LCOV - code coverage report
Current view: top level - TPC/TPCcalib - AliTPCPreprocessorOffline.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 19 5.3 %
Date: 2016-06-14 17:26:59 Functions: 1 23 4.3 %

          Line data    Source code
       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             : #include "TVectorD.h"
      15             : 
      16             : class TObjArray;
      17             : class THnSparse;
      18             : class TChain;
      19             : 
      20             : class AliTPCcalibTime;
      21             : class AliTPCcalibTimeGain;
      22             : class AliTPCcalibGainMult;
      23             : class AliTPCROC;
      24             : class AliTPCParam;
      25             : class TPad;
      26             : class AliCDBRunRange;
      27             : class AliCDBStorage;
      28             : class AliCDBEntry;
      29             : class TGraph;
      30             : class TGraphErrors;
      31             : class AliSplineFit;
      32             : 
      33             : class AliTPCPreprocessorOffline:public TNamed { 
      34             : public:
      35             :   enum EGainCalibType {kNoGainCalib=0, kFullGainCalib, kResidualGainQA, kCombinedGainCalib, kNGainCalibTypes};
      36             :   AliTPCPreprocessorOffline();
      37             :   virtual ~AliTPCPreprocessorOffline();
      38             :   void UpdateOCDBGain(Int_t  startRunNumber, Int_t endRunNumber, AliCDBStorage* fullStorage, AliCDBStorage* residualStorage=0x0);
      39             :   void UpdateDriftParam(AliTPCParam *param, TObjArray *const arr, Int_t lstartRun);
      40             : 
      41             :   //
      42             :   // v drift part
      43             :   //
      44             :   Int_t CalibTimeVdrift(AliTPCcalibTime* timeDrift, Int_t ustartRun, Int_t uendRun);
      45             :   void CalibTimeVdrift(const Char_t* file, Int_t ustartRun, Int_t uendRun,AliCDBStorage* ocdbStorage=0x0);
      46             :   AliCDBEntry* CreateDriftCDBentryObject(Int_t ustartRun, Int_t uendRun);
      47             :   void UpdateOCDBDrift(Int_t ustartRun, Int_t uendRun, AliCDBStorage* storage);
      48             :   void TakeOwnershipDriftCDBEntry();
      49             : 
      50             :   void GetRunRange(AliTPCcalibTime* const timeDrift);
      51             :   void AddHistoGraphs(  TObjArray * vdriftArray, AliTPCcalibTime * const timeDrift, Int_t minEntries);
      52             :   void AddAlignmentGraphs(  TObjArray * vdriftArray, AliTPCcalibTime * const timeDrift);
      53             :   void AddLaserGraphs(  TObjArray * vdriftArray, AliTPCcalibTime *timeDrift);
      54             :   void SetDefaultGraphDrift(TGraph *graph, Int_t color, Int_t style);
      55             :   void MakeDefaultPlots(TObjArray * const arr, TObjArray *picArray);
      56           0 :   void SetMaxVDriftCorr(Double_t maxVDriftCorr=0.03) {fMaxVdriftCorr=maxVDriftCorr;};
      57             :   Bool_t ValidateTimeDrift();
      58           0 :   AliCDBEntry* GetDriftCDBentry() const { return fDriftCDBentry; }
      59             :   
      60             :   //
      61             :   // Gain part
      62             :   //
      63             :   void CalibTimeGain(const Char_t* fileName, Int_t startRunNumber, Int_t endRunNumber,  AliCDBStorage* fullStorage, AliCDBStorage* residualStorage=0x0);
      64             :   void ReadGainGlobal(const Char_t* fileName="CalibObjectsTrain1.root");
      65             :   void MakeQAPlot(Float_t  FPtoMIPratio);
      66             :   Bool_t AnalyzeGain(Int_t startRunNumber, Int_t endRunNumber, Int_t minEntriesGaussFit = 500, Float_t FPtoMIPratio = 1.43); 
      67             :   Bool_t AnalyzeAttachment(Int_t startRunNumber, Int_t endRunNumber, Int_t minEntriesFit = 2000);
      68             :   Bool_t AnalyzePadRegionGain();
      69             :   Bool_t AnalyzeGainDipAngle(Int_t padRegion = 0);
      70             :   Bool_t AnalyzeGainMultiplicity();
      71             :   Bool_t AnalyzeGainChamberByChamber();
      72             :   void SetTimeGainRange(Double_t minGain=2.0, Double_t maxGain = 3.0) 
      73           0 :        {fMinGain = minGain; fMaxGain = maxGain;};
      74             :   Bool_t ValidateTimeGain();
      75             : 
      76           0 :   void SetGainCalibrationType(EGainCalibType type) { fGainCalibrationType=type;}
      77             :   static EGainCalibType GetGainCalibrationTypeFromString(const TString& type);
      78             :   Bool_t SetGainCalibrationType(const TString& type);
      79             :   Bool_t ProduceCombinedGainCalibration();
      80           0 :   EGainCalibType GetGainCalibrationType() const { return fGainCalibrationType; }
      81             : 
      82             :   void GetGraphs(const char* name, TGraphErrors* &grOCDB, TGraphErrors* &grThis);
      83             :   TGraphErrors* CombineGraphs(TGraphErrors *grOCDB, TGraphErrors *grThis, const Int_t type=0, const Bool_t multiply=kTRUE);
      84             :   static Bool_t GetPointWithError(const TGraphErrors *gr, const Double_t xPos, Double_t &y, Double_t &ey, Bool_t evalConst=kTRUE);
      85             : 
      86           0 :   const TObjArray* GetGainArray()         const { return fGainArray;         }
      87           0 :   const TObjArray* GetGainArrayCombined() const { return fGainArrayCombined; }
      88             : 
      89           0 :   void SetGainArray(TObjArray *arr) { fGainArray=arr; }
      90             :   //
      91             :   // Alignment time part
      92             :   //
      93             :   void  MakeChainTime();
      94             :   void  MakePrimitivesTime();
      95             :   //  static void RegisterPrimitiveTimes();
      96             :   void  CreateAlignTime(TString fstring, TVectorD paramC);  
      97             :   void  MakeFitTime();
      98             :   static Double_t EvalAt(Double_t phi, Double_t refX, Double_t theta, Int_t corr, Int_t ptype);
      99             :   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);
     100             : 
     101             :   // event/track counter related setters and getters
     102           0 :   Int_t GetNeventsVdrift() const {return fNeventsVdrift;}
     103           0 :   Int_t GetNtracksVdrift() const {return fNtracksVdrift;}
     104           0 :   Int_t GetMinEventsVdrift() const {return fMinEventsVdrift;}
     105           0 :   Int_t GetMinTracksVdrift() const {return fMinTracksVdrift;}
     106           0 :   void SetMinEventsVdrift(Int_t min) {fMinEventsVdrift=min;}
     107           0 :   void SetMinTracksVdrift(Int_t min) {fMinTracksVdrift=min;}
     108             : 
     109             :   //
     110             :   // QA drawing part
     111             :   //
     112             :   static void SetPadStyle(TPad *pad, Float_t mx0, Float_t mx1, Float_t my0, Float_t my1);
     113             :   static void PrintArray(TObjArray *array);
     114           0 :   TChain *GetAlignTree(){return fAlignTree;}
     115             :   //
     116           0 :   const TObjArray* GetArrQAhist() const { return fArrQAhist; }
     117             :   void  FillQA(Bool_t qa=kTRUE, Bool_t norm=kTRUE);
     118             :   void  MakeQAPlotsGain(TString outputDirectory="", TString fileTypes="png");
     119             :   //
     120             :   // graph filtering part
     121             :   //
     122             :   static TGraphErrors* FilterGraphMedianAbs(TGraphErrors * graph, Float_t cut,Double_t &medianY);
     123             :   static TGraphErrors* FilterGraphDrift(TGraphErrors * graph, Float_t errSigmaCut, Float_t medianCutAbs);
     124             :   static TGraphErrors* MakeGraphFilter0(THnSparse *hisN, Int_t itime, Int_t ival, Int_t minEntries, Double_t offset=0);
     125             : 
     126             :   //
     127           0 :   void SwitchOnValidation(Bool_t val = kTRUE) {fSwitchOnValidation = val;} 
     128           0 :   Bool_t IsSwitchOnValidation() { return fSwitchOnValidation; } 
     129             : 
     130             :   //
     131             :   Int_t GetStatus();
     132             :   enum ECalibStatusBit { kCalibFailedTimeDrift =0x0001,
     133             :                          kCalibFailedTimeGain  =0x0002,
     134             :                          kCalibFailedExport  =0x0004
     135             :   };
     136             : 
     137             : private:
     138             :   Bool_t fNormaliseQA;                     // normalise the QA histograms in the same way as the derived graphs
     139             :   EGainCalibType fGainCalibrationType;     // gain calibration type
     140             :   Int_t fMinEntries;                       // minimal number of entries for fit
     141             :   Int_t fStartRun;                         // start Run - used to make fast selection in THnSparse
     142             :   Int_t fEndRun;                           // end   Run - used to make fast selection in THnSparse
     143             :   Int_t fStartTime;                        // fStartTime - used to make fast selection in THnSparse
     144             :   Int_t fEndTime;                          // fEndTime   - used to make fast selection in THnSparse
     145             :   AliCDBStorage*  fOCDBstorage;            // OCDB storage
     146             :   TObjArray * fVdriftArray;                // array with output calibration graphs
     147             :   AliTPCcalibTime * fTimeDrift;            // input data to construct calibration graphs
     148             :   TGraphErrors * fGraphMIP;                // graph time dependence of MIP
     149             :   TGraphErrors * fGraphCosmic;             // graph time dependence at Plateu
     150             :   TGraphErrors * fGraphAttachmentMIP;      // graph time dependence of attachment (signal vs. mean driftlength)
     151             :   AliSplineFit * fFitMIP;                  // fit of dependence - MIP
     152             :   AliSplineFit * fFitCosmic;               // fit of dependence - Plateu
     153             :   TObjArray    * fGainArray;               // array to be stored in the OCDB
     154             :   TObjArray    * fGainArrayCombined;       // array to be stored in the OCDB, contains the combined Full (+) Residual calibration
     155             :   TObjArray    * fArrQAhist;               // QA histograms
     156             :   AliTPCcalibTimeGain * fGainMIP;          // calibration component for MIP
     157             :   AliTPCcalibTimeGain * fGainCosmic;       // calibration component for cosmic
     158             :   AliTPCcalibGainMult * fGainMult;         // calibration component for pad region gain equalization and multiplicity dependence
     159             : 
     160             :   TChain   *fAlignTree;        //alignment tree
     161             :   //
     162             :   Bool_t fSwitchOnValidation;  // flag to switch on validation of OCDB parameters
     163             :   Float_t fMinGain;            // min gain
     164             :   Float_t fMaxGain;            // max gain
     165             :   Float_t fMaxVdriftCorr;      // max v-drift correction
     166             :   Int_t fNtracksVdrift;           // n tracks used for v drift determination
     167             :   Int_t fMinTracksVdrift;         // minimum numner of tracks for v drift determination
     168             :   Int_t fNeventsVdrift;           // number of events used for drift calibration
     169             :   Int_t fMinEventsVdrift;         // minimum number of events used for drift calibration
     170             : 
     171             :   Int_t fCalibrationStatus;       // status of calibration, each set bit signifies a failure in a component (see ECalibStatusBit)
     172             : 
     173             :   AliCDBEntry* fDriftCDBentry;         //!the freshly produced CDB entry
     174             : 
     175             :   void ScaleY(TGraphErrors *graph, Double_t normval);
     176             :   Bool_t NormaliseYToMean(TGraphErrors *graph);
     177             :   Bool_t NormaliseYToWeightedMeandEdx(TGraphErrors *graph);
     178             :   Bool_t NormaliseYToTruncateddEdx(TGraphErrors *graph);
     179             : private:
     180             :   AliTPCPreprocessorOffline& operator=(const AliTPCPreprocessorOffline&); // not implemented
     181             :   AliTPCPreprocessorOffline(const AliTPCPreprocessorOffline&); // not implemented
     182           6 :   ClassDef(AliTPCPreprocessorOffline,3)
     183             : };
     184             : 
     185             : #endif

Generated by: LCOV version 1.11