Missing submission to rev 52361
[u/mrichter/AliRoot.git] / TRD / AliTRDPreprocessorOffline.h
CommitLineData
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"
b3fcfd96 15class TObjArray;
01239968 16class AliTRDCalDet;
b3fcfd96 17class TH2I;
18class TProfile2D;
19class AliTRDCalibraVdriftLinearFit;
20class TH1I;
21class TH2F;
01239968 22class TString;
b3fcfd96 23
24
25class AliTRDPreprocessorOffline:public TNamed {
26public:
27 enum{
28 kGain = 0,
29 kVdriftPHDet = 1,
30 kVdriftPHPad = 2,
31 kT0PHDet = 3,
32 kT0PHPad = 4,
33 kVdriftLinear = 5,
34 kLorentzLinear = 6,
a5dcf618 35 kChamberStatus = 7,
36 kPRF = 8
b3fcfd96 37 };
840ec79d 38 enum { kGainNotEnoughStatsButFill = 2,
39 kVdriftNotEnoughStatsButFill = 4,
40 kGainNotEnoughStatsNotFill = 8,
41 kVdriftNotEnoughStatsNotFill = 16,
42 kTimeOffsetNotEnoughStatsNotFill = 32,
43 kExBErrorRange = 64};
44 enum { kGainErrorOld = 2,
45 kVdriftErrorOld = 4,
46 kExBErrorOld = 8,
47 kGainErrorRange = 16,
48 kVdriftErrorRange = 32,
49 kTimeOffsetErrorRange = 64,
50 kChamberStatusErrorRange = 128};
82b413fd 51
52
b3fcfd96 53 AliTRDPreprocessorOffline();
54 virtual ~AliTRDPreprocessorOffline();
55
82b413fd 56 Bool_t IsGainNotEnoughStatsButFill() const
57 { return CheckStatus(fStatusNeg, kGainNotEnoughStatsButFill); };
58 Bool_t IsGainNotEnoughStatsNotFill() const
59 { return CheckStatus(fStatusNeg, kGainNotEnoughStatsNotFill); };
60 Bool_t IsVdriftNotEnoughStatsButFill() const
61 { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsButFill); };
62 Bool_t IsVdriftNotEnoughStatsNotFill() const
63 { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsNotFill); };
64 Bool_t IsTimeOffsetNotEnoughStatsNotFill() const
840ec79d 65 { return CheckStatus(fStatusNeg, kTimeOffsetNotEnoughStatsNotFill); };
66 Bool_t IsExBErrorRange() const
67 { return CheckStatus(fStatusNeg, kExBErrorRange); };
82b413fd 68
69 Bool_t IsGainErrorOld() const
70 { return CheckStatus(fStatusPos, kGainErrorOld); };
71 Bool_t IsVdriftErrorOld() const
72 { return CheckStatus(fStatusPos, kVdriftErrorOld); };
840ec79d 73 Bool_t IsExBErrorOld() const
74 { return CheckStatus(fStatusPos, kExBErrorOld); };
82b413fd 75 Bool_t IsGainErrorRange() const
76 { return CheckStatus(fStatusPos, kGainErrorRange); };
77 Bool_t IsVdriftErrorRange() const
78 { return CheckStatus(fStatusPos, kVdriftErrorRange); };
79 Bool_t IsTimeOffsetErrorRange() const
80 { return CheckStatus(fStatusPos, kTimeOffsetErrorRange); };
81 Bool_t IsChamberStatusErrorRange() const
82 { return CheckStatus(fStatusPos, kChamberStatusErrorRange); };
83
84 Bool_t CheckStatus(Int_t status, Int_t bitMask) const;
85 void PrintStatus() const;
86
87
b3fcfd96 88 void SetLinearFitForVdrift(Bool_t methodsecond) { fMethodSecond = methodsecond;};
89 Bool_t GetLinearFitForVdrift() const { return fMethodSecond;};
01239968 90 void SetNameList(TString nameList) { fNameList = nameList;};
91 TString GetNameList() const { return fNameList;};
92 void SetCalDetGain(AliTRDCalDet *calDetGainUsed) {fCalDetGainUsed = calDetGainUsed;};
840ec79d 93 void SetCalDetVdrift(AliTRDCalDet *calDetVdriftUsed);
94 void SetCalDetVdriftExB(AliTRDCalDet *calDetVdriftUsed,AliTRDCalDet *calDetExBUsed) {fCalDetVdriftUsed = calDetVdriftUsed; fCalDetExBUsed = calDetExBUsed;};
008817a3 95 void SetSwitchOnValidation(Bool_t switchOnValidation) {fSwitchOnValidation = switchOnValidation;};
01239968 96 AliTRDCalDet *GetCalDetGain() const { return fCalDetGainUsed;};
4c865c34 97 AliTRDCalDet *GetCalDetVdrift() const { return fCalDetVdriftUsed;};
b3fcfd96 98
4c865c34 99 Bool_t Init(const Char_t* fileName);
100
b3fcfd96 101 void CalibVdriftT0(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
102 void CalibGain(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
103 void CalibPRF(const Char_t* file, Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
a5dcf618 104 void CalibChamberStatus(Int_t startRunNumber, Int_t endRunNumber, TString ocdbStorage="");
81a5aeca 105
b3fcfd96 106 Bool_t ReadGainGlobal(const Char_t* fileName="CalibObjects.root");
107 Bool_t ReadVdriftT0Global(const Char_t* fileName="CalibObjects.root");
108 Bool_t ReadVdriftLinearFitGlobal(const Char_t* fileName="CalibObjects.root");
109 Bool_t ReadPRFGlobal(const Char_t* fileName="CalibObjects.root");
110
111 Bool_t AnalyzeGain();
112 Bool_t AnalyzeVdriftT0();
113 Bool_t AnalyzeVdriftLinearFit();
a5dcf618 114 Bool_t AnalyzePRF();
115 Bool_t AnalyzeChamberStatus();
b3fcfd96 116
01239968 117 void CorrectFromDetGainUsed();
4c865c34 118 void CorrectFromDetVdriftUsed();
a5dcf618 119
b3fcfd96 120 void UpdateOCDBT0(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath);
121 void UpdateOCDBVdrift(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath);
eec29d56 122 void UpdateOCDBExB(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath);
b3fcfd96 123 void UpdateOCDBGain(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath);
124 void UpdateOCDBPRF(Int_t startRunNumber, Int_t endRunNumber, const char* storagePath);
a5dcf618 125 void UpdateOCDBChamberStatus(Int_t startRunNumber, Int_t endRunNumber, const Char_t *storagePath);
b3fcfd96 126
54f2ff1c 127 Bool_t ValidateGain();
00d203b6 128 Bool_t ValidateVdrift();
840ec79d 129 Bool_t ValidateExB();
00d203b6 130 Bool_t ValidateT0();
131 Bool_t ValidatePRF() const;
82b413fd 132 Bool_t ValidateChamberStatus();
00d203b6 133
82b413fd 134 Int_t GetStatus() const;
135 Int_t GetStatusPos() const { return fStatusPos; }
136 Int_t GetStatusNeg() const { return fStatusNeg; }
4c865c34 137 Int_t GetVersionGainUsed() const { return fVersionGainUsed; }
138 Int_t GetSubVersionGainUsed() const { return fSubVersionGainUsed; }
ca7e6e64 139 Int_t GetFirstRunVdriftUsed() const { return fFirstRunVdriftUsed; }
4c865c34 140 Int_t GetVersionVdriftUsed() const { return fVersionVdriftUsed; }
141 Int_t GetSubVersionVdriftUsed() const { return fSubVersionVdriftUsed; }
a2a4ec8e 142
143 void SetMinStatsVdriftT0PH(Int_t minStatsVdriftT0PH) { fMinStatsVdriftT0PH = minStatsVdriftT0PH; }
144 void SetMinStatsVdriftLinear(Int_t minStatsVdriftLinear) { fMinStatsVdriftLinear = minStatsVdriftLinear; }
145 void SetMinStatsGain(Int_t minStatsGain) { fMinStatsGain = minStatsGain; }
146 void SetMinStatsPRF(Int_t minStatsPRF) { fMinStatsPRF = minStatsPRF; }
54f2ff1c 147 void SetBackCorrectGain(Bool_t backCorrectGain) { fBackCorrectGain = backCorrectGain; }
148 void SetBackCorrectVdrift(Bool_t backCorrectVdrift) { fBackCorrectVdrift = backCorrectVdrift; }
81a5aeca 149
a5dcf618 150
4c865c34 151
152 private:
81a5aeca 153 Bool_t fMethodSecond; // Second Method for drift velocity
154 TString fNameList; // Name of the list
155 AliTRDCalDet *fCalDetGainUsed; // CalDet used and to be corrected for
156 AliTRDCalDet *fCalDetVdriftUsed; // CalDet used and to be corrected for
840ec79d 157 AliTRDCalDet *fCalDetExBUsed; // CalDet used and to be corrected for
81a5aeca 158 TH2I *fCH2d; // Gain
159 TProfile2D *fPH2d; // Drift velocity first method
160 TProfile2D *fPRF2d; // PRF
b3fcfd96 161 AliTRDCalibraVdriftLinearFit *fAliTRDCalibraVdriftLinearFit; // Drift velocity second method
162 TH1I *fNEvents; // Number of events
163 TH2F *fAbsoluteGain; // Absolute Gain calibration
164 TObjArray * fPlots; // array with some plots to check
165 TObjArray * fCalibObjects; // array with calibration objects
4c865c34 166 Int_t fVersionGainUsed; // VersionGainUsed
167 Int_t fSubVersionGainUsed; // SubVersionGainUsed
ca7e6e64 168 Int_t fFirstRunVdriftUsed; // FirstRunVdrift
4c865c34 169 Int_t fVersionVdriftUsed; // VersionVdriftUsed
170 Int_t fSubVersionVdriftUsed; // SubVersionVdriftUsed
00d203b6 171 Bool_t fSwitchOnValidation; // Validation
172 Bool_t fVdriftValidated; // Vdrift validation
840ec79d 173 Bool_t fExBValidated; // ExB validation
00d203b6 174 Bool_t fT0Validated; // T0 validation
a2a4ec8e 175 Int_t fMinStatsVdriftT0PH; // MinStats VdriftT0
176 Int_t fMinStatsVdriftLinear; // MinStats Vdrift Linear
177 Int_t fMinStatsGain; // MinStats Gain
178 Int_t fMinStatsPRF; // MinStats PRF
54f2ff1c 179 Bool_t fBackCorrectGain; // Back correction afterwards gain
180 Bool_t fBackCorrectVdrift; // Back correction afterwards vdrift
181 Bool_t fNotEnoughStatisticsForTheGain;// Take the chamber per chamber distribution from the default distribution
182 Bool_t fNotEnoughStatisticsForTheVdriftLinear;// Take the chamber per chamber distribution from the default distribution
82b413fd 183 Int_t fStatusNeg; // Info but ok
184 Int_t fStatusPos; // Problems
a2a4ec8e 185
b3fcfd96 186
4c865c34 187 Int_t GetSubVersion(TString name) const;
188 Int_t GetVersion(TString name) const;
ca7e6e64 189 Int_t GetFirstRun(TString name) const;
b3fcfd96 190
191
192
193private:
194 AliTRDPreprocessorOffline& operator=(const AliTRDPreprocessorOffline&); // not implemented
195 AliTRDPreprocessorOffline(const AliTRDPreprocessorOffline&); // not implemented
54f2ff1c 196 ClassDef(AliTRDPreprocessorOffline,2)
b3fcfd96 197};
198
199#endif
01239968 200
a5dcf618 201