1 // The following macro runs the HLT ITS tracker over the HLT
2 // tracks stored in the ESD and stores the output tracks in a
3 // separate ESD file AliESDits.root
5 #if !defined(__CINT__) || defined(__MAKECINT__)
12 #include <TProfile2D.h>
14 #include <TGraphErrors.h>
16 #include <TParticle.h>
20 #include <TStopwatch.h>
24 #include "AliHeader.h"
25 #include "AliTrackReference.h"
26 #include "AliRunLoader.h"
28 #include "AliITSLoader.h"
29 #include "AliITSgeom.h"
30 #include "AliITStrackerV2.h"
33 #include "AliGenEventHeader.h"
35 #include "AliHLTITStrack.h"
36 #include "AliHLTITStracker.h"
37 #include "AliHLTITSVertexerZ.h"
40 //extern TSystem *gSystem;
42 Int_t RunHLTITS(Int_t nev=1,Int_t run=0) {
44 // gSystem->Load("libAliHLTITS.so");
50 delete gAlice->GetRunLoader();
55 AliRunLoader *rl = AliRunLoader::Open("galice.root");
57 cerr<<"Can not open session"<<endl;
60 Int_t retval = rl->LoadgAlice();
62 cerr<<"AliESDtest.C : LoadgAlice returned error"<<endl;
66 retval = rl->LoadHeader();
68 cerr<<"AliESDtest.C : LoadHeader returned error"<<endl;
72 gAlice=rl->GetAliRun();
74 AliTracker::SetFieldMap(gAlice->Field());
76 AliITSLoader* itsl = (AliITSLoader*)rl->GetLoader("ITSLoader");
78 cerr<<"AliESDtest.C : Can not get the ITS loader"<<endl;
81 itsl->LoadRecPoints("read");
83 AliITS *dITS = (AliITS*)gAlice->GetDetector("ITS");
85 cerr<<"AliESDtest.C : Can not find the ITS detector !"<<endl;
88 // AliITSgeom *geom = dITS->GetITSgeom();
89 AliITSgeom *geom = new AliITSgeom();
90 geom->ReadNewFile("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det");
92 //An instance of the HLT ITS tracker
93 AliHLTITStracker itsTracker(geom);
95 TFile *ef=TFile::Open("AliESDs.root");
96 if (!ef || !ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;}
97 AliESD* event = new AliESD;
98 TTree* tree = (TTree*) ef->Get("esdTree");
99 if (!tree) {cerr<<"no ESD tree found\n"; return 1;};
100 tree->SetBranchAddress("ESD", &event);
102 TFile *itsf=TFile::Open("AliESDits.root","RECREATE");
103 if ((!itsf)||(!itsf->IsOpen())) {
104 cerr<<"Can't AliESDits.root !\n"; return 1;
108 if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
109 //The loop over events
110 for (Int_t i=0; i<nev; i++) {
112 cerr<<"\n\nProcessing event number : "<<i<<endl;
117 rl->GetHeader()->GenEventHeader()->PrimaryVertex(v);
118 Double_t vtx[3]={v[0],v[1],v[2]};
119 Double_t cvtx[3]={0.005,0.005,0.010};
120 cout<<"MC vertex position: "<<v[2]<<endl;
122 AliHLTITSVertexerZ vertexer("null");
123 AliESDVertex* vertex = NULL;
126 TTree* treeClusters = itsl->TreeR();
127 // vertex = vertexer.FindVertexForCurrentEvent(i);
128 // AliESDVertex *vertex = vertexer.FindVertexForCurrentEvent(geom,treeClusters);
129 vertex = new AliESDVertex(vtx,cvtx);
133 cerr<<"Vertex not found"<<endl;
134 vertex = new AliESDVertex(vtx,cvtx);
137 vertex->SetTruePos(vtx); // store also the vertex from MC
140 event->SetVertex(vertex);
144 vertex->GetXYZ(vtxPos);
145 vertex->GetSigmaXYZ(vtxErr);
146 itsTracker.SetVertex(vtxPos,vtxErr);
148 TTree *itsTree=itsl->TreeR();
150 cerr<<"Can't get the ITS cluster tree !\n";
153 itsTracker.LoadClusters(itsTree);
154 rc+=itsTracker.Clusters2Tracks(event);
155 // rc+=itsTracker.PropagateBack(event);
156 itsTracker.UnloadClusters();
159 TTree* tree = new TTree("esdTree", "Tree with ESD objects");
160 tree->Branch("ESD", "AliESD", &event);
166 cerr<<"Something bad happened...\n";