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