]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFcalib.h
Added possibility to run without reading the MC (Andrea)
[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 class TChain;
35 class TMap;
36
37 //class AliESD;
38
39 class AliTOFCal;
40 class AliTOFRecoParam;
41 class AliTOFChannelOnlineStatusArray;
42 class AliTOFChannelOnlineArray;
43
44 class AliTOFcalib:public TTask{
45 public:
46   AliTOFcalib();          // ctor
47   AliTOFcalib(const AliTOFcalib & calib); // copy constructor
48   AliTOFcalib& operator=(const AliTOFcalib & calib); // assignment operator
49   virtual ~AliTOFcalib() ; // dtor
50   void CreateCalArrays();
51   void CreateCalObjects();
52   TObjArray * GetTOFCalArrayOnline() const {return fTOFCalOnline;}
53   AliTOFChannelOnlineArray * GetTOFOnlineDelay() const {return fCal;}
54   AliTOFChannelOnlineStatusArray * GetTOFOnlineStatus() const {return fStatus;}
55   TObjArray * GetTOFCalArrayOnlinePulser() const {return fTOFCalOnlinePulser;}
56   TObjArray * GetTOFCalArrayOnlineNoise() const {return fTOFCalOnlineNoise;}
57   TObjArray * GetTOFCalArrayOnlineHW() const {return fTOFCalOnlineHW;}
58   TObjArray * GetTOFCalArrayOffline() const {return fTOFCalOffline;}
59   TMap * GetConfigMap() const {return fConfigMap;}
60   TH1F * GetTOFSimToT() const {return fTOFSimToT;}
61   TTree * GetTOFCalibTree() const {return fTree;}
62   TChain * GetTOFCalibChain() const {return fChain;}
63   const char * GetOfflineValidity() const {return fkValidity;}
64   void SetOfflineValidity(const char* validity) {fkValidity = validity;}
65   Int_t NChannels()const{return fNChannels;}
66
67   // Methods to retrieve/write parameters from/on CDB
68   // writing
69
70   void WriteSimHistoOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun, TH1F *histo);
71   void WriteConfigMapOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
72   void WriteConfigMapOnCDB(const Char_t *sel);
73   // new calib objs
74   void WriteParOnlineDelayOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
75   void WriteParOnlineStatusOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
76   void WriteParOnlineDelayOnCDB(const Char_t *sel);
77   void WriteParOnlineStatusOnCDB(const Char_t *sel);
78   // old calib objs
79   void WriteParOnlineOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
80   void WriteParOnlinePulserOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
81   void WriteParOnlineNoiseOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
82   void WriteParOnlineHWOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun);
83   void WriteParOfflineOnCDB(const Char_t *sel, const Char_t *validity, Int_t minrun, Int_t maxrun);
84   void WriteParOnlineOnCDB(const Char_t *sel);
85   void WriteParOnlinePulserOnCDB(const Char_t *sel);  // old, before unification of status info
86   void WriteParOnlineNoiseOnCDB(const Char_t *sel);   // old, before unification of status info
87   void WriteParOnlineHWOnCDB(const Char_t *sel);      // old, before unification of status info
88   void WriteParOfflineOnCDB(const Char_t *sel, const Char_t *validity);
89
90   // reading
91   Bool_t ReadSimHistoFromCDB(const Char_t *sel, Int_t nrun);
92   Bool_t ReadConfigMapFromCDB(const Char_t *sel, Int_t nrun);
93   // new objs
94   Bool_t ReadParOnlineDelayFromCDB(const Char_t *sel, Int_t nrun);
95   Bool_t ReadParOnlineStatusFromCDB(const Char_t *sel, Int_t nrun);
96   // old objs
97   Bool_t ReadParOnlineFromCDB(const Char_t *sel, Int_t nrun);
98   Bool_t ReadParOnlinePulserFromCDB(const Char_t *sel, Int_t nrun);  // old, before unification of status info
99   Bool_t ReadParOnlineNoiseFromCDB(const Char_t *sel, Int_t nrun);   // old, before unification of status info
100   Bool_t ReadParOnlineHWFromCDB(const Char_t *sel, Int_t nrun);      // old, before unification of status info
101   Bool_t ReadParOfflineFromCDB(const Char_t *sel, Int_t nrun);
102   void WriteRecParOnCDB(const Char_t *sel, Int_t minrun, Int_t maxrun, AliTOFRecoParam *param);
103   AliTOFRecoParam * ReadRecParFromCDB(const Char_t *sel, Int_t nrun);
104   void CreateTreeFromCDB(Int_t minrun, Int_t maxrun);
105   void CreateTreeFromFile(Int_t minrun, Int_t maxrun);
106   void CreateTreeFromGrid(Int_t minrun, Int_t maxrun);
107   void CreateChainFromGrid(Int_t minrun, Int_t maxrun);
108   Int_t Calibrate(Option_t *optionSave="", Option_t *optionFit="RQ");
109   Int_t Calibrate(Int_t nch,Int_t *ich, Option_t *optionSave="", Option_t *optionFit="RQ");
110   Int_t Calibrate(Int_t ichmin, Int_t ichmax, Option_t *optionSave="", Option_t *optionFit="RQ");
111   Int_t Calibrate(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ");
112   Int_t CalibrateFromProfile(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ");
113   TH1F* Profile(Int_t i);
114   Int_t FindBins (TH1F* h, Double_t *bins) const;
115   void SetNruns(Int_t nruns) {fNruns=nruns;}
116   Int_t GetNruns() const {return fNruns;}
117   void SetFirstRun(Int_t firstRun) {fFirstRun=firstRun;}
118   Int_t GetFirstRun() const {return fFirstRun;}
119   void SetLastRun(Int_t lastRun) {fLastRun=lastRun;}
120   Int_t GetLastRun() const {return fLastRun;}
121
122 private:
123   Int_t fNChannels; // number of TOF channels
124
125   // old calibration objects
126   TObjArray *fTOFCalOnline;       // array of AliTOFChannels storing calib parameters
127   TObjArray *fTOFCalOnlinePulser; // array of AliTOFChannels storing calib status from pulser   // old, before unification of status info
128   TObjArray *fTOFCalOnlineNoise;  // array of AliTOFChannels storing calib status from noise    // old, before unification of status info
129   TObjArray *fTOFCalOnlineHW;  // array of AliTOFChannels storing calib status from hardware    // old, before unification of status info
130   TObjArray *fTOFCalOffline;       // array of AliTOFChannels storing calib parameters
131
132   // new calibration objects
133   AliTOFChannelOnlineArray *fCal; // object with delay array for TOF channels
134   AliTOFChannelOnlineStatusArray *fStatus; // object with status array for TOF channels
135
136   TH1F *fTOFSimToT;        // histo with realistic ToT signal from TB Data
137   const char *fkValidity;  // validity for offline calibration object
138   TTree *fTree;            // tree for TOF calibration
139   TChain *fChain;          // chain for TOF calibration
140   Int_t fNruns;            // number of runs to be processed
141   Int_t fFirstRun;            // first run for calibration obj validity
142   Int_t fLastRun;            // last run for calib obj validity
143   TMap* fConfigMap;          // map holding configuration obj
144
145   ClassDef(AliTOFcalib,7);
146 };
147
148 #endif // AliTOFcalib_H
149