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