LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
TCTruth.h
Go to the documentation of this file.
1 //
3 //
4 // TCAlg MC Truth
5 //
6 // Bruce Baller
7 //
9 #ifndef TRAJCLUSTERALGTRUTH_H
10 #define TRAJCLUSTERALGTRUTH_H
11 
12 
16 
17 
18 namespace tca {
19 
21  {
22 
23  public:
24 
25  TruthMatcher(TjStuff& my_tjs) : tjs(my_tjs) {
26  EPCnts.fill(0);
27  TSums.fill(0.0);
28  EPTSums.fill(0.0);
29  TruVxCounts.fill(0);
30  MCP_TSum = 0;
31  MCP_EPTSum = 0;
32  MCP_Cnt = 0;
33  MCP_PFP_Cnt = 0;
34  Prim_TSum = 0;
35  Prim_EPTSum = 0;
36  PFP_Cnt = 0;
37  nBadEP = 0;
38  nLongInPln = 0;
39  nLongMCP = 0;
40  nGoodLongMCP = 0;
41  }
42 
43  void Initialize();
44  void MatchTrueHits();
45  void MatchTruth(const HistStuff& hist, bool fStudyMode);
46  void MatchAndSum(const HistStuff& hist, const std::vector<unsigned int>& mcpSelect, const geo::TPCID& inTPCID);
47  void PrintResults(int eventNum) const;
48  bool CanReconstruct(unsigned int mcpIndex, unsigned short nDimensions, const geo::TPCID& tpcid);
49  // Put hits matched to a MCParticle in CTP into a vector
50  std::vector<unsigned int> PutMCPHitsInVector(unsigned int mcpIndex, CTP_t inCTP);
51  void StudyShowerParents(HistStuff& hist);
52  void StudyElectrons(const HistStuff& hist);
53  void StudyPiZeros(const HistStuff& hist);
54 
56  // Variables for summing Eff*Pur for electrons, muons, pions, kaons and protons for Trajectories
57  std::array<short, 5> EPCnts {{0}};
58  std::array<float, 5> TSums; // sum of kinetic energy
59  std::array<float, 5> EPTSums; // E*P sum weighted by kinetic energy for 5 particle types
60 
61  float MCP_TSum; // T sum of MCParticles that should be reconstructed in 3D
62  float MCP_EPTSum; // E*P weighted T sum of MCParticles that ARE reconstructed in 3D
63  float MCP_Cnt; // Count of MCParticles that should be reconstructed in 3D
64  float MCP_PFP_Cnt; // Count of MCParticles that are matched to a PFParticle
65  float Prim_TSum; // T sum of Primary MCParticles that should be reconstructed in 3D
66  float Prim_EPTSum; // E*P weighted T sum of primary MCParticles that ARE reconstructed in 3D
67  float PFP_Cnt; // Count of ALL PFParticles
68 
69  unsigned short nBadEP; // Number of MCParticles that have >= MatchTruth[3] hits in a plane && EP < MatchTruth[2]
70  unsigned short nLongInPln; // Number of MCParticles that have >= MatchTruth[3] hits in a plane
71  unsigned short nLongMCP; // Number of MCParticles that have >= MatchTruth[3] hits
72  unsigned short nGoodLongMCP; // Number of MCParticles that have >= 2 * MatchTruth[3] hits with EP > 0.8
73 
74  // Counts of:
75  // [0] = the number of true vertices that are reconstructable (> 0 primary MCParticles)
76  // [1] = [0] + a vertex was reconstructed within 1 cm of the true vertex position
77  // [2] = [1] + the vertex is attached to a neutrino PFParticle
78  std::array<unsigned short, 3> TruVxCounts;
79  }; // TruthMatcher class
80 
82  {
83  public:
84 
85  MCParticleListUtils(TjStuff& my_tjs) : tjs(my_tjs) {}
87  void MakeTruTrajPoint(unsigned int MCParticleListIndex, TrajPoint& tp);
88  ShowerStruct3D MakeCheatShower(unsigned int mcpIndex, Point3_t primVx, int& truParentPFP);
89  bool PrimaryElectronStart(Point3_t& start, Vector3_t& dir, float& energy);
90  int PrimaryElectronPFPID(const geo::TPCID& tpcid);
91  int PrimaryElectronTjID(CTP_t inCTP);
92  int MCParticleStartTjID(unsigned int MCParticleListIndex, CTP_t inCTP);
93  unsigned int GetMCPartListIndex(const TrajPoint& tp);
94  unsigned int GetMCPartListIndex(const Trajectory& tj, unsigned short& nTruHits);
95  unsigned int GetMCPartListIndex(const ShowerStruct& ss, unsigned short& nTruHits);
96 
97  }; // MCParticleListUtils class
98 
99 
100 } // namespace tca
101 
102 #endif // ifndef TRAJCLUSTERALGTRUTH_H
float MCP_TSum
Definition: TCTruth.h:61
unsigned short nLongInPln
Definition: TCTruth.h:70
std::array< double, 3 > Point3_t
Definition: DataStructs.h:35
Float_t ss
Definition: plot.C:23
void Initialize()
Definition: TCTruth.cxx:20
void StudyShowerParents(HistStuff &hist)
Definition: TCTruth.cxx:235
bool CanReconstruct(unsigned int mcpIndex, unsigned short nDimensions, const geo::TPCID &tpcid)
Definition: TCTruth.cxx:1135
MCParticleListUtils(TjStuff &my_tjs)
Definition: TCTruth.h:85
float Prim_EPTSum
Definition: TCTruth.h:66
TjStuff & tjs
Definition: TCTruth.h:55
float MCP_EPTSum
Definition: TCTruth.h:62
void MatchTrueHits()
Definition: TCTruth.cxx:31
std::array< float, 5 > TSums
Definition: TCTruth.h:58
std::array< float, 5 > EPTSums
Definition: TCTruth.h:59
std::array< short, 5 > EPCnts
Definition: TCTruth.h:57
double energy
Definition: plottest35.C:25
std::vector< unsigned int > PutMCPHitsInVector(unsigned int mcpIndex, CTP_t inCTP)
Definition: TCTruth.cxx:1156
TruthMatcher(TjStuff &my_tjs)
Definition: TCTruth.h:25
unsigned short nLongMCP
Definition: TCTruth.h:71
The data type to uniquely identify a TPC.
Definition: geo_types.h:195
void MatchTruth(const HistStuff &hist, bool fStudyMode)
Definition: TCTruth.cxx:459
unsigned short nBadEP
Definition: TCTruth.h:69
unsigned short nGoodLongMCP
Definition: TCTruth.h:72
void MatchAndSum(const HistStuff &hist, const std::vector< unsigned int > &mcpSelect, const geo::TPCID &inTPCID)
Definition: TCTruth.cxx:874
unsigned int CTP_t
Definition: DataStructs.h:41
TH2F * hist
Definition: plot.C:136
TDirectory * dir
Definition: macro.C:5
float MCP_PFP_Cnt
Definition: TCTruth.h:64
void StudyPiZeros(const HistStuff &hist)
Definition: TCTruth.cxx:415
std::array< double, 3 > Vector3_t
Definition: DataStructs.h:36
void StudyElectrons(const HistStuff &hist)
Definition: TCTruth.cxx:386
void PrintResults(int eventNum) const
Definition: TCTruth.cxx:1083
std::array< unsigned short, 3 > TruVxCounts
Definition: TCTruth.h:78
float Prim_TSum
Definition: TCTruth.h:65