1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: BaseClusteringModule.hh 2734 2006-06-09 13:03:09Z pesce $ |
---|
3 | // R.Pesce created Jan, 19 2004 |
---|
4 | |
---|
5 | #ifndef __BASECLUSTERINGMODULE_HH_ |
---|
6 | #define __BASECLUSTERINGMODULE_HH_ |
---|
7 | |
---|
8 | #include <vector> |
---|
9 | #include "euso.hh" |
---|
10 | #include "RecoModule.hh" |
---|
11 | |
---|
12 | class EusoCluster; |
---|
13 | class RecoRootEvent; |
---|
14 | |
---|
15 | class BaseClusteringModule : public RecoModule { |
---|
16 | public: |
---|
17 | // ctor |
---|
18 | BaseClusteringModule(); |
---|
19 | |
---|
20 | // dtor |
---|
21 | virtual ~BaseClusteringModule(); |
---|
22 | |
---|
23 | // Init method: called at the beginning of a run |
---|
24 | virtual Bool_t Init(); |
---|
25 | |
---|
26 | // called before each event process |
---|
27 | virtual Bool_t PreProcess(); |
---|
28 | |
---|
29 | // event processing |
---|
30 | virtual Bool_t Process( RecoEvent* ); |
---|
31 | |
---|
32 | // called after processing an event |
---|
33 | virtual Bool_t PostProcess(); |
---|
34 | |
---|
35 | // called at the end of each run |
---|
36 | virtual Bool_t Done(); |
---|
37 | |
---|
38 | // save root output |
---|
39 | virtual Bool_t SaveRootData( RecoRootEvent* ); |
---|
40 | |
---|
41 | // memory clean |
---|
42 | virtual void UserMemoryClean(); |
---|
43 | |
---|
44 | // get a specified cluster |
---|
45 | EusoCluster* GetCluster( Int_t num ); |
---|
46 | |
---|
47 | EsafConfigClass(Reco,BaseClusteringModule) |
---|
48 | |
---|
49 | private: |
---|
50 | |
---|
51 | RecoEvent *fEv; |
---|
52 | RecoRootEvent *fRecoRootEvent; |
---|
53 | Double_t fGtuLength; // GTU length |
---|
54 | |
---|
55 | Double_t fSignalToNoise; // signal to noise ratio (used with processonlysignal) |
---|
56 | Float_t fAlpha; // correcting factor |
---|
57 | Int_t fMainMacroCellId; // id of the most populous macrocell |
---|
58 | Double_t fDensity; // density of points in the main macrocell |
---|
59 | Double_t fThreshold; // threshold on the distance between two points of a cluster |
---|
60 | Int_t fTotalNumPoints; // total number of points |
---|
61 | Int_t fNumClusters; // total number of clusters |
---|
62 | Int_t fNumSigClusters; // number of significant clusters |
---|
63 | Int_t fNumClustersUniform; // number of clusters expected in an uniform distribution |
---|
64 | Int_t fNumPointsMinimum; // minimum number of points in a significant cluster |
---|
65 | Int_t fSignificanceLevel; // level of significance (from config file) |
---|
66 | Double_t fNumHitsMinimum; // minimum number of points in a significant pixel (from config file) |
---|
67 | // if is a negative value the number is calculated from the background rate in the pixel |
---|
68 | Int_t fMeanThreshold; // mean threshold in pixels hits; |
---|
69 | Double_t fFOVThreshold; // if threshold type is fov, the clustering threshold is set to |
---|
70 | // fFOVThreshold * Sqrt(DeltaThetaFOVPixel*DeltaPhiFOVPixel) |
---|
71 | // using the pixel-angle map |
---|
72 | Double_t fNSigmaToSelect; // number of sigmas from the main cluster line within the points are selected |
---|
73 | |
---|
74 | Int_t fGTUDiffThreshold; // threshold in time difference in GTU between two pixels |
---|
75 | |
---|
76 | vector<Int_t> fHitted; // references to pixels with minimum number of hits |
---|
77 | Int_t fNumPoints; // number of pixels with minimum number of hits |
---|
78 | Int_t fNumHits; // number of hits in points over pixel threshold |
---|
79 | // variables for clustering |
---|
80 | Int_t fNumNodes; // number of nodes |
---|
81 | Int_t fNumPointsCluster; // number of points in cluster |
---|
82 | Int_t fCounter; // point to be processed |
---|
83 | Int_t fBookmark; // first point of a new cluster |
---|
84 | vector<Int_t> fId; // identifier of point |
---|
85 | vector<Bool_t> fFlag1; // flag that indicates if a point is already in a cluster |
---|
86 | vector<Bool_t> fFlag2; // flag that indicates if a point is already considered in the |
---|
87 | // current search |
---|
88 | |
---|
89 | // methods for clustering |
---|
90 | void CalculateDensity(); |
---|
91 | void DensityMainMC(); |
---|
92 | void DensityEvent(); |
---|
93 | void CalculateNaturalThreshold(); |
---|
94 | Double_t CalculateDistance(Int_t n1, Int_t n2); |
---|
95 | Int_t CalculateTimeDifference(Int_t n1, Int_t n2); |
---|
96 | void CalculateNumClustersUniform(); |
---|
97 | void CalculateNumPointsMinimum(); |
---|
98 | |
---|
99 | void NewCluster(); |
---|
100 | void SearchClusters(); |
---|
101 | void WriteCluster(); |
---|
102 | void FillCluster(); |
---|
103 | |
---|
104 | void FitCluster( EusoCluster *clu ); |
---|
105 | void HistoCluster(); |
---|
106 | |
---|
107 | // vector of significant clusters |
---|
108 | vector<EusoCluster*> fClusters; |
---|
109 | |
---|
110 | // parameters of the main cluster |
---|
111 | Double_t fSlopeMainPhi; Double_t fOffsetMainPhi; Double_t fAbsDevMainPhi; |
---|
112 | Double_t fSlopeMainTheta; Double_t fOffsetMainTheta; Double_t fAbsDevMainTheta; |
---|
113 | |
---|
114 | // vector of pixel ids to pass to the hough module |
---|
115 | vector<Int_t> fSelectedPixels; |
---|
116 | |
---|
117 | // data organization in GTU, EC,.... |
---|
118 | Int_t fGtuMin; |
---|
119 | Int_t fGtuMax; |
---|
120 | void MakeMaps(); // create the maps of pixel data in Gtu,... |
---|
121 | map< Int_t, vector<Int_t> > fPixelGtuMap; |
---|
122 | |
---|
123 | // quality parameters //FIXME: to check definitions |
---|
124 | Double_t fSignalFraction; // signal fraction (over all signal) in the selected points |
---|
125 | Double_t fSigFracOverThresh; // signal fraction (over the signal in the pixels over threshold) |
---|
126 | // in the selected points |
---|
127 | Double_t fContamination; // percentual of pixel w/o signal in the selected points |
---|
128 | Double_t fContaminationInCluster; // percentual of pixel w/o signal in the main cluster |
---|
129 | |
---|
130 | friend class AutomatedClustering; |
---|
131 | friend class GTUClusteringModule; |
---|
132 | ClassDef(BaseClusteringModule,0) |
---|
133 | }; |
---|
134 | |
---|
135 | #endif /* __BASECLUSTERINGMODULE_HH_ */ |
---|
136 | |
---|