1 //********************************************************************
2 // Example of the reconstruction that generates the ESD
4 // a) AliTPCclusters.root containing the TPC clusters
5 // (the AliTPCFindClusters.C macro can be used to generate it)
6 // b) AliITSclustersV2.root containing the ITS clusters
7 // (the AliITSFindClustersV2.C macro can be used to generate it)
9 // AliESDs.root containing the ESD events
11 // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
12 //********************************************************************
15 #include <Riostream.h>
17 #include "TStopwatch.h"
20 #include "AliESDpid.h"
21 #include "AliTPCpidESD.h"
22 #include "AliTPCParam.h"
23 #include "AliTPCtracker.h"
24 #include "AliITSgeom.h"
25 #include "AliITStrackerV2.h"
26 #include "AliTRDtracker.h"
27 #include "AliTRDPartID.h"
28 #include "AliITSpidESD.h"
31 Int_t AliESDtest(Int_t nev=1,
32 const char* fileNameITSClusters = "its.clusters.root",
33 const char* fileNameTPCClusters = "tpc.clusters.root",
34 const char* fileNameTRDClusters = "trd.clusters.root") {
36 //File with the TPC clusters
37 TFile *tpccf=TFile::Open(fileNameTPCClusters);
38 if (!tpccf->IsOpen()) {
39 cerr<<"Can't open "<<fileNameTPCClusters<<" !\n";
42 AliTPCParam *par=(AliTPCParam*)tpccf->Get("75x40_100x60_150x60");
43 if (!par) {cerr<<"Can't get TPC parameters !\n"; return 3;}
45 //An instance of the TPC tracker
46 AliTPCtracker tpcTracker(par);
48 //An instance of the TPC PID maker
49 Double_t parTPC[]={47.,0.1,3.};
50 AliTPCpidESD tpcPID(parTPC);
52 //File with the ITS clusters
53 TFile *itscf=TFile::Open(fileNameITSClusters);
54 if (!itscf->IsOpen()) {
55 cerr<<"Can't open "<<fileNameITSClusters<<".root !\n";
58 AliITSgeom *geom=(AliITSgeom*)itscf->Get("AliITSgeom");
59 if (!geom) {cerr<<"Can't get AliITSgeom !\n"; return 5;}
61 //An instance of the ITS tracker
62 AliITStrackerV2 itsTracker(geom);
64 //An instance of the ITS PID maker
65 Double_t parITS[]={34.,0.12,3.};
66 AliITSpidESD itsPID(parITS);
68 //File with the TRD clusters
69 TFile *trdcf=TFile::Open(fileNameTRDClusters);
70 if (!trdcf->IsOpen()) {
71 cerr<<"Can't open "<<fileNameTRDClusters<<".root !\n";
75 //An instance of the TRD tracker
76 AliTRDtracker trdTracker(trdcf);
78 //An instance of the TRD PID maker
79 AliTRDPartID* trdPID = AliTRDPartID::GetFromFile();
80 if (!trdPID) return 7;
82 TFile *ef=TFile::Open("AliESDs.root","RECREATE");
83 if (!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
87 //The loop over events
88 for (Int_t i=0; i<nev; i++) {
89 cerr<<"\n\nProcessing event number : "<<i<<endl;
90 AliESD *event=new AliESD();
92 tpcTracker.SetEventNumber(i);
93 tpcTracker.LoadClusters(tpccf);
95 itsTracker.SetEventNumber(i);
96 itsTracker.LoadClusters(itscf);
98 rc+=tpcTracker.Clusters2Tracks(event);
100 rc+=itsTracker.Clusters2Tracks(event);
102 rc+=itsTracker.PropagateBack(event);
103 itsTracker.UnloadClusters();
105 itsPID.MakePID(event);
107 rc+=tpcTracker.PropagateBack(event);
108 tpcTracker.UnloadClusters();
110 tpcPID.MakePID(event);
112 trdTracker.SetEventNumber(i);
114 trdTracker.LoadClusters();
116 rc+=trdTracker.PropagateBack(event);
117 trdTracker.UnloadClusters();
119 for (Int_t iTrack = 0; iTrack < event->GetNumberOfTracks(); iTrack++) {
120 AliESDtrack* track = event->GetTrack(iTrack);
121 trdPID->MakePID(track);
124 //Here is the combined PID
125 AliESDpid::MakePID(event);
129 sprintf(ename,"%d",i);
131 if (!event->Write(ename)) rc++;
134 cerr<<"Something bad happened...\n";
138 timer.Stop(); timer.Print();