1 //********************************************************************
2 // Example of the reconstruction that generates the ESD
4 // a) file containing the ITS clusters
5 // (the AliITSFindClustersV2.C macro can be used to generate it)
6 // b) file containing the TPC clusters
7 // (the AliTPCFindClusters.C macro can be used to generate it)
8 // c) file containing the TRD clusters
9 // (the AliTRDdigits2cluster.C macro can be used to generate it)
10 // d) file containing the TOF digits
11 // (the AliTOFSDigits2Digits.C macro can be used to generate it)
13 // AliESDs.root containing the ESD events
15 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
16 //********************************************************************
18 #if !defined(__CINT__) || defined(__MAKECINT__)
19 #include <Riostream.h>
22 #include "TStopwatch.h"
28 #include "AliRunLoader.h"
29 #include "AliLoader.h"
30 #include "AliHeader.h"
31 #include "AliGenEventHeader.h"
34 #include "AliESDpid.h"
37 #include "AliITSgeom.h"
38 #include "AliITStrackerV2.h"
39 #include "AliV0vertexer.h"
40 #include "AliCascadeVertexer.h"
41 #include "AliITSpidESD.h"
42 #include "AliITSLoader.h"
44 #include "AliTPCParam.h"
45 #include "AliTPCtracker.h"
46 #include "AliTPCpidESD.h"
47 #include "AliTPCLoader.h"
49 #include "AliTRDtracker.h"
50 #include "AliTRDPartID.h"
52 #include "AliTOFpidESD.h"
55 extern TSystem *gSystem;
56 extern AliRun *gAlice;
59 Int_t AliESDtest(Int_t nev=1,Int_t run=0) {
61 /**** Initialization of the NewIO *******/
64 delete gAlice->GetRunLoader();
69 gSystem->Load("libgeant321"); // needed for the PID in TOF
70 new TGeant3(""); // must be re-done !
72 AliRunLoader *rl = AliRunLoader::Open("galice.root");
74 cerr<<"Can not open session"<<endl;
77 Int_t retval = rl->LoadgAlice();
79 cerr<<"AliESDtest.C : LoadgAlice returned error"<<endl;
83 retval = rl->LoadHeader();
85 cerr<<"AliESDtest.C : LoadHeader returned error"<<endl;
89 gAlice=rl->GetAliRun();
92 AliKalmanTrack::SetConvConst(
93 1000/0.299792458/gAlice->Field()->SolenoidField()
97 /**** The ITS corner ********************/
99 AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
101 cerr<<"AliESDtest.C : Can not get the ITS loader"<<endl;
104 itsl->LoadRecPoints("read");
106 AliITS *dITS = (AliITS*)gAlice->GetDetector("ITS");
108 cerr<<"AliESDtest.C : Can not find the ITS detector !"<<endl;
111 AliITSgeom *geom = dITS->GetITSgeom();
113 //An instance of the ITS tracker
114 AliITStrackerV2 itsTracker(geom);
116 //An instance of the ITS PID maker
117 Double_t parITS[]={34.,0.15,10.};
118 AliITSpidESD itsPID(parITS);
120 //An instance of the V0 finder
121 Double_t cuts[]={33, // max. allowed chi2
122 0.16,// min. allowed negative daughter's impact parameter
123 0.05,// min. allowed positive daughter's impact parameter
124 0.080,// max. allowed DCA between the daughter tracks
125 0.998,// max. allowed cosine of V0's pointing angle
126 0.9, // min. radius of the fiducial volume
127 2.9 // max. radius of the fiducial volume
129 AliV0vertexer vtxer(cuts);
131 Double_t cts[]={33., // max. allowed chi2
132 0.05, // min. allowed V0 impact parameter
133 0.008, // window around the Lambda mass
134 0.035, // min. allowed bachelor's impact parameter
135 0.10, // max. allowed DCA between a V0 and a track
136 0.9985, //max. allowed cosine of the cascade pointing angle
137 0.9, // min. radius of the fiducial volume
138 2.9 // max. radius of the fiducial volume
140 AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
142 /**** The TPC corner ********************/
144 AliTPCLoader* tpcl = (AliTPCLoader*)rl->GetLoader("TPCLoader");
146 cerr<<"AliESDtest.C : can not get the TPC loader"<<endl;
149 tpcl->LoadRecPoints("read");
152 AliTPCParam *par=(AliTPCParam *)gDirectory->Get("75x40_100x60_150x60");
154 cerr<<"TPC parameters have not been found !\n";
158 //An instance of the TPC tracker
159 AliTPCtracker tpcTracker(par);
161 //An instance of the TPC PID maker
162 Double_t parTPC[]={47.,0.10,10.};
163 AliTPCpidESD tpcPID(parTPC);
166 /**** The TRD corner ********************/
168 AliLoader* trdl = rl->GetLoader("TRDLoader");
170 cerr<<"AliESDtest.C : can not get the TRD loader"<<endl;
173 trdl->LoadRecPoints("read");
175 //An instance of the TRD tracker
177 AliTRDtracker trdTracker(gFile); //galice.root file
180 //An instance of the TRD PID maker
181 TFile* pidFile = TFile::Open("pid.root");
182 if (!pidFile->IsOpen()) {
183 cerr << "Can't get pid.root !\n";
186 AliTRDPartID* trdPID = (AliTRDPartID*) pidFile->Get("AliTRDPartID");
188 cerr << "Can't get PID object !\n";
194 /**** The TOF corner ********************/
196 AliLoader* tofl = rl->GetLoader("TOFLoader");
198 cerr<<"AliESDtest.C : can not get the TOF loader"<<endl;
201 tofl->LoadDigits("read");
204 //Instance of the TOF PID maker
205 Double_t parTOF[]={130.,5.};
206 AliTOFpidESD tofPID(parTOF);
209 //rl->UnloadgAlice();
212 TFile *ef=TFile::Open("AliESDs.root","RECREATE");
213 if (!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
217 if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
218 //The loop over events
219 for (Int_t i=0; i<nev; i++) {
220 cerr<<"\n\nProcessing event number : "<<i<<endl;
221 AliESD *event=new AliESD();
222 event->SetRunNumber(run);
223 event->SetEventNumber(i);
227 //***** Primary vertex reconstruction (MC vertex position, for the moment)
229 rl->GetHeader()->GenEventHeader()->PrimaryVertex(v);
230 Double_t vtx[3]={v[0],v[1],v[2]};
236 event->SetVertex(vtx,cvtx);
237 cvtx[1]=cvtx[0]; cvtx[2]=cvtx[5]; //trackers use only the diag.elements
239 //***** Initial path towards the primary vertex
240 tpcTracker.SetVertex(vtx,cvtx);
241 TTree *tpcTree=tpcl->TreeR();
243 cerr<<"Can't get the TPC cluster tree !\n";
246 tpcTracker.LoadClusters(tpcTree);
247 rc+=tpcTracker.Clusters2Tracks(event);
249 itsTracker.SetVertex(vtx,cvtx);
250 TTree *itsTree=itsl->TreeR();
252 cerr<<"Can't get the ITS cluster tree !\n";
255 itsTracker.LoadClusters(itsTree);
256 rc+=itsTracker.Clusters2Tracks(event);
259 //***** Back propagation towards the outer barrel detectors
260 rc+=itsTracker.PropagateBack(event);
261 //itsPID.MakePID(event);
263 rc+=tpcTracker.PropagateBack(event);
264 tpcPID.MakePID(event);
266 TTree *trdTree=trdl->TreeR();
268 cerr<<"Can't get the TRD cluster tree !\n";
271 trdTracker.LoadClusters(trdTree);
272 rc+=trdTracker.PropagateBack(event);
274 for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++) {
275 AliESDtrack* track = event->GetTrack(iTrack);
276 trdPID->MakePID(track);
279 TTree *tofTree=tofl->TreeD();
281 cerr<<"Can't get the TOF cluster tree !\n";
284 tofPID.LoadClusters(tofTree);
285 tofPID.MakePID(event);
286 tofPID.UnloadClusters();
290 //***** Here is the combined PID
291 AliESDpid::MakePID(event);
295 //***** Now the final refit at the primary vertex...
296 rc+=trdTracker.RefitInward(event);
297 trdTracker.UnloadClusters();
299 rc+=tpcTracker.RefitInward(event);
300 tpcTracker.UnloadClusters();
302 rc+=itsTracker.RefitInward(event);
303 itsTracker.UnloadClusters();
307 //***** Hyperon reconstruction
308 vtxer.SetVertex(vtx);
309 rc+=vtxer.Tracks2V0vertices(event); // V0 finding
310 rc+=cvtxer.V0sTracks2CascadeVertices(event); // cascade finding
314 //***** Some final manipulations with this event
317 sprintf(ename,"%d",i);
319 if (!event->Write(ename)) rc++;
322 cerr<<"Something bad happened...\n";
326 timer.Stop(); timer.Print();