]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCtrackingParamDB.C
ZDC automatic scripts updates (Marco Leoncino) + updates in QA config
[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__
b2bca9d4 23#include "Riostream.h"
887eddf8 24#include <TFile.h>
a654e257 25#include <TTree.h>
887eddf8 26#include <TStopwatch.h>
27#include <TObject.h>
28#include "alles.h"
29#include "AliRun.h"
30#include "AliHeader.h"
31#include "AliGenEventHeader.h"
32#include "AliMagF.h"
33#include "AliModule.h"
34#include "AliArrayI.h"
35#include "AliDigits.h"
36#include "AliITS.h"
37#include "AliTPC.h"
38#include "AliITSgeom.h"
39#include "AliITSRecPoint.h"
40#include "AliITSclusterV2.h"
41#include "AliITSsimulationFastPoints.h"
42#include "AliITStrackerV2.h"
43#include "AliKalmanTrack.h"
44#include "AliTPCtrackerParam.h"
a654e257 45#include "AliTracker.h"
46#include "AliESD.h"
47#include "AliRun.h"
48#include "AliRunLoader.h"
887eddf8 49#endif
50
a654e257 51Int_t TPCParamTracks(const Int_t coll=1,Int_t firstEvent=0,Int_t lastEvent=0);
52void CreateAllGeantTracks(const Int_t coll=1,Int_t nev=1);
b2bca9d4 53void TrackCompare(const Int_t coll,const Double_t Bfield,Int_t n);
887eddf8 54void BuildDataBase(const Int_t coll,const Double_t Bfield);
55
887eddf8 56//_____________________________________________________________________________
a654e257 57Int_t TPCParamTracks(const Int_t coll,Int_t firstEvent,Int_t lastEvent) {
887eddf8 58//
59// Ordinary TPC tracking parameterization
60//
887eddf8 61
a654e257 62 /**** Initialization of the NewIO *******/
63
64 if (gAlice) {
33c3c91a 65 delete AliRunLoader::Instance();
a654e257 66 delete gAlice;
67 gAlice=0;
68 }
69
70 AliRunLoader *rl = AliRunLoader::Open("galice.root");
71 if (rl == 0x0) {
72 cerr<<"Can not open session"<<endl;
73 return;
74 }
75 Int_t retval = rl->LoadgAlice();
76 if (retval) {
77 cerr<<"LoadgAlice returned error"<<endl;
78 delete rl;
79 return;
80 }
81 retval = rl->LoadHeader();
82 if (retval) {
83 cerr<<"LoadHeader returned error"<<endl;
84 delete rl;
85 return;
86 }
87 gAlice=rl->GetAliRun();
88
89
90 TDatabasePDG *DataBase = TDatabasePDG::Instance();
91
92 // Get field from galice.root
f7a1cc68 93 AliMagF *fiel = TGeoGlobalMagField::Instance()->GetField();
a654e257 94 Double_t fieval=TMath::Abs((Double_t)fiel->SolenoidField()/10.);
a654e257 95
96 /**** The TPC corner ********************/
97
98 AliTPCtrackerParam tpcTrackerPar(coll,fieval);
99 tpcTrackerPar.Init();
100
101 /***** The TREE is born *****/
102
103 TTree *esdTree=new TTree("esdTree","Tree with ESD objects");
104 AliESD *event=0;
105 esdTree->Branch("ESD","AliESD",&event);
106
107 if(firstEvent>rl->GetNumberOfEvents()) firstEvent=rl->GetNumberOfEvents()-1;
108 if(lastEvent>rl->GetNumberOfEvents()) lastEvent=rl->GetNumberOfEvents()-1;
109 cout<<" Number of events: "<<1+lastEvent-firstEvent<<endl;
110
111 //<----------------------------------The Loop over events begins
112 TStopwatch timer;
113 Int_t trc;
114 for(Int_t i=firstEvent; i<=lastEvent; i++) {
115
116 cerr<<" Processing event number : "<<i<<endl;
117 AliESD *event = new AliESD();
118 event->SetRunNumber(gAlice->GetRunNumber());
119 event->SetEventNumber(i);
120 event->SetMagneticField(gAlice->Field()->SolenoidField());
121 rl->GetEvent(i);
122
123 if ( (trc=tpcTrackerPar.BuildTPCtracks(event)) ) {
124 printf("exiting tracker with code %d in event %d\n",trc,i);
125 esdTree->Fill(); delete event;
126 continue;
127 }
128
129 esdTree->Fill();
130 delete event;
131
132 }//<-----------------------------------The Loop over events ends here
133 timer.Stop(); timer.Print();
134
135 // The AliESDs.root is born
136 TFile *ef = TFile::Open("AliESDs.root","RECREATE");
137 if (!ef || !ef->IsOpen()) {cerr<<"Can't open AliESDs.root !\n"; return;}
138
139 esdTree->Write(); //Write the TREE and close everything
140 delete esdTree;
141 ef->Close();
142
143 delete rl;
144
145 return;
887eddf8 146}
147//_____________________________________________________________________________
a654e257 148void CreateAllGeantTracks(const Int_t coll,Int_t nev) {
887eddf8 149//
150// Get all tracks at TPC 1st hit w/o selection and smearing
151//
152 cerr<<"\n*******************************************************************\n";
153
154 const Char_t *name="CreateAllGeantTracks";
155 cerr<<'\n'<<name<<"...\n";
156 gBenchmark->Start(name);
157
158 TFile *outfile=TFile::Open(outname,"recreate");
159 TFile *infile =TFile::Open(galice);
160
b2bca9d4 161 AliTPCtrackerParam tracker(coll,Bfield,n);
887eddf8 162 tracker.AllGeantTracks(); // this is to switch-off selection and smearing
b2bca9d4 163 tracker.BuildTPCtracks(infile,outfile);
887eddf8 164
165 delete gAlice; gAlice=0;
166
167 infile->Close();
168 outfile->Close();
169
170 gBenchmark->Stop(name);
171 gBenchmark->Show(name);
172
173 return;
174}
175//_____________________________________________________________________________
b2bca9d4 176void TrackCompare(const Int_t coll,const Double_t Bfield,Int_t n) {
887eddf8 177//
178// Compare Kalman tracks with tracks at TPC 1st hit
179//
180 cerr<<"\n*******************************************************************\n";
181
182 const Char_t *name="TrackCompare";
183 cerr<<'\n'<<name<<"...\n";
184 gBenchmark->Start(name);
185
b2bca9d4 186 AliTPCtrackerParam tracker(coll,Bfield,n);
887eddf8 187 tracker.CompareTPCtracks();
188
189 gBenchmark->Stop(name);
190 gBenchmark->Show(name);
191
192 return;
193}
194//_____________________________________________________________________________
195void BuildDataBase(const Int_t coll,const Double_t Bfield) {
196//
197//
198//
199 cerr<<"\n*******************************************************************\n";
200
201 AliTPCtrackerParam tracker(coll,Bfield);
202
203 // Merge files with cov. matrix and compute average efficiencies
204 cerr<<"\n --- Merging Events ---\n\n";
205 tracker.MergeEvents(1,5);
206
207 // Compute the pulls for pions, kaons, electrons
208 cerr<<"\n --- Analyzing Pulls ---\n\n";
209 tracker.AnalyzePulls("pulls.root");
210
211 // Draw pulls and efficiencies
212 tracker.DrawPulls("CovMatrixDB_PbPb6000_B0.4T.root",211,0);
213 tracker.DrawEffs("CovMatrixDB_PbPb6000_B0.4T.root",13);
214
215 // Regularize the covariance matrix
216 tracker.RegularizeCovMatrix("regPi.root",211);
217
218 // Analyze the dE/dx
219 tracker.AnalyzedEdx("dEdxPi.root",211);
220
221
222 // Put everything together and create the DB file
223 tracker.MakeDataBase();
224
225 return;
226}
227
228
229
230
231
232
233