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