]>
Commit | Line | Data |
---|---|---|
f49fde2a | 1 | //This script is a skeleton for RICH analisys. It consequently reads events in a givent set of directories and provides |
2 | //resulting RANA.root file in home directory which contains all the requested hists. | |
3 | #include <TCanvas.h> | |
4 | #include <TTree.h> | |
5 | #include <TH2F.h> | |
6 | #include <AliESD.h> | |
7 | #include <AliESDtrack.h> | |
8 | ||
9 | ||
10 | TH2F *pMassLen2; | |
11 | ||
12 | void HistBook() | |
13 | { | |
14 | pMassLen2=new TH2F("masslen","Particle mass versus track length;cm;GeV",200,0,600,200,0,1.2); | |
15 | } | |
16 | //__________________________________________________________________________________________________ | |
17 | void HistFill(AliESDtrack *pTrack) | |
18 | { | |
19 | pMassLen2->Fill(pTrack->GetIntegratedLength(),pTrack->GetMass()); | |
20 | ||
21 | } | |
22 | //__________________________________________________________________________________________________ | |
23 | void HistOut() | |
24 | { | |
25 | TCanvas *pC=new TCanvas("RICH analisys"); | |
26 | pMassLen2->Draw(); | |
27 | ||
28 | TFile outFile("~/RANA.root","RECREATE"); pC->Write(); outFile.Close(); | |
29 | } | |
30 | //__________________________________________________________________________________________________ | |
31 | void Analyse(char *sDirName) | |
32 | { | |
33 | //Analyse info from single directory | |
34 | ::Info("","Tring to open from %s",sDirName); | |
35 | TFile *pFile=TFile::Open(Form("%s/AliESDs.root",sDirName));if(!pFile || !pFile->IsOpen()) return;//open AliESDs.root | |
36 | TTree* pTree = (TTree*) pFile->Get("esdTree"); if(!pTree) return;//get ESD tree | |
37 | ||
38 | AliESD *pESD=new AliESD; pTree->SetBranchAddress("ESD", &pESD); | |
39 | ||
40 | Int_t iNevents=pTree->GetEntries(); //how many events in this given directory | |
41 | ::Info("","have %i events",iNevents); | |
42 | for(Int_t iEventN=0;iEventN<iNevents;iEventN++){//ESD events loop | |
43 | pTree->GetEvent(iEventN); | |
44 | Int_t iNtracks=pESD->GetNumberOfTracks(); | |
45 | for(Int_t iTrackN=0;iTrackN<iNtracks;iTrackN++){//ESD tracks loop | |
46 | HistFill(pESD->GetTrack(iTrackN)); | |
47 | }//ESD tracks loop | |
48 | }//ESD events loop | |
49 | ||
50 | delete pESD; pFile->Close();//close AliESDs.root | |
51 | } | |
52 | //__________________________________________________________________________________________________ | |
53 | void RichAna(Int_t iDirFirst=1,Int_t iDirLast=4) | |
54 | { | |
55 | // gBenchmark->Start("RICHanalisys"); | |
56 | ||
57 | HistBook(); | |
58 | ||
59 | for(Int_t iDirN=iDirFirst;iDirN<=iDirLast;iDirN++) Analyse(Form("Ev%04i",iDirN)); //analise for single directory | |
60 | ||
61 | HistOut(); | |
62 | ||
63 | // gBenchmark->Stop("RICHanalisys"); | |
64 | // gBenchmark->Show("RICHanalisys"); | |
65 | } |