Task for TOF Calibration, optimized for pp runs
[u/mrichter/AliRoot.git] / TOF / AliTOFCalibTask.h
CommitLineData
1ed77580 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
46class TTree;
47class AliESDtrack ;
48class TFile;
49class TH1F ;
50class TH1I ;
51class TH1D ;
52class TH2F ;
53class AliESD ;
54
55class AliTOFCalibTask : public AliAnalysisTask {
56
57public:
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
67 public:
68 class AliTOFArrayTask : public TObject {
69 public:
70 AliTOFArrayTask(): TObject(),fSize(0),fArray(0x0){}
71 AliTOFArrayTask(Int_t size) :
72 TObject(),
73 fSize(size),
74 fArray(new TArrayF*[size]) {
75 }
76 AliTOFArrayTask(const AliTOFArrayTask & source):
77 TObject(),fSize(0),fArray(0x0){ // copy constructor
78 this->fSize= source.fSize;
79 this->fArray= source.fArray;
80 };
81
82 AliTOFArrayTask& operator=(const AliTOFArrayTask & source) { // assignment operator
83 this->fSize= source.fSize;
84 this->fArray= source.fArray;
85 return *this;
86 }
87
88 Int_t GetSize() const {return fSize;}
89 void AddArray(Int_t pos, TArrayF * parr) {
90 if (pos>-1 && pos < fSize)fArray[pos] = parr;}
91 TArrayF * GetArray(Int_t pos) const {
92 TArrayF * parr = 0x0;
93 if (pos>-1 && pos < fSize)parr = fArray[pos];
94 return parr;
95 }
96 virtual ~AliTOFArrayTask() {
97 delete [] fArray;
98 }
99
100 private:
101
102 Int_t fSize; // Size of the array of TArrayFs
103 TArrayF ** fArray; //[fSize]};
104
105 };
106
107private:
108 Bool_t Select(AliESDtrack *t);
109 Bool_t CombPID(Float_t *smallarray, Int_t size);
110 void BookHistos();
111 void DrawHistos();
112 Int_t Calibrate(Option_t *optionSave="", Option_t *optionFit="RQ");
113 Int_t Calibrate(Int_t nch,Int_t *ich, Option_t *optionSave="", Option_t *optionFit="RQ");
114 Int_t Calibrate(Int_t ichmin, Int_t ichmax, Option_t *optionSave="", Option_t *optionFit="RQ");
115 Int_t Calibrate(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ");
116 Int_t CalibrateFromProfile(Int_t ich, Option_t *optionSave="", Option_t *optionFit="RQ");
117 TH1F* Profile(Int_t i);
118 Int_t FindBins (TH1F* h, Double_t *bins) const;
119
120 const Char_t *fdir; // initial directory
121 TTree* fChain ; //!pointer to the analyzed TTree or TChain
122 //leaf types
123 AliESD* fESD ; //! Declaration of leave types
124 Int_t fMinEntries; // minimum number of entries to steer the task
125 Int_t fIch; // TOF channel number
126 Float_t fToT; // Time over Threshold, ns
127 Float_t fTime; // TOF time, ns
128 Float_t fExpTimePi; // exp time, Pions, ns
129 Float_t fExpTimeKa; // exp time, Kaons, ns
130 Float_t fExpTimePr; // exp time, Protons, ns
131 TTree* ftree; // tree for calibration
132 Float_t fMinTime; // min TOF time for track selection; not used
133 Float_t** fbigarray; // big array for calibration
134 Int_t* findexarray; // array for entry index in each channel
135 Int_t fnESD; // number of analyzed ESD tracks
136 Int_t fnESDselected; // number of selected ESD tracks
137 Int_t fnESDkTOFout; // number of ESD tracks with kTOFout
138 Int_t fnESDkTIME; // number of ESD tracks with kTIME
139 Int_t fnESDassTOFcl; // number of ESD tracks with assigned TOF cluster
140 Int_t fnESDTIMEcut; // number of ESD tracks with TOF time < 17 ns
141 Int_t fnESDTRDcut; // number of ESD tracks with TRD ok
142
143 // Histos
144 TH1F* fhToT; // ToT histo
145 TH1F* fhTime; // Time histo
146 TH1F* fhExpTimePi; // Exp Time Pi histo
147 TH1F* fhExpTimeKa; // Exp Time Ka histo
148 TH1F* fhExpTimePr; // Exp Time Pr histo
149 TH1I* fhPID; // PID histo
150 TH1D* fhch; // TOF channel histo
151
152 TObjArray * fOutputContainer ; //! output data container
153
154 ClassDef(AliTOFCalibTask, 1); // TOF Calib task
155};
156#endif // ALITOFCALIBTASK_H
157