]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCPreprocessorOffline.h
config time calib
[u/mrichter/AliRoot.git] / TPC / AliTPCPreprocessorOffline.h
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
7 //
8 //
9 //    Class to create OCDB entries - processing the results of the OFFLINE calibration
10 //
11
12
13 #include "TNamed.h"
14 class TObjArray;
15 class AliTPCcalibTime;
16 class AliTPCcalibTimeGain;
17 class AliTPCcalibGainMult;
18 class AliTPCROC;
19 class AliTPCParam;
20 class TPad;
21 class AliCDBRunRange;
22
23 class AliTPCPreprocessorOffline:public TNamed { 
24 public:
25   AliTPCPreprocessorOffline();
26   virtual ~AliTPCPreprocessorOffline();
27   void UpdateOCDBDrift(Int_t ustartRun, Int_t uendRun, const char* storagePath);
28   void UpdateOCDBGain(Int_t  startRunNumber, Int_t endRunNumber, const char* storagePath);
29   void UpdateDriftParam(AliTPCParam *param, TObjArray *const arr, Int_t startRun);
30
31   //
32   // v drift part
33   //
34   void GetRunRange(AliTPCcalibTime* const timeDrift);
35   void CalibTimeVdrift(const Char_t* file, Int_t ustartRun, Int_t uendRun,TString ocdbStorage="");
36   void AddHistoGraphs(  TObjArray * vdriftArray, AliTPCcalibTime * const timeDrift, Int_t minEntries);
37   void AddAlignmentGraphs(  TObjArray * vdriftArray, AliTPCcalibTime * const timeDrift);
38   void AddLaserGraphs(  TObjArray * vdriftArray, AliTPCcalibTime *timeDrift);
39   void SetDefaultGraphDrift(TGraph *graph, Int_t color, Int_t style);
40   void MakeDefaultPlots(TObjArray * const arr, TObjArray *picArray);
41   void SetMaxVDriftCorr(Double_t maxVDriftCorr=0.03) {fMaxVdriftCorr=maxVDriftCorr;};
42   Bool_t ValidateTimeDrift();
43   //
44   // Gain part
45   //
46   void CalibTimeGain(const Char_t* fileName, Int_t startRunNumber, Int_t endRunNumber,  TString  ocdbStorage);
47   void ReadGainGlobal(const Char_t* fileName="CalibObjectsTrain1.root");
48   void MakeQAPlot(Float_t  FPtoMIPratio);
49   Bool_t AnalyzeGain(Int_t startRunNumber, Int_t endRunNumber, Int_t minEntriesGaussFit = 500, Float_t FPtoMIPratio = 1.43); 
50   Bool_t AnalyzeAttachment(Int_t startRunNumber, Int_t endRunNumber, Int_t minEntriesFit = 2000);
51   Bool_t AnalyzePadRegionGain();
52   Bool_t AnalyzeGainMultiplicity();
53   Bool_t AnalyzeGainChamberByChamber();
54   void SetTimeGainRange(Double_t minGain=2.0, Double_t maxGain = 3.0) 
55        {fMinGain = minGain; fMaxGain = maxGain;};
56   Bool_t ValidateTimeGain();
57   //
58   // Alignment time part
59   //
60   void  MakeChainTime();
61   void  MakePrimitivesTime();
62   //  static void RegisterPrimitiveTimes();
63   void  CreateAlignTime(TString fstring, TVectorD paramC);  
64   void  MakeFitTime();
65   static Double_t EvalAt(Double_t phi, Double_t refX, Double_t theta, Int_t corr, Int_t ptype);
66   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);
67
68   //
69   // QA drawing part
70   //
71   static void SetPadStyle(TPad *pad, Float_t mx0, Float_t mx1, Float_t my0, Float_t my1);
72   static void PrintArray(TObjArray *array);
73   TChain *GetAlignTree(){return fAlignTree;}
74   //
75   // graph filtering part
76   //
77   static TGraphErrors* FilterGraphMedianAbs(TGraphErrors * graph, Float_t cut,Double_t &medianY);
78   static TGraphErrors* FilterGraphDrift(TGraphErrors * graph, Float_t errSigmaCut, Float_t medianCutAbs);
79   static TGraphErrors * MakeGraphFilter0(THnSparse *hisN, Int_t itime, Int_t ival, Int_t minEntries, Double_t offset=0);
80
81   //
82   void SwitchOnValidation(Bool_t val = kTRUE) {fSwitchOnValidation = val;} 
83   Bool_t IsSwitchOnValidation() { return fSwitchOnValidation; } 
84
85 private:
86   Int_t fMinEntries;                      // minimal number of entries for fit
87   Int_t startRun;                         // start Run - used to make fast selection in THnSparse
88   Int_t endRun;                           // end   Run - used to make fast selection in THnSparse
89   Int_t startTime;                        // startTime - used to make fast selection in THnSparse
90   Int_t endTime;                          // endTime   - used to make fast selection in THnSparse
91   TString  ocdbStorage;                   // path to the OCDB storage
92   TObjArray * fVdriftArray;               // array with output calibration graphs
93   AliTPCcalibTime * fTimeDrift;           // input data to construct calibration graphs
94   TGraphErrors * fGraphMIP;                // graph time dependence of MIP
95   TGraphErrors * fGraphCosmic;             // graph time dependence at Plateu
96   TGraphErrors * fGraphAttachmentMIP;      // graph time dependence of attachment (signal vs. mean driftlength)
97   AliSplineFit * fFitMIP;                  // fit of dependence - MIP
98   AliSplineFit * fFitCosmic;               // fit of dependence - Plateu
99   TObjArray    * fGainArray;               // array to be stored in the OCDB
100   AliTPCcalibTimeGain * fGainMIP;          // calibration component for MIP
101   AliTPCcalibTimeGain * fGainCosmic;       // calibration component for cosmic
102   AliTPCcalibGainMult * fGainMult;         // calibration component for pad region gain equalization and multiplicity dependence
103
104   TChain   *fAlignTree;        //alignment tree
105   //
106   Bool_t fSwitchOnValidation;  // flag to switch on validation of OCDB parameters
107   Float_t fMinGain;            // min gain
108   Float_t fMaxGain;            // max gain
109   Float_t fMaxVdriftCorr;      // max v-drift correction
110
111 private:
112   AliTPCPreprocessorOffline& operator=(const AliTPCPreprocessorOffline&); // not implemented
113   AliTPCPreprocessorOffline(const AliTPCPreprocessorOffline&); // not implemented
114   ClassDef(AliTPCPreprocessorOffline,1)
115 };
116
117 #endif