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