]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDcalibDB.h
Update responsibles for MCH, MTR, HMP
[u/mrichter/AliRoot.git] / TRD / AliTRDcalibDB.h
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
14 #ifndef ROOT_TObject
15 #include "TObject.h"
16 #endif
17
18 #ifndef ALITRDPIDUTIL_H
19 #include "AliTRDpidUtil.h"
20 #endif
21
22 #ifndef ALITRDPIDRESPONSE_H
23 #include "AliTRDPIDResponse.h"
24 #endif
25
26 #include "AliTRDCalTrapConfig.h"
27 #include "AliTRDtrapConfig.h"
28
29 class TString;
30
31 class AliCDBEntry;
32
33 class AliTRDrecoParam;
34 class AliTRDCalTrkAttach;
35 class AliTRDCalPID;
36 class AliTRDCalMonitoring;
37 class AliTRDCalROC;
38 class AliTRDCalDet;
39 class AliTRDCalSingleChamberStatus;
40 class AliTRDCalOnlineGainTableROC;
41
42 class AliTRDcalibDB : public TObject {
43
44  public:
45
46   enum { kNlayer  =   6
47        , kNstack  =   5
48        , kNsector =  18
49        , kNdet    = 540 };
50   
51   enum { kFltrSet = 1
52        , kReadout
53        , kTimebin
54        , kTrkMode
55        , kTrigSet
56        , kAddOpti };
57
58   static AliTRDcalibDB               *Instance();
59   static void                         Terminate();
60
61   void                                SetRun(Long64_t run);
62   Long64_t                            GetRun() const { return fRun; }
63
64   Float_t                             GetNoise(Int_t det, Int_t col, Int_t row);
65         AliTRDCalROC                 *GetNoiseROC(Int_t det);
66   const AliTRDCalDet                 *GetNoiseDet();
67
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();
72   TObjArray                          *GetPHQ();
73   const AliTRDCalDet                 *GetExBDet();
74
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();
79
80   Float_t                             GetGainFactor(Int_t det, Int_t col, Int_t row);
81   Float_t                             GetGainFactorAverage(Int_t det);
82   AliTRDCalROC                       *GetGainFactorROC(Int_t det);
83   const AliTRDCalDet                 *GetGainFactorDet();
84
85   Float_t                             GetOnlineGainFactor(Int_t det, Int_t col, Int_t row);
86   AliTRDCalOnlineGainTableROC        *GetOnlineGainTableROC(Int_t det);
87
88   AliTRDCalROC                       *GetPRFROC(Int_t det);
89   Float_t                             GetPRFWidth(Int_t det, Int_t col, Int_t row);
90
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;  };
95
96   Int_t                               ExtractTimeBinsFromString(TString tbstr);
97   Int_t                               GetNumberOfTimeBinsDCS();
98   void                                GetFilterType(TString &filterType);
99   void                                GetGlobalConfiguration(TString &config);
100   void                                GetGlobalConfigurationByChamber(TString &config,Int_t par, Int_t opt=0);
101   void                                GetGlobalConfigurationVersion(TString &version);
102   Int_t                               GetNumberOfParsDCS(TString cname, Char_t delimiter='_');
103   Int_t                               GetNumberOfOptsDCS(TString cname, Int_t cfgType);
104   void                                GetDCSConfigParOption(TString cname, Int_t cfgType, Int_t option, TString &cfgo);
105
106   Int_t                               GetOnlineGainTableID();
107
108   Bool_t                              HasOnlineFilterPedestal();
109   Bool_t                              HasOnlineFilterGain();
110   Bool_t                              HasOnlineTailCancellation();
111
112   Char_t                              GetPadStatus(Int_t det, Int_t col, Int_t row);
113   AliTRDCalSingleChamberStatus       *GetPadStatusROC(Int_t det);
114   AliTRDrecoParam*                    GetRecoParam(Int_t *eventtype);
115   AliTRDPIDResponse                  *GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod m);
116
117   Char_t                              GetChamberStatus(Int_t det);
118
119   Bool_t                              IsPadMasked(Int_t det, Int_t col, Int_t row);
120   Bool_t                              IsPadBridgedLeft(Int_t det, Int_t col, Int_t row);
121   Bool_t                              IsPadBridgedRight(Int_t det, Int_t col, Int_t row);
122   Bool_t                              IsPadNotConnected(Int_t det, Int_t col, Int_t row);
123   
124   Bool_t                              IsChamberGood(Int_t det);
125   Bool_t                              IsChamberNoData(Int_t det);
126   Bool_t                              IsHalfChamberNoData(Int_t det, Int_t side);
127   Bool_t                              IsChamberBadCalibrated(Int_t det);
128   Bool_t                              IsChamberNotCalibrated(Int_t det);
129
130   const AliTRDCalMonitoring          *GetMonitoringObject();
131   const AliTRDCalPID                 *GetPIDObject(AliTRDpidUtil::ETRDPIDMethod m);
132   const AliTRDCalTrkAttach           *GetAttachObject();
133
134   // Related functions, these depend on calibration data
135   Int_t                               PadResponse(Double_t signal, Double_t dist
136                                                 , Int_t layer, Double_t *pad) const;
137
138   AliTRDtrapConfig*                   GetTrapConfig();
139   void                                GetTrapConfig(TString &name, TString &version) { name = fTrapConfigName; version = fTrapConfigVersion; }
140   void                                SetTrapConfig(const TString name, const TString version) { fTrapConfigName = name; fTrapConfigVersion = version; }
141   void                                SetTrapConfig(AliTRDtrapConfig *trapcfg) { fTrapConfig = trapcfg; }
142
143  protected:
144
145   AliTRDtrapConfig*                   LoadTrapConfig(const TString &name = "", const TString &version = "");
146   Int_t                               GetNumberOfTimeBinsDCSBoard(); // Old method as fallback for patched OCDB 
147
148   // For caching see also implentation of GetCachedCDBObject in the .cxx file
149   enum { kIDVdriftPad = 0
150        , kIDVdriftChamber
151        , kIDExBChamber
152        , kIDT0Pad
153        , kIDT0Chamber
154        , kIDGainFactorPad
155        , kIDGainFactorChamber
156        , kIDOnlineGainFactor
157        , kIDNoiseChamber
158        , kIDNoisePad
159        , kIDPRFWidth
160        , kIDFEE
161        , kIDTrapConfig
162        , kIDChamberPos
163        , kIDStackPos
164        , kIDSuperModulePos
165        , kIDPIDNN
166        , kIDPIDLQ
167        , kIDPIDLQ1D
168        , kIDRecoParam
169        , kIDMonitoringData
170        , kIDChamberStatus
171        , kIDPadStatus
172        , kIDDCS
173        , kIDAttach
174        , kIDPHQ
175        , kCDBCacheSize };         // IDs of cached objects
176
177   const TObject *GetCachedCDBObject(Int_t id);
178   
179   void           Invalidate();
180   void           SamplePRF();
181   
182   AliCDBEntry   *GetCDBEntry(const Char_t *cdbPath);
183   const TObject *CacheCDBEntry(Int_t id, const Char_t *cdbPath);
184
185   static AliTRDcalibDB *fgInstance;                 //  Instance of this class (singleton implementation)
186   static Bool_t         fgTerminated;               //  Defines if this class has already been terminated
187
188   AliCDBEntry          *fCDBEntries[kCDBCacheSize]; //  Cache for CDB entries
189   TObject              *fCDBCache[kCDBCacheSize];   //  Cache for calibration objects.
190
191   Long64_t              fRun;                       //  Run Number
192
193   Float_t              *fPRFsmp;                    //! Sampled pad response
194   Int_t                 fPRFbin;                    //  Number of bins for the PRF
195   Float_t               fPRFlo;                     //  Lower boundary of the PRF
196   Float_t               fPRFhi;                     //  Higher boundary of the PRF
197   Float_t               fPRFwid;                    //  Bin width of the sampled PRF
198   Int_t                 fPRFpad;                    //  Distance to next pad in PRF
199
200   AliTRDPIDResponse    *fPIDResponse;               //  TRD PID Response function
201
202   Int_t                 fOnlineGainTableID;         //  ID for online gain table 
203
204   AliTRDtrapConfig*     fTrapConfig;                //  TRAP configuration
205   TString               fTrapConfigName;            //  name of the TRAPconfig
206   TString               fTrapConfigVersion;         //  version of the TRAPconfig
207   
208  private:
209
210   AliTRDcalibDB();                                  //  This is a singleton, constructor is private!  
211   AliTRDcalibDB(const AliTRDcalibDB &c);   
212   AliTRDcalibDB &operator=(const AliTRDcalibDB &c); 
213   virtual ~AliTRDcalibDB();
214
215   ClassDef(AliTRDcalibDB, 8)                        //  Provides central access to the CDB
216
217 };
218
219 #endif
220