Skip to content

Commit b0e491f

Browse files
authored
ClusterSearcher and RecoCluster (#365)
* -Updated DigitBuilder to be more consistent with, but independent of ClusterFinder's corresponding functions --Added some extra features, such as hit LAPPD count and strip-by-strip LAPPD hits. -Added ClusterSearcher to replace ClusterFinder using RecoDigit and RecoCluster classes -Updated RecoDigit and RecoCluster classes for corresponding use and new features, such as various cluster parameters -Added NeutronCheck tool as output for RecoCluster information -Added sample toolchain configfolder for using the new tools * Update to previous commit in accordance with feedback: -Changed RecoCluster and RecoDigit lists in several tools to be vectors of objects, rather than vectors of pointers, to avoid memory complications -removed unused convex hull function from RecoCluster class -simplified CalcAS function in RecoCluster class by consolidating for loops -removed several instances of commented-out code from older versions -removed several debug outputs -altered hard-coded time window values in several instances to rely on configuration input -added use of the true Q2 value from the GenieInfo store to NeutronCheck's output. -removed several uncontrolled cout lines, and replaced useful ones with Log. -Tidied the Instance() function of ClusterSearcher -Added vertex information to NeutronCheck * Removed ClusterCA from NeutronCheck to fix bug. * Modified HitCleaner for non-pointer Digits list. * Update/fix to ClusterSearcher sample toolchain. * Removed HitCleaner::FilterByClusters because it is neither functional nor memory-safe with recent changes to RecoDigit storage. * -removed unused configvariable ArgonFV from ClusterSearcher/EventSelectorConfig -removed unhelpful forced loop end from single-pe gains extraction in ClusterSearcher::Initialize() -changed Genie version in ClusterSearcher/LoadGenieEventConfig to 1 * Fixed memory leak caused by double-pointing to the same object -replaced all instances of fClusterList with fRecoClusters in ClusterSearcher -changed ClusterSearcher::RecoClusters() to a void function, since it was returning a member pointer to itself -removed ClusterSearcher::SelectByClusters(), which is not used * Pointer cleanup in RecoClusterClass
1 parent 91d5cd8 commit b0e491f

28 files changed

Lines changed: 2786 additions & 276 deletions

DataModel/RecoCluster.cpp

Lines changed: 397 additions & 9 deletions
Large diffs are not rendered by default.

DataModel/RecoCluster.h

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@
33
#ifndef RECOCLUSTER_H
44
#define RECOCLUSTER_H
55
#include "RecoDigit.h"
6+
#include "Position.h"
67
#include<SerialisableObject.h>
8+
#include "TVector3.h"
9+
#include "TMatrixDSym.h"
10+
#include "TMatrixDSymEigen.h"
11+
#include "TVectorD.h"
12+
#include "TMath.h"
13+
#include "TF1.h"
14+
#include "Math/IFunction.h"
715

816
class RecoCluster : public SerialisableObject {
917

@@ -16,19 +24,96 @@ class RecoCluster : public SerialisableObject {
1624
void Reset();
1725
void SortCluster();
1826

19-
void AddDigit(RecoDigit* digit);
27+
void AddDigit(RecoDigit digit);
28+
inline void SetDigits(vector<RecoDigit> indigits){fDigitList=indigits;}
2029

21-
RecoDigit* GetDigit(int n);
30+
RecoDigit GetDigit(int n);
31+
32+
void SetClusterMode(int cmode);
33+
34+
int GetClusterMode();
35+
36+
std::vector<RecoDigit> GetDigitList() {return fDigitList;}
37+
2238
int GetNDigits();
2339

2440
bool Print() {
2541
cout<<"Number of digits in this cluster : "<<GetNDigits()<<endl;
42+
cout<<"Clustering mode : "<<GetClusterMode()<<endl;
2643
return true;
2744
}
2845

46+
inline double GetTime() { return clusterTime; }
47+
inline double GetCharge() { return clusterCharge; }
48+
49+
void CalcTime();
50+
void CalcCharge();
51+
52+
inline double GetCB() { return clusterCB; }
53+
inline Position GetCV() {return ChargeVector; }
54+
55+
void CalcCB();
56+
void CalcAS();
57+
void CalcCV();
58+
void CalcAMD();
59+
void CalcSA();
60+
void CalcAW();
61+
void CalcPlanaritySphericity();
62+
double CalcBeta(int order);
63+
void CalcTR();
64+
void CalcParameters();
65+
int calcBestParent();
66+
double GetAS(int mode);
67+
inline double GetASC(){return ASC;}
68+
inline double GetAMD(){return AMD;}
69+
inline Position GetSA(){return SpatialAverage;}
70+
inline double GetAW(){return AngularWidth;}
71+
inline double GetPlanarity(){return Planarity;}
72+
inline double GetSphericity(){return Sphericity;}
73+
double GetBeta(int order);
74+
inline double GetTimeRangeT() {return TRTotal;}
75+
inline double GetTimeRangeQ() {return TRQ;}
76+
inline double GetTimeRangeC() {return TRCluster;}
77+
inline double GetTRRTQ(){return TRRatioTQ;}
78+
inline double GetTRRTC() { return TRRatioTC; }
79+
inline double GetTRRQC() { return TRRatioQC; }
80+
81+
void SetParticle(int pID,int pPDG, double eff, double pur);
82+
inline int GetBestParent(){return bestParticleID;}
83+
inline void SetPDG(int pPDG) {bestParticlePDG=pPDG;}
84+
inline int GetPDG(){return bestParticlePDG;}
85+
inline double Efficiency(){return efficiency;}
86+
inline double Purity(){return purity;}
87+
88+
bool CheckFilter();
89+
inline bool GetFilterStatus(){return fIsFiltered;}
90+
//void CleanDigits();
91+
2992
private:
93+
double clusterTime;
94+
double clusterCharge;
95+
double clusterCB;
96+
double AS0, AS1, ASC;
97+
double AMD;
98+
Position ChargeVector;
99+
Position SpatialAverage;
100+
double AngularWidth;
101+
double Planarity=-999;
102+
double Sphericity=-999;
103+
std::map<int,double> BetaParameters;
104+
double TRTotal, TRQ, TRCluster;
105+
double TRRatioTQ, TRRatioTC,TRRatioQC;
106+
int bestParticleID;
107+
int bestParticlePDG;
108+
double efficiency;
109+
double purity;
110+
bool fIsFiltered=0;
111+
112+
113+
int fClusterMode = -999;
114+
std::vector<RecoDigit> fDigitList;
115+
Position TwoDCenter;
30116

31-
std::vector<RecoDigit*> fDigitList;
32117

33118
protected:
34119
template<class Archive> void serialize(Archive & ar, const unsigned int version){

DataModel/RecoDigit.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,32 @@ class RecoDigit : public SerialisableObject{
3333
fIsFiltered = 1;
3434
ANNIERecoObjectTable::Instance()->NewDigit();
3535
}
36+
RecoDigit(RecoDigit* origin) {
37+
serialise=true;
38+
fRegion=origin->GetRegion();
39+
fPosition = origin->GetPosition();
40+
fCalTime = origin->GetCalTime();
41+
fCalCharge=origin->GetCalCharge();
42+
fDigitType=origin->GetDigitType();
43+
fDetectorID=origin->GetDetectorID();
44+
fIsFiltered=origin->GetFilterStatus();
45+
46+
}
3647
~RecoDigit() {/*ANNIERecoObjectTable::Instance()->DeleteDigit();*/}
3748

49+
bool operator<(const RecoDigit other) const {
50+
return (fPosition.X() == other.GetPosition().X()) ? fPosition.Y() < other.GetPosition().Y() : fPosition.X() < other.GetPosition().X();
51+
}
52+
3853
inline int GetRegion() const {return fRegion;}
3954
inline Position GetPosition() const {return fPosition;}
4055
inline double GetCalTime() const {return fCalTime;}
4156
inline double GetCalCharge() const {return fCalCharge;}
4257
inline bool GetFilterStatus() const {return fIsFiltered;}
58+
inline vector<int> GetClusteredModes() { return fClusterMode; }
4359
inline int GetDigitType() const {return fDigitType;}
4460
inline int GetDetectorID() const {return fDetectorID;}
61+
inline std::vector<int> GetParents() const {return Parents;}
4562

4663
inline void SetRegion(int reg) {fRegion = reg;}
4764
inline void SetPosition(Position pos){fPosition = pos;}
@@ -52,6 +69,9 @@ class RecoDigit : public SerialisableObject{
5269
inline void SetFilter(bool pass = 1) { fIsFiltered = pass;}
5370
inline void ResetFilter() {SetFilter(0);}
5471
inline void PassFilter() {SetFilter(1);}
72+
inline void AddCluster(int InClusterMode) {fClusterMode.push_back(InClusterMode); }
73+
inline void UnCluster(){fClusterMode.pop_back(); }
74+
inline void SetParents(std::vector<int> parentsin) { Parents = parentsin; }
5575

5676
bool Print() {
5777
cout<<"Region : "<<fRegion<<endl;
@@ -70,8 +90,10 @@ class RecoDigit : public SerialisableObject{
7090
double fCalTime;
7191
double fCalCharge;
7292
bool fIsFiltered;
93+
vector<int> fClusterMode;
7394
int fDigitType;
7495
int fDetectorID;
96+
std::vector<int> Parents;
7597

7698
template<class Archive> void serialize(Archive & ar, const unsigned int version){
7799
if(serialise){

0 commit comments

Comments
 (0)