10 #ifndef CHEAT_BACKTRACKER_H 11 #define CHEAT_BACKTRACKER_H 14 #include <unordered_map> 19 #include "NovaDAQConventions/DAQConventions.h" 105 Atom<double> MinContribFrac{
Name(
"MinContribFrac"),
Comment(
"Minimum fractional contribution a particle must make to a CellHit's energy to be counted"), 0.1};
106 Atom<int> MinPhysicsHits{
Name(
"MinPhysicsHits"),
Comment(
"Minimum number of hits in a cluster that are not noise for the function IsHitsNoise to return false"), 4};
107 Atom<double> MinPhysicsFrac{
Name(
"MinPhysicsFrac"),
Comment(
"If cluster fails to have MinPhysicsHits, can still have function IsHitsNoise return false if fraction of physics hits is at least MinPhysicsFrac"), 0.5};
142 const std::vector<sim::PhotonSignal> CellToPhotonSignal(
unsigned int const&
plane,
143 unsigned int const&
cell)
const;
159 const std::vector<sim::FLSHit> CellToFLSHit(
unsigned int const& plane,
160 unsigned int const& cell)
const;
164 std::vector<sim::FLSHit> HitToFLSHit(
const rb::CellHit& hit)
const;
168 return HitToFLSHit(*hit);
173 std::vector<sim::FLSHit> ParticleToFLSHit(
const int&
trackID)
const;
183 std::vector<sim::FLSHit> ParticleToFLSHit(
const int trackID,
const int pdg)
const;
187 const double EnergyFromTrackId(
const art::Ptr<rb::CellHit>& hit,
int trackId,
bool useBirksE =
false)
const;
192 bool quiet =
false)
const;
197 bool quiet =
false)
const;
210 const sim::Particle* TrackIDToMotherParticle(
int const&
id)
const;
227 std::vector<const sim::Particle*> HitsToParticle(
const std::vector<const rb::CellHit*>&
hits)
const;
228 std::vector<const sim::Particle*>
HitsToParticle(
const std::vector<rb::CellHit>& hits)
const 230 return HitsToParticle(VecToVecRawPtr(hits));
234 return HitsToParticle(VecPtrToVecRawPtr(hits));
238 return HitsToParticle(PtrVecToVecRawPtr(hits));
246 std::vector<TrackIDE> HitsToTrackIDE(
const std::vector<const rb::CellHit*>& hits,
bool useBirksE =
false)
const;
248 std::vector<TrackIDE>
HitsToTrackIDE(
const std::vector<rb::CellHit>& hits,
bool useBirksE =
false)
const 250 return HitsToTrackIDE(VecToVecRawPtr(hits), useBirksE);
255 return HitsToTrackIDE(VecPtrToVecRawPtr(hits), useBirksE);
260 return HitsToTrackIDE(PtrVecToVecRawPtr(hits), useBirksE);
264 std::vector<TrackIDE> HitToTrackIDE(
const rb::CellHit& hit,
bool useBirksE =
false)
const;
272 double HitCollectionPurity(
const std::set<int>& trackIDs,
273 const std::vector<rb::WeightedHit>& whits,
274 std::map<int, double>* purMap = 0,
275 std::map<int, int>* parents = 0,
276 bool energyPur =
false)
const;
287 double HitCollectionPurity(
const std::set<int>& trackIDs,
288 const std::vector<const rb::CellHit*>& hits,
289 std::map<int, double>* purMap = 0,
290 std::map<int, int>* parents = 0,
291 bool energyPur =
false)
const;
294 const std::vector<rb::CellHit>& hits,
295 std::map<int, double>* purMap = 0,
296 std::map<int, int>* parents = 0,
297 bool energyPur =
false)
const 299 return HitCollectionPurity(trackIDs, VecToVecRawPtr(hits), purMap, parents, energyPur);
304 std::map<int, double>* purMap = 0,
305 std::map<int, int>* parents = 0,
306 bool energyPur =
false)
const 308 return HitCollectionPurity(trackIDs, VecPtrToVecRawPtr(hits), purMap, parents, energyPur);
313 std::map<int, double>* purMap = 0,
314 std::map<int, int>* parents = 0,
315 bool energyPur =
false)
const 317 return HitCollectionPurity(trackIDs, PtrVecToVecRawPtr(hits), purMap, parents, energyPur);
326 double HitCollectionEfficiency(
const std::set<int>& trackIDs,
327 const std::vector<rb::WeightedHit>& whits,
328 const std::vector<const rb::CellHit*>& allhits,
330 std::map<int, double>* effMap = 0,
331 bool energyEff =
false,
332 double* desiredEnergy = 0,
334 int* desiredHits = 0,
335 int* totalHits = 0)
const;
338 const std::vector<rb::WeightedHit>& whits,
339 const std::vector<rb::CellHit>& allhits,
341 std::map<int, double>* effMap = 0,
342 bool energyEff =
false,
343 double* desiredEnergy = 0,
345 int* desiredHits = 0,
346 int* totalHits = 0)
const 348 return HitCollectionEfficiency(trackIDs, whits, VecToVecRawPtr(allhits), view, effMap, energyEff, desiredEnergy,
totalEnergy, desiredHits, totalHits);
352 const std::vector<rb::WeightedHit>& whits,
355 std::map<int, double>* effMap = 0,
356 bool energyEff =
false,
357 double* desiredEnergy = 0,
359 int* desiredHits = 0,
360 int* totalHits = 0)
const 362 return HitCollectionEfficiency(trackIDs, whits, VecPtrToVecRawPtr(allhits), view, effMap, energyEff, desiredEnergy,
totalEnergy, desiredHits, totalHits);
366 const std::vector<rb::WeightedHit>& whits,
369 std::map<int, double>* effMap = 0,
370 bool energyEff =
false,
371 double* desiredEnergy = 0,
373 int* desiredHits = 0,
374 int* totalHits = 0)
const 376 return HitCollectionEfficiency(trackIDs, whits, PtrVecToVecRawPtr(allhits), view, effMap, energyEff, desiredEnergy,
totalEnergy, desiredHits, totalHits);
390 double HitCollectionEfficiency(
const std::set<int>& trackIDs,
391 const std::vector<const rb::CellHit*>& hits,
392 const std::vector<const rb::CellHit*>& allhits,
394 std::map<int, double>* effMap = 0,
395 bool energyEff =
false,
396 double* desiredEnergy = 0,
398 int* desiredHits = 0,
399 int* totalHits = 0)
const;
402 const std::vector<rb::CellHit>& hits,
403 const std::vector<rb::CellHit>& allhits,
405 std::map<int, double>* effMap = 0,
406 bool energyEff =
false,
407 double* desiredEnergy = 0,
409 int* desiredHits = 0,
410 int* totalHits = 0)
const 412 return HitCollectionEfficiency(trackIDs,
413 VecToVecRawPtr(hits),
414 VecToVecRawPtr(allhits),
416 effMap, energyEff, desiredEnergy,
424 std::map<int, double>* effMap = 0,
425 bool energyEff =
false,
426 double* desiredEnergy = 0,
428 int* desiredHits = 0,
429 int* totalHits = 0)
const 431 return HitCollectionEfficiency(trackIDs,
432 VecPtrToVecRawPtr(hits),
433 VecPtrToVecRawPtr(allhits),
435 effMap, energyEff, desiredEnergy,
443 std::map<int, double>* effMap = 0,
444 bool energyEff =
false,
445 double* desiredEnergy = 0,
447 int* desiredHits = 0,
448 int* totalHits = 0)
const 450 return HitCollectionEfficiency(trackIDs,
451 PtrVecToVecRawPtr(hits),
452 PtrVecToVecRawPtr(allhits),
454 effMap, energyEff, desiredEnergy,
469 static bool sort_idxeff(
const std::pair<int,NeutrinoEffPur>& a,
const std::pair<int,NeutrinoEffPur>& b);
472 static bool sort_idxpur(
const std::pair<int,NeutrinoEffPur>& a,
const std::pair<int,NeutrinoEffPur>& b);
478 SliceToNeutrinoIndex(
const std::vector<const rb::CellHit*>& sliceHits,
479 const std::vector<const rb::CellHit*>& allHits,
480 bool sortPur =
false)
const;
486 std::vector<NeutrinoEffPur>
487 SliceToNeutrinoInteractions(
const std::vector<const rb::CellHit*>& sliceHits,
488 const std::vector<const rb::CellHit*>& allHits,
489 bool sortPur =
false)
const;
491 std::vector<NeutrinoEffPur>
493 const std::vector<rb::CellHit>& allHits,
494 bool sortPur =
false)
const 496 return SliceToNeutrinoInteractions(VecToVecRawPtr(sliceHits),
497 VecToVecRawPtr(allHits),
501 std::vector<NeutrinoEffPur>
504 bool sortPur =
false)
const 506 return SliceToNeutrinoInteractions(VecPtrToVecRawPtr(sliceHits),
507 VecPtrToVecRawPtr(allHits),
511 std::vector<NeutrinoEffPur>
514 bool sortPur =
false)
const 516 return SliceToNeutrinoInteractions(PtrVecToVecRawPtr(sliceHits),
517 PtrVecToVecRawPtr(allHits),
521 std::vector<NeutrinoEffPur>
523 const std::vector<const rb::CellHit*>& allHits,
524 bool sortPur =
false)
const;
526 std::vector<NeutrinoEffPur>
528 const std::vector<rb::CellHit>& allHits,
529 bool sortPur =
false)
const 531 return SliceToNeutrinoInteractions(sliceCluster,
532 VecToVecRawPtr(allHits),
536 std::vector<NeutrinoEffPur>
539 bool sortPur =
false)
const 541 return SliceToNeutrinoInteractions(sliceCluster,
542 VecPtrToVecRawPtr(allHits),
546 std::vector<NeutrinoEffPur>
549 bool sortPur =
false)
const 551 return SliceToNeutrinoInteractions(sliceCluster,
552 PtrVecToVecRawPtr(allHits),
560 std::vector <int> SliceToOrderedNuIds(
const std::vector<cheat::NeutrinoWithIndex>& nusWithIdx,
561 const std::vector<std::vector<cheat::NeutrinoEffPur>>& slTruthTable,
565 std::vector <int> SliceToOrderedNuIdsByEff(
const std::vector<cheat::NeutrinoWithIndex>& nusWithIdx,
566 const std::vector<std::vector<cheat::NeutrinoEffPur>>& slTruthTable)
const;
568 std::vector <int> SliceToOrderedNuIdsByPur(
const std::vector<cheat::NeutrinoWithIndex>& nusWithIdx,
569 const std::vector<std::vector<cheat::NeutrinoEffPur>>& slTruthTable)
const;
571 std::vector <int> SliceToOrderedNuIdsByEffPur(
const std::vector<cheat::NeutrinoWithIndex>& nusWithIdx,
572 const std::vector<std::vector<cheat::NeutrinoEffPur>>& slTruthTable)
const;
574 std::vector <int> SliceToOrderedNuIdsByEnergy(
const std::vector<cheat::NeutrinoWithIndex>& nusWithIdx,
575 const std::vector<std::vector<cheat::NeutrinoEffPur>>& slTruthTable)
const;
582 std::vector<NeutrinoEffPur>
583 SliceToMCTruth(
const std::vector<const rb::CellHit*>& sliceHits,
584 const std::vector<const rb::CellHit*>& allHits,
585 bool sortPur =
false)
const;
587 std::vector<NeutrinoEffPur>
589 const std::vector<rb::CellHit>& allHits,
590 bool sortPur =
false)
const 592 return SliceToMCTruth(VecToVecRawPtr(sliceHits),
593 VecToVecRawPtr(allHits),
597 std::vector<NeutrinoEffPur>
600 bool sortPur =
false)
const 602 return SliceToMCTruth(VecPtrToVecRawPtr(sliceHits),
603 VecPtrToVecRawPtr(allHits),
607 std::vector<NeutrinoEffPur>
610 bool sortPur =
false)
const 612 return SliceToMCTruth(PtrVecToVecRawPtr(sliceHits),
613 PtrVecToVecRawPtr(allHits),
617 std::vector<NeutrinoEffPur>
619 const std::vector<const rb::CellHit*>& allHits,
620 bool sortPur =
false)
const;
622 std::vector<NeutrinoEffPur>
624 const std::vector<rb::CellHit>& allHits,
625 bool sortPur =
false)
const 627 return SliceToMCTruth(sliceCluster, VecToVecRawPtr(allHits), sortPur);
630 std::vector<NeutrinoEffPur>
633 bool sortPur =
false)
const 635 return SliceToMCTruth(sliceCluster, VecPtrToVecRawPtr(allHits), sortPur);
638 std::vector<NeutrinoEffPur>
641 bool sortPur =
false)
const 643 return SliceToMCTruth(sliceCluster, PtrVecToVecRawPtr(allHits), sortPur);
655 std::vector<std::vector<cheat::NeutrinoEffPur>>
656 SlicesToMCTruthsTable(
const std::vector<const rb::Cluster*>& sliceList)
const;
658 std::vector<std::vector<cheat::NeutrinoEffPur>>
661 return SlicesToMCTruthsTable(VecToVecRawPtr(sliceList));
664 std::vector<std::vector<cheat::NeutrinoEffPur>>
667 return SlicesToMCTruthsTable(VecPtrToVecRawPtr(sliceList));
670 std::vector<std::vector<cheat::NeutrinoEffPur>>
673 return SlicesToMCTruthsTable(PtrVecToVecRawPtr(sliceList));
687 std::vector<ParticleEffPur>
688 TracksToParticles(
const std::vector<const rb::Track*>& tracks,
689 const std::set<int>& trkIDs,
690 const std::set<int>& allowedDaughters,
691 const std::vector<const rb::CellHit*>& allHits)
const;
693 std::vector<ParticleEffPur>
695 const std::set<int>& trkIDs,
696 const std::set<int>& allowedDaughters,
697 const std::vector<rb::CellHit>& allHits)
const 699 return TracksToParticles(VecToVecRawPtr(tracks),
700 trkIDs, allowedDaughters,
701 VecToVecRawPtr(allHits));
704 std::vector<ParticleEffPur>
706 const std::set<int>& trkIDs,
707 const std::set<int>& allowedDaughters,
710 return TracksToParticles(VecPtrToVecRawPtr(tracks),
711 trkIDs, allowedDaughters,
712 VecPtrToVecRawPtr(allHits));
715 std::vector<ParticleEffPur>
717 const std::set<int>& trkIDs,
718 const std::set<int>& allowedDaughters,
721 return TracksToParticles(PtrVecToVecRawPtr(tracks),
722 trkIDs, allowedDaughters,
723 PtrVecToVecRawPtr(allHits));
726 std::vector<ParticleEffPur>
728 const std::set<int>& trkIDs,
729 const std::set<int>& allowedDaughters,
732 return TracksToParticles(VecPtrToVecRawPtr(tracks),
733 trkIDs, allowedDaughters,
734 PtrVecToVecRawPtr(allHits));
739 std::vector <NeutrinoWithIndex> allNeutrinoInteractions()
const;
741 std::vector <NeutrinoWithIndex> allMCTruth()
const;
769 void HitToParticlesMap(
const std::vector<const rb::Cluster*>& sliceList,
770 const int& sliceIdx);
775 return HitToParticlesMap(VecToVecRawPtr(sliceList), sliceIdx);
781 return HitToParticlesMap(VecPtrToVecRawPtr(sliceList), sliceIdx);
787 return HitToParticlesMap(PtrVecToVecRawPtr(sliceList), sliceIdx);
791 const std::vector<const rb::CellHit*>& hits,
792 const int& sliceIdx);
795 const std::vector<rb::CellHit>& hits,
798 return ClusterToParticle(VecToVecRawPtr(sliceList),
799 VecToVecRawPtr(hits),
807 return ClusterToParticle(VecPtrToVecRawPtr(sliceList),
808 VecPtrToVecRawPtr(hits),
816 return ClusterToParticle(PtrVecToVecRawPtr(sliceList),
817 PtrVecToVecRawPtr(hits),
832 float CalcEscapingEnergy(
const sim::Particle &Par,
float& EnDep,
bool UseMCPart =
true,
std::string G4Label =
"trueens" );
837 float CalcDaughterEscapingEnergy(
const sim::Particle &Par );
844 float CalcTotalEscapingEnergy(
const sim::Particle &Par,
float& ParEnDep,
bool UseMCPart =
true,
std::string G4Label =
"trueens" );
853 bool InterceptsDetector(
const sim::Particle &Par,
int &TrajEnt,
int &TrajEx );
860 template<
class T> std::vector<const T*>
863 std::vector<const T*>
ret;
864 ret.reserve(xs.
size());
873 template<
class T> std::vector<const T*>
876 std::vector<const T*>
ret;
877 ret.reserve(xs.size());
886 template<
class T> std::vector<const T*>
889 std::vector<const T*>
ret;
890 ret.reserve(xs.size());
891 for(
const T&
x: xs) ret.push_back(&
x);
906 double HitCollectionPurity(
const std::set<int>& trackIDs,
907 const std::vector<RawWeightedHit>& whits,
908 std::map<int, double>* purMap = 0,
909 std::map<int, int>* parents = 0,
910 bool energyPur =
false)
const;
913 double HitCollectionEfficiency(
const std::set<int>& trackIDs,
914 const std::vector<RawWeightedHit>& whits,
915 const std::vector<const rb::CellHit*>& allhits,
917 std::map<int, double>* effMap = 0,
918 bool energyEff =
false,
919 double* desiredEnergy = 0,
921 int* desiredHits = 0,
922 int* totalHits = 0)
const;
930 void AccumulateHitContributions(
rb::CellHit const& hit,
931 std::map<int, int> & idToNPhot)
const;
939 std::unordered_map< geo::OfflineChan, std::list<sim::FLSHit> >
fCellToFLSHit;
960 #endif // CHEAT_BACKTRACKER_H void HitToParticlesMap(const art::PtrVector< rb::Cluster > &sliceList, const int &sliceIdx)
std::vector< const T * > VecPtrToVecRawPtr(const std::vector< art::Ptr< T >> &xs) const
std::vector< const T * > PtrVecToVecRawPtr(const art::PtrVector< T > &xs) const
Helper function for implementing overloads.
std::unordered_map< geo::OfflineChan, std::vector< sim::PhotonSignal > > fCellToPhotonSignal
map of PhotonSignals in each cell in event
std::vector< NeutrinoEffPur > SliceToMCTruth(const std::vector< rb::CellHit > &sliceHits, const std::vector< rb::CellHit > &allHits, bool sortPur=false) const
std::vector< TrackIDE > HitsToTrackIDE(const std::vector< rb::CellHit > &hits, bool useBirksE=false) const
std::vector< const sim::Particle * > HitsToParticle(const std::vector< rb::CellHit > &hits) const
std::set< int > fTrackIDs
G4 track ids for all particles in the events.
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
float energyFrac
fraction of hit energy from the particle with this trackID
cheat::ParticleEffPur ClusterToParticle(const std::vector< art::Ptr< rb::Cluster >> &sliceList, const std::vector< art::Ptr< rb::CellHit >> &hits, const int &sliceIdx)
std::map< double, std::vector< cheat::TrackIDE > > fCellToIDs
int trackID
Truth particle track ID.
unsigned int truthColIndex
Position in column vector of MCTruths from the event.
float energy
energy from the particle with this trackID
A collection of associated CellHits.
std::vector< ParticleEffPur > TracksToParticles(const std::vector< art::Ptr< rb::Track >> &tracks, const std::set< int > &trkIDs, const std::set< int > &allowedDaughters, const art::PtrVector< rb::CellHit > &allHits) const
std::vector< std::vector< cheat::NeutrinoEffPur > > SlicesToMCTruthsTable(const std::vector< rb::Cluster > &sliceList) const
int nTotalHits
Total number of hits the neutrino left in the detector.
double energyTotal
Sum of FLS hits from the neutrino contributing to any hit in the event.
int fNumTrueEnergyWarnings
std::vector< ParticleEffPur > TracksToParticles(const std::vector< art::Ptr< rb::Track >> &tracks, const std::set< int > &trkIDs, const std::set< int > &allowedDaughters, const std::vector< art::Ptr< rb::CellHit >> &allHits) const
#define DECLARE_ART_SERVICE(svc, scope)
double purity
Putity of particle relative to track.
std::vector< NeutrinoEffPur > SliceToNeutrinoInteractions(const art::PtrVector< rb::CellHit > &sliceHits, const art::PtrVector< rb::CellHit > &allHits, bool sortPur=false) const
double HitCollectionEfficiency(std::set< int > trackIDs, const art::PtrVector< rb::CellHit > &hits, const art::PtrVector< rb::CellHit > &allhits, const geo::View_t &view, std::map< int, double > *effMap=0, bool energyEff=false, double *desiredEnergy=0, double *totalEnergy=0, int *desiredHits=0, int *totalHits=0) const
std::vector< NeutrinoEffPur > SliceToNeutrinoInteractions(const art::Ptr< rb::Cluster > &sliceCluster, const std::vector< rb::CellHit > &allHits, bool sortPur=false) const
double HitCollectionEfficiency(const std::set< int > &trackIDs, const std::vector< rb::CellHit > &hits, const std::vector< rb::CellHit > &allhits, const geo::View_t &view, std::map< int, double > *effMap=0, bool energyEff=false, double *desiredEnergy=0, double *totalEnergy=0, int *desiredHits=0, int *totalHits=0) const
std::vector< std::vector< cheat::NeutrinoEffPur > > SlicesToMCTruthsTable(const art::PtrVector< rb::Cluster > &sliceList) const
double efficiency
Efficiency (based on FLS energy) of neutrino interaction relative to slice.
std::unordered_map< geo::OfflineChan, std::list< sim::FLSHit > > fCellToFLSHit
map of FLSHits in each cell in event
Helper for HitCollectionEfficiency and HitCollectionPurity.
std::vector< art::Ptr< simb::MCTruth > > fMCTruthList
all the MCTruths for this event
std::vector< NeutrinoEffPur > SliceToMCTruth(const art::Ptr< rb::Cluster > &sliceCluster, const art::PtrVector< rb::CellHit > &allHits, bool sortPur=false) const
cheat::ParticleEffPur ClusterToParticle(const std::vector< rb::Cluster > &sliceList, const std::vector< rb::CellHit > &hits, const int &sliceIdx)
void HitToParticlesMap(const std::vector< art::Ptr< rb::Cluster >> &sliceList, const int &sliceIdx)
std::unordered_map< int, std::list< sim::FLSHit > > fTrackIDToFLSHit
map of G4 track ids to FLSHits
std::map< int, float > fIdToEnergy
int trackID
Geant4 supplied trackID.
std::vector< NeutrinoEffPur > SliceToMCTruth(const art::Ptr< rb::Cluster > &sliceCluster, const std::vector< rb::CellHit > &allHits, bool sortPur=false) const
std::vector< sim::FLSHit > HitToFLSHit(const art::Ptr< rb::CellHit > &hit) const
std::vector< NeutrinoEffPur > SliceToNeutrinoInteractions(const std::vector< rb::CellHit > &sliceHits, const std::vector< rb::CellHit > &allHits, bool sortPur=false) const
std::vector< art::Ptr< sim::TrueEnergy > > fTrueEnergyList
all the TrueEnergy's for this event
sim::ParticleNavigator fParticleNav
Particle navigator to map track ID to Particle.
std::vector< NeutrinoEffPur > SliceToNeutrinoInteractions(const art::Ptr< rb::Cluster > &sliceCluster, const art::PtrVector< rb::CellHit > &allHits, bool sortPur=false) const
double efficiency
Efficiency of particle relative to track.
cheat::ParticleEffPur ClusterToParticle(const art::PtrVector< rb::Cluster > &sliceList, const art::PtrVector< rb::CellHit > &hits, const int &sliceIdx)
bool CompareByEnergy(const TrackIDE &a, const TrackIDE &b)
Does a have less energy than b?
double EnergyMetric(const cheat::NeutrinoEffPur &ep)
Function for NeutrinoEffPur's nu interaction to slice energy.
int fSliceIDForHitParticleMap
std::map< int, int > fTrackIDToTrueEIndex
map of track id values to TrueEnergy entry
double HitCollectionEfficiency(const std::set< int > &trackIDs, const std::vector< rb::WeightedHit > &whits, const std::vector< art::Ptr< rb::CellHit >> &allhits, const geo::View_t &view, std::map< int, double > *effMap=0, bool energyEff=false, double *desiredEnergy=0, double *totalEnergy=0, int *desiredHits=0, int *totalHits=0) const
std::vector< NeutrinoEffPur > SliceToMCTruth(const art::Ptr< rb::Cluster > &sliceCluster, const std::vector< art::Ptr< rb::CellHit >> &allHits, bool sortPur=false) const
double HitCollectionPurity(const std::set< int > &trackIDs, const std::vector< rb::CellHit > &hits, std::map< int, double > *purMap=0, std::map< int, int > *parents=0, bool energyPur=false) const
std::vector< ParticleEffPur > TracksToParticles(const art::PtrVector< rb::Track > &tracks, const std::set< int > &trkIDs, const std::set< int > &allowedDaughters, const art::PtrVector< rb::CellHit > &allHits) const
std::vector< std::vector< cheat::NeutrinoEffPur > > SlicesToMCTruthsTable(const std::vector< art::Ptr< rb::Cluster >> &sliceList) const
double EffPurMetric(const cheat::NeutrinoEffPur &ep)
Function for NeutrinoEffPur's nu interaction to slice efficiency * purity.
A rawdata::RawDigit with channel information decoded.
std::vector< const sim::Particle * > HitsToParticle(const std::vector< art::Ptr< rb::CellHit >> &hits) const
int nSliceHits
Number of hits from this neutrino in this slice.
double HitCollectionEfficiency(const std::set< int > &trackIDs, const std::vector< rb::WeightedHit > &whits, const std::vector< rb::CellHit > &allhits, const geo::View_t &view, std::map< int, double > *effMap=0, bool energyEff=false, double *desiredEnergy=0, double *totalEnergy=0, int *desiredHits=0, int *totalHits=0) const
code to link reconstructed objects back to the MC truth information
double HitCollectionEfficiency(const std::set< int > &trackIDs, const std::vector< art::Ptr< rb::CellHit >> &hits, const std::vector< art::Ptr< rb::CellHit >> &allhits, const geo::View_t &view, std::map< int, double > *effMap=0, bool energyEff=false, double *desiredEnergy=0, double *totalEnergy=0, int *desiredHits=0, int *totalHits=0) const
bool fHaveTruthInfo
Set by Rebuild.
std::vector< NeutrinoEffPur > SliceToNeutrinoInteractions(const std::vector< art::Ptr< rb::CellHit >> &sliceHits, const std::vector< art::Ptr< rb::CellHit >> &allHits, bool sortPur=false) const
std::vector< NeutrinoEffPur > SliceToMCTruth(const art::PtrVector< rb::CellHit > &sliceHits, const art::PtrVector< rb::CellHit > &allHits, bool sortPur=false) const
RawWeightedHit(const rb::WeightedHit &h)
std::map< int, int > fTrackIDToMCTruthIndex
map of track id values to MCTruthList entry
double energySlice
Sum of FLS hits from the neutrino contributing to hits included in the slice.
bool HaveTruthInfo() const
Is this a file with truth info in? (Is BackTracker going to be any use to you?)
RawWeightedHit(const rb::CellHit *h, double w)
const std::set< int > GetTrackIDList() const
Get all G4 track ids present in the event.
Simple hit+weight pair, returned from rb::Cluster::WeightedHits.
std::vector< TrackIDE > HitsToTrackIDE(const std::vector< art::Ptr< rb::CellHit >> &hits, bool useBirksE=false) const
void HitToParticlesMap(const std::vector< rb::Cluster > &sliceList, const int &sliceIdx)
double PurMetric(const cheat::NeutrinoEffPur &ep)
Function for NeutrinoEffPur's nu interaction to slice purity.
double EffMetric(const cheat::NeutrinoEffPur &ep)
Function for NeutrinoEffPur's nu interaction to slice efficiency.
double HitCollectionPurity(const std::set< int > &trackIDs, const art::PtrVector< rb::CellHit > &hits, std::map< int, double > *purMap=0, std::map< int, int > *parents=0, bool energyPur=false) const
std::vector< const T * > VecToVecRawPtr(const std::vector< T > &xs) const
static Var totalEnergy(const std::shared_ptr< CAFAnaModel > &model)
art::Ptr< simb::MCTruth > neutrinoInt
Truth information about neutrino interaction.
double HitCollectionEfficiency(const std::set< int > &trackIDs, const std::vector< rb::WeightedHit > &whits, const art::PtrVector< rb::CellHit > &allhits, const geo::View_t &view, std::map< int, double > *effMap=0, bool energyEff=false, double *desiredEnergy=0, double *totalEnergy=0, int *desiredHits=0, int *totalHits=0) const
std::vector< NeutrinoEffPur > SliceToMCTruth(const std::vector< art::Ptr< rb::CellHit >> &sliceHits, const std::vector< art::Ptr< rb::CellHit >> &allHits, bool sortPur=false) const
Simple object representing a (plane, cell) pair.
novadaq::cnv::DetId fDetID
detector id
double HitCollectionPurity(const std::set< int > &trackIDs, const std::vector< art::Ptr< rb::CellHit >> &hits, std::map< int, double > *purMap=0, std::map< int, int > *parents=0, bool energyPur=false) const
std::vector< TrackIDE > HitsToTrackIDE(const art::PtrVector< rb::CellHit > &hits, bool useBirksE=false) const
std::vector< NeutrinoEffPur > SliceToNeutrinoInteractions(const art::Ptr< rb::Cluster > &sliceCluster, const std::vector< art::Ptr< rb::CellHit >> &allHits, bool sortPur=false) const
art::Ptr< simb::MCTruth > neutrinoInt
Truth information about neutrino interaction.
std::vector< const sim::Particle * > HitsToParticle(const art::PtrVector< rb::CellHit > &hits) const
double purity
Purity (based on FLS energy) of neutrino interaction relative to slice.
unsigned int truthColIndex
Position in column vector of MCTruths from the event.
std::vector< ParticleEffPur > TracksToParticles(const std::vector< rb::Track > &tracks, const std::set< int > &trkIDs, const std::set< int > &allowedDaughters, const std::vector< rb::CellHit > &allHits) const