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