]>
Commit | Line | Data |
---|---|---|
55a288e5 | 1 | #ifndef ALITRDCALIBRAFILLHISTO_H |
6bbdc11a | 2 | #define ALITRDCALIBRAFILLHISTO_H |
55a288e5 | 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_TProfile2D |
18 | # include <TProfile2D.h> | |
19 | #endif | |
6bbdc11a | 20 | |
55a288e5 | 21 | |
55a288e5 | 22 | class TProfile2D; |
55a288e5 | 23 | class TObjArray; |
24 | class TH1F; | |
25 | class TH2I; | |
170c35f1 | 26 | class TH2F; |
55a288e5 | 27 | class TH2; |
170c35f1 | 28 | class TLinearFitter; |
3a0f6479 | 29 | class TTreeSRedirector; |
55a288e5 | 30 | |
31 | class AliLog; | |
f162af62 | 32 | class AliRawReader; |
33 | ||
55a288e5 | 34 | class AliTRDCalibraMode; |
35 | class AliTRDCalibraVector; | |
3a0f6479 | 36 | class AliTRDCalibraVdriftLinearFit; |
b70c68da | 37 | class AliTRDrawStreamBase; |
55a288e5 | 38 | class AliTRDcluster; |
bcb6fb78 | 39 | class AliTRDtrackV1; |
55a288e5 | 40 | class AliTRDtrack; |
bcb6fb78 | 41 | class AliTRDseedV1; |
f162af62 | 42 | class AliTRDgeometry; |
d0569428 | 43 | class AliTRDCalDet; |
44 | class AliTRDCalROC; | |
01239968 | 45 | class AliTRDcalibDB; |
d0569428 | 46 | |
1785640c | 47 | class AliTRDrawFastStream; |
48 | class AliTRDdigitsManager; | |
49 | class AliTRDSignalIndex; | |
170c35f1 | 50 | |
51 | struct eventHeaderStruct; | |
55a288e5 | 52 | |
53 | class AliTRDCalibraFillHisto : public TObject { | |
54 | ||
55 | public: | |
56 | ||
57 | // Instance | |
58 | static AliTRDCalibraFillHisto *Instance(); | |
59 | static void Terminate(); | |
60 | static void Destroy(); | |
bcb6fb78 | 61 | void DestroyDebugStreamer(); |
62 | ||
55a288e5 | 63 | |
64 | AliTRDCalibraFillHisto(const AliTRDCalibraFillHisto &c); | |
65 | AliTRDCalibraFillHisto &operator=(const AliTRDCalibraFillHisto &) { return *this; } | |
66 | ||
bcb6fb78 | 67 | // Functions for initialising and filling with AliTRDtrackV1 |
9ff7be6d | 68 | Bool_t Init2Dhistos(Int_t nboftimebin = -1); |
a2a4ec8e | 69 | Bool_t InitCalDet(); |
6bbdc11a | 70 | Bool_t UpdateHistograms(const AliTRDtrack *t); |
71 | Bool_t UpdateHistogramsV1(const AliTRDtrackV1 *t); | |
55a288e5 | 72 | |
3a0f6479 | 73 | // Process events DAQ |
b70c68da | 74 | Int_t ProcessEventDAQ(AliTRDrawStreamBase *rawStream, Bool_t nocheck = kFALSE); |
3a0f6479 | 75 | Int_t ProcessEventDAQ(AliRawReader *rawReader, Bool_t nocheck = kFALSE); |
6bbdc11a | 76 | Int_t ProcessEventDAQ(const eventHeaderStruct *event, Bool_t nocheck = kFALSE); |
1785640c | 77 | Int_t ProcessEventDAQ2(AliRawReader *rawReader); |
fd50bb14 | 78 | Int_t ProcessEventDAQ3(AliRawReader *rawReader); |
170c35f1 | 79 | |
55a288e5 | 80 | // Is Pad on |
bcb6fb78 | 81 | Bool_t IsPadOn(Int_t detector, Int_t row, Int_t col) const; |
55a288e5 | 82 | |
170c35f1 | 83 | // Functions for write |
84 | void Write2d(const Char_t *filename = "TRD.calibration.root", Bool_t append = kFALSE); | |
85 | ||
55a288e5 | 86 | //For the statistics |
87 | Double_t *StatH(TH2 *ch, Int_t i); | |
170c35f1 | 88 | Double_t *GetMeanMedianRMSNumberCH(); |
89 | Double_t *GetMeanMedianRMSNumberLinearFitter() const; | |
64942b85 | 90 | // LinearFitter |
91 | void AnalyseLinearFitter(); | |
170c35f1 | 92 | |
55a288e5 | 93 | |
94 | // | |
95 | // Set of Get the variables | |
96 | // | |
97 | ||
64942b85 | 98 | void SetIsHLT(Bool_t isHLT = kTRUE) { fIsHLT = isHLT; } |
99 | Bool_t IsHLT() const { return fIsHLT; } | |
100 | ||
55a288e5 | 101 | // Choice to fill or not the 2D |
e526983e | 102 | void SetPH2dOn(Bool_t ph2don = kTRUE) { fPH2dOn = ph2don; } |
3a0f6479 | 103 | void SetCH2dOn(Bool_t ch2don = kTRUE) { fCH2dOn = ch2don; } |
104 | void SetPRF2dOn(Bool_t prf2don = kTRUE) { fPRF2dOn = prf2don; } | |
105 | void SetHisto2d(Bool_t histo2d = kTRUE) { fHisto2d = histo2d; } | |
106 | void SetVector2d(Bool_t vector2d = kTRUE) { fVector2d = vector2d; } | |
107 | void SetLinearFitterOn(Bool_t linearfitteron = kTRUE) { fLinearFitterOn = linearfitteron;} | |
108 | void SetLinearFitterDebugOn(Bool_t debug = kTRUE) { fLinearFitterDebugOn = debug; } | |
4c865c34 | 109 | void SetVersionGainUsed(Int_t versionGainUsed) { fVersionGainUsed = versionGainUsed; } |
110 | void SetSubVersionGainUsed(Int_t subVersionGainUsed) { fSubVersionGainUsed = subVersionGainUsed; } | |
a2a4ec8e | 111 | void SetVersionGainLocalUsed(Int_t versionGainLocalUsed) { fVersionGainLocalUsed = versionGainLocalUsed; } |
112 | void SetSubVersionGainLocalUsed(Int_t subVersionGainLocalUsed) { fSubVersionGainLocalUsed = subVersionGainLocalUsed; } | |
4c865c34 | 113 | void SetVersionVdriftUsed(Int_t versionVdriftUsed) { fVersionVdriftUsed = versionVdriftUsed; } |
114 | void SetSubVersionVdriftUsed(Int_t subVersionVdriftUsed) { fSubVersionVdriftUsed = subVersionVdriftUsed; } | |
115 | ||
55a288e5 | 116 | |
e526983e | 117 | Bool_t GetPH2dOn() const { return fPH2dOn; } |
55a288e5 | 118 | Bool_t GetCH2dOn() const { return fCH2dOn; } |
119 | Bool_t GetPRF2dOn() const { return fPRF2dOn; } | |
120 | Bool_t GetHisto2d() const { return fHisto2d; } | |
121 | Bool_t GetVector2d() const { return fVector2d; } | |
3a0f6479 | 122 | Bool_t GetLinearFitterOn() const { return fLinearFitterOn; } |
4c865c34 | 123 | Bool_t GetLinearFitterDebugOn() const { return fLinearFitterDebugOn; } |
124 | Int_t GetVersionGainUsed() const { return fVersionGainUsed; } | |
125 | Int_t GetSubVersionGainUsed() const { return fSubVersionGainUsed; } | |
126 | Int_t GetVersionVdriftUsed() const { return fVersionVdriftUsed; } | |
127 | Int_t GetSubVersionVdriftUsed() const { return fSubVersionVdriftUsed; } | |
bcb6fb78 | 128 | |
129 | ||
130 | // Get stuff that are filled | |
131 | TH2I *GetCH2d(); | |
3a0f6479 | 132 | TProfile2D *GetPH2d(Int_t nbtimebin=24, Float_t samplefrequency= 10.0); |
170c35f1 | 133 | TProfile2D *GetPRF2d() const { return fPRF2d; } |
134 | TObjArray GetLinearFitterArray() const { return fLinearFitterArray; } | |
135 | TLinearFitter *GetLinearFitter(Int_t detector, Bool_t force=kFALSE); | |
d0569428 | 136 | AliTRDCalibraVdriftLinearFit *GetVdriftLinearFit() const { return fLinearVdriftFit; } |
3a0f6479 | 137 | |
170c35f1 | 138 | |
55a288e5 | 139 | // How to fill the 2D |
55a288e5 | 140 | void SetRelativeScale(Float_t relativeScale); |
55a288e5 | 141 | void SetThresholdClusterPRF2(Float_t thresholdClusterPRF2) { fThresholdClusterPRF2 = thresholdClusterPRF2; } |
b70c68da | 142 | void SetLimitChargeIntegration(Bool_t limitChargeIntegration) { fLimitChargeIntegration = limitChargeIntegration; } |
37b0cf5e | 143 | void SetFillWithZero(Bool_t fillWithZero) { fFillWithZero = fillWithZero; } |
64942b85 | 144 | void SetNormalizeNbOfCluster(Bool_t normalizeNbOfCluster) { fNormalizeNbOfCluster = normalizeNbOfCluster; } |
145 | void SetMaxCluster(Float_t maxCluster) { fMaxCluster = maxCluster; } | |
146 | void SetNbMaxCluster(Short_t nbMaxCluster) { fNbMaxCluster = nbMaxCluster; } | |
170c35f1 | 147 | void SetNz(Int_t i, Short_t nz); |
55a288e5 | 148 | void SetNrphi(Int_t i, Short_t nrphi); |
64942b85 | 149 | void SetAllTogether(Int_t i); |
150 | void SetPerSuperModule(Int_t i); | |
151 | void SetProcent(Float_t procent) { fProcent = procent; } | |
55a288e5 | 152 | void SetDifference(Short_t difference) { fDifference = difference; } |
e526983e | 153 | void SetNumberClusters(Short_t numberClusters) { if(numberClusters >= 0) fNumberClusters = numberClusters; } |
bcb6fb78 | 154 | void SetNumberClustersf(Short_t numberClustersf) { fNumberClustersf = numberClustersf; } |
6aafa7ea | 155 | void SetNumberClustersProcent(Float_t numberClustersProcent) { fNumberClustersProcent = numberClustersProcent; } |
156 | void SetThresholdClustersDAQ(Float_t thresholdClustersDAQ) { fThresholdClustersDAQ = thresholdClustersDAQ; } | |
157 | void SetNumberRowDAQ(Short_t numberRowDAQ) { fNumberRowDAQ = numberRowDAQ; } | |
158 | void SetNumberColDAQ(Short_t numberColDAQ) { fNumberColDAQ = numberColDAQ; } | |
1785640c | 159 | void SetNumberBinCharge(Short_t numberBinCharge) { fNumberBinCharge = numberBinCharge; } |
55a288e5 | 160 | void SetNumberBinPRF(Short_t numberBinPRF) { fNumberBinPRF = numberBinPRF; } |
170c35f1 | 161 | void SetNumberGroupsPRF(Short_t numberGroupsPRF); |
55a288e5 | 162 | |
163 | Float_t GetRelativeScale() const { return fRelativeScale; } | |
55a288e5 | 164 | Float_t GetThresholdClusterPRF2() const { return fThresholdClusterPRF2; } |
b70c68da | 165 | Bool_t GetLimitChargeIntegration() const { return fLimitChargeIntegration; } |
37b0cf5e | 166 | Bool_t GetFillWithZero() const { return fFillWithZero; } |
64942b85 | 167 | Bool_t GetNormalizeNbOfCluster() const { return fNormalizeNbOfCluster; } |
168 | Float_t GetMaxCluster() const { return fMaxCluster; } | |
169 | Short_t GetNbMaxCluster() const { return fNbMaxCluster; } | |
55a288e5 | 170 | Float_t GetProcent() const { return fProcent; } |
171 | Short_t GetDifference() const { return fDifference; } | |
172 | Short_t GetNumberClusters() const { return fNumberClusters; } | |
bcb6fb78 | 173 | Short_t GetNumberClustersf() const { return fNumberClustersf; } |
55a288e5 | 174 | Short_t GetNumberBinCharge() const { return fNumberBinCharge; } |
175 | Short_t GetNumberBinPRF() const { return fNumberBinPRF; } | |
170c35f1 | 176 | Short_t GetNumberGroupsPRF() const { return fNgroupprf; } |
177 | Int_t *GetEntriesLinearFitter() const { return fEntriesLinearFitter; } | |
55a288e5 | 178 | |
170c35f1 | 179 | // Debug |
180 | void SetDebugLevel(Short_t level) { fDebugLevel = level; } | |
181 | ||
182 | // Vector method | |
55a288e5 | 183 | AliTRDCalibraVector *GetCalibraVector() const { return fCalibraVector; } |
e4db522f | 184 | |
55a288e5 | 185 | protected: |
186 | ||
f162af62 | 187 | // Geometry |
188 | AliTRDgeometry *fGeo; //! The TRD geometry | |
01239968 | 189 | // calibration DB |
190 | AliTRDcalibDB *fCalibDB; //! The pointer to the TRDcalibDB instance | |
f162af62 | 191 | |
64942b85 | 192 | // Is HLT |
193 | Bool_t fIsHLT; // Now if HLT, the per detector | |
194 | ||
55a288e5 | 195 | // Choice to fill or not the 2D |
e526983e | 196 | Bool_t fCH2dOn; // Chose to fill the 2D histos or vectors for the relative gain calibration |
55a288e5 | 197 | Bool_t fPH2dOn; // Chose to fill the 2D histos or vectors for the drift velocity and T0 |
198 | Bool_t fPRF2dOn; // Chose to fill the 2D histos or vectors for the pad response function calibration | |
199 | Bool_t fHisto2d; // Chose to fill the 2D histos | |
200 | Bool_t fVector2d; // Chose to fill vectors | |
170c35f1 | 201 | Bool_t fLinearFitterOn; // Method with linear fit for drift velocity |
202 | Bool_t fLinearFitterDebugOn; // Method with linear fit for drift velocity | |
55a288e5 | 203 | |
204 | // How to fill the 2D | |
205 | Float_t fRelativeScale; // Scale of the deposited charge | |
170c35f1 | 206 | Float_t fThresholdClusterPRF2; // Threshold on cluster pad signals |
b70c68da | 207 | Bool_t fLimitChargeIntegration; // Integration range for the gain calibration |
37b0cf5e | 208 | Bool_t fFillWithZero; // Fill with zero or not the average pulse height |
64942b85 | 209 | Bool_t fNormalizeNbOfCluster; // Normalize with the number of cluster for the gain |
210 | Float_t fMaxCluster; // Max amplitude of one cluster | |
211 | Short_t fNbMaxCluster; // Number of tb at the end | |
4c865c34 | 212 | // Back correction |
213 | Int_t fVersionGainUsed; // VersionGainUsed | |
214 | Int_t fSubVersionGainUsed; // SubVersionGainUsed | |
a2a4ec8e | 215 | Int_t fVersionGainLocalUsed; // VersionGainUsed |
216 | Int_t fSubVersionGainLocalUsed;// SubVersionGainUsed | |
4c865c34 | 217 | Int_t fVersionVdriftUsed; // VersionVdriftUsed |
218 | Int_t fSubVersionVdriftUsed; // SubVersionVdriftUsed | |
170c35f1 | 219 | // Calibration mode |
55a288e5 | 220 | AliTRDCalibraMode *fCalibraMode; // Calibration mode |
221 | ||
170c35f1 | 222 | //For debugging |
223 | TTreeSRedirector *fDebugStreamer; //!Debug streamer | |
224 | Short_t fDebugLevel; // Flag for debugging | |
55a288e5 | 225 | // |
226 | // Internal variables | |
227 | // | |
228 | ||
229 | // Fill the 2D histos in the offline tracking | |
170c35f1 | 230 | Int_t fDetectorPreviousTrack; // Change of detector |
e4db522f | 231 | Int_t fMCMPrevious; // Change of MCM |
232 | Int_t fROBPrevious; // Change of ROB | |
170c35f1 | 233 | Short_t fNumberClusters; // Minimum number of clusters in the tracklets |
bcb6fb78 | 234 | Short_t fNumberClustersf; // Maximum number of clusters in the tracklets |
6aafa7ea | 235 | Float_t fNumberClustersProcent; // Procent of number of time bins for fNumberClusters |
236 | Float_t fThresholdClustersDAQ; // Threshold clusters for DAQ algorithm | |
237 | Short_t fNumberRowDAQ; // Size of the spot for DAQ algorithm | |
238 | Short_t fNumberColDAQ; // Size of the spot for DAQ algorithm | |
55a288e5 | 239 | Float_t fProcent; // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH) |
240 | Short_t fDifference; // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH) | |
241 | Int_t fNumberTrack; // How many tracks could be used (Debug for the moment) | |
242 | Int_t fNumberUsedCh[2]; // How many tracks have been really used for the gain (0, strict; 1 with fProcent) | |
243 | Int_t fNumberUsedPh[2]; // How many tracks have been really used for the drift velocity (0, strict; 1 with fDifference) | |
244 | Int_t fTimeMax; // Number of time bins | |
245 | Float_t fSf; // Sampling frequence | |
246 | Short_t fNumberBinCharge; // Number of bins for the gain factor | |
247 | Short_t fNumberBinPRF; // Number of bin for the PRF | |
170c35f1 | 248 | Short_t fNgroupprf; // Number of groups in tnp bins for PRF /2.0 |
249 | ||
250 | // Variables per tracklet | |
170c35f1 | 251 | Float_t *fAmpTotal; // Energy deposited in the calibration group by the track |
252 | Short_t *fPHPlace; // Calibration group of PH | |
253 | Float_t *fPHValue; // PH | |
254 | Bool_t fGoodTracklet; // Good tracklet | |
1ca79a00 | 255 | TLinearFitter *fLinearFitterTracklet; // linear fitter tracklet |
bcb6fb78 | 256 | //Statistics |
170c35f1 | 257 | Int_t *fEntriesCH; // Number of entries CH |
258 | Int_t *fEntriesLinearFitter; // Number of entries LinearFitter | |
259 | ||
55a288e5 | 260 | |
261 | // | |
262 | // Vector method | |
263 | // | |
d0569428 | 264 | |
265 | AliTRDCalibraVector *fCalibraVector; // The vector object | |
55a288e5 | 266 | |
267 | ||
268 | // Histograms to store the info from the digits, from the tracklets or from the tracks | |
d0569428 | 269 | TProfile2D *fPH2d; // 2D average pulse height |
270 | TProfile2D *fPRF2d; // 2D PRF | |
271 | TH2I *fCH2d; // 2D deposited charge | |
272 | TObjArray fLinearFitterArray; // TObjArray of Linear Fitters for the detectors | |
273 | AliTRDCalibraVdriftLinearFit *fLinearVdriftFit; // Info Linear Fit | |
274 | ||
275 | // Current calib object: to correct for the database used | |
276 | AliTRDCalDet *fCalDetGain; // Current calib object gain | |
277 | AliTRDCalROC *fCalROCGain; // Current calib object gain | |
bcb6fb78 | 278 | |
55a288e5 | 279 | // |
280 | // A lot of internal functions...... | |
a2a4ec8e | 281 | // Init |
282 | Bool_t InitCalPad(Int_t detector); | |
55a288e5 | 283 | // |
55a288e5 | 284 | // Create the 2D histo to be filled Online |
285 | void CreateCH2d(Int_t nn); | |
286 | void CreatePH2d(Int_t nn); | |
3a0f6479 | 287 | void CreatePRF2d(Int_t nn); |
55a288e5 | 288 | |
bcb6fb78 | 289 | // Calibration with AliTRDtrackV1 |
55a288e5 | 290 | void FillTheInfoOfTheTrackPH(); |
bcb6fb78 | 291 | void FillTheInfoOfTheTrackCH(Int_t nbclusters); |
6bbdc11a | 292 | Bool_t FindP1TrackPHtracklet(const AliTRDtrack *t, Int_t index0, Int_t index1); |
bcb6fb78 | 293 | Bool_t FindP1TrackPHtrackletV1(const AliTRDseedV1 *tracklet, Int_t nbclusters); |
6bbdc11a | 294 | Bool_t HandlePRFtracklet(const AliTRDtrack *t, Int_t index0, Int_t index1); |
bcb6fb78 | 295 | Bool_t HandlePRFtrackletV1(const AliTRDseedV1 *tracklet, Int_t nbclusters); |
296 | void ResetfVariablestracklet(); | |
1785640c | 297 | void StoreInfoCHPHtrack(const AliTRDcluster *cl,const Double_t dqdl,const Int_t *group,const Int_t row,const Int_t col,const AliTRDcluster *cls=0x0); |
170c35f1 | 298 | void FillCH2d(Int_t x, Float_t y); |
bcb6fb78 | 299 | |
300 | // Calibration on DAQ | |
301 | ||
302 | Int_t FillDAQ(Double_t phvalue[16][144][36]); | |
bcb6fb78 | 303 | Bool_t UpdateDAQ(Int_t det, Int_t /*row*/, Int_t /*col*/, Int_t timebin, Float_t signal, Int_t nbtimebins); |
00a3834d | 304 | |
305 | // row col calibration groups stuff | |
55a288e5 | 306 | Bool_t LocalisationDetectorXbins(Int_t detector); |
170c35f1 | 307 | Int_t CalculateTotalNumberOfBins(Int_t i); |
6bbdc11a | 308 | void CheckGoodTrackletV0(const Int_t detector,const Int_t row,const Int_t col); |
309 | void CheckGoodTrackletV1(const AliTRDcluster *cl); | |
bcb6fb78 | 310 | Int_t CalculateCalibrationGroup(Int_t i, Int_t row, Int_t col) const; |
170c35f1 | 311 | |
55a288e5 | 312 | // Clear |
313 | void ClearHistos(); | |
314 | ||
315 | // Some basic geometry function | |
053767a4 | 316 | virtual Int_t GetLayer(Int_t d) const; |
317 | virtual Int_t GetStack(Int_t d) const; | |
55a288e5 | 318 | virtual Int_t GetSector(Int_t d) const; |
d0569428 | 319 | |
bcb6fb78 | 320 | |
55a288e5 | 321 | // Instance of this class and so on |
170c35f1 | 322 | static AliTRDCalibraFillHisto *fgInstance; // Instance |
323 | static Bool_t fgTerminated; // If terminated | |
0c349049 | 324 | |
0c349049 | 325 | private: |
326 | ||
327 | // This is a singleton, contructor is private! | |
328 | AliTRDCalibraFillHisto(); | |
e4db522f | 329 | virtual ~AliTRDCalibraFillHisto(); |
55a288e5 | 330 | |
e4db522f | 331 | ClassDef(AliTRDCalibraFillHisto,4) // TRD Calibration class |
55a288e5 | 332 | |
333 | }; | |
334 | ||
335 | #endif | |
a2a4ec8e | 336 |