]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDcalibDB.h
Introduce an enumerator for PID methods
[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 ALITRDRECOPARAM_H
19 #include "AliTRDrecoParam.h"
20 #endif
21
22 class AliCDBEntry;
23
24 class AliTRDCalPID;
25 class AliTRDCalMonitoring;
26 class AliTRDCalROC;
27 class AliTRDCalDet;
28 class AliTRDCalSingleChamberStatus;
29
30 class AliTRDcalibDB : public TObject {
31
32  public:
33
34   enum { kNlayer  =   6
35        , kNstack  =   5
36        , kNsector =  18
37        , kNdet    = 540 };
38   
39   static AliTRDcalibDB               *Instance();
40   static void                         Terminate();
41
42   void                                SetRun(Long64_t run);
43   Long64_t                            GetRun() const { return fRun; }
44
45   Float_t                             GetNoise(Int_t det, Int_t col, Int_t row);
46         AliTRDCalROC                 *GetNoiseROC(Int_t det);
47   const AliTRDCalDet                 *GetNoiseDet();
48
49   Float_t                             GetVdrift(Int_t det, Int_t col, Int_t row);
50   Float_t                             GetVdriftAverage(Int_t det);
51         AliTRDCalROC                 *GetVdriftROC(Int_t det);
52   const AliTRDCalDet                 *GetVdriftDet();
53
54   Float_t                             GetT0(Int_t det, Int_t col, Int_t row);
55   Float_t                             GetT0Average(Int_t det);
56         AliTRDCalROC                 *GetT0ROC(Int_t det);
57   const AliTRDCalDet                 *GetT0Det();
58
59   Float_t                             GetGainFactor(Int_t det, Int_t col, Int_t row);
60   Float_t                             GetGainFactorAverage(Int_t det);
61   AliTRDCalROC                       *GetGainFactorROC(Int_t det);
62   const AliTRDCalDet                 *GetGainFactorDet();
63
64   AliTRDCalROC                       *GetPRFROC(Int_t det);
65   Float_t                             GetPRFWidth(Int_t det, Int_t col, Int_t row);
66
67   Float_t*                            GetSampledPRF() { return fPRFsmp; };
68   Int_t                               GetPRFbin()     { return fPRFbin; };
69   Float_t                             GetPRFlo()      { return fPRFlo;  };
70   Float_t                             GetPRFhi()      { return fPRFhi;  };
71
72   Int_t                               GetNumberOfTimeBins();
73
74   Char_t                              GetPadStatus(Int_t det, Int_t col, Int_t row);
75   AliTRDCalSingleChamberStatus       *GetPadStatusROC(Int_t det);
76
77   Char_t                              GetChamberStatus(Int_t det);
78
79   Bool_t                              IsPadMasked(Int_t det, Int_t col, Int_t row);
80   Bool_t                              IsPadBridgedLeft(Int_t det, Int_t col, Int_t row);
81   Bool_t                              IsPadBridgedRight(Int_t det, Int_t col, Int_t row);
82   Bool_t                              IsPadNotConnected(Int_t det, Int_t col, Int_t row);
83   
84   Bool_t                              IsChamberInstalled(Int_t det);
85   Bool_t                              IsChamberMasked(Int_t det);
86
87   const AliTRDCalMonitoring          *GetMonitoringObject();
88   const AliTRDCalPID                 *GetPIDObject(AliTRDrecoParam::AliTRDpidMethod method);
89
90   // Related functions, these depend on calibration data
91   static Float_t                      GetOmegaTau(Float_t vdrift, Float_t bz);
92          Int_t                        PadResponse(Double_t signal, Double_t dist
93                                                 , Int_t layer, Double_t *pad) const;
94   
95  protected:
96
97   // For caching see also implentation of GetCachedCDBObject in the .cxx file
98   enum { kCDBCacheSize = 18 };   // Number of cached objects
99   enum { kIDVdriftPad = 0
100        , kIDVdriftChamber
101        , kIDT0Pad
102        , kIDT0Chamber
103        , kIDGainFactorPad
104        , kIDGainFactorChamber
105        , kIDNoiseChamber
106        , kIDNoisePad
107        , kIDPRFWidth
108        , kIDFEE
109        , kIDChamberPos
110        , kIDStackPos
111        , kIDSuperModulePos
112        , kIDPIDNN
113        , kIDPIDLQ
114        , kIDMonitoringData
115        , kIDChamberStatus
116        , kIDPadStatus };         // IDs of cached objects
117
118   const TObject *GetCachedCDBObject(Int_t id);
119   
120   void           Invalidate();
121   void           SamplePRF();
122   
123   AliCDBEntry   *GetCDBEntry(const Char_t *cdbPath);
124   const TObject *CacheCDBEntry(Int_t id, const Char_t *cdbPath);
125
126   static AliTRDcalibDB *fgInstance;                 //  Instance of this class (singleton implementation)
127   static Bool_t         fgTerminated;               //  Defines if this class has already been terminated
128
129   AliCDBEntry          *fCDBEntries[kCDBCacheSize]; //  Cache for CDB entries
130   TObject              *fCDBCache[kCDBCacheSize];   //  Cache for calibration objects.
131
132   Long64_t              fRun;                       //  Run Number
133   
134   Float_t              *fPRFsmp;                    //! Sampled pad response
135   Int_t                 fPRFbin;                    //  Number of bins for the PRF
136   Float_t               fPRFlo;                     //  Lower boundary of the PRF
137   Float_t               fPRFhi;                     //  Higher boundary of the PRF
138   Float_t               fPRFwid;                    //  Bin width of the sampled PRF
139   Int_t                 fPRFpad;                    //  Distance to next pad in PRF
140   
141  private:
142
143   AliTRDcalibDB();                                  //  This is a singleton, constructor is private!  
144   AliTRDcalibDB(const AliTRDcalibDB &c);   
145   AliTRDcalibDB &operator=(const AliTRDcalibDB &c); 
146   virtual ~AliTRDcalibDB();
147
148   ClassDef(AliTRDcalibDB,3)                         //  Provides central access to the CDB
149
150 };
151
152 #endif