LArSoft  v06_85_00
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(TjStuff& tjs, std::string fMVAShowerParentWeights);
37  bool FindShowerStart(TjStuff& tjs, ShowerStruct3D& ss3, bool prt);
38  void KillVerticesInShower(std::string inFcnLabel, TjStuff& tjs, ShowerStruct& ss, bool prt);
39  void Finish3DShowers(TjStuff& tjs);
40  bool FindShowers3D(TjStuff& tjs, const geo::TPCID& tpcid);
41  bool Reconcile3D(std::string inFcnLabel, TjStuff& tjs, const geo::TPCID& tpcid, bool parentSearchDone, bool prt);
42  bool Reconcile3D(std::string inFcnLabel, TjStuff& tjs, ShowerStruct3D& ss3, bool prt);
43  bool MergeShowerTjsAndStore(TjStuff& tjs, unsigned short istj, unsigned short jstj, bool prt);
44  bool TransferTjHits(TjStuff& tjs, bool prt);
45  int GetCotID(TjStuff& tjs, int ShowerTjID);
46 
47  bool CompleteIncompleteShower(std::string inFcnLabel, TjStuff& tjs, ShowerStruct3D& ss3, bool prt);
48  void Match2DShowers(std::string inFcnLabel, TjStuff& tjs, const geo::TPCID& tpcid, bool prt);
49  bool UpdateShower(std::string inFcnLabel, TjStuff& tjs, ShowerStruct& ss, bool prt);
50  bool UpdateShower(std::string inFcnLabel, TjStuff& tjs, ShowerStruct3D& ss3, bool prt);
51  float Match3DFOM(std::string inFcnLabel, TjStuff& tjs, int icotID, int jcotID, bool prt);
52  float Match3DFOM(std::string inFcnLabel, TjStuff& tjs, int icotID, int jcotID, int kcotID, bool prt);
53  float Match3DFOM(std::string inFcnLabel, TjStuff& tjs, ShowerStruct3D& ss3, bool prt);
54  void MakeShowerObsolete(std::string inFcnLabel, TjStuff& tjs, ShowerStruct3D& ss3, bool prt);
55  void MakeShowerObsolete(std::string inFcnLabel, TjStuff& tjs, ShowerStruct& ss, bool prt);
56  bool DontCluster(const TjStuff& tjs, const std::vector<int>& tjlist1, const std::vector<int>& tjlist2);
57  void DefineDontCluster(TjStuff& tjs, const geo::TPCID& tpcid, bool prt);
58  bool RemovePFP(std::string inFcnLabel, TjStuff& tjs, PFPStruct& pfp, ShowerStruct3D& ss3, bool doUpdate, bool prt);
59  bool AddPFP(std::string inFcnLabel, TjStuff& tjs, int pID, ShowerStruct3D& ss3, bool doUpdate, bool prt);
60  bool RemovePFP(std::string inFcnLabel, TjStuff& tjs, int pID, ShowerStruct3D& ss3, bool doUpdate, bool prt);
61  bool AddTj(std::string inFcnLabel, TjStuff& tjs, int TjID, ShowerStruct& ss, bool doUpdate, bool prt);
62  bool RemoveTj(std::string inFcnLabel, TjStuff& tjs, int TjID, ShowerStruct& ss, bool doUpdate, bool prt);
63  bool AnalyzeRotPos(std::string inFcnLabel, TjStuff& tjs, ShowerStruct& ss, bool prt);
64  void ReverseShower(std::string inFcnLabel, TjStuff& tjs, ShowerStruct& ss, bool prt);
65  void ReverseShower(std::string inFcnLabel, TjStuff& tjs, int cotID, bool prt);
66  bool FindParent(std::string inFcnLabel, TjStuff& tjs, ShowerStruct3D& ss3, bool prt);
67  bool SetParent(std::string inFcnLabel, TjStuff& tjs, PFPStruct& pfp, ShowerStruct3D& ss3, bool prt);
68  bool WrongSplitTj(std::string inFcnLabel, TjStuff& tjs, Trajectory& tj, unsigned short tjEnd, ShowerStruct& ss, bool prt);
69  bool IsShowerLike(const TjStuff& tjs, const std::vector<int> TjIDs);
70  float InShowerProb(const TjStuff& tjs, const ShowerStruct3D& ss3, const PFPStruct& pfp);
71  float InShowerProb(const TjStuff& tjs, 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, TjStuff& tjs, PFPStruct& pfp, unsigned short pend, ShowerStruct3D& ss3, bool prt);
78  float ParentFOM(std::string inFcnLabel, TjStuff& tjs, Trajectory& tj, unsigned short& tjEnd, ShowerStruct& ss, float& tp1Sep, float& vx3Score, bool prt);
79  void DefineEnvelope(std::string inFcnLabel, TjStuff& tjs, ShowerStruct& ss, bool prt);
80  bool AddTjsInsideEnvelope(std::string inFcnLabel, TjStuff& tjs, ShowerStruct& ss, bool prt);
81  bool AddLooseHits(std::string inFcnLabel, TjStuff& tjs, int cotID, bool prt);
82  void FindStartChg(std::string inFcnLabel, TjStuff& tjs, int cotID, bool prt);
83  std::vector<float> StartChgVec(TjStuff& tjs, int cotID, bool prt);
84  void DumpShowerPts(std::string inFcnLabel, TjStuff& tjs, int cotID);
85 // void CheckQuality(std::string inFcnLabel, TjStuff& tjs, const geo::TPCID& tpcid, bool prt);
86 
87  void FindCots(std::string inFcnLabel, TjStuff& tjs, const CTP_t& inCTP, std::vector<std::vector<int>>& tjLists, bool prt);
88  void TagShowerLike(std::string inFcnLabel, TjStuff& tjs, const CTP_t& inCTP);
89  void FindNearbyTjs(std::string inFcnLabel, TjStuff& tjs, ShowerStruct& ss, bool prt);
90  void AddCloseTjsToList(std::string inFcnLabel, TjStuff& tjs, unsigned short itj, std::vector<int> list);
91  void MergeTjList(std::vector<std::vector<int>>& tjList);
92  void MergeTjList2(std::string inFcnLabel, TjStuff& tjs, std::vector<std::vector<int>>& tjList, bool prt);
93  void MergeNearby2DShowers(std::string inFcnLabel, TjStuff& tjs, const CTP_t& inCTP, bool prt);
94  void MergeOverlap(std::string inFcnLabel, TjStuff& tjs, const CTP_t& inCTP, bool prt);
95  void MergeShowerChain(std::string inFcnLabel, TjStuff& tjs, const CTP_t& inCTP, bool prt);
96  void MergeSubShowersTj(std::string inFcnLabel, TjStuff& tjs, const CTP_t& inCTP, bool prt);
97  void MergeSubShowers(std::string inFcnLabel, TjStuff& tjs, const CTP_t& inCTP, bool prt);
98  int MergeShowers(std::string inFcnLabel, TjStuff& tjs, std::vector<int> showerIDs, bool prt);
99  bool MergeShowersAndStore(std::string inFcnLabel, TjStuff& tjs, int icotID, int jcotID, bool prt);
100  double ShowerEnergy(const ShowerStruct3D& ss3);
101  float ShowerEnergy(const TjStuff& tjs, const std::vector<int> tjIDs);
102  float ChgToMeV(float chg);
103  PFPStruct CreateFakePFP(const TjStuff& tjs, const ShowerStruct3D& ss3);
104  bool StoreShower(std::string inFcnLabel, TjStuff& tjs, ShowerStruct3D& ss3);
105  bool StoreShower(std::string inFcnLabel, TjStuff& tjs, ShowerStruct& ss);
106  ShowerStruct3D CreateSS3(TjStuff& tjs, const geo::TPCID& tpcid);
107  ShowerStruct CreateSS(TjStuff& tjs, CTP_t inCTP, const std::vector<int>& tjl);
108  bool ChkAssns(std::string inFcnLabel, TjStuff& tjs);
109  void PrintShowers(std::string someText, TjStuff& tjs);
110  void Print2DShowers(std::string someText, const TjStuff& tjs, CTP_t inCTP, bool printKilledShowers);
111  void PrintShower(std::string someText, const TjStuff& tjs, const ShowerStruct& ss, bool printHeader, bool printExtras);
112 
113 }
114 
115 
116 #endif // ifndef TRAJCLUSTERALGSHOWERS_H
bool TransferTjHits(TjStuff &tjs, bool prt)
Definition: TCShower.cxx:4383
bool FindParent(std::string inFcnLabel, TjStuff &tjs, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:1739
void MakeShowerObsolete(std::string inFcnLabel, TjStuff &tjs, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:3310
bool AddPFP(std::string inFcnLabel, TjStuff &tjs, int pID, ShowerStruct3D &ss3, bool doUpdate, bool prt)
Definition: TCShower.cxx:1570
void MergeShowerChain(std::string inFcnLabel, TjStuff &tjs, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2642
bool AddTjsInsideEnvelope(std::string inFcnLabel, TjStuff &tjs, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3996
void MergeOverlap(std::string inFcnLabel, TjStuff &tjs, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2530
bool AddTj(std::string inFcnLabel, TjStuff &tjs, int tjID, ShowerStruct &ss, bool doUpdate, bool prt)
Definition: TCShower.cxx:1624
void MergeNearby2DShowers(std::string inFcnLabel, TjStuff &tjs, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2443
bool MergeShowersAndStore(std::string inFcnLabel, TjStuff &tjs, int icotID, int jcotID, bool prt)
Definition: TCShower.cxx:3053
void Print2DShowers(std::string someText, const TjStuff &tjs, CTP_t inCTP, bool printKilledShowers)
Definition: TCShower.cxx:4713
double InShowerProbLong(double showerEnergy, double along)
Definition: TCShower.cxx:2118
std::vector< float > StartChgVec(TjStuff &tjs, int cotID, bool prt)
Definition: TCShower.cxx:4254
bool RemovePFP(std::string inFcnLabel, TjStuff &tjs, PFPStruct &pfp, ShowerStruct3D &ss3, bool doUpdate, bool prt)
Definition: TCShower.cxx:1547
bool ChkAssns(std::string inFcnLabel, TjStuff &tjs)
Definition: TCShower.cxx:4625
Float_t ss
Definition: plot.C:23
void ConfigureMVA(TjStuff &tjs, std::string fMVAShowerParentWeights)
Definition: TCShower.cxx:15
bool Reconcile3D(std::string inFcnLabel, TjStuff &tjs, const geo::TPCID &tpcid, bool parentSearchDone, bool prt)
Definition: TCShower.cxx:491
double ShowerEnergy(const ShowerStruct3D &ss3)
Definition: TCShower.cxx:4434
bool SetParent(std::string inFcnLabel, TjStuff &tjs, PFPStruct &pfp, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:1988
void KillVerticesInShower(std::string inFcnLabel, TjStuff &tjs, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:767
bool FindShowerStart(TjStuff &tjs, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:45
double InShowerProbTrans(double showerEnergy, double along, double trans)
Definition: TCShower.cxx:2152
float Match3DFOM(std::string inFcnLabel, TjStuff &tjs, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:1417
void MergeTjList(std::vector< std::vector< int >> &tjList)
Definition: TCShower.cxx:1494
double ShowerParamTransRMS(double showerEnergy, double along)
Definition: TCShower.cxx:2104
bool IsShowerLike(const TjStuff &tjs, const std::vector< int > TjIDs)
Definition: TCShower.cxx:2071
bool WrongSplitTj(std::string inFcnLabel, TjStuff &tjs, Trajectory &tj, unsigned short tjEnd, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:2409
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
Definition: DumpUtils.h:265
void DefineEnvelope(std::string inFcnLabel, TjStuff &tjs, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3936
bool RemoveTj(std::string inFcnLabel, TjStuff &tjs, int TjID, ShowerStruct &ss, bool doUpdate, bool prt)
Definition: TCShower.cxx:1691
void FindCots(std::string inFcnLabel, TjStuff &tjs, const CTP_t &inCTP, std::vector< std::vector< int >> &tjLists, bool prt)
Definition: TCShower.cxx:3485
bool UpdateShower(std::string inFcnLabel, TjStuff &tjs, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:1104
void MergeSubShowers(std::string inFcnLabel, TjStuff &tjs, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2878
PFPStruct CreateFakePFP(const TjStuff &tjs, const ShowerStruct3D &ss3)
Definition: TCShower.cxx:2050
void ReverseShower(std::string inFcnLabel, TjStuff &tjs, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3269
bool StoreShower(std::string inFcnLabel, TjStuff &tjs, ShowerStruct3D &ss3)
Definition: TCShower.cxx:4468
float ParentFOM(std::string inFcnLabel, TjStuff &tjs, PFPStruct &pfp, unsigned short pend, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:2238
void DefineDontCluster(TjStuff &tjs, const geo::TPCID &tpcid, bool prt)
Definition: TCShower.cxx:3397
int GetCotID(TjStuff &tjs, int ShowerTjID)
Definition: TCShower.cxx:4424
void PrintShower(std::string someText, const TjStuff &tjs, const ShowerStruct &ss, bool printHeader, bool printExtras)
Definition: TCShower.cxx:4801
The data type to uniquely identify a TPC.
Definition: geo_types.h:195
bool DontCluster(const TjStuff &tjs, const std::vector< int > &tjlist1, const std::vector< int > &tjlist2)
Definition: TCShower.cxx:3381
Definition of data types for geometry description.
void MergeTjList2(std::string inFcnLabel, TjStuff &tjs, std::vector< std::vector< int >> &tjList, bool prt)
bool MergeShowerTjsAndStore(TjStuff &tjs, unsigned short istj, unsigned short jstj, bool prt)
Definition: TCShower.cxx:3128
ShowerStruct3D CreateSS3(TjStuff &tjs, const geo::TPCID &tpcid)
Definition: TCShower.cxx:4553
unsigned int CTP_t
Definition: DataStructs.h:41
void FindNearbyTjs(std::string inFcnLabel, TjStuff &tjs, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3829
void ShowerParams(double showerEnergy, double &shMaxAlong, double &along95)
Definition: TCShower.cxx:2084
void PrintShowers(std::string fcnLabel, TjStuff &tjs)
Definition: TCShower.cxx:4676
void DumpShowerPts(TjStuff &tjs, int cotID)
Definition: TCShower.cxx:4302
bool AddLooseHits(TjStuff &tjs, int cotID, bool prt)
Definition: TCShower.cxx:4069
void Finish3DShowers(TjStuff &tjs)
Definition: TCShower.cxx:131
ShowerStruct CreateSS(TjStuff &tjs, CTP_t inCTP, const std::vector< int > &tjl)
Definition: TCShower.cxx:4572
bool CompleteIncompleteShower(std::string inFcnLabel, TjStuff &tjs, ShowerStruct3D &ss3, bool prt)
Definition: TCShower.cxx:804
float ChgToMeV(float chg)
Definition: TCShower.cxx:4460
void Match2DShowers(std::string inFcnLabel, TjStuff &tjs, const geo::TPCID &tpcid, bool prt)
Definition: TCShower.cxx:947
int MergeShowers(std::string inFcnLabel, TjStuff &tjs, std::vector< int > ssIDs, bool prt)
Definition: TCShower.cxx:2985
void MergeSubShowersTj(std::string inFcnLabel, TjStuff &tjs, const CTP_t &inCTP, bool prt)
Definition: TCShower.cxx:2768
bool AnalyzeRotPos(std::string inFcnLabel, TjStuff &tjs, ShowerStruct &ss, bool prt)
Definition: TCShower.cxx:3170
void FindStartChg(std::string inFcnLabel, TjStuff &tjs, int cotID, bool prt)
Definition: TCShower.cxx:4142
bool FindShowers3D(TjStuff &tjs, const geo::TPCID &tpcid)
Definition: TCShower.cxx:286
float InShowerProb(const TjStuff &tjs, const ShowerStruct3D &ss3, const PFPStruct &pfp)
Definition: TCShower.cxx:2172
void TagShowerLike(std::string inFcnLabel, TjStuff &tjs, const CTP_t &inCTP)
Definition: TCShower.cxx:3700
void AddCloseTjsToList(TjStuff &tjs, unsigned short itj, std::vector< int > list)
Definition: TCShower.cxx:3907