]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFCalibTask.h
updates to comply with AliTOFGeometryV5 becoming AliTOFGeometry and Calibration objects
[u/mrichter/AliRoot.git] / TOF / AliTOFCalibTask.h
1 #ifndef ALITOFCALIBTASK_H
2 #define ALITOFCALIBTASK_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 //    task for TOF calibration            //
9 //         C.Zampolli                     //
10 ////////////////////////////////////////////
11
12 /* $Id$ */
13
14 #define TOFCHANNELS       160000   // number TOF channels 
15 #define CHENTRIES            500   // number of entries per TOF channel per run
16                                    // (to be divided by 5 to get the 
17                                    // real number of entries), bigarray 
18 #define CHENTRIESSMALL       300   // number of entries per TOF channel per run
19                                    // (to be divided by 3 to get the 
20                                    // real number of entries), smallarray 
21 #define MAXCHENTRIESSMALL  10000   // max number of entries per TOF channel 
22                                    // (to be divided by 3 to get the 
23                                    // real number of entries), smallarray 
24                                    
25 #define LOWERMOMBOUND        1.0   // [GeV/c] default value Pb-Pb
26 #define UPPERMOMBOUND        1.8   // [GeV/c] default value Pb-Pb
27 #define MINTIME              5E3   // min time of flight value (ns)
28 #define NIDX                   5   // number of values stored 
29                                    // in big/smallarray per ESD track
30 #define NIDXSMALL              3   // number of values stored 
31                                    // after Comb PID per ESD track
32 #define DELTAIDXTOT            0   // index for ToT in bigarray
33 #define DELTAIDXTIME           1   // index for TOF time in big/smallarray
34 #define DELTAIDXEXTIMEPI       2   // index for Exp Time Pi in bigarray
35 #define DELTAIDXEXTIMEKA       3   // index for Exp Time Ka in bigarray
36 #define DELTAIDXEXTIMEPR       4   // index for Exp Time Pr in bigarray
37 #define DELTAIDXPID            2   // index for Exp Time after Comb PID 
38                                    // in smallarray
39 #define TRACKERROR       90*1E-3   // error on the tracks for 
40                                    // Combinatorial PID (ns)
41 #define MEANENTRIES           15   // Mean number of entries per channel 
42                                    // to perform calibration
43
44 #include "AliAnalysisTask.h"  
45
46 class TTree;
47 class AliESDtrack ;  
48 class TFile; 
49 class TH1F ;
50 class TH1I ;
51 class TH1D ;
52 class TH2F ;
53 class AliESDEvent ; 
54
55 class AliTOFCalibTask : public AliAnalysisTask {
56
57 public:
58   AliTOFCalibTask(const char *name) ; //ctor
59   AliTOFCalibTask(const AliTOFCalibTask & calibtask); // copy constructor
60   AliTOFCalibTask& operator=(const AliTOFCalibTask & calibtask); // assignment operator
61   virtual ~AliTOFCalibTask(); //dtor
62   virtual void Exec(Option_t * opt="") ;
63   virtual void ConnectInputData(Option_t *) ;
64   virtual void CreateOutputObjects();
65   virtual void Terminate(Option_t * opt = "") ;
66   virtual Bool_t Notify();
67
68  public: 
69   class AliTOFArrayTask : public TObject {
70   public:
71     AliTOFArrayTask(): TObject(),fSize(0),fArray(0x0){}
72     AliTOFArrayTask(Int_t size) :
73       TObject(),
74       fSize(size),
75       fArray(new TArrayF*[size]) {
76     } 
77     AliTOFArrayTask(const AliTOFArrayTask & source):
78       TObject(),fSize(0),fArray(0x0){ // copy constructor
79       this->fSize= source.fSize;
80       this->fArray= source.fArray;
81     };
82
83     AliTOFArrayTask& operator=(const AliTOFArrayTask & source) { // assignment operator
84       this->fSize= source.fSize;
85       this->fArray= source.fArray;
86       return *this;
87     }
88
89     Int_t GetSize() const {return fSize;}
90     void AddArray(Int_t pos, TArrayF * parr) {
91       if (pos>-1 && pos < fSize)fArray[pos] = parr;}
92     TArrayF *  GetArray(Int_t pos) const {
93       TArrayF * parr = 0x0; 
94       if  (pos>-1 && pos < fSize)parr = fArray[pos];
95       return parr;
96     }
97     virtual ~AliTOFArrayTask() {
98       delete [] fArray;
99     }
100     
101   private:
102     
103     Int_t fSize;       // Size of the array of TArrayFs
104     TArrayF ** fArray; //[fSize]};
105     
106   };
107
108 private:
109   Bool_t Select(AliESDtrack *t);
110   Bool_t CombPID(Float_t *smallarray, Int_t size);
111   void BookHistos();
112   void DrawHistos();
113   Int_t Calibrate(Option_t *optionSave="", Option_t *optionFit="RQ");
114   Int_t Calibrate(Int_t nch,Int_t *ich, Option_t *optionSave="", Option_t *optionFit="RQ");
115   Int_t Calibrate(Int_t ichmin, Int_t ichmax, Option_t *optionSave="", Option_t *optionFit="RQ");
116   Int_t Calibrate(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ");
117   Int_t CalibrateFromProfile(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ");
118   TH1F* Profile(Int_t i);
119   Int_t FindBins (TH1F* h, Double_t *bins) const;
120
121   const Char_t *fdir;              // initial directory
122   TTree* fChain ;            //!pointer to the analyzed TTree or TChain
123   //leaf types
124   AliESDEvent* fESD ;              //! Declaration of leave types
125   Int_t fMinEntries;            // minimum number of entries to steer the task
126   Int_t fIch;                   // TOF channel number
127   Float_t fToT;                 // Time over Threshold, ns
128   Float_t fTime;                // TOF time, ns
129   Float_t fExpTimePi;           // exp time, Pions, ns
130   Float_t fExpTimeKa;           // exp time, Kaons, ns
131   Float_t fExpTimePr;           // exp time, Protons, ns
132   TTree* ftree;                 // tree for calibration
133   Float_t fMinTime;             // min TOF time for track selection; not used
134   Float_t** fbigarray;          // big array for calibration
135   Int_t* findexarray;           // array for entry index in each channel 
136   Int_t fnESD;                  // number of analyzed ESD tracks 
137   Int_t fnESDselected;          // number of selected ESD tracks 
138   Int_t fnESDkTOFout;           // number of ESD tracks with kTOFout
139   Int_t fnESDkTIME;             // number of ESD tracks with kTIME
140   Int_t fnESDassTOFcl;          // number of ESD tracks with assigned TOF cluster
141   Int_t fnESDTIMEcut;           // number of ESD tracks with TOF time < 17 ns
142   Int_t fnESDTRDcut;            // number of ESD tracks with TRD ok
143
144   // Histos
145   TH1F* fhToT;                  // ToT histo
146   TH1F* fhTime;                 // Time histo
147   TH1F* fhExpTimePi;            // Exp Time Pi histo                  
148   TH1F* fhExpTimeKa;            // Exp Time Ka histo                  
149   TH1F* fhExpTimePr;            // Exp Time Pr histo                  
150   TH1I* fhPID;                  // PID histo                  
151   TH1D* fhch;                   // TOF channel histo               
152
153   TObjArray * fOutputContainer ; //! output data container
154
155   ClassDef(AliTOFCalibTask, 1); //  TOF Calib task 
156 };
157 #endif // ALITOFCALIBTASK_H
158