]>
Commit | Line | Data |
---|---|---|
b3fcfd96 | 1 | #ifndef ALITRDPREPROCESSOROFFLINE_H |
2 | #define ALITRDPREPROCESSOROFFLINE_H | |
3 | ||
4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | // | |
8 | // | |
9 | // Class to create OCDB entries - processing the results of the OFFLINE calibration | |
10 | // | |
11 | ||
12 | ||
13 | #include "TNamed.h" | |
81a5aeca | 14 | #include "AliTRDCalChamberStatus.h" |
83d0cc79 | 15 | #include <THnSparse.h> |
b3fcfd96 | 16 | class TObjArray; |
01239968 | 17 | class AliTRDCalDet; |
b3fcfd96 | 18 | class TH2I; |
19 | class TProfile2D; | |
20 | class AliTRDCalibraVdriftLinearFit; | |
a0bb5615 | 21 | class AliTRDCalibraExbAltFit; |
b3fcfd96 | 22 | class TH1I; |
23 | class TH2F; | |
01239968 | 24 | class TString; |
a9f9c69b | 25 | class AliCDBStorage; |
b3fcfd96 | 26 | |
b3fcfd96 | 27 | class AliTRDPreprocessorOffline:public TNamed { |
28 | public: | |
a0bb5615 | 29 | enum{ kGain = 0, |
30 | kVdriftPHDet = 1, | |
31 | kVdriftPHPad = 2, | |
32 | kT0PHDet = 3, | |
33 | kT0PHPad = 4, | |
34 | kVdriftLinear = 5, | |
35 | kLorentzLinear = 6, | |
36 | kChamberStatus = 7, | |
37 | kPRF = 8, | |
38 | kExbAlt = 9, | |
e2a1c98b | 39 | kPHQ = 10, |
40 | kNumCalibObjs = 11 | |
a0bb5615 | 41 | }; |
840ec79d | 42 | enum { kGainNotEnoughStatsButFill = 2, |
43 | kVdriftNotEnoughStatsButFill = 4, | |
44 | kGainNotEnoughStatsNotFill = 8, | |
45 | kVdriftNotEnoughStatsNotFill = 16, | |
46 | kTimeOffsetNotEnoughStatsNotFill = 32, | |
47 | kExBErrorRange = 64}; | |
48 | enum { kGainErrorOld = 2, | |
49 | kVdriftErrorOld = 4, | |
50 | kExBErrorOld = 8, | |
51 | kGainErrorRange = 16, | |
52 | kVdriftErrorRange = 32, | |
53 | kTimeOffsetErrorRange = 64, | |
54 | kChamberStatusErrorRange = 128}; | |
82b413fd | 55 | |
56 | ||
b3fcfd96 | 57 | AliTRDPreprocessorOffline(); |
58 | virtual ~AliTRDPreprocessorOffline(); | |
59 | ||
83d0cc79 | 60 | Bool_t Init(const Char_t* fileName); |
a9f9c69b | 61 | void Process(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* ocdbStorage); |
83d0cc79 | 62 | |
63 | // settings | |
64 | void SetLinearFitForVdrift(Bool_t methodsecond) { fMethodSecond = methodsecond;}; | |
65 | void SetNameList(TString nameList) { fNameList = nameList;}; | |
66 | void SetMinStatsVdriftT0PH(Int_t minStatsVdriftT0PH) { fMinStatsVdriftT0PH = minStatsVdriftT0PH; } | |
67 | void SetMinStatsVdriftLinear(Int_t minStatsVdriftLinear) { fMinStatsVdriftLinear = minStatsVdriftLinear; } | |
68 | void SetMinStatsGain(Int_t minStatsGain) { fMinStatsGain = minStatsGain; } | |
69 | void SetMinStatsPRF(Int_t minStatsPRF) { fMinStatsPRF = minStatsPRF; } | |
70 | void SetMinStatsChamberStatus(Int_t minStatsChamberStatus) { fMinStatsChamberStatus = minStatsChamberStatus; } | |
532be2d4 | 71 | void SetSingleMinStatsChamberStatus(Int_t minSingleStatsChamberStatus) { fMinSingleStatsChamberStatus = minSingleStatsChamberStatus; } |
83d0cc79 | 72 | void SetLimitValidateNoData(Int_t nodatavalidate) { fNoDataValidate = nodatavalidate; }; |
73 | void SetLimitValidateBadCalib(Int_t badcalibvalidate) { fBadCalibValidate = badcalibvalidate; }; | |
74 | void SetBackCorrectGain(Bool_t backCorrectGain) { fBackCorrectGain = backCorrectGain; } | |
75 | void SetBackCorrectVdrift(Bool_t backCorrectVdrift) { fBackCorrectVdrift = backCorrectVdrift; } | |
76 | void SetNoExBUsedInReco(Bool_t noExBUsedInReco) { fNoExBUsedInReco = noExBUsedInReco; }; | |
77 | void SetSwitchOnValidation(Bool_t switchOnValidation) { fSwitchOnValidation = switchOnValidation;}; | |
66c56ac7 | 78 | void SetSwitchOnChamberStatus(Bool_t switchOnChamberStatus) { fSwitchOnChamberStatus = switchOnChamberStatus;}; |
83d0cc79 | 79 | void SetRMSBadCalibratedGain(Double_t rms) { fRMSBadCalibratedGain = rms;}; |
80 | void SetRMSBadCalibratedVdrift(Double_t rms) { fRMSBadCalibratedVdrift = rms;}; | |
81 | void SetRMSBadCalibratedExB(Double_t rms) { fRMSBadCalibratedExB = rms;}; | |
d82bad1e | 82 | void SetMinTimeOffsetValidate(Double_t min) { fMinTimeOffsetValidate = min;}; |
2a1a7b36 | 83 | void SetRobustFitDriftVelocity(Bool_t robustFitDriftVelocity) { fRobustFitDriftVelocity = robustFitDriftVelocity;}; |
84 | void SetRobustFitExbAlt(Bool_t robustFitExbAlt) { fRobustFitExbAlt = robustFitExbAlt;}; | |
661c7be6 | 85 | void SetAlternativeDriftVelocityFit(Bool_t alt) { fAlternativeVdrfitFit = alt;}; |
532be2d4 | 86 | void SetMinNbOfPointVdriftFit(Int_t minNbOfPointVdriftFit) { fMinNbOfPointVdriftFit = minNbOfPointVdriftFit;}; |
661c7be6 | 87 | void SetAlternativeExbAltFit(Bool_t alt) { fAlternativeExbAltFit = alt;}; |
595cfc12 | 88 | void SetMethodeFitGain(Int_t methodeFitGain) { fMethodeGain = methodeFitGain;}; |
89 | void SetOutliersFitChargeLow(Float_t outliersFitChargeLow) { fOutliersFitChargeLow = outliersFitChargeLow; } | |
90 | void SetOutliersFitChargeHigh(Float_t outliersFitChargeHigh) { fOutliersFitChargeHigh = outliersFitChargeHigh; } | |
91 | void SetBeginFitCharge(Float_t beginFitCharge) { fBeginFitCharge = beginFitCharge;}; | |
4f3bd513 | 92 | void SetT0Shift0(Float_t t0Shift0) { fT0Shift0 = t0Shift0;}; |
93 | void SetT0Shift1(Float_t t0Shift1) { fT0Shift1 = t0Shift1;}; | |
595cfc12 | 94 | |
2a1a7b36 | 95 | |
83d0cc79 | 96 | |
97 | Bool_t GetLinearFitForVdrift() const { return fMethodSecond;}; | |
98 | TString GetNameList() const { return fNameList;}; | |
99 | ||
100 | // status | |
101 | Bool_t CheckStatus(Int_t status, Int_t bitMask) const; | |
102 | void PrintStatus() const; | |
103 | ||
82b413fd | 104 | Bool_t IsGainNotEnoughStatsButFill() const |
105 | { return CheckStatus(fStatusNeg, kGainNotEnoughStatsButFill); }; | |
106 | Bool_t IsGainNotEnoughStatsNotFill() const | |
107 | { return CheckStatus(fStatusNeg, kGainNotEnoughStatsNotFill); }; | |
108 | Bool_t IsVdriftNotEnoughStatsButFill() const | |
109 | { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsButFill); }; | |
110 | Bool_t IsVdriftNotEnoughStatsNotFill() const | |
111 | { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsNotFill); }; | |
112 | Bool_t IsTimeOffsetNotEnoughStatsNotFill() const | |
840ec79d | 113 | { return CheckStatus(fStatusNeg, kTimeOffsetNotEnoughStatsNotFill); }; |
114 | Bool_t IsExBErrorRange() const | |
115 | { return CheckStatus(fStatusNeg, kExBErrorRange); }; | |
82b413fd | 116 | |
117 | Bool_t IsGainErrorOld() const | |
118 | { return CheckStatus(fStatusPos, kGainErrorOld); }; | |
119 | Bool_t IsVdriftErrorOld() const | |
120 | { return CheckStatus(fStatusPos, kVdriftErrorOld); }; | |
840ec79d | 121 | Bool_t IsExBErrorOld() const |
122 | { return CheckStatus(fStatusPos, kExBErrorOld); }; | |
82b413fd | 123 | Bool_t IsGainErrorRange() const |
124 | { return CheckStatus(fStatusPos, kGainErrorRange); }; | |
125 | Bool_t IsVdriftErrorRange() const | |
126 | { return CheckStatus(fStatusPos, kVdriftErrorRange); }; | |
127 | Bool_t IsTimeOffsetErrorRange() const | |
128 | { return CheckStatus(fStatusPos, kTimeOffsetErrorRange); }; | |
129 | Bool_t IsChamberStatusErrorRange() const | |
130 | { return CheckStatus(fStatusPos, kChamberStatusErrorRange); }; | |
131 | ||
82b413fd | 132 | |
83d0cc79 | 133 | // Back corrections |
01239968 | 134 | void SetCalDetGain(AliTRDCalDet *calDetGainUsed) {fCalDetGainUsed = calDetGainUsed;}; |
840ec79d | 135 | void SetCalDetVdrift(AliTRDCalDet *calDetVdriftUsed); |
136 | void SetCalDetVdriftExB(AliTRDCalDet *calDetVdriftUsed,AliTRDCalDet *calDetExBUsed) {fCalDetVdriftUsed = calDetVdriftUsed; fCalDetExBUsed = calDetExBUsed;}; | |
83d0cc79 | 137 | Bool_t SetCalDetGain(Int_t runNumber, Int_t version, Int_t subversion); |
138 | Bool_t SetCalDetVdriftExB(Int_t runNumber, Int_t versionv, Int_t subversionv, Int_t versionexb, Int_t subversionexb); | |
139 | ||
01239968 | 140 | AliTRDCalDet *GetCalDetGain() const { return fCalDetGainUsed;}; |
4c865c34 | 141 | AliTRDCalDet *GetCalDetVdrift() const { return fCalDetVdriftUsed;}; |
83d0cc79 | 142 | Int_t GetFirstRunGainUsed() const { return fFirstRunGainUsed; } |
143 | Int_t GetVersionGainUsed() const { return fVersionGainUsed; } | |
144 | Int_t GetSubVersionGainUsed() const { return fSubVersionGainUsed; } | |
145 | Int_t GetFirstRunVdriftUsed() const { return fFirstRunVdriftUsed; } | |
146 | Int_t GetVersionVdriftUsed() const { return fVersionVdriftUsed; } | |
147 | Int_t GetSubVersionVdriftUsed() const { return fSubVersionVdriftUsed; } | |
148 | Int_t GetFirstRunExBUsed() const { return fFirstRunExBUsed; } | |
149 | Int_t GetVersionExBUsed() const { return fVersionExBUsed; } | |
150 | Int_t GetSubVersionExBUsed() const { return fSubVersionExBUsed; } | |
151 | ||
152 | ||
153 | // Internal functions | |
b3fcfd96 | 154 | |
a9f9c69b | 155 | void CalibVdriftT0(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* ocdbStorage=0x0); |
156 | void CalibExbAlt(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* ocdbStorage=0x0); | |
157 | void CalibGain(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* ocdbStorage=0x0); | |
158 | void CalibPRF(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* ocdbStorage=0x0); | |
159 | void CalibChamberStatus(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* ocdbStorage=0x0); | |
160 | void CalibPHQ(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* ocdbStorage); | |
81a5aeca | 161 | |
83d0cc79 | 162 | Bool_t ReadStatusGlobal(const Char_t* fileName="CalibObjects.root"); |
b3fcfd96 | 163 | Bool_t ReadGainGlobal(const Char_t* fileName="CalibObjects.root"); |
164 | Bool_t ReadVdriftT0Global(const Char_t* fileName="CalibObjects.root"); | |
165 | Bool_t ReadVdriftLinearFitGlobal(const Char_t* fileName="CalibObjects.root"); | |
a0bb5615 | 166 | Bool_t ReadExbAltFitGlobal(const Char_t* fileName="CalibObjects.root"); |
b3fcfd96 | 167 | Bool_t ReadPRFGlobal(const Char_t* fileName="CalibObjects.root"); |
e2a1c98b | 168 | Bool_t ReadPHQGlobal(const Char_t* fileName); |
b3fcfd96 | 169 | |
170 | Bool_t AnalyzeGain(); | |
171 | Bool_t AnalyzeVdriftT0(); | |
172 | Bool_t AnalyzeVdriftLinearFit(); | |
a0bb5615 | 173 | Bool_t AnalyzeExbAltFit(); |
a5dcf618 | 174 | Bool_t AnalyzePRF(); |
175 | Bool_t AnalyzeChamberStatus(); | |
e2a1c98b | 176 | Bool_t AnalyzePHQ(Int_t startRunNumber); |
177 | ||
01239968 | 178 | void CorrectFromDetGainUsed(); |
4c865c34 | 179 | void CorrectFromDetVdriftUsed(); |
a5dcf618 | 180 | |
a9f9c69b | 181 | void UpdateOCDBT0(Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* storage); |
182 | void UpdateOCDBVdrift(Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* storage); | |
183 | void UpdateOCDBExB(Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* storage); | |
184 | void UpdateOCDBExBAlt(Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* storage); | |
185 | void UpdateOCDBGain(Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* storage); | |
186 | void UpdateOCDBPRF(Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* storage); | |
187 | void UpdateOCDBChamberStatus(Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* storage); | |
188 | void UpdateOCDBPHQ(Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* storage); | |
b3fcfd96 | 189 | |
54f2ff1c | 190 | Bool_t ValidateGain(); |
00d203b6 | 191 | Bool_t ValidateVdrift(); |
840ec79d | 192 | Bool_t ValidateExB(); |
00d203b6 | 193 | Bool_t ValidateT0(); |
194 | Bool_t ValidatePRF() const; | |
82b413fd | 195 | Bool_t ValidateChamberStatus(); |
00d203b6 | 196 | |
82b413fd | 197 | Int_t GetStatus() const; |
198 | Int_t GetStatusPos() const { return fStatusPos; } | |
199 | Int_t GetStatusNeg() const { return fStatusNeg; } | |
a5dcf618 | 200 | |
9a8b0e85 | 201 | Bool_t IsPHQon() const { return fPHQon ;}; |
202 | void SetPHQon(const Bool_t kphq){ fPHQon = kphq; } | |
83d0cc79 | 203 | |
687aa844 | 204 | Bool_t IsDebugPHQon() const { return fDebugPHQon ;}; |
205 | void SetDebugPHQon(const Bool_t kphq){ fDebugPHQon = kphq; } | |
206 | ||
4c865c34 | 207 | private: |
81a5aeca | 208 | Bool_t fMethodSecond; // Second Method for drift velocity |
209 | TString fNameList; // Name of the list | |
210 | AliTRDCalDet *fCalDetGainUsed; // CalDet used and to be corrected for | |
211 | AliTRDCalDet *fCalDetVdriftUsed; // CalDet used and to be corrected for | |
840ec79d | 212 | AliTRDCalDet *fCalDetExBUsed; // CalDet used and to be corrected for |
81a5aeca | 213 | TH2I *fCH2d; // Gain |
214 | TProfile2D *fPH2d; // Drift velocity first method | |
215 | TProfile2D *fPRF2d; // PRF | |
83d0cc79 | 216 | THnSparseI *fSparse; // chamberstatus |
b3fcfd96 | 217 | AliTRDCalibraVdriftLinearFit *fAliTRDCalibraVdriftLinearFit; // Drift velocity second method |
a0bb5615 | 218 | AliTRDCalibraExbAltFit* fAliTRDCalibraExbAltFit; //ExB alternative method |
b3fcfd96 | 219 | TH1I *fNEvents; // Number of events |
220 | TH2F *fAbsoluteGain; // Absolute Gain calibration | |
221 | TObjArray * fPlots; // array with some plots to check | |
222 | TObjArray * fCalibObjects; // array with calibration objects | |
83d0cc79 | 223 | Int_t fFirstRunGainUsed; // first run gain used |
4c865c34 | 224 | Int_t fVersionGainUsed; // VersionGainUsed |
225 | Int_t fSubVersionGainUsed; // SubVersionGainUsed | |
ca7e6e64 | 226 | Int_t fFirstRunVdriftUsed; // FirstRunVdrift |
4c865c34 | 227 | Int_t fVersionVdriftUsed; // VersionVdriftUsed |
228 | Int_t fSubVersionVdriftUsed; // SubVersionVdriftUsed | |
83d0cc79 | 229 | Int_t fFirstRunExBUsed; // FirstRunExB |
230 | Int_t fVersionExBUsed; // VersionExBUsed | |
231 | Int_t fSubVersionExBUsed; // SubVersionExBUsed | |
232 | Bool_t fNoExBUsedInReco; // ExB not used yet in the reco | |
00d203b6 | 233 | Bool_t fSwitchOnValidation; // Validation |
66c56ac7 | 234 | Bool_t fSwitchOnChamberStatus; // ChamberStatus |
00d203b6 | 235 | Bool_t fVdriftValidated; // Vdrift validation |
840ec79d | 236 | Bool_t fExBValidated; // ExB validation |
00d203b6 | 237 | Bool_t fT0Validated; // T0 validation |
a2a4ec8e | 238 | Int_t fMinStatsVdriftT0PH; // MinStats VdriftT0 |
239 | Int_t fMinStatsVdriftLinear; // MinStats Vdrift Linear | |
240 | Int_t fMinStatsGain; // MinStats Gain | |
241 | Int_t fMinStatsPRF; // MinStats PRF | |
83d0cc79 | 242 | Int_t fMinStatsChamberStatus; // MinStats ChamberStatus |
d82bad1e | 243 | Double_t fMinSingleStatsChamberStatus; // MinStats per chamber in % of mean (ChamberStatus) |
54f2ff1c | 244 | Bool_t fBackCorrectGain; // Back correction afterwards gain |
245 | Bool_t fBackCorrectVdrift; // Back correction afterwards vdrift | |
246 | Bool_t fNotEnoughStatisticsForTheGain;// Take the chamber per chamber distribution from the default distribution | |
247 | Bool_t fNotEnoughStatisticsForTheVdriftLinear;// Take the chamber per chamber distribution from the default distribution | |
82b413fd | 248 | Int_t fStatusNeg; // Info but ok |
249 | Int_t fStatusPos; // Problems | |
83d0cc79 | 250 | Int_t fBadCalib[18]; // number of bad calibrated chambers per sm |
251 | Int_t fNoData[18]; // number of chambers w/o data per sm | |
252 | Int_t fBadCalibValidate; // validation limit for bad calibrated chambers | |
253 | Int_t fNoDataValidate; // validation limit for chamber w/o data (sm w/o data excluded) | |
254 | Double_t fRMSBadCalibratedGain; // value to decide when it is bad calibrated | |
255 | Double_t fRMSBadCalibratedVdrift; // value to decide when it is bad calibrated | |
256 | Double_t fRMSBadCalibratedExB; // value to decide when it is bad calibrated | |
d82bad1e | 257 | Double_t fMinTimeOffsetValidate; // For validation of timeoffset min value |
2a1a7b36 | 258 | Bool_t fRobustFitDriftVelocity; // Robust fit for the drift velocity |
259 | Bool_t fRobustFitExbAlt; // Robust fit for the exb alt | |
661c7be6 | 260 | Bool_t fAlternativeVdrfitFit; // Alternative fitting method for vdrift calibration |
261 | Bool_t fAlternativeExbAltFit; // Alternative fitting method for the alternative exb calibarion method | |
532be2d4 | 262 | Int_t fMinNbOfPointVdriftFit; // Min number of points for the drift velocity calibration |
595cfc12 | 263 | Int_t fMethodeGain; // Methode Gain Fit |
264 | Float_t fOutliersFitChargeLow; // The fit starts at fOutliersFitChargeLow procent number of entries | |
265 | Float_t fOutliersFitChargeHigh; // The fit starts at fOutliersFitChargeHigh procent number of entries | |
266 | Float_t fBeginFitCharge; // Fit Begin Charge starts at mean/fBeginFitCharge | |
4f3bd513 | 267 | Float_t fT0Shift0; // T0 Shift with the maximum positive slope |
268 | Float_t fT0Shift1; // T0 Shift with the maximum of the amplification region | |
b3fcfd96 | 269 | |
4c865c34 | 270 | Int_t GetSubVersion(TString name) const; |
271 | Int_t GetVersion(TString name) const; | |
ca7e6e64 | 272 | Int_t GetFirstRun(TString name) const; |
b3fcfd96 | 273 | |
274 | ||
275 | ||
276 | private: | |
277 | AliTRDPreprocessorOffline& operator=(const AliTRDPreprocessorOffline&); // not implemented | |
278 | AliTRDPreprocessorOffline(const AliTRDPreprocessorOffline&); // not implemented | |
9a8b0e85 | 279 | |
280 | Bool_t fPHQon; //switch of PHQ | |
687aa844 | 281 | Bool_t fDebugPHQon; //switch of DebugPHQ |
9a8b0e85 | 282 | |
66c56ac7 | 283 | ClassDef(AliTRDPreprocessorOffline,5) |
b3fcfd96 | 284 | }; |
285 | ||
286 | #endif | |
01239968 | 287 | |
a5dcf618 | 288 |