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