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