1 #ifndef _DMCThrownMatching_
2 #define _DMCThrownMatching_
7 #include "JANA/JObject.h"
41 bool Get_MatchingChargedHypotheses(
const DMCThrown* locInputMCThrown, deque<const DChargedTrackHypothesis*>& locMatchingChargedHypotheses,
double& locMatchFOM)
const;
42 const DChargedTrack* Get_MatchingChargedTrack(
const DMCThrown* locInputMCThrown,
double& locMatchFOM)
const;
44 bool Get_MatchingNeutralHypotheses(
const DMCThrown* locInputMCThrown, deque<const DNeutralParticleHypothesis*>& locMatchingNeutralHypotheses,
double& locMatchFOM)
const;
59 const DTOFPoint* Get_MatchingTOFPoint(
const DTOFTruth* locTOFTruth,
double& locMatchFOM)
const;
60 const DTOFTruth* Get_MatchingTOFTruth(
const DTOFPoint* locTOFPoint,
double& locMatchFOM)
const;
70 inline void Get_ThrownToChargedHypoMap(map<
const DMCThrown*, pair<deque<const DChargedTrackHypothesis*>,
double> >& locThrownToChargedHypoMap)
const{locThrownToChargedHypoMap = dThrownToChargedHypoMap;}
73 inline void Get_ThrownToChargedMap(map<
const DMCThrown*, pair<const DChargedTrack*, double> >& locThrownToChargedMap)
const{locThrownToChargedMap = dThrownToChargedMap;}
76 inline void Get_ThrownToNeutralHypoMap(map<
const DMCThrown*, pair<deque<const DNeutralParticleHypothesis*>,
double> >& locThrownToNeutralHypoMap)
const{locThrownToNeutralHypoMap = dThrownToNeutralHypoMap;}
79 inline void Get_ThrownToNeutralMap(map<
const DMCThrown*, pair<const DNeutralParticle*, double> >& locThrownToNeutralMap)
const{locThrownToNeutralMap = dThrownToNeutralMap;}
81 inline void Get_TOFPointToTruthMap(map<
const DTOFPoint*, pair<const DTOFTruth*, double> >& locTOFPointToTruthMap)
const{locTOFPointToTruthMap = dTOFPointToTruthMap;}
82 inline void Get_TOFTruthToPointMap(map<
const DTOFTruth*, pair<const DTOFPoint*, double> >& locTOFTruthToPointMap)
const{locTOFTruthToPointMap = dTOFTruthToPointMap;}
84 inline void Get_BCALShowerToTruthMap(map<
const DBCALShower*, pair<const DBCALTruthShower*, double> >& locBCALShowerToTruthMap)
const{locBCALShowerToTruthMap = dBCALShowerToTruthMap;}
87 inline void Get_FCALShowerToTruthMap(map<
const DFCALShower*, pair<const DFCALTruthShower*, double> >& locFCALShowerToTruthMap)
const{locFCALShowerToTruthMap = dFCALShowerToTruthMap;}
92 inline void Set_ThrownToChargedHypoMap(
const map<
const DMCThrown*, pair<deque<const DChargedTrackHypothesis*>,
double> >& locThrownToChargedHypoMap){dThrownToChargedHypoMap = locThrownToChargedHypoMap;}
95 inline void Set_ThrownToChargedMap(
const map<
const DMCThrown*, pair<const DChargedTrack*, double> >& locThrownToChargedMap){dThrownToChargedMap = locThrownToChargedMap;}
98 inline void Set_ThrownToNeutralHypoMap(
const map<
const DMCThrown*, pair<deque<const DNeutralParticleHypothesis*>,
double> >& locThrownToNeutralHypoMap){dThrownToNeutralHypoMap = locThrownToNeutralHypoMap;}
101 inline void Set_ThrownToNeutralMap(
const map<
const DMCThrown*, pair<const DNeutralParticle*, double> >& locThrownToNeutralMap){dThrownToNeutralMap = locThrownToNeutralMap;}
112 inline void Set_BeamPhotonToTruthMap(map<const DBeamPhoton*, const DBeamPhoton*>& locBeamPhotonToTruthMap){dBeamPhotonToTruthMap = locBeamPhotonToTruthMap;}
113 inline void Set_BeamTruthToPhotonMap(map<const DBeamPhoton*, const DBeamPhoton*>& locBeamTruthToPhotonMap){dBeamTruthToPhotonMap = locBeamTruthToPhotonMap;}
151 map<const DBeamPhoton*, const DBeamPhoton*>::const_iterator locIterator = dBeamTruthToPhotonMap.find(locTruthBeamPhoton);
152 if(locIterator == dBeamTruthToPhotonMap.end())
154 return locIterator->second;
159 map<const DBeamPhoton*, const DBeamPhoton*>::const_iterator locIterator = dBeamPhotonToTruthMap.find(locReconBeamPhoton);
160 if(locIterator != dBeamPhotonToTruthMap.end())
161 return locIterator->second;
165 locReconBeamPhoton->GetSingle(locAssociatedBeamPhoton);
166 if(locAssociatedBeamPhoton == NULL)
168 return Get_MatchingTruthPhoton(locAssociatedBeamPhoton);
173 locMatchingChargedHypotheses.clear();
174 map<const DMCThrown*, pair<deque<const DChargedTrackHypothesis*>,
double> >::const_iterator locIterator = dThrownToChargedHypoMap.find(locInputMCThrown);
175 if(locIterator == dThrownToChargedHypoMap.end())
178 locMatchingChargedHypotheses = locIterator->second.first;
179 locMatchFOM = locIterator->second.second;
185 map<const DMCThrown*, pair<const DChargedTrack*, double> >::const_iterator locIterator = dThrownToChargedMap.find(locInputMCThrown);
186 if(locIterator == dThrownToChargedMap.end())
189 locMatchFOM = locIterator->second.second;
190 return locIterator->second.first;
195 map<const DMCThrown*, pair<deque<const DChargedTrackHypothesis*>,
double> >::const_iterator locIterator = dThrownToChargedHypoMap.find(locInputMCThrown);
196 if(locIterator == dThrownToChargedHypoMap.end())
198 deque<const DChargedTrackHypothesis*> locHypotheses = locIterator->second.first;
199 locMatchFOM = locIterator->second.second;
202 for(
size_t loc_i = 0; loc_i < locHypotheses.size(); ++loc_i)
204 if(locHypotheses[loc_i]->PID() == locInputMCThrown->
PID())
205 return locHypotheses[loc_i];
206 if(locBestHypothesis == NULL)
207 locBestHypothesis = locHypotheses[loc_i];
208 else if(locHypotheses[loc_i]->Get_FOM() > locBestHypothesis->
Get_FOM())
209 locBestHypothesis = locHypotheses[loc_i];
211 return locBestHypothesis;
216 map<const DMCThrown*, pair<deque<const DNeutralParticleHypothesis*>,
double> >::const_iterator locIterator = dThrownToNeutralHypoMap.find(locInputMCThrown);
217 if(locIterator == dThrownToNeutralHypoMap.end())
219 deque<const DNeutralParticleHypothesis*> locHypotheses = locIterator->second.first;
220 locMatchFOM = locIterator->second.second;
223 for(
size_t loc_i = 0; loc_i < locHypotheses.size(); ++loc_i)
225 if(locHypotheses[loc_i]->PID() == locInputMCThrown->
PID())
226 return locHypotheses[loc_i];
227 if(locBestHypothesis == NULL)
228 locBestHypothesis = locHypotheses[loc_i];
229 else if(locHypotheses[loc_i]->Get_FOM() > locBestHypothesis->
Get_FOM())
230 locBestHypothesis = locHypotheses[loc_i];
232 return locBestHypothesis;
237 locMatchingNeutralHypotheses.clear();
238 map<const DMCThrown*, pair<deque<const DNeutralParticleHypothesis*>,
double> >::const_iterator locIterator = dThrownToNeutralHypoMap.find(locInputMCThrown);
239 if(locIterator == dThrownToNeutralHypoMap.end())
241 locMatchFOM = locIterator->second.second;
242 locMatchingNeutralHypotheses = locIterator->second.first;
248 map<const DMCThrown*, pair<const DNeutralParticle*, double> >::const_iterator locIterator = dThrownToNeutralMap.find(locInputMCThrown);
249 if(locIterator == dThrownToNeutralMap.end())
251 locMatchFOM = locIterator->second.second;
252 return locIterator->second.first;
257 map<const DChargedTrackHypothesis*, pair<const DMCThrown*, double> >::const_iterator locIterator = dChargedHypoToThrownMap.find(locChargedTrackHypothesis);
258 if(locIterator != dChargedHypoToThrownMap.end())
260 locMatchFOM = locIterator->second.second;
261 return locIterator->second.first;
265 vector<const DChargedTrack*> locAssociatedChargedTracks;
266 locChargedTrackHypothesis->Get(locAssociatedChargedTracks);
267 for(
size_t loc_i = 0; loc_i < locAssociatedChargedTracks.size(); ++loc_i)
269 const DMCThrown* locMCThrown = Get_MatchingMCThrown(locAssociatedChargedTracks[loc_i], locMatchFOM);
270 if(locMCThrown != NULL)
278 auto locIterator = dChargedToThrownMap.find(locChargedTrack);
279 if(locIterator != dChargedToThrownMap.end())
281 locMatchFOM = locIterator->second.second;
282 return locIterator->second.first;
286 vector<const DChargedTrack*> locAssocTracks;
287 locChargedTrack->Get(locAssocTracks);
288 if(locAssocTracks.empty())
291 return Get_MatchingMCThrown(locAssocTracks[0], locMatchFOM);
296 map<const DNeutralParticleHypothesis*, pair<const DMCThrown*, double> >::const_iterator locIterator = dNeutralHypoToThrownMap.find(locNeutralParticleHypothesis);
297 if(locIterator != dNeutralHypoToThrownMap.end())
299 locMatchFOM = locIterator->second.second;
300 return locIterator->second.first;
304 if(locAssociatedNeutralShower_Input == NULL)
308 map<const DNeutralParticle*, pair<const DMCThrown*, double> >::const_iterator locParticleIterator;
309 for(locParticleIterator = dNeutralToThrownMap.begin(); locParticleIterator != dNeutralToThrownMap.end(); ++locParticleIterator)
311 auto locAssociatedNeutralShower_Check = locParticleIterator->first->dNeutralShower;
312 if(locAssociatedNeutralShower_Check->dShowerID == locAssociatedNeutralShower_Input->
dShowerID)
314 locMatchFOM = locParticleIterator->second.second;
315 return locParticleIterator->second.first;
323 map<const DNeutralParticle*, pair<const DMCThrown*, double> >::const_iterator locIterator = dNeutralToThrownMap.find(locNeutralParticle);
324 if(locIterator == dNeutralToThrownMap.end())
326 locMatchFOM = locIterator->second.second;
327 return locIterator->second.first;
332 map<const DNeutralParticle*, pair<const DMCThrown*, double> >::const_iterator locIterator = dNeutralToThrownMap.begin();
333 for(; locIterator != dNeutralToThrownMap.end(); ++locIterator)
335 if(locIterator->first->dNeutralShower != locNeutralShower)
337 locMatchFOM = locIterator->second.second;
338 return locIterator->second.first;
345 map<const DMCThrown*, pair<const DNeutralParticle*, double> >::const_iterator locIterator = dThrownToNeutralMap.begin();
346 for(; locIterator != dThrownToNeutralMap.end(); ++locIterator)
348 if(locIterator->first != locInputMCThrown)
350 locMatchFOM = locIterator->second.second;
351 return locIterator->second.first->dNeutralShower;
358 map<const DTOFTruth*, pair<const DTOFPoint*, double> >::const_iterator locIterator = dTOFTruthToPointMap.find(locTOFTruth);
359 if(locIterator == dTOFTruthToPointMap.end())
361 locMatchFOM = locIterator->second.second;
362 return locIterator->second.first;
367 map<const DTOFPoint*, pair<const DTOFTruth*, double> >::const_iterator locIterator = dTOFPointToTruthMap.find(locTOFPoint);
368 if(locIterator == dTOFPointToTruthMap.end())
370 locMatchFOM = locIterator->second.second;
371 return locIterator->second.first;
376 map<const DBCALTruthShower*, pair<const DBCALShower*, double> >::const_iterator locIterator = dBCALTruthToShowerMap.find(locBCALTruthShower);
377 if(locIterator == dBCALTruthToShowerMap.end())
379 locMatchFOM = locIterator->second.second;
380 return locIterator->second.first;
385 map<const DBCALShower*, pair<const DBCALTruthShower*, double> >::const_iterator locIterator = dBCALShowerToTruthMap.find(locBCALShower);
386 if(locIterator == dBCALShowerToTruthMap.end())
388 locMatchFOM = locIterator->second.second;
389 return locIterator->second.first;
394 map<const DFCALTruthShower*, pair<const DFCALShower*, double> >::const_iterator locIterator = dFCALTruthToShowerMap.find(locFCALTruthShower);
395 if(locIterator == dFCALTruthToShowerMap.end())
397 locMatchFOM = locIterator->second.second;
398 return locIterator->second.first;
403 map<const DFCALShower*, pair<const DFCALTruthShower*, double> >::const_iterator locIterator = dFCALShowerToTruthMap.find(locFCALShower);
404 if(locIterator == dFCALShowerToTruthMap.end())
406 locMatchFOM = locIterator->second.second;
407 return locIterator->second.first;
410 #endif // _DMCThrownMatching_
void Set_ThrownToChargedMap(const map< const DMCThrown *, pair< const DChargedTrack *, double > > &locThrownToChargedMap)
void Set_ThrownToNeutralMap(const map< const DMCThrown *, pair< const DNeutralParticle *, double > > &locThrownToNeutralMap)
map< const DMCThrown *, pair< deque< const DChargedTrackHypothesis * >, double > > dThrownToChargedHypoMap
const DBeamPhoton * dTaggedMCGENBeamPhoton
map< const DMCThrown *, pair< deque< const DNeutralParticleHypothesis * >, double > > dThrownToNeutralHypoMap
void Set_FCALTruthToShowerMap(map< const DFCALTruthShower *, pair< const DFCALShower *, double > > &locFCALTruthToShowerMap)
void Set_FCALShowerToTruthMap(map< const DFCALShower *, pair< const DFCALTruthShower *, double > > &locFCALShowerToTruthMap)
void Get_ThrownToChargedMap(map< const DMCThrown *, pair< const DChargedTrack *, double > > &locThrownToChargedMap) const
const DBeamPhoton * Get_MatchingTruthPhoton(const DBeamPhoton *locReconBeamPhoton) const
map< const DBCALTruthShower *, pair< const DBCALShower *, double > > dBCALTruthToShowerMap
const DBeamPhoton * Get_MatchingReconPhoton(const DBeamPhoton *locTruthBeamPhoton) const
void Set_NeutralHypoToThrownMap(const map< const DNeutralParticleHypothesis *, pair< const DMCThrown *, double > > &locNeutralHypoToThrownMap)
void Get_BCALTruthToShowerMap(map< const DBCALTruthShower *, pair< const DBCALShower *, double > > &locBCALTruthToShowerMap) const
map< const DChargedTrack *, pair< const DMCThrown *, double > > dChargedToThrownMap
void Get_ChargedToThrownMap(map< const DChargedTrack *, pair< const DMCThrown *, double > > &locChargedToThrownMap) const
double Get_FOM(void) const
void Set_BCALTruthToShowerMap(map< const DBCALTruthShower *, pair< const DBCALShower *, double > > &locBCALTruthToShowerMap)
const DBeamPhoton * Get_MCGENBeamPhoton(void) const
map< const DBeamPhoton *, const DBeamPhoton * > dBeamPhotonToTruthMap
map< const DBCALShower *, pair< const DBCALTruthShower *, double > > dBCALShowerToTruthMap
void Set_TOFTruthToPointMap(const map< const DTOFTruth *, pair< const DTOFPoint *, double > > &locTOFTruthToPointMap)
map< const DFCALTruthShower *, pair< const DFCALShower *, double > > dFCALTruthToShowerMap
const DNeutralShower * Get_NeutralShower(void) const
void Set_TaggedMCGENBeamPhoton(const DBeamPhoton *locBeamPhoton)
const DFCALShower * Get_MatchingFCALShower(const DFCALTruthShower *locFCALTruthShower, double &locMatchFOM) const
void Set_ThrownToChargedHypoMap(const map< const DMCThrown *, pair< deque< const DChargedTrackHypothesis * >, double > > &locThrownToChargedHypoMap)
map< const DMCThrown *, pair< const DChargedTrack *, double > > dThrownToChargedMap
map< const DChargedTrackHypothesis *, pair< const DMCThrown *, double > > dChargedHypoToThrownMap
void Get_NeutralToThrownMap(map< const DNeutralParticle *, pair< const DMCThrown *, double > > &locNeutralToThrownMap) const
void Set_ThrownToNeutralHypoMap(const map< const DMCThrown *, pair< deque< const DNeutralParticleHypothesis * >, double > > &locThrownToNeutralHypoMap)
const DTOFPoint * Get_MatchingTOFPoint(const DTOFTruth *locTOFTruth, double &locMatchFOM) const
bool Get_MatchingChargedHypotheses(const DMCThrown *locInputMCThrown, deque< const DChargedTrackHypothesis * > &locMatchingChargedHypotheses, double &locMatchFOM) const
const DChargedTrack * Get_MatchingChargedTrack(const DMCThrown *locInputMCThrown, double &locMatchFOM) const
double Get_FOM(void) const
map< const DTOFPoint *, pair< const DTOFTruth *, double > > dTOFPointToTruthMap
void Get_TOFTruthToPointMap(map< const DTOFTruth *, pair< const DTOFPoint *, double > > &locTOFTruthToPointMap) const
void Get_ChargedHypoToThrownMap(map< const DChargedTrackHypothesis *, pair< const DMCThrown *, double > > &locChargedHypoToThrownMap) const
const DNeutralShower * Get_MatchingNeutralShower(const DMCThrown *locInputMCThrown, double &locMatchFOM) const
void Set_BeamTruthToPhotonMap(map< const DBeamPhoton *, const DBeamPhoton * > &locBeamTruthToPhotonMap)
const DBeamPhoton * Get_TaggedMCGENBeamPhoton(void) const
void Set_TOFPointToTruthMap(const map< const DTOFPoint *, pair< const DTOFTruth *, double > > &locTOFPointToTruthMap)
const DNeutralParticle * Get_MatchingNeutralParticle(const DMCThrown *locInputMCThrown, double &locMatchFOM) const
map< const DBeamPhoton *, const DBeamPhoton * > dBeamTruthToPhotonMap
const DBCALTruthShower * Get_MatchingBCALTruthShower(const DBCALShower *locBCALShower, double &locMatchFOM) const
void Get_TOFPointToTruthMap(map< const DTOFPoint *, pair< const DTOFTruth *, double > > &locTOFPointToTruthMap) const
void Set_ChargedToThrownMap(const map< const DChargedTrack *, pair< const DMCThrown *, double > > &locChargedToThrownMap)
const DTOFTruth * Get_MatchingTOFTruth(const DTOFPoint *locTOFPoint, double &locMatchFOM) const
void Set_NeutralToThrownMap(const map< const DNeutralParticle *, pair< const DMCThrown *, double > > &locNeutralToThrownMap)
void Get_FCALTruthToShowerMap(map< const DFCALTruthShower *, pair< const DFCALShower *, double > > &locFCALTruthToShowerMap) const
void Get_NeutralHypoToThrownMap(map< const DNeutralParticleHypothesis *, pair< const DMCThrown *, double > > &locNeutralHypoToThrownMap) const
map< const DFCALShower *, pair< const DFCALTruthShower *, double > > dFCALShowerToTruthMap
void Get_ThrownToNeutralMap(map< const DMCThrown *, pair< const DNeutralParticle *, double > > &locThrownToNeutralMap) const
void Set_MCGENBeamPhoton(const DBeamPhoton *locBeamPhoton)
const DFCALTruthShower * Get_MatchingFCALTruthShower(const DFCALShower *locFCALShower, double &locMatchFOM) const
void Get_BCALShowerToTruthMap(map< const DBCALShower *, pair< const DBCALTruthShower *, double > > &locBCALShowerToTruthMap) const
const DBeamPhoton * dMCGENBeamPhoton
void Set_ChargedHypoToThrownMap(const map< const DChargedTrackHypothesis *, pair< const DMCThrown *, double > > &locChargedHypoToThrownMap)
void Set_BeamPhotonToTruthMap(map< const DBeamPhoton *, const DBeamPhoton * > &locBeamPhotonToTruthMap)
const DBCALShower * Get_MatchingBCALShower(const DBCALTruthShower *locBCALTruthShower, double &locMatchFOM) const
map< const DMCThrown *, pair< const DNeutralParticle *, double > > dThrownToNeutralMap
void Get_ThrownToChargedHypoMap(map< const DMCThrown *, pair< deque< const DChargedTrackHypothesis * >, double > > &locThrownToChargedHypoMap) const
map< const DNeutralParticle *, pair< const DMCThrown *, double > > dNeutralToThrownMap
void Set_BCALShowerToTruthMap(map< const DBCALShower *, pair< const DBCALTruthShower *, double > > &locBCALShowerToTruthMap)
void Get_FCALShowerToTruthMap(map< const DFCALShower *, pair< const DFCALTruthShower *, double > > &locFCALShowerToTruthMap) const
map< const DTOFTruth *, pair< const DTOFPoint *, double > > dTOFTruthToPointMap
bool Get_MatchingNeutralHypotheses(const DMCThrown *locInputMCThrown, deque< const DNeutralParticleHypothesis * > &locMatchingNeutralHypotheses, double &locMatchFOM) const
const DChargedTrackHypothesis * Get_MatchingChargedHypothesis(const DMCThrown *locInputMCThrown, double &locMatchFOM) const
const DNeutralParticleHypothesis * Get_MatchingNeutralHypothesis(const DMCThrown *locInputMCThrown, double &locMatchFOM) const
map< const DNeutralParticleHypothesis *, pair< const DMCThrown *, double > > dNeutralHypoToThrownMap
Particle_t PID(void) const
const DMCThrown * Get_MatchingMCThrown(const DChargedTrackHypothesis *locChargedTrackHypothesis, double &locMatchFOM) const
void Get_ThrownToNeutralHypoMap(map< const DMCThrown *, pair< deque< const DNeutralParticleHypothesis * >, double > > &locThrownToNeutralHypoMap) const