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()
74 ////////////////////////////////////////////////////////////////////////
77 void AliJetDistributions::DefineHistograms()
79 // Define histograms to be used
80 fRetaH = new TH1F("fRetaH","Reconstructed eta",140,-1.2,1.2);
81 SetProperties(fRetaH,"#eta","entries");
82 fRphiH = new TH1F("fRphiH","Reconstructed phi",18,0,2.0*TMath::Pi());
83 SetProperties(fRphiH,"#phi","entries");
84 fRptH = new TH1F("fRptH","Reconstructed pt",150,0,150);
85 SetProperties(fRptH,"p_{T} (GeV/c)","entries");
87 fRetaphiH = new TH2F("fRetaphiH","Reconstructed eta vs. phi",140,-1.2,1.2,18,0.,2.0*TMath::Pi());
88 SetProperties(fRetaphiH,"#eta","#phi");
90 fMultH = new TH1F("fMultH","Reconstructed Multiplicity",1000,0,10000);
91 SetProperties(fMultH,"Multiplicity","entries");
94 void AliJetDistributions::SetProperties(TH1* h,const char* x, const char* y) const
96 // Properties of histograms (x title, y title and error propagation)
102 ////////////////////////////////////////////////////////////////////////
105 void AliJetDistributions::FillHistograms()
108 AliJetProductionDataPDC2004* runData = new AliJetProductionDataPDC2004();
112 for (Int_t iRun = fRunMin; iRun <= fRunMax; iRun++) {
114 sprintf(fn,"%s/%s.root",fDirectory,(runData->GetRunTitle(iRun)).Data());
115 jFile = new TFile(fn);
116 printf(" Analyzing run: %d %s\n", iRun,fn);
118 // Get reader header and events to be looped over
119 AliJetReaderHeader *jReaderH = (AliJetReaderHeader*)(jFile->Get(fReaderHeader));
120 if (fEventMin == -1) fEventMin = jReaderH->GetFirstEvent();
121 if (fEventMax == -1) {
122 fEventMax = jReaderH->GetLastEvent();
124 fEventMax = TMath::Min(fEventMax, jReaderH->GetLastEvent());
127 //AliUA1JetHeader *jH = (AliUA1JetHeader *) (jFile->Get("AliUA1JetHeader"));
128 //jH->PrintParameters();
132 for (Int_t i = fEventMin; i < fEventMax; i++) {
133 //printf(" Analyzing run: %d Event %d / %d \n",iRun, i, fEventMax);
135 // Get next tree with AliJet
137 sprintf(nameT, "TreeJ%d",i);
138 TTree *jetT =(TTree *)(jFile->Get(nameT));
139 if (fDoRecJ) jetT->SetBranchAddress("FoundJet", &fRecJ);
140 if (fDoGenJ) jetT->SetBranchAddress("GenJet", &fGenJ);
141 if (fDoPart) jetT->SetBranchAddress("LeadingPart", &fPart);
145 FillDistributions(fRecJ);
148 } // end loop over events in one file
149 if (jFile) jFile->Close();
151 } // end loop over files
154 void AliJetDistributions::FillDistributions(AliJet *j)
157 TArrayI inJet = j->GetInJet();
158 TArrayF etain = j->GetEtaIn();
159 TArrayF ptin = j->GetPtIn();
160 TArrayF phiin = j->GetPhiIn();
162 fMultH->Fill(inJet.GetSize(),1);
163 for(Int_t i=0;i<inJet.GetSize();i++) {
164 fRetaH->Fill(etain[i],1);
165 fRphiH->Fill(phiin[i],1);
166 fRptH->Fill(ptin[i],1);
167 fRetaphiH->Fill(etain[i],phiin[i],1);
171 ////////////////////////////////////////////////////////////////////////
174 void AliJetDistributions::PlotHistograms()
186 ////////////////////////////////////////////////////////////////////////
189 void AliJetDistributions::SaveHistograms()
192 TFile *fOut = new TFile(fFile,"recreate");
202 // main Analysis function
204 void AliJetDistributions::Analyze()