]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/AliAnaGamma.cxx
coding conventions, compilation warnings, code cleanup
[u/mrichter/AliRoot.git] / PWG4 / AliAnaGamma.cxx
CommitLineData
bdcfac30 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$
20 * Revision 1.1.2.1 2007/07/26 10:32:09 schutz
21 * new analysis classes in the the new analysis framework
22 *
23 *
24 */
25
26//_________________________________________________________________________
27// Base class for prompt gamma and correlation analysis
28//*-- Author: Gustavo Conesa (INFN-LNF)
29
30// --- ROOT system ---
31
32#include <TParticle.h>
33#include <TH2.h>
34
35//---- AliRoot system ----
36#include "AliAnaGamma.h"
37#include "AliGammaReader.h"
38#include "AliAnaGammaDirect.h"
39#include "AliAnaGammaCorrelation.h"
40#include "AliNeutralMesonSelection.h"
41#include "Riostream.h"
42#include "AliLog.h"
43
44ClassImp(AliAnaGamma)
45
46
47//____________________________________________________________________________
48 AliAnaGamma::AliAnaGamma() :
49 TObject(),
50 fOutputContainer(0x0),
51 fAnaType(0), fCalorimeter(0), fData(0x0), fKine(0x0),
52 fReader(0x0), fGammaDirect(0x0), fGammaCorrelation(0x0),
53 fNeutralMesonSelection(0x0)
54{
55 //Default Ctor
56
57 //Initialize parameters, pointers and histograms
58 if(!fReader)
59 fReader = new AliGammaReader();
60 if(!fGammaDirect)
61 fGammaDirect = new AliAnaGammaDirect();
62 if(!fGammaCorrelation)
63 fGammaCorrelation = new AliAnaGammaCorrelation();
64 if(!fNeutralMesonSelection)
65 fNeutralMesonSelection = new AliNeutralMesonSelection();
66
67 InitParameters();
68
69}
70
71//____________________________________________________________________________
72AliAnaGamma::AliAnaGamma(const AliAnaGamma & g) :
73 TObject(),
74 fOutputContainer(g. fOutputContainer),
75 fAnaType(g.fAnaType), fCalorimeter(g.fCalorimeter),
76 fData(g.fData), fKine(g.fKine),fReader(g.fReader),
77 fGammaDirect(g.fGammaDirect), fGammaCorrelation(g.fGammaCorrelation),
78 fNeutralMesonSelection(g.fNeutralMesonSelection)
79{
80 // cpy ctor
81
82}
83
84//_________________________________________________________________________
85AliAnaGamma & AliAnaGamma::operator = (const AliAnaGamma & source)
86{
87 // assignment operator
88
89 if(this == &source)return *this;
90 ((TObject *)this)->operator=(source);
91
92 fOutputContainer = source.fOutputContainer ;
93 fAnaType = source.fAnaType;
94 fCalorimeter = source.fCalorimeter ;
95 fData = source.fData ;
96 fKine = source.fKine ;
97 fReader = source.fReader ;
98 fGammaDirect = source.fGammaDirect ;
99 fGammaCorrelation = source.fGammaCorrelation ;
100 fNeutralMesonSelection = source.fNeutralMesonSelection ;
101
102 return *this;
103
104}
105
106//____________________________________________________________________________
107AliAnaGamma::~AliAnaGamma()
108{
109 // Remove all pointers
110
111 fOutputContainer->Clear() ;
112 delete fOutputContainer ;
113
114 delete fData ;
115 delete fKine ;
116 delete fReader ;
117 delete fGammaDirect ;
118 delete fGammaCorrelation ;
119 delete fNeutralMesonSelection ;
120
121}
122
123//________________________________________________________________________
124void AliAnaGamma::Init()
125{
126
127 //Init container histograms and other common variables
128
129 //Histograms container
130 fOutputContainer = new TList ;
131
132 //Fill container with appropriate histograms
133
134 //Set prompt photon analysis histograms
135 TList * promptcontainer = fGammaDirect->GetCreateOutputObjects();
136 for(Int_t i = 0; i < promptcontainer->GetEntries(); i++)
137 fOutputContainer->Add(promptcontainer->At(i)) ;
138
139 if(fAnaType == kCorrelation){
140
141 //Check if selected options are correct
142 if (fGammaDirect->GetICMethod()==AliAnaGammaDirect::kSeveralIC)
143 AliFatal("Correlation not allowed with multiple isolation cuts, kCorrelation and kSeveralIC do not go together");
144
145 if(fGammaCorrelation->GetCorrelationType() == AliAnaGammaCorrelation::kParton &&
146 fReader->GetDataType() != AliGammaReader::kMC)
147 AliFatal("kParton must be analyzed with data kMC");
148
149 //Set the parameters for the neutral pair selection depending on the analysis,
150 fNeutralMesonSelection->SetDeltaPhiCutRange(fGammaCorrelation->GetDeltaPhiMinCut(),
151 fGammaCorrelation->GetDeltaPhiMaxCut());
152
153
154 if(fGammaCorrelation->GetCorrelationType() == AliAnaGammaCorrelation::kHadron){
155 fNeutralMesonSelection->SetPhiPtSelection(AliNeutralMesonSelection::kSelectPhiMinPt);
156 fNeutralMesonSelection->SetMinPt(fGammaCorrelation->GetMinPtHadron());
157
158 }
159
160 if(fGammaCorrelation->GetCorrelationType() == AliAnaGammaCorrelation::kJetLeadCone){
161 fNeutralMesonSelection->SetPhiPtSelection(AliNeutralMesonSelection::kSelectPhiPtRatio);
162 fNeutralMesonSelection->SetRatioCutRange(fGammaCorrelation->GetRatioMinCut(),
163 fGammaCorrelation->GetRatioMaxCut());
164 }
165
166 //Set the neutral mesosn selection histograms
167 TList * neutralmesoncontainer = fNeutralMesonSelection->GetCreateOutputObjects();
168 if(fNeutralMesonSelection->AreNeutralMesonSelectionHistosKept()){
169 for(Int_t i = 0; i < neutralmesoncontainer->GetEntries(); i++)
170 fOutputContainer->Add(neutralmesoncontainer->At(i)) ;
171 }
172
173 //Set correlation histograms
174 TList * correlationcontainer = fGammaCorrelation->GetCreateOutputObjects();
175 for(Int_t i = 0; i < correlationcontainer->GetEntries(); i++)
176 fOutputContainer->Add(correlationcontainer->At(i)) ;
177 fGammaCorrelation->SetOutputContainer(fOutputContainer);
178 fGammaCorrelation->SetNeutralMesonSelection(fNeutralMesonSelection);
179
180 }//kCorrelation
181
182}
183
184//____________________________________________________________________________
185void AliAnaGamma::InitParameters()
186{
187
188 //Init data members
189
190 fAnaType = kPrompt;
191 fCalorimeter = "EMCAL";
192
193}
194
195//__________________________________________________________________
196void AliAnaGamma::Print(const Option_t * opt) const
197{
198
199 //Print some relevant parameters set for the analysis
200 if(! opt)
201 return;
202
203 Info("Print", "%s %s", GetName(), GetTitle() ) ;
204 printf("Analysis type = %d\n", fAnaType) ;
205 printf("Calorimeter = %s\n", fCalorimeter.Data()) ;
206
207 switch(fAnaType)
208 {
209 case kPrompt:
210 {
211 fGammaDirect->Print("");
212 }// case kIsolationCut
213 break;
214
215 case kCorrelation:
216 {
217 fGammaCorrelation->Print("");
218 }// case kCorrelation
219 break;
220
221 }//switch
222}
223
224
225//____________________________________________________________________________
226Bool_t AliAnaGamma::ProcessEvent(Long64_t entry){
227
228 AliDebug(1,Form("Entry %d",entry));
229
230 if(!fOutputContainer)
231 AliFatal("Histograms not initialized");
232
233 //CreateTLists with arrays of TParticles. Filled with particles only relevant for the analysis.
234
235 TClonesArray * plCTS = new TClonesArray("TParticle",1000); // All particles refitted in Central Tracking System (ITS+TPC)
236 TClonesArray * plEMCAL = new TClonesArray("TParticle",1000); // All particles measured in Jet Calorimeter (EMCAL)
237 TClonesArray * plPHOS = new TClonesArray("TParticle",1000); // All particles measured Gamma calorimeter
238 TClonesArray * plParton = new TClonesArray("TParticle",1000); // All partons
239 //Fill lists with photons, neutral particles and charged particles
240 //look for the highest energy photon in the event inside fCalorimeter
241
242 //Fill particle lists
243 if(fReader->GetDataType() == AliGammaReader::kData){
244 AliDebug(1,"Data analysis");
245 fReader->CreateParticleList(fData, NULL,plCTS,plEMCAL,plPHOS,NULL);
246 }
247 else if( fReader->GetDataType()== AliGammaReader::kMC){
248 AliDebug(1,"Kinematics analysis");
249 fReader->CreateParticleList(fKine, NULL,plCTS,plEMCAL,plPHOS,plParton);
250 }
251 else if(fReader->GetDataType() == AliGammaReader::kMCData) {
252 AliDebug(1,"Data + Kinematics analysis");
253 fReader->CreateParticleList(fData, fKine,plCTS,plEMCAL,plPHOS,NULL);
254 }
255 else
256 AliError("Option not implemented");
257
258 //Search highest energy prompt gamma in calorimeter
259 if(fCalorimeter == "PHOS")
260 MakeAnalysis(plPHOS, plEMCAL, plCTS, plParton) ;
261 else if (fCalorimeter == "EMCAL")
262 MakeAnalysis(plEMCAL, plPHOS, plCTS,plParton) ;
263 else
264 AliFatal("Wrong calorimeter name");
265
266 plCTS->Clear() ;
267 plEMCAL->Clear() ;
268 plPHOS->Clear() ;
269 plParton->Clear() ;
270
271 delete plCTS ;
272 delete plPHOS ;
273 delete plEMCAL ;
274 delete plParton ;
275
276 return kTRUE;
277
278}
279
280//____________________________________________________________________________
281void AliAnaGamma::MakeAnalysis(TClonesArray * plCalo, TClonesArray * plNe, TClonesArray * plCTS, TClonesArray * plParton) {
282
283 TParticle * pGamma = new TParticle ;
284 Bool_t isInCalo = kFALSE ;
285
286 switch(fAnaType)
287 {
288
289 //Only Prompt photon analysis
290 case kPrompt:
291 {
292 AliDebug(1,"kPrompt analysis");
293 switch(fGammaDirect->GetICMethod())
294 {
295
296 case AliAnaGammaDirect::kSeveralIC:
297 {
298 fGammaDirect->MakeSeveralICAnalysis(plCalo, plCTS);
299 AliDebug(1,"kSeveralIC analysis");
300 }
301 break;
302
303 default :
304 {
305 fGammaDirect->GetPromptGamma(plCalo, plCTS,pGamma,isInCalo);
306 if(!isInCalo)
307 AliDebug(1,"Prompt gamma not found");
308 }
309 break;
310 }//IC method
311 }// case kPrompt:
312 break;
313
314 //Correlate prompt photon with something: parton, hadron, jet.
315 case kCorrelation:
316 {
317 AliDebug(1,"kCorrelation analysis");
318 //Find prompt photon
319 fGammaDirect->GetPromptGamma(plCalo, plCTS,pGamma,isInCalo);
320
321 if(isInCalo){//If prompt photon found, do correlation
322
323 switch(fGammaCorrelation->GetCorrelationType())
324 {
325 case AliAnaGammaCorrelation::kParton:
326 {
327 AliDebug(1,"kParton correlation");
328 fGammaCorrelation->MakeGammaCorrelation(pGamma, plParton, NULL);
329 }// case kParton
330 break;
331
332 case AliAnaGammaCorrelation::kHadron:
333 {
334 AliDebug(1,"kHadron correlation");
335 fGammaCorrelation->MakeGammaCorrelation(pGamma, plCTS, plNe);
336 }// case kHadron
337 break;
338
339 case AliAnaGammaCorrelation::kJetLeadCone:
340 {
341 AliDebug(1,"kJetLeadCone correlation");
342 fGammaCorrelation->MakeGammaCorrelation(pGamma, plCTS, plNe);
343 }// case kJetLeadCone
344 break;
345
346 case AliAnaGammaCorrelation::kJetFinder:
347 {
348 AliDebug(1,"kJetFinder correlation");
349 printf("Analysis not implemented \n");
350 }// case kJetFinder
351 break;
352 }// switch correlation
353 }// is in calo
354 else AliDebug(2,"Prompt gamma not found");
355 }// case kCorrelation
356 break;
357
358 } //switch(fAnaType)
359
360 delete pGamma ;
361
362}