1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //---------------------------------------------------------------------
17 // JetDistributions class
18 // Get different basic distributions
19 // Authors: mercedes.lopez.noriega@cern.ch
20 //---------------------------------------------------------------------
22 #include "AliJetDistributions.h"
23 ClassImp(AliJetDistributions)
25 ////////////////////////////////////////////////////////////////////////
27 #include <Riostream.h>
34 #include "AliJetProductionDataPDC2004.h"
36 #include "AliJetKineReaderHeader.h"
37 #include "AliJetESDReaderHeader.h"
38 #include "AliLeading.h"
40 ////////////////////////////////////////////////////////////////////////
41 // constructor/destructor
43 AliJetDistributions::AliJetDistributions():
66 // Default constructor
72 ////////////////////////////////////////////////////////////////////////
75 void AliJetDistributions::DefineHistograms()
77 // Define histograms to be used
78 fRetaH = new TH1F("fRetaH","Reconstructed eta",140,-1.2,1.2);
79 SetProperties(fRetaH,"#eta","entries");
80 fRphiH = new TH1F("fRphiH","Reconstructed phi",18,0,2.0*TMath::Pi());
81 SetProperties(fRphiH,"#phi","entries");
82 fRptH = new TH1F("fRptH","Reconstructed pt",150,0,150);
83 SetProperties(fRptH,"p_{T} (GeV/c)","entries");
85 fRetaphiH = new TH2F("fRetaphiH","Reconstructed eta vs. phi",140,-1.2,1.2,18,0.,2.0*TMath::Pi());
86 SetProperties(fRetaphiH,"#eta","#phi");
88 fMultH = new TH1F("fMultH","Reconstructed Multiplicity",1000,0,10000);
89 SetProperties(fMultH,"Multiplicity","entries");
92 void AliJetDistributions::SetProperties(TH1* h,const char* x, const char* y) const
94 // Properties of histograms (x title, y title and error propagation)
100 ////////////////////////////////////////////////////////////////////////
103 void AliJetDistributions::FillHistograms()
106 AliJetProductionDataPDC2004* runData = new AliJetProductionDataPDC2004();
110 for (Int_t iRun = fRunMin; iRun <= fRunMax; iRun++) {
112 sprintf(fn,"%s/%s.root",fDirectory,(runData->GetRunTitle(iRun)).Data());
113 jFile = new TFile(fn);
114 printf(" Analyzing run: %d %s\n", iRun,fn);
116 // Get reader header and events to be looped over
117 AliJetReaderHeader *jReaderH = (AliJetReaderHeader*)(jFile->Get(fReaderHeader));
118 if (fEventMin == -1) fEventMin = jReaderH->GetFirstEvent();
119 if (fEventMax == -1) {
120 fEventMax = jReaderH->GetLastEvent();
122 fEventMax = TMath::Min(fEventMax, jReaderH->GetLastEvent());
125 //AliUA1JetHeader *jH = (AliUA1JetHeader *) (jFile->Get("AliUA1JetHeader"));
126 //jH->PrintParameters();
130 for (Int_t i = fEventMin; i < fEventMax; i++) {
131 //printf(" Analyzing run: %d Event %d / %d \n",iRun, i, fEventMax);
133 // Get next tree with AliJet
135 sprintf(nameT, "TreeJ%d",i);
136 TTree *jetT =(TTree *)(jFile->Get(nameT));
137 if (fDoRecJ) jetT->SetBranchAddress("FoundJet", &fRecJ);
138 if (fDoGenJ) jetT->SetBranchAddress("GenJet", &fGenJ);
139 if (fDoPart) jetT->SetBranchAddress("LeadingPart", &fPart);
143 FillDistributions(fRecJ);
146 } // end loop over events in one file
147 if (jFile) jFile->Close();
149 } // end loop over files
152 void AliJetDistributions::FillDistributions(AliJet *j)
155 TArrayI inJet = j->GetInJet();
156 TArrayF etain = j->GetEtaIn();
157 TArrayF ptin = j->GetPtIn();
158 TArrayF phiin = j->GetPhiIn();
160 fMultH->Fill(inJet.GetSize(),1);
161 for(Int_t i=0;i<inJet.GetSize();i++) {
162 fRetaH->Fill(etain[i],1);
163 fRphiH->Fill(phiin[i],1);
164 fRptH->Fill(ptin[i],1);
165 fRetaphiH->Fill(etain[i],phiin[i],1);
169 ////////////////////////////////////////////////////////////////////////
172 void AliJetDistributions::PlotHistograms()
184 ////////////////////////////////////////////////////////////////////////
187 void AliJetDistributions::SaveHistograms()
190 TFile *fOut = new TFile(fFile,"recreate");
200 // main Analysis function
202 void AliJetDistributions::Analyze()