More comments for documentation.
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructioner.h
CommitLineData
db9ba97f 1#ifndef ALITOFRECONSTRUCTIONER_H
2#define ALITOFRECONSTRUCTIONER_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6
7//_________________________________________________________________________
8// Task Class for Reconstruction in TOF
9//
10//-- Authors: Bologna-ITEP-Salerno Group
11
12
13#include "TTask.h"
14#include "TString.h"
15#include <TF1.h>
16#include <TF2.h>
17#include <TH1.h>
18#include <TH2.h>
19#include <TRandom.h>
20#include <TNtuple.h>
21#include "TParticle.h"
22#include "AliTOF.h"
23#include "AliDetector.h"
24
25class AliTOFPad;
26class AliTOFRecHit;
27class AliTOFTrack;
28class TGeant3;
29
30class AliTOFReconstructioner: public TTask {
31
32public:
33 AliTOFReconstructioner() ; // ctor
34 AliTOFReconstructioner(char* headerFile, Option_t* opt, char *RecFile = 0) ;
35 virtual ~AliTOFReconstructioner() ; // dtor
36 virtual void InitArray(Float_t array[], Int_t nlocations);
37 virtual void InitArray(Int_t array[], Int_t nlocations);
38 virtual void Exec(const char* datafile, Option_t* option); // do the main work
39 virtual void ReadTOFHits(Int_t ntracks, TTree* treehits, TClonesArray* tofhits, Int_t *** MapPixels, Int_t* kTOFhitFirst, AliTOFPad* pixelArray , Int_t* iTOFpixel, Float_t* toftime, AliTOFRecHit* hitArray, Int_t& isHitOnFiredPad, Int_t& ipixel);
40 virtual void AddNoiseFromOuter(Option_t *option, Int_t *** MapPixels, AliTOFPad* pixelArray , AliTOFRecHit* hitArray, Int_t& isHitOnFiredPad, Int_t& ipixel);
41 virtual void SetMinDistance(AliTOFRecHit* hitArray, Int_t ilastEntry);
42 // this line has to be commented till TPC will provide fPx fPy fPz
43 // and fL in AliTPChit class
44 //virtual void ReadTPCHits(Int_t ntracks, TTree* treehits, TClonesArray* tpchits, Int_t* iTrackPt, Int_t* iparticle, Float_t* ptTrack, AliTOFTrack* trackArray, Int_t& itrack);
45 virtual void ReadTPCTracks(TFile* tpcReconFile){};
46 virtual void Matching(AliTOFTrack* trackArray, AliTOFRecHit* hitArray, Int_t *** mapPixel, AliTOFPad* pixelArray, Int_t* kTOFhitFirst, Int_t& ipixel, Int_t* iTrackPt, Int_t* iTOFpixel, Int_t ntotTpcTracks);
47
48 virtual void FillNtuple(Int_t ntracks, AliTOFTrack* trackArray, AliTOFRecHit* hitArray, AliTOFPad* pixelArray, Int_t* iTOFpixel, Int_t* iparticle, Float_t* toftime, Int_t& ipixelLastEntry, Int_t itrack);
49 void Init(Option_t* opt);
50 void CreateNTuple();
51 void SetNEvents(Int_t Nevents) {fNevents = Nevents;}
52 void SetFirstEvent(Int_t firstevent) {fFirstEvent = firstevent;}
53 void SetLastEvent(Int_t lastevent) {fLastEvent = lastevent;}
54 Int_t GetNEvents() const {return fNevents;}
55 const char* GetRecFile() const {return fRecFile.Data();}
56 Int_t PDGtoGeantCode(Int_t pdgcode);
57 virtual void IsInsideThePad(TGeant3* g3, Float_t x, Float_t y, Float_t z, Int_t *nGeom, Float_t& zPad, Float_t& xPad);
58 virtual void BorderEffect(Float_t z0, Float_t x0, Float_t geantTime, Int_t& nActivatedPads, Int_t& nFiredPads, Bool_t* isFired, Int_t* nPlace, Float_t* qInduced, Float_t* tofTime, Float_t& averageTime);
59 virtual void EpMulScatt(Float_t& px, Float_t& py, Float_t& pz, Float_t& p, Float_t& theta);
60 void SetDbg(Int_t dbgflag) {fdbg=dbgflag;}
61 void SetRecFile(char * file ) ;
62 void SetTimeResolution(Float_t timeResolution) {fTimeResolution=timeResolution;}
63 void SetPadefficiency(Float_t padefficiency) {fpadefficiency=padefficiency;}
64 void SetEdgeEffect(Int_t edgeEffect) {fEdgeEffect=edgeEffect;}
65 void SetEdgeTails(Int_t edgeTails) {fEdgeTails=edgeTails;}
66 void SetHparameter(Float_t hparameter) {fHparameter=hparameter;}
67 void SetH2parameter(Float_t h2parameter) {fH2parameter=h2parameter;}
68 void SetKparameter(Float_t kparameter) {fKparameter=kparameter;}
69 void SetK2parameter(Float_t k2parameter) {fK2parameter=k2parameter;}
70 void SetEffCenter(Float_t effCenter) {fEffCenter=effCenter;}
71 void SetEffBoundary(Float_t effBoundary) {fEffBoundary=effBoundary;}
72 void SetEff2Boundary(Float_t eff2Boundary) {fEff2Boundary=eff2Boundary;}
73 void SetEff3Boundary(Float_t eff3Boundary) {fEff3Boundary=eff3Boundary;}
74 void SetResCenter (Float_t resCenter) {fResCenter=resCenter;}
75 void SetResBoundary(Float_t resBoundary) {fResBoundary=resBoundary;}
76 void SetResSlope(Float_t resSlope) {fResSlope=resSlope;}
77 void SetTimeWalkCenter(Float_t timeWalkCenter) {fTimeWalkCenter=timeWalkCenter;}
78 void SetTimeWalkBoundary(Float_t timeWalkBoundary){fTimeWalkBoundary=timeWalkBoundary;}
79 void SetTimeWalkSlope(Float_t timeWalkSlope) {fTimeWalkSlope=timeWalkSlope;}
80
81 void SetTimeDelayFlag(Int_t timeDelayFlag) {fTimeDelayFlag=timeDelayFlag;}
82 void SetPulseHeightSlope(Float_t pulseHeightSlope){fPulseHeightSlope=pulseHeightSlope;}
83 void SetTimeDelaySlope(Float_t timeDelaySlope) {fTimeDelaySlope=timeDelaySlope;}
84 void SetMinimumCharge(Float_t minimumCharge) {fMinimumCharge=minimumCharge;}
85 void SetChargeSmearing(Float_t chargeSmearing) {fChargeSmearing=chargeSmearing;}
86 void SetLogChargeSmearing(Float_t logChargeSmearing){fLogChargeSmearing=logChargeSmearing;}
87 void SetTimeSmearing(Float_t timeSmearing) {fTimeSmearing=timeSmearing;}
88 void SetAverageTimeFlag(Int_t averageTimeFlag) {fAverageTimeFlag=averageTimeFlag;}
89 void SetChargeFactorForMatching(Int_t chargeFactorForMatching){fChargeFactorForMatching=chargeFactorForMatching;}
90 void SetMatchingStyle(Int_t matchingStyle) {fMatchingStyle=matchingStyle;}
91 void SetTrackingEfficiency(Float_t trackingEfficiency){fTrackingEfficiency=trackingEfficiency;}
92 void SetSigmavsp(Float_t sigmavsp) {fSigmavsp=sigmavsp;}
93 void SetSigmaZ(Float_t sigmaZ) {fSigmaZ=sigmaZ;}
94 void SetSigmarphi(Float_t sigmarphi) {fSigmarphi=sigmarphi;}
95 void SetSigmap(Float_t sigmap) {fSigmap=sigmap;}
96 void SetSigmaPhi(Float_t sigmaPhi) {fSigmaPhi=sigmaPhi;}
97 void SetSigmaTheta(Float_t sigmaTheta) {fSigmaTheta=sigmaTheta;}
98 void SetNoise(Float_t noise) {fNoise=noise;}
99 void SetNoiseSlope(Float_t noiseSlope) {fNoiseSlope=noiseSlope;}
100 void SetNoiseMeanTof(Float_t noiseTof) {fNoiseMeanTof=noiseTof;}
101 void SetField(Float_t field) {fField=field;}
102 void SetRadLenTPC(Float_t radLenTPC) {fRadLenTPC=radLenTPC;}
103 void SetCorrectionTRD(Float_t correctionTRD) {fCorrectionTRD=correctionTRD;}
104 void SetLastTPCRow(Int_t lastTPCRow) {fLastTPCRow=lastTPCRow;}
105 void SetRadiusvtxBound(Float_t radiusvtxBound) {fRadiusvtxBound=radiusvtxBound;}
106 void SetMaxTestTracks(Int_t maxTestTracks) {fMaxTestTracks=maxTestTracks;}
107 void SetStep(Float_t step) {fStep=step;}
108 void SetMaxPixels(Int_t maxPixels) {fMaxPixels=maxPixels;}
109 void SetMaxAllTracks(Int_t maxAllTracks) {fMaxAllTracks=maxAllTracks;}
110 void SetMaxTracks(Int_t maxTracks) {fMaxTracks=maxTracks;}
111 void SetMaxTOFHits(Int_t maxTOFHits) {fMaxTOFHits=maxTOFHits;}
112 void SetPBound(Float_t pBound) {fPBound=pBound;}
113
114 Int_t GetDbgFlag() const {return fdbg;}
115 Float_t GetTimeResolution() const {return fTimeResolution;}
116 Float_t GetPadefficiency() const {return fpadefficiency;}
117 Int_t GetEdgeEffect() const {return fEdgeEffect;}
118 Int_t GetEdgeTails() const {return fEdgeTails;}
119 Float_t GetHparameter() const {return fHparameter;}
120 Float_t GetH2parameter() const {return fH2parameter;}
121 Float_t GetKparameter() const {return fKparameter;}
122 Float_t GetK2parameter() const {return fK2parameter;}
123 Float_t GetEffCenter() const {return fEffCenter;}
124 Float_t GetEffBoundary() const {return fEffBoundary;}
125 Float_t GetEff2Boundary() const {return fEff2Boundary;}
126 Float_t GetEff3Boundary() const {return fEff3Boundary;}
127 Float_t GetResCenter () const {return fResCenter;}
128 Float_t GetResBoundary() const {return fResBoundary;}
129 Float_t GetResSlope() const {return fResSlope;}
130 Float_t GetTimeWalkCenter() const {return fTimeWalkCenter;}
131 Float_t GetTimeWalkBoundary() const {return fTimeWalkBoundary;}
132 Float_t GetTimeWalkSlope() const {return fTimeWalkSlope;}
133 Int_t GetTimeDelayFlag() const {return fTimeDelayFlag;}
134 Float_t GetPulseHeightSlope() const {return fPulseHeightSlope;}
135 Float_t GetTimeDelaySlope() const {return fTimeDelaySlope;}
136 Float_t GetMinimumCharge() const {return fMinimumCharge;}
137 Float_t GetChargeSmearing() const {return fChargeSmearing;}
138 Float_t GetLogChargeSmearing()const {return fLogChargeSmearing;}
139 Float_t GetTimeSmearing() const {return fTimeSmearing;}
140 Int_t GetAverageTimeFlag() const {return fAverageTimeFlag;}
141 Int_t GetChargeFactorForMatching()const{return fChargeFactorForMatching;}
142 Int_t GetMatchingStyle() const{return fMatchingStyle;}
143 Float_t GetTrackingEfficiency() const{return fTrackingEfficiency;}
144 Float_t GetSigmavsp() const{return fSigmavsp;}
145 Float_t GetSigmaZ() const{return fSigmaZ;}
146 Float_t GetSigmarphi() const{return fSigmarphi;}
147 Float_t GetSigmap() const{return fSigmap;}
148 Float_t GetSigmaPhi() const{return fSigmaPhi;}
149 Float_t GetSigmaTheta() const{return fSigmaTheta;}
150 Float_t GetNoise() const{return fNoise;}
151 Float_t GetNoiseSlope() const{return fNoiseSlope;}
152 Float_t GetNoiseMeanTof() const{return fNoiseMeanTof;}
153 Float_t GetField() const{return fField;}
154 Float_t GetRadLenTPC() const{return fRadLenTPC;}
155 Float_t GetCorrectionTRD() const{return fCorrectionTRD;}
156 Int_t GetLastTPCRow() const{return fLastTPCRow;}
157 Float_t GetRadiusvtxBound() const{return fRadiusvtxBound;}
158 Int_t GetMaxTestTracks() const{return fMaxTestTracks;}
159 Float_t GetStep() const{return fStep;}
160 Int_t GetMaxPixels() const{return fMaxPixels;}
161 Int_t GetMaxAllTracks() const{return fMaxAllTracks;}
162 Int_t GetMaxTracks() const{return fMaxTracks;}
163 Int_t GetMaxTOFHits() const{return fMaxTOFHits;}
164 Float_t GetPBound() const{return fPBound;}
165
166 virtual void PrintParameters() const ;
167 virtual void Print(Option_t* option) const ;
168 void UseHitsFrom(const char * filename) ;
169 Bool_t operator == (const AliTOFReconstructioner & tofrec) const ;
170
171private:
172 TGeant3 *fg3; // pointer to GEANT geometry
173 TFile *foutputfile; // pointer to output file
174 TNtuple *foutputntuple; // pointer to output ntuple
175 TF1 *fZnoise; // pointer to formula giving the noise along z direction
176 TF1 *ftail; // pointer to formula for time with tail
177 Int_t fdbg; // Flag for debug, 0 no debug, 1 debug
178 Int_t fNevents; // Number of events to reconstruct
179 Int_t fFirstEvent; // First event to reconstruct
180 Int_t fLastEvent; // Last event to reconstruct
181 TString fRecFile; // output file
182 TString fHeadersFile; // input file
183 // Intrisic MRPC time resolution and pad edge effect parameters
184 Float_t fTimeResolution; // time resolution of the MRPC (ns)
185 Float_t fpadefficiency; // intrinsic pad efficiency, used if fEdgeEffect==0
186 Int_t fEdgeEffect; // edge effects option
187 Int_t fEdgeTails; // edge tails option
188 Float_t fHparameter; // sensitive edge (to produce hits on the
189 // neighbouring pads) =0.7, new = 0.4 cm
190 Float_t fH2parameter; // parameter to fit the efficiency
191 Float_t fKparameter; // sensitive edge (going ahead towards the
192 // center no delay effects are suffered) =1.0, new = 0.5 cm
193 Float_t fK2parameter; // parameter to fit the efficiency
194 // Pad Efficiency and Resolution parameters
195 Float_t fEffCenter; // efficiency in the central region of the pad
196 Float_t fEffBoundary; // efficiency at the boundary of the pad
197 Float_t fEff2Boundary; // efficiency value at H2parameter
198 Float_t fEff3Boundary; // efficiency value at K2parameter
199 Float_t fResCenter; // resolution (ps) in the central region of the pad
200 Float_t fResBoundary; // resolution (ps) at the boundary of the pad
201 Float_t fResSlope; // slope (ps/K) for neighbouring pad
202 // Time Walk parameters
203 Float_t fTimeWalkCenter; // time walk (ps) in the central region of the pad
204 Float_t fTimeWalkBoundary;// time walk (ps) at the boundary of the pad
205 Float_t fTimeWalkSlope; // slope (ps/K) for neighbouring pad
206 Int_t fTimeDelayFlag; // flag for delay due to the PulseHeightEffect
207 Float_t fPulseHeightSlope;// It determines the charge amount induced
208 // due to edge effect, using the formula
209 // qInduced=exp(-PulseHeightSlope*x)
210 Float_t fTimeDelaySlope; // It determines the time delay. This is the slope
211 // in the T1-T2 vs log(q1/q2) plot
212 // ADC-TDC correlation parameters
213 Float_t fMinimumCharge; // Minimum charge amount which could be induced
214 Float_t fChargeSmearing; // Smearing in charge in (q1/q2) vs x plot
215 Float_t fLogChargeSmearing;// Smearing in log of charge ratio
216 Float_t fTimeSmearing; // Smearing in time in time vs log(q1/q2) plot
217 Int_t fAverageTimeFlag; // flag (see the setter for details)
218 Int_t fChargeFactorForMatching; // if set to 1, during matching procedure
219 // probe hits are weighted according to
220 // the pulse height
221 Int_t fMatchingStyle; // Matching style option (see setter for details)
222
223 // TPC tracking parameters
224 Float_t fTrackingEfficiency; //tracking efficiency in the TPC 0.88
225 Float_t fSigmavsp; //!=0 - sigmas depend on momentum, SIGMA VS P
226 // =0 - sigmas do not depend on momentum
227 Float_t fSigmaZ; //sigma(z) (cm) 0.044, 0.03/P(GeV/c) -> av.0.083, see AN-97-39 table 2
228 Float_t fSigmarphi; //sigma(R(phi)) (cm) 0.023, 0.015/P(GeV/c) -> av.0.041, see AN-97-39 table 2
229 Float_t fSigmap; //sigma(delta(P)/P) 0.019, 0.01*(fabs((logP(GeV/c)+0.5)/0.7)**3+1.5) -> av.0.017
230 Float_t fSigmaPhi; //sigma(phi) (rad) 0.0050, 0.001*((1-logP(GeV/c))**3+0.3) for P<10 -> av.0.003
231 Float_t fSigmaTheta;//sigma(theta) (rad) 0.0035, 0.001*((1-logP(GeV/c))**3+0.3) for P<10 -> av.0.003
232
233 // Parameters for additional noise hits
234 Float_t fNoise; //number of noise hits 6600/7800 with/without the holes,
235 //7800-holes*1200 for V3.02(TDR), 11000-holes*1200 for V3.04
236 // 10000-holes*? for V3.05 with the half z-length 370 cm, for 350 cm
237 // it should be 5% less, 9500
238 //for the field 0.4 T: ? /6333 with/without the holes
239 //for the field 0.4 T: 8400 for V3.05
240 //for PYTHIA p+p at 14 TeV: 26 for V3.05
241 Float_t fNoiseSlope; //slope parameter (ns) in the time distribution of the add. noise hits: ~exp(-tau/NOISETAU)
242 Float_t fNoiseMeanTof; // mean value of the time of flight for noise from outer regions (ns)
243 Float_t fField; //magnetic field (tesla), 0.2 tesla = 2 kilogauss
244 Float_t fRadLenTPC; //radiation length of the outer wall of TPC, 0.03+0.14/0.03 with/out TRD
245 Float_t fCorrectionTRD; //!=0 px, py on the last row of TPC are corrected
246 // using x, y position on the last layer of TRD, see void correctionTRD()
247 //=0 without the correction
248 Int_t fLastTPCRow; //the number of the last TPC row 111 for V3.05
249 Float_t fRadiusvtxBound; //vertex radius (cm) for selected tracks
250 Int_t fMaxTestTracks; //max.number of test tracks 20
251 //for PYTHIA p+p at 14 TeV: 500
252 Float_t fStep; //space step (cm) along circle, shuold be < the pixel width YP=ZAZOR+2*DY=12.3*0.05=0.615
253 Int_t fMaxPixels; //max.number of pixels involved in the matching procedure, 70000
254 Int_t fMaxAllTracks; //max.number of all tracks including the neutral ones, 65000
255 Int_t fMaxTracks; //max.number of tracks selected for matching (hit on TPC with Rvtx<RVTXBOUND), 15000
256 Int_t fMaxTOFHits; //max.number of TOF hits per event, 35000
257 Float_t fPBound; //tracks/hits with P(GeV/c)<PBOUND do not take into account (kinematical cut)
258
259 protected:
260
261 ClassDef(AliTOFReconstructioner,1) // Task class for TOF reconstruction
262
263};
264
265#endif // AliTOFRECONSTRUCTIONER_H