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