]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/AliAnaGammaIsolCut.cxx
replace ANALYSIS_NEW by ANALYSIS
[u/mrichter/AliRoot.git] / PWG4 / AliAnaGammaIsolCut.cxx
CommitLineData
2d11ded3 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/* $Id$ */
16
17/* History of cvs commits:
18 *
19 * $Log$
2a1d8a29 20 * Revision 1.1 2007/01/25 17:24:20 schutz
21 * new class
22 *
2d11ded3 23 * Revision 1.1 2007/01/23 17:17:29 schutz
24 * New Gamma package
25 *
26 *
27 */
28
29//_________________________________________________________________________
30// Class for the analysis of gamma correlations (gamma-jet,
31// gamma-hadron and isolation cut.
32// This class makes isolation cut analysis for 2 IC methods
33//(cone pt sum and particle pt threshold), for different cone sizes
34//and pt thresholds
35//
36// Class created from old AliPHOSGammaJet
37// (see AliRoot versions previous Release 4-09)
38//
39//*-- Author: Gustavo Conesa (LNF-INFN)
40//////////////////////////////////////////////////////////////////////////////
41
42
43// --- ROOT system ---
44
45#include <TFile.h>
46#include <TParticle.h>
47#include <TH2.h>
48
49#include "AliAnaGammaIsolCut.h"
50#include "AliESD.h"
51#include "AliESDtrack.h"
52#include "AliESDCaloCluster.h"
53#include "Riostream.h"
54#include "AliLog.h"
55
56ClassImp(AliAnaGammaIsolCut)
57
58//____________________________________________________________________________
59 AliAnaGammaIsolCut::AliAnaGammaIsolCut(const char *name) :
60 AliAnaGammaDirect(name),
61 fOutputContainer(new TObjArray(100)),
62 fNCones(0),fNPtThres(0)
63{
64 //Ctor
65 TList * list = gDirectory->GetListOfKeys() ;
66 TIter next(list) ;
67 TH2F * h = 0 ;
68 Int_t index ;
69 for (index = 0 ; index < list->GetSize()-1 ; index++) {
70 //-1 to avoid GammaJet Task
71 h = dynamic_cast<TH2F*>(gDirectory->Get(list->At(index)->GetName())) ;
72 fOutputContainer->Add(h) ;
73 }
74
75 for(Int_t i = 0; i < 10 ; i++){
76 fConeSizes[i]=0;
77 fPtThresholds[i]=0;
78 }
79
80 // Input slot #0 works with an Ntuple
81 DefineInput(0, TChain::Class());
82 // Output slot #0 writes into a TH1 container
83 DefineOutput(0, TObjArray::Class()) ;
84
85}
86
87
88//____________________________________________________________________________
89AliAnaGammaIsolCut::AliAnaGammaIsolCut(const AliAnaGammaIsolCut & ic) :
90 AliAnaGammaDirect(ic),
91 fOutputContainer(ic. fOutputContainer),
92 fNCones(ic.fNCones),fNPtThres(ic.fNPtThres)
93{
94 // cpy ctor
95 SetName (ic.GetName()) ;
96 SetTitle(ic.GetTitle()) ;
97
98 for(Int_t i = 0; i < 10 ; i++){
99 fConeSizes[i]= ic.fConeSizes[i];
100 fPtThresholds[i]= ic.fPtThresholds[i];
101 }
102}
103
104//____________________________________________________________________________
105AliAnaGammaIsolCut::~AliAnaGammaIsolCut()
106{
107 // Remove all pointers
108 fOutputContainer->Clear() ;
109 delete fOutputContainer ;
110
111 delete fhPtCandidate ;
112 delete [] fhPtThresIsolated ;
113 delete [] fhPtSumIsolated ;
114
115}
116
2a1d8a29 117//______________________________________________________________________________
118void AliAnaGammaIsolCut::ConnectInputData(const Option_t*)
119{
120 // Initialisation of branch container and histograms
121 AliAnaGammaDirect::ConnectInputData("");
122
123}
124
125//____________________________________________________
126void AliAnaGammaIsolCut::CreateOutputObjects()
127{
128
129 // Init parameteres and create histograms to be saved in output file and
130 // stores them in fOutputContainer
131 InitParameters();
132
133 fOutputContainer = new TObjArray(100) ;
134
135 //Isolation cut histograms
136 fhPtCandidate = new TH1F
137 ("PtCandidate","p_{T} of candidate particles for isolation",240,0,120);
138 fhPtCandidate->SetXTitle("p_{T} (GeV/c)");
139 fOutputContainer->Add(fhPtCandidate) ;
140
141 char name[128];
142 char title[128];
143 for(Int_t icone = 0; icone<fNCones; icone++){
144 sprintf(name,"PtSumIsolated_Cone_%d",icone);
145 sprintf(title,"Candidate cone sum p_{T} for cone size %d vs candidate p_{T}",icone);
146 fhPtSumIsolated[icone] = new TH2F(name, title,240,0,120,120,0,10);
147 fhPtSumIsolated[icone]->SetYTitle("#Sigma p_{T} (GeV/c)");
148 fhPtSumIsolated[icone]->SetXTitle("p_{T} (GeV/c)");
149 fOutputContainer->Add(fhPtSumIsolated[icone]) ;
150
151 for(Int_t ipt = 0; ipt<fNPtThres;ipt++){
152 sprintf(name,"PtThresIsol_Cone_%d_Pt%d",icone,ipt);
153 sprintf(title,"Isolated candidate p_{T} distribution for cone size %d and p_{T}^{th} %d",icone,ipt);
154 fhPtThresIsolated[icone][ipt] = new TH1F(name, title,240,0,120);
155 fhPtThresIsolated[icone][ipt]->SetXTitle("p_{T} (GeV/c)");
156 fOutputContainer->Add(fhPtThresIsolated[icone][ipt]) ;
157 }//icone loop
158 }//ipt loop
2d11ded3 159
2a1d8a29 160}
2d11ded3 161
162//____________________________________________________________________________
163void AliAnaGammaIsolCut::Exec(Option_t *)
164{
165
166 // Processing of one event
2d11ded3 167 //Get ESDs
2a1d8a29 168
2d11ded3 169 Long64_t entry = GetChain()->GetReadEntry() ;
2d11ded3 170 if (!GetESD()) {
171 AliError("fESD is not connected to the input!") ;
172 return ;
173 }
2d11ded3 174 if (GetPrintInfo())
175 AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(GetChain()))->GetFile()->GetName(), entry)) ;
176
177 //CreateTLists with arrays of TParticles. Filled with particles only relevant for the analysis.
178
179 TClonesArray * particleList = new TClonesArray("TParticle",1000); // All particles refitted in CTS and detected in EMCAL (jet)
180 TClonesArray * plCTS = new TClonesArray("TParticle",1000); // All particles refitted in Central Tracking System (ITS+TPC)
181 TClonesArray * plNe = new TClonesArray("TParticle",1000); // All particles measured in Jet Calorimeter (EMCAL)
182 TClonesArray * plPHOS = new TClonesArray("TParticle",1000); // All particles measured in PHOS as Gamma calorimeter
183 TClonesArray * plEMCAL = new TClonesArray("TParticle",1000); // All particles measured in EMCAL as Gamma calorimeter
184
185
186 AliDebug(2, "Fill particle lists");
187
188 //Fill particle lists
189 CreateParticleList(particleList, plCTS,plEMCAL,plPHOS);
190
191 if(GetCalorimeter() == "PHOS")
192 plNe = plPHOS;
193 if(GetCalorimeter() == "EMCAL")
194 plNe = plEMCAL;
195
196 //Isolation Cut Analysis for both methods and different pt cuts and cones
197
198 for(Int_t ipr = 0; ipr < plNe->GetEntries() ; ipr ++ ){
199 TParticle * pCandidate = dynamic_cast<TParticle *>(plNe->At(ipr)) ;
200
201 if(pCandidate->Pt() > GetMinGammaPt()){
202
203 Bool_t icPtThres = kFALSE;
204 Bool_t icPtSum = kFALSE;
205
206 Float_t ptC = pCandidate->Pt() ;
207
208 fhPtCandidate->Fill(ptC);
209
210 for(Int_t icone = 0; icone<fNCones; icone++){
211 SetConeSize(fConeSizes[icone]) ;
212 Float_t coneptsum = 0 ;
213 for(Int_t ipt = 0; ipt<fNPtThres;ipt++){
214 SetPtThreshold(fPtThresholds[ipt]) ;
215 MakeIsolationCut(plCTS,plNe, pCandidate, ipr, icPtThres, icPtSum,coneptsum);
216 AliDebug(4,Form("Candidate pt %f, pt in cone %f, Isolated? ICPt %d, ICSum %d",
217 pCandidate->Pt(), coneptsum, icPtThres, icPtSum));
218
219 fhPtThresIsolated[icone][ipt]->Fill(ptC);
220 }//pt thresh loop
221 fhPtSumIsolated[icone]->Fill(ptC,coneptsum) ;
222 }//cone size loop
223 }//min pt candidate
224 }//candidate loop
225
226 AliDebug(2, "End of analysis, delete pointers");
227
228 particleList->Delete() ;
229 plCTS->Delete() ;
230 plNe->Delete() ;
231 plPHOS->Delete() ;
232 plEMCAL->Delete() ;
233
234 delete plNe ;
235 delete plCTS ;
236 //delete plPHOS ;
237 //delete plEMCAL ;
238 delete particleList ;
239
240 PostData(0, fOutputContainer);
241}
242
243 //____________________________________________________________________________
2a1d8a29 244void AliAnaGammaIsolCut::InitParameters()
2d11ded3 245{
246 // Initialisation of branch container
2a1d8a29 247 AliAnaGammaDirect::InitParameters();
2d11ded3 248
249 fNCones = 4 ;
250 fNPtThres = 4 ;
251 fConeSizes[0] = 0.1; fConeSizes[0] = 0.2; fConeSizes[2] = 0.3; fConeSizes[3] = 0.4;
252 fPtThresholds[0]=1.; fPtThresholds[0]=2.; fPtThresholds[0]=3.; fPtThresholds[0]=4.;
2d11ded3 253}
254
2d11ded3 255void AliAnaGammaIsolCut::Print(const Option_t * opt) const
256{
257
258 //Print some relevant parameters set for the analysis
259 if(! opt)
260 return;
261
262 Info("Print", "%s %s", GetName(), GetTitle() ) ;
263 printf("N Cone Sizes = %d\n", fNCones) ;
264 printf("N pT thresholds = %d\n", fNPtThres) ;
265 printf("Cone Sizes = \n") ;
266 for(Int_t i = 0; i < fNCones; i++)
267 printf(" %f;", fConeSizes[i]) ;
268 printf(" \n") ;
269 for(Int_t i = 0; i < fNPtThres; i++)
270 printf(" %f;", fPtThresholds[i]) ;
271 printf(" \n") ;
272
273}
274
275void AliAnaGammaIsolCut::Terminate(Option_t *)
276{
277 // The Terminate() function is the last function to be called during
278 // a query. It always runs on the client, it can be used to present
279 // the results graphically or save the results to file.
280
281}