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 "AliJetReaderHeader.h"
37 #include "AliLeading.h"
39 ////////////////////////////////////////////////////////////////////////
40 // constructor/destructor
42 AliJetDistributions::AliJetDistributions():
65 // Default constructor
71 ////////////////////////////////////////////////////////////////////////
74 void AliJetDistributions::DefineHistograms()
76 // Define histograms to be used
77 fRetaH = new TH1F("fRetaH","Reconstructed eta",140,-1.2,1.2);
78 SetProperties(fRetaH,"#eta","entries");
79 fRphiH = new TH1F("fRphiH","Reconstructed phi",18,0,2.0*TMath::Pi());
80 SetProperties(fRphiH,"#phi","entries");
81 fRptH = new TH1F("fRptH","Reconstructed pt",150,0,150);
82 SetProperties(fRptH,"p_{T} (GeV/c)","entries");
84 fRetaphiH = new TH2F("fRetaphiH","Reconstructed eta vs. phi",140,-1.2,1.2,18,0.,2.0*TMath::Pi());
85 SetProperties(fRetaphiH,"#eta","#phi");
87 fMultH = new TH1F("fMultH","Reconstructed Multiplicity",1000,0,10000);
88 SetProperties(fMultH,"Multiplicity","entries");
91 void AliJetDistributions::SetProperties(TH1* h,const char* x, const char* y) const
93 // Properties of histograms (x title, y title and error propagation)
99 ////////////////////////////////////////////////////////////////////////
102 void AliJetDistributions::FillHistograms()
105 AliJetProductionDataPDC2004* runData = new AliJetProductionDataPDC2004();
109 for (Int_t iRun = fRunMin; iRun <= fRunMax; iRun++) {
111 sprintf(fn,"%s/%s.root",fDirectory,(runData->GetRunTitle(iRun)).Data());
112 jFile = new TFile(fn);
113 printf(" Analyzing run: %d %s\n", iRun,fn);
115 // Get reader header and events to be looped over
116 AliJetReaderHeader *jReaderH = (AliJetReaderHeader*)(jFile->Get(fReaderHeader));
117 if (fEventMin == -1) fEventMin = jReaderH->GetFirstEvent();
118 if (fEventMax == -1) {
119 fEventMax = jReaderH->GetLastEvent();
121 fEventMax = TMath::Min(fEventMax, jReaderH->GetLastEvent());
124 //AliUA1JetHeader *jH = (AliUA1JetHeader *) (jFile->Get("AliUA1JetHeader"));
125 //jH->PrintParameters();
129 for (Int_t i = fEventMin; i < fEventMax; i++) {
130 //printf(" Analyzing run: %d Event %d / %d \n",iRun, i, fEventMax);
132 // Get next tree with AliJet
134 sprintf(nameT, "TreeJ%d",i);
135 TTree *jetT =(TTree *)(jFile->Get(nameT));
136 if (fDoRecJ) jetT->SetBranchAddress("FoundJet", &fRecJ);
137 if (fDoGenJ) jetT->SetBranchAddress("GenJet", &fGenJ);
138 if (fDoPart) jetT->SetBranchAddress("LeadingPart", &fPart);
142 FillDistributions(fRecJ);
145 } // end loop over events in one file
146 if (jFile) jFile->Close();
148 } // end loop over files
151 void AliJetDistributions::FillDistributions(AliJet *j)
154 TArrayI inJet = j->GetInJet();
155 TArrayF etain = j->GetEtaIn();
156 TArrayF ptin = j->GetPtIn();
157 TArrayF phiin = j->GetPhiIn();
159 fMultH->Fill(inJet.GetSize(),1);
160 for(Int_t i=0;i<inJet.GetSize();i++) {
161 fRetaH->Fill(etain[i],1);
162 fRphiH->Fill(phiin[i],1);
163 fRptH->Fill(ptin[i],1);
164 fRetaphiH->Fill(etain[i],phiin[i],1);
168 ////////////////////////////////////////////////////////////////////////
171 void AliJetDistributions::PlotHistograms()
183 ////////////////////////////////////////////////////////////////////////
186 void AliJetDistributions::SaveHistograms()
189 TFile *fOut = new TFile(fFile,"recreate");
199 // main Analysis function
201 void AliJetDistributions::Analyze()