LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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 
13 // C/C++ standard libraries
14 #include <array>
15 #include <vector>
16 #include <bitset>
17 #include <utility> // std::pair<>
18 #include <cmath>
19 #include <iostream>
20 #include <iomanip>
21 #include <algorithm>
22 
24 
25 // LArSoft libraries
33 
34 namespace tca {
35 
36  void ConfigureMVA(TCConfig& tcc, std::string fMVAShowerParentWeights);
37  bool FindShowerStart(TCSlice& slc, ShowerStruct3D& ss3, bool prt);
38  void KillVerticesInShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
39  void Finish3DShowers(TCSlice& slc);
40  bool FindShowers3D(TCSlice& slc);
41  bool Reconcile3D(std::string inFcnLabel, TCSlice& slc, bool parentSearchDone, bool prt);
42  bool Reconcile3D(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3, bool prt);
43  bool MergeShowerTjsAndStore(TCSlice& slc, unsigned short istj, unsigned short jstj, bool prt);
44  bool TransferTjHits(TCSlice& slc, bool prt);
45  int GetCotID(TCSlice& slc, int ShowerTjID);
46 
47  bool CompleteIncompleteShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3, bool prt);
48  void Match2DShowers(std::string inFcnLabel, TCSlice& slc, bool prt);
49  bool UpdateShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
50  bool UpdateShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3, bool prt);
51  float Match3DFOM(std::string inFcnLabel, TCSlice& slc, int icotID, int jcotID, bool prt);
52  float Match3DFOM(std::string inFcnLabel, TCSlice& slc, int icotID, int jcotID, int kcotID, bool prt);
53  float Match3DFOM(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3, bool prt);
54  void MakeShowerObsolete(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3, bool prt);
55  void MakeShowerObsolete(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
56  bool DontCluster(TCSlice& slc, const std::vector<int>& tjlist1, const std::vector<int>& tjlist2);
57  void DefineDontCluster(TCSlice& slc, bool prt);
58  bool RemovePFP(std::string inFcnLabel, TCSlice& slc, PFPStruct& pfp, ShowerStruct3D& ss3, bool doUpdate, bool prt);
59  bool AddPFP(std::string inFcnLabel, TCSlice& slc, int pID, ShowerStruct3D& ss3, bool doUpdate, bool prt);
60  bool RemovePFP(std::string inFcnLabel, TCSlice& slc, int pID, ShowerStruct3D& ss3, bool doUpdate, bool prt);
61  bool AddTj(std::string inFcnLabel, TCSlice& slc, int TjID, ShowerStruct& ss, bool doUpdate, bool prt);
62  bool RemoveTj(std::string inFcnLabel, TCSlice& slc, int TjID, ShowerStruct& ss, bool doUpdate, bool prt);
63  bool AnalyzeRotPos(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
64  void ReverseShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
65  void ReverseShower(std::string inFcnLabel, TCSlice& slc, int cotID, bool prt);
66  bool FindParent(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3, bool prt);
67  bool SetParent(std::string inFcnLabel, TCSlice& slc, PFPStruct& pfp, ShowerStruct3D& ss3, bool prt);
68  bool WrongSplitTj(std::string inFcnLabel, TCSlice& slc, Trajectory& tj, unsigned short tjEnd, ShowerStruct& ss, bool prt);
69  bool IsShowerLike(TCSlice& slc, const std::vector<int> TjIDs);
70  float InShowerProb(TCSlice& slc, const ShowerStruct3D& ss3, const PFPStruct& pfp);
71  float InShowerProb(TCSlice& slc, const ShowerStruct& ss, const Trajectory& tj);
72  void ShowerParams(double showerEnergy, double& shMaxAlong, double& shE95Along);
73  double ShowerParamTransRMS(double showerEnergy, double along);
74  double InShowerProbLong(double showerEnergy, double along);
75  double InShowerProbTrans(double showerEnergy, double along, double trans);
76  double InShowerProb(double showerEnergy, double along, double trans);
77  float ParentFOM(std::string inFcnLabel, TCSlice& slc, PFPStruct& pfp, unsigned short pend, ShowerStruct3D& ss3, bool prt);
78  float ParentFOM(std::string inFcnLabel, TCSlice& slc, Trajectory& tj, unsigned short& tjEnd, ShowerStruct& ss, float& tp1Sep, float& vx3Score, bool prt);
79  void DefineEnvelope(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
80  bool AddTjsInsideEnvelope(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
81  bool AddLooseHits(std::string inFcnLabel, TCSlice& slc, int cotID, bool prt);
82  void FindStartChg(std::string inFcnLabel, TCSlice& slc, int cotID, bool prt);
83  std::vector<float> StartChgVec(TCSlice& slc, int cotID, bool prt);
84  void DumpShowerPts(std::string inFcnLabel, TCSlice& slc, int cotID);
85 
86  void FindCots(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, std::vector<std::vector<int>>& tjLists, bool prt);
87  void TagShowerLike(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP);
88  void FindNearbyTjs(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss, bool prt);
89  void AddCloseTjsToList(std::string inFcnLabel, TCSlice& slc, unsigned short itj, std::vector<int> list);
90  void MergeTjList(std::vector<std::vector<int>>& tjList);
91  void MergeTjList2(std::string inFcnLabel, TCSlice& slc, std::vector<std::vector<int>>& tjList, bool prt);
92  void MergeNearby2DShowers(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
93  void MergeOverlap(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
94  void MergeShowerChain(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
95  void MergeSubShowersTj(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
96  void MergeSubShowers(std::string inFcnLabel, TCSlice& slc, const CTP_t& inCTP, bool prt);
97  int MergeShowers(std::string inFcnLabel, TCSlice& slc, std::vector<int> showerIDs, bool prt);
98  bool MergeShowersAndStore(std::string inFcnLabel, TCSlice& slc, int icotID, int jcotID, bool prt);
99  double ShowerEnergy(const ShowerStruct3D& ss3);
100  float ShowerEnergy(TCSlice& slc, const std::vector<int> tjIDs);
101  float ChgToMeV(float chg);
102  PFPStruct CreateFakePFP(TCSlice& slc, const ShowerStruct3D& ss3);
103  bool StoreShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct3D& ss3);
104  bool StoreShower(std::string inFcnLabel, TCSlice& slc, ShowerStruct& ss);
105  ShowerStruct3D CreateSS3(TCSlice& slc);
106  ShowerStruct CreateSS(TCSlice& slc, const std::vector<int>& tjl);
107  bool ChkAssns(std::string inFcnLabel, TCSlice& slc);
108  void PrintShowers(std::string someText, TCSlice& slc);
109  void Print2DShowers(std::string someText, TCSlice& slc, CTP_t inCTP, bool printKilledShowers);
110  void PrintShower(std::string someText, TCSlice& slc, const ShowerStruct& ss, bool printHeader, bool printExtras);
111 
112 }
113 
114 
115 #endif // ifndef TRAJCLUSTERALGSHOWERS_H
bool AddTj(std::string inFcnLabel, TCSlice &slc, int tjID, ShowerStruct &ss, bool doUpdate, bool prt)
Definition: TCShower.cxx:1552
bool TransferTjHits(TCSlice &slc, bool prt)
Definition: TCShower.cxx:4318
void MergeNearby2DShowers(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2374
void ConfigureMVA(TCConfig &tcc, std::string fMVAShowerParentWeights)
Definition: TCShower.cxx:15
void ReverseShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3201
void MergeShowerChain(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2573
double InShowerProbLong(double showerEnergy, double along)
Definition: TCShower.cxx:2049
bool ChkAssns(std::string inFcnLabel, TCSlice &slc)
Definition: TCShower.cxx:4560
ShowerStruct3D CreateSS3(TCSlice &slc)
Definition: TCShower.cxx:4495
TCConfig tcc
Definition: DataStructs.cxx:6
void PrintShowers(std::string fcnLabel, TCSlice &slc)
Definition: TCShower.cxx:4611
int GetCotID(TCSlice &slc, int ShowerTjID)
Definition: TCShower.cxx:4359
Float_t ss
Definition: plot.C:23
void PrintShower(std::string someText, TCSlice &slc, const ShowerStruct &ss, bool printHeader, bool printExtras)
Definition: TCShower.cxx:4733
bool WrongSplitTj(std::string inFcnLabel, TCSlice &slc, Trajectory &tj, unsigned short tjEnd, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:2340
void KillVerticesInShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:702
double ShowerEnergy(const ShowerStruct3D &ss3)
Definition: TCShower.cxx:4369
float ParentFOM(std::string inFcnLabel, TCSlice &slc, PFPStruct &pfp, unsigned short pend, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:2169
bool IsShowerLike(TCSlice &slc, const std::vector< int > TjIDs)
Definition: TCShower.cxx:2002
double InShowerProbTrans(double showerEnergy, double along, double trans)
Definition: TCShower.cxx:2083
ShowerStruct CreateSS(TCSlice &slc, const std::vector< int > &tjl)
Definition: TCShower.cxx:4514
bool AddLooseHits(TCSlice &slc, int cotID, bool prt)
Definition: TCShower.cxx:4002
bool SetParent(std::string inFcnLabel, TCSlice &slc, PFPStruct &pfp, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:1919
bool DontCluster(TCSlice &slc, const std::vector< int > &tjlist1, const std::vector< int > &tjlist2)
Definition: TCShower.cxx:3313
void MergeTjList(std::vector< std::vector< int >> &tjList)
Definition: TCShower.cxx:1422
double ShowerParamTransRMS(double showerEnergy, double along)
Definition: TCShower.cxx:2035
void AddCloseTjsToList(TCSlice &slc, unsigned short itj, std::vector< int > list)
Definition: TCShower.cxx:3840
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
void DefineEnvelope(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3869
void FindCots(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, std::vector< std::vector< int >> &tjLists, bool prt)
Definition: TCShower.cxx:3416
void MergeSubShowersTj(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2699
float Match3DFOM(std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:1345
void DumpShowerPts(TCSlice &slc, int cotID)
Definition: TCShower.cxx:4237
float InShowerProb(TCSlice &slc, const ShowerStruct3D &ss3, const PFPStruct &pfp)
Definition: TCShower.cxx:2103
bool MergeShowerTjsAndStore(TCSlice &slc, unsigned short istj, unsigned short jstj, bool prt)
Definition: TCShower.cxx:3060
void TagShowerLike(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP)
Definition: TCShower.cxx:3631
void FindNearbyTjs(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3762
void MergeOverlap(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2461
PFPStruct CreateFakePFP(TCSlice &slc, const ShowerStruct3D &ss3)
Definition: TCShower.cxx:1981
Definition of data types for geometry description.
bool AddPFP(std::string inFcnLabel, TCSlice &slc, int pID, ShowerStruct3D &ss3, bool doUpdate, bool prt)
Definition: TCShower.cxx:1498
std::vector< float > StartChgVec(TCSlice &slc, int cotID, bool prt)
Definition: TCShower.cxx:4188
bool AddTjsInsideEnvelope(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3929
bool FindParent(std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:1668
bool MergeShowersAndStore(std::string inFcnLabel, TCSlice &slc, int icotID, int jcotID, bool prt)
Definition: TCShower.cxx:2985
unsigned int CTP_t
Definition: DataStructs.h:41
bool RemoveTj(std::string inFcnLabel, TCSlice &slc, int TjID, ShowerStruct &ss, bool doUpdate, bool prt)
Definition: TCShower.cxx:1620
bool FindShowers3D(TCSlice &slc)
Definition: TCShower.cxx:286
int MergeShowers(std::string inFcnLabel, TCSlice &slc, std::vector< int > ssIDs, bool prt)
Definition: TCShower.cxx:2917
void ShowerParams(double showerEnergy, double &shMaxAlong, double &along95)
Definition: TCShower.cxx:2015
bool FindShowerStart(TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:45
void Match2DShowers(std::string inFcnLabel, TCSlice &slc, bool prt)
Definition: TCShower.cxx:882
void DefineDontCluster(TCSlice &slc, bool prt)
Definition: TCShower.cxx:3329
void MergeTjList2(std::string inFcnLabel, TCSlice &slc, std::vector< std::vector< int >> &tjList, bool prt)
bool RemovePFP(std::string inFcnLabel, TCSlice &slc, PFPStruct &pfp, ShowerStruct3D &ss3, bool doUpdate, bool prt)
Definition: TCShower.cxx:1475
void MergeSubShowers(std::string inFcnLabel, TCSlice &slc, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2810
void FindStartChg(std::string inFcnLabel, TCSlice &slc, int cotID, bool prt)
Definition: TCShower.cxx:4076
void Finish3DShowers(TCSlice &slc)
Definition: TCShower.cxx:131
bool AnalyzeRotPos(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3102
float ChgToMeV(float chg)
Definition: TCShower.cxx:4395
bool UpdateShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:1033
void Print2DShowers(std::string someText, TCSlice &slc, CTP_t inCTP, bool printKilledShowers)
Definition: TCShower.cxx:4648
bool CompleteIncompleteShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:739
void MakeShowerObsolete(std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:3242
bool StoreShower(std::string inFcnLabel, TCSlice &slc, ShowerStruct3D &ss3)
Definition: TCShower.cxx:4403
bool Reconcile3D(std::string inFcnLabel, TCSlice &slc, bool parentSearchDone, bool prt)
Definition: TCShower.cxx:431