]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCPreprocessorOffline.h
Tree chaching implemented and update of merging of trees
[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 class AliCDBStorage;
23
24 class AliTPCPreprocessorOffline:public TNamed { 
25 public:
26   AliTPCPreprocessorOffline();
27   virtual ~AliTPCPreprocessorOffline();
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);
31
32   //
33   // v drift part
34   //
35   void GetRunRange(AliTPCcalibTime* const timeDrift);
36   void CalibTimeVdrift(const Char_t* file, Int_t ustartRun, Int_t uendRun,AliCDBStorage* ocdbStorage=0x0);
37   void AddHistoGraphs(  TObjArray * vdriftArray, AliTPCcalibTime * const timeDrift, Int_t minEntries);
38   void AddAlignmentGraphs(  TObjArray * vdriftArray, AliTPCcalibTime * const timeDrift);
39   void AddLaserGraphs(  TObjArray * vdriftArray, AliTPCcalibTime *timeDrift);
40   void SetDefaultGraphDrift(TGraph *graph, Int_t color, Int_t style);
41   void MakeDefaultPlots(TObjArray * const arr, TObjArray *picArray);
42   void SetMaxVDriftCorr(Double_t maxVDriftCorr=0.03) {fMaxVdriftCorr=maxVDriftCorr;};
43   Bool_t ValidateTimeDrift();
44   //
45   // Gain part
46   //
47   void CalibTimeGain(const Char_t* fileName, Int_t startRunNumber, Int_t endRunNumber,  AliCDBStorage* ocdbStorage);
48   void ReadGainGlobal(const Char_t* fileName="CalibObjectsTrain1.root");
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); 
51   Bool_t AnalyzeAttachment(Int_t startRunNumber, Int_t endRunNumber, Int_t minEntriesFit = 2000);
52   Bool_t AnalyzePadRegionGain();
53   Bool_t AnalyzeGainMultiplicity();
54   Bool_t AnalyzeGainChamberByChamber();
55   void SetTimeGainRange(Double_t minGain=2.0, Double_t maxGain = 3.0) 
56        {fMinGain = minGain; fMaxGain = maxGain;};
57   Bool_t ValidateTimeGain();
58   //
59   // Alignment time part
60   //
61   void  MakeChainTime();
62   void  MakePrimitivesTime();
63   //  static void RegisterPrimitiveTimes();
64   void  CreateAlignTime(TString fstring, TVectorD paramC);  
65   void  MakeFitTime();
66   static Double_t EvalAt(Double_t phi, Double_t refX, Double_t theta, Int_t corr, Int_t ptype);
67   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);
68
69   // event/track counter related setters and getters
70   Int_t GetNeventsVdrift() const {return fNeventsVdrift;}
71   Int_t GetNtracksVdrift() const {return fNtracksVdrift;}
72   Int_t GetMinEventsVdrift() const {return fMinEventsVdrift;}
73   Int_t GetMinTracksVdrift() const {return fMinTracksVdrift;}
74   void SetMinEventsVdrift(Int_t min) {fMinEventsVdrift=min;}
75   void SetMinTracksVdrift(Int_t min) {fMinTracksVdrift=min;}
76
77   //
78   // QA drawing part
79   //
80   static void SetPadStyle(TPad *pad, Float_t mx0, Float_t mx1, Float_t my0, Float_t my1);
81   static void PrintArray(TObjArray *array);
82   TChain *GetAlignTree(){return fAlignTree;}
83   //
84   // graph filtering part
85   //
86   static TGraphErrors* FilterGraphMedianAbs(TGraphErrors * graph, Float_t cut,Double_t &medianY);
87   static TGraphErrors* FilterGraphDrift(TGraphErrors * graph, Float_t errSigmaCut, Float_t medianCutAbs);
88   static TGraphErrors * MakeGraphFilter0(THnSparse *hisN, Int_t itime, Int_t ival, Int_t minEntries, Double_t offset=0);
89
90   //
91   void SwitchOnValidation(Bool_t val = kTRUE) {fSwitchOnValidation = val;} 
92   Bool_t IsSwitchOnValidation() { return fSwitchOnValidation; } 
93
94   //
95   Int_t GetStatus();
96   enum ECalibStatusBit { kCalibFailedTimeDrift =0x0001,
97                          kCalibFailedTimeGain  =0x0002 };
98
99 private:
100   Int_t fMinEntries;                      // minimal number of entries for fit
101   Int_t fStartRun;                         // start Run - used to make fast selection in THnSparse
102   Int_t fEndRun;                           // end   Run - used to make fast selection in THnSparse
103   Int_t fStartTime;                        // fStartTime - used to make fast selection in THnSparse
104   Int_t fEndTime;                          // fEndTime   - used to make fast selection in THnSparse
105   AliCDBStorage*  fOCDBstorage;            // OCDB storage
106   TObjArray * fVdriftArray;               // array with output calibration graphs
107   AliTPCcalibTime * fTimeDrift;           // input data to construct calibration graphs
108   TGraphErrors * fGraphMIP;                // graph time dependence of MIP
109   TGraphErrors * fGraphCosmic;             // graph time dependence at Plateu
110   TGraphErrors * fGraphAttachmentMIP;      // graph time dependence of attachment (signal vs. mean driftlength)
111   AliSplineFit * fFitMIP;                  // fit of dependence - MIP
112   AliSplineFit * fFitCosmic;               // fit of dependence - Plateu
113   TObjArray    * fGainArray;               // array to be stored in the OCDB
114   AliTPCcalibTimeGain * fGainMIP;          // calibration component for MIP
115   AliTPCcalibTimeGain * fGainCosmic;       // calibration component for cosmic
116   AliTPCcalibGainMult * fGainMult;         // calibration component for pad region gain equalization and multiplicity dependence
117
118   TChain   *fAlignTree;        //alignment tree
119   //
120   Bool_t fSwitchOnValidation;  // flag to switch on validation of OCDB parameters
121   Float_t fMinGain;            // min gain
122   Float_t fMaxGain;            // max gain
123   Float_t fMaxVdriftCorr;      // max v-drift correction
124   Int_t fNtracksVdrift;           // n tracks used for v drift determination
125   Int_t fMinTracksVdrift;         // minimum numner of tracks for v drift determination
126   Int_t fNeventsVdrift;           // number of events used for drift calibration
127   Int_t fMinEventsVdrift;         // minimum number of events used for drift calibration
128
129   Int_t fCalibrationStatus;       // status of calibration, each set bit signifies a failure in a component (see ECalibStatusBit)
130
131 private:
132   AliTPCPreprocessorOffline& operator=(const AliTPCPreprocessorOffline&); // not implemented
133   AliTPCPreprocessorOffline(const AliTPCPreprocessorOffline&); // not implemented
134   ClassDef(AliTPCPreprocessorOffline,1)
135 };
136
137 #endif