]>
Commit | Line | Data |
---|---|---|
55a288e5 | 1 | #ifndef ALITRDCALIBRAFILLHISTO_H |
2 | #define ALITRDCALIBRAFILLHISTO_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | /////////////////////////////////////////////////////////////////////////////// | |
9 | // // | |
10 | // TRD calibration class for the HLT parameters // | |
11 | // // | |
12 | /////////////////////////////////////////////////////////////////////////////// | |
13 | ||
14 | #ifndef ROOT_TObject | |
15 | # include <TObject.h> | |
16 | #endif | |
170c35f1 | 17 | #ifndef ROOT_TLinearFitter |
18 | # include <TLinearFitter.h> | |
19 | #endif | |
20 | #ifndef ROOT_TProfile2D | |
21 | # include <TProfile2D.h> | |
22 | #endif | |
23 | #ifndef ROOT_TH2I | |
24 | # include <TH2I.h> | |
25 | #endif | |
55a288e5 | 26 | |
55a288e5 | 27 | class TProfile2D; |
55a288e5 | 28 | class TObjArray; |
29 | class TH1F; | |
30 | class TH2I; | |
170c35f1 | 31 | class TH2F; |
55a288e5 | 32 | class TH2; |
170c35f1 | 33 | class TLinearFitter; |
55a288e5 | 34 | |
35 | class AliLog; | |
f162af62 | 36 | class AliRawReader; |
37 | ||
55a288e5 | 38 | class AliTRDCalibraMode; |
39 | class AliTRDCalibraVector; | |
170c35f1 | 40 | class AliTRDRawStream; |
55a288e5 | 41 | class AliTRDcluster; |
42 | class AliTRDtrack; | |
43 | class AliTRDmcmTracklet; | |
f162af62 | 44 | class AliTRDgeometry; |
170c35f1 | 45 | class TTreeSRedirector; |
46 | ||
47 | struct eventHeaderStruct; | |
55a288e5 | 48 | |
49 | class AliTRDCalibraFillHisto : public TObject { | |
50 | ||
51 | public: | |
52 | ||
53 | // Instance | |
54 | static AliTRDCalibraFillHisto *Instance(); | |
55 | static void Terminate(); | |
56 | static void Destroy(); | |
57 | ||
58 | AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c); | |
59 | AliTRDCalibraFillHisto &operator=(const AliTRDCalibraFillHisto &) { return *this; } | |
60 | ||
61 | // Functions for initialising the AliTRDCalibraFillHisto in the code | |
62 | Bool_t Init2Dhistos(); | |
63 | ||
64 | // Functions for filling the histos in the code | |
65 | Bool_t ResetTrack(); | |
66 | Bool_t UpdateHistograms(AliTRDcluster *cl, AliTRDtrack *t); | |
67 | Bool_t UpdateHistogramcm(AliTRDmcmTracklet *trk); | |
68 | ||
170c35f1 | 69 | // Process events DAQ |
70 | Bool_t ProcessEventDAQ(AliTRDRawStream *rawStream); | |
71 | Bool_t ProcessEventDAQ(AliRawReader *rawReader); | |
72 | Bool_t ProcessEventDAQ(eventHeaderStruct *event); | |
73 | ||
74 | Bool_t UpdateDAQ(Int_t det, Int_t /*row*/, Int_t /*col*/, Int_t timebin, Int_t signal, Int_t nbtimebins); | |
75 | ||
76 | ||
55a288e5 | 77 | // Is Pad on |
78 | Bool_t IsPadOn(Int_t detector, Int_t col, Int_t row) const; | |
79 | ||
80 | // Functions for plotting the 2D | |
81 | void Plot2d(); | |
82 | ||
170c35f1 | 83 | // Functions for write |
84 | void Write2d(const Char_t *filename = "TRD.calibration.root", Bool_t append = kFALSE); | |
85 | ||
86 | // Reset the linearfitter objects | |
87 | void ResetLinearFitter(); | |
88 | void ResetCHHisto() { if(fCH2d) fCH2d->Reset(); } | |
89 | void ResetPHHisto() { if(fPH2d) fPH2d->Reset(); } | |
90 | void ResetPRFHisto() { if(fPRF2d) fPRF2d->Reset();} | |
55a288e5 | 91 | |
92 | //For the statistics | |
93 | Double_t *StatH(TH2 *ch, Int_t i); | |
170c35f1 | 94 | Double_t *GetMeanMedianRMSNumberCH(); |
95 | Double_t *GetMeanMedianRMSNumberLinearFitter() const; | |
96 | ||
55a288e5 | 97 | |
98 | // | |
99 | // Set of Get the variables | |
100 | // | |
101 | ||
102 | // Choice to fill or not the 2D | |
103 | void SetMITracking(Bool_t mitracking = kTRUE) { fMITracking = mitracking; } | |
104 | void SetMcmTracking(Bool_t mcmtracking = kTRUE) { fMcmTracking = mcmtracking; } | |
105 | void SetMcmCorrectAngle() { fMcmCorrectAngle = kTRUE; } | |
106 | void SetPH2dOn() { fPH2dOn = kTRUE; } | |
107 | void SetCH2dOn() { fCH2dOn = kTRUE; } | |
108 | void SetPRF2dOn() { fPRF2dOn = kTRUE; } | |
109 | void SetHisto2d() { fHisto2d = kTRUE; } | |
110 | void SetVector2d() { fVector2d = kTRUE; } | |
170c35f1 | 111 | void SetLinearFitterOn() { fLinearFitterOn = kTRUE; } |
112 | void SetLinearFitterDebugOn() { fLinearFitterDebugOn = kTRUE; } | |
113 | ||
55a288e5 | 114 | |
115 | Bool_t GetMITracking() const { return fMITracking; } | |
116 | Bool_t GetMcmTracking() const { return fMcmTracking; } | |
117 | Bool_t GetMcmCorrectAngle() const { return fMcmCorrectAngle; } | |
118 | Bool_t GetPH2dOn() const { return fPH2dOn; } | |
119 | Bool_t GetCH2dOn() const { return fCH2dOn; } | |
120 | Bool_t GetPRF2dOn() const { return fPRF2dOn; } | |
121 | Bool_t GetHisto2d() const { return fHisto2d; } | |
122 | Bool_t GetVector2d() const { return fVector2d; } | |
123 | TH2I *GetCH2d() const { return fCH2d; } | |
170c35f1 | 124 | TProfile2D *GetPH2d(Int_t nbtimebin=24, Float_t samplefrequency= 10.0, Bool_t force=kFALSE); |
125 | TProfile2D *GetPRF2d() const { return fPRF2d; } | |
126 | TObjArray GetLinearFitterArray() const { return fLinearFitterArray; } | |
127 | TLinearFitter *GetLinearFitter(Int_t detector, Bool_t force=kFALSE); | |
128 | TH2F *GetLinearFitterHisto(Int_t detector, Bool_t force=kFALSE); | |
129 | ||
55a288e5 | 130 | // How to fill the 2D |
55a288e5 | 131 | void SetRelativeScale(Float_t relativeScale); |
55a288e5 | 132 | void SetThresholdClusterPRF2(Float_t thresholdClusterPRF2) { fThresholdClusterPRF2 = thresholdClusterPRF2; } |
170c35f1 | 133 | void SetNz(Int_t i, Short_t nz); |
55a288e5 | 134 | void SetNrphi(Int_t i, Short_t nrphi); |
135 | void SetProcent(Float_t procent) { fProcent = procent; } | |
136 | void SetDifference(Short_t difference) { fDifference = difference; } | |
137 | void SetNumberClusters(Short_t numberClusters) { fNumberClusters = numberClusters; } | |
138 | void SetNumberBinCharge(Short_t numberBinCharge) { fNumberBinCharge = numberBinCharge; } | |
139 | void SetNumberBinPRF(Short_t numberBinPRF) { fNumberBinPRF = numberBinPRF; } | |
170c35f1 | 140 | void SetNumberGroupsPRF(Short_t numberGroupsPRF); |
55a288e5 | 141 | |
142 | Float_t GetRelativeScale() const { return fRelativeScale; } | |
55a288e5 | 143 | Float_t GetThresholdClusterPRF2() const { return fThresholdClusterPRF2; } |
144 | Float_t GetProcent() const { return fProcent; } | |
145 | Short_t GetDifference() const { return fDifference; } | |
146 | Short_t GetNumberClusters() const { return fNumberClusters; } | |
147 | Short_t GetNumberBinCharge() const { return fNumberBinCharge; } | |
148 | Short_t GetNumberBinPRF() const { return fNumberBinPRF; } | |
170c35f1 | 149 | Short_t GetNumberGroupsPRF() const { return fNgroupprf; } |
150 | Int_t *GetEntriesLinearFitter() const { return fEntriesLinearFitter; } | |
151 | // Calibration mode | |
55a288e5 | 152 | AliTRDCalibraMode *GetCalibraMode() const { return fCalibraMode; } |
153 | ||
170c35f1 | 154 | // Debug |
155 | void SetDebugLevel(Short_t level) { fDebugLevel = level; } | |
156 | ||
157 | // Vector method | |
55a288e5 | 158 | AliTRDCalibraVector *GetCalibraVector() const { return fCalibraVector; } |
159 | ||
160 | private: | |
161 | ||
162 | // This is a singleton, contructor is private! | |
163 | AliTRDCalibraFillHisto(); | |
164 | virtual ~AliTRDCalibraFillHisto(); | |
165 | ||
166 | protected: | |
167 | ||
f162af62 | 168 | // Geometry |
169 | AliTRDgeometry *fGeo; //! The TRD geometry | |
170 | ||
55a288e5 | 171 | // Choice to fill or not the 2D |
172 | Bool_t fMITracking; // Chose to fill the 2D histos or vectors during the offline MI tracking | |
173 | Bool_t fMcmTracking; // Chose to fill the 2D histos or vectors during the tracking with tracklets | |
174 | Bool_t fMcmCorrectAngle; // Apply correction due to the mcmtrackletangle in the z direction (only) assuming from vertex | |
175 | Bool_t fCH2dOn; // Chose to fill the 2D histos or vectors for the relative gain calibration | |
176 | Bool_t fPH2dOn; // Chose to fill the 2D histos or vectors for the drift velocity and T0 | |
177 | Bool_t fPRF2dOn; // Chose to fill the 2D histos or vectors for the pad response function calibration | |
178 | Bool_t fHisto2d; // Chose to fill the 2D histos | |
179 | Bool_t fVector2d; // Chose to fill vectors | |
170c35f1 | 180 | Bool_t fLinearFitterOn; // Method with linear fit for drift velocity |
181 | Bool_t fLinearFitterDebugOn; // Method with linear fit for drift velocity | |
55a288e5 | 182 | |
183 | // How to fill the 2D | |
184 | Float_t fRelativeScale; // Scale of the deposited charge | |
170c35f1 | 185 | Float_t fThresholdClusterPRF2; // Threshold on cluster pad signals |
186 | // Calibration mode | |
55a288e5 | 187 | AliTRDCalibraMode *fCalibraMode; // Calibration mode |
188 | ||
170c35f1 | 189 | //For debugging |
190 | TTreeSRedirector *fDebugStreamer; //!Debug streamer | |
191 | Short_t fDebugLevel; // Flag for debugging | |
55a288e5 | 192 | // |
193 | // Internal variables | |
194 | // | |
195 | ||
196 | // Fill the 2D histos in the offline tracking | |
197 | Bool_t fDetectorAliTRDtrack; // Change of track | |
170c35f1 | 198 | Int_t fDetectorPreviousTrack; // Change of detector |
199 | Short_t fNumberClusters; // Minimum number of clusters in the tracklets | |
55a288e5 | 200 | Float_t fProcent; // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH) |
201 | Short_t fDifference; // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH) | |
202 | Int_t fNumberTrack; // How many tracks could be used (Debug for the moment) | |
203 | Int_t fNumberUsedCh[2]; // How many tracks have been really used for the gain (0, strict; 1 with fProcent) | |
204 | Int_t fNumberUsedPh[2]; // How many tracks have been really used for the drift velocity (0, strict; 1 with fDifference) | |
205 | Int_t fTimeMax; // Number of time bins | |
206 | Float_t fSf; // Sampling frequence | |
207 | Short_t fNumberBinCharge; // Number of bins for the gain factor | |
208 | Short_t fNumberBinPRF; // Number of bin for the PRF | |
170c35f1 | 209 | Short_t fNgroupprf; // Number of groups in tnp bins for PRF /2.0 |
210 | ||
211 | // Variables per tracklet | |
212 | TObjArray *fListClusters; // List of clusters | |
213 | Double_t *fPar0; // List of track parameter fP[0] | |
214 | Double_t *fPar1; // List of track parameter fP[1] | |
215 | Double_t *fPar2; // List of track parameter fP[2] | |
216 | Double_t *fPar3; // List of track parameter fP[3] | |
217 | Double_t *fPar4; // List of track paarmeter fP[4] | |
218 | Float_t *fAmpTotal; // Energy deposited in the calibration group by the track | |
219 | Short_t *fPHPlace; // Calibration group of PH | |
220 | Float_t *fPHValue; // PH | |
221 | Bool_t fGoodTracklet; // Good tracklet | |
222 | // Variables per track | |
223 | Bool_t fGoodTrack; // no return | |
224 | ||
225 | //Statistics | |
226 | Int_t *fEntriesCH; // Number of entries CH | |
227 | Int_t *fEntriesLinearFitter; // Number of entries LinearFitter | |
228 | ||
55a288e5 | 229 | |
230 | // | |
231 | // Vector method | |
232 | // | |
233 | ||
234 | ||
235 | AliTRDCalibraVector *fCalibraVector; // The vector object | |
236 | ||
237 | ||
238 | // Histograms to store the info from the digits, from the tracklets or from the tracks | |
239 | TProfile2D *fPH2d; // 2D average pulse height | |
240 | TProfile2D *fPRF2d; // 2D PRF | |
170c35f1 | 241 | TH2I *fCH2d; // 2D deposited charge |
242 | TObjArray fLinearFitterArray; // TObjArray of Linear Fitters for the detectors | |
243 | TObjArray fLinearFitterHistoArray; // TObjArray of histo2D for debugging Linear Fitters | |
55a288e5 | 244 | |
245 | // | |
246 | // A lot of internal functions...... | |
247 | // | |
55a288e5 | 248 | // Create the 2D histo to be filled Online |
249 | void CreateCH2d(Int_t nn); | |
250 | void CreatePH2d(Int_t nn); | |
251 | void CreatePRF2d(Int_t nn); | |
252 | ||
253 | // Fill the 2D | |
254 | void FillTheInfoOfTheTrackPH(); | |
255 | void FillTheInfoOfTheTrackCH(); | |
170c35f1 | 256 | void FillCH2d(Int_t x, Float_t y); |
170c35f1 | 257 | Bool_t FindP1TrackPH(); |
55a288e5 | 258 | void ResetfVariables(); |
259 | Bool_t LocalisationDetectorXbins(Int_t detector); | |
170c35f1 | 260 | Int_t *CalculateRowCol(AliTRDcluster *cl) const; |
261 | void CheckGoodTracklet(Int_t detector, Int_t *rowcol); | |
262 | Int_t CalculateCalibrationGroup(Int_t i, Int_t *rowcol) const; | |
263 | Int_t CalculateTotalNumberOfBins(Int_t i); | |
264 | void StoreInfoCHPH(AliTRDcluster *cl, AliTRDtrack *t, Int_t *group); | |
265 | Bool_t HandlePRF(); | |
266 | ||
55a288e5 | 267 | // Clear |
268 | void ClearHistos(); | |
269 | ||
270 | // Some basic geometry function | |
271 | virtual Int_t GetPlane(Int_t d) const; | |
272 | virtual Int_t GetChamber(Int_t d) const; | |
273 | virtual Int_t GetSector(Int_t d) const; | |
274 | ||
275 | ||
276 | // Instance of this class and so on | |
170c35f1 | 277 | static AliTRDCalibraFillHisto *fgInstance; // Instance |
278 | static Bool_t fgTerminated; // If terminated | |
279 | ||
55a288e5 | 280 | |
f162af62 | 281 | ClassDef(AliTRDCalibraFillHisto,3) // TRD Calibration class |
55a288e5 | 282 | |
283 | }; | |
284 | ||
285 | #endif | |
286 | ||
287 |