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