1 #ifndef ALITRDPREPROCESSOROFFLINE_H
2 #define ALITRDPREPROCESSOROFFLINE_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
9 // Class to create OCDB entries - processing the results of the OFFLINE calibration
14 #include "AliTRDCalChamberStatus.h"
15 #include <THnSparse.h>
20 class AliTRDCalibraVdriftLinearFit;
21 class AliTRDCalibraExbAltFit;
27 class AliTRDPreprocessorOffline:public TNamed {
41 enum { kGainNotEnoughStatsButFill = 2,
42 kVdriftNotEnoughStatsButFill = 4,
43 kGainNotEnoughStatsNotFill = 8,
44 kVdriftNotEnoughStatsNotFill = 16,
45 kTimeOffsetNotEnoughStatsNotFill = 32,
47 enum { kGainErrorOld = 2,
51 kVdriftErrorRange = 32,
52 kTimeOffsetErrorRange = 64,
53 kChamberStatusErrorRange = 128};
56 AliTRDPreprocessorOffline();
57 virtual ~AliTRDPreprocessorOffline();
59 Bool_t Init(const Char_t* fileName);
60 void Process(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage);
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 SetLimitValidateNoData(Int_t nodatavalidate) { fNoDataValidate = nodatavalidate; };
71 void SetLimitValidateBadCalib(Int_t badcalibvalidate) { fBadCalibValidate = badcalibvalidate; };
72 void SetBackCorrectGain(Bool_t backCorrectGain) { fBackCorrectGain = backCorrectGain; }
73 void SetBackCorrectVdrift(Bool_t backCorrectVdrift) { fBackCorrectVdrift = backCorrectVdrift; }
74 void SetNoExBUsedInReco(Bool_t noExBUsedInReco) { fNoExBUsedInReco = noExBUsedInReco; };
75 void SetSwitchOnValidation(Bool_t switchOnValidation) { fSwitchOnValidation = switchOnValidation;};
76 void SetRMSBadCalibratedGain(Double_t rms) { fRMSBadCalibratedGain = rms;};
77 void SetRMSBadCalibratedVdrift(Double_t rms) { fRMSBadCalibratedVdrift = rms;};
78 void SetRMSBadCalibratedExB(Double_t rms) { fRMSBadCalibratedExB = rms;};
80 Bool_t GetLinearFitForVdrift() const { return fMethodSecond;};
81 TString GetNameList() const { return fNameList;};
84 Bool_t CheckStatus(Int_t status, Int_t bitMask) const;
85 void PrintStatus() const;
87 Bool_t IsGainNotEnoughStatsButFill() const
88 { return CheckStatus(fStatusNeg, kGainNotEnoughStatsButFill); };
89 Bool_t IsGainNotEnoughStatsNotFill() const
90 { return CheckStatus(fStatusNeg, kGainNotEnoughStatsNotFill); };
91 Bool_t IsVdriftNotEnoughStatsButFill() const
92 { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsButFill); };
93 Bool_t IsVdriftNotEnoughStatsNotFill() const
94 { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsNotFill); };
95 Bool_t IsTimeOffsetNotEnoughStatsNotFill() const
96 { return CheckStatus(fStatusNeg, kTimeOffsetNotEnoughStatsNotFill); };
97 Bool_t IsExBErrorRange() const
98 { return CheckStatus(fStatusNeg, kExBErrorRange); };
100 Bool_t IsGainErrorOld() const
101 { return CheckStatus(fStatusPos, kGainErrorOld); };
102 Bool_t IsVdriftErrorOld() const
103 { return CheckStatus(fStatusPos, kVdriftErrorOld); };
104 Bool_t IsExBErrorOld() const
105 { return CheckStatus(fStatusPos, kExBErrorOld); };
106 Bool_t IsGainErrorRange() const
107 { return CheckStatus(fStatusPos, kGainErrorRange); };
108 Bool_t IsVdriftErrorRange() const
109 { return CheckStatus(fStatusPos, kVdriftErrorRange); };
110 Bool_t IsTimeOffsetErrorRange() const
111 { return CheckStatus(fStatusPos, kTimeOffsetErrorRange); };
112 Bool_t IsChamberStatusErrorRange() const
113 { return CheckStatus(fStatusPos, kChamberStatusErrorRange); };
117 void SetCalDetGain(AliTRDCalDet *calDetGainUsed) {fCalDetGainUsed = calDetGainUsed;};
118 void SetCalDetVdrift(AliTRDCalDet *calDetVdriftUsed);
119 void SetCalDetVdriftExB(AliTRDCalDet *calDetVdriftUsed,AliTRDCalDet *calDetExBUsed) {fCalDetVdriftUsed = calDetVdriftUsed; fCalDetExBUsed = calDetExBUsed;};
120 Bool_t SetCalDetGain(Int_t runNumber, Int_t version, Int_t subversion);
121 Bool_t SetCalDetVdriftExB(Int_t runNumber, Int_t versionv, Int_t subversionv, Int_t versionexb, Int_t subversionexb);
123 AliTRDCalDet *GetCalDetGain() const { return fCalDetGainUsed;};
124 AliTRDCalDet *GetCalDetVdrift() const { return fCalDetVdriftUsed;};
125 Int_t GetFirstRunGainUsed() const { return fFirstRunGainUsed; }
126 Int_t GetVersionGainUsed() const { return fVersionGainUsed; }
127 Int_t GetSubVersionGainUsed() const { return fSubVersionGainUsed; }
128 Int_t GetFirstRunVdriftUsed() const { return fFirstRunVdriftUsed; }
129 Int_t GetVersionVdriftUsed() const { return fVersionVdriftUsed; }
130 Int_t GetSubVersionVdriftUsed() const { return fSubVersionVdriftUsed; }
131 Int_t GetFirstRunExBUsed() const { return fFirstRunExBUsed; }
132 Int_t GetVersionExBUsed() const { return fVersionExBUsed; }
133 Int_t GetSubVersionExBUsed() const { return fSubVersionExBUsed; }
136 // Internal functions
138 void CalibVdriftT0(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
139 void CalibExbAlt(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
140 void CalibGain(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
141 void CalibPRF(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
142 void CalibChamberStatus(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
144 Bool_t ReadStatusGlobal(const Char_t* fileName="CalibObjects.root");
145 Bool_t ReadGainGlobal(const Char_t* fileName="CalibObjects.root");
146 Bool_t ReadVdriftT0Global(const Char_t* fileName="CalibObjects.root");
147 Bool_t ReadVdriftLinearFitGlobal(const Char_t* fileName="CalibObjects.root");
148 Bool_t ReadExbAltFitGlobal(const Char_t* fileName="CalibObjects.root");
149 Bool_t ReadPRFGlobal(const Char_t* fileName="CalibObjects.root");
151 Bool_t AnalyzeGain();
152 Bool_t AnalyzeVdriftT0();
153 Bool_t AnalyzeVdriftLinearFit();
154 Bool_t AnalyzeExbAltFit();
156 Bool_t AnalyzeChamberStatus();
158 void CorrectFromDetGainUsed();
159 void CorrectFromDetVdriftUsed();
161 void UpdateOCDBT0(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath);
162 void UpdateOCDBVdrift(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath);
163 void UpdateOCDBExB(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath);
164 void UpdateOCDBExBAlt(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath);
165 void UpdateOCDBGain(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath);
166 void UpdateOCDBPRF(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath);
167 void UpdateOCDBChamberStatus(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath);
169 Bool_t ValidateGain();
170 Bool_t ValidateVdrift();
171 Bool_t ValidateExB();
173 Bool_t ValidatePRF() const;
174 Bool_t ValidateChamberStatus();
176 Int_t GetStatus() const;
177 Int_t GetStatusPos() const { return fStatusPos; }
178 Int_t GetStatusNeg() const { return fStatusNeg; }
183 Bool_t fMethodSecond; // Second Method for drift velocity
184 TString fNameList; // Name of the list
185 AliTRDCalDet *fCalDetGainUsed; // CalDet used and to be corrected for
186 AliTRDCalDet *fCalDetVdriftUsed; // CalDet used and to be corrected for
187 AliTRDCalDet *fCalDetExBUsed; // CalDet used and to be corrected for
189 TProfile2D *fPH2d; // Drift velocity first method
190 TProfile2D *fPRF2d; // PRF
191 THnSparseI *fSparse; // chamberstatus
192 AliTRDCalibraVdriftLinearFit *fAliTRDCalibraVdriftLinearFit; // Drift velocity second method
193 AliTRDCalibraExbAltFit* fAliTRDCalibraExbAltFit; //ExB alternative method
194 TH1I *fNEvents; // Number of events
195 TH2F *fAbsoluteGain; // Absolute Gain calibration
196 TObjArray * fPlots; // array with some plots to check
197 TObjArray * fCalibObjects; // array with calibration objects
198 Int_t fFirstRunGainUsed; // first run gain used
199 Int_t fVersionGainUsed; // VersionGainUsed
200 Int_t fSubVersionGainUsed; // SubVersionGainUsed
201 Int_t fFirstRunVdriftUsed; // FirstRunVdrift
202 Int_t fVersionVdriftUsed; // VersionVdriftUsed
203 Int_t fSubVersionVdriftUsed; // SubVersionVdriftUsed
204 Int_t fFirstRunExBUsed; // FirstRunExB
205 Int_t fVersionExBUsed; // VersionExBUsed
206 Int_t fSubVersionExBUsed; // SubVersionExBUsed
207 Bool_t fNoExBUsedInReco; // ExB not used yet in the reco
208 Bool_t fSwitchOnValidation; // Validation
209 Bool_t fVdriftValidated; // Vdrift validation
210 Bool_t fExBValidated; // ExB validation
211 Bool_t fT0Validated; // T0 validation
212 Int_t fMinStatsVdriftT0PH; // MinStats VdriftT0
213 Int_t fMinStatsVdriftLinear; // MinStats Vdrift Linear
214 Int_t fMinStatsGain; // MinStats Gain
215 Int_t fMinStatsPRF; // MinStats PRF
216 Int_t fMinStatsChamberStatus; // MinStats ChamberStatus
217 Bool_t fBackCorrectGain; // Back correction afterwards gain
218 Bool_t fBackCorrectVdrift; // Back correction afterwards vdrift
219 Bool_t fNotEnoughStatisticsForTheGain;// Take the chamber per chamber distribution from the default distribution
220 Bool_t fNotEnoughStatisticsForTheVdriftLinear;// Take the chamber per chamber distribution from the default distribution
221 Int_t fStatusNeg; // Info but ok
222 Int_t fStatusPos; // Problems
223 Int_t fBadCalib[18]; // number of bad calibrated chambers per sm
224 Int_t fNoData[18]; // number of chambers w/o data per sm
225 Int_t fBadCalibValidate; // validation limit for bad calibrated chambers
226 Int_t fNoDataValidate; // validation limit for chamber w/o data (sm w/o data excluded)
227 Double_t fRMSBadCalibratedGain; // value to decide when it is bad calibrated
228 Double_t fRMSBadCalibratedVdrift; // value to decide when it is bad calibrated
229 Double_t fRMSBadCalibratedExB; // value to decide when it is bad calibrated
231 Int_t GetSubVersion(TString name) const;
232 Int_t GetVersion(TString name) const;
233 Int_t GetFirstRun(TString name) const;
238 AliTRDPreprocessorOffline& operator=(const AliTRDPreprocessorOffline&); // not implemented
239 AliTRDPreprocessorOffline(const AliTRDPreprocessorOffline&); // not implemented
240 ClassDef(AliTRDPreprocessorOffline,2)