]>
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; |
b3fcfd96 | 25 | |
26 | ||
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); |
61 | void Process(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage); | |
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; } | |
17aa2935 | 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;}; | |
78 | void SetRMSBadCalibratedGain(Double_t rms) { fRMSBadCalibratedGain = rms;}; | |
79 | void SetRMSBadCalibratedVdrift(Double_t rms) { fRMSBadCalibratedVdrift = rms;}; | |
80 | void SetRMSBadCalibratedExB(Double_t rms) { fRMSBadCalibratedExB = rms;}; | |
2a1a7b36 | 81 | void SetRobustFitDriftVelocity(Bool_t robustFitDriftVelocity) { fRobustFitDriftVelocity = robustFitDriftVelocity;}; |
82 | void SetRobustFitExbAlt(Bool_t robustFitExbAlt) { fRobustFitExbAlt = robustFitExbAlt;}; | |
661c7be6 | 83 | void SetAlternativeDriftVelocityFit(Bool_t alt) { fAlternativeVdrfitFit = alt;}; |
84 | void SetAlternativeExbAltFit(Bool_t alt) { fAlternativeExbAltFit = alt;}; | |
595cfc12 | 85 | void SetMethodeFitGain(Int_t methodeFitGain) { fMethodeGain = methodeFitGain;}; |
86 | void SetOutliersFitChargeLow(Float_t outliersFitChargeLow) { fOutliersFitChargeLow = outliersFitChargeLow; } | |
87 | void SetOutliersFitChargeHigh(Float_t outliersFitChargeHigh) { fOutliersFitChargeHigh = outliersFitChargeHigh; } | |
88 | void SetBeginFitCharge(Float_t beginFitCharge) { fBeginFitCharge = beginFitCharge;}; | |
89 | ||
2a1a7b36 | 90 | |
83d0cc79 | 91 | |
92 | Bool_t GetLinearFitForVdrift() const { return fMethodSecond;}; | |
93 | TString GetNameList() const { return fNameList;}; | |
94 | ||
95 | // status | |
96 | Bool_t CheckStatus(Int_t status, Int_t bitMask) const; | |
97 | void PrintStatus() const; | |
98 | ||
82b413fd | 99 | Bool_t IsGainNotEnoughStatsButFill() const |
100 | { return CheckStatus(fStatusNeg, kGainNotEnoughStatsButFill); }; | |
101 | Bool_t IsGainNotEnoughStatsNotFill() const | |
102 | { return CheckStatus(fStatusNeg, kGainNotEnoughStatsNotFill); }; | |
103 | Bool_t IsVdriftNotEnoughStatsButFill() const | |
104 | { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsButFill); }; | |
105 | Bool_t IsVdriftNotEnoughStatsNotFill() const | |
106 | { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsNotFill); }; | |
107 | Bool_t IsTimeOffsetNotEnoughStatsNotFill() const | |
840ec79d | 108 | { return CheckStatus(fStatusNeg, kTimeOffsetNotEnoughStatsNotFill); }; |
109 | Bool_t IsExBErrorRange() const | |
110 | { return CheckStatus(fStatusNeg, kExBErrorRange); }; | |
82b413fd | 111 | |
112 | Bool_t IsGainErrorOld() const | |
113 | { return CheckStatus(fStatusPos, kGainErrorOld); }; | |
114 | Bool_t IsVdriftErrorOld() const | |
115 | { return CheckStatus(fStatusPos, kVdriftErrorOld); }; | |
840ec79d | 116 | Bool_t IsExBErrorOld() const |
117 | { return CheckStatus(fStatusPos, kExBErrorOld); }; | |
82b413fd | 118 | Bool_t IsGainErrorRange() const |
119 | { return CheckStatus(fStatusPos, kGainErrorRange); }; | |
120 | Bool_t IsVdriftErrorRange() const | |
121 | { return CheckStatus(fStatusPos, kVdriftErrorRange); }; | |
122 | Bool_t IsTimeOffsetErrorRange() const | |
123 | { return CheckStatus(fStatusPos, kTimeOffsetErrorRange); }; | |
124 | Bool_t IsChamberStatusErrorRange() const | |
125 | { return CheckStatus(fStatusPos, kChamberStatusErrorRange); }; | |
126 | ||
82b413fd | 127 | |
83d0cc79 | 128 | // Back corrections |
01239968 | 129 | void SetCalDetGain(AliTRDCalDet *calDetGainUsed) {fCalDetGainUsed = calDetGainUsed;}; |
840ec79d | 130 | void SetCalDetVdrift(AliTRDCalDet *calDetVdriftUsed); |
131 | void SetCalDetVdriftExB(AliTRDCalDet *calDetVdriftUsed,AliTRDCalDet *calDetExBUsed) {fCalDetVdriftUsed = calDetVdriftUsed; fCalDetExBUsed = calDetExBUsed;}; | |
83d0cc79 | 132 | Bool_t SetCalDetGain(Int_t runNumber, Int_t version, Int_t subversion); |
133 | Bool_t SetCalDetVdriftExB(Int_t runNumber, Int_t versionv, Int_t subversionv, Int_t versionexb, Int_t subversionexb); | |
134 | ||
01239968 | 135 | AliTRDCalDet *GetCalDetGain() const { return fCalDetGainUsed;}; |
4c865c34 | 136 | AliTRDCalDet *GetCalDetVdrift() const { return fCalDetVdriftUsed;}; |
83d0cc79 | 137 | Int_t GetFirstRunGainUsed() const { return fFirstRunGainUsed; } |
138 | Int_t GetVersionGainUsed() const { return fVersionGainUsed; } | |
139 | Int_t GetSubVersionGainUsed() const { return fSubVersionGainUsed; } | |
140 | Int_t GetFirstRunVdriftUsed() const { return fFirstRunVdriftUsed; } | |
141 | Int_t GetVersionVdriftUsed() const { return fVersionVdriftUsed; } | |
142 | Int_t GetSubVersionVdriftUsed() const { return fSubVersionVdriftUsed; } | |
143 | Int_t GetFirstRunExBUsed() const { return fFirstRunExBUsed; } | |
144 | Int_t GetVersionExBUsed() const { return fVersionExBUsed; } | |
145 | Int_t GetSubVersionExBUsed() const { return fSubVersionExBUsed; } | |
146 | ||
147 | ||
148 | // Internal functions | |
b3fcfd96 | 149 | |
150 | void CalibVdriftT0(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage=""); | |
a0bb5615 | 151 | void CalibExbAlt(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage=""); |
b3fcfd96 | 152 | void CalibGain(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage=""); |
153 | void CalibPRF(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage=""); | |
83d0cc79 | 154 | void CalibChamberStatus(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage=""); |
e2a1c98b | 155 | void CalibPHQ(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage); |
81a5aeca | 156 | |
83d0cc79 | 157 | Bool_t ReadStatusGlobal(const Char_t* fileName="CalibObjects.root"); |
b3fcfd96 | 158 | Bool_t ReadGainGlobal(const Char_t* fileName="CalibObjects.root"); |
159 | Bool_t ReadVdriftT0Global(const Char_t* fileName="CalibObjects.root"); | |
160 | Bool_t ReadVdriftLinearFitGlobal(const Char_t* fileName="CalibObjects.root"); | |
a0bb5615 | 161 | Bool_t ReadExbAltFitGlobal(const Char_t* fileName="CalibObjects.root"); |
b3fcfd96 | 162 | Bool_t ReadPRFGlobal(const Char_t* fileName="CalibObjects.root"); |
e2a1c98b | 163 | Bool_t ReadPHQGlobal(const Char_t* fileName); |
b3fcfd96 | 164 | |
165 | Bool_t AnalyzeGain(); | |
166 | Bool_t AnalyzeVdriftT0(); | |
167 | Bool_t AnalyzeVdriftLinearFit(); | |
a0bb5615 | 168 | Bool_t AnalyzeExbAltFit(); |
a5dcf618 | 169 | Bool_t AnalyzePRF(); |
170 | Bool_t AnalyzeChamberStatus(); | |
e2a1c98b | 171 | Bool_t AnalyzePHQ(Int_t startRunNumber); |
172 | ||
01239968 | 173 | void CorrectFromDetGainUsed(); |
4c865c34 | 174 | void CorrectFromDetVdriftUsed(); |
a5dcf618 | 175 | |
b3fcfd96 | 176 | void UpdateOCDBT0(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath); |
177 | void UpdateOCDBVdrift(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath); | |
eec29d56 | 178 | void UpdateOCDBExB(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath); |
a0bb5615 | 179 | void UpdateOCDBExBAlt(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath); |
b3fcfd96 | 180 | void UpdateOCDBGain(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath); |
181 | void UpdateOCDBPRF(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath); | |
a5dcf618 | 182 | void UpdateOCDBChamberStatus(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath); |
e2a1c98b | 183 | void UpdateOCDBPHQ(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath); |
b3fcfd96 | 184 | |
54f2ff1c | 185 | Bool_t ValidateGain(); |
00d203b6 | 186 | Bool_t ValidateVdrift(); |
840ec79d | 187 | Bool_t ValidateExB(); |
00d203b6 | 188 | Bool_t ValidateT0(); |
189 | Bool_t ValidatePRF() const; | |
82b413fd | 190 | Bool_t ValidateChamberStatus(); |
00d203b6 | 191 | |
82b413fd | 192 | Int_t GetStatus() const; |
193 | Int_t GetStatusPos() const { return fStatusPos; } | |
194 | Int_t GetStatusNeg() const { return fStatusNeg; } | |
a5dcf618 | 195 | |
83d0cc79 | 196 | |
4c865c34 | 197 | |
198 | private: | |
81a5aeca | 199 | Bool_t fMethodSecond; // Second Method for drift velocity |
200 | TString fNameList; // Name of the list | |
201 | AliTRDCalDet *fCalDetGainUsed; // CalDet used and to be corrected for | |
202 | AliTRDCalDet *fCalDetVdriftUsed; // CalDet used and to be corrected for | |
840ec79d | 203 | AliTRDCalDet *fCalDetExBUsed; // CalDet used and to be corrected for |
81a5aeca | 204 | TH2I *fCH2d; // Gain |
205 | TProfile2D *fPH2d; // Drift velocity first method | |
206 | TProfile2D *fPRF2d; // PRF | |
83d0cc79 | 207 | THnSparseI *fSparse; // chamberstatus |
b3fcfd96 | 208 | AliTRDCalibraVdriftLinearFit *fAliTRDCalibraVdriftLinearFit; // Drift velocity second method |
a0bb5615 | 209 | AliTRDCalibraExbAltFit* fAliTRDCalibraExbAltFit; //ExB alternative method |
b3fcfd96 | 210 | TH1I *fNEvents; // Number of events |
211 | TH2F *fAbsoluteGain; // Absolute Gain calibration | |
212 | TObjArray * fPlots; // array with some plots to check | |
213 | TObjArray * fCalibObjects; // array with calibration objects | |
83d0cc79 | 214 | Int_t fFirstRunGainUsed; // first run gain used |
4c865c34 | 215 | Int_t fVersionGainUsed; // VersionGainUsed |
216 | Int_t fSubVersionGainUsed; // SubVersionGainUsed | |
ca7e6e64 | 217 | Int_t fFirstRunVdriftUsed; // FirstRunVdrift |
4c865c34 | 218 | Int_t fVersionVdriftUsed; // VersionVdriftUsed |
219 | Int_t fSubVersionVdriftUsed; // SubVersionVdriftUsed | |
83d0cc79 | 220 | Int_t fFirstRunExBUsed; // FirstRunExB |
221 | Int_t fVersionExBUsed; // VersionExBUsed | |
222 | Int_t fSubVersionExBUsed; // SubVersionExBUsed | |
223 | Bool_t fNoExBUsedInReco; // ExB not used yet in the reco | |
00d203b6 | 224 | Bool_t fSwitchOnValidation; // Validation |
225 | Bool_t fVdriftValidated; // Vdrift validation | |
840ec79d | 226 | Bool_t fExBValidated; // ExB validation |
00d203b6 | 227 | Bool_t fT0Validated; // T0 validation |
a2a4ec8e | 228 | Int_t fMinStatsVdriftT0PH; // MinStats VdriftT0 |
229 | Int_t fMinStatsVdriftLinear; // MinStats Vdrift Linear | |
230 | Int_t fMinStatsGain; // MinStats Gain | |
231 | Int_t fMinStatsPRF; // MinStats PRF | |
83d0cc79 | 232 | Int_t fMinStatsChamberStatus; // MinStats ChamberStatus |
17aa2935 | 233 | Double_t fMinSingleStatsChamberStatus; // MinStats per chamber in % of mean (ChamberStatus) |
54f2ff1c | 234 | Bool_t fBackCorrectGain; // Back correction afterwards gain |
235 | Bool_t fBackCorrectVdrift; // Back correction afterwards vdrift | |
236 | Bool_t fNotEnoughStatisticsForTheGain;// Take the chamber per chamber distribution from the default distribution | |
237 | Bool_t fNotEnoughStatisticsForTheVdriftLinear;// Take the chamber per chamber distribution from the default distribution | |
82b413fd | 238 | Int_t fStatusNeg; // Info but ok |
239 | Int_t fStatusPos; // Problems | |
83d0cc79 | 240 | Int_t fBadCalib[18]; // number of bad calibrated chambers per sm |
241 | Int_t fNoData[18]; // number of chambers w/o data per sm | |
242 | Int_t fBadCalibValidate; // validation limit for bad calibrated chambers | |
243 | Int_t fNoDataValidate; // validation limit for chamber w/o data (sm w/o data excluded) | |
244 | Double_t fRMSBadCalibratedGain; // value to decide when it is bad calibrated | |
245 | Double_t fRMSBadCalibratedVdrift; // value to decide when it is bad calibrated | |
246 | Double_t fRMSBadCalibratedExB; // value to decide when it is bad calibrated | |
2a1a7b36 | 247 | Bool_t fRobustFitDriftVelocity; // Robust fit for the drift velocity |
248 | Bool_t fRobustFitExbAlt; // Robust fit for the exb alt | |
661c7be6 | 249 | Bool_t fAlternativeVdrfitFit; // Alternative fitting method for vdrift calibration |
250 | Bool_t fAlternativeExbAltFit; // Alternative fitting method for the alternative exb calibarion method | |
595cfc12 | 251 | Int_t fMethodeGain; // Methode Gain Fit |
252 | Float_t fOutliersFitChargeLow; // The fit starts at fOutliersFitChargeLow procent number of entries | |
253 | Float_t fOutliersFitChargeHigh; // The fit starts at fOutliersFitChargeHigh procent number of entries | |
254 | Float_t fBeginFitCharge; // Fit Begin Charge starts at mean/fBeginFitCharge | |
b3fcfd96 | 255 | |
4c865c34 | 256 | Int_t GetSubVersion(TString name) const; |
257 | Int_t GetVersion(TString name) const; | |
ca7e6e64 | 258 | Int_t GetFirstRun(TString name) const; |
b3fcfd96 | 259 | |
260 | ||
261 | ||
262 | private: | |
263 | AliTRDPreprocessorOffline& operator=(const AliTRDPreprocessorOffline&); // not implemented | |
264 | AliTRDPreprocessorOffline(const AliTRDPreprocessorOffline&); // not implemented | |
2a1a7b36 | 265 | ClassDef(AliTRDPreprocessorOffline,3) |
b3fcfd96 | 266 | }; |
267 | ||
268 | #endif | |
01239968 | 269 | |
a5dcf618 | 270 |