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