Compatibility with ROOT trunk
[u/mrichter/AliRoot.git] / JETAN / AliJetHistos.cxx
CommitLineData
22003a60 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18#include <TList.h>
19#include <TClonesArray.h>
20#include <TH1I.h>
21#include <TH1F.h>
22#include <TMath.h>
23
24#include "AliAODJet.h"
25#include "AliJetHistos.h"
26
27ClassImp(AliJetHistos)
28
29AliJetHistos::AliJetHistos():
30 fNJetsH(0x0),
31 fPtH(0x0),
32 fEtaH(0x0),
33 fEneH(0x0),
34 fPhiH(0x0)
35{
36 // Default constructor
37
38 fNJetsH = new TH1I("NJetsH","Number of Jets",12,0,11);
39 SetProperties(fNJetsH,"Number of jets","Entries");
40
41 fPtH = new TH1F("PtH","Pt of Jets",50,0.,200.);
42 SetProperties(fPtH,"P_{#perp} [GeV]","Entries");
43
44 fEtaH = new TH1F("EtaH","Pseudorapidity of Jets",30,-1.5,1.5);
45 SetProperties(fEtaH,"#eta","Entries");
46
47 fEneH = new TH1F("EneH","Energy of Jets",50,0.,200.);
48 SetProperties(fEneH,"Energy [GeV]","Entries");
49
50 fPhiH = new TH1F("PhiH","Azimuthal angle of Jets",
51 60,0.,2.0*TMath::Pi());
52 SetProperties(fPhiH,"#phi","Entries");
53}
54
55AliJetHistos::~AliJetHistos()
56{
1240edf5 57// Destructor
22003a60 58 delete fNJetsH;
59 delete fPtH;
60 delete fEtaH;
61 delete fEneH;
62 delete fPhiH;
63}
64
65void AliJetHistos::SetProperties(TH1* h,const char* x, const char* y) const
66{
67// Sets the histogram style properties
68 h->SetMarkerStyle(20);
69 h->SetMarkerSize(.5);
70 h->SetMarkerColor(2);
71 h->SetXTitle(x);
72 h->SetYTitle(y);
73 h->Sumw2();
74}
75
76void AliJetHistos::AddHistosToList(TList *list)
77{
1240edf5 78// Add histos to the list
22003a60 79 list->Add(fNJetsH);
80 list->Add(fPtH);
81 list->Add(fEtaH);
82 list->Add(fEneH);
83 list->Add(fPhiH);
84}
85
86
87void AliJetHistos::FillHistos(TClonesArray *jets)
88{
1240edf5 89// Fill histograms
8bca421f 90 if(!jets)return;
22003a60 91 Int_t nj = jets->GetEntries();
92 fNJetsH->Fill(nj,1);
93
94 if (nj == 0 ) return;
95
96 AliAODJet *j;
97 for (Int_t i=0;i<nj;i++) {
98 j = (AliAODJet *) jets->At(i);
99 fPtH->Fill(j->Pt(),1);
100 fEtaH->Fill(j->Eta(),1);
101 fEneH->Fill(j->E(),1);
102 fPhiH->Fill(j->Phi(),1);
103 }
104
105}