]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDcalibDB.h
Change THnSparseS to THnSparseF (Xianguo)
[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                               GetNumberOfTimeBinsDCS();
97   void                                GetFilterType(TString &filterType);
98   void                                GetGlobalConfiguration(TString &config);
99   void                                GetGlobalConfigurationVersion(TString &version);
100   void                                GetDCSConfigParOption(Int_t cfgType, Int_t option, TString &cfgo);
101
102   Int_t                               GetOnlineGainTableID();
103
104   Bool_t                              HasOnlineFilterPedestal();
105   Bool_t                              HasOnlineFilterGain();
106   Bool_t                              HasOnlineTailCancellation();
107
108   Char_t                              GetPadStatus(Int_t det, Int_t col, Int_t row);
109   AliTRDCalSingleChamberStatus       *GetPadStatusROC(Int_t det);
110   AliTRDrecoParam*                    GetRecoParam(Int_t *eventtype);
111   AliTRDPIDResponse                  *GetPIDResponse(AliTRDPIDResponse::ETRDPIDMethod m);
112
113   Char_t                              GetChamberStatus(Int_t det);
114
115   Bool_t                              IsPadMasked(Int_t det, Int_t col, Int_t row);
116   Bool_t                              IsPadBridgedLeft(Int_t det, Int_t col, Int_t row);
117   Bool_t                              IsPadBridgedRight(Int_t det, Int_t col, Int_t row);
118   Bool_t                              IsPadNotConnected(Int_t det, Int_t col, Int_t row);
119   
120   Bool_t                              IsChamberGood(Int_t det);
121   Bool_t                              IsChamberNoData(Int_t det);
122   Bool_t                              IsHalfChamberNoData(Int_t det, Int_t side);
123   Bool_t                              IsChamberBadCalibrated(Int_t det);
124
125   const AliTRDCalMonitoring          *GetMonitoringObject();
126   const AliTRDCalPID                 *GetPIDObject(AliTRDpidUtil::ETRDPIDMethod m);
127   const AliTRDCalTrkAttach           *GetAttachObject();
128
129   // Related functions, these depend on calibration data
130   Int_t                               PadResponse(Double_t signal, Double_t dist
131                                                 , Int_t layer, Double_t *pad) const;
132
133   AliTRDtrapConfig*                   GetTrapConfig();
134   void                                GetTrapConfig(TString &name, TString &version) { name = fTrapConfigName; version = fTrapConfigVersion; }
135   void                                SetTrapConfig(const TString name, const TString version) { fTrapConfigName = name; fTrapConfigVersion = version; }
136   void                                SetTrapConfig(AliTRDtrapConfig *trapcfg) { fTrapConfig = trapcfg; }
137
138  protected:
139
140   AliTRDtrapConfig*                   LoadTrapConfig(const TString &name = "", const TString &version = "");
141
142   // For caching see also implentation of GetCachedCDBObject in the .cxx file
143   enum { kIDVdriftPad = 0
144        , kIDVdriftChamber
145        , kIDExBChamber
146        , kIDT0Pad
147        , kIDT0Chamber
148        , kIDGainFactorPad
149        , kIDGainFactorChamber
150        , kIDOnlineGainFactor
151        , kIDNoiseChamber
152        , kIDNoisePad
153        , kIDPRFWidth
154        , kIDFEE
155        , kIDTrapConfig
156        , kIDChamberPos
157        , kIDStackPos
158        , kIDSuperModulePos
159        , kIDPIDNN
160        , kIDPIDLQ
161        , kIDPIDLQ1D
162        , kIDRecoParam
163        , kIDMonitoringData
164        , kIDChamberStatus
165        , kIDPadStatus
166        , kIDDCS
167        , kIDAttach
168        , kIDPHQ
169        , kCDBCacheSize };         // IDs of cached objects
170
171   const TObject *GetCachedCDBObject(Int_t id);
172   
173   void           Invalidate();
174   void           SamplePRF();
175   
176   AliCDBEntry   *GetCDBEntry(const Char_t *cdbPath);
177   const TObject *CacheCDBEntry(Int_t id, const Char_t *cdbPath);
178
179   static AliTRDcalibDB *fgInstance;                 //  Instance of this class (singleton implementation)
180   static Bool_t         fgTerminated;               //  Defines if this class has already been terminated
181
182   AliCDBEntry          *fCDBEntries[kCDBCacheSize]; //  Cache for CDB entries
183   TObject              *fCDBCache[kCDBCacheSize];   //  Cache for calibration objects.
184
185   Long64_t              fRun;                       //  Run Number
186
187   Float_t              *fPRFsmp;                    //! Sampled pad response
188   Int_t                 fPRFbin;                    //  Number of bins for the PRF
189   Float_t               fPRFlo;                     //  Lower boundary of the PRF
190   Float_t               fPRFhi;                     //  Higher boundary of the PRF
191   Float_t               fPRFwid;                    //  Bin width of the sampled PRF
192   Int_t                 fPRFpad;                    //  Distance to next pad in PRF
193
194   AliTRDPIDResponse    *fPIDResponse;               //  TRD PID Response function
195
196   Int_t                 fOnlineGainTableID;         //  ID for online gain table 
197
198   AliTRDtrapConfig*     fTrapConfig;                //  TRAP configuration
199   TString               fTrapConfigName;            //  name of the TRAPconfig
200   TString               fTrapConfigVersion;         //  version of the TRAPconfig
201   
202  private:
203
204   AliTRDcalibDB();                                  //  This is a singleton, constructor is private!  
205   AliTRDcalibDB(const AliTRDcalibDB &c);   
206   AliTRDcalibDB &operator=(const AliTRDcalibDB &c); 
207   virtual ~AliTRDcalibDB();
208
209   ClassDef(AliTRDcalibDB, 8)                        //  Provides central access to the CDB
210
211 };
212
213 #endif
214