1 #if !defined(__CINT__) || defined(__MAKECINT__)
6 #include <TGeoManager.h>
8 #include "AliRunLoader.h"
10 #include "AliESDEvent.h"
12 #include "AliITSLoader.h"
13 #include "AliITSMultReconstructor.h"
14 #include "AliGeomManager.h"
18 void testITSMultReco(Char_t* dir = ".") {
23 AliRunLoader* runLoader;
25 AliESDEvent* esd = new AliESDEvent();
30 delete AliRunLoader::Instance();
35 sprintf(fileName,"%s/galice.root",dir);
36 runLoader = AliRunLoader::Open(fileName);
37 /* if (runLoader == 0x0) {
38 cout << "Can not open session"<<endl;
42 // get geometry (here geometry.root is used, change it if needed)
44 sprintf(fileName,"%s/geometry.root",dir);
45 AliGeomManager::LoadGeometry(fileName);
48 // open the ESD file and get the tree
50 sprintf(fileName,"%s/AliESDs.root",dir);
51 TFile esdFile(fileName, "READ");
52 esdTree = (TTree*)esdFile.Get("esdTree");
53 esd->ReadFromTree(esdTree);
57 AliITSLoader* itsLoader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
59 cout << " Can't get the ITS loader!" << endl;
62 itsLoader->LoadRecPoints("read");
64 AliITSMultReconstructor* multReco = new AliITSMultReconstructor();
65 // multReco->SetGeometry(itsGeo);
67 // getting number of events
69 Int_t nEvents = (Int_t)runLoader->GetNumberOfEvents();
70 Int_t nESDEvents = esdTree->GetEntries();
72 if (nEvents!=nESDEvents) {
73 cout << " Different number of events from runloader and esdtree!!!"
74 << nEvents << " / " << nESDEvents << endl;
78 // loop over number of events
79 cout << nEvents << " event(s) found in the file set" << endl;
80 for (Int_t iEv=0; iEv<nEvents; ++iEv) {
82 cout << "-------------------------" << endl << " event# " << iEv << endl;
84 runLoader->GetEvent(iEv);
85 esdTree->GetEvent(iEv);
89 const AliESDVertex* vtxESD = esd->GetVertex();
96 // cout<<"vertex Z->"<<esdVtx[2]<<endl;
100 TTree* itsClusterTree = itsLoader->TreeR();
101 if (!itsClusterTree) {
102 cerr<< " Can't get the ITS cluster tree !\n";
106 multReco->SetHistOn(kTRUE);
107 multReco->Reconstruct(itsClusterTree, esdVtx, esdVtx);
109 cout <<"Number of tracklets: "<<multReco->GetNTracklets()<<endl;
110 for (Int_t itr=0; itr<multReco->GetNTracklets(); itr++) {
112 cout << " tracklet " << itr
113 << " , theta = " << multReco->GetTracklet(itr)[0]
114 << " , phi = " << multReco->GetTracklet(itr)[1]
115 << " , DeltaPhi = " << multReco->GetTracklet(itr)[2]<< endl;
119 cout <<"Number of single clusters (inner layer): "<<multReco->GetNSingleClusters()<<endl;
120 for (Int_t iscl=0; iscl<multReco->GetNSingleClusters(); iscl++) {
122 cout << " cluster " << iscl
123 << " , theta = " << multReco->GetCluster(iscl)[0]
124 << " , phi = " << multReco->GetCluster(iscl)[1] << endl;
129 TFile* fout = new TFile("out.root","RECREATE");
131 multReco->SaveHists();