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