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