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