1 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #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 // #########################################################
31 // setup galice and runloader
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 runLoader->LoadgAlice();
47 gAlice = runLoader->GetAliRun();
48 runLoader->LoadKinematics();
49 runLoader->LoadHeader();
51 // #########################################################
52 // open esd file and get the tree
54 // close it first to avoid memory leak
56 if (esdFile->IsOpen())
59 sprintf(str,"%s/AliESDs.root",dir);
60 esdFile = TFile::Open(str);
61 esdTree = (TTree*)esdFile->Get("esdTree");
62 TBranch * esdBranch = esdTree->GetBranch("ESD");
63 esdBranch->SetAddress(&esd);
66 // #########################################################
69 AliITS* its=(AliITS*)runLoader->GetAliRun()->GetDetector("ITS");
71 cout << " Can't get the ITS!" << endl;
74 AliITSgeom* itsGeo=its->GetITSgeom();
76 cout << " Can't get the ITS geometry!" << endl;
79 AliITSLoader* itsLoader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
81 cout << " Can't get the ITS loader!" << endl;
84 itsLoader->LoadRecPoints("read");
86 // #########################################################
87 AliITSMultReconstructor* multReco = new AliITSMultReconstructor();
88 multReco->SetGeometry(itsGeo);
90 // #########################################################
91 // getting number of events
93 Int_t nEvents = (Int_t)runLoader->GetNumberOfEvents();
94 Int_t nESDEvents = esdBranch->GetEntries();
96 if (nEvents!=nESDEvents) {
97 cout << " Different number of events from runloader and esdtree!!!"
98 << nEvents << " / " << nESDEvents << endl;
102 // ########################################################
103 // loop over number of events
104 cout << nEvents << " event(s) found in the file set" << endl;
105 for(Int_t i=0; i<nEvents; i++) {
107 cout << "-------------------------" << endl << " event# " << i << endl;
109 runLoader->GetEvent(i);
110 esdBranch->GetEntry(i);
112 // ########################################################
113 // get the EDS vertex
114 const AliESDVertex* vtxESD = esd->GetVertex();
122 ///#########################################################
124 TTree* itsClusterTree = itsLoader->TreeR();
125 if (!itsClusterTree) {
126 cerr<< " Can't get the ITS cluster tree !\n";
129 multReco->SetHistOn(kTRUE);
130 multReco->Reconstruct(itsClusterTree, esdVtx, esdVtx);
133 for (Int_t t=0; t<multReco->GetNTracklets(); t++) {
135 cout << " tracklet " << t
136 << " , theta = " << multReco->GetTracklet(t)[0]
137 << " , phi = " << multReco->GetTracklet(t)[1] << endl;
142 TFile* fout = new TFile("out.root","RECREATE");
144 multReco->SaveHists();