8 #include <marlin/Global.h>
9 #include <gear/BField.h>
11 #include <EVENT/LCCollection.h>
12 #include <IMPL/LCCollectionVec.h>
13 #include <IMPL/ReconstructedParticleImpl.h>
17 using namespace lcio ;
18 using namespace marlin ;
25 _description =
"Processor to convert track collection into ReconstructedParticle collection" ;
28 registerInputCollection( LCIO::TRACK,
29 "InputTrackCollection",
30 "Input track collection to convert",
32 std::string(
"InputTracks") );
35 registerOutputCollection( LCIO::RECONSTRUCTEDPARTICLE,
36 "OutputPFOCollection",
39 std::string(
"ConvertedTrackAsPFO") );
56 const double c = 2.99792458e8;
58 const double mm2m = 1
e-3;
59 const double eV2GeV = 1
e-9;
60 const double eB = B*c*mm2m*eV2GeV;
61 const double pi_mass = 0.13957018;
62 const double pi_mass_sq = pi_mass*pi_mass;
64 unsigned int ntrk = trkCol->getNumberOfElements();
65 for (
unsigned int i = 0; i < ntrk; i++ ) {
66 Track* trk =
dynamic_cast<Track*
>( trkCol->getElementAt(i) );
67 ReconstructedParticleImpl* rp =
new ReconstructedParticleImpl();
70 double om = trk->getOmega();
71 double td = trk->getTanLambda();
72 double cd = 1./sqrt(1+td*td);
74 double cph = cos(trk->getPhi());
75 double sph = sin(trk->getPhi());
76 double pT = eB/fabs(om);
82 double e = sqrt( pi_mass_sq + px*px + py*py + pz*pz );
83 double mom[3] = { px, py, pz };
88 double bz = marlin::Global::GEAR->getBField().at(
gear::Vector3D(0.,0.,0.)).z();
89 int signbz = (bz > 0 ? 1 : -1);
90 int signom = (om > 0 ? 1 : -1);
92 double chrg = signbz * signom;
93 rp->setCharge( chrg );
95 outCol->addElement( rp );
virtual ~TrackToRecoParticleConverter()
CLHEP::Hep3Vector Vector3D
virtual void processRunHeader(LCRunHeader *run)
Called for every run.
virtual void check(LCEvent *evt)
virtual void end()
Called after data processing for clean up.
std::string _inputTrackCollectionName
Input collection name.
virtual void init()
Called at the begin of the job before anything is read.
std::vector< LCCollection * > LCCollectionVec
Simple creation of ReconstructedParticle collection encapsulating tracks.
std::string _outputPFOCollectionName
TrackToRecoParticleConverter aTrackToRecoParticleConverter
TrackToRecoParticleConverter()
virtual void processEvent(LCEvent *evt)
Called for every event - the working horse.