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