]>
Commit | Line | Data |
---|---|---|
1 | //******************************************************************** | |
2 | // Example (very basic for the moment) of the data analysis | |
3 | // using the ESD classes | |
4 | // | |
5 | // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch | |
6 | //******************************************************************** | |
7 | ||
8 | #ifndef __CINT__ | |
9 | #include <Riostream.h> | |
10 | #include "TKey.h" | |
11 | #include "TFile.h" | |
12 | #include "TH2F.h" | |
13 | #include "TCanvas.h" | |
14 | #include "TStopwatch.h" | |
15 | ||
16 | #include "AliESD.h" | |
17 | #endif | |
18 | ||
19 | Int_t AliESDanalysis(Int_t nev=1) { | |
20 | TH2F *tpcHist=new TH2F("tpcHist","dE/dX vs momentum",50,0.,2.,50,0.,400.); | |
21 | TH2F *itsHist=new TH2F("itsHits","dE/dX vs momentum",50,0.,2.,50,0.,200.); | |
22 | ||
23 | TFile *ef=TFile::Open("AliESDs.root"); | |
24 | if (!ef->IsOpen()) {cerr<<"Can't AliESDs.root !\n"; return 1;} | |
25 | ||
26 | TStopwatch timer; | |
27 | Int_t rc=0,n=0; | |
28 | TKey *key=0; | |
29 | TIter next(ef->GetListOfKeys()); | |
30 | ||
31 | //******* The loop over events | |
32 | while ((key=(TKey*)next())!=0) { | |
33 | cerr<<"Processing event number : "<<n++<<endl; | |
34 | AliESD *event=(AliESD*)key->ReadObj(); | |
35 | ||
36 | Int_t ntrk=event->GetNumberOfTracks(); | |
37 | cerr<<"Number of ESD tracks : "<<ntrk<<endl; | |
38 | //****** The loop over tracks | |
39 | while (ntrk--) { | |
40 | AliESDtrack *t=event->GetTrack(ntrk); | |
41 | Double_t p=t->GetP(); | |
42 | if (t->GetStatus()&AliESDtrack::kTPCin) { | |
43 | Double_t dedx=t->GetTPCsignal(); | |
44 | tpcHist->Fill(p,dedx,1); | |
45 | } | |
46 | if (t->GetStatus()&AliESDtrack::kITSin) { | |
47 | Double_t dedx=t->GetITSsignal(); | |
48 | itsHist->Fill(p,dedx,1); | |
49 | } | |
50 | } | |
51 | delete event; | |
52 | } | |
53 | timer.Stop(); timer.Print(); | |
54 | ||
55 | TCanvas *c1=new TCanvas("c1","",0,0,600,1200); | |
56 | c1->Divide(1,2); | |
57 | ||
58 | c1->cd(1); | |
59 | tpcHist->Draw(); | |
60 | c1->cd(2); | |
61 | itsHist->Draw(); | |
62 | ||
63 | ef->Close(); | |
64 | ||
65 | return rc; | |
66 | } |