Fixed warnings
[u/mrichter/AliRoot.git] / TPC / AliTPCcalibDB.h
CommitLineData
c5bbaa2c 1#ifndef ALITPCCALIBDB_H
2#define ALITPCCALIBDB_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
418bbcaf 13class AliTPCTransform;
14class AliTPCExB;
c5bbaa2c 15#include "TObject.h"
bf85fe4d 16#include "TObjArray.h"
17#include "TArrayI.h"
18#include "TVectorD.h"
5312f439 19#include "TGraph.h"
20#include "AliTPCCalPad.h"
21#include "TString.h"
7390f655 22#include "AliSplineFit.h"
bf85fe4d 23
54472e4f 24class AliTPCSensorTempArray;
e7e39fb5 25class AliDCSSensorArray;
c5bbaa2c 26class AliCDBEntry;
8477f500 27class AliTPCParam;
d6834f5f 28class AliTPCAltroMapping;
96305e49 29class AliTPCClusterParam;
bf85fe4d 30class AliDCSSensor;
31class AliDCSSensorArray;
da6c0bc9 32class AliTPCCalibVdrift;
8de77f00 33class AliGRPObject;
6e7d7dc4 34class AliTPCCalibRaw;
949d8707 35class AliTPCdataQA;
0231c65f 36class TMap;
0a997b33 37class AliMagF;
1e722a63 38class AliTPCcalibDButil;
f14d21a1 39class AliCTPTimeParams;
68751c2c 40//class AliCDBStorage;
c5bbaa2c 41
42class AliTPCcalibDB : public TObject
43{
44 public:
45 static AliTPCcalibDB* Instance();
46 AliTPCcalibDB();
47 virtual ~AliTPCcalibDB();
48 static void Terminate();
49 void SetRun(Long64_t run);
5e1215d4 50 void Update(); //update entries
51 void UpdateRunInformations(Int_t run, Bool_t force=kFALSE);
56ce896d 52 void UpdateNonRec();
5e1215d4 53 //
5312f439 54 Long64_t GetRun() const {return fRun;}
5e1215d4 55 //
56 //
c5bbaa2c 57 //
f5344549 58 AliTPCTransform* GetTransform() {return fTransform;}
3ac615eb 59 AliTPCExB* GetExB() {return fExB;}
f4d5fd21 60 void SetExBField(Float_t bz);
0a997b33 61 void SetExBField( const AliMagF* bmap);
3ac615eb 62 static AliTPCExB* GetExB(Float_t bz,Bool_t bdelete);
54472e4f 63 AliTPCCalPad* GetPadGainFactor() {return fPadGainFactor;}
9f6e9f81 64 AliTPCCalPad* GetDedxGainFactor() {return fDedxGainFactor;}
54472e4f 65 AliTPCCalPad* GetPadTime0() {return fPadTime0;}
2293155b 66 AliTPCCalPad* GetDistortionMap(Int_t i) {return (fDistortionMap) ? (AliTPCCalPad*)fDistortionMap->At(i):0;}
54472e4f 67 AliTPCCalPad* GetPadNoise() {return fPadNoise;}
68 AliTPCCalPad* GetPedestals() {return fPedestals;}
5312f439 69 //ALTRO config data
70 TObjArray* GetAltroConfigData() const {return fALTROConfigData;}
71 AliTPCCalPad* GetALTROAcqStart() const {return fALTROConfigData?static_cast<AliTPCCalPad*>(fALTROConfigData->FindObject("AcqStart")):0;}
72 AliTPCCalPad* GetALTROZsThr() const {return fALTROConfigData?static_cast<AliTPCCalPad*>(fALTROConfigData->FindObject("ZsThr")):0;}
73 AliTPCCalPad* GetALTROFPED() const {return fALTROConfigData?static_cast<AliTPCCalPad*>(fALTROConfigData->FindObject("FPED")):0;}
74 AliTPCCalPad* GetALTROAcqStop() const {return fALTROConfigData?static_cast<AliTPCCalPad*>(fALTROConfigData->FindObject("AcqStop")):0;}
75 AliTPCCalPad* GetALTROMasked() const {return fALTROConfigData?static_cast<AliTPCCalPad*>(fALTROConfigData->FindObject("Masked")):0;}
f14d21a1 76 TMap* GetRCUconfig() const {return fALTROConfigData?(TMap*)(fALTROConfigData->FindObject("RCUconfig")):0;}
77 Int_t GetRCUTriggerConfig() const;
78 Bool_t IsTrgL0();
79 Bool_t IsTrgL1();
80
81
5312f439 82 //Pulser data
83 TObjArray* GetPulserData() const {return fPulserData;}
84 AliTPCCalPad* GetPulserTmean() const {return fPulserData?static_cast<AliTPCCalPad*>(fPulserData->FindObject("PulserTmean")):0;}
85 AliTPCCalPad* GetPulserTrms() const {return fPulserData?static_cast<AliTPCCalPad*>(fPulserData->FindObject("PulserTrms")):0;}
86 AliTPCCalPad* GetPulserQmean() const {return fPulserData?static_cast<AliTPCCalPad*>(fPulserData->FindObject("PulserQmean")):0;}
6e7d7dc4 87 //CE data
5312f439 88 TObjArray* GetCEData() const {return fCEData;}
89 AliTPCCalPad* GetCETmean() const {return fCEData?static_cast<AliTPCCalPad*>(fCEData->FindObject("CETmean")):0;}
90 AliTPCCalPad* GetCETrms() const {return fCEData?static_cast<AliTPCCalPad*>(fCEData->FindObject("CETrms")):0;}
91 AliTPCCalPad* GetCEQmean() const {return fCEData?static_cast<AliTPCCalPad*>(fCEData->FindObject("CEQmean")):0;}
92 TObjArray* GetCErocTtime() const {return fCEData?static_cast<TObjArray*>(fCEData->FindObject("rocTtime")):0;}
93 TObjArray* GetCErocQtime() const {return fCEData?static_cast<TObjArray*>(fCEData->FindObject("rocQtime")):0;}
94 TGraph* GetCErocTgraph(const Int_t roc)const {return GetCErocTtime()?static_cast<TGraph*>(GetCErocTtime()->At(roc)):0;}
95 TGraph* GetCErocQgraph(const Int_t roc)const {return GetCErocQtime()?static_cast<TGraph*>(GetCErocQtime()->At(roc)):0;}
892226be 96 static Float_t GetCEdriftTime(Int_t run, Int_t sector, Double_t timeStamp=-1., Int_t *entries=0);
97 static Float_t GetCEchargeTime(Int_t run, Int_t sector, Double_t timeStamp=-1., Int_t *entries=0);
6e7d7dc4 98 //Raw calibration
99 AliTPCCalibRaw* GetCalibRaw() const {return fCalibRaw;}
949d8707 100 //QA object
101 AliTPCdataQA* GetDataQA() const {return fDataQA;}
6e7d7dc4 102 //
54472e4f 103 AliTPCSensorTempArray* GetTemperature() {return fTemperature;}
104 AliTPCParam* GetParameters(){return fParam;}
d6834f5f 105 AliTPCAltroMapping ** GetMapping(){ return fMapping;}
96305e49 106 AliTPCClusterParam *GetClusterParam(){ return fClusterParam;}
3af3fbc4 107 TObjArray *GetTimeGainSplines(){ return fTimeGainSplines;}
d6834f5f 108 //
5312f439 109 //GRP information
8de77f00 110 static AliGRPObject * GetGRP(Int_t run);
0231c65f 111 static TMap * GetGRPMap(Int_t run);
da6c0bc9 112 static Float_t GetPressure(Int_t timeStamp, Int_t run, Int_t type=0);
5312f439 113 static Float_t GetL3Current(Int_t run, Int_t statType=0);
114 static Float_t GetBz(Int_t run);
115 static Char_t GetL3Polarity(Int_t run);
116 static TString GetRunType(Int_t run);
117 //
7fff7612 118 static Float_t GetDCSSensorValue(AliDCSSensorArray *arr, Int_t timeStamp, const char * sensorName, Int_t sigDigits=-1);
119 static Float_t GetDCSSensorMeanValue(AliDCSSensorArray *arr, const char * sensorName, Int_t sigDigits=-1);
5312f439 120 //Voltage information
7fff7612 121 static Float_t GetChamberHighVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0);
122 static Float_t GetSkirtVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0);
123 static Float_t GetCoverVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0);
124 static Float_t GetGGoffsetVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0);
125 static Float_t GetGGnegVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0);
126 static Float_t GetGGposVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0);
5312f439 127 //Goofie Values
7f7847fe 128 static Float_t GetValueGoofie(Int_t timeStamp, Int_t run, Int_t type);
5312f439 129 //
64b48395 130 static Bool_t GetTemperatureFit(Int_t timeStamp, Int_t run, Int_t side,TVectorD& fit);
131 static Float_t GetTemperature(Int_t timeStamp, Int_t run, Int_t side);
da6c0bc9 132 static Double_t GetPTRelative(UInt_t timeSec, Int_t run, Int_t side);
133 AliDCSSensor * GetPressureSensor(Int_t run, Int_t type=0);
e2914767 134 //AliDCSSensor * GetVoltageSensor(Int_t run, Int_t type=0);
bf85fe4d 135 AliTPCSensorTempArray * GetTemperatureSensor(Int_t run);
136 AliDCSSensorArray * GetGoofieSensors(Int_t run);
e2914767 137 AliDCSSensorArray * GetVoltageSensors(Int_t run);
da6c0bc9 138 AliTPCCalibVdrift * GetVdrift(Int_t run);
43a74775 139 TObjArray * GetTimeGainSplinesRun(Int_t run);
7390f655 140 TObjArray* GetTimeVdriftSplineRun(Int_t run);
bf85fe4d 141 static Float_t GetGain(Int_t sector, Int_t row, Int_t pad);
142 //
17c90083 143 Double_t GetVDriftCorrectionTime(Int_t timeStamp, Int_t run, Int_t side, Int_t mode);
144 Double_t GetTime0CorrectionTime(Int_t timeStamp, Int_t run, Int_t side, Int_t mode);
145 Double_t GetVDriftCorrectionGy(Int_t timeStamp, Int_t run, Int_t side, Int_t mode);
146 //
7390f655 147 AliSplineFit* GetVdriftSplineFit(const char* name, Int_t run);
2cb269df 148 AliSplineFit* CreateVdriftSplineFit(const char* graphName, Int_t run);
7390f655 149 //
86df2b3a 150 static void CreateObjectList(const Char_t *filename, TObjArray *calibObjects);
151 static void MakeTree(const char * fileName, TObjArray * array, const char * mapFileName = 0, AliTPCCalPad* outlierPad = 0, Float_t ltmFraction = 0.9);
3ac615eb 152 static void RegisterExB(Int_t index, Float_t bz, Bool_t bdelete);
c5bbaa2c 153 //
bf85fe4d 154 //
f14d21a1 155
f6b5fa33 156 AliTPCCalPad* MakeDeadMap(const char *nameMappingFile="$ALICE_ROOT/TPC/Calib/tpcMapping.root");
e2914767 157 AliGRPObject * MakeGRPObjectFromMap(TMap *map);
f14d21a1 158 AliCTPTimeParams* GetCTPTimeParams() const {return fCTPTimeParams;}
5312f439 159 //Create a tree suited for diplaying with the AliTPCCalibViewerGUI
949d8707 160 Bool_t CreateGUITree(const char* filename="");
5312f439 161 static Bool_t CreateGUITree(Int_t run, const char* filename="");
7390f655 162 static Bool_t CreateRefFile(Int_t run, const char* filename="");
bf85fe4d 163 //
c5bbaa2c 164protected:
e2914767 165
c5bbaa2c 166 AliCDBEntry* GetCDBEntry(const char* cdbPath);
481f877b 167 Long64_t fRun; // current run number
f5344549 168 AliTPCTransform *fTransform; // object responsible for spacial corrections
418bbcaf 169 AliTPCExB *fExB; // ExB correction factor
68751c2c 170// AliCDBStorage* fLocator; // Storage locator retrieved from AliCDBManager
c5bbaa2c 171 //
172 // calibration parameters per pad
173 //
418bbcaf 174 AliTPCCalPad* fPadGainFactor; // Gain calibration entry
9f6e9f81 175 AliTPCCalPad* fDedxGainFactor; // Gain calibration entry - for dEdx
418bbcaf 176 AliTPCCalPad* fPadTime0; // Time0 calibration entry
2293155b 177 TObjArray *fDistortionMap; // distortion map
418bbcaf 178 AliTPCCalPad* fPadNoise; // Noise calibration entry
179 AliTPCCalPad* fPedestals; // Pedestal calibration entry
6e7d7dc4 180 AliTPCCalibRaw *fCalibRaw; // raw data calibration entry
949d8707 181 AliTPCdataQA *fDataQA; // qa object
5312f439 182 TObjArray *fALTROConfigData; // ALTRO configuration data
183 TObjArray *fPulserData; // Calibration Pulser data
184 TObjArray *fCEData; // CE data
185 //
949d8707 186 //
187 //
188 //
418bbcaf 189 AliTPCSensorTempArray* fTemperature; // Temperature calibration entry
d6834f5f 190 AliTPCAltroMapping **fMapping; // Altro mapping
8477f500 191 //
192 //
418bbcaf 193 AliTPCParam * fParam; // TPC parameters
96305e49 194 AliTPCClusterParam * fClusterParam; // TPC cluster error, shape and Q parameterization
3af3fbc4 195 TObjArray * fTimeGainSplines; // Array of AliSplineFits: at 0 MIP position in time ; at 1 Fermi Plateau from cosmics
c5bbaa2c 196 //
bf85fe4d 197 // Get the corssrun information
198 //
a2c3785e 199 TObjArray fTimeGainSplinesArray; //! array Array of AliSplineFits: at 0 MIP position in time ; at 1 Fermi Plateau from cosmics
200 TObjArray fGRPArray; //! array of GRPs - per run
201 TObjArray fGRPMaps; //! array of GRPs maps - per run - old data
202 TObjArray fGoofieArray; //! array of GOOFIE values -per run
203 TObjArray fVoltageArray; //! array of Chamber HV values -per run
204 TObjArray fTemperatureArray; //! array of temperature sensors - per run
205 TObjArray fVdriftArray; //! array of v drift interfaces
5e1215d4 206 TObjArray fDriftCorrectionArray; //! array of drift correction
207
a2c3785e 208 TArrayI fRunList; //! run list - indicates try to get the run param
bf85fe4d 209 //
418bbcaf 210 static AliTPCcalibDB* fgInstance; // singleton control
211 static Bool_t fgTerminated; // termination control
3ac615eb 212 static TObjArray fgExBArray; // array of ExB corrections
1e722a63 213 AliTPCcalibDButil *fDButil; // utility class
f14d21a1 214 //ctp info
215 AliCTPTimeParams *fCTPTimeParams; //CTP timing parameters
216
c5bbaa2c 217 ClassDef(AliTPCcalibDB, 0)
e4dce695 218 private:
f4a89669 219 AliTPCcalibDB (const AliTPCcalibDB& );
220 AliTPCcalibDB& operator= (const AliTPCcalibDB& );
c5bbaa2c 221};
222
223
224#endif