]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDcalibDB.h
Fix
[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   static AliTRDcalibDB               *Instance();
52   static void                         Terminate();
53
54   void                                SetRun(Long64_t run);
55   Long64_t                            GetRun() const { return fRun; }
56
57   Float_t                             GetNoise(Int_t det, Int_t col, Int_t row);
58         AliTRDCalROC                 *GetNoiseROC(Int_t det);
59   const AliTRDCalDet                 *GetNoiseDet();
60
61   Float_t                             GetVdrift(Int_t det, Int_t col, Int_t row);
62   Float_t                             GetVdriftAverage(Int_t det);
63         AliTRDCalROC                 *GetVdriftROC(Int_t det);
64   const AliTRDCalDet                 *GetVdriftDet();
65   TObjArray                          *GetPHQ();
66   const AliTRDCalDet                 *GetExBDet();
67
68   Float_t                             GetT0(Int_t det, Int_t col, Int_t row);
69   Float_t                             GetT0Average(Int_t det);
70         AliTRDCalROC                 *GetT0ROC(Int_t det);
71   const AliTRDCalDet                 *GetT0Det();
72
73   Float_t                             GetGainFactor(Int_t det, Int_t col, Int_t row);
74   Float_t                             GetGainFactorAverage(Int_t det);
75   AliTRDCalROC                       *GetGainFactorROC(Int_t det);
76   const AliTRDCalDet                 *GetGainFactorDet();
77
78   Float_t                             GetOnlineGainFactor(Int_t det, Int_t col, Int_t row);
79   AliTRDCalOnlineGainTableROC        *GetOnlineGainTableROC(Int_t det);
80
81   AliTRDCalROC                       *GetPRFROC(Int_t det);
82   Float_t                             GetPRFWidth(Int_t det, Int_t col, Int_t row);
83
84   Float_t*                            GetSampledPRF() const { return fPRFsmp; };
85   Int_t                               GetPRFbin() const     { return fPRFbin; };
86   Float_t                             GetPRFlo() const      { return fPRFlo;  };
87   Float_t                             GetPRFhi() const      { return fPRFhi;  };
88
89   Int_t                               GetNumberOfTimeBinsDCS();
90   void                                GetFilterType(TString &filterType);
91   void                                GetGlobalConfiguration(TString &config);
92   void                                GetGlobalConfigurationVersion(TString &version);
93
94   Int_t                               GetOnlineGainTableID();
95
96   Bool_t                              HasOnlineFilterPedestal();
97   Bool_t                              HasOnlineFilterGain();
98   Bool_t                              HasOnlineTailCancellation();
99
100   Char_t                              GetPadStatus(Int_t det, Int_t col, Int_t row);
101   AliTRDCalSingleChamberStatus       *GetPadStatusROC(Int_t det);
102   AliTRDrecoParam*                    GetRecoParam(Int_t *eventtype);
103   AliTRDPIDResponse                  *GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod m);
104
105   Char_t                              GetChamberStatus(Int_t det);
106
107   Bool_t                              IsPadMasked(Int_t det, Int_t col, Int_t row);
108   Bool_t                              IsPadBridgedLeft(Int_t det, Int_t col, Int_t row);
109   Bool_t                              IsPadBridgedRight(Int_t det, Int_t col, Int_t row);
110   Bool_t                              IsPadNotConnected(Int_t det, Int_t col, Int_t row);
111   
112   Bool_t                              IsChamberGood(Int_t det);
113   Bool_t                              IsChamberNoData(Int_t det);
114   Bool_t                              IsHalfChamberNoData(Int_t det, Int_t side);
115   Bool_t                              IsChamberBadCalibrated(Int_t det);
116
117   const AliTRDCalMonitoring          *GetMonitoringObject();
118   const AliTRDCalPID                 *GetPIDObject(AliTRDpidUtil::ETRDPIDMethod m);
119   const AliTRDCalTrkAttach           *GetAttachObject();
120
121   // Related functions, these depend on calibration data
122   Int_t                               PadResponse(Double_t signal, Double_t dist
123                                                 , Int_t layer, Double_t *pad) const;
124
125   AliTRDtrapConfig*                   GetTrapConfig();
126   void                                GetTrapConfig(TString &name, TString &version) { name = fTrapConfigName; version = fTrapConfigVersion; }
127   void                                SetTrapConfig(const TString name, const TString version) { fTrapConfigName = name; fTrapConfigVersion = version; }
128   void                                SetTrapConfig(AliTRDtrapConfig *trapcfg) { fTrapConfig = trapcfg; }
129
130  protected:
131
132   AliTRDtrapConfig*                   LoadTrapConfig(const TString &name = "", const TString &version = "");
133
134   // For caching see also implentation of GetCachedCDBObject in the .cxx file
135   enum { kIDVdriftPad = 0
136        , kIDVdriftChamber
137        , kIDExBChamber
138        , kIDT0Pad
139        , kIDT0Chamber
140        , kIDGainFactorPad
141        , kIDGainFactorChamber
142        , kIDOnlineGainFactor
143        , kIDNoiseChamber
144        , kIDNoisePad
145        , kIDPRFWidth
146        , kIDFEE
147        , kIDTrapConfig
148        , kIDChamberPos
149        , kIDStackPos
150        , kIDSuperModulePos
151        , kIDPIDNN
152        , kIDPIDLQ
153        , kIDPIDLQ1D
154        , kIDRecoParam
155        , kIDMonitoringData
156        , kIDChamberStatus
157        , kIDPadStatus
158        , kIDDCS
159        , kIDAttach
160        , kIDPHQ
161        , kCDBCacheSize };         // IDs of cached objects
162
163   const TObject *GetCachedCDBObject(Int_t id);
164   
165   void           Invalidate();
166   void           SamplePRF();
167   
168   AliCDBEntry   *GetCDBEntry(const Char_t *cdbPath);
169   const TObject *CacheCDBEntry(Int_t id, const Char_t *cdbPath);
170
171   static AliTRDcalibDB *fgInstance;                 //  Instance of this class (singleton implementation)
172   static Bool_t         fgTerminated;               //  Defines if this class has already been terminated
173
174   AliCDBEntry          *fCDBEntries[kCDBCacheSize]; //  Cache for CDB entries
175   TObject              *fCDBCache[kCDBCacheSize];   //  Cache for calibration objects.
176
177   Long64_t              fRun;                       //  Run Number
178
179   Float_t              *fPRFsmp;                    //! Sampled pad response
180   Int_t                 fPRFbin;                    //  Number of bins for the PRF
181   Float_t               fPRFlo;                     //  Lower boundary of the PRF
182   Float_t               fPRFhi;                     //  Higher boundary of the PRF
183   Float_t               fPRFwid;                    //  Bin width of the sampled PRF
184   Int_t                 fPRFpad;                    //  Distance to next pad in PRF
185
186   AliTRDPIDResponse    *fPIDResponse;               //  TRD PID Response function
187
188   Int_t                 fOnlineGainTableID;         //  ID for online gain table 
189
190   AliTRDtrapConfig*     fTrapConfig;                //  TRAP configuration
191   TString               fTrapConfigName;            //  name of the TRAPconfig
192   TString               fTrapConfigVersion;         //  version of the TRAPconfig
193   
194  private:
195
196   AliTRDcalibDB();                                  //  This is a singleton, constructor is private!  
197   AliTRDcalibDB(const AliTRDcalibDB &c);   
198   AliTRDcalibDB &operator=(const AliTRDcalibDB &c); 
199   virtual ~AliTRDcalibDB();
200
201   ClassDef(AliTRDcalibDB, 8)                        //  Provides central access to the CDB
202
203 };
204
205 #endif
206