1 /****************************************************************************
2 * This macro is used to create a DataBase for the TPC tracking *
4 * 1) the function CreateAllGeantTracks gives all tracks at the 1st hit of *
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. *
18 * Origin: A.Dainese, Padova, andrea.dainese@pd,infn.it *
20 ****************************************************************************/
23 #include "Riostream.h"
26 #include <TStopwatch.h>
30 #include "AliHeader.h"
31 #include "AliGenEventHeader.h"
33 #include "AliModule.h"
34 #include "AliArrayI.h"
35 #include "AliDigits.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"
45 #include "AliTracker.h"
48 #include "AliRunLoader.h"
51 Int_t TPCParamTracks(const Int_t coll=1,Int_t firstEvent=0,Int_t lastEvent=0);
52 void CreateAllGeantTracks(const Int_t coll=1,Int_t nev=1);
53 void TrackCompare(const Int_t coll,const Double_t Bfield,Int_t n);
54 void BuildDataBase(const Int_t coll,const Double_t Bfield);
56 //_____________________________________________________________________________
57 Int_t TPCParamTracks(const Int_t coll,Int_t firstEvent,Int_t lastEvent) {
59 // Ordinary TPC tracking parameterization
62 /**** Initialization of the NewIO *******/
65 delete AliRunLoader::Instance();
70 AliRunLoader *rl = AliRunLoader::Open("galice.root");
72 cerr<<"Can not open session"<<endl;
75 Int_t retval = rl->LoadgAlice();
77 cerr<<"LoadgAlice returned error"<<endl;
81 retval = rl->LoadHeader();
83 cerr<<"LoadHeader returned error"<<endl;
87 gAlice=rl->GetAliRun();
90 TDatabasePDG *DataBase = TDatabasePDG::Instance();
92 // Get field from galice.root
93 AliMagF *fiel = TGeoGlobalMagField::Instance()->GetField();
94 Double_t fieval=TMath::Abs((Double_t)fiel->SolenoidField()/10.);
96 /**** The TPC corner ********************/
98 AliTPCtrackerParam tpcTrackerPar(coll,fieval);
101 /***** The TREE is born *****/
103 TTree *esdTree=new TTree("esdTree","Tree with ESD objects");
105 esdTree->Branch("ESD","AliESD",&event);
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;
111 //<----------------------------------The Loop over events begins
114 for(Int_t i=firstEvent; i<=lastEvent; i++) {
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());
123 if ( (trc=tpcTrackerPar.BuildTPCtracks(event)) ) {
124 printf("exiting tracker with code %d in event %d\n",trc,i);
125 esdTree->Fill(); delete event;
132 }//<-----------------------------------The Loop over events ends here
133 timer.Stop(); timer.Print();
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;}
139 esdTree->Write(); //Write the TREE and close everything
147 //_____________________________________________________________________________
148 void CreateAllGeantTracks(const Int_t coll,Int_t nev) {
150 // Get all tracks at TPC 1st hit w/o selection and smearing
152 cerr<<"\n*******************************************************************\n";
154 const Char_t *name="CreateAllGeantTracks";
155 cerr<<'\n'<<name<<"...\n";
156 gBenchmark->Start(name);
158 TFile *outfile=TFile::Open(outname,"recreate");
159 TFile *infile =TFile::Open(galice);
161 AliTPCtrackerParam tracker(coll,Bfield,n);
162 tracker.AllGeantTracks(); // this is to switch-off selection and smearing
163 tracker.BuildTPCtracks(infile,outfile);
165 delete gAlice; gAlice=0;
170 gBenchmark->Stop(name);
171 gBenchmark->Show(name);
175 //_____________________________________________________________________________
176 void TrackCompare(const Int_t coll,const Double_t Bfield,Int_t n) {
178 // Compare Kalman tracks with tracks at TPC 1st hit
180 cerr<<"\n*******************************************************************\n";
182 const Char_t *name="TrackCompare";
183 cerr<<'\n'<<name<<"...\n";
184 gBenchmark->Start(name);
186 AliTPCtrackerParam tracker(coll,Bfield,n);
187 tracker.CompareTPCtracks();
189 gBenchmark->Stop(name);
190 gBenchmark->Show(name);
194 //_____________________________________________________________________________
195 void BuildDataBase(const Int_t coll,const Double_t Bfield) {
199 cerr<<"\n*******************************************************************\n";
201 AliTPCtrackerParam tracker(coll,Bfield);
203 // Merge files with cov. matrix and compute average efficiencies
204 cerr<<"\n --- Merging Events ---\n\n";
205 tracker.MergeEvents(1,5);
207 // Compute the pulls for pions, kaons, electrons
208 cerr<<"\n --- Analyzing Pulls ---\n\n";
209 tracker.AnalyzePulls("pulls.root");
211 // Draw pulls and efficiencies
212 tracker.DrawPulls("CovMatrixDB_PbPb6000_B0.4T.root",211,0);
213 tracker.DrawEffs("CovMatrixDB_PbPb6000_B0.4T.root",13);
215 // Regularize the covariance matrix
216 tracker.RegularizeCovMatrix("regPi.root",211);
219 tracker.AnalyzedEdx("dEdxPi.root",211);
222 // Put everything together and create the DB file
223 tracker.MakeDataBase();