// ----------------------------------------------------------------------------
// $Id: LCDTrackRecSmear.cxx,v 1.2 2001/06/23 16:17:08 toshi Exp $
// ----------------------------------------------------------------------------
//
// $Log: LCDTrackRecSmear.cxx,v $
// Revision 1.2 2001/06/23 16:17:08 toshi
// In method arg. , Char_t* -> const Char_t* .
//
// Revision 1.1 2001/05/10 18:29:07 toshi
// C++ file name convention has been changed from *.C to *.cxx .
//
//
#include "LCDTrackRecSmear.h"
#include "LCDSmearTrack.h"
//#include "LCDTrack.h"
#include "LCDTracker_Hit.h"
#include "LCDVXD_Hit.h"
ClassImp(LCDTrackRecSmear)
//----------------------------------------------------------------------
// constructor: create everything
LCDTrackRecSmear::LCDTrackRecSmear(LCDGetParameters* gp,
const Char_t* smearFileName) {
m_recon = new LCDSmearTrack(gp, smearFileName);
m_parameters = gp;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
LCDTrackRecSmear::~LCDTrackRecSmear() {
if (m_recon)
delete m_recon;
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
void
LCDTrackRecSmear::Cleanup(LCDEvent* event) {
if (event) {
event->Tracks()->Delete();
}
}
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// execute: 'reconstruct' the tracks from McPart
void
LCDTrackRecSmear::Doit(LCDEvent* event) {
TClonesArray* McPList = event->MCparticles();
TClonesArray* TrackerList = event->Tracker();
TClonesArray* VXDList = event->VXD();
// create tracks for particles within the acceptance
Int_t nparts = McPList->GetEntries();
LCDMcPart* mcP;
Int_t statusCode;
Int_t decayed;
TVector3 p;
Double_t pTot;
Int_t nHits;
LCDMcPart* mcPtrkr;
Int_t index;
Int_t nTrkHits;
Int_t trkr;
LCDTracker_Hit* tkHit;
Int_t nVXDHits;
Int_t vxd;
LCDVXD_Hit* vxdHit;
Int_t index0;
LCDTrack* tk;
Int_t part;
Int_t ntrk=0;
for(part=0; part< nparts; part++) {
mcP = (LCDMcPart*)McPList->At(part);
statusCode = mcP->GetStatus();
// these are Gismo status codes: 8 = PRIMARY; 1 = DECAYED.
decayed = ( statusCode==8 || statusCode==1 );
if ( decayed ) continue;
if (mcP->GetCharge() == 0) continue;
p = (*mcP->Get4MomentumPtr()).Vect();
pTot = p.Mag();
// find out how many hits in the VXD and Tracker come from this mcP
nHits = 0;
index = -1;
nTrkHits = TrackerList->GetEntries();
for (trkr=0 ; trkr < nTrkHits ; trkr++) {
tkHit = (LCDTracker_Hit*)TrackerList->At(trkr);
index = tkHit->GetParticle();
if ( index >= 0 ) {
mcPtrkr = (LCDMcPart*)McPList->At(index);
if ( mcPtrkr == mcP ) nHits += 1;
}
}
nVXDHits = VXDList->GetEntries();
for (vxd=0 ; vxd < nVXDHits ; vxd++) {
vxdHit = (LCDVXD_Hit*)VXDList->At(vxd);
index = vxdHit->GetParticle();
if ( index >= 0 ) {
mcPtrkr = (LCDMcPart*)McPList->At(index);
if ( mcPtrkr == mcP ) nHits += 1;
}
}
index = part;
// Temp
index0 = mcP->GetParentIdx();
if ( (nHits >= m_parameters->GetMinHit()) &&
(pTot > m_parameters->GetPTMin() ) ){
tk=new((*event->Tracks())[ntrk++]) LCDTrack();
m_recon->SmearTrack(mcP,index,index0,m_parameters,tk);
}
}
}
//----------------------------------------------------------------------
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.