1 void ReadACORDEHits (Int_t numberOfEvents=-1,
2 const char *filename="galice.root")
4 // produces some plots from acorde hits
7 // Dynamically link some shared libs
8 if (gClassTable->GetID("AliRun") < 0)
10 gROOT->LoadMacro("loadlibs.C");
15 delete gAlice->GetRunLoader();
22 AliRunLoader::Open("galice.root",
23 AliConfig::GetDefaultEventFolderName(),"read");
26 cerr<<"Can't load RunLoader from file! \n"; return 0x0;
30 gAlice = rl->GetAliRun();
33 cerr << " AliRun object not found on file \n"; return 0x0;
38 // Get the pointer to the ACORDE detector
39 AliLoader *acordel = rl->GetLoader("ACORDELoader");
40 AliACORDE *ACORDE = (AliACORDE *) gAlice->GetDetector("ACORDE");
41 if (ACORDE == 0x0 || acordel == 0x0) {
42 cerr << " Can not find ACORDE or ACORDELoader \n"; return 0x0;
45 // get number of events
46 if (numberOfEvents<0) numberOfEvents=(Int_t)(rl->GetNumberOfEvents());
49 TH1F *elossH = new TH1F("eloss" ,"Energy Loss ",1000,0.,10);
50 TH2F *geoH = new TH2F("geo"," ACORDE geometry seen by hits",
51 250, -750,750, 250, -500,500);
53 for (Int_t ievent=0; ievent<numberOfEvents; ievent++) {
54 if ((ievent%10) == 0) printf ("Processing event %d \n", ievent);
57 // Get the pointer Hit tree
59 TTree *hitTree = acordel->TreeH();
60 ACORDE->SetTreeAddress();
62 cout << " No TreeH found" << endl; return 0x0; //rc;
66 Int_t nTrack = (Int_t) hitTree->GetEntries();
68 // Start loop on tracks in the hits containers
69 for(Int_t iTrack=0; iTrack<nTrack;iTrack++){
71 hitTree->GetEvent(iTrack);
73 for(acordeHit=(AliACORDEhit*)ACORDE->FirstHit(-1);acordeHit;
74 acordeHit=(AliACORDEhit*)ACORDE->NextHit()) {
75 elossH->Fill( (Float_t)(acordeHit->Eloss()*1000.0));
76 geoH->Fill(acordeHit->X(),acordeHit->Z());
77 } // end for acordeHits
81 // save histos in a root file
82 TFile *fout = new TFile("ACORDE_hits.root","RECREATE");