]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCtrackerParam.h
Digitization included into AliSimulation framework
[u/mrichter/AliRoot.git] / TPC / AliTPCtrackerParam.h
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                               */
5
6 /* $Id$ */
7
8
9 //-----------------------------------------------------------------------------
10 //                    TPC Tracking Parameterization Class
11 //
12 //   Origin: Andrea Dainese, Padova - e-mail: andrea.dainese@pd.infn.it
13 //
14 //
15 //
16 //-----------------------------------------------------------------------------
17
18 //----- Root headers ---------
19 #include <TMatrixD.h>
20 //---- AliRoot headers -------
21 //#include "alles.h"
22 #include "AliRun.h"
23 //#include "AliGausCorr.h"
24 //#include "AliMagF.h"
25 #include "AliTPCkineGrid.h"
26 #include "AliTPCtrack.h"
27 //#include "AliTrackReference.h"
28 //----------------------------
29
30 class AliTPC;
31
32 class AliTPCtrackerParam:
33   public TObject
34 {
35    
36   /////////////////////////////////////////////////////////////////////////
37   //                                                                        
38   // This class builds AliTPCtrack objects from generated tracks to feed    
39   // ITS tracking (V2). The AliTPCtrack is built from its first hit in      
40   // the TPC. The track is assigned a Kalman-like covariance matrix         
41   // depending on its pT and pseudorapidity and track parameters are        
42   // smeared according to this covariance matrix.                           
43   // Output file contains sorted tracks, ready for matching with ITS.        
44   //                                                                        
45   // See implementation file for more details.  
46   //                                  
47   //                                                                        
48   //  Origin: Andrea Dainese, Padova - e-mail: andrea.dainese@pd.infn.it     
49   //                                                                        
50   /////////////////////////////////////////////////////////////////////////
51  public:
52   AliTPCtrackerParam(Int_t coll=0, Double_t Bz=0.4, Int_t n=1,
53                      const char* evfoldname = AliConfig::GetDefaultEventFolderName());
54   virtual ~AliTPCtrackerParam();
55
56   // this function performs the parameterized tracking
57   //
58   AliTPCtrackerParam(const AliTPCtrackerParam& p);
59   //
60   Int_t BuildTPCtracks(const TFile *inp, TFile *out);
61   // these functions are used to create a DB of cov. matrices,
62   // including regularization, efficiencies and dE/dx
63   void  AllGeantTracks() { fSelAndSmear=kFALSE; return; }
64   void  AnalyzedEdx(const Char_t *outName,Int_t pdg);
65   void  AnalyzePulls(const Char_t *outName);
66   void  AnalyzeResolutions(Int_t pdg);
67   void  CompareTPCtracks(const Char_t *galiceName="galice.root",
68                          const Char_t *trkGeaName="AliTPCtracksGeant.root",
69                          const Char_t *trkKalName="AliTPCtracksSorted.root",
70                          const Char_t *covmatName="CovMatrix.root",
71                          const Char_t *tpceffasciiName="TPCeff.dat",
72                          const Char_t *tpceffrootName="TPCeff.root");
73   void  DrawEffs(const Char_t *inName,Int_t pdg=211);
74   void  DrawPulls(const Char_t *inName,Int_t pdg=211,Int_t par=0);
75   void  MakeDataBase();
76   void  MergeEvents(Int_t evFirst=1,Int_t evLast=1);
77   void  RegularizeCovMatrix(const Char_t *outName,Int_t pdg);
78
79
80   //********* Internal class definition *******
81   class AliTPCtrackParam : public AliTPCtrack {
82   public:
83     AliTPCtrackParam():AliTPCtrack(){}
84     AliTPCtrackParam(const AliTPCtrack &t):AliTPCtrack(t){}
85
86     void AssignMass(Double_t mass) {SetMass(mass); return;}
87     
88   private:
89
90   };
91   //********* end of internal class ***********
92
93   //********* Internal class definition *******
94   class AliTPCseedGeant : public TObject {
95   public:
96     AliTPCseedGeant(Double_t x=0.,Double_t y=0.,Double_t z=0.,
97                     Double_t px=0.,Double_t py=0.,Double_t pz=0.,
98                     Int_t lab=0);
99     Int_t    GetLabel() const { return fLabel; }
100     Double_t GetAlpha() const { return fAlpha; }      
101     Double_t GetXL() const 
102       { return fXg*TMath::Cos(fAlpha)+fYg*TMath::Sin(fAlpha); }
103     Double_t GetYL() const 
104       { return -fXg*TMath::Sin(fAlpha)+fYg*TMath::Cos(fAlpha); }
105     Double_t GetZL() const { return fZg; }
106     Double_t GetPx() const { return fPx; } 
107     Double_t GetPy() const { return fPy; } 
108     Double_t GetPz() const { return fPz; } 
109     Double_t GetPt() const { return TMath::Sqrt(fPx*fPx+fPy*fPy); }
110     Double_t GetEta() const 
111       { 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() const {
114       if(TMath::Abs(GetZL()+(244.-GetXL())*fPz/GetPt())>252.) return kFALSE;
115       return kTRUE;
116     }
117
118   private:
119     Double_t fXg;     // global x of seed 
120     Double_t fYg;     // global y of seed
121     Double_t fZg;     // global z of seed
122     Double_t fPx;     // global px
123     Double_t fPy;     // global py
124     Double_t fPz;     // global pz
125     Double_t fAlpha;  // alpha angle
126     Int_t    fLabel;  // track label
127     Int_t    fSector; // TPC sector
128   };
129   //******* end of internal class ****************
130   
131  private:
132   TString fEvFolderName;//! name of data folder
133
134   Int_t           fNevents;     // number of events in the file to be processed
135   Double_t        fBz;          // value of the z component of L3 field (Tesla)
136   Int_t           fColl;        // collision code (0: PbPb6000; 1: pp)
137   Bool_t          fSelAndSmear; // if kFALSE returns GEANT tracks 
138                                 // at TPC first hit 
139   TString         fDBfileName;  // DataBase file name
140   
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
149   AliTPCkineGrid  fDBgridPr; //               "                  for protons
150   AliTPCkineGrid  fDBgridEl; //               "                  for electrons
151   AliTPCkineGrid  fDBgridMu; //               "                  for muons
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
163   AliTPCkineGrid  fPullsPr[5]; //        "      protons
164   AliTPCkineGrid  fPullsEl[5]; //        "      electrons
165   AliTPCkineGrid  fPullsMu[5]; //        "      muons
166
167   TMatrixD       *fRegPar;     // regularization parameters for the curr. track
168   TMatrixD        fRegParPi;   //                  "        for pions         
169   TMatrixD        fRegParKa;   //                  "        for kaons
170   TMatrixD        fRegParPr;   //                  "        for protons
171   TMatrixD        fRegParEl;   //                  "        for electrons
172   TMatrixD        fRegParMu;   //                  "        for muons
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
179   AliTPCkineGrid  fdEdxMeanMu; //                "     muons
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
186   AliTPCkineGrid  fdEdxRMSMu;  //                "     muons
187
188
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;
192   void     CookdEdx(Double_t pt,Double_t eta);
193   void     CookTrack(Double_t pt,Double_t eta);
194   TMatrixD GetSmearingMatrix(Double_t *cc, Double_t pt,Double_t eta) const;
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;
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);
212   
213   
214   ClassDef(AliTPCtrackerParam,1) // TPC tracking parameterization class
215 };
216
217 #endif
218
219
220
221
222
223
224
225
226
227
228
229
230