]>
Commit | Line | Data |
---|---|---|
77566f2a | 1 | #ifndef ALITRDCALIBRA_H |
2 | #define ALITRDCALIBRA_H | |
8ec526a4 | 3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
4 | * See cxx source for full Copyright notice */ | |
77566f2a | 5 | |
8ec526a4 | 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 | |
17 | ||
18 | class TTree; | |
19 | class TProfile2D; | |
20 | class TGraphErrors; | |
9f4780aa | 21 | class TGraph; |
8ec526a4 | 22 | class TObjArray; |
23 | class TH1I; | |
24 | class TH1; | |
25 | class TH1F; | |
26 | class TH2I; | |
27 | class TH2F; | |
28 | class TF1; | |
29 | ||
30 | class AliLog; | |
e5c60cc7 | 31 | |
8ec526a4 | 32 | class AliTRDcluster; |
33 | class AliTRDtrack; | |
34 | class AliTRDmcmTracklet; | |
35 | class AliTRDCalDet; | |
77566f2a | 36 | |
37 | class AliTRDCalibra : public TObject { | |
8ec526a4 | 38 | |
77566f2a | 39 | public: |
40 | ||
8ec526a4 | 41 | // Instance |
42 | static AliTRDCalibra *Instance(); | |
77566f2a | 43 | static void Terminate(); |
44 | static void Destroy(); | |
45 | ||
46 | AliTRDCalibra(const AliTRDCalibra &c); | |
47 | AliTRDCalibra &operator=(const AliTRDCalibra &) { return *this; } | |
48 | ||
77566f2a | 49 | // Functions fit online |
8ec526a4 | 50 | Bool_t FitCHOnline(TH2I *ch); |
51 | Bool_t FitCHOnline(); | |
52 | Bool_t FitCHOnline(TTree *tree); | |
53 | Bool_t FitPHOnline(TProfile2D *ph); | |
54 | Bool_t FitPHOnline(); | |
55 | Bool_t FitPHOnline(TTree *tree); | |
56 | Bool_t FitPRFOnline(TProfile2D *prf); | |
57 | Bool_t FitPRFOnline(); | |
58 | Bool_t FitPRFOnline(TTree *tree); | |
77566f2a | 59 | |
60 | // Functions for initialising the AliTRDCalibra in the code | |
8ec526a4 | 61 | Bool_t Init2Dhistos(); |
62 | ||
77566f2a | 63 | // Functions for filling the histos in the code |
8ec526a4 | 64 | Bool_t ResetTrack(); |
65 | Bool_t UpdateHistograms(AliTRDcluster *cl, AliTRDtrack *t); | |
66 | Bool_t UpdateHistogramcm(AliTRDmcmTracklet *trk); | |
77566f2a | 67 | |
77566f2a | 68 | // Is Pad on |
8ec526a4 | 69 | Bool_t IsPadOn(Int_t detector, Int_t col, Int_t row) const; |
77566f2a | 70 | |
71 | // Functions for plotting the 2D | |
8ec526a4 | 72 | void Plot2d(); |
77566f2a | 73 | |
74 | // Functions for writting the 2D | |
8ec526a4 | 75 | Bool_t Write2d(); |
77566f2a | 76 | |
77 | // Function fill 2D for the moment out of the code | |
8ec526a4 | 78 | Bool_t Create2DDiSimOnline(Int_t iev1, Int_t iev2); |
79 | Bool_t Create2DRaDaOnline(Int_t iev1, Int_t iev2); | |
77566f2a | 80 | |
8ec526a4 | 81 | // Pad Calibration |
82 | Bool_t ModePadFragmentation(Int_t iPlane,Int_t iChamb, Int_t iSect, Int_t i); | |
83 | void ModePadCalibration(Int_t iChamb, Int_t i); | |
84 | Bool_t SetModeCalibrationFromTObject(TObject *object, Int_t i); | |
77566f2a | 85 | |
86 | // Fill the database | |
8ec526a4 | 87 | TObject *CreatePadObjectTree(TTree *tree); |
88 | TObject *CreatePadObjectTree(TTree *tree, Int_t i, AliTRDCalDet *detobject); | |
89 | AliTRDCalDet *CreateDetObjectTree(TTree *tree, Int_t i); | |
77566f2a | 90 | |
91 | // Correct the error | |
8ec526a4 | 92 | TH1F *CorrectTheError(TGraphErrors *hist); |
93 | TGraphErrors *AddProfiles(TGraphErrors *hist1, TGraphErrors *hist2) const ; | |
77566f2a | 94 | |
95 | // Add two trees | |
8ec526a4 | 96 | TTree *Sum2Trees(const Char_t *filename1, const Char_t *filename2, const Char_t *variablecali); |
77566f2a | 97 | |
8ec526a4 | 98 | // |
99 | // Set of Get the variables | |
100 | // | |
77566f2a | 101 | |
102 | // Choice to fill or not the 2D | |
8ec526a4 | 103 | void SetMITracking(Bool_t mitracking = kTRUE) { fMITracking = mitracking; } |
e5c60cc7 | 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; } | |
8ec526a4 | 111 | |
e5c60cc7 | 112 | Bool_t GetMITracking() const { return fMITracking; } |
113 | Bool_t GetMcmTracking() const { return fMcmTracking; } | |
114 | Bool_t GetMcmCorrectAngle() const { return fMcmCorrectAngle; } | |
115 | Bool_t GetPH2dOn() const { return fPH2dOn; } | |
116 | Bool_t GetCH2dOn() const { return fCH2dOn; } | |
117 | Bool_t GetPRF2dOn() const { return fPRF2dOn; } | |
118 | Bool_t GetHisto2d() const { return fHisto2d; } | |
119 | Bool_t GetVector2d() const { return fVector2d; } | |
120 | TH2I *GetCH2d() const { return fCH2d; } | |
121 | TProfile2D *GetPH2d() const { return fPH2d; } | |
122 | TProfile2D *GetPRF2d() const { return fPRF2d; } | |
77566f2a | 123 | |
124 | // How to fill the 2D | |
e5c60cc7 | 125 | void SetRelativeScaleAuto() { fRelativeScaleAuto = kTRUE; } |
8ec526a4 | 126 | void SetRelativeScale(Float_t relativeScale); |
e5c60cc7 | 127 | void SetThresholdDigit(Int_t digitthreshold) { fThresholdDigit = digitthreshold; } |
128 | void SetThresholdClusterPRF1(Float_t thresholdClusterPRF1) { fThresholdClusterPRF1 = thresholdClusterPRF1; } | |
129 | void SetThresholdClusterPRF2(Float_t thresholdClusterPRF2) { fThresholdClusterPRF2 = thresholdClusterPRF2; } | |
130 | void SetCenterOfflineCluster() { fCenterOfflineCluster = kTRUE; } | |
131 | void SetTraMaxPad() { fTraMaxPad = kTRUE; } | |
8ec526a4 | 132 | void SetNz(Int_t i, Short_t nz); |
133 | void SetNrphi(Int_t i, Short_t nrphi); | |
e5c60cc7 | 134 | void SetProcent(Float_t procent) { fProcent = procent; } |
135 | void SetDifference(Short_t difference) { fDifference = difference; } | |
136 | void SetNumberClusters(Short_t numberClusters) { fNumberClusters = numberClusters; } | |
137 | void SetNumberBinCharge(Short_t numberBinCharge) { fNumberBinCharge = numberBinCharge; } | |
138 | void SetNumberBinPRF(Short_t numberBinPRF) { fNumberBinPRF = numberBinPRF; } | |
8ec526a4 | 139 | |
e5c60cc7 | 140 | Float_t GetRelativeScale() const { return fRelativeScale; } |
141 | Bool_t GetRelativeScaleAuto() const { return fRelativeScaleAuto; } | |
142 | Int_t GetThresholdDigit() const { return fThresholdDigit; } | |
143 | Float_t GetThresholdClusterPRF1() const { return fThresholdClusterPRF1; } | |
144 | Float_t GetThresholdClusterPRF2() const { return fThresholdClusterPRF2; } | |
145 | Bool_t GetTraMaxPad()const { return fTraMaxPad; } | |
146 | Short_t GetNz(Int_t i) const { return fNz[i]; } | |
147 | Short_t GetNrphi(Int_t i) const { return fNrphi[i]; } | |
148 | Float_t GetProcent() const { return fProcent; } | |
149 | Short_t GetDifference() const { return fDifference; } | |
150 | Short_t GetNumberClusters() const { return fNumberClusters; } | |
151 | Short_t GetNumberBinCharge() const { return fNumberBinCharge; } | |
152 | Short_t GetNumberBinPRF() const { return fNumberBinPRF; } | |
77566f2a | 153 | |
154 | // Write | |
8ec526a4 | 155 | void SetWriteCoef(Int_t i) { fWriteCoef[i] = kTRUE; } |
156 | void SetWriteNameCoef(TString writeNameCoef) { fWriteNameCoef = writeNameCoef; } | |
157 | void SetWrite(Int_t i) { fWrite[i] = kTRUE; } | |
158 | void SetWriteName(TString writeName) { fWriteName = writeName; } | |
77566f2a | 159 | |
8ec526a4 | 160 | Bool_t GetWriteCoef(Int_t i) const { return fWriteCoef[i]; } |
161 | TString GetWriteNameCoef() const { return fWriteNameCoef; } | |
162 | Bool_t GetWrite(Int_t i) const { return fWrite[i]; } | |
163 | TString GetWriteName() const { return fWriteName; } | |
77566f2a | 164 | |
165 | // Fit | |
e5c60cc7 | 166 | void SetFitPHOn() { fFitPHOn = kTRUE; } |
8ec526a4 | 167 | void SetPeriodeFitPH(Int_t periodeFitPH); |
168 | void SetBeginFitCharge(Float_t beginFitCharge); | |
169 | void SetT0Shift(Float_t t0Shift); | |
170 | void SetRangeFitPRF(Float_t rangeFitPRF); | |
e5c60cc7 | 171 | void SetMeanChargeOn() { fMeanChargeOn = kTRUE; } |
172 | void SetAccCDB() { fAccCDB = kTRUE; } | |
173 | void SetFitChargeBisOn() { fFitChargeBisOn = kTRUE; } | |
174 | void SetMinEntries(Int_t minEntries) { fMinEntries = minEntries; } | |
8ec526a4 | 175 | |
e5c60cc7 | 176 | Bool_t GetFitPHOn() const { return fFitPHOn; } |
177 | Int_t GetPeriodeFitPH() const { return fFitPHPeriode; } | |
178 | Float_t GetBeginFitCharge() const { return fBeginFitCharge; } | |
179 | Float_t GetT0Shift() const { return fT0Shift; } | |
180 | Float_t GetRangeFitPRF() const { return fRangeFitPRF; } | |
181 | Bool_t GetMeanChargeOn() const { return fMeanChargeOn; } | |
182 | Bool_t GetAccCDB() const { return fAccCDB; } | |
183 | Bool_t GetFitChargeBisOn() const { return fFitChargeBisOn; } | |
184 | Int_t GetMinEntries() const { return fMinEntries; } | |
185 | Int_t GetNumberFit() const { return fNumberFit; } | |
186 | Int_t GetNumberEnt() const { return fNumberEnt; } | |
187 | Double_t GetStatisticMean() const { return fStatisticMean; } | |
8ec526a4 | 188 | |
189 | // Debug | |
e5c60cc7 | 190 | void SetDebug(Short_t debug) { fDebug = debug; } |
8ec526a4 | 191 | void SetDet(Int_t iPlane, Int_t iChamb, Int_t iSect) { fDet[0] = iPlane; |
192 | fDet[1] = iChamb; | |
e5c60cc7 | 193 | fDet[2] = iSect; } |
194 | void SetFitVoir(Int_t fitVoir) { fFitVoir = fitVoir; } | |
8ec526a4 | 195 | |
e5c60cc7 | 196 | Short_t GetDebug() const { return fDebug; } |
197 | Int_t GetDet(Int_t i) const { return fDet[i]; } | |
198 | Int_t GetFitVoir() const { return fFitVoir; } | |
8ec526a4 | 199 | |
200 | // | |
201 | // Internal variables to be sure! | |
202 | // | |
77566f2a | 203 | |
204 | // Pad calibration | |
e5c60cc7 | 205 | Short_t GetNnz(Int_t i) const { return fNnZ[i]; } |
206 | Short_t GetNnrphi(Int_t i) const { return fNnRphi[i]; } | |
207 | Short_t GetNfragz(Int_t i) const { return fNfragZ[i]; } | |
208 | Short_t GetNfragrphi(Int_t i) const { return fNfragRphi[i]; } | |
209 | Short_t GetDetChamb0(Int_t i) const { return fDetChamb0[i]; } | |
210 | Short_t GetDetChamb2(Int_t i) const { return fDetChamb2[i]; } | |
8ec526a4 | 211 | |
212 | void SetRebin(Short_t rebin); | |
e5c60cc7 | 213 | Short_t GetRebin() const { return fRebin; } |
8ec526a4 | 214 | |
215 | // Getter for the coefficient trees | |
e5c60cc7 | 216 | TTree *GetPRF() const { return fPRF; } |
217 | TTree *GetGain() const { return fGain; } | |
218 | TTree *GetT0() const { return fT0; } | |
219 | TTree *GetVdrift() const { return fVdrift; } | |
8ec526a4 | 220 | |
221 | private: | |
222 | ||
223 | static Double_t PH(Double_t *x, Double_t *par); | |
224 | static Double_t AsymmGauss(Double_t *x, Double_t *par); | |
225 | static Double_t FuncLandauGaus(Double_t *x, Double_t *par); | |
226 | static Double_t LanGauFun(Double_t *x, Double_t *par); | |
227 | TF1 *LanGauFit(TH1 *his, Double_t *fitrange, Double_t *startvalues | |
228 | , Double_t *parlimitslo, Double_t *parlimitshi, Double_t *fitparams | |
229 | , Double_t *fiterrors, Double_t *chiSqr, Int_t *ndf); | |
230 | Int_t LanGauPro(Double_t *params, Double_t &maxx, Double_t &fwhm); | |
77566f2a | 231 | |
8ec526a4 | 232 | // This is a singleton, contructor is private! |
233 | AliTRDCalibra(); | |
234 | virtual ~AliTRDCalibra(); | |
77566f2a | 235 | |
8ec526a4 | 236 | protected: |
77566f2a | 237 | |
77566f2a | 238 | // Choice to fill or not the 2D |
8ec526a4 | 239 | Bool_t fMITracking; // Chose to fill the 2D histos or vectors during the offline MI tracking |
240 | Bool_t fMcmTracking; // Chose to fill the 2D histos or vectors during the tracking with tracklets | |
241 | Bool_t fMcmCorrectAngle; // Apply correction due to the mcmtrackletangle in the z direction (only) assuming from vertex | |
242 | Bool_t fCH2dOn; // Chose to fill the 2D histos or vectors for the relative gain calibration | |
243 | Bool_t fPH2dOn; // Chose to fill the 2D histos or vectors for the drift velocity and T0 | |
244 | Bool_t fPRF2dOn; // Chose to fill the 2D histos or vectors for the pad response function calibration | |
245 | Bool_t fHisto2d; // Chose to fill the 2D histos | |
246 | Bool_t fVector2d; // Chose to fill vectors | |
77566f2a | 247 | |
248 | // How to fill the 2D | |
8ec526a4 | 249 | Float_t fRelativeScale; // Scale of the deposited charge |
250 | Int_t fCountRelativeScale; // fCountRelativeScale first data used for the scaling | |
251 | Bool_t fRelativeScaleAuto; // Scaling with the first fCountRelativeScale objects | |
252 | Int_t fThresholdDigit; // Threshold on RawData | |
253 | Float_t fThresholdClusterPRF1; // Threshold on cluster pad signals for PRF peripherique | |
254 | Float_t fThresholdClusterPRF2; // Threshold on cluster pad signals for PRF peripherique | |
255 | Bool_t fCenterOfflineCluster; // Choose to use the offline determination of the center of the cluster | |
256 | Bool_t fTraMaxPad; // Take the Max Pad for the gain calibration and PH | |
257 | Short_t fNz[3]; // Mode of calibration | |
258 | Short_t fNrphi[3]; // Mode of calibration | |
259 | Int_t fNtotal[3]; // Total number of Xbins | |
77566f2a | 260 | |
77566f2a | 261 | // Write |
8ec526a4 | 262 | Bool_t fWriteCoef[3]; // Do you want to write the result in a file? |
263 | TString fWriteNameCoef; // Where the coef Det are written | |
264 | Bool_t fWrite[3]; // Do you want to write the 2D histo or vectors converted in a tree | |
265 | TString fWriteName; // Where the 2D or trees are written | |
77566f2a | 266 | |
267 | // Fit | |
8ec526a4 | 268 | Bool_t fFitPHOn; // The fit PH On |
269 | Int_t fFitPHPeriode; // Periode of the fit PH | |
270 | Float_t fBeginFitCharge; // The fit begins at mean/fBeginFitCharge for the gain calibration | |
271 | Float_t fRangeFitPRF; // The fit range for the PRF is -fRangeFitPRF +fRangeFitPRF | |
272 | Bool_t fMeanChargeOn; // Mean Charge on | |
273 | Bool_t fFitChargeBisOn; // For an other fit function (convolution and not sum, more time consuming) | |
274 | Float_t fT0Shift; // T0 Shift with the actual method | |
275 | Bool_t fAccCDB; // If there is a calibration database to be compared with.... | |
276 | Int_t fNumberFit; // To know how many pad groups have been fitted | |
e5c60cc7 | 277 | Int_t fNumberEnt; // To know how many pad groups have entries in the histo |
8ec526a4 | 278 | Double_t fStatisticMean; // To know the mean statistic of the histos |
279 | ||
77566f2a | 280 | // Debug Mode |
8ec526a4 | 281 | Short_t fDebug; // For debugging 0 rien, 1 errors, 2 one fit alone, 3 one detector, 4 one detector with errors |
282 | Int_t fDet[3]; // Detector visualised (plane,chamb,sect) si debugging == 3 or 4 | |
283 | Int_t fFitVoir; // Fit visualised si debugging == 2 | |
77566f2a | 284 | |
8ec526a4 | 285 | // |
286 | // Internal variables | |
287 | // | |
288 | ||
77566f2a | 289 | // Storage of coef |
8ec526a4 | 290 | TTree *fPRF; // Tree of the sigma of PRD |
291 | TTree *fGain; // Tree of the gain factor | |
292 | TTree *fT0; // Tree of the time0 | |
293 | TTree *fVdrift; // Tree of the drift velocity | |
77566f2a | 294 | |
295 | // "Pointer" of the branch of the tree | |
8ec526a4 | 296 | Int_t fVdriftDetector; // Branch of Vdrift |
297 | Float_t *fVdriftPad; // Branch of Vdrift | |
298 | Int_t fT0Detector; // Branch of t0 | |
299 | Float_t *fT0Pad; // Branch of t0 | |
300 | Int_t fPRFDetector; // Branch of PRF | |
301 | Float_t *fPRFPad; // Branch of PRF | |
302 | Float_t *fCoefCH; // Branch relative gain | |
77566f2a | 303 | |
304 | // Fill the 2D histos in the offline tracking | |
8ec526a4 | 305 | Bool_t fDetectorAliTRDtrack; // Change of track |
306 | Int_t fChamberAliTRDtrack; // Change of chamber | |
307 | Int_t fDetectorPreviousTrack; // Change of detector | |
308 | Bool_t fGoodTrack; // If goes through a kaputt pad | |
309 | Float_t *fAmpTotal; // Energy deposited in the calibration group by the track | |
310 | Short_t *fPHPlace; // Calibration group of PH | |
311 | Float_t *fPHValue; // PH | |
312 | Short_t fNumberClusters; // Minimum number of clusters in the tracklets | |
313 | Float_t fProcent; // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH) | |
314 | Short_t fDifference; // Limit to take the info of the most important calibration group if the track goes through 2 groups (CH) | |
315 | Int_t fNumberTrack; // How many tracks could be used (Debug for the moment) | |
316 | Int_t fNumberUsedCh[2]; // How many tracks have been really used for the gain (0, strict; 1 with fProcent) | |
317 | Int_t fNumberUsedPh[2]; // How many tracks have been really used for the drift velocity (0, strict; 1 with fDifference) | |
318 | ||
319 | // | |
77566f2a | 320 | // For debugging |
8ec526a4 | 321 | // |
77566f2a | 322 | |
9f4780aa | 323 | // To build the graph with the errors of the fits |
324 | Double_t *fCoefCharge[4]; // Coefs resulting from the fit for the gain | |
325 | Double_t *fCoefChargeE[3]; // Error of the found coefs for the gain | |
326 | Double_t *fCoefVdrift[3]; // Coefs resulting from the fit for the drift velocity | |
327 | Double_t *fCoefVdriftE[2]; // Error of the found coefs for the drift velocity | |
328 | Double_t *fCoefT0[3]; // Coefs resulting from the fit for the drift velocity | |
329 | Double_t *fCoefT0E[2]; // Error of the found coefs for the drift velocity | |
330 | Double_t *fCoefPRF[2]; // Coefs resulting from the fit for the PRF | |
331 | Double_t *fCoefPRFE; // Error of the found coefs for the PRF | |
332 | TH2F *fCoefChargeDB[3]; // Visualisation of the coef of the detecteur fDet for the gain | |
333 | TH2F *fCoefVdriftDB[2]; // Visualisation of the coef of the detecteur fDet for the drift velocity | |
334 | TH2F *fCoefT0DB[2]; // Visualisation of the coef of the detecteur fDet for time 0 | |
335 | TH2F *fCoefPRFDB; // Visualisation of the coef of the detecteur fDet for the pad response function | |
77566f2a | 336 | |
337 | // Variables in the loop for the coef or more general | |
8ec526a4 | 338 | Float_t fChargeCoef[4]; // 3 database value, 0 fit, 1 mean, 2 fit time consuming |
339 | Float_t fVdriftCoef[3]; // 2 database value, 1 slope method, 0 fit | |
340 | Float_t fPRFCoef[2]; // 1 database, 0 fit | |
341 | Float_t fT0Coef[3]; // 3 database, 1 slope method, 0 fit | |
342 | Float_t fPhd[3]; // Begin AR and DR | |
343 | Int_t fTimeMax; // Number of time bins | |
344 | Float_t fSf; // Sampling frequence | |
345 | Int_t fDect1[3]; // First calibration group that will be called to be maybe fitted | |
346 | Int_t fDect2[3]; // Last calibration group that will be called to be maybe fitted | |
347 | Double_t fScaleFitFactor; // Scale factor of the fit results for the gain | |
348 | Int_t fMinEntries; // Min Entries to fit the histo | |
349 | Int_t fEntriesCurrent; // Entries in the current histo | |
350 | Int_t fCountDet[3]; // Current detector | |
351 | Int_t fCount[3]; // When the next detector comes | |
352 | Float_t fL3P0; // Parameter to be pass from the default fit of CH histo to the optional one | |
353 | Float_t fL3P2; // Parameter to be pass from the default fit of CH histo to the optional one | |
354 | Float_t fG3P2; // Parameter to be pass from the default fit of CH histo to the optional one | |
77566f2a | 355 | |
77566f2a | 356 | // Pad Calibration |
8ec526a4 | 357 | Short_t fNnZ[3]; // Number of pad rows in a group |
358 | Short_t fNnRphi[3]; // Number of pad cols in a group | |
359 | Short_t fNfragZ[3]; // Number of pad row group | |
360 | Short_t fNfragRphi[3]; // Number of pad col group | |
361 | Short_t fRowMin[3]; // Limits of the group in pad row | |
362 | Short_t fRowMax[3]; // Limits of the group in pad row | |
363 | Short_t fColMin[3]; // Limits of the group in pad col | |
364 | Short_t fColMax[3]; // Limits of the group in pad col | |
365 | Int_t fXbins[3]; // First Xbins of the detector | |
366 | Short_t fDetChamb0[3]; // Number of XBins for chamber != 2 | |
9f4780aa | 367 | Short_t fDetChamb2[3]; // Number of Xbins for chamber 2 |
77566f2a | 368 | |
369 | // Methode Alexandru store info | |
8ec526a4 | 370 | class AliTRDPlace : public TObject { |
77566f2a | 371 | |
8ec526a4 | 372 | public: |
373 | ||
374 | AliTRDPlace() | |
375 | :TObject() | |
376 | ,fPlace(0x0) { } | |
377 | AliTRDPlace(const AliTRDPlace &i) | |
378 | :TObject(i) | |
379 | ,fPlace(0x0) { } | |
380 | AliTRDPlace &operator=(const AliTRDPlace&) { return *this; } | |
381 | virtual ~AliTRDPlace() { } | |
382 | ||
383 | void SetPlace(Int_t place) { fPlace = place; } | |
384 | Int_t GetPlace() const { return fPlace; } | |
385 | ||
386 | protected: | |
387 | ||
388 | Int_t fPlace; // Place of the calibration group | |
77566f2a | 389 | |
8ec526a4 | 390 | }; |
391 | ||
392 | class AliTRDCTInfo : public TObject { | |
77566f2a | 393 | |
8ec526a4 | 394 | public: |
395 | ||
396 | AliTRDCTInfo() | |
397 | :TObject() | |
398 | ,fEntries(0x0) { } | |
399 | AliTRDCTInfo(const AliTRDCTInfo &i) | |
400 | :TObject(i) | |
401 | ,fEntries(0x0) { } | |
402 | AliTRDCTInfo &operator=(const AliTRDCTInfo&) { return *this; } | |
403 | virtual ~AliTRDCTInfo() { } | |
404 | ||
405 | void SetEntries(UShort_t *entries) { fEntries = entries; } | |
77566f2a | 406 | |
8ec526a4 | 407 | UShort_t *GetEntries() const { return fEntries; } |
408 | ||
409 | protected: | |
410 | ||
411 | UShort_t *fEntries; // Current number of entries for each bin of CH | |
77566f2a | 412 | |
413 | }; | |
414 | ||
8ec526a4 | 415 | class AliTRDFitCHInfo : public TObject { |
77566f2a | 416 | |
8ec526a4 | 417 | public: |
418 | ||
419 | AliTRDFitCHInfo() | |
420 | :TObject() | |
421 | ,fCoef(0x0) | |
422 | ,fDetector(-1) { } | |
423 | AliTRDFitCHInfo(const AliTRDFitCHInfo &i) | |
424 | :TObject(i) | |
425 | ,fCoef(0x0) | |
426 | ,fDetector(-1) { } | |
427 | AliTRDFitCHInfo &operator=(const AliTRDFitCHInfo&) { return *this; } | |
428 | virtual ~AliTRDFitCHInfo() { } | |
429 | ||
430 | void SetCoef(Float_t *coef) { fCoef = coef; } | |
431 | void SetDetector(Int_t detector) { fDetector = detector; } | |
77566f2a | 432 | |
8ec526a4 | 433 | Float_t *GetCoef() const { return fCoef; } |
434 | Int_t GetDetector() const { return fDetector; } | |
435 | ||
436 | protected: | |
437 | ||
438 | Float_t *fCoef; // Relative gain coefficient for each group of the detector | |
439 | Int_t fDetector; // Detector number | |
77566f2a | 440 | |
441 | }; | |
442 | ||
8ec526a4 | 443 | class AliTRDPInfo : public TObject { |
77566f2a | 444 | public: |
8ec526a4 | 445 | |
446 | AliTRDPInfo() | |
447 | :TObject() | |
448 | ,fSum(0x0) | |
449 | ,fSumSquare(0x0) | |
450 | ,fEntries(0x0) { } | |
451 | AliTRDPInfo(const AliTRDPInfo &i) | |
452 | :TObject(i) | |
453 | ,fSum(0x0) | |
454 | ,fSumSquare(0x0) | |
455 | ,fEntries(0x0) { } | |
456 | AliTRDPInfo &operator=(const AliTRDPInfo&) { return *this; } | |
457 | virtual ~AliTRDPInfo() { } | |
458 | ||
459 | void SetSum(Float_t *sum) { fSum = sum; } | |
460 | void SetSumSquare(Float_t *sumSquare) { fSumSquare = sumSquare; } | |
461 | void SetEntries(UShort_t *entries) { fEntries = entries; } | |
462 | ||
463 | Float_t *GetSum() const { return fSum; } | |
464 | Float_t *GetSumSquare() const { return fSumSquare; } | |
465 | UShort_t *GetEntries() const { return fEntries; } | |
466 | ||
467 | protected: | |
77566f2a | 468 | |
8ec526a4 | 469 | Float_t *fSum; // Current mean for each bin of the average pulse height |
470 | Float_t *fSumSquare; // Current mean of square values for each bin of the average pulse height | |
471 | UShort_t *fEntries; // Current number of entries for each bin of the average pulse height | |
77566f2a | 472 | |
473 | }; | |
8ec526a4 | 474 | |
77566f2a | 475 | // PH |
476 | // fTimeMax will define the size of fcharge | |
8ec526a4 | 477 | TObjArray *fVectorPH; // Vectors to fill |
478 | TObjArray *fPlaPH; // Vectors to fill | |
77566f2a | 479 | // CH |
8ec526a4 | 480 | Short_t fNumberBinCharge; // Number of bins for the gain factor |
481 | TObjArray *fVectorCH; // Vectors to fill | |
482 | TObjArray *fPlaCH; // Vectors to fill | |
77566f2a | 483 | // FitCH |
8ec526a4 | 484 | TObjArray *fVectorFitCH; // Vectors to fit |
77566f2a | 485 | // PRF |
8ec526a4 | 486 | Short_t fNumberBinPRF; // Number of bin for the PRF |
487 | TObjArray *fVectorPRF; // Vectors to fill | |
488 | TObjArray *fPlaPRF; // Vectors to fill | |
77566f2a | 489 | |
77566f2a | 490 | // Histograms to store the info from the digits, from the tracklets or from the tracks |
8ec526a4 | 491 | TProfile2D *fPH2d; // 2D average pulse height |
492 | TProfile2D *fPRF2d; // 2D PRF | |
493 | TH2I *fCH2d; // 2D deposited charge | |
494 | Short_t fRebin; // If you want to rebin the histo for the gain calibration | |
77566f2a | 495 | |
8ec526a4 | 496 | // |
497 | // A lot of internal functions...... | |
498 | // | |
77566f2a | 499 | |
500 | // Init AliTRDCalibra | |
8ec526a4 | 501 | void Init(); |
77566f2a | 502 | |
503 | // Create the 2D histo to be filled Online | |
8ec526a4 | 504 | void CreateCH2d(Int_t nn); |
505 | void CreatePH2d(Int_t nn); | |
506 | void CreatePRF2d(Int_t nn); | |
507 | ||
508 | // Fill the 2D | |
509 | void FillTheInfoOfTheTrackPH(); | |
510 | void FillTheInfoOfTheTrackCH(); | |
511 | void ResetfVariables(); | |
512 | Bool_t LocalisationDetectorXbins(Int_t detector); | |
77566f2a | 513 | |
514 | // Plot the 2D | |
8ec526a4 | 515 | void PlotCH2d(); |
516 | void PlotPH2d(); | |
517 | void PlotPRF2d(); | |
77566f2a | 518 | |
8ec526a4 | 519 | // |
520 | // Fit | |
521 | // | |
77566f2a | 522 | |
77566f2a | 523 | // Create histos if fDebug == 1 or fDebug >=3 |
8ec526a4 | 524 | void CreateFitHistoPHDB(Int_t rowMax, Int_t colMax); |
525 | void CreateFitHistoT0DB(Int_t rowMax, Int_t colMax); | |
526 | void CreateFitHistoCHDB(Int_t rowMax, Int_t colMax); | |
527 | void CreateFitHistoPRFDB(Int_t rowMax, Int_t colMax); | |
9f4780aa | 528 | void InitArrayFitCH(); |
529 | void InitArrayFitPH(); | |
530 | void InitArrayFitT0(); | |
531 | void InitArrayFitPRF(); | |
77566f2a | 532 | |
533 | // CHFit functions | |
8ec526a4 | 534 | Bool_t FillVectorFitCH(Int_t countdet); |
9f4780aa | 535 | Bool_t InitFit(Int_t nbins, Int_t i); |
8ec526a4 | 536 | void InitfCountDetAndfCount(Int_t i); |
537 | void UpdatefCountDetAndfCount(Int_t idect, Int_t i); | |
538 | void ReconstructFitRowMinRowMax(Int_t idect, Int_t i); | |
539 | Bool_t NotEnoughStatistic(Int_t idect, Int_t i); | |
540 | Bool_t FillInfosFit(Int_t idect, Int_t i); | |
541 | Bool_t WriteFitInfos(Int_t i); | |
542 | void NormierungCharge(); | |
77566f2a | 543 | |
77566f2a | 544 | // Fill histos DB from the Coef histos |
8ec526a4 | 545 | void FillCoefChargeDB(); |
546 | void FillCoefVdriftDB(); | |
547 | void FillCoefT0DB(); | |
548 | void FillCoefPRFDB(); | |
77566f2a | 549 | |
77566f2a | 550 | // Plot histos CoefPRF Coef.... |
9f4780aa | 551 | void PlotWritePH(); |
552 | void PlotWriteT0(); | |
553 | void PlotWriteCH(); | |
554 | void PlotWritePRF(); | |
77566f2a | 555 | |
77566f2a | 556 | // Plot histos DB |
8ec526a4 | 557 | void PlotPHDB(); |
558 | void PlotT0DB(); | |
559 | void PlotCHDB(); | |
560 | void PlotPRFDB(); | |
9f4780aa | 561 | |
8ec526a4 | 562 | // Write the DB histos |
563 | void WritePHDB(TFile *fout); | |
564 | void WriteT0DB(TFile *fout); | |
565 | void WriteCHDB(TFile *fout); | |
566 | void WritePRFDB(TFile *fout); | |
567 | ||
77566f2a | 568 | // Calculate the mean coefs from the database |
8ec526a4 | 569 | Bool_t CalculVdriftCoefMean(Int_t fect, Int_t idect); |
570 | Bool_t CalculChargeCoefMean(Int_t fect, Int_t idect, Bool_t vrai); | |
571 | Bool_t CalculPRFCoefMean(Int_t fect, Int_t idect); | |
572 | Bool_t CalculT0CoefMean(Int_t fect, Int_t idect); | |
573 | Float_t GetPRFDefault(Int_t plane) const; | |
77566f2a | 574 | |
8ec526a4 | 575 | // Pad group calibration mode |
576 | void ReconstructionRowPadGroup(Int_t idect, Int_t i); | |
577 | void CalculXBins(Int_t idect, Int_t i); | |
77566f2a | 578 | |
579 | // Convertion vector, tree, histos.... | |
8ec526a4 | 580 | Int_t SearchInVector(Int_t group, Int_t i) const; |
581 | Int_t SearchInTreeVector (TObjArray *vectorplace, Int_t group) const; | |
582 | Int_t SearchBin (Float_t value, Int_t i) const; | |
583 | Bool_t UpdateVectorCH(Int_t group, Float_t value); | |
584 | Bool_t UpdateVectorPRF(Int_t group, Float_t x, Float_t y); | |
585 | Bool_t UpdateVectorPH(Int_t group, Int_t time, Float_t value); | |
586 | Bool_t UpdateVectorT0(Int_t group, Int_t time); | |
587 | TGraphErrors *ConvertVectorPHisto(AliTRDPInfo *pInfo, const Char_t *name) const; | |
588 | TH1F *ConvertVectorCTHisto(AliTRDCTInfo *cTInfo, const Char_t *name) const; | |
589 | TTree *ConvertVectorCTTreeHisto(TObjArray *vVectorCT, TObjArray *pPlaCT, const Char_t *name, const Char_t *nametitle) const; | |
590 | TTree *ConvertVectorPTreeHisto(TObjArray *vVectorP, TObjArray *pPlaP, const Char_t *name, const Char_t *nametitle) const; | |
591 | TObjArray *ConvertTreeVector(TTree *tree) const ; | |
592 | Bool_t MergeVectorCT(TObjArray *vVectorCT2, TObjArray *pPlaCT2); | |
593 | Bool_t MergeVectorP(TObjArray *vVectorP2, TObjArray *pPlaP2, Int_t i); | |
77566f2a | 594 | |
77566f2a | 595 | // Fit methods |
8ec526a4 | 596 | void FitBisCH(TH1 *projch, Int_t idect); |
597 | void FitCH(TH1 *projch, Int_t idect); | |
598 | void FitPH(TH1 *projPH, Int_t idect); | |
599 | void FitPRF(TH1 *projPRF, Int_t idect); | |
600 | void FitPente(TH1 *projPH, Int_t idect); | |
601 | TH1I *ReBin(TH1I *hist) const; | |
602 | TH1F *ReBin(TH1F *hist) const; | |
77566f2a | 603 | |
604 | // Clear | |
8ec526a4 | 605 | void ClearHistos(); |
606 | void ClearTree(); | |
77566f2a | 607 | |
608 | // Some basic geometry function | |
8ec526a4 | 609 | virtual Int_t GetPlane(Int_t d) const; |
610 | virtual Int_t GetChamber(Int_t d) const; | |
611 | virtual Int_t GetSector(Int_t d) const; | |
77566f2a | 612 | |
613 | // Init, Fill and Reset the variables to default value tree Gain, PRF, Vdrift and T0 | |
8ec526a4 | 614 | void InitTreePH(); |
615 | void FillTreeVdrift(Int_t countdet); | |
616 | void InitTreeT0(); | |
617 | void FillTreeT0(Int_t countdet); | |
618 | void InitTreePRF(); | |
619 | void FillTreePRF(Int_t countdet); | |
620 | void ConvertVectorFitCHTree(); | |
621 | ||
622 | // Instance of this class and so on | |
623 | static AliTRDCalibra *fgInstance; // Instance | |
624 | static Bool_t fgTerminated; // If terminated | |
625 | ||
9f4780aa | 626 | ClassDef(AliTRDCalibra,2) // TRD Calibration class |
77566f2a | 627 | |
628 | }; | |
629 | ||
630 | #endif | |
631 | ||
632 |