Transition to NewIO
[u/mrichter/AliRoot.git] / TPC / AliTPCtrackerParam.h
CommitLineData
6eb67451 1#ifndef ALITPCTRACKERPARAM_H
2#define ALITPCTRACKERPARAM_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
4/* See cxx source for full Copyright notice */
c68184b6 5
6/* $Id$ */
7
8
6eb67451 9//-----------------------------------------------------------------------------
10// TPC Tracking Parameterization Class
11//
12// Origin: Andrea Dainese, Padova - e-mail: andrea.dainese@pd.infn.it
13//-----------------------------------------------------------------------------
b2bca9d4 14
15//----- Root headers ---------
6eb69b9a 16#include <TMatrixD.h>
b2bca9d4 17//---- AliRoot headers -------
6eb67451 18#include "alles.h"
70521312 19#include "AliGausCorr.h"
6eb69b9a 20#include "AliMagF.h"
21#include "AliTPCkineGrid.h"
6eb67451 22#include "AliTPCtrack.h"
b2bca9d4 23#include "AliTrackReference.h"
24//----------------------------
6eb67451 25
26class AliTPCtrackerParam {
6eb69b9a 27 /////////////////////////////////////////////////////////////////////////
28 //
29 // This class builds AliTPCtrack objects from generated tracks to feed
30 // ITS tracking (V2). The AliTPCtrack is built from its first hit in
31 // the TPC. The track is assigned a Kalman-like covariance matrix
32 // depending on its pT and pseudorapidity and track parameters are
33 // smeared according to this covariance matrix.
34 // Output file contains sorted tracks, ready for matching with ITS.
35 //
b2bca9d4 36 // See implementation file for more details.
37 //
6eb69b9a 38 //
39 // Origin: Andrea Dainese, Padova - e-mail: andrea.dainese@pd.infn.it
40 //
41 /////////////////////////////////////////////////////////////////////////
6eb67451 42 public:
88cb7938 43 AliTPCtrackerParam(const Int_t coll=0,const Double_t Bz=0.4,const Int_t n=1,
44 const char* evfoldname = AliConfig::fgkDefaultEventFolderName);
6eb67451 45 virtual ~AliTPCtrackerParam();
46
6eb69b9a 47 // this function performs the parameterized tracking
b2bca9d4 48 Int_t BuildTPCtracks(const TFile *inp, TFile *out);
6eb67451 49
6eb69b9a 50 // these functions are used to create a DB of cov. matrices,
51 // including regularization, efficiencies and dE/dx
52 void AllGeantTracks() { fSelAndSmear=kFALSE; return; }
53 void AnalyzedEdx(const Char_t *outName,Int_t pdg);
54 void AnalyzePulls(const Char_t *outName);
b2bca9d4 55 void AnalyzeResolutions(Int_t pdg);
6eb69b9a 56 void CompareTPCtracks(const Char_t *galiceName="galice.root",
57 const Char_t *trkGeaName="AliTPCtracksGeant.root",
58 const Char_t *trkKalName="AliTPCtracksSorted.root",
59 const Char_t *covmatName="CovMatrix.root",
b2bca9d4 60 const Char_t *tpceffasciiName="TPCeff.dat",
61 const Char_t *tpceffrootName="TPCeff.root");
6eb69b9a 62 void DrawEffs(const Char_t *inName,Int_t pdg=211);
63 void DrawPulls(const Char_t *inName,Int_t pdg=211,Int_t par=0);
64 void MakeDataBase();
65 void MergeEvents(Int_t evFirst=1,Int_t evLast=1);
66 void RegularizeCovMatrix(const Char_t *outName,Int_t pdg);
67
b2bca9d4 68
69 //********* Internal class definition *******
6eb69b9a 70 class AliTPCtrackParam : public AliTPCtrack {
71 public:
72 AliTPCtrackParam():AliTPCtrack(){}
73 AliTPCtrackParam(const AliTPCtrack &t):AliTPCtrack(t){}
74
75 void AssignMass(Double_t mass) {SetMass(mass); return;}
76
77 private:
b2bca9d4 78
6eb69b9a 79 };
b2bca9d4 80 //********* end of internal class ***********
6eb67451 81
b2bca9d4 82 //********* Internal class definition *******
83 class AliTPCseedGeant : public TObject {
84 public:
85 AliTPCseedGeant(Double_t x,Double_t y,Double_t z,
86 Double_t px,Double_t py,Double_t pz,
87 Int_t lab) {
88 fXg = x;
89 fYg = y;
90 fZg = z;
91 fPx = px;
92 fPy = py;
93 fPz = pz;
94 fLabel = lab;
95 Double_t a = TMath::ATan2(y,x)*180./TMath::Pi();
96 if(a<0) a += 360.;
97 fSector = (Int_t)(a/20.);
98 fAlpha = 10.+20.*fSector;
99 fAlpha /= 180.;
100 fAlpha *= TMath::Pi();
101 }
102 Int_t GetLabel() { return fLabel; }
103 Double_t GetAlpha() { return fAlpha; }
104 Double_t GetXL() { return fXg*TMath::Cos(fAlpha)+fYg*TMath::Sin(fAlpha); }
105 Double_t GetYL() { return -fXg*TMath::Sin(fAlpha)+fYg*TMath::Cos(fAlpha); }
106 Double_t GetZL() { return fZg; }
107 Double_t GetPx() { return fPx; }
108 Double_t GetPy() { return fPy; }
109 Double_t GetPz() { return fPz; }
110 Double_t GetPt() { return TMath::Sqrt(fPx*fPx+fPy*fPy); }
111 Double_t GetEta() { return -TMath::Log(TMath::Tan(0.25*TMath::Pi()-0.5*TMath::ATan(fPz/GetPt()))); }
112 void SetLabel(Int_t lab) { fLabel=lab; return; }
113 Bool_t InTPCAcceptance() {
114 if(TMath::Abs(GetZL()+(244.-GetXL())*fPz/GetPt())>252.) return kFALSE;
115 return kTRUE;
116 }
117
118 private:
119 Double_t fXg;
120 Double_t fYg;
121 Double_t fZg;
122 Double_t fPx;
123 Double_t fPy;
124 Double_t fPz;
125 Double_t fAlpha;
126 Int_t fLabel;
127 Int_t fSector;
128 };
129 //******* end of internal class ****************
130
6eb69b9a 131 private:
88cb7938 132 TString fEvFolderName;//! name of data folder
133
b2bca9d4 134 Int_t fNevents; // number of events in the file to be processed
6eb69b9a 135 Double_t fBz; // value of the z component of L3 field (Tesla)
b2bca9d4 136 Int_t fColl; // collision code (0: PbPb6000; 1: pp)
6eb69b9a 137 Bool_t fSelAndSmear; // if kFALSE returns GEANT tracks
138 // at TPC first hit
139 TString fDBfileName; // DataBase file name
6eb67451 140
6eb69b9a 141 AliTPCtrack fTrack; // current track
142
143 TTree *fCovTree; // tree with regularized cov matrices
144 // for the current track
145
146 AliTPCkineGrid *fDBgrid; // grid for the cov matrix look-up table
147 AliTPCkineGrid fDBgridPi; // " for pions
148 AliTPCkineGrid fDBgridKa; // " for kaons
b2bca9d4 149 AliTPCkineGrid fDBgridPr; // " for protons
6eb69b9a 150 AliTPCkineGrid fDBgridEl; // " for electrons
b2bca9d4 151 AliTPCkineGrid fDBgridMu; // " for muons
6eb69b9a 152
153 AliTPCkineGrid *fEff; // TPC efficiencies for the current track
154 AliTPCkineGrid fEffPi; // " pions
155 AliTPCkineGrid fEffKa; // " kaons
156 AliTPCkineGrid fEffPr; // " protons
157 AliTPCkineGrid fEffEl; // " electrons
158 AliTPCkineGrid fEffMu; // " muons
159
160 AliTPCkineGrid *fPulls; // pulls for the current track
161 AliTPCkineGrid fPullsPi[5]; // " pions
162 AliTPCkineGrid fPullsKa[5]; // " muons
b2bca9d4 163 AliTPCkineGrid fPullsPr[5]; // " protons
6eb69b9a 164 AliTPCkineGrid fPullsEl[5]; // " electrons
b2bca9d4 165 AliTPCkineGrid fPullsMu[5]; // " muons
6eb69b9a 166
167 TMatrixD *fRegPar; // regularization parameters for the curr. track
168 TMatrixD fRegParPi; // " for pions
169 TMatrixD fRegParKa; // " for kaons
b2bca9d4 170 TMatrixD fRegParPr; // " for protons
6eb69b9a 171 TMatrixD fRegParEl; // " for electrons
b2bca9d4 172 TMatrixD fRegParMu; // " for muons
6eb69b9a 173
174 AliTPCkineGrid *fdEdxMean; // dEdx mean for the current track
175 AliTPCkineGrid fdEdxMeanPi; // " pions
176 AliTPCkineGrid fdEdxMeanKa; // " kaons
177 AliTPCkineGrid fdEdxMeanPr; // " protons
178 AliTPCkineGrid fdEdxMeanEl; // " electrons
b2bca9d4 179 AliTPCkineGrid fdEdxMeanMu; // " muons
6eb69b9a 180
181 AliTPCkineGrid *fdEdxRMS; // dEdx RMS for the current track
182 AliTPCkineGrid fdEdxRMSPi; // " pions
183 AliTPCkineGrid fdEdxRMSKa; // " kaons
184 AliTPCkineGrid fdEdxRMSPr; // " protons
185 AliTPCkineGrid fdEdxRMSEl; // " electrons
b2bca9d4 186 AliTPCkineGrid fdEdxRMSMu; // " muons
6eb69b9a 187
188
b2bca9d4 189 void BuildTrack(AliTPCseedGeant *s,Int_t ch);
190 Int_t CheckLabel(AliTPCseedGeant *s,Int_t nPart,
191 Double_t *ptkine,Double_t *pzkine) const;
6eb69b9a 192 void CookdEdx(Double_t pt,Double_t eta);
193 void CookTrack(Double_t pt,Double_t eta);
6eb69b9a 194 TMatrixD GetSmearingMatrix(Double_t *cc, Double_t pt,Double_t eta) const;
b2bca9d4 195 void InitializeKineGrid(Option_t *which);
196 void MakeSeedsFromHits(AliTPC *TPC,TTree *TH,TObjArray &seedArray) const;
197 void MakeSeedsFromRefs(TTree *TTR,
198 TObjArray &seedArray) const;
6eb69b9a 199 Int_t ReadAllData(const Char_t *inName);
200 Int_t ReadDBgrid(const Char_t *inName);
201 Int_t ReaddEdx(const Char_t *inName,Int_t pdg);
202 Int_t ReadEffs(const Char_t *inName);
203 Int_t ReadPulls(const Char_t *inName);
204 Int_t ReadRegParams(const Char_t *inName,Int_t pdg);
205 Bool_t SelectedTrack(Double_t pt, Double_t eta) const;
206 void SetParticle(Int_t pdg);
207 void SmearTrack(Double_t *xx,Double_t *xxsm,TMatrixD cov) const;
208 Int_t WritedEdx(const Char_t *outName,Int_t pdg);
209 Int_t WriteEffs(const Char_t *outName);
210 Int_t WritePulls(const Char_t *outName);
211 Int_t WriteRegParams(const Char_t *outName,Int_t pdg);
6eb67451 212
213
e130146c 214 ClassDef(AliTPCtrackerParam,1) // TPC tracking parameterization class
6eb67451 215};
216
217#endif
218
219
6eb69b9a 220
221
222
223
224
225
226
227
228
229
230