]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFcalib.h
Adding RAWDatarec before STEER (Laurent)
[u/mrichter/AliRoot.git] / TOF / AliTOFcalib.h
1 #ifndef ALITOFCALIB_H
2 #define ALITOFCALIB_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 //  class for TOF calibration:: simulation of uncalibrated data //
9 //////////////////////////////////////////////////////////////////
10
11 #define CHENTRIESSMALL       300   // number of entries per TOF channel per run
12                                    // (to be divided by 3 to get the 
13                                    // real number of entries), smallarray 
14 #define MAXCHENTRIESSMALL  10000   // max number of entries per TOF channel 
15                                    // (to be divided by 3 to get the 
16                                    // real number of entries), smallarray 
17                                    
18 #define NIDXSMALL              3   // number of values stored 
19                                    // after Comb PID per ESD track
20 #define DELTAIDXTOT            0   // index for ToT in bigarray
21 #define DELTAIDXTIME           1   // index for TOF time in big/smallarray
22 #define DELTAIDXPID            2   // index for Exp Time after Comb PID 
23                                    // in smallarray
24 #define MEANENTRIES           15   // Mean number of entries per channel 
25                                    // to perform calibration
26
27 #include "TTask.h"
28
29 class TArrayF;
30 class TF1;
31 class TH1F;
32 class TObjArray;
33 class TTree;
34
35 class AliESD;
36
37 class AliTOFCal;
38 class AliTOFRecoParam;
39
40 class AliTOFcalib:public TTask{
41 public:
42   AliTOFcalib();          // ctor
43   AliTOFcalib(const AliTOFcalib & calib); // copy constructor
44   AliTOFcalib& operator=(const AliTOFcalib & calib); // assignment operator
45   virtual ~AliTOFcalib() ; // dtor
46   void CreateCalArrays();
47   void CreateSimCalArrays();
48   TObjArray * GetTOFCalArrayOnline() const {return fTOFCalOnline;}
49   TObjArray * GetTOFCalArrayOffline() const {return fTOFCalOffline;}
50   TObjArray * GetTOFSimCalArrayOnline() const {return fTOFSimCalOnline;}
51   TObjArray * GetTOFSimCalArrayOffline() const {return fTOFSimCalOffline;}
52   TH1F * GetTOFSimToT() const {return fTOFSimToT;}
53   TTree * GetTOFCalibTree() const {return fTree;}
54   const char * GetOfflineValidity() const {return fkValidity;}
55   void SetOfflineValidity(const char* validity) {fkValidity = validity;}
56   Int_t NChannels()const{return fNChannels;}
57   // Methods to retrieve/write parameters from/on CDB
58   void WriteSimParOnlineOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun, TObjArray *cal);
59   void WriteSimParOfflineOnCDB(Char_t *sel, const Char_t * validity, Int_t minrun, Int_t maxrun, TObjArray *cal, TH1F *histo);
60   void ReadSimParOnlineFromCDB(Char_t *sel, Int_t nrun);
61   void ReadSimParOfflineFromCDB(Char_t *sel, Int_t nrun);
62   void WriteParOnlineOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun);
63   void WriteParOfflineOnCDB(Char_t *sel, const Char_t *validity, Int_t minrun, Int_t maxrun);
64   void WriteParOnlineOnCDB(Char_t *sel);
65   void WriteParOfflineOnCDB(Char_t *sel, const Char_t *validity);
66   Bool_t ReadParOnlineFromCDB(Char_t *sel, Int_t nrun);
67   Bool_t ReadParOfflineFromCDB(Char_t *sel, Int_t nrun);
68   void WriteRecParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun, AliTOFRecoParam *param);
69   AliTOFRecoParam * ReadRecParFromCDB(Char_t *sel, Int_t nrun);
70   void CreateTreeFromCDB(Int_t minrun, Int_t maxrun);
71   void CreateTreeFromFile(Int_t minrun, Int_t maxrun);
72   void CreateTreeFromGrid(Int_t minrun, Int_t maxrun);
73   Int_t Calibrate(Option_t *optionSave="", Option_t *optionFit="RQ");
74   Int_t Calibrate(Int_t nch,Int_t *ich, Option_t *optionSave="", Option_t *optionFit="RQ");
75   Int_t Calibrate(Int_t ichmin, Int_t ichmax, Option_t *optionSave="", Option_t *optionFit="RQ");
76   Int_t Calibrate(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ");
77   Int_t CalibrateFromProfile(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ");
78   TH1F* Profile(Int_t i);
79   Int_t FindBins (TH1F* h, Double_t *bins) const;
80   void SetNruns(Int_t nruns) {fNruns=nruns;}
81   Int_t GetNruns() const {return fNruns;}
82   void SetFirstRun(Int_t firstRun) {fFirstRun=firstRun;}
83   Int_t GetFirstRun() const {return fFirstRun;}
84   void SetLastRun(Int_t lastRun) {fLastRun=lastRun;}
85   Int_t GetLastRun() const {return fLastRun;}
86
87 private:
88   Int_t fNChannels; // number of TOF channels
89   TObjArray *fTOFCalOnline;       // array of AliTOFChannels storing calib parameters
90   TObjArray *fTOFCalOffline;       // array of AliTOFChannels storing calib parameters
91   TObjArray *fTOFSimCalOnline;       // array of AliTOFChannels storing calib parameters
92   TObjArray *fTOFSimCalOffline;       // array of AliTOFChannels storing calib parameters
93   TH1F *fTOFSimToT;        // histo with realistic ToT signal from TB Data
94   const char *fkValidity;  // validity for offline calibration object
95   TTree *fTree;            // tree for TOF calibration
96   Int_t fNruns;            // number of runs to be processed
97   Int_t fFirstRun;            // first run for calibration obj validity
98   Int_t fLastRun;            // last run for calib obj validity
99
100   ClassDef(AliTOFcalib,3);
101 };
102
103 #endif // AliTOFcalib_H
104