1 #if !defined(__CINT__) || defined(__MAKECINT__)
7 #include <TGeoManager.h>
9 #include "AliRunLoader.h"
13 #include "AliITSgeom.h"
14 #include "AliITSLoader.h"
15 #include "AliITSMultReconstructor.h"
19 void testITSMultReco(Char_t* dir = ".") {
23 // ########################################################
25 AliRunLoader* runLoader;
30 // #########################################################
34 delete gAlice->GetRunLoader();
39 sprintf(str,"%s/galice.root",dir);
40 runLoader = AliRunLoader::Open(str);
41 if (runLoader == 0x0) {
42 cout << "Can not open session"<<endl;
45 // get geometry (here geometry.root is used, change it if needed)
47 sprintf(str,"%s/geometry.root",dir);
48 TGeoManager::Import(str);
50 cout << "Can not access the geometry file"<<endl;
56 // #########################################################
57 // open esd file and get the tree
59 // close it first to avoid memory leak
61 if (esdFile->IsOpen())
64 sprintf(str,"%s/AliESDs.root",dir);
65 esdFile = TFile::Open(str);
66 esdTree = (TTree*)esdFile->Get("esdTree");
67 TBranch * esdBranch = esdTree->GetBranch("ESD");
68 esdBranch->SetAddress(&esd);
71 // #########################################################
74 AliITSLoader* itsLoader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
76 cout << " Can't get the ITS loader!" << endl;
79 AliITSgeom* itsGeo=itsLoader->GetITSgeom();
80 itsLoader->LoadRecPoints("read");
82 // #########################################################
83 AliITSMultReconstructor* multReco = new AliITSMultReconstructor();
84 multReco->SetGeometry(itsGeo);
86 // #########################################################
87 // getting number of events
89 Int_t nEvents = (Int_t)runLoader->GetNumberOfEvents();
90 Int_t nESDEvents = esdBranch->GetEntries();
92 if (nEvents!=nESDEvents) {
93 cout << " Different number of events from runloader and esdtree!!!"
94 << nEvents << " / " << nESDEvents << endl;
98 // ########################################################
99 // loop over number of events
100 cout << nEvents << " event(s) found in the file set" << endl;
101 for(Int_t i=0; i<nEvents; i++) {
103 cout << "-------------------------" << endl << " event# " << i << endl;
105 runLoader->GetEvent(i);
106 esdBranch->GetEntry(i);
108 // ########################################################
109 // get the EDS vertex
110 const AliESDVertex* vtxESD = esd->GetVertex();
118 ///#########################################################
120 TTree* itsClusterTree = itsLoader->TreeR();
121 if (!itsClusterTree) {
122 cerr<< " Can't get the ITS cluster tree !\n";
125 multReco->SetHistOn(kTRUE);
126 multReco->Reconstruct(itsClusterTree, esdVtx, esdVtx);
128 cout <<" >>>> Number of tracklets: "<<multReco->GetNTracklets()<<endl;
129 for (Int_t t=0; t<multReco->GetNTracklets(); t++) {
131 cout << " tracklet " << t
132 << " , theta = " << multReco->GetTracklet(t)[0]
133 << " , phi = " << multReco->GetTracklet(t)[1]
134 << " , DeltaPhi = " << multReco->GetTracklet(t)[2]<< endl;
136 cout <<" >>>> Number of single layer 1 clusters: "<<multReco->GetNSingleClusters()<<endl;
137 for (Int_t t=0; t<multReco->GetNSingleClusters(); t++) {
139 cout << " cluster " << t
140 << " , theta = " << multReco->GetCluster(t)[0]
141 << " , phi = " << multReco->GetCluster(t)[1] << endl;
146 TFile* fout = new TFile("out.root","RECREATE");
148 multReco->SaveHists();