24 return (locTrackMatch1->
dFOM > locTrackMatch2->
dFOM);
53 unsigned int loc_i, loc_j;
55 DLorentzVector locReconstructedFourMomentum, locReconstructedSpacetimeVertex;
59 map<const DMCThrown*, const DChargedTrack*> locTrackMap;
60 map<const DMCThrown*, const DChargedTrack*>::iterator locTrackMapIterator;
62 vector<const DMCThrown*> locMCThrownVector;
64 loop->Get(locMCThrownVector);
66 vector<const DChargedTrack*> locChargedTrackVector;
68 loop->Get(locChargedTrackVector);
72 double locFOM, locMinimumFOM = 0.1;
75 for(loc_i = 0; loc_i < locMCThrownVector.size(); loc_i++){
76 locMCThrown = locMCThrownVector[loc_i];
77 for(loc_j = 0; loc_j < locChargedTrackVector.size(); loc_j++){
78 locChargedTrack = locChargedTrackVector[loc_j];
80 if(locFOM > locMinimumFOM){
84 locTrackMatch->
dFOM = locFOM;
96 locTrackMap[locMCThrown] = locChargedTrack;
100 if(locTrackMatch->
dMCThrown == locMCThrown)
111 japp->RootWriteLock();
114 for(loc_i = 0; loc_i < locMCThrownVector.size(); loc_i++){
115 locMCThrown = locMCThrownVector[loc_i];
119 locThrownFourMomentum.SetVect(locMCThrown->
momentum());
120 locThrownFourMomentum.SetT(locMCThrown->
energy());
122 locThrownSpacetimeVertex.SetVect(locMCThrown->
position());
123 locThrownSpacetimeVertex.SetT(locMCThrown->t0());
126 locChargedTrack = NULL;
127 for(locTrackMapIterator = locTrackMap.begin(); locTrackMapIterator != locTrackMap.end(); locTrackMapIterator++){
128 if(locMCThrown == (*locTrackMapIterator).first){
129 locChargedTrack = (*locTrackMapIterator).second;
133 if(locChargedTrack == NULL){
144 locReconstructedHypothesis->
dPID = locChargedTrackHypothesis->dPID;
145 locReconstructedFourMomentum.SetVect(locChargedTrackHypothesis->dTrackTimeBased->
momentum());
146 locReconstructedFourMomentum.SetT(locChargedTrackHypothesis->dTrackTimeBased->
energy());
147 locReconstructedSpacetimeVertex.SetVect(locChargedTrackHypothesis->dTrackTimeBased->
position());
148 locReconstructedSpacetimeVertex.SetT(locChargedTrackHypothesis->dTrackTimeBased->
t0());
149 locReconstructedHypothesis->
dFourMomentum = locReconstructedFourMomentum;
150 locReconstructedHypothesis->
dSpacetimeVertex = locReconstructedSpacetimeVertex;
152 locReconstructedHypothesis->
dChiSq_Overall = locChargedTrackHypothesis->dChiSq;
153 locReconstructedHypothesis->
dNDF_Overall = locChargedTrackHypothesis->dNDF;
155 locReconstructedHypothesis->
dChiSq_Tracking = locChargedTrackHypothesis->dTrackTimeBased->chisq;
156 locReconstructedHypothesis->
dNDF_Tracking = locChargedTrackHypothesis->dTrackTimeBased->Ndof;
158 locReconstructedHypothesis->
dChiSq_DCdEdx = locChargedTrackHypothesis->dTrackTimeBased->chi2_dedx;
161 locReconstructedHypothesis->
dChiSq_Timing = locChargedTrackHypothesis->dChiSq_Timing;
162 locReconstructedHypothesis->
dNDF_Timing = locChargedTrackHypothesis->dNDF_Timing;
218 double epsilon = 1.0E-6;
220 double curature_a = 1.0/locMomentum_Track1.Mag();
221 double curature_b = 1.0/locMomentum_Track1.Mag();
222 double curvature_diff = fabs(curature_a - curature_b);
223 double curvature_fom = 1.0/(curvature_diff + epsilon);
225 double theta_rel = fabs(locMomentum_Track1.Angle(locMomentum_Track2));
226 double theta_fom = 1.0/(theta_rel + epsilon);
228 double fom = curvature_fom*theta_fom;
DLorentzVector dFourMomentum
bool Compare_TrackMatches(DEventProcessor_pidstudies_tree::plugin_trackmatch_t *locTrackMatch1, DEventProcessor_pidstudies_tree::plugin_trackmatch_t *locTrackMatch2)
double energy(void) const
jerror_t brun(JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
double Calc_MatchFOM(const DVector3 &locMomentum_Track1, const DVector3 &locMomentum_Track2) const
const DVector3 & position(void) const
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
TLorentzVector DLorentzVector
DLorentzVector dSpacetimeVertex
DLorentzVector dThrownSpacetimeVertex
jerror_t fini(void)
Called after last event of last event source has been processed.
vector< ReconstructedHypothesis * > dReconstructedHypothesisVector
DLorentzVector dThrownFourMomentum
TTree * dPluginTree_MCReconstructionStatuses
MCReconstructionStatuses * dMCReconstructionStatuses
jerror_t init(void)
Called once at program start.
const DChargedTrack * dChargedTrack
const DMCThrown * dMCThrown
jerror_t evnt(JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
vector< MCReconstructionStatus * > dMCReconstructionStatusVector
const DVector3 & momentum(void) const
int type
GEANT particle ID.
vector< const DChargedTrackHypothesis * > dChargedTrackHypotheses
vector< plugin_trackmatch_t * > dTrackMatches