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