A bug corrected (from A. Dainese and M. Masera)
[u/mrichter/AliRoot.git] / TPC / AliTPCtrackingParamDB.C
CommitLineData
887eddf8 1/****************************************************************************
2 * This macro is used to create a DataBase for the TPC tracking *
3 * parameterization. *
4 * 1) the function CreateAllGeantTracks gives all tracks at the 1st hit of *
5 * the TPC *
6 * 2) the function TrackCompare compares them with track found by the *
7 * Kalman filter for the same event and computes efficiency and *
8 * resolution on the track parameters for the Kalman filter. *
9 * 3) the function BuildDataBase calls many functions of AliTPCtrackerParam:*
10 * - merge results from TrackCompare for many events and compute *
11 * average efficiency. *
12 * - analyze the pulls of the covariance matrix *
13 * - analyze the dE/dx *
14 * - regularize the covariance matrix as a function of the momentum *
15 * - write all the informations and the trees with regularized cov. *
16 * matrices in the DataBase file. *
17 * *
18 * Origin: A.Dainese, Padova, andrea.dainese@pd,infn.it *
19 * *
20 ****************************************************************************/
21
22#ifndef __CINT__
23#include <iostream.h>
24#include <TFile.h>
25#include <TStopwatch.h>
26#include <TObject.h>
27#include "alles.h"
28#include "AliRun.h"
29#include "AliHeader.h"
30#include "AliGenEventHeader.h"
31#include "AliMagF.h"
32#include "AliModule.h"
33#include "AliArrayI.h"
34#include "AliDigits.h"
35#include "AliITS.h"
36#include "AliTPC.h"
37#include "AliITSgeom.h"
38#include "AliITSRecPoint.h"
39#include "AliITSclusterV2.h"
40#include "AliITSsimulationFastPoints.h"
41#include "AliITStrackerV2.h"
42#include "AliKalmanTrack.h"
43#include "AliTPCtrackerParam.h"
44#endif
45
46void TPCParamTracks(const Char_t *galice,const Char_t *outname,const Int_t coll,const Double_t Bfield,Int_t n);
47void CreateAllGeantTracks(const Char_t *galice, const Char_t *outname,const Int_t coll,const Double_t Bfield,Int_t n);
48void TrackCompare(const Int_t coll,const Double_t Bfield);
49void BuildDataBase(const Int_t coll,const Double_t Bfield);
50
51void AliTPCtrackingParamDB(Int_t n=1) {
52
53 const Char_t *name=" AliTPCtrackingParamTest";
54 cerr<<'\n'<<name<<"...\n";
55 gBenchmark->Start(name);
56
57
58 const Char_t *TPCtrkName="AliTPCtracksParam.root";
59 const Char_t *TPCgeatrkName="AliTPCtracksGeant.root";
60 const Char_t *galiceName="galice.root";
61
62 // set here the code for the type of collision (needed for TPC tracking
63 // parameterization). available collisions:
64 //
65 // coll = 0 -> PbPb6000 (HIJING with b<2fm)
66 const Int_t collcode = 0;
67 // set here the value of the magnetic field
68 const Double_t BfieldValue = 0.4;
69
70 AliKalmanTrack::SetConvConst(100/0.299792458/BfieldValue);
71
72 // ********** Build TPC tracks with parameterization *********** //
73 TPCParamTracks(galiceName,TPCtrkName,collcode,BfieldValue,n);
74
75
76 // ********** Build All True TPC tracks *********** //
77 CreateAllGeantTracks(galiceName,TPCgeatrkName,collcode,BfieldValue,n);
78
79 // ********** Compare Kalman tracks with tracks at 1st hit *********** //
80 TrackCompare(collcode,BfieldValue);
81
82
83 // ********** Merge files, compute pulls, and dEdx *********** //
84 BuildDataBase(collcode,BfieldValue);
85
86
87
88
89 gBenchmark->Stop(name);
90 gBenchmark->Show(name);
91
92 return;
93}
94
95//_____________________________________________________________________________
96void TPCParamTracks(const Char_t *galice, const Char_t *outname,
97 const Int_t coll,const Double_t Bfield,Int_t n) {
98//
99// Ordinary TPC tracking parameterization
100//
101 cerr<<"\n*******************************************************************\n";
102
103 const Char_t *name="TPCParamTracks";
104 cerr<<'\n'<<name<<"...\n";
105 gBenchmark->Start(name);
106
107 TFile *outfile=TFile::Open(outname,"recreate");
108 TFile *infile =TFile::Open(galice);
109
110 AliTPCtrackerParam tracker(coll,Bfield);
111 tracker.BuildTPCtracks(infile,outfile,n);
112
113 delete gAlice; gAlice=0;
114
115 infile->Close();
116 outfile->Close();
117
118 gBenchmark->Stop(name);
119 gBenchmark->Show(name);
120
121 return;
122}
123//_____________________________________________________________________________
124void CreateAllGeantTracks(const Char_t *galice, const Char_t *outname,
125 const Int_t coll,const Double_t Bfield,Int_t n) {
126//
127// Get all tracks at TPC 1st hit w/o selection and smearing
128//
129 cerr<<"\n*******************************************************************\n";
130
131 const Char_t *name="CreateAllGeantTracks";
132 cerr<<'\n'<<name<<"...\n";
133 gBenchmark->Start(name);
134
135 TFile *outfile=TFile::Open(outname,"recreate");
136 TFile *infile =TFile::Open(galice);
137
138 AliTPCtrackerParam tracker(coll,Bfield);
139 tracker.AllGeantTracks(); // this is to switch-off selection and smearing
140 tracker.BuildTPCtracks(infile,outfile,n);
141
142 delete gAlice; gAlice=0;
143
144 infile->Close();
145 outfile->Close();
146
147 gBenchmark->Stop(name);
148 gBenchmark->Show(name);
149
150 return;
151}
152//_____________________________________________________________________________
153void TrackCompare(const Int_t coll,const Double_t Bfield) {
154//
155// Compare Kalman tracks with tracks at TPC 1st hit
156//
157 cerr<<"\n*******************************************************************\n";
158
159 const Char_t *name="TrackCompare";
160 cerr<<'\n'<<name<<"...\n";
161 gBenchmark->Start(name);
162
163 AliTPCtrackerParam tracker(coll,Bfield);
164 tracker.CompareTPCtracks();
165
166 gBenchmark->Stop(name);
167 gBenchmark->Show(name);
168
169 return;
170}
171//_____________________________________________________________________________
172void BuildDataBase(const Int_t coll,const Double_t Bfield) {
173//
174//
175//
176 cerr<<"\n*******************************************************************\n";
177
178 AliTPCtrackerParam tracker(coll,Bfield);
179
180 // Merge files with cov. matrix and compute average efficiencies
181 cerr<<"\n --- Merging Events ---\n\n";
182 tracker.MergeEvents(1,5);
183
184 // Compute the pulls for pions, kaons, electrons
185 cerr<<"\n --- Analyzing Pulls ---\n\n";
186 tracker.AnalyzePulls("pulls.root");
187
188 // Draw pulls and efficiencies
189 tracker.DrawPulls("CovMatrixDB_PbPb6000_B0.4T.root",211,0);
190 tracker.DrawEffs("CovMatrixDB_PbPb6000_B0.4T.root",13);
191
192 // Regularize the covariance matrix
193 tracker.RegularizeCovMatrix("regPi.root",211);
194
195 // Analyze the dE/dx
196 tracker.AnalyzedEdx("dEdxPi.root",211);
197
198
199 // Put everything together and create the DB file
200 tracker.MakeDataBase();
201
202 return;
203}
204
205
206
207
208
209
210