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
70 ////////////////////////////////////////////////////////////////////////
73 void AliJetDistributions::DefineHistograms()
75 // Define histograms to be used
76 fRetaH = new TH1F("fRetaH","Reconstructed eta",140,-1.2,1.2);
77 SetProperties(fRetaH,"#eta","entries");
78 fRphiH = new TH1F("fRphiH","Reconstructed phi",18,0,2.0*TMath::Pi());
79 SetProperties(fRphiH,"#phi","entries");
80 fRptH = new TH1F("fRptH","Reconstructed pt",150,0,150);
81 SetProperties(fRptH,"p_{T} (GeV/c)","entries");
83 fRetaphiH = new TH2F("fRetaphiH","Reconstructed eta vs. phi",140,-1.2,1.2,18,0.,2.0*TMath::Pi());
84 SetProperties(fRetaphiH,"#eta","#phi");
86 fMultH = new TH1F("fMultH","Reconstructed Multiplicity",1000,0,10000);
87 SetProperties(fMultH,"Multiplicity","entries");
90 void AliJetDistributions::SetProperties(TH1* h,const char* x, const char* y) const
92 // Properties of histograms (x title, y title and error propagation)
98 ////////////////////////////////////////////////////////////////////////
101 void AliJetDistributions::FillHistograms()
104 AliJetProductionDataPDC2004* runData = new AliJetProductionDataPDC2004();
108 for (Int_t iRun = fRunMin; iRun <= fRunMax; iRun++) {
110 sprintf(fn,"%s/%s.root",fDirectory,(runData->GetRunTitle(iRun)).Data());
111 jFile = new TFile(fn);
112 printf(" Analyzing run: %d %s\n", iRun,fn);
114 // Get reader header and events to be looped over
115 AliJetReaderHeader *jReaderH = (AliJetReaderHeader*)(jFile->Get(fReaderHeader));
116 if (fEventMin == -1) fEventMin = jReaderH->GetFirstEvent();
117 if (fEventMax == -1) {
118 fEventMax = jReaderH->GetLastEvent();
120 fEventMax = TMath::Min(fEventMax, jReaderH->GetLastEvent());
123 //AliUA1JetHeader *jH = (AliUA1JetHeader *) (jFile->Get("AliUA1JetHeader"));
124 //jH->PrintParameters();
128 for (Int_t i = fEventMin; i < fEventMax; i++) {
129 //printf(" Analyzing run: %d Event %d / %d \n",iRun, i, fEventMax);
131 // Get next tree with AliJet
133 sprintf(nameT, "TreeJ%d",i);
134 TTree *jetT =(TTree *)(jFile->Get(nameT));
135 if (fDoRecJ) jetT->SetBranchAddress("FoundJet", &fRecJ);
136 if (fDoGenJ) jetT->SetBranchAddress("GenJet", &fGenJ);
137 if (fDoPart) jetT->SetBranchAddress("LeadingPart", &fPart);
141 FillDistributions(fRecJ);
144 } // end loop over events in one file
145 if (jFile) jFile->Close();
147 } // end loop over files
150 void AliJetDistributions::FillDistributions(AliJet *j)
153 TArrayI inJet = j->GetInJet();
154 TArrayF etain = j->GetEtaIn();
155 TArrayF ptin = j->GetPtIn();
156 TArrayF phiin = j->GetPhiIn();
158 fMultH->Fill(inJet.GetSize(),1);
159 for(Int_t i=0;i<inJet.GetSize();i++) {
160 fRetaH->Fill(etain[i],1);
161 fRphiH->Fill(phiin[i],1);
162 fRptH->Fill(ptin[i],1);
163 fRetaphiH->Fill(etain[i],phiin[i],1);
167 ////////////////////////////////////////////////////////////////////////
170 void AliJetDistributions::PlotHistograms()
182 ////////////////////////////////////////////////////////////////////////
185 void AliJetDistributions::SaveHistograms()
188 TFile *fOut = new TFile(fFile,"recreate");
198 // main Analysis function
200 void AliJetDistributions::Analyze()