]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/Calib/AliTPCPreprocessorOffline.h
Fix for coverity (AdC)
[u/mrichter/AliRoot.git] / TPC / Calib / 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 AnalyzeGainDipAngle(Int_t padRegion = 0);
54   Bool_t AnalyzeGainMultiplicity();
55   Bool_t AnalyzeGainChamberByChamber();
56   void SetTimeGainRange(Double_t minGain=2.0, Double_t maxGain = 3.0) 
57        {fMinGain = minGain; fMaxGain = maxGain;};
58   Bool_t ValidateTimeGain();
59   //
60   // Alignment time part
61   //
62   void  MakeChainTime();
63   void  MakePrimitivesTime();
64   //  static void RegisterPrimitiveTimes();
65   void  CreateAlignTime(TString fstring, TVectorD paramC);  
66   void  MakeFitTime();
67   static Double_t EvalAt(Double_t phi, Double_t refX, Double_t theta, Int_t corr, Int_t ptype);
68   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);
69
70   // event/track counter related setters and getters
71   Int_t GetNeventsVdrift() const {return fNeventsVdrift;}
72   Int_t GetNtracksVdrift() const {return fNtracksVdrift;}
73   Int_t GetMinEventsVdrift() const {return fMinEventsVdrift;}
74   Int_t GetMinTracksVdrift() const {return fMinTracksVdrift;}
75   void SetMinEventsVdrift(Int_t min) {fMinEventsVdrift=min;}
76   void SetMinTracksVdrift(Int_t min) {fMinTracksVdrift=min;}
77
78   //
79   // QA drawing part
80   //
81   static void SetPadStyle(TPad *pad, Float_t mx0, Float_t mx1, Float_t my0, Float_t my1);
82   static void PrintArray(TObjArray *array);
83   TChain *GetAlignTree(){return fAlignTree;}
84   //
85   // graph filtering part
86   //
87   static TGraphErrors* FilterGraphMedianAbs(TGraphErrors * graph, Float_t cut,Double_t &medianY);
88   static TGraphErrors* FilterGraphDrift(TGraphErrors * graph, Float_t errSigmaCut, Float_t medianCutAbs);
89   static TGraphErrors * MakeGraphFilter0(THnSparse *hisN, Int_t itime, Int_t ival, Int_t minEntries, Double_t offset=0);
90
91   //
92   void SwitchOnValidation(Bool_t val = kTRUE) {fSwitchOnValidation = val;} 
93   Bool_t IsSwitchOnValidation() { return fSwitchOnValidation; } 
94
95   //
96   Int_t GetStatus();
97   enum ECalibStatusBit { kCalibFailedTimeDrift =0x0001,
98                          kCalibFailedTimeGain  =0x0002 };
99
100 private:
101   Int_t fMinEntries;                      // minimal number of entries for fit
102   Int_t fStartRun;                         // start Run - used to make fast selection in THnSparse
103   Int_t fEndRun;                           // end   Run - used to make fast selection in THnSparse
104   Int_t fStartTime;                        // fStartTime - used to make fast selection in THnSparse
105   Int_t fEndTime;                          // fEndTime   - used to make fast selection in THnSparse
106   AliCDBStorage*  fOCDBstorage;            // OCDB storage
107   TObjArray * fVdriftArray;               // array with output calibration graphs
108   AliTPCcalibTime * fTimeDrift;           // input data to construct calibration graphs
109   TGraphErrors * fGraphMIP;                // graph time dependence of MIP
110   TGraphErrors * fGraphCosmic;             // graph time dependence at Plateu
111   TGraphErrors * fGraphAttachmentMIP;      // graph time dependence of attachment (signal vs. mean driftlength)
112   AliSplineFit * fFitMIP;                  // fit of dependence - MIP
113   AliSplineFit * fFitCosmic;               // fit of dependence - Plateu
114   TObjArray    * fGainArray;               // array to be stored in the OCDB
115   AliTPCcalibTimeGain * fGainMIP;          // calibration component for MIP
116   AliTPCcalibTimeGain * fGainCosmic;       // calibration component for cosmic
117   AliTPCcalibGainMult * fGainMult;         // calibration component for pad region gain equalization and multiplicity dependence
118
119   TChain   *fAlignTree;        //alignment tree
120   //
121   Bool_t fSwitchOnValidation;  // flag to switch on validation of OCDB parameters
122   Float_t fMinGain;            // min gain
123   Float_t fMaxGain;            // max gain
124   Float_t fMaxVdriftCorr;      // max v-drift correction
125   Int_t fNtracksVdrift;           // n tracks used for v drift determination
126   Int_t fMinTracksVdrift;         // minimum numner of tracks for v drift determination
127   Int_t fNeventsVdrift;           // number of events used for drift calibration
128   Int_t fMinEventsVdrift;         // minimum number of events used for drift calibration
129
130   Int_t fCalibrationStatus;       // status of calibration, each set bit signifies a failure in a component (see ECalibStatusBit)
131
132 private:
133   AliTPCPreprocessorOffline& operator=(const AliTPCPreprocessorOffline&); // not implemented
134   AliTPCPreprocessorOffline(const AliTPCPreprocessorOffline&); // not implemented
135   ClassDef(AliTPCPreprocessorOffline,1)
136 };
137
138 #endif