re-activate contrib code
[u/mrichter/AliRoot.git] / TRD / AliTRDcalibDB.h
CommitLineData
3551db50 1#ifndef ALITRDCALIBDB_H
2#define ALITRDCALIBDB_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6///////////////////////////////////////////////////////////////////////////////
7// //
8// Class providing the calibration parameters by accessing the CDB //
9// //
10///////////////////////////////////////////////////////////////////////////////
11
12/* $Id$ */
13
4ba1d6ae 14#ifndef ROOT_TObject
3551db50 15#include "TObject.h"
4ba1d6ae 16#endif
17
0d83b3a5 18#ifndef ALITRDPIDUTIL_H
19#include "AliTRDpidUtil.h"
4ba1d6ae 20#endif
3551db50 21
9dcc64cc 22#ifndef ALITRDPIDRESPONSE_H
23#include "AliTRDPIDResponse.h"
24#endif
25
a9e22145 26#include "AliTRDCalTrapConfig.h"
27#include "AliTRDtrapConfig.h"
28
ea3eaa08 29class TString;
30
2745a409 31class AliCDBEntry;
3551db50 32
0d83b3a5 33class AliTRDrecoParam;
9dcc64cc 34class AliTRDCalTrkAttach;
720a0a16 35class AliTRDCalPID;
7754cd1f 36class AliTRDCalMonitoring;
56178ff4 37class AliTRDCalROC;
38class AliTRDCalDet;
0e09df31 39class AliTRDCalSingleChamberStatus;
ea3eaa08 40class AliTRDCalOnlineGainTableROC;
41
2745a409 42class AliTRDcalibDB : public TObject {
43
44 public:
45
053767a4 46 enum { kNlayer = 6
47 , kNstack = 5
48 , kNsector = 18
49 , kNdet = 540 };
6a739e92 50
fc358d0f 51 enum { kFltrSet = 1
52 , kReadout
53 , kTimebin
54 , kTrkMode
55 , kTrigSet
56 , kAddOpti };
57
0e09df31 58 static AliTRDcalibDB *Instance();
59 static void Terminate();
3551db50 60
0e09df31 61 void SetRun(Long64_t run);
62 Long64_t GetRun() const { return fRun; }
7754cd1f 63
df83a620 64 Float_t GetNoise(Int_t det, Int_t col, Int_t row);
65 AliTRDCalROC *GetNoiseROC(Int_t det);
66 const AliTRDCalDet *GetNoiseDet();
67
0e09df31 68 Float_t GetVdrift(Int_t det, Int_t col, Int_t row);
69 Float_t GetVdriftAverage(Int_t det);
70 AliTRDCalROC *GetVdriftROC(Int_t det);
71 const AliTRDCalDet *GetVdriftDet();
e2a1c98b 72 TObjArray *GetPHQ();
eda91732 73 const AliTRDCalDet *GetExBDet();
74
0e09df31 75 Float_t GetT0(Int_t det, Int_t col, Int_t row);
76 Float_t GetT0Average(Int_t det);
77 AliTRDCalROC *GetT0ROC(Int_t det);
78 const AliTRDCalDet *GetT0Det();
7754cd1f 79
0e09df31 80 Float_t GetGainFactor(Int_t det, Int_t col, Int_t row);
81 Float_t GetGainFactorAverage(Int_t det);
4ba1d6ae 82 AliTRDCalROC *GetGainFactorROC(Int_t det);
0e09df31 83 const AliTRDCalDet *GetGainFactorDet();
3551db50 84
ea3eaa08 85 Float_t GetOnlineGainFactor(Int_t det, Int_t col, Int_t row);
86 AliTRDCalOnlineGainTableROC *GetOnlineGainTableROC(Int_t det);
87
4ba1d6ae 88 AliTRDCalROC *GetPRFROC(Int_t det);
0e09df31 89 Float_t GetPRFWidth(Int_t det, Int_t col, Int_t row);
7754cd1f 90
be28462a 91 Float_t* GetSampledPRF() const { return fPRFsmp; };
92 Int_t GetPRFbin() const { return fPRFbin; };
93 Float_t GetPRFlo() const { return fPRFlo; };
94 Float_t GetPRFhi() const { return fPRFhi; };
fa7427d0 95
5b7ccf04 96 Int_t ExtractTimeBinsFromString(TString tbstr);
e232d349 97 Int_t GetNumberOfTimeBinsDCS();
98 void GetFilterType(TString &filterType);
af086c5e 99 void GetGlobalConfiguration(TString &config);
f8059b39 100 void GetGlobalConfigurationVersion(TString &version);
1567d9a4 101 Int_t GetNumberOfParsDCS(TString cname, Char_t delimiter='_');
5b7ccf04 102 Int_t GetNumberOfOptsDCS(TString cname, Int_t cfgType);
103 void GetDCSConfigParOption(TString cname, Int_t cfgType, Int_t option, TString &cfgo);
ea3eaa08 104
105 Int_t GetOnlineGainTableID();
106
af086c5e 107 Bool_t HasOnlineFilterPedestal();
108 Bool_t HasOnlineFilterGain();
109 Bool_t HasOnlineTailCancellation();
7754cd1f 110
0e09df31 111 Char_t GetPadStatus(Int_t det, Int_t col, Int_t row);
4ba1d6ae 112 AliTRDCalSingleChamberStatus *GetPadStatusROC(Int_t det);
a7ac01d2 113 AliTRDrecoParam* GetRecoParam(Int_t *eventtype);
9dcc64cc 114 AliTRDPIDResponse *GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod m);
7754cd1f 115
0e09df31 116 Char_t GetChamberStatus(Int_t det);
117
118 Bool_t IsPadMasked(Int_t det, Int_t col, Int_t row);
119 Bool_t IsPadBridgedLeft(Int_t det, Int_t col, Int_t row);
120 Bool_t IsPadBridgedRight(Int_t det, Int_t col, Int_t row);
fa7427d0 121 Bool_t IsPadNotConnected(Int_t det, Int_t col, Int_t row);
3551db50 122
eda91732 123 Bool_t IsChamberGood(Int_t det);
124 Bool_t IsChamberNoData(Int_t det);
125 Bool_t IsHalfChamberNoData(Int_t det, Int_t side);
126 Bool_t IsChamberBadCalibrated(Int_t det);
67abca5c 127 Bool_t IsChamberNotCalibrated(Int_t det);
7754cd1f 128
0e09df31 129 const AliTRDCalMonitoring *GetMonitoringObject();
0d83b3a5 130 const AliTRDCalPID *GetPIDObject(AliTRDpidUtil::ETRDPIDMethod m);
9dcc64cc 131 const AliTRDCalTrkAttach *GetAttachObject();
7754cd1f 132
2745a409 133 // Related functions, these depend on calibration data
ea3eaa08 134 Int_t PadResponse(Double_t signal, Double_t dist
053767a4 135 , Int_t layer, Double_t *pad) const;
543691ea 136
a9e22145 137 AliTRDtrapConfig* GetTrapConfig();
1b1afdd3 138 void GetTrapConfig(TString &name, TString &version) { name = fTrapConfigName; version = fTrapConfigVersion; }
139 void SetTrapConfig(const TString name, const TString version) { fTrapConfigName = name; fTrapConfigVersion = version; }
a9e22145 140 void SetTrapConfig(AliTRDtrapConfig *trapcfg) { fTrapConfig = trapcfg; }
a9e22145 141
2745a409 142 protected:
143
1b1afdd3 144 AliTRDtrapConfig* LoadTrapConfig(const TString &name = "", const TString &version = "");
145
2745a409 146 // For caching see also implentation of GetCachedCDBObject in the .cxx file
b43a3e17 147 enum { kIDVdriftPad = 0
148 , kIDVdriftChamber
eda91732 149 , kIDExBChamber
b43a3e17 150 , kIDT0Pad
151 , kIDT0Chamber
152 , kIDGainFactorPad
153 , kIDGainFactorChamber
ea3eaa08 154 , kIDOnlineGainFactor
df83a620 155 , kIDNoiseChamber
156 , kIDNoisePad
b43a3e17 157 , kIDPRFWidth
aa617684 158 , kIDFEE
a9e22145 159 , kIDTrapConfig
b43a3e17 160 , kIDChamberPos
161 , kIDStackPos
162 , kIDSuperModulePos
44dbae42 163 , kIDPIDNN
b43a3e17 164 , kIDPIDLQ
9dcc64cc 165 , kIDPIDLQ1D
a7ac01d2 166 , kIDRecoParam
b43a3e17 167 , kIDMonitoringData
168 , kIDChamberStatus
913950a4 169 , kIDPadStatus
d6a1ec13 170 , kIDDCS
9dcc64cc 171 , kIDAttach
e2a1c98b 172 , kIDPHQ
d6a1ec13 173 , kCDBCacheSize }; // IDs of cached objects
7754cd1f 174
56178ff4 175 const TObject *GetCachedCDBObject(Int_t id);
3551db50 176
2745a409 177 void Invalidate();
178 void SamplePRF();
6a739e92 179
b43a3e17 180 AliCDBEntry *GetCDBEntry(const Char_t *cdbPath);
181 const TObject *CacheCDBEntry(Int_t id, const Char_t *cdbPath);
7754cd1f 182
2745a409 183 static AliTRDcalibDB *fgInstance; // Instance of this class (singleton implementation)
184 static Bool_t fgTerminated; // Defines if this class has already been terminated
6d50f529 185
2745a409 186 AliCDBEntry *fCDBEntries[kCDBCacheSize]; // Cache for CDB entries
187 TObject *fCDBCache[kCDBCacheSize]; // Cache for calibration objects.
6a739e92 188
2745a409 189 Long64_t fRun; // Run Number
ea3eaa08 190
6d50f529 191 Float_t *fPRFsmp; //! Sampled pad response
192 Int_t fPRFbin; // Number of bins for the PRF
193 Float_t fPRFlo; // Lower boundary of the PRF
194 Float_t fPRFhi; // Higher boundary of the PRF
195 Float_t fPRFwid; // Bin width of the sampled PRF
196 Int_t fPRFpad; // Distance to next pad in PRF
ea3eaa08 197
9dcc64cc 198 AliTRDPIDResponse *fPIDResponse; // TRD PID Response function
ea3eaa08 199
200 Int_t fOnlineGainTableID; // ID for online gain table
a9e22145 201
202 AliTRDtrapConfig* fTrapConfig; // TRAP configuration
1b1afdd3 203 TString fTrapConfigName; // name of the TRAPconfig
204 TString fTrapConfigVersion; // version of the TRAPconfig
6a739e92 205
2745a409 206 private:
207
208 AliTRDcalibDB(); // This is a singleton, constructor is private!
209 AliTRDcalibDB(const AliTRDcalibDB &c);
210 AliTRDcalibDB &operator=(const AliTRDcalibDB &c);
3551db50 211 virtual ~AliTRDcalibDB();
212
1b1afdd3 213 ClassDef(AliTRDcalibDB, 8) // Provides central access to the CDB
2745a409 214
3551db50 215};
216
3551db50 217#endif
7a6352a6 218