updates for 1/pT correction
[u/mrichter/AliRoot.git] / TPC / Calib / AliTPCPreprocessorOffline.h
CommitLineData
da268e11 1#ifndef ALITPCPREPROCESSOROFFLINE_H
2#define ALITPCPREPROCESSOROFFLINE_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
f12abd89 7//
da268e11 8//
9// Class to create OCDB entries - processing the results of the OFFLINE calibration
f12abd89 10//
11
da268e11 12
13#include "TNamed.h"
14class TObjArray;
15class AliTPCcalibTime;
16class AliTPCcalibTimeGain;
56b51ad9 17class AliTPCcalibGainMult;
da268e11 18class AliTPCROC;
f12abd89 19class AliTPCParam;
20class TPad;
21class AliCDBRunRange;
a9f9c69b 22class AliCDBStorage;
da268e11 23
f12abd89 24class AliTPCPreprocessorOffline:public TNamed {
da268e11 25public:
26 AliTPCPreprocessorOffline();
27 virtual ~AliTPCPreprocessorOffline();
a9f9c69b 28 void UpdateOCDBDrift(Int_t ustartRun, Int_t uendRun, AliCDBStorage* storage);
29 void UpdateOCDBGain(Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* storage);
30 void UpdateDriftParam(AliTPCParam *param, TObjArray *const arr, Int_t lstartRun);
da268e11 31
32 //
33 // v drift part
34 //
40120adc 35 void GetRunRange(AliTPCcalibTime* const timeDrift);
a9f9c69b 36 void CalibTimeVdrift(const Char_t* file, Int_t ustartRun, Int_t uendRun,AliCDBStorage* ocdbStorage=0x0);
40120adc 37 void AddHistoGraphs( TObjArray * vdriftArray, AliTPCcalibTime * const timeDrift, Int_t minEntries);
38 void AddAlignmentGraphs( TObjArray * vdriftArray, AliTPCcalibTime * const timeDrift);
da268e11 39 void AddLaserGraphs( TObjArray * vdriftArray, AliTPCcalibTime *timeDrift);
40 void SetDefaultGraphDrift(TGraph *graph, Int_t color, Int_t style);
40120adc 41 void MakeDefaultPlots(TObjArray * const arr, TObjArray *picArray);
88b09aaa 42 void SetMaxVDriftCorr(Double_t maxVDriftCorr=0.03) {fMaxVdriftCorr=maxVDriftCorr;};
43 Bool_t ValidateTimeDrift();
da268e11 44 //
45 // Gain part
46 //
a9f9c69b 47 void CalibTimeGain(const Char_t* fileName, Int_t startRunNumber, Int_t endRunNumber, AliCDBStorage* ocdbStorage);
40120adc 48 void ReadGainGlobal(const Char_t* fileName="CalibObjectsTrain1.root");
da268e11 49 void MakeQAPlot(Float_t FPtoMIPratio);
50 Bool_t AnalyzeGain(Int_t startRunNumber, Int_t endRunNumber, Int_t minEntriesGaussFit = 500, Float_t FPtoMIPratio = 1.43);
391ffdb2 51 Bool_t AnalyzeAttachment(Int_t startRunNumber, Int_t endRunNumber, Int_t minEntriesFit = 2000);
56b51ad9 52 Bool_t AnalyzePadRegionGain();
d7f71269 53 Bool_t AnalyzeGainDipAngle(Int_t padRegion = 0);
7c7777fc 54 Bool_t AnalyzeGainInclinationAngle(Int_t padRegion = 0);
6d64657a 55 Bool_t AnalyzeGainMultiplicity();
7e3e1a9c 56 Bool_t AnalyzeGainChamberByChamber();
88b09aaa 57 void SetTimeGainRange(Double_t minGain=2.0, Double_t maxGain = 3.0)
58 {fMinGain = minGain; fMaxGain = maxGain;};
59 Bool_t ValidateTimeGain();
da268e11 60 //
f3023796 61 // Alignment time part
62 //
63 void MakeChainTime();
64 void MakePrimitivesTime();
39c42ea2 65 // static void RegisterPrimitiveTimes();
f3023796 66 void CreateAlignTime(TString fstring, TVectorD paramC);
67 void MakeFitTime();
68 static Double_t EvalAt(Double_t phi, Double_t refX, Double_t theta, Int_t corr, Int_t ptype);
39c42ea2 69 static Double_t EvalAtPar(Double_t phi, Double_t snp, Double_t refX, Double_t theta, Int_t corr, Int_t ptype, Int_t nstep);
f3023796 70
3f76dadb 71 // event/track counter related setters and getters
72 Int_t GetNeventsVdrift() const {return fNeventsVdrift;}
73 Int_t GetNtracksVdrift() const {return fNtracksVdrift;}
74 Int_t GetMinEventsVdrift() const {return fMinEventsVdrift;}
75 Int_t GetMinTracksVdrift() const {return fMinTracksVdrift;}
76 void SetMinEventsVdrift(Int_t min) {fMinEventsVdrift=min;}
77 void SetMinTracksVdrift(Int_t min) {fMinTracksVdrift=min;}
78
f3023796 79 //
da268e11 80 // QA drawing part
81 //
82 static void SetPadStyle(TPad *pad, Float_t mx0, Float_t mx1, Float_t my0, Float_t my1);
83 static void PrintArray(TObjArray *array);
f3023796 84 TChain *GetAlignTree(){return fAlignTree;}
da268e11 85 //
86 // graph filtering part
87 //
88 static TGraphErrors* FilterGraphMedianAbs(TGraphErrors * graph, Float_t cut,Double_t &medianY);
89 static TGraphErrors* FilterGraphDrift(TGraphErrors * graph, Float_t errSigmaCut, Float_t medianCutAbs);
90 static TGraphErrors * MakeGraphFilter0(THnSparse *hisN, Int_t itime, Int_t ival, Int_t minEntries, Double_t offset=0);
91
68d461b2 92 //
93 void SwitchOnValidation(Bool_t val = kTRUE) {fSwitchOnValidation = val;}
94 Bool_t IsSwitchOnValidation() { return fSwitchOnValidation; }
95
3f76dadb 96 //
97 Int_t GetStatus();
98 enum ECalibStatusBit { kCalibFailedTimeDrift =0x0001,
99 kCalibFailedTimeGain =0x0002 };
100
40120adc 101private:
102 Int_t fMinEntries; // minimal number of entries for fit
a9f9c69b 103 Int_t fStartRun; // start Run - used to make fast selection in THnSparse
104 Int_t fEndRun; // end Run - used to make fast selection in THnSparse
105 Int_t fStartTime; // fStartTime - used to make fast selection in THnSparse
106 Int_t fEndTime; // fEndTime - used to make fast selection in THnSparse
107 AliCDBStorage* fOCDBstorage; // OCDB storage
40120adc 108 TObjArray * fVdriftArray; // array with output calibration graphs
109 AliTPCcalibTime * fTimeDrift; // input data to construct calibration graphs
da268e11 110 TGraphErrors * fGraphMIP; // graph time dependence of MIP
111 TGraphErrors * fGraphCosmic; // graph time dependence at Plateu
391ffdb2 112 TGraphErrors * fGraphAttachmentMIP; // graph time dependence of attachment (signal vs. mean driftlength)
da268e11 113 AliSplineFit * fFitMIP; // fit of dependence - MIP
114 AliSplineFit * fFitCosmic; // fit of dependence - Plateu
115 TObjArray * fGainArray; // array to be stored in the OCDB
116 AliTPCcalibTimeGain * fGainMIP; // calibration component for MIP
117 AliTPCcalibTimeGain * fGainCosmic; // calibration component for cosmic
56b51ad9 118 AliTPCcalibGainMult * fGainMult; // calibration component for pad region gain equalization and multiplicity dependence
f3023796 119
120 TChain *fAlignTree; //alignment tree
121 //
68d461b2 122 Bool_t fSwitchOnValidation; // flag to switch on validation of OCDB parameters
88b09aaa 123 Float_t fMinGain; // min gain
124 Float_t fMaxGain; // max gain
125 Float_t fMaxVdriftCorr; // max v-drift correction
3f76dadb 126 Int_t fNtracksVdrift; // n tracks used for v drift determination
127 Int_t fMinTracksVdrift; // minimum numner of tracks for v drift determination
128 Int_t fNeventsVdrift; // number of events used for drift calibration
129 Int_t fMinEventsVdrift; // minimum number of events used for drift calibration
130
131 Int_t fCalibrationStatus; // status of calibration, each set bit signifies a failure in a component (see ECalibStatusBit)
da268e11 132
133private:
f12abd89 134 AliTPCPreprocessorOffline& operator=(const AliTPCPreprocessorOffline&); // not implemented
135 AliTPCPreprocessorOffline(const AliTPCPreprocessorOffline&); // not implemented
da268e11 136 ClassDef(AliTPCPreprocessorOffline,1)
137};
138
139#endif