LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
TCShower.h
Go to the documentation of this file.
1 //
3 //
4 // TCAlg shower code
5 //
6 // Bruce Baller
7 //
9 #ifndef TRAJCLUSTERALGSHOWERS_H
10 #define TRAJCLUSTERALGSHOWERS_H
11 
12 // C/C++ standard libraries
13 #include <string>
14 #include <vector>
15 
16 // LArSoft libraries
18 
19 namespace detinfo {
20  class DetectorPropertiesData;
21 }
22 
23 namespace tca {
24 
25  void ConfigureMVA(TCConfig& tcc, std::string fMVAShowerParentWeights);
27  TCSlice& slc,
28  ShowerStruct3D& ss3,
29  bool prt);
30  void KillVerticesInShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
31  void Finish3DShowers(TCSlice& slc);
32  bool FindShowers3D(detinfo::DetectorPropertiesData const& detProp, TCSlice& slc);
33  bool Reconcile3D(std::string inFcnLabel, TCSlice& slc, bool parentSearchDone, bool prt);
34  bool Reconcile3D(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3, bool prt);
35  bool MergeShowerTjsAndStore(TCSlice& slc, unsigned short istj, unsigned short jstj, bool prt);
36  bool TransferTjHits(TCSlice& slc, bool prt);
37  int GetCotID(TCSlice& slc, int ShowerTjID);
38 
39  bool CompleteIncompleteShower(std::string inFcnLabel,
40  TCSlice& slc,
41  ShowerStruct3D& ss3,
42  bool prt);
43  void Match2DShowers(std::string inFcnLabel, TCSlice& slc, bool prt);
44  bool UpdateShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
45  bool UpdateShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3, bool prt);
46  float Match3DFOM(detinfo::DetectorPropertiesData const& detProp,
47  std::string inFcnLabel,
48  TCSlice& slc,
49  int icotID,
50  int jcotID,
51  bool prt);
52  float Match3DFOM(detinfo::DetectorPropertiesData const& detProp,
53  std::string inFcnLabel,
54  TCSlice& slc,
55  int icotID,
56  int jcotID,
57  int kcotID,
58  bool prt);
59  float Match3DFOM(detinfo::DetectorPropertiesData const& detProp,
60  std::string inFcnLabel,
61  TCSlice& slc,
62  ShowerStruct3D& ss3,
63  bool prt);
64  void MakeShowerObsolete(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3, bool prt);
65  void MakeShowerObsolete(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
66  bool DontCluster(TCSlice const& slc,
67  const std::vector<int>& tjlist1,
68  const std::vector<int>& tjlist2);
69  void DefineDontCluster(TCSlice& slc, bool prt);
70  bool RemovePFP(std::string inFcnLabel,
71  TCSlice& slc,
72  PFPStruct& pfp,
73  ShowerStruct3D& ss3,
74  bool doUpdate,
75  bool prt);
76  bool AddPFP(std::string inFcnLabel,
77  TCSlice& slc,
78  int pID,
79  ShowerStruct3D& ss3,
80  bool doUpdate,
81  bool prt);
82  bool RemovePFP(std::string inFcnLabel,
83  TCSlice& slc,
84  int pID,
85  ShowerStruct3D& ss3,
86  bool doUpdate,
87  bool prt);
88  bool AddTj(std::string inFcnLabel,
89  TCSlice& slc,
90  int TjID,
91  ShowerStruct& ss,
92  bool doUpdate,
93  bool prt);
94  bool RemoveTj(std::string inFcnLabel,
95  TCSlice& slc,
96  int TjID,
97  ShowerStruct& ss,
98  bool doUpdate,
99  bool prt);
100  bool AnalyzeRotPos(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
101  void ReverseShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
102  void ReverseShower(std::string inFcnLabel, TCSlice& slc, int cotID, bool prt);
103  bool FindParent(detinfo::DetectorPropertiesData const& detProp,
104  std::string inFcnLabel,
105  TCSlice& slc,
106  ShowerStruct3D& ss3,
107  bool prt);
108  bool SetParent(detinfo::DetectorPropertiesData const& detProp,
109  std::string inFcnLabel,
110  TCSlice& slc,
111  PFPStruct& pfp,
112  ShowerStruct3D& ss3,
113  bool prt);
114  bool WrongSplitTj(std::string inFcnLabel,
115  TCSlice& slc,
116  Trajectory& tj,
117  unsigned short tjEnd,
118  bool prt);
119  bool IsShowerLike(TCSlice const& slc, std::vector<int> const& TjIDs);
120  float InShowerProb(TCSlice& slc, const ShowerStruct3D& ss3, const PFPStruct& pfp);
121  float InShowerProb(TCSlice& slc, const ShowerStruct& ss, const Trajectory& tj);
122  void ShowerParams(double showerEnergy, double& shMaxAlong, double& shE95Along);
123  double ShowerParamTransRMS(double showerEnergy, double along);
124  double InShowerProbLong(double showerEnergy, double along);
125  double InShowerProbTrans(double showerEnergy, double along, double trans);
126  double InShowerProb(double showerEnergy, double along, double trans);
127  float ParentFOM(std::string inFcnLabel,
128  TCSlice& slc,
129  PFPStruct& pfp,
130  ShowerStruct3D& ss3,
131  bool prt);
132  float ParentFOM(std::string inFcnLabel,
133  TCSlice& slc,
134  Trajectory& tj,
135  unsigned short& tjEnd,
136  ShowerStruct& ss,
137  float& tp1Sep,
138  float& vx3Score,
139  bool prt);
140  void DefineEnvelope(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
141  bool AddTjsInsideEnvelope(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
142  bool AddLooseHits(std::string inFcnLabel, TCSlice& slc, int cotID, bool prt);
143  void FindStartChg(std::string inFcnLabel, TCSlice& slc, int cotID, bool prt);
144  std::vector<float> StartChgVec(TCSlice& slc, int cotID);
145  void DumpShowerPts(std::string inFcnLabel, TCSlice& slc, int cotID);
146 
147  void FindCots(std::string inFcnLabel,
148  TCSlice& slc,
149  const CTP_t& inCTP,
150  std::vector<std::vector<int>>& tjLists,
151  bool prt);
152  void TagShowerLike(TCSlice& slc, const CTP_t& inCTP);
153  void FindNearbyTjs(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
154  void AddCloseTjsToList(std::string inFcnLabel,
155  TCSlice& slc,
156  unsigned short itj,
157  std::vector<int> list);
158  void MergeTjList(std::vector<std::vector<int>>& tjList);
159  void MergeTjList2(std::string inFcnLabel,
160  TCSlice& slc,
161  std::vector<std::vector<int>>& tjList,
162  bool prt);
163  void MergeNearby2DShowers(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
164  void MergeOverlap(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
165  void MergeShowerChain(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
166  void MergeSubShowersTj(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
167  void MergeSubShowers(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
168  int MergeShowers(std::string inFcnLabel, TCSlice& slc, std::vector<int> showerIDs, bool prt);
169  bool MergeShowersAndStore(std::string inFcnLabel, TCSlice& slc, int icotID, int jcotID, bool prt);
170  double ShowerEnergy(const ShowerStruct3D& ss3);
171  float ShowerEnergy(TCSlice& slc, const std::vector<int> tjIDs);
172  float ChgToMeV(float chg);
173  // PFPStruct CreateFakePFP(TCSlice& slc, const ShowerStruct3D& ss3);
174  bool StoreShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3);
175  bool StoreShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss);
176  ShowerStruct3D CreateSS3(TCSlice& slc);
177  ShowerStruct CreateSS(TCSlice& slc, const std::vector<int>& tjl);
178  bool ChkAssns(std::string inFcnLabel, TCSlice& slc);
179  void PrintShowers(detinfo::DetectorPropertiesData const& detProp,
180  std::string someText,
181  TCSlice const& slc);
182  void Print2DShowers(std::string someText,
183  TCSlice const& slc,
184  CTP_t inCTP,
185  bool printKilledShowers);
186  void PrintShower(std::string someText,
187  TCSlice const& slc,
188  const ShowerStruct& ss,
189  bool printHeader,
190  bool printExtras);
191 
192 }
193 
194 #endif // ifndef TRAJCLUSTERALGSHOWERS_H
bool AddTj(std::string inFcnLabel, TCSlice &slc, int tjID, ShowerStruct &ss, bool doUpdate, bool prt)
Definition: TCShower.cxx:1429
bool TransferTjHits(TCSlice &slc, bool prt)
Definition: TCShower.cxx:3845
void MergeNearby2DShowers(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2279
void ConfigureMVA(TCConfig &tcc, std::string fMVAShowerParentWeights)
Definition: TCShower.cxx:34
bool AddLooseHits(std::string inFcnLabel, TCSlice &slc, int cotID, bool prt)
bool FindParent(detinfo::DetectorPropertiesData const &detProp, std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:1561
void ReverseShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3112
void MergeShowerChain(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2491
double InShowerProbLong(double showerEnergy, double along)
Definition: TCShower.cxx:1937
bool WrongSplitTj(std::string inFcnLabel, TCSlice &slc, Trajectory &tj, unsigned short tjEnd, bool prt)
Definition: TCShower.cxx:2239
bool ChkAssns(std::string inFcnLabel, TCSlice &slc)
Definition: TCShower.cxx:4095
ShowerStruct3D CreateSS3(TCSlice &slc)
Definition: TCShower.cxx:4030
TCConfig tcc
Definition: DataStructs.cxx:9
void PrintShowers(detinfo::DetectorPropertiesData const &detProp, std::string fcnLabel, TCSlice const &slc)
Definition: TCShower.cxx:4150
int GetCotID(TCSlice &slc, int ShowerTjID)
Definition: TCShower.cxx:3889
bool IsShowerLike(TCSlice const &slc, std::vector< int > const &TjIDs)
Definition: TCShower.cxx:1891
bool DontCluster(TCSlice const &slc, const std::vector< int > &tjlist1, const std::vector< int > &tjlist2)
Definition: TCShower.cxx:3213
void KillVerticesInShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:704
bool FindShowers3D(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc)
Definition: TCShower.cxx:285
double ShowerEnergy(const ShowerStruct3D &ss3)
Definition: TCShower.cxx:3899
void TagShowerLike(TCSlice &slc, const CTP_t &inCTP)
Definition: TCShower.cxx:3232
double InShowerProbTrans(double showerEnergy, double along, double trans)
Definition: TCShower.cxx:1972
bool FindShowerStart(detinfo::DetectorPropertiesData const &detProp, TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:60
ShowerStruct CreateSS(TCSlice &slc, const std::vector< int > &tjl)
Definition: TCShower.cxx:4049
void MergeTjList(std::vector< std::vector< int >> &tjList)
Definition: TCShower.cxx:1287
double ShowerParamTransRMS(double showerEnergy, double along)
Definition: TCShower.cxx:1923
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:289
void DefineEnvelope(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3442
void FindCots(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, std::vector< std::vector< int >> &tjLists, bool prt)
void MergeSubShowersTj(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2620
bool MergeShowerTjsAndStore(TCSlice &slc, unsigned short istj, unsigned short jstj, bool prt)
Definition: TCShower.cxx:2978
void AddCloseTjsToList(std::string inFcnLabel, TCSlice &slc, unsigned short itj, std::vector< int > list)
void FindNearbyTjs(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3335
void MergeOverlap(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2371
double InShowerProb(double showerEnergy, double along, double trans)
General LArSoft Utilities.
bool AddPFP(std::string inFcnLabel, TCSlice &slc, int pID, ShowerStruct3D &ss3, bool doUpdate, bool prt)
Definition: TCShower.cxx:1368
float ParentFOM(std::string inFcnLabel, TCSlice &slc, PFPStruct &pfp, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:2051
bool AddTjsInsideEnvelope(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3503
bool MergeShowersAndStore(std::string inFcnLabel, TCSlice &slc, int icotID, int jcotID, bool prt)
Definition: TCShower.cxx:2908
std::vector< float > StartChgVec(TCSlice &slc, int cotID)
Definition: TCShower.cxx:3774
unsigned int CTP_t
Definition: DataStructs.h:47
bool RemoveTj(std::string inFcnLabel, TCSlice &slc, int TjID, ShowerStruct &ss, bool doUpdate, bool prt)
Definition: TCShower.cxx:1506
int MergeShowers(std::string inFcnLabel, TCSlice &slc, std::vector< int > ssIDs, bool prt)
Definition: TCShower.cxx:2847
void ShowerParams(double showerEnergy, double &shMaxAlong, double &along95)
Definition: TCShower.cxx:1904
void PrintShower(std::string someText, TCSlice const &slc, const ShowerStruct &ss, bool printHeader, bool printExtras)
Definition: TCShower.cxx:4283
void Match2DShowers(std::string inFcnLabel, TCSlice &slc, bool prt)
void DefineDontCluster(TCSlice &slc, bool prt)
void MergeTjList2(std::string inFcnLabel, TCSlice &slc, std::vector< std::vector< int >> &tjList, bool prt)
void MergeSubShowers(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2731
void FindStartChg(std::string inFcnLabel, TCSlice &slc, int cotID, bool prt)
Definition: TCShower.cxx:3654
void Finish3DShowers(TCSlice &slc)
Definition: TCShower.cxx:153
bool AnalyzeRotPos(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3022
float Match3DFOM(detinfo::DetectorPropertiesData const &detProp, std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:1198
float ChgToMeV(float chg)
Definition: TCShower.cxx:3925
bool UpdateShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:904
void Print2DShowers(std::string someText, TCSlice const &slc, CTP_t inCTP, bool printKilledShowers)
Definition: TCShower.cxx:4192
bool RemovePFP(std::string inFcnLabel, TCSlice &slc, int pID, ShowerStruct3D &ss3, bool doUpdate, bool prt)
bool CompleteIncompleteShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:748
void DumpShowerPts(std::string inFcnLabel, TCSlice &slc, int cotID)
bool SetParent(detinfo::DetectorPropertiesData const &detProp, std::string inFcnLabel, TCSlice &slc, PFPStruct &pfp, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:1815
void MakeShowerObsolete(std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:3151
bool StoreShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3)
Definition: TCShower.cxx:3933
bool Reconcile3D(std::string inFcnLabel, TCSlice &slc, bool parentSearchDone, bool prt)
Definition: TCShower.cxx:424