]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/GammaConv/AliAnalysisTaskGammaConversion.cxx
Fixing coverity defects: 17612, 17611
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliAnalysisTaskGammaConversion.cxx
CommitLineData
d7d7e825 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2eedd4ed 3 * *
4 * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt *
5 * Version 1.1 *
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. *
d7d7e825 14 **************************************************************************/
15
16////////////////////////////////////////////////
17//---------------------------------------------
18// Class used to do analysis on conversion pairs
19//---------------------------------------------
2eedd4ed 20///////////////////////////////////////////////
d7d7e825 21
22// root
23#include <TChain.h>
24
25// analysis
26#include "AliAnalysisTaskGammaConversion.h"
27#include "AliStack.h"
28#include "AliLog.h"
29#include "AliESDtrackCuts.h"
30#include "TNtuple.h"
2eedd4ed 31//#include "AliCFManager.h" // for CF
32//#include "AliCFContainer.h" // for CF
9c1cb6f7 33#include "AliESDInputHandler.h"
34#include "AliAnalysisManager.h"
6441e967 35#include "AliAODPWG4Particle.h"
36#include "AliAODPWG4ParticleCorrelation.h"
2eedd4ed 37#include "AliAODConversionPhoton.h"
5e55d806 38#include "AliGammaConversionBGHandler.h"
6272370b 39#include "AliESDCaloCluster.h" // for combining PHOS and GammaConv
9c1cb6f7 40#include "AliKFVertex.h"
3c45d101 41#include "AliGenPythiaEventHeader.h"
42#include "AliGenDPMjetEventHeader.h"
43#include "AliGenEventHeader.h"
e60f3265 44#include <AliMCEventHandler.h>
77ac6f3e 45#include "TRandom3.h"
18a1e325 46#include "AliTriggerAnalysis.h"
b6dd6ad2 47#include "AliCentrality.h"
cc5a88a2 48#include "AliMultiplicity.h"
f0f3d4a1 49#include "AliAODHandler.h"
2eedd4ed 50#include "AliKFConversionPhoton.h"
51#include "AliKFConversionMother.h"
77ac6f3e 52
d707e3cf 53class AliESDTrackCuts;
4a6157dc 54class AliCFContainer;
55class AliCFManager;
d7d7e825 56class AliKFVertex;
57class AliAODHandler;
58class AliAODEvent;
59class ALiESDEvent;
60class AliMCEvent;
61class AliMCEventHandler;
62class AliESDInputHandler;
63class AliAnalysisManager;
64class Riostream;
65class TFile;
66class TInterpreter;
67class TSystem;
68class TROOT;
69
70ClassImp(AliAnalysisTaskGammaConversion)
71
72
73AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion():
74AliAnalysisTaskSE(),
2eedd4ed 75 fV0Reader(NULL),
76 fStack(NULL),
77 fMCTruth(NULL), // for CF
78 fGCMCEvent(NULL), // for CF
79 fESDEvent(NULL),
80 fOutputContainer(NULL),
81 fCFManager(0x0), // for CF
82 fHistograms(NULL),
83 fTriggerCINT1B(kFALSE),
84 fDoMCTruth(kFALSE),
85 fDoNeutralMeson(kFALSE),
86 fDoOmegaMeson(kFALSE),
87 fDoJet(kFALSE),
88 fDoChic(kFALSE),
c2ce474e 89 fRecalculateV0ForGamma(kFALSE),
2eedd4ed 90 fKFReconstructedGammasTClone(NULL),
91 fKFReconstructedPi0sTClone(NULL),
c2ce474e 92 fKFRecalculatedGammasTClone(NULL),
2eedd4ed 93 fCurrentEventPosElectronTClone(NULL),
94 fCurrentEventNegElectronTClone(NULL),
95 fKFReconstructedGammasCutTClone(NULL),
96 fPreviousEventTLVNegElectronTClone(NULL),
97 fPreviousEventTLVPosElectronTClone(NULL),
98 // fElectronRecalculatedv1(),
99 // fElectronRecalculatedv2(),
100 fElectronMass(-1),
101 fGammaMass(-1),
102 fPi0Mass(-1),
103 fEtaMass(-1),
104 fGammaWidth(-1),
105 fPi0Width(-1),
106 fEtaWidth(-1),
107 fMinOpeningAngleGhostCut(0.),
108 fEsdTrackCuts(NULL),
109 fCalculateBackground(kFALSE),
110 fWriteNtuple(kFALSE),
111 fGammaNtuple(NULL),
112 fNeutralMesonNtuple(NULL),
113 fTotalNumberOfAddedNtupleEntries(0),
114 fChargedParticles(NULL),
115 fChargedParticlesId(),
116 fGammaPtHighest(0.),
117 fMinPtForGammaJet(1.),
118 fMinIsoConeSize(0.2),
119 fMinPtIsoCone(0.7),
120 fMinPtGamChargedCorr(0.5),
121 fMinPtJetCone(0.5),
122 fLeadingChargedIndex(-1),
123 fLowPtMapping(1.),
124 fHighPtMapping(3.),
125 fDoCF(kFALSE),
126 fAODGamma(NULL),
127 //fAODPi0(NULL),
128 //fAODOmega(NULL),
129 fAODBranchName("GammaConv"),
130 fKFCreateAOD(kTRUE),
131 fKFForceAOD(kFALSE),
132 fKFDeltaAODFileName(""),
133 fDoNeutralMesonV0MCCheck(kFALSE),
134 fUseTrackMultiplicityForBG(kTRUE),
135 fMoveParticleAccordingToVertex(kFALSE),
136 fApplyChi2Cut(kFALSE),
137 fNRandomEventsForBG(15),
138 fNDegreesPMBackground(15),
139 fDoRotation(kTRUE),
140 fCheckBGProbability(kTRUE),
141 fRemovePileUp(kFALSE),
142 fSelectV0AND(kFALSE),
143 fTriggerAnalysis(NULL),
144 fMultiplicity(0),
145 fUseMultiplicity(0),
146 fUseMultiplicityBin(0),
147 fUseHBTMultiplicity(0),
148 fUseHBTMultiplicityBin(0),
149 fUseCentrality(0),
150 fUseCentralityBin(0),
151 fRandom(0)
d7d7e825 152{
2eedd4ed 153 // Default constructor
5a34881d 154
2eedd4ed 155 /* Kenneth: the default constructor should not have any define input/output or the call to SetESDtrackCuts
156 // Common I/O in slot 0
157 DefineInput (0, TChain::Class());
158 DefineOutput(0, TTree::Class());
d7d7e825 159
2eedd4ed 160 // Your private output
161 DefineOutput(1, TList::Class());
a0b94e5c 162
2eedd4ed 163 // Define standard ESD track cuts for Gamma-hadron correlation
164 SetESDtrackCuts();
165 */
d7d7e825 166}
167
168AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion(const char* name):
2eedd4ed 169 AliAnalysisTaskSE(name),
170 fV0Reader(NULL),
171 fStack(NULL),
172 fMCTruth(NULL), // for CF
173 fGCMCEvent(NULL), // for CF
174 fESDEvent(NULL),
175 fOutputContainer(0x0),
176 fCFManager(0x0), // for CF
177 fHistograms(NULL),
178 fTriggerCINT1B(kFALSE),
179 fDoMCTruth(kFALSE),
180 fDoNeutralMeson(kFALSE),
181 fDoOmegaMeson(kFALSE),
182 fDoJet(kFALSE),
183 fDoChic(kFALSE),
c2ce474e 184 fRecalculateV0ForGamma(kFALSE),
2eedd4ed 185 fKFReconstructedGammasTClone(NULL),
186 fKFReconstructedPi0sTClone(NULL),
c2ce474e 187 fKFRecalculatedGammasTClone(NULL),
2eedd4ed 188 fCurrentEventPosElectronTClone(NULL),
189 fCurrentEventNegElectronTClone(NULL),
190 fKFReconstructedGammasCutTClone(NULL),
191 fPreviousEventTLVNegElectronTClone(NULL),
192 fPreviousEventTLVPosElectronTClone(NULL),
193 // fElectronRecalculatedv1(),
194 // fElectronRecalculatedv2(),
195 fElectronMass(-1),
196 fGammaMass(-1),
197 fPi0Mass(-1),
198 fEtaMass(-1),
199 fGammaWidth(-1),
200 fPi0Width(-1),
201 fEtaWidth(-1),
202 fMinOpeningAngleGhostCut(0.),
203 fEsdTrackCuts(NULL),
204 fCalculateBackground(kFALSE),
205 fWriteNtuple(kFALSE),
206 fGammaNtuple(NULL),
207 fNeutralMesonNtuple(NULL),
208 fTotalNumberOfAddedNtupleEntries(0),
209 fChargedParticles(NULL),
210 fChargedParticlesId(),
211 fGammaPtHighest(0.),
212 fMinPtForGammaJet(1.),
213 fMinIsoConeSize(0.2),
214 fMinPtIsoCone(0.7),
215 fMinPtGamChargedCorr(0.5),
216 fMinPtJetCone(0.5),
217 fLeadingChargedIndex(-1),
218 fLowPtMapping(1.),
219 fHighPtMapping(3.),
220 fDoCF(kFALSE),
221 fAODGamma(NULL),
222 //fAODPi0(NULL),
223 //fAODOmega(NULL),
224 fAODBranchName("GammaConv"),
225 fKFCreateAOD(kTRUE),
226 fKFForceAOD(kFALSE),
227 fKFDeltaAODFileName(""),
228 fDoNeutralMesonV0MCCheck(kFALSE),
229 fUseTrackMultiplicityForBG(kTRUE),
230 fMoveParticleAccordingToVertex(kFALSE),
231 fApplyChi2Cut(kFALSE),
232 fNRandomEventsForBG(15),
233 fNDegreesPMBackground(15),
234 fDoRotation(kTRUE),
235 fCheckBGProbability(kTRUE),
236 fRemovePileUp(kFALSE),
237 fSelectV0AND(kFALSE),
238 fTriggerAnalysis(NULL),
239 fMultiplicity(0),
240 fUseMultiplicity(0),
241 fUseMultiplicityBin(0),
242 fUseHBTMultiplicity(0),
243 fUseHBTMultiplicityBin(0),
244 fUseCentrality(0),
245 fUseCentralityBin(0),
246 fRandom(0)
d7d7e825 247{
2eedd4ed 248 // Common I/O in slot 0, don't define when inheriting from AnalysisTaskSE
249 // DefineInput (0, TChain::Class());
250 // DefineOutput(0, TTree::Class());
d7d7e825 251
2eedd4ed 252 // Your private output
253 DefineOutput(1, TList::Class());
254 DefineOutput(2, AliCFContainer::Class()); // for CF
a0b94e5c 255
256
2eedd4ed 257 // Define standard ESD track cuts for Gamma-hadron correlation
258 SetESDtrackCuts();
9c1cb6f7 259
d7d7e825 260}
261
262AliAnalysisTaskGammaConversion::~AliAnalysisTaskGammaConversion()
263{
2eedd4ed 264 // Remove all pointers
265
266 if(fOutputContainer){
267 fOutputContainer->Clear() ;
268 delete fOutputContainer ;
269 }
270 if(fHistograms){
271 delete fHistograms;
272 }
273 if(fV0Reader){
274 delete fV0Reader;
275 }
276
277 // for CF
278 if(fCFManager){
279 delete fCFManager;
280 }
281
282 if(fEsdTrackCuts){
283 delete fEsdTrackCuts;
284 }
285
286 //Delete AODs
287 if (fAODGamma) {
288 fAODGamma->Clear();
289 delete fAODGamma;
290 }
291 fAODGamma = NULL;
292
293 /*if (fAODPi0) {
294 fAODPi0->Clear();
295 delete fAODPi0;
296 }
297 fAODPi0 = NULL;
298
299 if (fAODOmega) {
300 fAODOmega->Clear();
301 delete fAODOmega;
302 }
303 fAODOmega = NULL;
304 */
305 if(fTriggerAnalysis) {
306 delete fTriggerAnalysis;
307 }
18a1e325 308
309
04bf4381 310}
d7d7e825 311
12464034 312
d7d7e825 313void AliAnalysisTaskGammaConversion::Init()
314{
2eedd4ed 315 // Initialization
316 // AliLog::SetGlobalLogLevel(AliLog::kError);
d7d7e825 317}
318void AliAnalysisTaskGammaConversion::SetESDtrackCuts()
319{
2eedd4ed 320 // SetESDtrackCuts
321 if (fEsdTrackCuts!=NULL){
322 delete fEsdTrackCuts;
323 }
324 fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
325 //standard cuts from:
326 //http://aliceinfo.cern.ch/alicvs/viewvc/PWG0/dNdEta/CreateCuts.C?revision=1.4&view=markup
327
328 // Cuts used up to 3rd of March
329
330 // fEsdTrackCuts->SetMinNClustersTPC(50);
331 // fEsdTrackCuts->SetMaxChi2PerClusterTPC(3.5);
332 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
333 // fEsdTrackCuts->SetRequireITSRefit(kTRUE);
334 // fEsdTrackCuts->SetMaxNsigmaToVertex(3);
335 // fEsdTrackCuts->SetRequireSigmaToVertex(kTRUE);
336
337 //------- To be tested-----------
338 // Cuts used up to 26th of Agost
339 // Int_t minNClustersTPC = 70;
340 // Double_t maxChi2PerClusterTPC = 4.0;
341 // Double_t maxDCAtoVertexXY = 2.4; // cm
342 // Double_t maxDCAtoVertexZ = 3.2; // cm
343 // fEsdTrackCuts->SetRequireSigmaToVertex(kFALSE);
344 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
345 // fEsdTrackCuts->SetRequireITSRefit(kTRUE);
346 // // fEsdTrackCuts->SetRequireTPCStandAlone(kTRUE);
347 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
348 // fEsdTrackCuts->SetMinNClustersTPC(minNClustersTPC);
349 // fEsdTrackCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);
350 // fEsdTrackCuts->SetMaxDCAToVertexXY(maxDCAtoVertexXY);
351 // fEsdTrackCuts->SetMaxDCAToVertexZ(maxDCAtoVertexZ);
352 // fEsdTrackCuts->SetDCAToVertex2D(kTRUE);
353 // fEsdTrackCuts->SetEtaRange(-0.8, 0.8);
354 // fEsdTrackCuts->SetPtRange(0.15);
355
356 // fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
357
358
359 // Using standard function for setting Cuts
360 Bool_t selectPrimaries=kTRUE;
361 fEsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
362 fEsdTrackCuts->SetMaxDCAToVertexZ(2);
363 fEsdTrackCuts->SetEtaRange(-0.8, 0.8);
364 fEsdTrackCuts->SetPtRange(0.15);
365
366 //----- From Jacek 10.03.03 ------------------/
367 // minNClustersTPC = 70;
368 // maxChi2PerClusterTPC = 4.0;
369 // maxDCAtoVertexXY = 2.4; // cm
370 // maxDCAtoVertexZ = 3.2; // cm
371
372 // esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
373 // esdTrackCuts->SetRequireTPCRefit(kFALSE);
374 // esdTrackCuts->SetRequireTPCStandAlone(kTRUE);
375 // esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
376 // esdTrackCuts->SetMinNClustersTPC(minNClustersTPC);
377 // esdTrackCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);
378 // esdTrackCuts->SetMaxDCAToVertexXY(maxDCAtoVertexXY);
379 // esdTrackCuts->SetMaxDCAToVertexZ(maxDCAtoVertexZ);
380 // esdTrackCuts->SetDCAToVertex2D(kTRUE);
381
382
383
384 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
385 // fV0Reader->SetESDtrackCuts(fEsdTrackCuts);
d7d7e825 386}
387
c00009fb 388void AliAnalysisTaskGammaConversion::UserExec(Option_t */*option*/)
d7d7e825 389{
2eedd4ed 390 // Execute analysis for current event
391
392 // Load the esdpid from the esdhandler if exists (tender was applied) otherwise set the Bethe Bloch parameters
393 Int_t eventQuality=-1;
394
395 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
396 AliESDInputHandler *esdHandler=0x0;
397 if ( (esdHandler=dynamic_cast<AliESDInputHandler*>(man->GetInputEventHandler())) && esdHandler->GetESDpid() ){
398 AliV0Reader::SetESDpid(esdHandler->GetESDpid());
399 } else {
400 //load esd pid bethe bloch parameters depending on the existance of the MC handler
401 // yes: MC parameters
402 // no: data parameters
403 if (!AliV0Reader::GetESDpid()){
404 if (fMCEvent ) {
405 AliV0Reader::InitESDpid();
406 } else {
407 AliV0Reader::InitESDpid(1);
408 }
409 }
410 }
9c1cb6f7 411
2eedd4ed 412 if(fAODGamma) fAODGamma->Delete();
413 // if(fAODPi0) fAODPi0->Delete();
414 // if(fAODOmega) fAODOmega->Delete();
f06de224 415
48682642 416
2eedd4ed 417 // if(fV0Reader == NULL){ // coverty does not permit this test
418 // Write warning here cuts and so on are default if this ever happens
419 // }
48682642 420
2eedd4ed 421 if (fMCEvent ) {
422 // To avoid crashes due to unzip errors. Sometimes the trees are not there.
e60f3265 423
2eedd4ed 424 AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
425 if (!mcHandler){
426 AliError("Could not retrive MC event handler!");
9c1cb6f7 427
2eedd4ed 428 eventQuality=0;
429 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
430 return;
431 }
432 if (!mcHandler->InitOk() ){
433 eventQuality=0;
434 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
435 return;
436 }
437 if (!mcHandler->TreeK() ){
438 eventQuality=0;
439 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
440 return;
441 }
442 if (!mcHandler->TreeTR() ) {
443 eventQuality=0;
444 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
445 return;
446 }
447 }
18a1e325 448
2eedd4ed 449 fV0Reader->SetInputAndMCEvent(InputEvent(), MCEvent());
5e55d806 450
2eedd4ed 451 fV0Reader->Initialize();
452 fDoMCTruth = fV0Reader->GetDoMCTruth();
6272370b 453
2eedd4ed 454
455 if(fKFReconstructedGammasTClone == NULL){
456 fKFReconstructedGammasTClone = new TClonesArray("AliKFConversionPhoton",0);
457 }
458 if(fCurrentEventPosElectronTClone == NULL){
459 fCurrentEventPosElectronTClone = new TClonesArray("AliESDtrack",0);
460 }
461 if(fCurrentEventNegElectronTClone == NULL){
462 fCurrentEventNegElectronTClone = new TClonesArray("AliESDtrack",0);
463 }
464 if(fKFReconstructedGammasCutTClone == NULL){
465 fKFReconstructedGammasCutTClone = new TClonesArray("AliKFConversionPhoton",0);
466 }
467 if(fPreviousEventTLVNegElectronTClone == NULL){
468 fPreviousEventTLVNegElectronTClone = new TClonesArray("TLorentzVector",0);
469 }
470 if(fPreviousEventTLVPosElectronTClone == NULL){
471 fPreviousEventTLVPosElectronTClone = new TClonesArray("TLorentzVector",0);
472 }
473 if(fChargedParticles == NULL){
474 fChargedParticles = new TClonesArray("AliESDtrack",0);
475 }
6272370b 476
2eedd4ed 477 if(fKFReconstructedPi0sTClone == NULL){
478 fKFReconstructedPi0sTClone = new TClonesArray("AliKFConversionMother",0);
479 }
480
481/* if(fKFRecalculatedGammasTClone == NULL){
482 fKFRecalculatedGammasTClone = new TClonesArray("AliKFParticle",0);
483 }
484 */
485 if(fTriggerAnalysis== NULL){
486 fTriggerAnalysis = new AliTriggerAnalysis;
487 }
9c1cb6f7 488
2eedd4ed 489 //clear TClones
490 fKFReconstructedGammasTClone->Delete();
491 fCurrentEventPosElectronTClone->Delete();
492 fCurrentEventNegElectronTClone->Delete();
493 fKFReconstructedGammasCutTClone->Delete();
494 fPreviousEventTLVNegElectronTClone->Delete();
495 fPreviousEventTLVPosElectronTClone->Delete();
496 fKFReconstructedPi0sTClone->Delete();
497 // fKFRecalculatedGammasTClone->Delete();
5e55d806 498
2eedd4ed 499 //clear vectors
037dc2db 500
2eedd4ed 501 fChargedParticles->Delete();
cc5a88a2 502
2eedd4ed 503 fChargedParticlesId.clear();
b5832f95 504
22182c37 505
2eedd4ed 506 //Clear the data in the v0Reader
507 // fV0Reader->UpdateEventByEventData();
10e3319b 508
2eedd4ed 509 //Take Only events with proper trigger
510 /*
511 if(fTriggerCINT1B){
512 if(!fV0Reader->GetESDEvent()->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL")) return;
513 }
514 */
515 Bool_t v0A = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0A);
516 Bool_t v0C = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0C);
517 Bool_t v0AND = v0A && v0C;
518
519 if(fSelectV0AND && !v0AND){
520 eventQuality=5;
521 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
522 if(fDoMCTruth){
523 if(!fV0Reader->GetIsHeavyIon()){
cc5a88a2 524 CheckMesonProcessTypeEventQuality(eventQuality);
2eedd4ed 525 }
526 }
c8206114 527
2eedd4ed 528 return;
529 }
c8206114 530
2eedd4ed 531 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
532 // cout<< "Event not taken"<< endl;
533 eventQuality=1;
534 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
535 if(fDoMCTruth){
536 if(!fV0Reader->GetIsHeavyIon()){
537 CheckMesonProcessTypeEventQuality(eventQuality);
538 }
539 }
540 return; // aborts if the primary vertex does not have contributors.
541 }
542
543
2f426a53 544
2eedd4ed 545 if(!fV0Reader->CheckForPrimaryVertexZ() ){
546 eventQuality=2;
547 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
548 if(fDoMCTruth){
549 if(!fV0Reader->GetIsHeavyIon()){
550 CheckMesonProcessTypeEventQuality(eventQuality);
551 }
552 }
553 return;
554 }
cc5a88a2 555
ada7a878 556
2eedd4ed 557 if(fV0Reader->GetESDEvent()->GetPrimaryVertexTracks()->GetNContributors()>0) {
558 fHistograms->FillHistogram("ESD_GlobalPrimaryVtxZ",fV0Reader->GetESDEvent()->GetPrimaryVertex()->GetZ());
559 }else{
560 if(fV0Reader->GetESDEvent()->GetPrimaryVertexSPD()->GetNContributors()>0) {
561 fHistograms->FillHistogram("ESD_SPDPrimaryVtxZ",fV0Reader->GetESDEvent()->GetPrimaryVertex()->GetZ());
562 }
563 }
564
565 if(fRemovePileUp && fV0Reader->GetESDEvent()->IsPileupFromSPD()) {
566 eventQuality=4;
567 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
568 return;
569 }
570
571
572 Int_t tTracklet=0, tITSTPC=0, tITSPure=0;
573 fV0Reader->GetESDEvent()->EstimateMultiplicity(tTracklet, tITSTPC, tITSPure, 0.8);
574 Int_t fMultiplicityITS = tITSPure;
cc5a88a2 575
2eedd4ed 576 fMultiplicity = fEsdTrackCuts->CountAcceptedTracks(fV0Reader->GetESDEvent());
577 Int_t fMultiplicityStandard = fMultiplicity;
cc5a88a2 578
2eedd4ed 579 if( fUseHBTMultiplicity==1) {
580 fMultiplicity = fMultiplicityITS;
cc5a88a2 581
2eedd4ed 582 }
cc5a88a2 583
18a1e325 584
2eedd4ed 585 fHistograms->FillHistogram("ESD_MultiplicityDeviation",fMultiplicityStandard,fMultiplicityITS);
6746e1e1 586
2eedd4ed 587
cc5a88a2 588
2eedd4ed 589 if(fUseMultiplicity!=0 && CalculateMultiplicityBin()!=fUseMultiplicityBin ){
590 eventQuality=6;
591 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
592 return;
593 }
18a1e325 594
2eedd4ed 595
596 if(fUseHBTMultiplicity!=0 && CalculateMultiplicityBin()!=fUseHBTMultiplicityBin ){
597 eventQuality=6;
598 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
599 return;
600 }
cc5a88a2 601
602
2eedd4ed 603 if(fV0Reader->GetIsHeavyIon()){
604 if(fUseCentrality>0){
605 AliCentrality *esdCentrality = fV0Reader->GetESDEvent()->GetCentrality();
606 Int_t centralityC = -1;
64f4118c 607
2eedd4ed 608 if(fUseCentrality==1){
64f4118c 609 centralityC = esdCentrality->GetCentralityClass10("V0M");
610 if( centralityC != fUseCentralityBin ){
2eedd4ed 611 eventQuality=7;
612 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
613 return;
64f4118c 614 }
2eedd4ed 615 }
64f4118c 616
2eedd4ed 617 if(fUseCentrality==2){
64f4118c 618 centralityC = esdCentrality->GetCentralityClass10("CL1");
619 if( centralityC != fUseCentralityBin ){
2eedd4ed 620 eventQuality=7;
621 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
622 return;
64f4118c 623 }
2eedd4ed 624 }
14d7f2f9 625
2eedd4ed 626 ////////////////////////////////////// RRnew start /////////////////////////////////////////////////////
627 if(fUseCentrality==3){
14d7f2f9 628 centralityC = esdCentrality->GetCentralityClass10("V0M");
629 if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
2eedd4ed 630 eventQuality=7;
631 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
632 return;
14d7f2f9 633 }
634 if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
2eedd4ed 635 eventQuality=7;
636 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
637 return;
14d7f2f9 638 }
639 if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
2eedd4ed 640 eventQuality=7;
641 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
642 return;
643 }
644 if( (fUseCentralityBin == 3) && (centralityC!=0) && (centralityC!=1) ){ // 0-20%
645 eventQuality=7;
646 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
647 return;
14d7f2f9 648 }
649 if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
2eedd4ed 650 eventQuality=7;
651 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
652 return;
14d7f2f9 653 }
654 if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
2eedd4ed 655 eventQuality=7;
656 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
657 return;
14d7f2f9 658 }
cc5a88a2 659 if( (fUseCentralityBin == 7) && (centralityC!=6) && (centralityC!=7) ){ // 60-80%
2eedd4ed 660 eventQuality=7;
661 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
662 return;
cc5a88a2 663 }
664 if( (fUseCentralityBin == 8) && (centralityC>=8) ){ // 0-80%
2eedd4ed 665 eventQuality=7;
666 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
667 return;
cc5a88a2 668 }
669 if( (fUseCentralityBin == 9) && (centralityC>=9) ){ // 0-90%
2eedd4ed 670 eventQuality=7;
671 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
672 return;
cc5a88a2 673 }
2eedd4ed 674 }
14d7f2f9 675
2eedd4ed 676 if(fUseCentrality==4){
14d7f2f9 677 centralityC = esdCentrality->GetCentralityClass10("CL1");
678 if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
2eedd4ed 679 eventQuality=7;
680 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
681 return;
14d7f2f9 682 }
683 if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
2eedd4ed 684 eventQuality=7;
685 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
686 return;
14d7f2f9 687 }
688 if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
2eedd4ed 689 eventQuality=7;
690 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
691 return;
14d7f2f9 692 }
693 if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
2eedd4ed 694 eventQuality=7;
695 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
696 return;
14d7f2f9 697 }
698 if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
2eedd4ed 699 eventQuality=7;
700 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
701 return;
702 }
703 }
704 ////////////////////////////////////// RRnew end ///////////////////////////////////////////////////////
705
706 }
14d7f2f9 707 }
14d7f2f9 708
cc5a88a2 709
2eedd4ed 710 eventQuality=3;
cc5a88a2 711
2eedd4ed 712 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
cc5a88a2 713
885114d1 714
6746e1e1 715
2eedd4ed 716 fHistograms->FillHistogram("ESD_NumberOfGoodESDTracks",fMultiplicity);
717 if (fV0Reader->GetNumberOfContributorsVtx()>=1){
718 fHistograms->FillHistogram("ESD_NumberOfGoodESDTracksVtx",fMultiplicity);
719 }
6746e1e1 720
6746e1e1 721
2eedd4ed 722 // Process the MC information
723 if(fDoMCTruth){
724 ProcessMCData();
725 }
6746e1e1 726
727
a0b94e5c 728
2eedd4ed 729 //Process the v0 information with no cuts
730 ProcessV0sNoCut();
cb90a330 731
2eedd4ed 732 // Process the v0 information
733 ProcessV0s();
734
5e55d806 735
2eedd4ed 736 //Fill Gamma AOD
737 if(fKFCreateAOD) {
738 FillAODWithConversionGammas() ;
739 }
63477d82 740
741
2eedd4ed 742 // Process reconstructed gammas
743 if(fDoNeutralMeson == kTRUE){
744 ProcessGammasForNeutralMesonAnalysis();
77880bd8 745
2eedd4ed 746 }
747
748 if(fDoMCTruth == kTRUE){
749 CheckV0Efficiency();
750 }
751 //Process reconstructed gammas electrons for Chi_c Analysis
752 if(fDoChic == kTRUE){
753 ProcessGammaElectronsForChicAnalysis();
754 }
755 // Process reconstructed gammas for gamma Jet/hadron correlations
756 if(fDoJet == kTRUE){
757 ProcessGammasForGammaJetAnalysis();
758 }
a0b94e5c 759
2eedd4ed 760 //calculate background if flag is set
761 if(fCalculateBackground){
762 CalculateBackground();
763 }
48682642 764
2eedd4ed 765 if(fDoNeutralMeson == kTRUE){
766 // ProcessConvPHOSGammasForNeutralMesonAnalysis();
767 if(fDoOmegaMeson == kTRUE){
768 ProcessGammasForOmegaMesonAnalysis();
769 }
770 }
48682642 771
f0f3d4a1 772
2eedd4ed 773 //Must set fForceAOD to true for the AOD to get filled. (Unless called by other task)
774 if(fKFForceAOD) {
775 if (!AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()) {
776 AliFatal("Cannot run ESD filter without an output event handler");
777
778 } else {
779 if(fAODGamma && fAODGamma->GetEntriesFast() > 0) {
f0f3d4a1 780 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
2eedd4ed 781 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
782 }
783 }
784
785 }
f0f3d4a1 786
2eedd4ed 787 ///Make sure delta aod is filled if standard aod is filled (for synchronization when reading aod with standard aod)
788 if(fKFCreateAOD) {
789 AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
790 if (aodhandler && aodhandler->GetFillAOD()) {
791 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
792 }
793 }
f0f3d4a1 794
2eedd4ed 795
796 //Clear the data in the v0Reader
797 fV0Reader->UpdateEventByEventData();
798 //if(fRecalculateV0ForGamma==kTRUE){
799 // RecalculateV0ForGamma();
800 // }
801 PostData(1, fOutputContainer);
802 PostData(2, fCFManager->GetParticleContainer()); // for CF
d7d7e825 803
804}
805
48682642 806// void AliAnalysisTaskGammaConversion::ConnectInputData(Option_t *option){
2eedd4ed 807// // see header file for documentation
808// // printf(" ConnectInputData %s\n", GetName());
8a685cf3 809
2eedd4ed 810// AliAnalysisTaskSE::ConnectInputData(option);
8a685cf3 811
2eedd4ed 812// if(fV0Reader == NULL){
813// // Write warning here cuts and so on are default if this ever happens
814// }
815// fV0Reader->Initialize();
816// fDoMCTruth = fV0Reader->GetDoMCTruth();
48682642 817// }
d7d7e825 818
3c45d101 819void AliAnalysisTaskGammaConversion::CheckMesonProcessTypeEventQuality(Int_t evtQ){
2eedd4ed 820 // Check meson process type event quality
821 fStack= MCEvent()->Stack();
822 fGCMCEvent=MCEvent();
cc5a88a2 823
2eedd4ed 824
cc5a88a2 825
2eedd4ed 826 for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
827 TParticle* particle = (TParticle *)fStack->Particle(iTracks);
828 if (!particle) {
829 //print warning here
830 continue;
831 }
832 // if(particle->GetPdgCode()!=111 || particle->GetPdgCode()!=221){
833 // continue;
834 // }
835
836 Double_t rapidity;
837 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
838 rapidity=8.;
839 }
840 else{
841 rapidity = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())));
842 }
843
cc5a88a2 844
2eedd4ed 845 if( particle->GetPdgCode()==111){
846 fHistograms->FillHistogram("MC_Test_AllPi0_Pt", particle->Pt());
847 if(particle->GetNDaughters()==2){
848 fHistograms->FillHistogram("MC_Test_2DaughPi0_Pt", particle->Pt());
849 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
850 fHistograms->FillHistogram("MC_Test_2DaughPi0_Rap_Pt", particle->Pt());
851 }
852 }
853 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
854 fHistograms->FillHistogram("MC_Test_Pi0_Rap_Pt", particle->Pt());
855 }
856 }
857
858
859 if(particle->GetPdgCode()==221){
860 fHistograms->FillHistogram("MC_Test_AllEta_Pt", particle->Pt());
861 if(particle->GetNDaughters()==2){
862 fHistograms->FillHistogram("MC_Test_2DaughEta_Pt", particle->Pt());
863 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
864 fHistograms->FillHistogram("MC_Test_2DaughEta_Rap_Pt", particle->Pt());
865 }
866 }
867 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
868 fHistograms->FillHistogram("MC_Test_Eta_Rap_Pt", particle->Pt());
869 }
870
871 }
62ae0124 872
d7d7e825 873
2eedd4ed 874 if(particle->GetPdgCode()!=111){ //Pi0
875 continue;
876 }
62ae0124 877
d7d7e825 878
2eedd4ed 879 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ) continue;
880 if(fV0Reader->GetIsHeavyIon()) continue;
881
882 if(evtQ==1){
883 switch(GetProcessType(fGCMCEvent)){
884 case kProcSD:
885 fHistograms->FillHistogram("MC_SD_EvtQ1_Pi0_Pt", particle->Pt());
886 break;
887 case kProcDD:
888 fHistograms->FillHistogram("MC_DD_EvtQ1_Pi0_Pt", particle->Pt());
889 break;
890 case kProcND:
891 fHistograms->FillHistogram("MC_ND_EvtQ1_Pi0_Pt", particle->Pt());
892 break;
893 default:
894 AliError("Unknown Process");
895 }
896 }
897 if(evtQ==2){
898 switch(GetProcessType(fGCMCEvent)){
899 case kProcSD:
900 fHistograms->FillHistogram("MC_SD_EvtQ2_Pi0_Pt", particle->Pt());
901 break;
902 case kProcDD:
903 fHistograms->FillHistogram("MC_DD_EvtQ2_Pi0_Pt", particle->Pt());
904 break;
905 case kProcND:
906 fHistograms->FillHistogram("MC_ND_EvtQ2_Pi0_Pt", particle->Pt());
907 break;
908 default:
909 AliError("Unknown Process");
910 }
911 }
3c45d101 912
2eedd4ed 913 if(evtQ==4){
914 switch(GetProcessType(fGCMCEvent)){
915 case kProcSD:
916 fHistograms->FillHistogram("MC_SD_EvtQ4_Pi0_Pt", particle->Pt());
917 break;
918 case kProcDD:
919 fHistograms->FillHistogram("MC_DD_EvtQ4_Pi0_Pt", particle->Pt());
920 break;
921 case kProcND:
922 fHistograms->FillHistogram("MC_ND_EvtQ4_Pi0_Pt", particle->Pt());
923 break;
924 default:
925 AliError("Unknown Process");
926 }
927 }
3c45d101 928
2eedd4ed 929 if(evtQ==5){
930 switch(GetProcessType(fGCMCEvent)){
931 case kProcSD:
932 fHistograms->FillHistogram("MC_SD_EvtQ5_Pi0_Pt", particle->Pt());
933 break;
934 case kProcDD:
935 fHistograms->FillHistogram("MC_DD_EvtQ5_Pi0_Pt", particle->Pt());
936 break;
937 case kProcND:
938 fHistograms->FillHistogram("MC_ND_EvtQ5_Pi0_Pt", particle->Pt());
939 break;
940 default:
941 AliError("Unknown Process");
942 }
943 }
bd6d9fa3 944
2eedd4ed 945 }
111d75df 946
2eedd4ed 947}
bd6d9fa3 948
2eedd4ed 949void AliAnalysisTaskGammaConversion::ProcessMCData(){
950 // see header file for documentation
951 //InputEvent(), MCEvent());
952 /* TestAnaMarin
953 fStack = fV0Reader->GetMCStack();
954 fMCTruth = fV0Reader->GetMCTruth(); // for CF
955 fGCMCEvent = fV0Reader->GetMCEvent(); // for CF
956 */
957 fStack= MCEvent()->Stack();
958 fGCMCEvent=MCEvent();
d7d7e825 959
2eedd4ed 960 // for CF
961 Double_t containerInput[3];
962 if(fDoCF){
963 if(!fGCMCEvent) cout << "NO MC INFO FOUND" << endl;
964 fCFManager->SetEventInfo(fGCMCEvent);
965 }
966 // end for CF
f8017b04 967
2eedd4ed 968 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
969 return; // aborts if the primary vertex does not have contributors.
1e7846f4 970 }
2eedd4ed 971
972 Int_t nCharged = 0;
973 Int_t nCharged150MeV = 0;
9640a3d1 974
2eedd4ed 975 for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
976 // for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++) {
977 TParticle* particle = (TParticle *)fStack->Particle(iTracks);
9c1cb6f7 978
9c1cb6f7 979
64f4118c 980
2eedd4ed 981 if (!particle) {
982 //print warning here
983 continue;
984 }
985
9640a3d1 986
9c1cb6f7 987
2eedd4ed 988
989 ///////////////////////Begin Chic Analysis/////////////////////////////
990 if(fDoChic) {
991 if(particle->GetPdgCode() == 443){//Is JPsi
992 if(particle->GetNDaughters()==2){
993 if(TMath::Abs(fStack->Particle(particle->GetFirstDaughter())->GetPdgCode()) == 11 &&
994 TMath::Abs(fStack->Particle(particle->GetLastDaughter())->GetPdgCode()) == 11){
995
996 TParticle* daug0 = fStack->Particle(particle->GetFirstDaughter());
997 TParticle* daug1 = fStack->Particle(particle->GetLastDaughter());
998 if(TMath::Abs(daug0->Eta()) < 0.9 && TMath::Abs(daug1->Eta()) < 0.9)
999 fHistograms->FillTable("Table_Electrons",3);//e+ e- from J/Psi inside acceptance
1000
1001 if( TMath::Abs(daug0->Eta()) < 0.9){
1002 if(daug0->GetPdgCode() == -11)
1003 fHistograms->FillTable("Table_Electrons",1);//e+ from J/Psi inside acceptance
1004 else
1005 fHistograms->FillTable("Table_Electrons",2);//e- from J/Psi inside acceptance
1006
1007 }
1008 if(TMath::Abs(daug1->Eta()) < 0.9){
1009 if(daug1->GetPdgCode() == -11)
1010 fHistograms->FillTable("Table_Electrons",1);//e+ from J/Psi inside acceptance
1011 else
1012 fHistograms->FillTable("Table_Electrons",2);//e- from J/Psi inside acceptance
1013 }
1014 }
1015 }
1016 }
1017 // const int CHI_C0 = 10441;
1018 // const int CHI_C1 = 20443;
1019 // const int CHI_C2 = 445
1020 if(particle->GetPdgCode() == 22){//gamma from JPsi
1021 if(particle->GetMother(0) > -1){
1022 if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 10441 ||
1023 fStack->Particle(particle->GetMother(0))->GetPdgCode() == 20443 ||
1024 fStack->Particle(particle->GetMother(0))->GetPdgCode() == 445){
1025 if(TMath::Abs(particle->Eta()) < 1.2)
1026 fHistograms->FillTable("Table_Electrons",17);// gamma from chic inside accptance
1027 }
1028 }
1029 }
1030 if(particle->GetPdgCode() == 10441 || particle->GetPdgCode() == 20443 || particle->GetPdgCode() == 445){
1031 if( particle->GetNDaughters() == 2){
1032 TParticle* daug0 = fStack->Particle(particle->GetFirstDaughter());
1033 TParticle* daug1 = fStack->Particle(particle->GetLastDaughter());
1034
1035 if( (daug0->GetPdgCode() == 443 || daug0->GetPdgCode() == 22) && (daug1->GetPdgCode() == 443 || daug1->GetPdgCode() == 22) ){
1036 if( daug0->GetPdgCode() == 443){
1037 TParticle* daugE0 = fStack->Particle(daug0->GetFirstDaughter());
1038 TParticle* daugE1 = fStack->Particle(daug0->GetLastDaughter());
1039 if( TMath::Abs(daug1->Eta()) < 1.2 && TMath::Abs(daugE0->Eta()) < 0.9 && TMath::Abs(daugE1->Eta()) < 0.9 )
1040 fHistograms->FillTable("Table_Electrons",18);
1041
1042 } else if (daug1->GetPdgCode() == 443){
1043 TParticle* daugE0 = fStack->Particle(daug1->GetFirstDaughter());
1044 TParticle* daugE1 = fStack->Particle(daug1->GetLastDaughter());
1045 if( TMath::Abs(daug0->Eta()) < 1.2 && TMath::Abs(daugE0->Eta()) < 0.9 && TMath::Abs(daugE1->Eta()) < 0.9 )
1046 fHistograms->FillTable("Table_Electrons",18);
1047 }//else if
1048 }//gamma o Jpsi
1049 }//GetNDaughters
1050 }
1051 }
1052
1053 /////////////////////End Chic Analysis////////////////////////////
1054
1055 // if(TMath::Abs(particle->Eta())> fV0Reader->GetEtaCut() ) continue;
9c1cb6f7 1056
9c1cb6f7 1057
9640a3d1 1058
9640a3d1 1059
2eedd4ed 1060 if(particle->Eta() <0.8 && particle->Eta() > (-0.8) && particle->GetPDG()->Charge() != 0) {
1061 nCharged++;
1062 if(particle->Pt()>0.150){
1063 nCharged150MeV++;}
a0b94e5c 1064 }
d7d7e825 1065
d7d7e825 1066
2eedd4ed 1067
1068 if(particle->R()>fV0Reader->GetMaxRCut()) continue; // cuts on distance from collision point
1069
1070 Double_t tmpPhi=particle->Phi();
1071
1072 if(particle->Phi()> TMath::Pi()){
1073 tmpPhi = particle->Phi()-(2*TMath::Pi());
1074 }
1075
1076 Double_t rapidity;
1077 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
1078 rapidity=8.;
1079 } else{
1080 rapidity = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())));
1081 }
1082
1083 if( particle->GetPdgCode()==111){
dc2883e4 1084
2eedd4ed 1085 //AM move here, otherwise for evt we consider only pi0 to 2 g
1086 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1087 if(!fV0Reader->GetIsHeavyIon()) {
1088
1089 switch(GetProcessType(fGCMCEvent)){
1090 case kProcSD:
1091 fHistograms->FillHistogram("MC_SD_EvtQ3_Pi0_Pt", particle->Pt());
1092 break;
1093 case kProcDD:
1094 fHistograms->FillHistogram("MC_DD_EvtQ3_Pi0_Pt", particle->Pt());
1095 break;
1096 case kProcND:
1097 fHistograms->FillHistogram("MC_ND_EvtQ3_Pi0_Pt", particle->Pt());
1098 break;
1099 default:
1100 AliError("Unknown Process");
1101 }
1102 }
1103 }
1104 fHistograms->FillHistogram("MC_Test_AllPi0_Pt", particle->Pt());
1105 if(particle->GetNDaughters()==2){
1106 fHistograms->FillHistogram("MC_Test_2DaughPi0_Pt", particle->Pt());
1107 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1108 fHistograms->FillHistogram("MC_Test_2DaughPi0_Rap_Pt", particle->Pt());
1109 }
1110 }
1111 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1112 fHistograms->FillHistogram("MC_Test_Pi0_Rap_Pt", particle->Pt());
1113 }
d7d7e825 1114 }
d7d7e825 1115
1116
2eedd4ed 1117 if(particle->GetPdgCode()==221){
1118 fHistograms->FillHistogram("MC_Test_AllEta_Pt", particle->Pt());
1119 if(particle->GetNDaughters()==2){
1120 fHistograms->FillHistogram("MC_Test_2DaughEta_Pt", particle->Pt());
1121 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1122 fHistograms->FillHistogram("MC_Test_2DaughEta_Rap_Pt", particle->Pt());
1123 }
1124 }
1125 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1126 fHistograms->FillHistogram("MC_Test_Eta_Rap_Pt", particle->Pt());
1127 }
d7d7e825 1128 }
2eedd4ed 1129
1130
1131 if(iTracks<=fStack->GetNprimary() ){
1132 if ( particle->GetPdgCode()== -211 || particle->GetPdgCode()== 211 ||
1133 particle->GetPdgCode()== 2212 || particle->GetPdgCode()==-2212 ||
1134 particle->GetPdgCode()== 321 || particle->GetPdgCode()==-321 ){
1135 if(TMath::Abs(particle->Eta())> 0.8 ) continue; // Eta cut used in charged particle spectrum
1136 //if( !particle->IsPhysicalPrimary() ){
1137 // cout<<"not Physical primary"<< particle->IsPhysicalPrimary()<<endl;
1138 //}
1139 if(particle->GetMother(0)>-1){
1140 // cout<<"Mother ::"<<fStack->Particle(particle->GetMother(0))->GetPdgCode()<<endl;
1141 if (fStack->Particle(particle->GetMother(0))->GetPdgCode()== -211 ||fStack->Particle(particle->GetMother(0))->GetPdgCode()== -3122 ){
1142 cout<<"Mother K0, lambda::"<<fStack->Particle(particle->GetMother(0))->GetPdgCode()<<endl;
1143 continue;
1144 }
1145 }
1146
1147 fHistograms->FillHistogram("MC_PhysicalPrimaryCharged_Pt", particle->Pt());
1148 //cout << "hihi" << endl;
1149 if (particle->GetPdgCode() == 211 ) fHistograms->FillHistogram("MC_PiPlus_Pt", particle->Pt());
1150 if (particle->GetPdgCode() == 321 ) fHistograms->FillHistogram("MC_KaonPlus_Pt", particle->Pt());
1151 if (particle->GetPdgCode() == 2212 ) fHistograms->FillHistogram("MC_Proton_Pt", particle->Pt());
1152 if (particle->GetPdgCode() == -211 ) fHistograms->FillHistogram("MC_PiMinus_Pt", particle->Pt());
1153 if (particle->GetPdgCode() == -321 ) fHistograms->FillHistogram("MC_KaonMinus_Pt", particle->Pt());
1154 if (particle->GetPdgCode() == -2212 ) fHistograms->FillHistogram("MC_AntiProton_Pt", particle->Pt());
1155 }
d7d7e825 1156 }
2eedd4ed 1157
1158
1159 //process the gammas
1160 if (particle->GetPdgCode() == 22){
1161 if(TMath::Abs(particle->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(particle->Eta())< fV0Reader->GetEtaCutMin()) continue;
1162
1163 if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
1164 continue; // no photon as mothers!
1165 }
d7d7e825 1166
2eedd4ed 1167 if(particle->GetMother(0) >= fStack->GetNprimary()){
1168 continue; // the gamma has a mother, and it is not a primary particle
1169 }
1170
1171 if(particle->GetMother(0) >-1){
1172 fHistograms->FillHistogram("MC_DecayAllGamma_Pt", particle->Pt()); // All
1173 switch(fStack->Particle(particle->GetMother(0))->GetPdgCode()){
1174 case 111: // Pi0
1175 fHistograms->FillHistogram("MC_DecayPi0Gamma_Pt", particle->Pt());
1176 break;
1177 case 113: // Rho0
1178 fHistograms->FillHistogram("MC_DecayRho0Gamma_Pt", particle->Pt());
1179 break;
1180 case 221: // Eta
1181 fHistograms->FillHistogram("MC_DecayEtaGamma_Pt", particle->Pt());
1182 break;
1183 case 223: // Omega
1184 fHistograms->FillHistogram("MC_DecayOmegaGamma_Pt", particle->Pt());
1185 break;
1186 case 310: // K_s0
1187 fHistograms->FillHistogram("MC_DecayK0sGamma_Pt", particle->Pt());
1188 break;
1189 case 331: // Eta'
1190 fHistograms->FillHistogram("MC_DecayEtapGamma_Pt", particle->Pt());
1191 break;
1192 case 333: // Phi
1193 fHistograms->FillHistogram("MC_DecayPhiGamma_Pt", particle->Pt());
1194 break;
1195 }
1196 }
a0b94e5c 1197
2eedd4ed 1198 fHistograms->FillHistogram("MC_allGamma_Energy", particle->Energy());
1199 fHistograms->FillHistogram("MC_allGamma_Pt", particle->Pt());
1200 fHistograms->FillHistogram("MC_allGamma_Eta", particle->Eta());
1201 fHistograms->FillHistogram("MC_allGamma_Phi", tmpPhi);
1202 fHistograms->FillHistogram("MC_allGamma_Rapid", rapidity);
d7d7e825 1203
2eedd4ed 1204 // for CF
1205 if(fDoCF){
1206 containerInput[0] = particle->Pt();
1207 containerInput[1] = particle->Eta();
1208 if(particle->GetMother(0) >=0){
1209 containerInput[2] = fStack->Particle(particle->GetMother(0))->GetMass();
1210 } else{
1211 containerInput[2]=-1;
1212 }
1213 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGenerated); // generated gamma
1214 }
d7d7e825 1215
2eedd4ed 1216 if(particle->GetMother(0) < 0 || //Phojet p+p -> Direct Photons have no mother
1217 ((particle->GetMother(0) > -1) &&
1218 ((TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) < 10)||
1219 (TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) ==21) )) //Pythia p+p -> Direct Photons have quarksor gluons as mother
1220 ){ // direct gamma
1221 fHistograms->FillHistogram("MC_allDirectGamma_Energy",particle->Energy());
1222 fHistograms->FillHistogram("MC_allDirectGamma_Pt", particle->Pt());
1223 fHistograms->FillHistogram("MC_allDirectGamma_Eta", particle->Eta());
1224 fHistograms->FillHistogram("MC_allDirectGamma_Phi", tmpPhi);
1225 fHistograms->FillHistogram("MC_allDirectGamma_Rapid", rapidity);
1226 }
d7d7e825 1227
2eedd4ed 1228 // looking for conversion (electron + positron from pairbuilding (= 5) )
1229 TParticle* ePos = NULL;
1230 TParticle* eNeg = NULL;
a0b94e5c 1231
2eedd4ed 1232 if(particle->GetNDaughters() >= 2){
1233 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1234 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1235 if(tmpDaughter->GetUniqueID() == 5){
1236 if(tmpDaughter->GetPdgCode() == 11){
1237 eNeg = tmpDaughter;
1238 } else if(tmpDaughter->GetPdgCode() == -11){
1239 ePos = tmpDaughter;
1240 }
1241 }
1242 }
1243 }
1244
1245 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
1246 continue;
1247 }
1248
1249
1250 Double_t ePosPhi = ePos->Phi();
1251 if(ePos->Phi()> TMath::Pi()) ePosPhi = ePos->Phi()-(2*TMath::Pi());
1252
1253 Double_t eNegPhi = eNeg->Phi();
1254 if(eNeg->Phi()> TMath::Pi()) eNegPhi = eNeg->Phi()-(2*TMath::Pi());
1255
1256 if(ePos->Pt()<fV0Reader->GetPtCut() || eNeg->Pt()<fV0Reader->GetPtCut()){
1257 continue; // no reconstruction below the Pt cut
1258 }
1259
1260 if( TMath::Abs(ePos->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(ePos->Eta())< fV0Reader->GetEtaCutMin() ||
1261 TMath::Abs(eNeg->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(eNeg->Eta())< fV0Reader->GetEtaCutMin() ) {
1262 continue;
1263 }
1264
1265 if(ePos->R()>fV0Reader->GetMaxRCut()){
1266 continue; // cuts on distance from collision point
1267 }
1268
1269 if(TMath::Abs(ePos->Vz()) > fV0Reader->GetMaxZCut()){
1270 continue; // outside material
1271 }
1272 if(TMath::Abs(eNeg->Vz()) > fV0Reader->GetMaxZCut()){
1273 continue; // outside material
1274 }
1275
1276 if( ePos->R() <= ((TMath::Abs(ePos->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue())){
1277 continue; // line cut to exclude regions where we do not reconstruct
1278 } else if ( fV0Reader->GetEtaCutMin() != -0.1 && ePos->R() >= ((TMath::Abs(ePos->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin()) ){
1279 continue;
1280 }
1281
1282 if( eNeg->R() <= ((TMath::Abs(eNeg->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue())){
1283 continue; // line cut to exclude regions where we do not reconstruct
1284 } else if ( fV0Reader->GetEtaCutMin() != -0.1 && eNeg->R() >= ((TMath::Abs(eNeg->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin()) ){
1285 continue;
1286 }
1287
1288 // for CF
1289 if(fDoCF){
1290 fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructable); // reconstructable gamma
1291 }
1292 fHistograms->FillHistogram("MC_ConvGamma_Energy", particle->Energy());
1293 fHistograms->FillHistogram("MC_ConvGamma_Pt", particle->Pt());
1294 // Move down, in the if that mother exists
1295 // if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 221)
1296 // fHistograms->FillHistogram("MC_ConvEtaGamma_Pt", particle->Pt());
1297 fHistograms->FillHistogram("MC_ConvGamma_Eta", particle->Eta());
1298 fHistograms->FillHistogram("MC_ConvGamma_Phi", tmpPhi);
1299 fHistograms->FillHistogram("MC_ConvGamma_Rapid", rapidity);
1300 fHistograms->FillHistogram("MC_ConvGamma_Pt_Eta", particle->Pt(),particle->Eta());
1301
1302 fHistograms->FillHistogram("MC_E_Energy", eNeg->Energy());
1303 fHistograms->FillHistogram("MC_E_Pt", eNeg->Pt());
1304 fHistograms->FillHistogram("MC_E_Eta", eNeg->Eta());
1305 fHistograms->FillHistogram("MC_E_Phi", eNegPhi);
1306
1307 fHistograms->FillHistogram("MC_P_Energy", ePos->Energy());
1308 fHistograms->FillHistogram("MC_P_Pt", ePos->Pt());
1309 fHistograms->FillHistogram("MC_P_Eta", ePos->Eta());
1310 fHistograms->FillHistogram("MC_P_Phi", ePosPhi);
1311
1312 if(!fV0Reader->GetIsHeavyIon()){
1313
1314 // begin Mapping
1315 Int_t rBin = fHistograms->GetRBin(ePos->R());
1316 Int_t zBin = fHistograms->GetZBin(ePos->Vz());
1317 Int_t phiBin = fHistograms->GetPhiBin(particle->Phi());
1318 Double_t rFMD=30;
1319 Double_t rITSTPCMin=50;
1320 Double_t rITSTPCMax=80;
1321
1322 TVector3 vtxPos(ePos->Vx(),ePos->Vy(),ePos->Vz());
1323
1324 TString nameMCMappingPhiR="";
1325 nameMCMappingPhiR.Form("MC_Conversion_Mapping_Phi%02d_R%02d",phiBin,rBin);
1326 // fHistograms->FillHistogram(nameMCMappingPhiR, ePos->Vz(), particle->Eta());
1327
1328 TString nameMCMappingPhi="";
1329 nameMCMappingPhi.Form("MC_Conversion_Mapping_Phi%02d",phiBin);
1330 // fHistograms->FillHistogram(nameMCMappingPhi, particle->Eta());
1331 //fHistograms->FillHistogram(nameMCMappingPhi, ePos->Vz(), particle->Eta());
1332
1333 TString nameMCMappingR="";
1334 nameMCMappingR.Form("MC_Conversion_Mapping_R%02d",rBin);
1335 // fHistograms->FillHistogram(nameMCMappingR, particle->Eta());
1336 //fHistograms->FillHistogram(nameMCMappingR,ePos->Vz(), particle->Eta());
1337
1338 TString nameMCMappingPhiInR="";
1339 nameMCMappingPhiInR.Form("MC_Conversion_Mapping_Phi_in_R_%02d",rBin);
1340 // fHistograms->FillHistogram(nameMCMappingPhiInR, tmpPhi);
1341 fHistograms->FillHistogram(nameMCMappingPhiInR, vtxPos.Phi());
1342
1343 TString nameMCMappingZInR="";
1344 nameMCMappingZInR.Form("MC_Conversion_Mapping_Z_in_R_%02d",rBin);
1345 fHistograms->FillHistogram(nameMCMappingZInR,ePos->Vz() );
1346
1347
1348 TString nameMCMappingPhiInZ="";
1349 nameMCMappingPhiInZ.Form("MC_Conversion_Mapping_Phi_in_Z_%02d",zBin);
1350 // fHistograms->FillHistogram(nameMCMappingPhiInR, tmpPhi);
1351 fHistograms->FillHistogram(nameMCMappingPhiInZ, vtxPos.Phi());
1352
1353
1354 if(ePos->R()<rFMD){
1355 TString nameMCMappingFMDPhiInZ="";
1356 nameMCMappingFMDPhiInZ.Form("MC_Conversion_Mapping_FMD_Phi_in_Z_%02d",zBin);
1357 fHistograms->FillHistogram(nameMCMappingFMDPhiInZ, vtxPos.Phi());
1358 }
1359
1360 if(ePos->R()>rITSTPCMin && ePos->R()<rITSTPCMax){
1361 TString nameMCMappingITSTPCPhiInZ="";
1362 nameMCMappingITSTPCPhiInZ.Form("MC_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",zBin);
1363 fHistograms->FillHistogram(nameMCMappingITSTPCPhiInZ, vtxPos.Phi());
1364 }
1365
1366 TString nameMCMappingRInZ="";
1367 nameMCMappingRInZ.Form("MC_Conversion_Mapping_R_in_Z_%02d",zBin);
1368 fHistograms->FillHistogram(nameMCMappingRInZ,ePos->R() );
1369
1370 if(particle->Pt() > fLowPtMapping && particle->Pt()< fHighPtMapping){
1371 TString nameMCMappingMidPtPhiInR="";
1372 nameMCMappingMidPtPhiInR.Form("MC_Conversion_Mapping_MidPt_Phi_in_R_%02d",rBin);
1373 fHistograms->FillHistogram(nameMCMappingMidPtPhiInR, vtxPos.Phi());
1374
1375 TString nameMCMappingMidPtZInR="";
1376 nameMCMappingMidPtZInR.Form("MC_Conversion_Mapping_MidPt_Z_in_R_%02d",rBin);
1377 fHistograms->FillHistogram(nameMCMappingMidPtZInR,ePos->Vz() );
1378
1379
1380 TString nameMCMappingMidPtPhiInZ="";
1381 nameMCMappingMidPtPhiInZ.Form("MC_Conversion_Mapping_MidPt_Phi_in_Z_%02d",zBin);
1382 fHistograms->FillHistogram(nameMCMappingMidPtPhiInZ, vtxPos.Phi());
1383
1384
1385 if(ePos->R()<rFMD){
1386 TString nameMCMappingMidPtFMDPhiInZ="";
1387 nameMCMappingMidPtFMDPhiInZ.Form("MC_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",zBin);
1388 fHistograms->FillHistogram(nameMCMappingMidPtFMDPhiInZ, vtxPos.Phi());
1389 }
1390
1391 TString nameMCMappingMidPtRInZ="";
1392 nameMCMappingMidPtRInZ.Form("MC_Conversion_Mapping_MidPt_R_in_Z_%02d",zBin);
1393 fHistograms->FillHistogram(nameMCMappingMidPtRInZ,ePos->R() );
1394
1395 }
1396 }
1397
1398 //end mapping
1399
1400 fHistograms->FillHistogram("MC_Conversion_R",ePos->R());
1401 fHistograms->FillHistogram("MC_Conversion_ZR",ePos->Vz(),ePos->R());
1402 fHistograms->FillHistogram("MC_Conversion_XY",ePos->Vx(),ePos->Vy());
1403 fHistograms->FillHistogram("MC_Conversion_OpeningAngle",GetMCOpeningAngle(ePos, eNeg));
1404 fHistograms->FillHistogram("MC_ConvGamma_E_AsymmetryP",particle->P(),eNeg->P()/particle->P());
1405 fHistograms->FillHistogram("MC_ConvGamma_P_AsymmetryP",particle->P(),ePos->P()/particle->P());
1406
1407
1408 if(particle->GetMother(0) < 0 || //Phojet p+p -> Direct Photons have no mother
1409 ((particle->GetMother(0) > -1) &&
1410 ((TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) < 10)||
1411 (TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) ==21) )) //Pythia p+p -> Direct Photons have quarksor gluons as mother
1412 ){ // direct gamma, still inside converted
1413 fHistograms->FillHistogram("MC_ConvDirectGamma_Energy",particle->Energy());
1414 fHistograms->FillHistogram("MC_ConvDirectGamma_Pt", particle->Pt());
1415 fHistograms->FillHistogram("MC_ConvDirectGamma_Eta", particle->Eta());
1416 fHistograms->FillHistogram("MC_ConvDirectGamma_Phi", tmpPhi);
1417 fHistograms->FillHistogram("MC_ConvDirectGamma_Rapid", rapidity);
1418
1419 } else{ // mother exits
1420 if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 221)
1421 fHistograms->FillHistogram("MC_ConvEtaGamma_Pt", particle->Pt());
1422 /* if( fStack->Particle(particle->GetMother(0))->GetPdgCode()==10441 ||//chic0
1423 fStack->Particle(particle->GetMother(0))->GetPdgCode()==20443 ||//psi2S
1424 fStack->Particle(particle->GetMother(0))->GetPdgCode()==445 //chic2
1425 ){
1426 fMCGammaChic.push_back(particle);
1427 }
1428 */
1429 } // end if mother exits
1430 } // end if particle is a photon
1431
1432
1433
1434 // process motherparticles (2 gammas as daughters)
1435 // the motherparticle had already to pass the R and the eta cut, but no line cut.
1436 // the line cut is just valid for the conversions!
1437
1438 // RR primary Pi0 debug ////////////////////////////////////////////////////////////////////////////////////////////
1439 if (particle->GetPdgCode()==111){
1440 if( TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1441 fHistograms->FillHistogram("MC_Pi0_Pt_vs_Rapid_allDaughters", particle->Pt(),rapidity);
1442 }
1443 }
1444 // end RR primary Pi0 debug ////////////////////////////////////////////////////////////////////////////////////////
1445
1446 if(particle->GetNDaughters() == 2){
1447
1448 TParticle* daughter0 = (TParticle*)fStack->Particle(particle->GetFirstDaughter());
1449 TParticle* daughter1 = (TParticle*)fStack->Particle(particle->GetLastDaughter());
1450
1451 if(daughter0->GetPdgCode() != 22 || daughter1->GetPdgCode() != 22) continue; //check for gamma gamma daughters
1452
1453 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ) continue;
1454
1455 // Check the acceptance for both gammas
1456 Bool_t gammaEtaCut = kTRUE;
1457 if(TMath::Abs(daughter0->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(daughter0->Eta()) < fV0Reader->GetEtaCutMin() ||
1458 TMath::Abs(daughter1->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(daughter1->Eta()) < fV0Reader->GetEtaCutMin() ) gammaEtaCut = kFALSE;
1459
1460 Bool_t gammaRCut = kTRUE;
1461 if(daughter0->R() > fV0Reader->GetMaxRCut() || daughter1->R() > fV0Reader->GetMaxRCut() ) gammaRCut = kFALSE;
1462
1463 // check for conversions now -> have to pass eta, R and line cut!
1464 Bool_t daughter0Electron = kFALSE;
1465 Bool_t daughter0Positron = kFALSE;
1466 Bool_t daughter1Electron = kFALSE;
1467 Bool_t daughter1Positron = kFALSE;
1468
1469 if(daughter0->GetNDaughters() >= 2){ // first gamma
1470 for(Int_t TrackIndex=daughter0->GetFirstDaughter();TrackIndex<=daughter0->GetLastDaughter();TrackIndex++){
1471 TParticle *tmpDaughter = fStack->Particle(TrackIndex);
1472 if(tmpDaughter->GetUniqueID() == 5){
1473 if(tmpDaughter->GetPdgCode() == 11){
1474 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1475 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1476 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1477 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1478 daughter0Electron = kTRUE;
1479 }
1480 }
1481 }
1482 }
1483 } else if(tmpDaughter->GetPdgCode() == -11){
1484 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1485 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1486 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1487 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1488 daughter0Positron = kTRUE;
1489 }
1490 }
1491 }
1492 }
1493 }
1494 }
1495 }
1496 }
1497
1498 if(daughter1->GetNDaughters() >= 2){ // second gamma
1499 for(Int_t TrackIndex=daughter1->GetFirstDaughter();TrackIndex<=daughter1->GetLastDaughter();TrackIndex++){
1500 TParticle *tmpDaughter = fStack->Particle(TrackIndex);
1501 if(tmpDaughter->GetUniqueID() == 5){
1502 if(tmpDaughter->GetPdgCode() == 11){
1503 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1504 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1505 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1506 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1507 daughter1Electron = kTRUE;
1508 }
1509 }
1510 }
1511 }
1512 } else if(tmpDaughter->GetPdgCode() == -11){
1513 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1514 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1515 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1516 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1517 daughter1Positron = kTRUE;
1518 }
1519 }
1520 }
1521 }
1522 }
1523 }
1524 }
1525 }
1526 if(particle->GetPdgCode()==111){ //Pi0
1527 if( iTracks >= fStack->GetNprimary()){
1528 fHistograms->FillHistogram("MC_Pi0_Secondaries_Eta", particle->Eta());
1529 fHistograms->FillHistogram("MC_Pi0_Secondaries_Rapid", rapidity);
1530 fHistograms->FillHistogram("MC_Pi0_Secondaries_Phi", tmpPhi);
1531 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt", particle->Pt());
1532 fHistograms->FillHistogram("MC_Pi0_Secondaries_Energy", particle->Energy());
1533 fHistograms->FillHistogram("MC_Pi0_Secondaries_R", particle->R());
1534 fHistograms->FillHistogram("MC_Pi0_Secondaries_ZR", particle->Vz(),particle->R());
1535 fHistograms->FillHistogram("MC_Pi0_Secondaries_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1536 fHistograms->FillHistogram("MC_Pi0_Secondaries_XY", particle->Vx(),particle->Vy());//only fill from one daughter to avoid multiple filling
1537
1538 if(gammaEtaCut && gammaRCut){
1539 //if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1540 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1541 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1542 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1543 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1544 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1545 }
1546 }
1547 } else{
1548
1549 fHistograms->FillHistogram("MC_Pi0_Eta", particle->Eta());
1550 fHistograms->FillHistogram("MC_Pi0_Rapid", rapidity);
1551 fHistograms->FillHistogram("MC_Pi0_Phi", tmpPhi);
1552 fHistograms->FillHistogram("MC_Pi0_Pt", particle->Pt());
1553 //if(fGCMCEvent->IsFromBGEvent(iTracks)) fHistograms->FillHistogram("MC_Pi0_Pt_under", particle->Pt());
1554 fHistograms->FillHistogram("MC_Pi0_Pt_vs_Rapid", particle->Pt(),rapidity);
1555 fHistograms->FillHistogram("MC_Pi0_Energy", particle->Energy());
1556 fHistograms->FillHistogram("MC_Pi0_R", particle->R());
1557 fHistograms->FillHistogram("MC_Pi0_ZR", particle->Vz(),particle->R());
1558 fHistograms->FillHistogram("MC_Pi0_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1559 fHistograms->FillHistogram("MC_Pi0_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling
1560 if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_Fiducial", particle->Pt());
1561 if(particle->GetMother(0) > -1){
1562 Int_t pdgPionMother=fStack->Particle(particle->GetMother(0))->GetPdgCode();
1563 if(pdgPionMother ==221 ){
1564 fHistograms->FillHistogram("MC_Pi0_Pt_FromEta", particle->Pt());
1565 }else if( pdgPionMother==223 ){
1566 fHistograms->FillHistogram("MC_Pi0_Pt_FromOmega", particle->Pt());
1567 }else if(TMath::Abs(pdgPionMother) ==213 ){
1568 fHistograms->FillHistogram("MC_Pi0_Pt_FromRhoPlusMinus", particle->Pt());
1569 }else{
1570 fHistograms->FillHistogram("MC_Pi0_Pt_FromOthers", particle->Pt());
1571 }
1572 }else{
1573 fHistograms->FillHistogram("MC_Pi0_Pt_Direct", particle->Pt());
1574 }
1575
1576 if(gammaEtaCut && gammaRCut){
1577 // if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1578 fHistograms->FillHistogram("MC_Pi0_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1579 fHistograms->FillHistogram("MC_Pi0_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1580 if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_withinAcceptance_Fiducial", particle->Pt());
1581 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1582 fHistograms->FillHistogram("MC_Pi0_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1583 fHistograms->FillHistogram("MC_Pi0_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1584 fHistograms->FillHistogram("MC_Pi0_ZR_ConvGamma_withinAcceptance", particle->Vz(),particle->R());
1585 fHistograms->FillHistogram("MC_Pi0_ConvGamma_OpeningAngle_Pt", particle->Pt(),GetMCOpeningAngle(daughter0,daughter1));
1586 fHistograms->FillHistogram("MC_Pi0_ConvGamma_PtGamma_Pt", particle->Pt(),daughter0->Pt());
1587 fHistograms->FillHistogram("MC_Pi0_ConvGamma_PtGamma_Pt", particle->Pt(),daughter1->Pt());
1588
1589 Double_t alfa=0.;
1590 if((daughter0->Energy()+daughter1->Energy()) > 0.){
1591 alfa= TMath::Abs((daughter0->Energy()-daughter1->Energy())/(daughter0->Energy()+daughter1->Energy()));
1592 }
1593 fHistograms->FillHistogram("MC_Pi0_alpha",alfa);
1594 if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_ConvGamma_withinAcceptance_Fiducial", particle->Pt());
1595 }
1596 }
1597 }
1598 }
1599
1600 if(particle->GetPdgCode()==221){ //Eta
1601 fHistograms->FillHistogram("MC_Eta_Eta", particle->Eta());
1602 fHistograms->FillHistogram("MC_Eta_Rapid", rapidity);
1603 fHistograms->FillHistogram("MC_Eta_Phi",tmpPhi);
1604 fHistograms->FillHistogram("MC_Eta_Pt", particle->Pt());
1605 fHistograms->FillHistogram("MC_Eta_Pt_vs_Rapid", particle->Pt(),rapidity);
1606 fHistograms->FillHistogram("MC_Eta_Energy", particle->Energy());
1607 fHistograms->FillHistogram("MC_Eta_R", particle->R());
1608 fHistograms->FillHistogram("MC_Eta_ZR", particle->Vz(),particle->R());
1609 fHistograms->FillHistogram("MC_Eta_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1610 fHistograms->FillHistogram("MC_Eta_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling
1611
1612 if(gammaEtaCut && gammaRCut){
1613 // if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1614 fHistograms->FillHistogram("MC_Eta_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1615 fHistograms->FillHistogram("MC_Eta_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1616 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1617 fHistograms->FillHistogram("MC_Eta_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1618 fHistograms->FillHistogram("MC_Eta_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1619 fHistograms->FillHistogram("MC_Eta_ZR_ConvGamma_withinAcceptance", particle->Vz(),particle->R());
1620 fHistograms->FillHistogram("MC_Eta_ConvGamma_OpeningAngle_Pt", particle->Pt(),GetMCOpeningAngle(daughter0,daughter1));
1621 fHistograms->FillHistogram("MC_Eta_ConvGamma_PtGamma_Pt", particle->Pt(),daughter0->Pt());
1622 fHistograms->FillHistogram("MC_Eta_ConvGamma_PtGamma_Pt", particle->Pt(),daughter1->Pt());
1623
1624 Double_t alfa=0.;
1625 if((daughter0->Energy()+daughter1->Energy()) > 0.){
1626 alfa= TMath::Abs((daughter0->Energy()-daughter1->Energy())/(daughter0->Energy()+daughter1->Energy()));
1627 }
1628 fHistograms->FillHistogram("MC_Eta_alpha",alfa);
1629 }
1630 }
1631 }
1632
1633 // all motherparticles with 2 gammas as daughters
1634 fHistograms->FillHistogram("MC_Mother_R", particle->R());
1635 fHistograms->FillHistogram("MC_Mother_ZR", particle->Vz(),particle->R());
1636 fHistograms->FillHistogram("MC_Mother_XY", particle->Vx(),particle->Vy());
1637 fHistograms->FillHistogram("MC_Mother_Mass", particle->GetCalcMass());
1638 fHistograms->FillHistogram("MC_Mother_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1639 fHistograms->FillHistogram("MC_Mother_Energy", particle->Energy());
1640 fHistograms->FillHistogram("MC_Mother_Pt", particle->Pt());
1641 fHistograms->FillHistogram("MC_Mother_Eta", particle->Eta());
1642 fHistograms->FillHistogram("MC_Mother_Rapid", rapidity);
1643 fHistograms->FillHistogram("MC_Mother_Phi",tmpPhi);
1644 fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt",particle->GetMass(),particle->Pt());
1645
1646 if(gammaEtaCut && gammaRCut){
1647 // if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1648 fHistograms->FillHistogram("MC_Mother_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1649 fHistograms->FillHistogram("MC_Mother_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1650 fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt_withinAcceptance",particle->GetMass(),particle->Pt());
1651 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1652 fHistograms->FillHistogram("MC_Mother_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1653 fHistograms->FillHistogram("MC_Mother_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1654 fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt_ConvGamma_withinAcceptance",particle->GetMass(),particle->Pt());
1655 }
1656 } // end passed R and eta cut
1657 } // end if(particle->GetNDaughters() == 2)
1658 }// end for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++)
1659
1660 fHistograms->FillHistogram("ESD_TrueMult_vs_MeasMult", nCharged,fMultiplicity);
1661 fHistograms->FillHistogram("ESD_TrueMult_vs_MeasMult_pt150MeV", nCharged150MeV,fMultiplicity);
1662 //cout << "True " << nCharged << " Meas. " << fMultiplicity << endl;
1663
1664} // end ProcessMCData
1665
1666
d7d7e825 1667
1668void AliAnalysisTaskGammaConversion::FillNtuple(){
2eedd4ed 1669 //Fills the ntuple with the different values
1670
1671 if(fGammaNtuple == NULL){
1672 return;
1673 }
1674 Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
1675 for(Int_t i=0;i<numberOfV0s;i++){
1676 Float_t values[27] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1677 AliESDv0 * cV0 = fV0Reader->GetV0(i);
1678 Double_t negPID=0;
1679 Double_t posPID=0;
1680 fV0Reader->GetPIDProbability(negPID,posPID);
1681 values[0]=cV0->GetOnFlyStatus();
1682 values[1]=fV0Reader->CheckForPrimaryVertex();
1683 values[2]=negPID;
1684 values[3]=posPID;
1685 values[4]=fV0Reader->GetX();
1686 values[5]=fV0Reader->GetY();
1687 values[6]=fV0Reader->GetZ();
1688 values[7]=fV0Reader->GetXYRadius();
1689 values[8]=fV0Reader->GetMotherCandidateNDF();
1690 values[9]=fV0Reader->GetMotherCandidateChi2();
1691 values[10]=fV0Reader->GetMotherCandidateEnergy();
1692 values[11]=fV0Reader->GetMotherCandidateEta();
1693 values[12]=fV0Reader->GetMotherCandidatePt();
1694 values[13]=fV0Reader->GetMotherCandidateMass();
1695 values[14]=fV0Reader->GetMotherCandidateWidth();
1696 // values[15]=fV0Reader->GetMotherMCParticle()->Pt(); MOVED TO THE END, HAS TO BE CALLED AFTER HasSameMother NB: still has the same entry in the array
1697 values[16]=fV0Reader->GetOpeningAngle();
1698 values[17]=fV0Reader->GetNegativeTrackEnergy();
1699 values[18]=fV0Reader->GetNegativeTrackPt();
1700 values[19]=fV0Reader->GetNegativeTrackEta();
1701 values[20]=fV0Reader->GetNegativeTrackPhi();
1702 values[21]=fV0Reader->GetPositiveTrackEnergy();
1703 values[22]=fV0Reader->GetPositiveTrackPt();
1704 values[23]=fV0Reader->GetPositiveTrackEta();
1705 values[24]=fV0Reader->GetPositiveTrackPhi();
1706 values[25]=fV0Reader->HasSameMCMother();
1707 if(values[25] != 0){
1708 values[26]=fV0Reader->GetMotherMCParticlePDGCode();
1709 values[15]=fV0Reader->GetMotherMCParticle()->Pt();
1710 }
1711 fTotalNumberOfAddedNtupleEntries++;
1712 fGammaNtuple->Fill(values);
1713 }
1714 fV0Reader->ResetV0IndexNumber();
d7d7e825 1715
1716}
1717
1718void AliAnalysisTaskGammaConversion::ProcessV0sNoCut(){
2eedd4ed 1719 // Process all the V0's without applying any cuts to it
a0b94e5c 1720
2eedd4ed 1721 Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
1722 for(Int_t i=0;i<numberOfV0s;i++){
1723 /*AliESDv0 * cV0 = */fV0Reader->GetV0(i);
a0b94e5c 1724
2eedd4ed 1725 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
1726 continue;
1727 }
9640a3d1 1728
2eedd4ed 1729 // if( !fV0Reader->GetV0(i)->GetOnFlyStatus()){
1730 if( !fV0Reader->CheckV0FinderStatus(i)){
1731 continue;
1732 }
9640a3d1 1733
cb90a330 1734
2eedd4ed 1735 if( !((fV0Reader->GetNegativeESDTrack())->GetStatus() & AliESDtrack::kTPCrefit) ||
1736 !((fV0Reader->GetPositiveESDTrack())->GetStatus() & AliESDtrack::kTPCrefit) ){
1737 continue;
1738 }
cb90a330 1739
2eedd4ed 1740 if( fV0Reader->GetNegativeESDTrack()->GetSign()== fV0Reader->GetPositiveESDTrack()->GetSign()){
1741 continue;
1742 }
ebcfaa7e 1743
2eedd4ed 1744 if( fV0Reader->GetNegativeESDTrack()->GetKinkIndex(0) > 0 ||
1745 fV0Reader->GetPositiveESDTrack()->GetKinkIndex(0) > 0) {
1746 continue;
1747 }
1748 if(TMath::Abs(fV0Reader->GetMotherCandidateEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetMotherCandidateEta())< fV0Reader->GetEtaCutMin()){
1749 continue;
1750 }
1751 if(TMath::Abs(fV0Reader->GetPositiveTrackEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetPositiveTrackEta())< fV0Reader->GetEtaCutMin()){
1752 continue;
1753 }
1754 if(TMath::Abs(fV0Reader->GetNegativeTrackEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetNegativeTrackEta())< fV0Reader->GetEtaCutMin()){
1755 continue;
1756 }
1757 if( fV0Reader->GetXYRadius() <= ((TMath::Abs(fV0Reader->GetZ())*fV0Reader->GetLineCutZRSlope())-fV0Reader->GetLineCutZValue()) ){ // cuts out regions where we do not reconstruct
1758 continue;
1759 } else if ( fV0Reader->GetEtaCutMin() != -0.1 && fV0Reader->GetXYRadius() > ((TMath::Abs(fV0Reader->GetZ())*fV0Reader->GetLineCutZRSlopeMin())-fV0Reader->GetLineCutZValueMin()) ) {
1760 continue;
1761 }
f3026589 1762
2eedd4ed 1763 fHistograms->FillHistogram("ESD_NoCutAllV0_Pt", fV0Reader->GetMotherCandidatePt());
e0155998 1764
2eedd4ed 1765 // RRnewTOF start ///////////////////////////////////////////////
1766 UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus();
1767 UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus();
e0155998 1768
2eedd4ed 1769 Double_t t0pos = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetPositiveTrackP());
1770 Double_t t0neg = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetNegativeTrackP());
e0155998 1771
2eedd4ed 1772 Double_t timesPos[5];
1773 fV0Reader->GetPositiveESDTrack()->GetIntegratedTimes(timesPos);
1774 Double_t timesNeg[5];
1775 fV0Reader->GetNegativeESDTrack()->GetIntegratedTimes(timesNeg);
e0155998 1776
2eedd4ed 1777 Double_t TOFsignalPos = fV0Reader->GetPositiveTrackTOFsignal();
1778 Double_t TOFsignalNeg = fV0Reader->GetNegativeTrackTOFsignal();
e0155998 1779
2eedd4ed 1780 Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
1781 Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
e0155998 1782
2eedd4ed 1783 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_NoCutConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
1784 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_NoCutConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
1785 // RRnewTOF end /////////////////////////////////////////////////
1786
1787 if(fDoMCTruth){
a0b94e5c 1788
2eedd4ed 1789 if(fV0Reader->HasSameMCMother() == kFALSE){
1790 continue;
1791 }
a0b94e5c 1792
2eedd4ed 1793 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
1794 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
a0b94e5c 1795
2eedd4ed 1796 if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
1797 continue;
1798 }
1799 if(negativeMC->GetPdgCode() == positiveMC->GetPdgCode()){
1800 continue;
1801 }
1802
1803 if(negativeMC->GetUniqueID() != 5 || positiveMC->GetUniqueID() !=5){ // id 5 is conversion
1804 continue;
1805 }
a0b94e5c 1806
2eedd4ed 1807 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
1808 fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
1809 fHistograms->FillHistogram("ESD_NoCutConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
1810 fHistograms->FillHistogram("ESD_NoCutConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
1811 fHistograms->FillHistogram("ESD_NoCutConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
1812 fHistograms->FillHistogram("ESD_NoCutConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
1813 fHistograms->FillHistogram("ESD_NoCutConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
1814 fHistograms->FillHistogram("ESD_NoCutConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
1815 fHistograms->FillHistogram("ESD_NoCutConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
1816 fHistograms->FillHistogram("ESD_NoCutConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
1817 fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
1818
1819 fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
1820 fHistograms->FillHistogram("ESD_NoCutConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
1821
1822 fHistograms->FillHistogram("ESD_NoCutConversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
1823 fHistograms->FillHistogram("ESD_NoCutConversion_R", fV0Reader->GetXYRadius());
1824 fHistograms->FillHistogram("ESD_NoCutConversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
1825 fHistograms->FillHistogram("ESD_NoCutConversion_OpeningAngle", fV0Reader->GetOpeningAngle());
1826 fHistograms->FillHistogram("ESD_NoCutConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
1827 fHistograms->FillHistogram("ESD_NoCutConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
1828 fHistograms->FillHistogram("ESD_NoCutConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
1829 fHistograms->FillHistogram("ESD_NoCutConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
1830
1831 fHistograms->FillHistogram("ESD_NoCutConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
1832 fHistograms->FillHistogram("ESD_NoCutConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
1833 fHistograms->FillHistogram("ESD_NoCutConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
1834 fHistograms->FillHistogram("ESD_NoCutConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
1835
1836 //store MCTruth properties
1837 fHistograms->FillHistogram("ESD_NoCutConvGamma_MC_Pt_Eta", fV0Reader->GetMotherMCParticle()->Pt(),fV0Reader->GetMotherMCParticle()->Eta());
1838 fHistograms->FillHistogram("ESD_NoCutConversion_MC_ZR", negativeMC->Vz(),negativeMC->R());
1839 fHistograms->FillHistogram("ESD_NoCutConversion_MC_XY", negativeMC->Vx(),negativeMC->Vy());
1840 }
1841 }
1842 }
1843 fV0Reader->ResetV0IndexNumber();
d7d7e825 1844}
1845
1846void AliAnalysisTaskGammaConversion::ProcessV0s(){
2eedd4ed 1847 // see header file for documentation
037dc2db 1848
1849
2eedd4ed 1850 if(fWriteNtuple == kTRUE){
1851 FillNtuple();
1852 }
d7d7e825 1853
2eedd4ed 1854 Int_t nSurvivingV0s=0;
1855 fV0Reader->ResetNGoodV0s();
1856 while(fV0Reader->NextV0()){
1857 nSurvivingV0s++;
d7d7e825 1858
e60f3265 1859
2eedd4ed 1860 TVector3 vtxConv(fV0Reader->GetX(),fV0Reader->GetY(), fV0Reader->GetZ());
e60f3265 1861
2eedd4ed 1862 //-------------------------- filling v0 information -------------------------------------
1863 fHistograms->FillHistogram("ESD_Conversion_R", fV0Reader->GetXYRadius());
1864 fHistograms->FillHistogram("ESD_Conversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
1865 fHistograms->FillHistogram("ESD_Conversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
1866 fHistograms->FillHistogram("ESD_Conversion_OpeningAngle", fV0Reader->GetOpeningAngle());
1867 fHistograms->FillHistogram("ESD_ConversionMapping_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
1868 fHistograms->FillHistogram("ESD_ConversionMapping_ZPhi", fV0Reader->GetZ(),vtxConv.Phi());
1869 fHistograms->FillHistogram("ESD_ConversionMapping_RPhi", fV0Reader->GetXYRadius(),vtxConv.Phi());
1870
1871 if ( fV0Reader->GetMotherCandidatePt() >= 2.){
1872 fHistograms->FillHistogram("ESD_Conversion_minPt_R", fV0Reader->GetXYRadius());
1873 fHistograms->FillHistogram("ESD_Conversion_minPt_Z", fV0Reader->GetZ());
1874 }
e60f3265 1875
2eedd4ed 1876 // Specific histograms for beam pipe studies
1877 if( TMath::Abs(fV0Reader->GetZ()) < fV0Reader->GetLineCutZValue() && TMath::Abs(fV0Reader->GetZ()) > fV0Reader->GetLineCutZValueMin()){
1878 fHistograms->FillHistogram("ESD_Conversion_XY_BeamPipe", fV0Reader->GetX(),fV0Reader->GetY());
1879 fHistograms->FillHistogram("ESD_Conversion_RPhi_BeamPipe", vtxConv.Phi(),fV0Reader->GetXYRadius());
1880 }
e60f3265 1881
1882
2eedd4ed 1883 fHistograms->FillHistogram("ESD_E_Energy", fV0Reader->GetNegativeTrackEnergy());
1884 fHistograms->FillHistogram("ESD_E_Pt", fV0Reader->GetNegativeTrackPt());
1885 fHistograms->FillHistogram("ESD_E_Eta", fV0Reader->GetNegativeTrackEta());
1886 fHistograms->FillHistogram("ESD_E_Phi", fV0Reader->GetNegativeTrackPhi());
1887 fHistograms->FillHistogram("ESD_E_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
1888 fHistograms->FillHistogram("ESD_E_nITSClusters", fV0Reader->GetNegativeTracknITSClusters());
1889 if ( fV0Reader->GetNegativeTrackPt()> 0.150){
1890 fHistograms->FillHistogram("ESD_E_minPt_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
1891 }
1892 if ( fV0Reader->GetNegativeTracknITSClusters()==0){
1893 fHistograms->FillHistogram("ESD_E_onlyTPC_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
1894 }
5ce758b0 1895
2eedd4ed 1896 Double_t eClsToF= 0;
1897 if(!fV0Reader->GetUseCorrectedTPCClsInfo()){
1898 if(fV0Reader->GetNegativeTracknTPCFClusters()!=0 ){
1899 eClsToF=(Double_t)fV0Reader->GetNegativeTracknTPCClusters()/(Double_t)fV0Reader->GetNegativeTracknTPCFClusters();
1900 }
1901 } else {
1902 eClsToF= fV0Reader->GetNegativeESDTrack()->GetTPCClusterInfo(2,0,fV0Reader->GetFirstTPCRow(fV0Reader->GetXYRadius()));
1903 }
1904 fHistograms->FillHistogram("ESD_E_nTPCClustersToFP", fV0Reader->GetNegativeTrackP(),eClsToF );
1905 fHistograms->FillHistogram("ESD_E_nTPCClustersToFR", fV0Reader->GetXYRadius(),eClsToF );
5ce758b0 1906
2eedd4ed 1907 if(fV0Reader->GetNegativeTracknTPCClusters()!=0 ){
1908 fHistograms->FillHistogram("ESD_E_TPCchi2", fV0Reader->GetNegativeTrackTPCchi2()/(Double_t)fV0Reader->GetNegativeTracknTPCClusters());
1909 }
5ce758b0 1910
40051a3e 1911
40051a3e 1912
2eedd4ed 1913 fHistograms->FillHistogram("ESD_P_Energy", fV0Reader->GetPositiveTrackEnergy());
1914 fHistograms->FillHistogram("ESD_P_Pt", fV0Reader->GetPositiveTrackPt());
1915 fHistograms->FillHistogram("ESD_P_Eta", fV0Reader->GetPositiveTrackEta());
1916 fHistograms->FillHistogram("ESD_P_Phi", fV0Reader->GetPositiveTrackPhi());
1917 fHistograms->FillHistogram("ESD_P_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
1918 fHistograms->FillHistogram("ESD_P_nITSClusters", fV0Reader->GetPositiveTracknITSClusters());
1919 if ( fV0Reader->GetPositiveTrackPt()> 0.150){
1920 fHistograms->FillHistogram("ESD_P_minPt_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
1921 }
1922 if (fV0Reader->GetPositiveTracknITSClusters()==0){
1923 fHistograms->FillHistogram("ESD_P_onlyTPC_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
1924 }
5ce758b0 1925
2eedd4ed 1926 Double_t pClsToF= 0;
1927 if(!fV0Reader->GetUseCorrectedTPCClsInfo()){
1928 if(fV0Reader->GetPositiveTracknTPCFClusters()!=0){
1929 pClsToF = (Double_t)fV0Reader->GetPositiveTracknTPCClusters()/(Double_t)fV0Reader->GetPositiveTracknTPCFClusters();
1930 }
1931 } else {
1932 pClsToF= fV0Reader->GetPositiveESDTrack()->GetTPCClusterInfo(2,0,fV0Reader->GetFirstTPCRow(fV0Reader->GetXYRadius()));
1933 }
5ce758b0 1934
2eedd4ed 1935 fHistograms->FillHistogram("ESD_P_nTPCClustersToFP",fV0Reader->GetPositiveTrackP(), pClsToF);
1936 fHistograms->FillHistogram("ESD_P_nTPCClustersToFR",fV0Reader->GetXYRadius(), pClsToF);
40051a3e 1937
2eedd4ed 1938 if(fV0Reader->GetPositiveTracknTPCClusters()!=0){
1939 fHistograms->FillHistogram("ESD_P_TPCchi2", fV0Reader->GetPositiveTrackTPCchi2()/(Double_t)fV0Reader->GetPositiveTracknTPCClusters());
1940 }
037dc2db 1941
e60f3265 1942
9640a3d1 1943
2eedd4ed 1944 fHistograms->FillHistogram("ESD_ConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
1945 fHistograms->FillHistogram("ESD_ConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
1946 fHistograms->FillHistogram("ESD_ConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
1947 fHistograms->FillHistogram("ESD_ConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
1948 fHistograms->FillHistogram("ESD_ConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
1949 fHistograms->FillHistogram("ESD_ConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
1950 fHistograms->FillHistogram("ESD_ConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
1951 fHistograms->FillHistogram("ESD_ConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
1952 fHistograms->FillHistogram("ESD_ConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
1953 fHistograms->FillHistogram("ESD_ConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
d7d7e825 1954
2eedd4ed 1955 fHistograms->FillHistogram("ESD_ConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
1956 fHistograms->FillHistogram("ESD_ConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
d7d7e825 1957
2eedd4ed 1958 fHistograms->FillHistogram("ESD_ConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
1959 fHistograms->FillHistogram("ESD_ConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
1960 fHistograms->FillHistogram("ESD_ConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
1961 fHistograms->FillHistogram("ESD_ConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
d7d7e825 1962
2eedd4ed 1963 fHistograms->FillHistogram("ESD_ConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
1964 fHistograms->FillHistogram("ESD_ConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
1965 fHistograms->FillHistogram("ESD_ConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
1966 fHistograms->FillHistogram("ESD_ConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
1967 fHistograms->FillHistogram("ESD_ConvGamma_E_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kElectron));
1968 fHistograms->FillHistogram("ESD_ConvGamma_P_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kElectron));
1969 fHistograms->FillHistogram("ESD_ConvGamma_PiPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kPion));
1970 fHistograms->FillHistogram("ESD_ConvGamma_PiMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kPion));
1971 fHistograms->FillHistogram("ESD_ConvGamma_KPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kKaon));
1972 fHistograms->FillHistogram("ESD_ConvGamma_KMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kKaon));
1973 fHistograms->FillHistogram("ESD_ConvGamma_PPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kProton));
1974 fHistograms->FillHistogram("ESD_ConvGamma_PMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kProton));
1975 fHistograms->FillHistogram("ESD_ConvGamma_MuPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kMuon));
1976 fHistograms->FillHistogram("ESD_ConvGamma_MuMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kMuon));
d7d7e825 1977
9640a3d1 1978
2eedd4ed 1979 UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus(); //moved up here from below RRnewTOF
1980 UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus();
1981 // RRnewTOF start ///////////////////////////////////////////////
1982 Double_t t0pos = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetPositiveTrackP());
1983 Double_t t0neg = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetNegativeTrackP());
1984
1985 Double_t timesPos[5];
1986 fV0Reader->GetPositiveESDTrack()->GetIntegratedTimes(timesPos);
1987 Double_t timesNeg[5];
1988 fV0Reader->GetNegativeESDTrack()->GetIntegratedTimes(timesNeg);
1989
1990 Double_t TOFsignalPos = fV0Reader->GetPositiveTrackTOFsignal();
1991 Double_t TOFsignalNeg = fV0Reader->GetNegativeTrackTOFsignal();
1992
1993 Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
1994 Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
1995
1996 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_ConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
1997 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_ConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
1998 // RRnewTOF end /////////////////////////////////////////////////
1999
2000 Double_t negPID=0;
2001 Double_t posPID=0;
2002 fV0Reader->GetPIDProbability(negPID,posPID);
2003 fHistograms->FillHistogram("ESD_ConvGamma_E_EProbP",fV0Reader->GetNegativeTrackP(),negPID);
2004 fHistograms->FillHistogram("ESD_ConvGamma_P_EProbP",fV0Reader->GetPositiveTrackP(),posPID);
2005
2006 Double_t negPIDmupi=0;
2007 Double_t posPIDmupi=0;
2008 fV0Reader->GetPIDProbabilityMuonPion(negPIDmupi,posPIDmupi);
2009 fHistograms->FillHistogram("ESD_ConvGamma_E_mupiProbP",fV0Reader->GetNegativeTrackP(),negPIDmupi);
2010 fHistograms->FillHistogram("ESD_ConvGamma_P_mupiProbP",fV0Reader->GetPositiveTrackP(),posPIDmupi);
2011
2012 Double_t armenterosQtAlfa[2];
2013 fV0Reader->GetArmenterosQtAlfa(fV0Reader-> GetNegativeKFParticle(),
2014 fV0Reader-> GetPositiveKFParticle(),
2015 fV0Reader->GetMotherCandidateKFCombination(),
2016 armenterosQtAlfa);
2017
2018 fHistograms->FillHistogram("ESD_ConvGamma_alfa_qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
2019 fHistograms->FillHistogram("ESD_ConvGamma_Pt_Qt",fV0Reader->GetMotherCandidatePt(),armenterosQtAlfa[0]);
2020
2021 if(!fV0Reader->GetIsHeavyIon()){
2022 fHistograms->FillHistogram("3DPlots_Conversion_XYZ", fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ());
2023 //fHistograms->FillHistogram("3DPlots_Conversion_ZRPhi", fV0Reader->GetZ(),fV0Reader->GetXYRadius(), vtxConv.Phi());
2024
2025 // begin mapping
2026 Int_t rBin = fHistograms->GetRBin(fV0Reader->GetXYRadius());
2027 Int_t zBin = fHistograms->GetZBin(fV0Reader->GetZ());
2028 Int_t phiBin = fHistograms->GetPhiBin(fV0Reader->GetNegativeTrackPhi());
2029 Double_t rFMD=25;
2030 Double_t rITSTPCMin=45;
2031 Double_t rITSTPCMax=80;
a0b94e5c 2032
2eedd4ed 2033 // Double_t motherCandidateEta= fV0Reader->GetMotherCandidateEta();
2034
2035 TString nameESDMappingPhiR="";
2036 nameESDMappingPhiR.Form("ESD_Conversion_Mapping_Phi%02d_R%02d",phiBin,rBin);
2037 //fHistograms->FillHistogram(nameESDMappingPhiR, fV0Reader->GetZ(), motherCandidateEta);
2038
2039 TString nameESDMappingPhi="";
2040 nameESDMappingPhi.Form("ESD_Conversion_Mapping_Phi%02d",phiBin);
2041 //fHistograms->FillHistogram(nameESDMappingPhi, fV0Reader->GetZ(), motherCandidateEta);
2042
2043 TString nameESDMappingR="";
2044 nameESDMappingR.Form("ESD_Conversion_Mapping_R%02d",rBin);
2045 //fHistograms->FillHistogram(nameESDMappingR, fV0Reader->GetZ(), motherCandidateEta);
2046
2047 TString nameESDMappingPhiInR="";
2048 nameESDMappingPhiInR.Form("ESD_Conversion_Mapping_Phi_in_R_%02d",rBin);
2049 // fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetMotherCandidatePhi());
2050 fHistograms->FillHistogram(nameESDMappingPhiInR, vtxConv.Phi());
2051
2052 TString nameESDMappingZInR="";
2053 nameESDMappingZInR.Form("ESD_Conversion_Mapping_Z_in_R_%02d",rBin);
2054 fHistograms->FillHistogram(nameESDMappingZInR, fV0Reader->GetZ());
2055
2056 TString nameESDMappingPhiInZ="";
2057 nameESDMappingPhiInZ.Form("ESD_Conversion_Mapping_Phi_in_Z_%02d",zBin);
2058 // fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetMotherCandidatePhi());
2059 fHistograms->FillHistogram(nameESDMappingPhiInZ, vtxConv.Phi());
2060
2061 if(fV0Reader->GetXYRadius()<rFMD){
2062 TString nameESDMappingFMDPhiInZ="";
2063 nameESDMappingFMDPhiInZ.Form("ESD_Conversion_Mapping_FMD_Phi_in_Z_%02d",zBin);
2064 fHistograms->FillHistogram(nameESDMappingFMDPhiInZ, vtxConv.Phi());
2065 fHistograms->FillHistogram("ESD_ConversionMapping_FMD_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2066 }
2067 if(fV0Reader->GetXYRadius()>rFMD && fV0Reader->GetXYRadius()<rITSTPCMin){
2068 fHistograms->FillHistogram("ESD_ConversionMapping_FMD2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2069 }
2070
2071 if(fV0Reader->GetXYRadius()>rITSTPCMin && fV0Reader->GetXYRadius()<rITSTPCMax){
2072 TString nameESDMappingITSTPCPhiInZ="";
2073 nameESDMappingITSTPCPhiInZ.Form("ESD_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",zBin);
2074 fHistograms->FillHistogram(nameESDMappingITSTPCPhiInZ, vtxConv.Phi());
2075 fHistograms->FillHistogram("ESD_ConversionMapping_ITSTPC_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2076 }
2077
2078 TString nameESDMappingRInZ="";
2079 nameESDMappingRInZ.Form("ESD_Conversion_Mapping_R_in_Z_%02d",zBin);
2080 fHistograms->FillHistogram(nameESDMappingRInZ, fV0Reader->GetXYRadius());
2081
2082 if(fV0Reader->GetMotherCandidatePt() > fLowPtMapping && fV0Reader->GetMotherCandidatePt()< fHighPtMapping){
2083 TString nameESDMappingMidPtPhiInR="";
2084 nameESDMappingMidPtPhiInR.Form("ESD_Conversion_Mapping_MidPt_Phi_in_R_%02d",rBin);
2085 fHistograms->FillHistogram(nameESDMappingMidPtPhiInR, vtxConv.Phi());
a0b94e5c 2086
2eedd4ed 2087 TString nameESDMappingMidPtZInR="";
2088 nameESDMappingMidPtZInR.Form("ESD_Conversion_Mapping_MidPt_Z_in_R_%02d",rBin);
2089 fHistograms->FillHistogram(nameESDMappingMidPtZInR, fV0Reader->GetZ());
a0b94e5c 2090
2eedd4ed 2091 TString nameESDMappingMidPtPhiInZ="";
2092 nameESDMappingMidPtPhiInZ.Form("ESD_Conversion_Mapping_MidPt_Phi_in_Z_%02d",zBin);
2093 fHistograms->FillHistogram(nameESDMappingMidPtPhiInZ, vtxConv.Phi());
2094 if(fV0Reader->GetXYRadius()<rFMD){
2095 TString nameESDMappingMidPtFMDPhiInZ="";
2096 nameESDMappingMidPtFMDPhiInZ.Form("ESD_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",zBin);
2097 fHistograms->FillHistogram(nameESDMappingMidPtFMDPhiInZ, vtxConv.Phi());
2098 }
2099 TString nameESDMappingMidPtRInZ="";
2100 nameESDMappingMidPtRInZ.Form("ESD_Conversion_Mapping_MidPt_R_in_Z_%02d",zBin);
2101 fHistograms->FillHistogram(nameESDMappingMidPtRInZ, fV0Reader->GetXYRadius());
2102 }
2103 }
9640a3d1 2104
2eedd4ed 2105 // end mapping
2106
2107
2108 new((*fKFReconstructedGammasTClone)[fKFReconstructedGammasTClone->GetEntriesFast()]) AliKFConversionPhoton(fV0Reader);
2109
2110
2111 //----------------------------------- checking for "real" conversions (MC match) --------------------------------------
2112 if(fDoMCTruth){
2113 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2114 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2115 Double_t rFMD=25;
2116 Double_t rITSTPCMin=45;
2117 Double_t rITSTPCMax=80;
2118
2119 if(fV0Reader->HasSameMCMother() == kFALSE){
2120 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_R", fV0Reader->GetXYRadius());
2121 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_Z", fV0Reader->GetZ());
2122 fHistograms->FillHistogram("ESD_TrueConvCombSelected_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
2123 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2124 fHistograms->FillHistogram("ESD_TrueConvCombinatorialMinPt_R", fV0Reader->GetXYRadius());
2125 fHistograms->FillHistogram("ESD_TrueConvCombinatorialMinPt_Z", fV0Reader->GetZ());
2126 }
2127 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_Pt", fV0Reader->GetMotherCandidatePt());
2128 fHistograms->FillHistogram("ESD_TrueConvCombinatorialDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2129 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
2130 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElec_R", fV0Reader->GetXYRadius());
2131 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElec_Pt", fV0Reader->GetMotherCandidatePt());
2132 }
2133 if(TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==211){
2134 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPi_R", fV0Reader->GetXYRadius());
2135 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPi_Pt", fV0Reader->GetMotherCandidatePt());
2136 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2137 }
2138 if((TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==2211) ||
2139 (TMath::Abs(negativeMC->GetPdgCode())==2212 && TMath::Abs(positiveMC->GetPdgCode())==211)){
2140 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiP_R", fV0Reader->GetXYRadius());
2141 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiP_Pt", fV0Reader->GetMotherCandidatePt());
2142 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiPDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2143 }
2144 if((TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==211) ||
2145 (TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==11)){
2146 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElecPi_R", fV0Reader->GetXYRadius());
2147 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElecPi_Pt", fV0Reader->GetMotherCandidatePt());
2148 }
2149 if( (statusPos & AliESDtrack::kTOFpid) && ( TMath::Abs(positiveMC->GetPdgCode()) != 11 ) && !(statusPos & AliESDtrack::kTOFmismatch) )
2150 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_DaughtersNotElec_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);//RRnewTOF
2151 if( (statusNeg & AliESDtrack::kTOFpid) && ( TMath::Abs(negativeMC->GetPdgCode()) != 11 ) && !(statusNeg & AliESDtrack::kTOFmismatch) )
2152 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_DaughtersNotElec_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);//RRnewTOF
2153 continue;
2154 }
2155
2156 // Moved up to check true electron background
2157 // TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2158 // TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2159
2160 if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
2161 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_R", fV0Reader->GetXYRadius());
2162 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Z", fV0Reader->GetZ());
2163 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2164 fHistograms->FillHistogram("ESD_TrueConvHadronicBckMinPt_R", fV0Reader->GetXYRadius());
2165 fHistograms->FillHistogram("ESD_TrueConvHadronicBckMinPt_Z", fV0Reader->GetZ());
2166 }
2167 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Pt", fV0Reader->GetMotherCandidatePt());
2168 fHistograms->FillHistogram("ESD_TrueConvHadronicBckDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2169 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) )
2170 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Daughters_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);//RRnewTOF
2171 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) )
2172 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Daughters_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);//RRnewTOF
2173 if((TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==2211) ||
2174 (TMath::Abs(negativeMC->GetPdgCode())==2212 && TMath::Abs(positiveMC->GetPdgCode())==211)){
2175 fHistograms->FillHistogram("ESD_TrueConvLambda_R", fV0Reader->GetXYRadius());
2176 fHistograms->FillHistogram("ESD_TrueConvLambda_Pt", fV0Reader->GetMotherCandidatePt());
2177 }
2178 if(TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==211){
2179 fHistograms->FillHistogram("ESD_TrueConvMeson_R", fV0Reader->GetXYRadius());
2180 fHistograms->FillHistogram("ESD_TrueConvMeson_Pt", fV0Reader->GetMotherCandidatePt());
2181 }
2182 continue;
2183 }
2184
2185
2186 if(negativeMC->GetPdgCode()==positiveMC->GetPdgCode()){
2187 continue;
2188 }
2189
2190 //UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus(); moved higher
2191 //UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus();
2192 UChar_t itsPixelPos = fV0Reader->GetPositiveESDTrack()->GetITSClusterMap();
2193 UChar_t itsPixelNeg = fV0Reader->GetNegativeESDTrack()->GetITSClusterMap();
2194
2195 // Using the UniqueID Phojet does not get the Dalitz right
2196 // if( (negativeMC->GetUniqueID() == 4 && positiveMC->GetUniqueID() ==4) ||
2197 // (negativeMC->GetUniqueID() == 0 && positiveMC->GetUniqueID() ==0) ){// fill r distribution for Dalitz decays
2198 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 111){ //pi0
2199 fHistograms->FillHistogram("ESD_TrueDalitzContamination_R", fV0Reader->GetXYRadius());
2200 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_R", fV0Reader->GetXYRadius());
2201 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_Z", fV0Reader->GetZ());
2202 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2203 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0MinPt_R", fV0Reader->GetXYRadius());
2204 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0MinPt_Z", fV0Reader->GetZ());
2205 }
2206
2207 //--------Histos for HFE
2208
2209 if(statusPos & AliESDtrack::kTOFpid){
2210 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SinglePos_R", fV0Reader->GetXYRadius());
2211 if( TESTBIT(itsPixelPos, 0) ){
2212 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SinglePos_kFirst_R", fV0Reader->GetXYRadius());
2213 }
2214 }
2215 if(statusNeg & AliESDtrack::kTOFpid){
2216 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SingleNeg_R", fV0Reader->GetXYRadius());
2217 if( TESTBIT(itsPixelNeg, 0) ){
2218 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SingleNeg_kFirst_R", fV0Reader->GetXYRadius());
2219 }
2220 }
2221 //--------------------------------------------------------
2222
2223 }
2224 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 221){ //eta
2225 fHistograms->FillHistogram("ESD_TrueConvDalitzEta_R", fV0Reader->GetXYRadius());
2226 fHistograms->FillHistogram("ESD_TrueConvDalitzEta_Z", fV0Reader->GetZ());
2227 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2228 fHistograms->FillHistogram("ESD_TrueConvDalitzEtaMinPt_R", fV0Reader->GetXYRadius());
2229 fHistograms->FillHistogram("ESD_TrueConvDalitzEtaMinPt_Z", fV0Reader->GetZ());
2230 }
2231 }
2232
2233 //}
2234
2235 if(negativeMC->GetUniqueID() != 5 || positiveMC->GetUniqueID() !=5){// check if the daughters come from a conversion
2236 continue;
2237 }
2238
2239 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
2240 if(fDoCF){
2241 Double_t containerInput[3];
2242 containerInput[0] = fV0Reader->GetMotherCandidatePt();
2243 containerInput[1] = fV0Reader->GetMotherCandidateEta();
2244 containerInput[2] = fV0Reader->GetMotherCandidateMass();
2245 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTrueGamma); // for CF
2246 }
2247
2248 // RRnewTOF start ///////////////////////////////////////////////
2249 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) {
2250 fHistograms->FillHistogram("ESD_TrueConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
2251 }
2252 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) {
2253 fHistograms->FillHistogram("ESD_TrueConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
2254 }
2255 // RRnewTOF end /////////////////////////////////////////////////
2256 if (fV0Reader->HasSameMCMother() == kTRUE){
2257 fHistograms->FillHistogram("ESD_TrueConvGammaSelected_Alpha_Qt",armenterosQtAlfa[1],armenterosQtAlfa[0]);
2258 fHistograms->FillHistogram("ESD_TrueConvGammaSelected_Pt_Qt",fV0Reader->GetMotherCandidatePt(),armenterosQtAlfa[0]);
2259 }
2260 // RRnewTOF end /////////////////////////////////////////////////
2261
2262 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
2263 if(negativeMC->GetMother(0) <= fStack->GetNprimary()){ // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
2264 fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
2265 fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_R", fV0Reader->GetXYRadius());
2266 fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_Z", fV0Reader->GetZ());
2267 if( fV0Reader->GetMotherCandidatePt() > 2. ) {
2268 fHistograms->FillHistogram("ESD_TrueConvPrimaryGammaMinPt_R", fV0Reader->GetXYRadius());
2269 fHistograms->FillHistogram("ESD_TrueConvPrimaryGammaMinPt_Z", fV0Reader->GetZ());
2270 }
2271 }
2272 if(fV0Reader->GetMotherMCParticle()->GetMother(0) > -1){
2273 if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetPdgCode() == 221){ // Use just gamma from eta for ratio esdtruegamma / mcconvgamma
2274 fHistograms->FillHistogram("ESD_TrueConvEtaGamma_Pt", fV0Reader->GetMotherCandidatePt());
2275 }
2276 }
2277 fHistograms->FillHistogram("ESD_TrueConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
2278 fHistograms->FillHistogram("ESD_TrueConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
2279 fHistograms->FillHistogram("ESD_TrueConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
2280 fHistograms->FillHistogram("ESD_TrueConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
2281 fHistograms->FillHistogram("ESD_TrueConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
2282 fHistograms->FillHistogram("ESD_TrueConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
2283 fHistograms->FillHistogram("ESD_TrueConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
2284 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
2285 fHistograms->FillHistogram("ESD_TrueConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
2286 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLength",fV0Reader->GetNegativeNTPCClusters());
2287 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLength",fV0Reader->GetPositiveNTPCClusters());
2288 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLengthVSInvMass",fV0Reader->GetNegativeNTPCClusters(),fV0Reader->GetMotherCandidateMass());
2289 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLengthVSInvMass",fV0Reader->GetPositiveNTPCClusters(),fV0Reader->GetMotherCandidateMass());
2290
2291 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
2292 fHistograms->FillHistogram("ESD_TrueConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
2293 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2294 fHistograms->FillHistogram("ESD_TrueConversionMinPt_R", fV0Reader->GetXYRadius());
2295 fHistograms->FillHistogram("ESD_TrueConversionMinPt_Z", fV0Reader->GetZ());
2296 }
2297
2298 fHistograms->FillHistogram("ESD_TrueConversion_E_nTPCClustersToFR", fV0Reader->GetXYRadius(),eClsToF );
2299 fHistograms->FillHistogram("ESD_TrueConversion_P_nTPCClustersToFR",fV0Reader->GetXYRadius(), pClsToF);
2300
2301 fHistograms->FillHistogram("ESD_TrueConversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
2302 fHistograms->FillHistogram("ESD_TrueConversion_R", fV0Reader->GetXYRadius());
2303 fHistograms->FillHistogram("ESD_TrueConversion_Z", fV0Reader->GetZ());
2304 fHistograms->FillHistogram("ESD_TrueConversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
2305 fHistograms->FillHistogram("ESD_TrueConversionMapping_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
2306 fHistograms->FillHistogram("ESD_TrueConversionMapping_ZPhi", fV0Reader->GetZ(),vtxConv.Phi());
2307 fHistograms->FillHistogram("ESD_TrueConversionMapping_RPhi", fV0Reader->GetXYRadius(),vtxConv.Phi());
2308 if(fV0Reader->GetXYRadius()<rFMD){
2309 fHistograms->FillHistogram("ESD_TrueConversionMapping_FMD_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2310 }
2311 if(fV0Reader->GetXYRadius()>rFMD && fV0Reader->GetXYRadius()<rITSTPCMin){
2312 fHistograms->FillHistogram("ESD_TrueConversionMapping_FMD2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2313 }
2314 if(fV0Reader->GetXYRadius()>rITSTPCMin && fV0Reader->GetXYRadius()<rITSTPCMax){
2315 fHistograms->FillHistogram("ESD_TrueConversionMapping_ITSTPC_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2316 }
2317 fHistograms->FillHistogram("ESD_TrueConversion_OpeningAngle", fV0Reader->GetOpeningAngle());
2318
2319 //----Histos for HFE--------------------------------------
2320
2321 if(statusPos & AliESDtrack::kTOFpid){
2322 fHistograms->FillHistogram("ESD_TrueConversion_SinglePos_R", positiveMC->R(),fV0Reader->GetPositiveMCParticle()->Pt());
2323 if( TESTBIT(itsPixelPos, 0) ){
2324 fHistograms->FillHistogram("ESD_TrueConversion_SinglePos_kFirst_R", positiveMC->R(),fV0Reader->GetPositiveMCParticle()->Pt());
2325 }
2326 }
2327 if(statusNeg & AliESDtrack::kTOFpid){
2328 fHistograms->FillHistogram("ESD_TrueConversion_SingleNeg_R", negativeMC->R(),fV0Reader->GetNegativeMCParticle()->Pt());
2329 if( TESTBIT(itsPixelNeg, 0) ){
2330 fHistograms->FillHistogram("ESD_TrueConversion_SingleNeg_kFirst_R", negativeMC->R(),fV0Reader->GetNegativeMCParticle()->Pt());
2331 }
2332 }
2333 //--------------------------------------------------------
2334
2335 fHistograms->FillHistogram("ESD_TrueConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
2336 fHistograms->FillHistogram("ESD_TrueConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
2337 fHistograms->FillHistogram("ESD_TrueConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
2338 fHistograms->FillHistogram("ESD_TrueConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
2339 if (fV0Reader->GetMotherCandidateP() != 0) {
2340 fHistograms->FillHistogram("ESD_TrueConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
2341 fHistograms->FillHistogram("ESD_TrueConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
2342 } else {
2343 cout << "Error::fV0Reader->GetNegativeTrackP() == 0 !!!" << endl;
2344 }
a0b94e5c 2345
2eedd4ed 2346 fHistograms->FillHistogram("ESD_TrueConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
2347 fHistograms->FillHistogram("ESD_TrueConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
2348
2349 //store MCTruth properties
2350 fHistograms->FillHistogram("ESD_TrueConvGamma_MC_Pt_Eta", fV0Reader->GetMotherMCParticle()->Pt(),fV0Reader->GetMotherMCParticle()->Eta());
2351 fHistograms->FillHistogram("ESD_TrueConversion_MC_ZR", negativeMC->Vz(),negativeMC->R());
2352 fHistograms->FillHistogram("ESD_TrueConversion_MC_XY", negativeMC->Vx(),negativeMC->Vy());
d7d7e825 2353
2eedd4ed 2354 //resolution
2355 Double_t mcpt = fV0Reader->GetMotherMCParticle()->Pt();
2356 Double_t esdpt = fV0Reader->GetMotherCandidatePt();
2357 Double_t resdPt = 0.;
2358 if(mcpt > 0){
2359 resdPt = ((esdpt - mcpt)/mcpt)*100.;
2360 } else if(mcpt < 0){
2361 cout<<"Pt of MC particle is negative, this will cause wrong calculation of resPt"<<endl;
2362 }
2363
2364 fHistograms->FillHistogram("Resolution_Gamma_dPt_Pt", mcpt, resdPt);
2365 fHistograms->FillHistogram("Resolution_MCPt_ESDPt", mcpt,esdpt);
2366 fHistograms->FillHistogram("Resolution_Gamma_dPt_Phi", fV0Reader->GetMotherCandidatePhi(), resdPt);
2367 if (esdpt> 0.150){
2368 fHistograms->FillHistogram("Resolution_Gamma_minPt_dPt_Phi", fV0Reader->GetMotherCandidatePhi(), resdPt);
2369 }
2370
2371 Double_t resdZ = 0.;
2372 if(fV0Reader->GetNegativeMCParticle()->Vz() != 0){
2373 resdZ = ((fV0Reader->GetZ() -fV0Reader->GetNegativeMCParticle()->Vz())/fV0Reader->GetNegativeMCParticle()->Vz())*100.;
2374 }
2375 Double_t resdZAbs = 0.;
2376 resdZAbs = (fV0Reader->GetZ() -fV0Reader->GetNegativeMCParticle()->Vz());
2377
2378 fHistograms->FillHistogram("Resolution_dZAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdZAbs);
2379 fHistograms->FillHistogram("Resolution_dZAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdZAbs);
2380 fHistograms->FillHistogram("Resolution_dZ", fV0Reader->GetNegativeMCParticle()->Vz(), resdZ);
2381 fHistograms->FillHistogram("Resolution_MCZ_ESDZ", fV0Reader->GetNegativeMCParticle()->Vz(),fV0Reader->GetZ());
2382
2383 // new for dPt_Pt-histograms for Electron and Positron
2384 Double_t mcEpt;
2385 Double_t resEdPt=0;
2386 UInt_t kTRDoutN, statusN;
2387 Int_t nITSclsE;
2388 // new for dPt_Pt-histograms for Electron and Positron
2389 if (fV0Reader->GetNegativeMCParticle()->GetPdgCode() == 11) {
2390 mcEpt = fV0Reader->GetNegativeMCParticle()->Pt();
2391 } else {
2392 mcEpt = fV0Reader->GetPositiveMCParticle()->Pt();
2393 }
2394 if (mcEpt > 0){
2395 resEdPt = ((fV0Reader->GetNegativeTrackPt()-mcEpt)/mcEpt)*100.;
2396 }
2397 statusN = fV0Reader->GetNegativeESDTrack()->GetStatus();
2398 kTRDoutN = (statusN & AliESDtrack::kTRDout);
2399 nITSclsE= fV0Reader->GetNegativeTracknITSClusters();
2400
2401 // filling Resolution_Pt_dPt with respect to the Number of ITS clusters for Positrons
2402 switch(nITSclsE){
2403 case 0: // 0 ITS clusters
2404 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS0", mcEpt, resEdPt);
2405 break;
2406 case 1: // 1 ITS cluster
2407 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS1", mcEpt, resEdPt);
2408 break;
2409 case 2: // 2 ITS clusters
2410 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS2", mcEpt, resEdPt);
2411 break;
2412 case 3: // 3 ITS clusters
2413 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS3", mcEpt, resEdPt);
2414 break;
2415 case 4: // 4 ITS clusters
2416 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS4", mcEpt, resEdPt);
2417 break;
2418 case 5: // 5 ITS clusters
2419 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS5", mcEpt, resEdPt);
2420 break;
2421 case 6: // 6 ITS clusters
2422 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS6", mcEpt, resEdPt);
2423 break;
2424 }
2425 //Filling histograms with respect to Electron resolution
2426 fHistograms->FillHistogram("Resolution_E_dPt_Pt", mcEpt, resEdPt);
2427 fHistograms->FillHistogram("Resolution_E_dPt_Phi", fV0Reader->GetNegativeTrackPhi(), resEdPt);
2428 if (fV0Reader->GetNegativeTrackPt()> 0.150){
2429 fHistograms->FillHistogram("Resolution_E_minPt_dPt_Phi", fV0Reader->GetNegativeTrackPhi(), resEdPt);
2430 }
2431
2432 if(kTRDoutN){
2433 fHistograms->FillHistogram("Resolution_E_nTRDtracklets_ESDPt", fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDntracklets());
2434 fHistograms->FillHistogram("Resolution_E_nTRDtracklets_MCPt", mcEpt, fV0Reader->GetNegativeESDTrack()->GetTRDntracklets());
2435 fHistograms->FillHistogram("Resolution_E_nTRDclusters_ESDPt",fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDncls());
2436 fHistograms->FillHistogram("Resolution_E_nTRDclusters_MCPt",mcEpt, fV0Reader->GetNegativeESDTrack()->GetTRDncls());
2437 fHistograms->FillHistogram("Resolution_E_TRDsignal_ESDPt", fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDsignal());
2438 }
2439
2440 Double_t mcPpt;
2441 if (fV0Reader->GetPositiveMCParticle()->GetPdgCode() == -11) {
2442 mcPpt = fV0Reader->GetPositiveMCParticle()->Pt();
2443 } else {
2444 mcPpt = fV0Reader->GetNegativeMCParticle()->Pt();
2445 }
2446
2447 Double_t resPdPt = 0;
2448 if (mcPpt > 0){
2449 resPdPt = ((fV0Reader->GetPositiveTrackPt()-mcPpt)/mcPpt)*100.;
2450 }
2451
2452 UInt_t statusP = fV0Reader->GetPositiveESDTrack()->GetStatus();
2453 // AliESDtrack * posTr= fV0Reader->GetPositiveESDTrack();
2454 UInt_t kTRDoutP = (statusP & AliESDtrack::kTRDout);
d7d7e825 2455
2eedd4ed 2456 Int_t nITSclsP = fV0Reader->GetPositiveTracknITSClusters();
2457 // filling Resolution_Pt_dPt with respect to the Number of ITS clusters for Positrons
2458 switch(nITSclsP){
2459 case 0: // 0 ITS clusters
2460 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS0", mcPpt, resPdPt);
2461 break;
2462 case 1: // 1 ITS cluster
2463 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS1", mcPpt, resPdPt);
2464 break;
2465 case 2: // 2 ITS clusters
2466 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS2", mcPpt, resPdPt);
2467 break;
2468 case 3: // 3 ITS clusters
2469 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS3", mcPpt, resPdPt);
2470 break;
2471 case 4: // 4 ITS clusters
2472 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS4", mcPpt, resPdPt);
2473 break;
2474 case 5: // 5 ITS clusters
2475 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS5", mcPpt, resPdPt);
2476 break;
2477 case 6: // 6 ITS clusters
2478 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS6", mcPpt, resPdPt);
2479 break;
2480 }
2481 //Filling histograms with respect to Positron resolution
2482 fHistograms->FillHistogram("Resolution_P_dPt_Pt", mcPpt, resPdPt);
2483 fHistograms->FillHistogram("Resolution_P_dPt_Phi", fV0Reader->GetPositiveTrackPhi(), resPdPt);
2484 if (fV0Reader->GetPositiveTrackPt()> 0.150){
2485 fHistograms->FillHistogram("Resolution_P_minPt_dPt_Phi", fV0Reader->GetPositiveTrackPhi(), resPdPt);
2486 }
2487
2488 if(kTRDoutP){
2489 fHistograms->FillHistogram("Resolution_P_nTRDtracklets_ESDPt", fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDntracklets());
2490 fHistograms->FillHistogram("Resolution_P_nTRDtracklets_MCPt", mcPpt, fV0Reader->GetPositiveESDTrack()->GetTRDntracklets());
2491 fHistograms->FillHistogram("Resolution_P_nTRDclusters_ESDPt",fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDncls());
2492 fHistograms->FillHistogram("Resolution_P_nTRDclusters_MCPt",mcPpt, fV0Reader->GetPositiveESDTrack()->GetTRDncls());
2493 fHistograms->FillHistogram("Resolution_P_TRDsignal_ESDPt", fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDsignal());
2494 }
037dc2db 2495
2eedd4ed 2496
2497 Double_t resdR = 0.;
2498 if(fV0Reader->GetNegativeMCParticle()->R() != 0){
2499 resdR = ((fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R())/fV0Reader->GetNegativeMCParticle()->R())*100.;
2500 }
2501 Double_t resdRAbs = 0.;
2502 resdRAbs = (fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R());
2503
2504 fHistograms->FillHistogram("Resolution_dRAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdRAbs);
2505 fHistograms->FillHistogram("Resolution_dR", fV0Reader->GetNegativeMCParticle()->R(), resdR);
2506 fHistograms->FillHistogram("Resolution_MCR_ESDR", fV0Reader->GetNegativeMCParticle()->R(),fV0Reader->GetXYRadius());
2507 fHistograms->FillHistogram("Resolution_R_dPt", fV0Reader->GetNegativeMCParticle()->R(), resdPt);
2508 if (esdpt> 0.150){
2509 fHistograms->FillHistogram("Resolution_minPt_R_dPt", fV0Reader->GetNegativeMCParticle()->R(), resdPt);
2510 }
2511
2512 Double_t resdPhiAbs=0.;
2513 resdPhiAbs=0.;
2514 resdPhiAbs= (fV0Reader->GetMotherCandidatePhi()-fV0Reader->GetNegativeMCParticle()->Phi());
2515 fHistograms->FillHistogram("Resolution_MCPhi_ESDPhi", fV0Reader->GetNegativeMCParticle()->Phi(),fV0Reader->GetMotherCandidatePhi());
2516 fHistograms->FillHistogram("Resolution_dPhiAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdPhiAbs);
2517 fHistograms->FillHistogram("Resolution_dPhiAbs_VS_Phi", fV0Reader->GetNegativeMCParticle()->Phi(), resdPhiAbs);
2518 }//if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22)
2519 }//if(fDoMCTruth)
2520 }//while(fV0Reader->NextV0)
2521 fHistograms->FillHistogram("ESD_NumberOfSurvivingV0s", nSurvivingV0s);
2522 fHistograms->FillHistogram("ESD_NumberOfV0s", fV0Reader->GetNumberOfV0s());
2523 fHistograms->FillHistogram("ESD_NumberOfContributorsVtx", fV0Reader->GetNumberOfContributorsVtx());
2524 fV0Reader->ResetV0IndexNumber();
d7d7e825 2525}
2526
81900183 2527
6441e967 2528
2eedd4ed 2529//_____________________________________________________________________________________
6272370b 2530void AliAnalysisTaskGammaConversion::ProcessGammasForOmegaMesonAnalysis(){
2eedd4ed 2531 // omega meson analysis pi0+gamma decay
2532 for(Int_t firstPi0Index=0;firstPi0Index<fKFReconstructedPi0sTClone->GetEntriesFast();firstPi0Index++){
2533 AliKFConversionMother * omegaCandidatePi0Daughter = (AliKFConversionMother *)fKFReconstructedPi0sTClone->At(firstPi0Index);
2534 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
2535
2536 AliKFConversionPhoton * omegaCandidateGammaDaughter = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
2537 if(omegaCandidatePi0Daughter->GetGammaLabel(0)==firstGammaIndex || omegaCandidatePi0Daughter->GetGammaLabel(1)==firstGammaIndex){
2538 continue;
2539 }
2540
2541 AliKFParticle omegaCandidate(*omegaCandidatePi0Daughter,*omegaCandidateGammaDaughter);
2542 Double_t massOmegaCandidate = 0.;
2543 Double_t widthOmegaCandidate = 0.;
2544
2545 omegaCandidate.GetMass(massOmegaCandidate,widthOmegaCandidate);
2546
2547 if ( massOmegaCandidate > 733 && massOmegaCandidate < 833 ) {
2548 //AddOmegaToAOD(&omegaCandidate, massOmegaCandidate, firstPi0Index, firstGammaIndex);
2549 }
2550
2551 fHistograms->FillHistogram("ESD_Omega_InvMass_vs_Pt",massOmegaCandidate ,omegaCandidate.GetPt());
2552 fHistograms->FillHistogram("ESD_Omega_InvMass",massOmegaCandidate);
48682642 2553
2eedd4ed 2554 //delete omegaCandidate;
5ce758b0 2555
2eedd4ed 2556 }// end of omega reconstruction in pi0+gamma channel
5ce758b0 2557
2eedd4ed 2558 if(fDoJet == kTRUE){
2559 AliKFParticle* negPiKF=NULL;
2560 AliKFParticle* posPiKF=NULL;
2561 Int_t piPlusMotherLabel=-1;
2562 Int_t piMinusMotherLabel=-1;
2563
2564 // look at the pi+pi+pi0 channel
2565 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2566 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2567 if (posTrack->GetSign()<0) continue;
2568 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
2569 if (posPiKF) delete posPiKF; posPiKF=NULL;
2570 posPiKF = new AliKFParticle( *(posTrack) ,211);
2571 if(fDoMCTruth){
2572 TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2573 if(positiveMCParticle->GetMother(0)>-1){
2574 piPlusMotherLabel = positiveMCParticle->GetMother(0);
2575 }
2576 }
2577
2578 for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
2579 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
2580 if( negTrack->GetSign()>0) continue;
2581 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2582 if (negPiKF) delete negPiKF; negPiKF=NULL;
2583 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2584 AliKFParticle omegaCandidatePipPinPi0(*omegaCandidatePi0Daughter,*posPiKF,*negPiKF);
2585 Double_t massOmegaCandidatePipPinPi0 = 0.;
2586 Double_t widthOmegaCandidatePipPinPi0 = 0.;
2587
2588 omegaCandidatePipPinPi0.GetMass(massOmegaCandidatePipPinPi0,widthOmegaCandidatePipPinPi0);
2589
2590 if ( massOmegaCandidatePipPinPi0 > 733 && massOmegaCandidatePipPinPi0 < 833 ) {
2591 // AddOmegaToAOD(&omegaCandidatePipPinPi0, massOmegaCandidatePipPinPi0, -1, -1);
2592 }
2593
2594 fHistograms->FillHistogram("ESD_OmegaPipPinPi0_InvMass_vs_Pt",massOmegaCandidatePipPinPi0 ,omegaCandidatePipPinPi0.GetPt());
2595 fHistograms->FillHistogram("ESD_OmegaPipPinPi0_InvMass",massOmegaCandidatePipPinPi0);
ef2e2748 2596
2597
2eedd4ed 2598 if(fDoMCTruth){
2599 TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[jCh])->GetLabel()));
2600 if(negativeMCParticle->GetMother(0)>-1){
2601 piMinusMotherLabel = negativeMCParticle->GetMother(0);
2602 if( piMinusMotherLabel == piPlusMotherLabel){
2603 Int_t geantCode=fStack->Particle(TMath::Abs(piPlusMotherLabel))->GetPdgCode();
2604 if(geantCode == 221 || geantCode == 223){
2605 fHistograms->FillHistogram("ESD_TrueOmegaPipPinPi0_InvMass_vs_Pt",massOmegaCandidatePipPinPi0 ,omegaCandidatePipPinPi0.GetPt());
2606 }
2607 }
2608
2609 }
2610
2611 }
2612
2613 // delete omegaCandidatePipPinPi0;
2614 }
2615 }
2616
2617 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
2618
2619 } // checking ig gammajet because in that case the chargedparticle list is created
48682642 2620
48682642 2621 }
2eedd4ed 2622 ////////////////////////
2623
2624 // gamma+ pi+
2625 if(fDoJet == kTRUE){
2626 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
2627 AliKFConversionPhoton * rhoCandidateGammaDaughter = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
2628 Int_t gamma1MotherLabel=-1;
2629 if(fDoMCTruth){
2630 Int_t indexKF1 = rhoCandidateGammaDaughter->GetV0Index();
2631 if(indexKF1<fV0Reader->GetNumberOfV0s()){
2632 fV0Reader->GetV0(indexKF1);//updates to the correct v0
2633
2634 if(fV0Reader->HasSameMCMother() == kTRUE){
2635 //cout<<"This v0 is a real v0!!!!"<<endl;
2636 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2637 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2638 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
2639 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
2640 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
2641 gamma1MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
2642 }
2643 }
2644 }
2645 }
2646 }
2647 }
2648
2649 AliKFParticle* posPiKF=NULL;
2650 AliKFParticle* negPiKF=NULL;
2651 Int_t piPlusMotherLabel=-1;
2652 Int_t piMinusMotherLabel=-1;
2653
2654 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2655 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2656 if (posTrack->GetSign()<0) continue;
2657 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
2658 if (posPiKF) delete posPiKF; posPiKF=NULL;
2659 posPiKF = new AliKFParticle( *(posTrack) ,211);
2660 AliKFParticle rhoPlusCandidate(*posPiKF,*rhoCandidateGammaDaughter);
2661 Double_t massRhoPlusCandidate = 0.;
2662 Double_t widthRhoPlusCandidate = 0.;
2663
2664 rhoPlusCandidate.GetMass(massRhoPlusCandidate,widthRhoPlusCandidate);
2665 fHistograms->FillHistogram("ESD_RhoPlus_InvMass_vs_Pt",massRhoPlusCandidate ,rhoPlusCandidate.GetPt());
2666 fHistograms->FillHistogram("ESD_RhoPlus_InvMass",massRhoPlusCandidate);
2667
2668
2669 if(fDoMCTruth){
2670 TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2671 if(positiveMCParticle->GetMother(0)>-1){
2672 piPlusMotherLabel = positiveMCParticle->GetMother(0);
2673 if(piPlusMotherLabel == gamma1MotherLabel){
2674 //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
2675 //cout<<"RhoPlus::" << geantCode<< endl;
2676 fHistograms->FillHistogram("ESD_TrueRhoPlus_InvMass_vs_Pt",massRhoPlusCandidate ,rhoPlusCandidate.GetPt());
2677 }
2678 }
2679 }
2680 for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
2681 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
2682 if (negTrack->GetSign()>0) continue;
2683 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2684 if (negPiKF) delete negPiKF; negPiKF=NULL;
2685 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2686 AliKFParticle rho0Candidate(*posPiKF,*negPiKF,*rhoCandidateGammaDaughter);
2687 Double_t massRho0Candidate = 0.;
2688 Double_t widthRho0Candidate = 0.;
2689
2690 rho0Candidate.GetMass(massRho0Candidate,widthRho0Candidate);
2691 fHistograms->FillHistogram("ESD_Rho0_InvMass_vs_Pt",massRho0Candidate ,rho0Candidate.GetPt());
2692 fHistograms->FillHistogram("ESD_Rho0_InvMass",massRho0Candidate);
2693
2694 if(fDoMCTruth){
2695 TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[jCh])->GetLabel()));
2696 if(negativeMCParticle->GetMother(0)>-1){
2697 piMinusMotherLabel = negativeMCParticle->GetMother(0);
2698 if( piMinusMotherLabel == piPlusMotherLabel && piMinusMotherLabel==gamma1MotherLabel ){
2699 Int_t geantCode=fStack->Particle(TMath::Abs(piPlusMotherLabel))->GetPdgCode();
2700 if(geantCode == 221 || geantCode == 113){
2701 fHistograms->FillHistogram("ESD_TrueRho0_InvMass_vs_Pt",massRho0Candidate ,rho0Candidate.GetPt());
2702 }
2703 }
2704 }
2705 }
2706 }
2707
2708 }
2709
2710 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
2711
2712
2713 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2714 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2715 if (negTrack->GetSign()>0) continue;
2716 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2717 if (negPiKF) delete negPiKF; negPiKF=NULL;
2718 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2719 AliKFParticle rhoMinusCandidate(*negPiKF,*rhoCandidateGammaDaughter);
2720 Double_t massRhoMinusCandidate = 0.;
2721 Double_t widthRhoMinusCandidate = 0.;
2722
2723 rhoMinusCandidate.GetMass(massRhoMinusCandidate,widthRhoMinusCandidate);
2724 fHistograms->FillHistogram("ESD_RhoMinus_InvMass_vs_Pt",massRhoMinusCandidate ,rhoMinusCandidate.GetPt());
2725 fHistograms->FillHistogram("ESD_RhoMinus_InvMass",massRhoMinusCandidate);
2726
2727 if(fDoMCTruth){
2728 TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2729 Int_t pionMotherLabel=-1;
2730
2731 if(negativeMCParticle->GetMother(0)>-1){
2732 pionMotherLabel = negativeMCParticle->GetMother(0);
2733 if(pionMotherLabel == gamma1MotherLabel){
2734 //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
2735 //cout<<"RhoMinus::" << geantCode<< endl;
2736 fHistograms->FillHistogram("ESD_TrueRhoMinus_InvMass_vs_Pt",massRhoMinusCandidate ,rhoMinusCandidate.GetPt());
2737 }
2738 }
2739 }
2740 }
2741 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
2742
2743 AliKFParticle* posProtKF=NULL;
d7d7e825 2744
2eedd4ed 2745
2746 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2747 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2748 if (posTrack->GetSign()<0) continue;
2749 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kProton))>2.) continue;
2750 if (posProtKF) delete posProtKF; posProtKF=NULL;
2751 posProtKF = new AliKFParticle( *(posTrack) ,2212);
2752 AliKFParticle deltaPlusCandidate(*posProtKF,*rhoCandidateGammaDaughter);
2753 Double_t massDeltaPlusCandidate = 0.;
2754 Double_t widthDeltaPlusCandidate = 0.;
2755
2756 deltaPlusCandidate.GetMass(massDeltaPlusCandidate,widthDeltaPlusCandidate);
2757 fHistograms->FillHistogram("ESD_DeltaPlus_InvMass_vs_Pt",massDeltaPlusCandidate ,deltaPlusCandidate.GetPt());
2758 fHistograms->FillHistogram("ESD_DeltaPlus_InvMass",massDeltaPlusCandidate);
2759
2760 if(fDoMCTruth){
2761 TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2762 Int_t protonMotherLabel=-1;
2763
2764 if(positiveMCParticle->GetMother(0)>-1){
2765 protonMotherLabel = positiveMCParticle->GetMother(0);
2766 if(protonMotherLabel == gamma1MotherLabel){
2767 //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
2768 //cout<<"RhoPlus::" << geantCode<< endl;
2769 fHistograms->FillHistogram("ESD_TrueDeltaPlus_InvMass_vs_Pt",massDeltaPlusCandidate ,deltaPlusCandidate.GetPt());
2770 }
2771 }
2772 }
2773
2774 }
2775 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL; if (posProtKF) delete posProtKF; posProtKF=NULL;
2776 }
2777 }
2778
2779 if(fCalculateBackground){
2780
2781 AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
2782
2783 Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
2784 Int_t mbin = 0;
2785 if(fUseTrackMultiplicityForBG == kTRUE){
2786 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
2787 } else {
2788 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
2789 }
2790
2791 AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
2792
2793 // Background calculation for the omega
2794 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
2795 AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2796
2797 if(fMoveParticleAccordingToVertex == kTRUE){
2798 bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
2799 }
2800 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2801 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
2802
2803 if(fMoveParticleAccordingToVertex == kTRUE){
2804 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2805 }
2806
2807 for(Int_t firstPi0Index=0;firstPi0Index<fKFReconstructedPi0sTClone->GetEntriesFast();firstPi0Index++){
2808 AliKFParticle * omegaCandidatePi0Daughter = (AliKFParticle *)fKFReconstructedPi0sTClone->At(firstPi0Index);
2809 AliKFParticle * omegaBckCandidate = new AliKFParticle(*omegaCandidatePi0Daughter,previousGoodV0);
2810 Double_t massOmegaBckCandidate = 0.;
2811 Double_t widthOmegaBckCandidate = 0.;
2812
2813 omegaBckCandidate->GetMass(massOmegaBckCandidate,widthOmegaBckCandidate);
2814
2815
2816 fHistograms->FillHistogram("ESD_Omega_Bck_InvMass_vs_Pt",massOmegaBckCandidate ,omegaBckCandidate->GetPt());
2817 fHistograms->FillHistogram("ESD_Omega_Bck_InvMass",massOmegaBckCandidate);
2818
2819 delete omegaBckCandidate;
2820 }
2821
2822 // Bck for gamma pi+ pi-
2823
2824 AliKFParticle* posPiKF=NULL;
2825 AliKFParticle* negPiKF=NULL;
2826
2827 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2828 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2829 if (posTrack->GetSign()<0) continue;
2830 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
2831 if (posPiKF) delete posPiKF; posPiKF=NULL;
2832 posPiKF = new AliKFParticle( *(posTrack) ,211);
2833
2834 for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
2835 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
2836 if (negTrack->GetSign()>0) continue;
2837 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2838 if (negPiKF) delete negPiKF; negPiKF=NULL;
2839 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2840 AliKFParticle rho0BckCandidate(*posPiKF,*negPiKF,previousGoodV0);
2841 Double_t massRho0BckCandidate = 0.;
2842 Double_t widthRho0BckCandidate = 0.;
2843
2844 rho0BckCandidate.GetMass(massRho0BckCandidate,widthRho0BckCandidate);
2845 fHistograms->FillHistogram("ESD_Rho0Bck_InvMass_vs_Pt",massRho0BckCandidate ,rho0BckCandidate.GetPt());
2846 fHistograms->FillHistogram("ESD_Rho0Bck_InvMass",massRho0BckCandidate);
2847 }
2848
2849 }
2850
2851 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
04bf4381 2852
04bf4381 2853
2eedd4ed 2854 }
2855 }
2856 } // end of checking if background calculation is available
2857}
04bf4381 2858
2859
d7d7e825 2860void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
2eedd4ed 2861 // see header file for documentation
d7d7e825 2862
2eedd4ed 2863 // for(UInt_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammas.size();firstGammaIndex++){
2864 // for(UInt_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFReconstructedGammas.size();secondGammaIndex++){
037dc2db 2865
2eedd4ed 2866 fESDEvent = fV0Reader->GetESDEvent();
5ce758b0 2867
2eedd4ed 2868 if(fKFReconstructedGammasTClone->GetEntriesFast()>fV0Reader->GetNumberOfV0s()){
2869 cout<<"Warning, number of entries in the tclone is bigger than number of v0s"<<endl;
2870 }
037dc2db 2871
2eedd4ed 2872 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
2873 for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();secondGammaIndex++){
a0b94e5c 2874
2eedd4ed 2875 // AliKFParticle * twoGammaDecayCandidateDaughter0 = &fKFReconstructedGammas[firstGammaIndex];
2876 // AliKFParticle * twoGammaDecayCandidateDaughter1 = &fKFReconstructedGammas[secondGammaIndex];
a0b94e5c 2877
2eedd4ed 2878 AliKFConversionPhoton * twoGammaDecayCandidateDaughter0 = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
2879 AliKFConversionPhoton * twoGammaDecayCandidateDaughter1 = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(secondGammaIndex);
2880
2881 if(twoGammaDecayCandidateDaughter0->GetTrackLabelPositive()==twoGammaDecayCandidateDaughter1->GetTrackLabelPositive()||
2882 twoGammaDecayCandidateDaughter0->GetTrackLabelPositive()==twoGammaDecayCandidateDaughter1->GetTrackLabelNegative()||
2883 twoGammaDecayCandidateDaughter0->GetTrackLabelNegative()==twoGammaDecayCandidateDaughter1->GetTrackLabelPositive()||
2884 twoGammaDecayCandidateDaughter0->GetTrackLabelNegative()==twoGammaDecayCandidateDaughter1->GetTrackLabelNegative())continue;
d7d7e825 2885
2eedd4ed 2886 AliKFConversionMother *twoGammaCandidate = new AliKFConversionMother(*twoGammaDecayCandidateDaughter0,*twoGammaDecayCandidateDaughter1);
2887 twoGammaCandidate->SetGammaLabels(firstGammaIndex,secondGammaIndex);
2888
2889 Double_t massTwoGammaCandidate = 0.;
2890 Double_t widthTwoGammaCandidate = 0.;
2891 Double_t chi2TwoGammaCandidate =10000.;
2892 twoGammaCandidate->GetMass(massTwoGammaCandidate,widthTwoGammaCandidate);
2893 // if(twoGammaCandidate->GetNDF()>0){
2894 // chi2TwoGammaCandidate = twoGammaCandidate->GetChi2()/twoGammaCandidate->GetNDF();
2895 chi2TwoGammaCandidate = twoGammaCandidate->GetChi2();
d7d7e825 2896
2eedd4ed 2897 fHistograms->FillHistogram("ESD_Mother_Chi2",chi2TwoGammaCandidate);
2898 if((chi2TwoGammaCandidate>0 && chi2TwoGammaCandidate<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
d7d7e825 2899
2eedd4ed 2900 TVector3 momentumVectorTwoGammaCandidate(twoGammaCandidate->GetPx(),twoGammaCandidate->GetPy(),twoGammaCandidate->GetPz());
2901 TVector3 spaceVectorTwoGammaCandidate(twoGammaCandidate->GetX(),twoGammaCandidate->GetY(),twoGammaCandidate->GetZ());
2902
2903 Double_t openingAngleTwoGammaCandidate = twoGammaCandidate->GetOpeningAngle();
dc2883e4 2904
2eedd4ed 2905 Double_t rapidity=twoGammaCandidate->GetRapidity();
2906
2907 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut()){
2908 delete twoGammaCandidate;
2909 continue; // rapidity cut
2910 }
dc2883e4 2911
2eedd4ed 2912 Double_t alfa=twoGammaCandidate->GetAlpha();
dc2883e4 2913
2eedd4ed 2914
2915 if(openingAngleTwoGammaCandidate < fMinOpeningAngleGhostCut){
2916 delete twoGammaCandidate;
2917 continue; // minimum opening angle to avoid using ghosttracks
2918 }
1e7846f4 2919
2eedd4ed 2920 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
2921 fHistograms->FillHistogram("ESD_Mother_GammaDaughter_OpeningAngle", openingAngleTwoGammaCandidate);
2922 fHistograms->FillHistogram("ESD_Mother_Energy", twoGammaCandidate->GetE());
2923 fHistograms->FillHistogram("ESD_Mother_Pt", momentumVectorTwoGammaCandidate.Pt());
2924 fHistograms->FillHistogram("ESD_Mother_Eta", momentumVectorTwoGammaCandidate.Eta());
2925 fHistograms->FillHistogram("ESD_Mother_Rapid", rapidity);
2926 fHistograms->FillHistogram("ESD_Mother_Phi", spaceVectorTwoGammaCandidate.Phi());
2927 fHistograms->FillHistogram("ESD_Mother_Mass", massTwoGammaCandidate);
2928 fHistograms->FillHistogram("ESD_Mother_alfa", alfa);
2929 if( (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) ){
2930 fHistograms->FillHistogram("ESD_Mother_alfa_Pi0", alfa);
2931 fHistograms->FillHistogram("ESD_Mother_Pt_alpha_Pi0", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
2932 }
2933 if( (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) ){
2934 fHistograms->FillHistogram("ESD_Mother_alfa_Eta", alfa);
2935 fHistograms->FillHistogram("ESD_Mother_Pt_alpha_Eta", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
2936 }
2937
2938 fHistograms->FillHistogram("ESD_Mother_R", spaceVectorTwoGammaCandidate.Pt()); // Pt in Space == R!!!
2939 fHistograms->FillHistogram("ESD_Mother_ZR", twoGammaCandidate->GetZ(), spaceVectorTwoGammaCandidate.Pt());
2940 fHistograms->FillHistogram("ESD_Mother_XY", twoGammaCandidate->GetX(), twoGammaCandidate->GetY());
2941 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
2942 fHistograms->FillHistogram("ESD_Mother_InvMass",massTwoGammaCandidate);
2943 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
2944 }
2945 if(alfa<0.1){
2946 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_E_alpha",massTwoGammaCandidate ,twoGammaCandidate->GetE());
2947 }
2948
2949 if(fCalculateBackground){
2950 /* Kenneth, just for testing*/
2951 AliGammaConversionBGHandler * bgHandlerTest = fV0Reader->GetBGHandler();
2952
2953 Int_t zbin= bgHandlerTest->GetZBinIndex(fV0Reader->GetVertexZ());
2954 Int_t mbin=0;
2955 Int_t multKAA=0;
2956 if(fUseTrackMultiplicityForBG == kTRUE){
2957 multKAA=fV0Reader->CountESDTracks();
2958 mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
2959 }
2960 else{// means we use #v0s for multiplicity
2961 multKAA=fV0Reader->GetNGoodV0s();
2962 mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
2963 }
2964 // cout<<"Filling bin number "<<zbin<<" and "<<mbin<<endl;
2965 // cout<<"Corresponding to z = "<<fV0Reader->GetVertexZ()<<" and m = "<<multKAA<<endl;
2966 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
2967 fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass",zbin,mbin),massTwoGammaCandidate);
2968 fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass_vs_Pt",zbin,mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
2969 /* end Kenneth, just for testing*/
2970 fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
2971 }
2972 }
2973 /* if(fCalculateBackground){
2974 AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
2975 Int_t mbin= bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
2976 fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
2977 }*/
2978 // if(fDoNeutralMesonV0MCCheck){
2979 if(fDoMCTruth){
2980 //Kenneth: Checking the eta of the gamma to check the difference between 0.9 and 1.2
2981 Int_t indexKF1 = twoGammaDecayCandidateDaughter0->GetV0Index();
2982 if(indexKF1<fV0Reader->GetNumberOfV0s()){
2983 fV0Reader->GetV0(indexKF1);//updates to the correct v0
2984 Double_t eta1 = fV0Reader->GetMotherCandidateEta();
2985 Bool_t isRealPi0=kFALSE;
2986 Bool_t isRealEta=kFALSE;
2987 Int_t gamma1MotherLabel=-1;
2988 if(fV0Reader->HasSameMCMother() == kTRUE){
2989 //cout<<"This v0 is a real v0!!!!"<<endl;
2990 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2991 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2992 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
2993 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
2994 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
2995 gamma1MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
2996 }
2997 }
2998 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==111){
2999 gamma1MotherLabel=-111;
3000 }
3001 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==221){
3002 gamma1MotherLabel=-221;
3003 }
3004 }
3005 }
3006 Int_t indexKF2 = twoGammaDecayCandidateDaughter1->GetV0Index();
3007 if(indexKF1 == indexKF2){
3008 cout<<"index of the two KF particles are the same.... should not happen"<<endl;
3009 }
3010 if(indexKF2<fV0Reader->GetNumberOfV0s()){
3011 fV0Reader->GetV0(indexKF2);
3012 Double_t eta2 = fV0Reader->GetMotherCandidateEta();
3013 Int_t gamma2MotherLabel=-1;
3014 if(fV0Reader->HasSameMCMother() == kTRUE){
3015 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
3016 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
3017 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
3018 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
3019 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
3020 gamma2MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
3021 }
3022 }
3023 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==111){
3024 gamma2MotherLabel=-111;
3025 }
3026 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==221){
3027 gamma2MotherLabel=-221;
3028 }
3029
3030 }
3031 }
3032 if(gamma1MotherLabel>=0 && gamma1MotherLabel==gamma2MotherLabel){
3033 if(fV0Reader->CheckIfPi0IsMother(gamma1MotherLabel)){
3034 isRealPi0=kTRUE;
3035 }
3036 if(fV0Reader->CheckIfEtaIsMother(gamma1MotherLabel)){
3037 isRealEta=kTRUE;
3038 }
3039 }
3040
3041 //cout << "alpha " << alfa << endl;
3042 if(isRealPi0)fHistograms->FillHistogram("ESD_TruePi0_alpha",alfa);
3043 if(isRealEta)fHistograms->FillHistogram("ESD_TrueEta_alpha",alfa);
3044
3045 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3046 if(TMath::Abs(eta1)>0.9 && TMath::Abs(eta2)>0.9){
3047 // fHistograms->FillHistogram("ESD_Mother_InvMass_1212",massTwoGammaCandidate);
3048 // fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3049 if(isRealPi0 || isRealEta){
3050 fHistograms->FillHistogram("ESD_TruePi0_InvMass_1212",massTwoGammaCandidate);
3051 fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_1212",openingAngleTwoGammaCandidate);
3052 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3053 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3054 fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
3055 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3056 if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
3057 fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3058 if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
3059 fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3060
3061 }
3062
3063 if(!isRealPi0 && !isRealEta){
3064 if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
3065 fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3066 } else {
3067 fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3068 }
3069 if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221){
3070 fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3071 }
3072 }
3073 } else if(TMath::Abs(eta1)>0.9 || TMath::Abs(eta2)>0.9){
3074 // fHistograms->FillHistogram("ESD_Mother_InvMass_0912",massTwoGammaCandidate);
3075 // fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3076
3077 if(isRealPi0 || isRealEta){
3078 fHistograms->FillHistogram("ESD_TruePi0_InvMass_0912",massTwoGammaCandidate);
3079 fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_0912",openingAngleTwoGammaCandidate);
3080 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3081 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3082 fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
3083 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3084 if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
3085 fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3086 if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
3087 fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3088 }
3089 if(!isRealPi0 && !isRealEta){
3090 if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
3091 fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3092 }else{
3093 fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3094 }
3095 if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221){
3096 fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3097 }
3098 }
3099 } else {
3100 // fHistograms->FillHistogram("ESD_Mother_InvMass_0909",massTwoGammaCandidate);
3101 // fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3102 if(isRealPi0 || isRealEta){
3103 fHistograms->FillHistogram("ESD_TruePi0_InvMass_0909",massTwoGammaCandidate);
3104 fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_0909",openingAngleTwoGammaCandidate);
3105 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3106 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3107 fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
3108 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3109 if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
3110 fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3111 if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
3112 fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3113 if(gamma1MotherLabel > fV0Reader->GetMCStack()->GetNprimary()){
3114 fHistograms->FillHistogram("ESD_TruePi0Sec_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3115 TParticle * secPi0MC = (TParticle*)fStack->Particle(fV0Reader->GetMotherMCParticle()->GetFirstMother());
3116 if (secPi0MC->GetMother(0) >-1){
3117 if(fStack->Particle(secPi0MC->GetMother(0))->GetPdgCode()==kK0Short){
3118 fHistograms->FillHistogram("ESD_TruePi0SecFromK0S_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3119 }
3120 }
3121 }
3122 }
3123 if(!isRealPi0 && !isRealEta){
3124 if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
3125 fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3126 }else{
3127 fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3128 }
3129 if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221 ){
3130 fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3131 }
3132 }
3133 }
3134 }
3135 }
3136 }
3137 }
3138 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3139 if ( TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())<0.9 && TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())<0.9 ){
3140 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_Fiducial",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3141 fHistograms->FillHistogram("ESD_Mother_InvMass_Fiducial",massTwoGammaCandidate);
3142 }
3143
3144 if(TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())>0.9 && TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())>0.9){
3145 fHistograms->FillHistogram("ESD_Mother_InvMass_1212",massTwoGammaCandidate);
3146 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3147 }
3148 else if(TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())>0.9 || TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())>0.9){
3149 fHistograms->FillHistogram("ESD_Mother_InvMass_0912",massTwoGammaCandidate);
3150 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3151 }
3152 else{
3153 fHistograms->FillHistogram("ESD_Mother_InvMass_0909",massTwoGammaCandidate);
3154 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3155 }
3156
3157 Double_t lowMassPi0=0.1;
3158 Double_t highMassPi0=0.15;
3159 if ( ( massTwoGammaCandidate > lowMassPi0) && (massTwoGammaCandidate < highMassPi0) ){
3160 new((*fKFReconstructedPi0sTClone)[fKFReconstructedPi0sTClone->GetEntriesFast()]) AliKFConversionMother(*twoGammaCandidate);
3161 }
3162
3163 if( fKFCreateAOD ) {
3164 lowMassPi0=0.08;
3165 highMassPi0=0.2;
3166 Double_t lowMassEta=0.4;
3167 Double_t highMassEta=0.7;
3168
3169 if ( ( massTwoGammaCandidate > lowMassPi0) && (massTwoGammaCandidate < highMassPi0) ){
3170
3171 TagDaughter(twoGammaCandidate->GetGammaLabel(0));
3172 TagDaughter(twoGammaCandidate->GetGammaLabel(1));
3173 // AddPionToAOD(twoGammaCandidate);
3174 } else if ( ( massTwoGammaCandidate > lowMassEta) && (massTwoGammaCandidate < highMassEta) ){
3175 TagDaughter(twoGammaCandidate->GetGammaLabel(0));
3176 TagDaughter(twoGammaCandidate->GetGammaLabel(1));
3177 // AddPionToAOD(twoGammaCandidate);
3178 }
3179 } // if create aod
3180
3181 }
3182 }
3183 delete twoGammaCandidate;
3184 }
cc5a88a2 3185 }
2eedd4ed 3186}
cc5a88a2 3187
2eedd4ed 3188///__________________________________________________________________________________
3189void AliAnalysisTaskGammaConversion::AddGammaToAOD(AliKFConversionPhoton * kfParticle) {
9640a3d1 3190
2eedd4ed 3191 //Fill AOD with particles
3192 TClonesArray *branch=fAODGamma;
3193 if(branch){
fd420a4f 3194 new((*branch)[branch->GetEntriesFast()]) AliAODConversionPhoton(kfParticle);
3195 } else {
3196 return;
3197 }
2eedd4ed 3198
3199 //Add PID information with ESD tender (AOD implementation is not complete)
3200
fd420a4f 3201 AliAODConversionPhoton *gamma=static_cast<AliAODConversionPhoton*>(fAODGamma->At(fAODGamma->GetEntriesFast()-1));
2eedd4ed 3202
3203 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
3204 AliInputEventHandler* inputHandler = (AliInputEventHandler*) (man->GetInputEventHandler());
3205 AliPIDResponse *fPIDResponse = (AliPIDResponse*)inputHandler->GetPIDResponse();
3206
3207 fESDEvent = fV0Reader->GetESDEvent();
3208
3209 if(fESDEvent){
3210 Int_t labelp=((AliESDv0*)fESDEvent->GetV0(kfParticle->GetV0Index()))->GetPindex();
3211 Int_t labeln=((AliESDv0*)fESDEvent->GetV0(kfParticle->GetV0Index()))->GetNindex();
3212
3213 AliESDtrack *trackpos=fESDEvent->GetTrack(labelp);
3214 AliESDtrack *trackneg=fESDEvent->GetTrack(labeln);
3215
3216 if(trackpos&&trackneg){
3217
3218 Float_t fNSigmadEdxPositive[5];
3219 Float_t fNSigmadEdxNegative[5];
3220
3221 fNSigmadEdxPositive[0]=fPIDResponse->NumberOfSigmasTPC(trackpos,AliPID::kElectron);
3222 fNSigmadEdxPositive[1]=fPIDResponse->NumberOfSigmasTPC(trackpos,AliPID::kMuon);
3223 fNSigmadEdxPositive[2]=fPIDResponse->NumberOfSigmasTPC(trackpos,AliPID::kPion);
3224 fNSigmadEdxPositive[3]=fPIDResponse->NumberOfSigmasTPC(trackpos,AliPID::kKaon);
3225 fNSigmadEdxPositive[4]=fPIDResponse->NumberOfSigmasTPC(trackpos,AliPID::kProton);
3226
3227 fNSigmadEdxNegative[0]=fPIDResponse->NumberOfSigmasTPC(trackneg,AliPID::kElectron);
3228 fNSigmadEdxNegative[1]=fPIDResponse->NumberOfSigmasTPC(trackneg,AliPID::kMuon);
3229 fNSigmadEdxNegative[2]=fPIDResponse->NumberOfSigmasTPC(trackneg,AliPID::kPion);
3230 fNSigmadEdxNegative[3]=fPIDResponse->NumberOfSigmasTPC(trackneg,AliPID::kKaon);
3231 fNSigmadEdxNegative[4]=fPIDResponse->NumberOfSigmasTPC(trackneg,AliPID::kProton);
3232
3233 gamma->SetNSigmadEdx(fNSigmadEdxPositive,fNSigmadEdxNegative);
2e2da371 3234 }
d7d7e825 3235 }
d7d7e825 3236}
3237
2eedd4ed 3238/*///__________________________________________________________________________________
3239void AliAnalysisTaskGammaConversion::AddPionToAOD(AliKFConversionMother * kfParticle) {
3240
3241 //Add pions to AOD
3242 TClonesArray *branch=fAODPi0;
3243
3244 if(branch){
3245 new((*branch)[branch->GetEntriesFast()]) AliAODConversionMother(kfParticle);
18922343 3246 }
2eedd4ed 3247
3248 TagDaughter(kfParticle->GetGammaLabel(0));
3249 TagDaughter(kfParticle->GetGammaLabel(1));
81900183 3250}
3251
3252///__________________________________________________________________________________
2eedd4ed 3253void AliAnalysisTaskGammaConversion::AddOmegaToAOD(AliKFParticle * kfParticle, Int_t daughter1, Int_t daughter2) {
81900183 3254
2eedd4ed 3255 //Add omegas to AOD
81900183 3256
2eedd4ed 3257 TClonesArray *branch=fAODOmega;
3258 // Get Daughters
3259 // AliAODConversionPhoton * fdaughter1 = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(daughter1));
3260 // AliAODConversionPhoton * fdaughter2 = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(daughter2));
81900183 3261
2eedd4ed 3262 if(branch){
3263 // new((*branch)[branch->GetEntriesFast()]) AliAODConversionMother(kfParticle);
3264 }
3265
3266 TagDaughter(daughter1);
3267 TagDaughter(daughter2);
3268
3269
3270}
3271*/
81900183 3272///__________________________________________________________________________________
3273void AliAnalysisTaskGammaConversion::TagDaughter(Int_t gammaIndex) {
2eedd4ed 3274 //Set conversion tag on pion daughters
3275 AliAODConversionPhoton * daughter = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(gammaIndex));
3276 if(daughter) {
3277 daughter->SetTag(kTRUE);
3278 } else {
3279 AliError("Daughter not in gamma tree!!");
3280 }
81900183 3281}
3282
3283///___________________________________________________________________________________
3284void AliAnalysisTaskGammaConversion::FillAODWithConversionGammas(){
2eedd4ed 3285 // Fill AOD with reconstructed Gamma
3286 for(Int_t gammaIndex=0;gammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();gammaIndex++){
3287 AliKFConversionPhoton * gammakf = dynamic_cast<AliKFConversionPhoton*>(fKFReconstructedGammasTClone->At(gammaIndex));
3288 if(gammakf) {
3289 AddGammaToAOD(gammakf);
3290 }
3291 }
04bf4381 3292}
3293
48682642 3294/*
2eedd4ed 3295 void AliAnalysisTaskGammaConversion::ProcessConvPHOSGammasForNeutralMesonAnalysis(){
3296
3297 // see header file for documentation
3298 // Analyse Pi0 with one photon from Phos and 1 photon from conversions
3299
3300
3301
3302 Double_t vtx[3];
3303 vtx[0] = fV0Reader->GetPrimaryVertex()->GetX();
3304 vtx[1] = fV0Reader->GetPrimaryVertex()->GetY();
3305 vtx[2] = fV0Reader->GetPrimaryVertex()->GetZ();
3306
3307
3308 // Loop over all CaloClusters and consider only the PHOS ones:
3309 AliESDCaloCluster *clu;
3310 TLorentzVector pPHOS;
3311 TLorentzVector gammaPHOS;
3312 TLorentzVector gammaGammaConv;
3313 TLorentzVector pi0GammaConvPHOS;
3314 TLorentzVector gammaGammaConvBck;
3315 TLorentzVector pi0GammaConvPHOSBck;
3316
3317
3318 for (Int_t i=0; i<fV0Reader->GetESDEvent()->GetNumberOfCaloClusters(); i++) {
3319 clu = fV0Reader->GetESDEvent()->GetCaloCluster(i);
3320 if ( !clu->IsPHOS() || clu->E()<0.1 ) continue;
3321 clu ->GetMomentum(pPHOS ,vtx);
3322 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
3323 AliKFParticle * twoGammaDecayCandidateDaughter0 = (AliKFParticle *)fKFReconstructedGammasTClone->At(firstGammaIndex);
3324 gammaGammaConv.SetXYZM(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz(),0.);
3325 gammaPHOS.SetXYZM(pPHOS.Px(),pPHOS.Py(),pPHOS.Pz(),0.);
3326 pi0GammaConvPHOS=gammaGammaConv+gammaPHOS;
3327 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS",pi0GammaConvPHOS.M());
3328 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvPHOS",pi0GammaConvPHOS.M(),pi0GammaConvPHOS.Pt());
3329
3330 TVector3 v3D0(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz());
3331 TVector3 v3D1(gammaPHOS.Px(),gammaPHOS.Py(),gammaPHOS.Pz());
3332 Double_t opanConvPHOS= v3D0.Angle(v3D1);
3333 if ( opanConvPHOS < 0.35){
3334 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS_OpanLow",pi0GammaConvPHOS.M());
3335 }else{
3336 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS_OpanHigh",pi0GammaConvPHOS.M());
3337 }
3338
3339 }
3340
3341 // Now the LorentVector pPHOS is obtained and can be paired with the converted proton
3342 }
3343 //==== End of the PHOS cluster selection ============
3344 TLorentzVector pEMCAL;
3345 TLorentzVector gammaEMCAL;
3346 TLorentzVector pi0GammaConvEMCAL;
3347 TLorentzVector pi0GammaConvEMCALBck;
3348
3349 for (Int_t i=0; i<fV0Reader->GetESDEvent()->GetNumberOfCaloClusters(); i++) {
3350 clu = fV0Reader->GetESDEvent()->GetCaloCluster(i);
3351 if ( !clu->IsEMCAL() || clu->E()<0.1 ) continue;
3352 if (clu->GetNCells() <= 1) continue;
3353 if ( clu->GetTOF()*1e9 < 550 || clu->GetTOF()*1e9 > 750) continue;
3354
3355 clu ->GetMomentum(pEMCAL ,vtx);
3356 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
3357 AliKFParticle * twoGammaDecayCandidateDaughter0 = (AliKFParticle *)fKFReconstructedGammasTClone->At(firstGammaIndex);
3358 gammaGammaConv.SetXYZM(twoGammaDecayCandidateDaughter0->Px(),
3359 twoGammaDecayCandidateDaughter0->Py(),
3360 twoGammaDecayCandidateDaughter0->Pz(),0.);
3361 gammaEMCAL.SetXYZM(pEMCAL.Px(),pEMCAL.Py(),pEMCAL.Pz(),0.);
3362 pi0GammaConvEMCAL=gammaGammaConv+gammaEMCAL;
3363 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL",pi0GammaConvEMCAL.M());
3364 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvEMCAL",pi0GammaConvEMCAL.M(),pi0GammaConvEMCAL.Pt());
3365 TVector3 v3D0(twoGammaDecayCandidateDaughter0->Px(),
3366 twoGammaDecayCandidateDaughter0->Py(),
3367 twoGammaDecayCandidateDaughter0->Pz());
3368 TVector3 v3D1(gammaEMCAL.Px(),gammaEMCAL.Py(),gammaEMCAL.Pz());
3369
3370
3371 Double_t opanConvEMCAL= v3D0.Angle(v3D1);
3372 if ( opanConvEMCAL < 0.35){
3373 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_OpanLow",pi0GammaConvEMCAL.M());
3374 }else{
3375 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_OpanHigh",pi0GammaConvEMCAL.M());
3376 }
3377
3378 }
3379 if(fCalculateBackground){
3380 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
3381 AliGammaConversionKFVector * previousEventV0s = fV0Reader->GetBGGoodV0s(nEventsInBG);
3382 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3383 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3384 gammaGammaConvBck.SetXYZM(previousGoodV0.Px(),
3385 previousGoodV0.Py(),
3386 previousGoodV0.Pz(),0.);
3387 pi0GammaConvEMCALBck=gammaGammaConvBck+gammaEMCAL;
3388 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_Bck",pi0GammaConvEMCALBck.M());
3389 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvEMCAL_Bck",pi0GammaConvEMCALBck.M(),
3390 pi0GammaConvEMCALBck.Pt());
3391 }
3392 }
3393
3394 // Now the LorentVector pEMCAL is obtained and can be paired with the converted proton
3395 } // end of checking if background photons are available
3396 }
3397 //==== End of the PHOS cluster selection ============
3398
3399 }
48682642 3400*/
6272370b 3401
77ac6f3e 3402void AliAnalysisTaskGammaConversion::MoveParticleAccordingToVertex(AliKFParticle * particle,const AliGammaConversionBGHandler::GammaConversionVertex *vertex){
2eedd4ed 3403 //see header file for documentation
3404
3405 Double_t dx = vertex->fX - fESDEvent->GetPrimaryVertex()->GetX();
3406 Double_t dy = vertex->fY - fESDEvent->GetPrimaryVertex()->GetY();
3407 Double_t dz = vertex->fZ - fESDEvent->GetPrimaryVertex()->GetZ();
3408
3409 // cout<<"dx, dy, dz: ["<<dx<<","<<dy<<","<<dz<<"]"<<endl;
3410 particle->X() = particle->GetX() - dx;
3411 particle->Y() = particle->GetY() - dy;
3412 particle->Z() = particle->GetZ() - dz;
5ce758b0 3413}
3414
111d75df 3415void AliAnalysisTaskGammaConversion::RotateKFParticle(AliKFParticle * kfParticle,Double_t angle){
2eedd4ed 3416 // Before rotate needs to be moved to position 0,0,0, ; move back after rotation
3417 Double_t dx = fESDEvent->GetPrimaryVertex()->GetX()-0.;
3418 Double_t dy = fESDEvent->GetPrimaryVertex()->GetY()-0.;
3419 Double_t dz = fESDEvent->GetPrimaryVertex()->GetZ()-0.;
3420
3421 kfParticle->X() = kfParticle->GetX() - dx;
3422 kfParticle->Y() = kfParticle->GetY() - dy;
3423 kfParticle->Z() = kfParticle->GetZ() - dz;
3424
3425
3426 // Rotate the kf particle
3427 Double_t c = cos(angle);
3428 Double_t s = sin(angle);
3429
3430 Double_t mA[8][ 8];
3431 for( Int_t i=0; i<8; i++ ){
3432 for( Int_t j=0; j<8; j++){
3433 mA[i][j] = 0;
3434 }
3435 }
3436 for( int i=0; i<8; i++ ){
3437 mA[i][i] = 1;
3438 }
3439 mA[0][0] = c; mA[0][1] = s;
3440 mA[1][0] = -s; mA[1][1] = c;
3441 mA[3][3] = c; mA[3][4] = s;
3442 mA[4][3] = -s; mA[4][4] = c;
3443
3444 Double_t mAC[8][8];
3445 Double_t mAp[8];
3446 for( Int_t i=0; i<8; i++ ){
3447 mAp[i] = 0;
3448 for( Int_t k=0; k<8; k++){
3449 mAp[i]+=mA[i][k] * kfParticle->GetParameter(k);
3450 }
3451 }
3452
3453 for( Int_t i=0; i<8; i++){
3454 kfParticle->Parameter(i) = mAp[i];
3455 }
3456
3457 for( Int_t i=0; i<8; i++ ){
3458 for( Int_t j=0; j<8; j++ ){
3459 mAC[i][j] = 0;
3460 for( Int_t k=0; k<8; k++ ){
77ac6f3e 3461 mAC[i][j]+= mA[i][k] * kfParticle->GetCovariance(k,j);
2eedd4ed 3462 }
3463 }
3464 }
111d75df 3465
2eedd4ed 3466 for( Int_t i=0; i<8; i++ ){
3467 for( Int_t j=0; j<=i; j++ ){
3468 Double_t xx = 0;
3469 for( Int_t k=0; k<8; k++){
77ac6f3e 3470 xx+= mAC[i][k]*mA[j][k];
2eedd4ed 3471 }
3472 kfParticle->Covariance(i,j) = xx;
3473 }
3474 }
5510ebe1 3475
2eedd4ed 3476 Double_t dx1 = 0.-fESDEvent->GetPrimaryVertex()->GetX();
3477 Double_t dy1 = 0.-fESDEvent->GetPrimaryVertex()->GetY();
3478 Double_t dz1 = 0.-fESDEvent->GetPrimaryVertex()->GetZ();
3479
3480 kfParticle->X() = kfParticle->GetX() - dx1;
3481 kfParticle->Y() = kfParticle->GetY() - dy1;
3482 kfParticle->Z() = kfParticle->GetZ() - dz1;
5510ebe1 3483
111d75df 3484}
3485
3486
d7d7e825 3487void AliAnalysisTaskGammaConversion::CalculateBackground(){
2eedd4ed 3488 // see header file for documentation
5e55d806 3489
3490
2eedd4ed 3491 TClonesArray * currentEventV0s = fV0Reader->GetCurrentEventGoodV0s();
5e55d806 3492
2eedd4ed 3493 AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
3494
3495 Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
3496 Int_t mbin = 0;
3497 if(fUseTrackMultiplicityForBG == kTRUE){
3498 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
3499 }
3500 else{
3501 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
3502 }
5ce758b0 3503
2eedd4ed 3504 if(fDoRotation == kTRUE){
5510ebe1 3505
2eedd4ed 3506 for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
3507 AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent));
3508 for(Int_t iCurrent2=iCurrent+1;iCurrent2<currentEventV0s->GetEntriesFast();iCurrent2++){
77ac6f3e 3509 for(Int_t nRandom=0;nRandom<fNRandomEventsForBG;nRandom++){
111d75df 3510
2eedd4ed 3511 AliKFParticle currentEventGoodV02 = *(AliKFParticle *)(currentEventV0s->At(iCurrent2));
3bfbe89a 3512
2eedd4ed 3513 if(fCheckBGProbability == kTRUE){
3514 Double_t massBGprob =0.;
3515 Double_t widthBGprob = 0.;
3516 AliKFParticle *backgroundCandidateProb = new AliKFParticle(currentEventGoodV0,currentEventGoodV02);
3517 backgroundCandidateProb->GetMass(massBGprob,widthBGprob);
3518 if(massBGprob>0.1 && massBGprob<0.14){
3519 if(fRandom.Rndm()>bgHandler->GetBGProb(zbin,mbin)){
3bfbe89a 3520 delete backgroundCandidateProb;
3521 continue;
2eedd4ed 3522 }
3523 }
3524 delete backgroundCandidateProb;
3525 }
3526
3527 Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
3528
3529 Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
3530
3531 RotateKFParticle(&currentEventGoodV02,rotationValue);
3532
3533 AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,currentEventGoodV02);
3534
3535 Double_t massBG =0.;
3536 Double_t widthBG = 0.;
3537 Double_t chi2BG =10000.;
3538 backgroundCandidate->GetMass(massBG,widthBG);
3539 // if(backgroundCandidate->GetNDF()>0){
3540 chi2BG = backgroundCandidate->GetChi2();
3541 if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
3542
3543 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
3544 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
3545
3546 Double_t openingAngleBG = currentEventGoodV0.GetAngle(currentEventGoodV02);
3547
3548 Double_t rapidity;
3549 if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0) {
3550 rapidity=8.;
3551 } else{
3552 rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
3553 }
3554 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
3555 delete backgroundCandidate;
3556 continue; // rapidity cut
3557 }
dc2883e4 3558
2eedd4ed 3559
3560 Double_t alfa=0.0;
3561 if( (currentEventGoodV0.GetE()+currentEventGoodV02.GetE()) != 0){
3562 alfa=TMath::Abs((currentEventGoodV0.GetE()-currentEventGoodV02.GetE())
3563 /(currentEventGoodV0.GetE()+currentEventGoodV02.GetE()));
3564 }
3565
3566
3567 if(openingAngleBG < fMinOpeningAngleGhostCut ){
3568 delete backgroundCandidate;
3569 continue; // minimum opening angle to avoid using ghosttracks
3570 }
3571
3572 // original
3573 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3574 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
3575 fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
3576 fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
3577 fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
3578 fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
3579 fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
3580 fHistograms->FillHistogram("ESD_Background_Mass", massBG);
3581 fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3582 fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3583 fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
3584 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
3585 fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
3586 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
3587
3588 if(massBG>0.1 && massBG<0.15){
dcdc851f 3589 fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
2eedd4ed 3590 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3591 }
3592 if(massBG>0.5 && massBG<0.57){
dcdc851f 3593 fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
2eedd4ed 3594 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3595 }
6de3471d 3596
2eedd4ed 3597 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(currentEventGoodV02.GetEta())<0.9 ){
6de3471d 3598 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
3599 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
2eedd4ed 3600 }
3601
3602 fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
3603 fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
3604 fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin), momentumVectorbackgroundCandidate.Pt());
3605 fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
3606 fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
3607 fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
3608 fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
3609 fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3610 fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3611 fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
3612 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3613 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
3614
3615 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(currentEventGoodV02.GetEta())<0.9 ){
6de3471d 3616 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3617 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
2eedd4ed 3618 }
3619 }
3620 if(alfa<0.1){
3621 fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
3622 }
3c45d101 3623
2eedd4ed 3624 }
3625 //}
3626 delete backgroundCandidate;
5ce758b0 3627 }
2eedd4ed 3628 }
3629 }
3630 }
3631 else{ // means no rotation
3632 AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
3633
3634 if(fUseTrackMultiplicityForBG){
3635 // cout<<"Using charged track multiplicity for background calculation"<<endl;
3636 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
5ce758b0 3637
111d75df 3638 AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);//fV0Reader->GetBGGoodV0s(nEventsInBG);
2eedd4ed 3639
5ce758b0 3640 if(fMoveParticleAccordingToVertex == kTRUE){
2eedd4ed 3641 bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
5ce758b0 3642 }
3643
3644 for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
2eedd4ed 3645 AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent));
3646 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3647 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3648 AliKFParticle previousGoodV0test = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3649
3650 //cout<<"Primary Vertex event: ["<<fESDEvent->GetPrimaryVertex()->GetX()<<","<<fESDEvent->GetPrimaryVertex()->GetY()<<","<<fESDEvent->GetPrimaryVertex()->GetZ()<<"]"<<endl;
3651 //cout<<"BG prim Vertex event: ["<<bgEventVertex->fX<<","<<bgEventVertex->fY<<","<<bgEventVertex->fZ<<"]"<<endl;
3652
3653 //cout<<"XYZ of particle before transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
3654 if(fMoveParticleAccordingToVertex == kTRUE){
3655 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
3656 }
3657 //cout<<"XYZ of particle after transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
3658
3659 AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
3660
3661 Double_t massBG =0.;
3662 Double_t widthBG = 0.;
3663 Double_t chi2BG =10000.;
3664 backgroundCandidate->GetMass(massBG,widthBG);
3665
3666 // if(backgroundCandidate->GetNDF()>0){
3667 // chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
3668 chi2BG = backgroundCandidate->GetChi2();
3669 if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
111d75df 3670
2eedd4ed 3671 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
3672 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
111d75df 3673
2eedd4ed 3674 Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
111d75df 3675
2eedd4ed 3676 Double_t rapidity;
3677
3678 if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() <= 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() <= 0){
111d75df 3679 cout << "Error: |Pz| > E !!!! " << endl;
cc5a88a2 3680 rapidity=8.;
2eedd4ed 3681 } else {
111d75df 3682 rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
2eedd4ed 3683 }
3684 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
3685 delete backgroundCandidate;
3686 continue; // rapidity cut
3687 }
dc2883e4 3688
3689
2eedd4ed 3690 Double_t alfa=0.0;
3691 if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
111d75df 3692 alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
3693 /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
2eedd4ed 3694 }
111d75df 3695
3696
2eedd4ed 3697 if(openingAngleBG < fMinOpeningAngleGhostCut ){
3698 delete backgroundCandidate;
3699 continue; // minimum opening angle to avoid using ghosttracks
3700 }
111d75df 3701
2eedd4ed 3702 // original
3703 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
6de3471d 3704 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
3705 fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
2eedd4ed 3706 fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
6de3471d 3707 fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
3708 fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
3709 fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
3710 fHistograms->FillHistogram("ESD_Background_Mass", massBG);
2eedd4ed 3711 fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
6de3471d 3712 fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3713 fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
3714 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
3715 fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
111d75df 3716 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
6de3471d 3717
dcdc851f 3718 if(massBG>0.1 && massBG<0.15){
2eedd4ed 3719 fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
3720 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
dcdc851f 3721 }
3722 if(massBG>0.5 && massBG<0.57){
2eedd4ed 3723 fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
3724 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
dcdc851f 3725 }
6de3471d 3726
2eedd4ed 3727 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
3728 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
3729 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
6de3471d 3730 }
3731
3732 // test
3733 fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
3734 fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
2eedd4ed 3735 fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin), momentumVectorbackgroundCandidate.Pt());
6de3471d 3736 fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
3737 fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
3738 fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
3739 fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
2eedd4ed 3740 fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
6de3471d 3741 fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3742 fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
3743 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3744 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
3745
2eedd4ed 3746 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
3747 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3748 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
6de3471d 3749 }
2eedd4ed 3750 // }
3751 }
3752 if(alfa<0.1){
3c45d101 3753 fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
2eedd4ed 3754 }
3c45d101 3755
2eedd4ed 3756 }
3757 delete backgroundCandidate;
3758 }
111d75df 3759 }
2eedd4ed 3760 }
3761 }
3762 else{ // means using #V0s for multiplicity
111d75df 3763
2eedd4ed 3764 // cout<<"Using the v0 multiplicity to calculate background"<<endl;
3765
3766 fHistograms->FillHistogram("ESD_Background_z_m",zbin,mbin);
3767 fHistograms->FillHistogram("ESD_Mother_multpilicityVSv0s",fV0Reader->CountESDTracks(),fV0Reader->GetNumberOfV0s());
111d75df 3768
2eedd4ed 3769 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
111d75df 3770 AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);// fV0Reader->GetBGGoodV0s(nEventsInBG);
3771 if(previousEventV0s){
3772
2eedd4ed 3773 if(fMoveParticleAccordingToVertex == kTRUE){
3774 bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
3775 }
111d75df 3776
2eedd4ed 3777 for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
3778 AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent));
3779 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3780 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
111d75df 3781
2eedd4ed 3782 if(fMoveParticleAccordingToVertex == kTRUE){
111d75df 3783 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2eedd4ed 3784 }
3785
3786 AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
3787 Double_t massBG =0.;
3788 Double_t widthBG = 0.;
3789 Double_t chi2BG =10000.;
3790 backgroundCandidate->GetMass(massBG,widthBG);
3791
3792 /* if(backgroundCandidate->GetNDF()>0){
3793 chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
3794 {//remember to remove
3795 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
3796 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
3797
3798 Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
3799 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle_nochi2", openingAngleBG);
3800 }
3801 */
3802 chi2BG = backgroundCandidate->GetChi2();
3803 if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
5ce758b0 3804 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
3805 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
3806
3807 Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
3808
3809 Double_t rapidity;
cc5a88a2 3810 if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0){
2eedd4ed 3811 rapidity=8.;
cc5a88a2 3812 }else{
2eedd4ed 3813 rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
cc5a88a2 3814 }
dc2883e4 3815 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
2eedd4ed 3816 delete backgroundCandidate;
3817 continue; // rapidity cut
dc2883e4 3818 }
3819
3820
5ce758b0 3821 Double_t alfa=0.0;
3822 if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
2eedd4ed 3823 alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
3824 /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
5ce758b0 3825 }
3826
3827
3828 if(openingAngleBG < fMinOpeningAngleGhostCut ){
2eedd4ed 3829 delete backgroundCandidate;
3830 continue; // minimum opening angle to avoid using ghosttracks
5ce758b0 3831 }
3832
2eedd4ed 3833 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3834 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
3835 fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
3836 fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
3837 fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
3838 fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
3839 fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
3840 fHistograms->FillHistogram("ESD_Background_Mass", massBG);
3841 fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3842 fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3843 fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
3844 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
3845 fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
3846
3847
3848 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
3849
3850 if(massBG>0.1 && massBG<0.15){
3851 fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
3852 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3853 }
3854 if(massBG>0.5 && massBG<0.57){
3855 fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
3856 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3857 }
3858
3859 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
3860 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
3861 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
3862 }
3863
3864 if(massBG>0.5 && massBG<0.6){
3865 fHistograms->FillHistogram("ESD_Background_alfa_pt0506",momentumVectorbackgroundCandidate.Pt(),alfa);
3866 }
3867 if(massBG>0.3 && massBG<0.4){
3868 fHistograms->FillHistogram("ESD_Background_alfa_pt0304",momentumVectorbackgroundCandidate.Pt(),alfa);
3869 }
3870
3871 // test
3872 fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
3873 fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
3874 fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin), momentumVectorbackgroundCandidate.Pt());
3875 fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
3876 fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
3877 fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
3878 fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
3879 fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3880 fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3881 fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
3882 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3883 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
3884
3885 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
3886 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3887 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
3888 }
5ce758b0 3889 }
5ce758b0 3890
6de3471d 3891 if(alfa<0.1){
2eedd4ed 3892 fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
3893 }
3894 // }
3895 }
3896 delete backgroundCandidate;
3897 }
5ce758b0 3898 }
5ce758b0 3899 }
2eedd4ed 3900 }
3901 } // end else (means use #v0s as multiplicity)
3902 } // end no rotation
d7d7e825 3903}
3904
3905
d7d7e825 3906void AliAnalysisTaskGammaConversion::ProcessGammasForGammaJetAnalysis(){
2eedd4ed 3907 //ProcessGammasForGammaJetAnalysis
a0b94e5c 3908
2eedd4ed 3909 Double_t distIsoMin;
a0b94e5c 3910
2eedd4ed 3911 CreateListOfChargedParticles();
a0b94e5c 3912
3913
2eedd4ed 3914 // for(UInt_t gammaIndex=0;gammaIndex<fKFReconstructedGammas.size();gammaIndex++){
3915 for(Int_t gammaIndex=0;gammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();gammaIndex++){
3916 AliKFParticle * currentGamma = (AliKFParticle*)fKFReconstructedGammasTClone->At(gammaIndex);
3917 TVector3 momentumVectorCurrentGamma(currentGamma->GetPx(),currentGamma->GetPy(),currentGamma->GetPz());
3918 if( momentumVectorCurrentGamma.Pt()> fMinPtForGammaJet){
3919 distIsoMin=GetMinimumDistanceToCharge(gammaIndex);
3920 if (distIsoMin > fMinIsoConeSize && fLeadingChargedIndex>=0){
3921 CalculateJetCone(gammaIndex);
3922 }
3923 }
3924 }
d7d7e825 3925}
3926
6272370b 3927//____________________________________________________________________
77ac6f3e 3928Bool_t AliAnalysisTaskGammaConversion::IsGoodImpPar(const AliESDtrack *const track)
6272370b 3929{
2eedd4ed 3930 //
3931 // check whether particle has good DCAr(Pt) impact
3932 // parameter. Only for TPC+ITS tracks (7*sigma cut)
3933 // Origin: Andrea Dainese
3934 //
3935
3936 Float_t d0z0[2],covd0z0[3];
3937 track->GetImpactParameters(d0z0,covd0z0);
3938 Float_t sigma= 0.0050+0.0060/TMath::Power(track->Pt(),0.9);
3939 Float_t d0max = 7.*sigma;
3940 if(TMath::Abs(d0z0[0]) < d0max) return kTRUE;
3941
3942 return kFALSE;
6272370b 3943}
3944
3945
d7d7e825 3946void AliAnalysisTaskGammaConversion::CreateListOfChargedParticles(){
2eedd4ed 3947 // CreateListOfChargedParticles
a0b94e5c 3948
2eedd4ed 3949 fESDEvent = fV0Reader->GetESDEvent();
3950 Int_t numberOfESDTracks=0;
3951 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
3952 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
a0b94e5c 3953
2eedd4ed 3954 if(!curTrack){
3955 continue;
3956 }
3957 // Not needed if Standard function used.
3958 // if(!IsGoodImpPar(curTrack)){
3959 // continue;
3960 // }
a0b94e5c 3961
2eedd4ed 3962 if(fEsdTrackCuts->AcceptTrack(curTrack) ){
3963 new((*fChargedParticles)[fChargedParticles->GetEntriesFast()]) AliESDtrack(*curTrack);
3964 // fChargedParticles.push_back(curTrack);
3965 fChargedParticlesId.push_back(iTracks);
3966 numberOfESDTracks++;
3967 }
3968 }
3969 // Moved to UserExec using CountAcceptedTracks function. runjet is not needed by default
3970 // fHistograms->FillHistogram("ESD_NumberOfGoodESDTracks",numberOfESDTracks);
3971 // cout<<"esdtracks::"<< numberOfESDTracks<<endl;
3972 // if (fV0Reader->GetNumberOfContributorsVtx()>=1){
3973 // fHistograms->FillHistogram("ESD_NumberOfGoodESDTracksVtx",numberOfESDTracks);
3974 // }
d7d7e825 3975}
2eedd4ed 3976
3977/*void AliAnalysisTaskGammaConversion::RecalculateV0ForGamma(){
3978 //recalculates v0 for gamma
3979
3980 Double_t massE=0.00051099892;
3981 TLorentzVector curElecPos;
3982 TLorentzVector curElecNeg;
3983 TLorentzVector curGamma;
3984
3985 TLorentzVector curGammaAt;
3986 TLorentzVector curElecPosAt;
3987 TLorentzVector curElecNegAt;
3988 AliKFVertex primVtxGamma(*(fESDEvent->GetPrimaryVertex()));
3989 AliKFVertex primVtxImprovedGamma = primVtxGamma;
3990
3991 const AliESDVertex *vtxT3D=fESDEvent->GetPrimaryVertex();
3992
3993 Double_t xPrimaryVertex=vtxT3D->GetXv();
3994 Double_t yPrimaryVertex=vtxT3D->GetYv();
3995 Double_t zPrimaryVertex=vtxT3D->GetZv();
3996 // Float_t primvertex[3]={xPrimaryVertex,yPrimaryVertex,zPrimaryVertex};
3997
3998 Float_t nsigmaTPCtrackPos;
3999 Float_t nsigmaTPCtrackNeg;
4000 Float_t nsigmaTPCtrackPosToPion;
4001 Float_t nsigmaTPCtrackNegToPion;
4002 AliKFParticle* negKF=NULL;
4003 AliKFParticle* posKF=NULL;
4004
4005 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
4006 AliESDtrack* posTrack = fESDEvent->GetTrack(iTracks);
4007 if(!posTrack){
4008 continue;
4009 }
4010 if (posKF) delete posKF; posKF=NULL;
4011 if(posTrack->GetSign()<0) continue;
4012 if(!(posTrack->GetStatus() & AliESDtrack::kTPCrefit))continue;
4013 if(posTrack->GetKinkIndex(0)>0 ) continue;
4014 if(posTrack->GetNcls(1)<50)continue;
4015 Double_t momPos[3];
4016 // posTrack->GetConstrainedPxPyPz(momPos);
4017 posTrack->GetPxPyPz(momPos);
4018 AliESDtrack *ptrk=fESDEvent->GetTrack(iTracks);
4019 curElecPos.SetXYZM(momPos[0],momPos[1],momPos[2],massE);
4020 if(TMath::Abs(curElecPos.Eta())<0.9) continue;
4021 posKF = new AliKFParticle( *(posTrack),-11);
4022
4023 nsigmaTPCtrackPos = fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kElectron);
4024 nsigmaTPCtrackPosToPion = fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion);
4025
4026 if ( nsigmaTPCtrackPos>5.|| nsigmaTPCtrackPos<-2.){
4027 continue;
4028 }
4029
4030 if(pow((momPos[0]*momPos[0]+momPos[1]*momPos[1]+momPos[2]*momPos[2]),0.5)>0.5 && nsigmaTPCtrackPosToPion<1){
4031 continue;
4032 }
cc5a88a2 4033
4034
4035
2eedd4ed 4036 for(Int_t jTracks = 0; jTracks < fESDEvent->GetNumberOfTracks(); jTracks++){
4037 AliESDtrack* negTrack = fESDEvent->GetTrack(jTracks);
4038 if(!negTrack){
4039 continue;
4040 }
4041 if (negKF) delete negKF; negKF=NULL;
4042 if(negTrack->GetSign()>0) continue;
4043 if(!(negTrack->GetStatus() & AliESDtrack::kTPCrefit))continue;
4044 if(negTrack->GetKinkIndex(0)>0 ) continue;
4045 if(negTrack->GetNcls(1)<50)continue;
4046 Double_t momNeg[3];
4047 // negTrack->GetConstrainedPxPyPz(momNeg);
4048 negTrack->GetPxPyPz(momNeg);
4049
4050 nsigmaTPCtrackNeg = fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kElectron);
4051 nsigmaTPCtrackNegToPion = fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion);
4052 if ( nsigmaTPCtrackNeg>5. || nsigmaTPCtrackNeg<-2.){
4053 continue;
4054 }
4055 if(pow((momNeg[0]*momNeg[0]+momNeg[1]*momNeg[1]+momNeg[2]*momNeg[2]),0.5)>0.5 && nsigmaTPCtrackNegToPion<1){
4056 continue;
4057 }
4058 AliESDtrack *ntrk=fESDEvent->GetTrack(jTracks);
4059 curElecNeg.SetXYZM(momNeg[0],momNeg[1],momNeg[2],massE);
4060 if(TMath::Abs(curElecNeg.Eta())<0.9) continue;
4061 negKF = new AliKFParticle( *(negTrack) ,11);
4062
4063 Double_t b=fESDEvent->GetMagneticField();
4064 Double_t xn, xp, dca=ntrk->GetDCA(ptrk,b,xn,xp);
4065 AliExternalTrackParam nt(*ntrk), pt(*ptrk);
4066 nt.PropagateTo(xn,b); pt.PropagateTo(xp,b);
4067
4068
4069 //--- Like in ITSV0Finder
4070 AliExternalTrackParam ntAt0(*ntrk), ptAt0(*ptrk);
4071 Double_t xxP,yyP,alphaP;
4072 Double_t rP[3];
4073
4074 // if (!ptAt0.GetGlobalXYZat(ptAt0->GetX(),xxP,yyP,zzP)) continue;
4075 if (!ptAt0.GetXYZAt(ptAt0.GetX(),b,rP)) continue;
4076 xxP=rP[0];
4077 yyP=rP[1];
4078 alphaP = TMath::ATan2(yyP,xxP);
4079
4080
4081 ptAt0.Propagate(alphaP,0,b);
4082 Float_t ptfacP = (1.+100.*TMath::Abs(ptAt0.GetC(b)));
4083
4084 // Double_t distP = ptAt0.GetY();
4085 Double_t normP = ptfacP*TMath::Sqrt(ptAt0.GetSigmaY2());
4086 Double_t normdist0P = TMath::Abs(ptAt0.GetY()/normP);
4087 Double_t normdist1P = TMath::Abs((ptAt0.GetZ()-zPrimaryVertex)/(ptfacP*TMath::Sqrt(ptAt0.GetSigmaZ2())));
4088 Double_t normdistP = TMath::Sqrt(normdist0P*normdist0P+normdist1P*normdist1P);
4089
4090
4091 Double_t xxN,yyN,alphaN;
4092 Double_t rN[3];
4093 // if (!ntAt0.GetGlobalXYZat(ntAt0->GetX(),xxN,yyN,zzN)) continue;
4094 if (!ntAt0.GetXYZAt(ntAt0.GetX(),b,rN)) continue;
4095 xxN=rN[0];
4096 yyN=rN[1];
9c1cb6f7 4097
2eedd4ed 4098 alphaN = TMath::ATan2(yyN,xxN);
9c1cb6f7 4099
2eedd4ed 4100 ntAt0.Propagate(alphaN,0,b);
9c1cb6f7 4101
2eedd4ed 4102 Float_t ptfacN = (1.+100.*TMath::Abs(ntAt0.GetC(b)));
4103 // Double_t distN = ntAt0.GetY();
4104 Double_t normN = ptfacN*TMath::Sqrt(ntAt0.GetSigmaY2());
4105 Double_t normdist0N = TMath::Abs(ntAt0.GetY()/normN);
4106 Double_t normdist1N = TMath::Abs((ntAt0.GetZ()-zPrimaryVertex)/(ptfacN*TMath::Sqrt(ntAt0.GetSigmaZ2())));
4107 Double_t normdistN = TMath::Sqrt(normdist0N*normdist0N+normdist1N*normdist1N);
4108
4109 //-----------------------------
cc5a88a2 4110
2eedd4ed 4111 Double_t momNegAt[3];
4112 nt.GetPxPyPz(momNegAt);
4113 curElecNegAt.SetXYZM(momNegAt[0],momNegAt[1],momNegAt[2],massE);
cc5a88a2 4114
2eedd4ed 4115 Double_t momPosAt[3];
4116 pt.GetPxPyPz(momPosAt);
4117 curElecPosAt.SetXYZM(momPosAt[0],momPosAt[1],momPosAt[2],massE);
4118 if(dca>1){
4119 continue;
4120 }
cc5a88a2 4121
2eedd4ed 4122 // Double_t dneg= negTrack->GetD(xPrimaryVertex,yPrimaryVertex,b);
4123 // Double_t dpos= posTrack->GetD(xPrimaryVertex,yPrimaryVertex,b);
4124 AliESDv0 vertex(nt,jTracks,pt,iTracks);
4125
9c1cb6f7 4126
2eedd4ed 4127 Float_t cpa=vertex.GetV0CosineOfPointingAngle(xPrimaryVertex,yPrimaryVertex,zPrimaryVertex);
9c1cb6f7 4128
9c1cb6f7 4129
70ef88b5 4130
2eedd4ed 4131 // cout<< "v0Rr::"<< v0Rr<<endl;
4132 // if (pvertex.GetRr()<0.5){
4133 // continue;
4134 //}
4135 // cout<<"vertex.GetChi2V0()"<<vertex.GetChi2V0()<<endl;
4136 if(cpa<0.9)continue;
4137 // if (vertex.GetChi2V0() > 30) continue;
4138 // cout<<"xp+xn::"<<xp<<" "<<xn<<endl;
4139 if ((xn+xp) < 0.4) continue;
4140 if (TMath::Abs(ntrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<0.05)
4141 if (TMath::Abs(ptrk->GetD(xPrimaryVertex,yPrimaryVertex,b))<0.05) continue;
4142
4143 //cout<<"pass"<<endl;
4144
4145 AliKFParticle v0GammaC;
4146 v0GammaC+=(*negKF);
4147 v0GammaC+=(*posKF);
4148 v0GammaC.SetMassConstraint(0,0.001);
4149 primVtxImprovedGamma+=v0GammaC;
4150 v0GammaC.SetProductionVertex(primVtxImprovedGamma);
4151
4152
4153 curGamma=curElecNeg+curElecPos;
4154 curGammaAt=curElecNegAt+curElecPosAt;
4155
4156 // invariant mass versus pt of K0short
4157
4158 Double_t chi2V0GammaC=100000.;
4159 if( v0GammaC.GetNDF() != 0) {
4160 chi2V0GammaC = v0GammaC.GetChi2()/v0GammaC.GetNDF();
4161 }else{
4162 cout<< "ERROR::v0K0C.GetNDF()" << endl;
4163 }
4164
4165 if(chi2V0GammaC<200 &&chi2V0GammaC>0 ){
4166 if(fHistograms != NULL){
4167 fHistograms->FillHistogram("ESD_RecalculateV0_InvMass",v0GammaC.GetMass());
4168 fHistograms->FillHistogram("ESD_RecalculateV0_Pt",v0GammaC.GetPt());
4169 fHistograms->FillHistogram("ESD_RecalculateV0_E_dEdxP",curElecNegAt.P(),negTrack->GetTPCsignal());
4170 fHistograms->FillHistogram("ESD_RecalculateV0_P_dEdxP",curElecPosAt.P(),posTrack->GetTPCsignal());
4171 fHistograms->FillHistogram("ESD_RecalculateV0_cpa",cpa);
4172 fHistograms->FillHistogram("ESD_RecalculateV0_dca",dca);
4173 fHistograms->FillHistogram("ESD_RecalculateV0_normdistP",normdistP);
4174 fHistograms->FillHistogram("ESD_RecalculateV0_normdistN",normdistN);
4175
4176 new((*fKFRecalculatedGammasTClone)[fKFRecalculatedGammasTClone->GetEntriesFast()]) AliKFParticle(v0GammaC);
4177 fElectronRecalculatedv1.push_back(iTracks);
4178 fElectronRecalculatedv2.push_back(jTracks);
4179 }
4180 }
4181 }
4182 }
9c1cb6f7 4183
2eedd4ed 4184 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFRecalculatedGammasTClone->GetEntriesFast();firstGammaIndex++){
4185 for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFRecalculatedGammasTClone->GetEntriesFast();secondGammaIndex++){
4186 AliKFParticle * twoGammaDecayCandidateDaughter0 = (AliKFParticle *)fKFRecalculatedGammasTClone->At(firstGammaIndex);
4187 AliKFParticle * twoGammaDecayCandidateDaughter1 = (AliKFParticle *)fKFRecalculatedGammasTClone->At(secondGammaIndex);
9c1cb6f7 4188
2eedd4ed 4189 if(fElectronRecalculatedv1[firstGammaIndex]==fElectronRecalculatedv1[secondGammaIndex]){
4190 continue;
4191 }
4192 if( fElectronRecalculatedv2[firstGammaIndex]==fElectronRecalculatedv2[secondGammaIndex]){
4193 continue;
4194 }
9c1cb6f7 4195
2eedd4ed 4196 AliKFParticle twoGammaCandidate(*twoGammaDecayCandidateDaughter0,*twoGammaDecayCandidateDaughter1);
4197 if(fHistograms != NULL){
4198 fHistograms->FillHistogram("ESD_RecalculateGG_InvMass",twoGammaCandidate.GetMass());
4199 fHistograms->FillHistogram("ESD_RecalculateGG_InvMass_vs_Pt",twoGammaCandidate.GetMass(),twoGammaCandidate.GetPt());
4200 }
4201 }
4202 }
9c1cb6f7 4203}
2eedd4ed 4204 */
01b7fdcc 4205void AliAnalysisTaskGammaConversion::CalculateJetCone(Int_t gammaIndex){
2eedd4ed 4206 // CaculateJetCone
a0b94e5c 4207
2eedd4ed 4208 Double_t cone;
4209 Double_t coneSize=0.3;
4210 Double_t ptJet=0;
a0b94e5c 4211
2eedd4ed 4212 // AliKFParticle * currentGamma = &fKFReconstructedGammas[gammaIndex];
4213 AliKFParticle * currentGamma = (AliKFParticle*)fKFReconstructedGammasTClone->At(gammaIndex);
98778c17 4214
2eedd4ed 4215 TVector3 momentumVectorCurrentGamma(currentGamma->GetPx(),currentGamma->GetPy(),currentGamma->GetPz());
a0b94e5c 4216
2eedd4ed 4217 AliESDtrack* leadingCharged = (AliESDtrack*)(fChargedParticles->At(fLeadingChargedIndex));
98778c17 4218
2eedd4ed 4219 Double_t momLeadingCharged[3];
4220 leadingCharged->GetConstrainedPxPyPz(momLeadingCharged);
a0b94e5c 4221
2eedd4ed 4222 TVector3 momentumVectorLeadingCharged(momLeadingCharged[0],momLeadingCharged[1],momLeadingCharged[2]);
a0b94e5c 4223
2eedd4ed 4224 Double_t phi1=momentumVectorLeadingCharged.Phi();
4225 Double_t eta1=momentumVectorLeadingCharged.Eta();
4226 Double_t phi3=momentumVectorCurrentGamma.Phi();
a0b94e5c 4227
2eedd4ed 4228 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
4229 AliESDtrack* curTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
4230 Int_t chId = fChargedParticlesId[iCh];
4231 if(fLeadingChargedIndex==chId || fLeadingChargedIndex==chId) continue;
4232 Double_t mom[3];
4233 curTrack->GetConstrainedPxPyPz(mom);
4234 TVector3 momentumVectorChargedParticle(mom[0],mom[1],mom[2]);
4235 Double_t phi2=momentumVectorChargedParticle.Phi();
4236 Double_t eta2=momentumVectorChargedParticle.Eta();
a0b94e5c 4237
4238
2eedd4ed 4239 cone=100.;
4240 if( TMath::Abs(phi2 - phi1) <= ( TMath::TwoPi()-coneSize) ){
4241 cone = TMath::Sqrt( TMath::Power((eta2-eta1),2)+ TMath::Power((phi2-phi1),2) );
4242 }else{
4243 if( (phi2 - phi1)> TMath::TwoPi()-coneSize ){
4244 cone = TMath::Sqrt( TMath::Power((eta2-eta1),2)+ TMath::Power((phi2-TMath::TwoPi()-phi1),2) );
4245 }
4246 if( (phi2 - phi1)< -(TMath::TwoPi()-coneSize) ){
4247 cone = TMath::Sqrt( TMath::Power((eta2-eta1),2)+ TMath::Power((phi2+TMath::TwoPi()-phi1),2) );
4248 }
4249 }
a0b94e5c 4250
2eedd4ed 4251 if(cone <coneSize&& momentumVectorChargedParticle.Pt()>fMinPtJetCone ){
4252 ptJet+= momentumVectorChargedParticle.Pt();
4253 Double_t ffzHdrGam = momentumVectorChargedParticle.Pt()/momentumVectorCurrentGamma.Pt();
4254 Double_t imbalanceHdrGam=-momentumVectorChargedParticle.Dot(momentumVectorCurrentGamma)/momentumVectorCurrentGamma.Mag2();
4255 fHistograms->FillHistogram("ESD_FFzHdrGam",ffzHdrGam);
4256 fHistograms->FillHistogram("ESD_ImbalanceHdrGam",imbalanceHdrGam);
a0b94e5c 4257
2eedd4ed 4258 }
a0b94e5c 4259
2eedd4ed 4260 Double_t dphiHdrGam=phi3-phi2;
4261 if ( dphiHdrGam < (-TMath::PiOver2())){
4262 dphiHdrGam+=(TMath::TwoPi());
4263 }
a0b94e5c 4264
2eedd4ed 4265 if ( dphiHdrGam > (3.*TMath::PiOver2()) ){
4266 dphiHdrGam-=(TMath::TwoPi());
4267 }
a0b94e5c 4268
2eedd4ed 4269 if (momentumVectorChargedParticle.Pt()>fMinPtGamChargedCorr){
4270 fHistograms->FillHistogram("ESD_dphiHdrGamIsolated",dphiHdrGam);
4271 }
4272 }//track loop
a0b94e5c 4273
4274
2eedd4ed 4275 }
4276
4277
d7d7e825 4278
4279Double_t AliAnalysisTaskGammaConversion::GetMinimumDistanceToCharge(Int_t indexHighestPtGamma){
2eedd4ed 4280 // GetMinimumDistanceToCharge
a0b94e5c 4281
2eedd4ed 4282 Double_t fIsoMin=100.;
4283 Double_t ptLeadingCharged=-1.;
98778c17 4284
2eedd4ed 4285 fLeadingChargedIndex=-1;
a0b94e5c 4286
2eedd4ed 4287 AliKFConversionPhoton * gammaHighestPt = (AliKFConversionPhoton*)fKFReconstructedGammasTClone->At(indexHighestPtGamma);
4288 TVector3 momentumVectorgammaHighestPt(gammaHighestPt->GetPx(),gammaHighestPt->GetPy(),gammaHighestPt->GetPz());
a0b94e5c 4289
2eedd4ed 4290 Double_t phi1=momentumVectorgammaHighestPt.Phi();
4291 Double_t eta1=momentumVectorgammaHighestPt.Eta();
a0b94e5c 4292
2eedd4ed 4293 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
4294 AliESDtrack* curTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
4295 Int_t chId = fChargedParticlesId[iCh];
4296 if(gammaHighestPt->GetTrackLabelPositive()==chId || gammaHighestPt->GetTrackLabelNegative()==chId) continue;
4297 Double_t mom[3];
4298 curTrack->GetConstrainedPxPyPz(mom);
4299 TVector3 momentumVectorChargedParticle(mom[0],mom[1],mom[2]);
4300 Double_t phi2=momentumVectorChargedParticle.Phi();
4301 Double_t eta2=momentumVectorChargedParticle.Eta();
4302 Double_t iso=pow( (pow( (eta1-eta2),2)+ pow((phi1-phi2),2)),0.5 );
a0b94e5c 4303
2eedd4ed 4304 if(momentumVectorChargedParticle.Pt()>fMinPtIsoCone ){
4305 if (iso<fIsoMin){
d7d7e825 4306 fIsoMin=iso;
2eedd4ed 4307 }
4308 }
a0b94e5c 4309
2eedd4ed 4310 Double_t dphiHdrGam=phi1-phi2;
4311 if ( dphiHdrGam < (-TMath::PiOver2())){
4312 dphiHdrGam+=(TMath::TwoPi());
4313 }
a0b94e5c 4314
2eedd4ed 4315 if ( dphiHdrGam > (3.*TMath::PiOver2()) ){
4316 dphiHdrGam-=(TMath::TwoPi());
4317 }
4318 if (momentumVectorChargedParticle.Pt()>fMinPtGamChargedCorr){
4319 fHistograms->FillHistogram("ESD_dphiHdrGam",dphiHdrGam);
4320 }
a0b94e5c 4321
2eedd4ed 4322 if (dphiHdrGam>0.9*TMath::Pi() && dphiHdrGam<1.1*TMath::Pi()){
4323 if (momentumVectorChargedParticle.Pt()> ptLeadingCharged && momentumVectorChargedParticle.Pt()>0.1*momentumVectorgammaHighestPt.Pt()){
4324 ptLeadingCharged=momentumVectorChargedParticle.Pt();
4325 fLeadingChargedIndex=iCh;
4326 }
4327 }
a0b94e5c 4328
2eedd4ed 4329 }//track loop
4330 fHistograms->FillHistogram("ESD_MinimumIsoDistance",fIsoMin);
4331 return fIsoMin;
a0b94e5c 4332
d7d7e825 4333}
4334
2eedd4ed 4335Int_t AliAnalysisTaskGammaConversion::GetIndexHighestPtGamma(){
4336 //GetIndexHighestPtGamma
a0b94e5c 4337
2eedd4ed 4338 Int_t indexHighestPtGamma=-1;
4339 //Double_t
4340 fGammaPtHighest = -100.;
a0b94e5c 4341
2eedd4ed 4342 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
4343 AliKFParticle * gammaHighestPtCandidate = (AliKFParticle*)fKFReconstructedGammasTClone->At(firstGammaIndex);
4344 TVector3 momentumVectorgammaHighestPtCandidate(gammaHighestPtCandidate->GetPx(),gammaHighestPtCandidate->GetPy(),gammaHighestPtCandidate->GetPz());
4345 if (momentumVectorgammaHighestPtCandidate.Pt() > fGammaPtHighest){
4346 fGammaPtHighest=momentumVectorgammaHighestPtCandidate.Pt();
4347 //gammaHighestPt = gammaHighestPtCandidate;
4348 indexHighestPtGamma=firstGammaIndex;
4349 }
4350 }
a0b94e5c 4351
2eedd4ed 4352 return indexHighestPtGamma;
a0b94e5c 4353
d7d7e825 4354}
4355
4356
4357void AliAnalysisTaskGammaConversion::Terminate(Option_t */*option*/)
4358{
2eedd4ed 4359 // Terminate analysis
4360 //
4361 AliDebug(1,"Do nothing in Terminate");
d7d7e825 4362}
4363
4364void AliAnalysisTaskGammaConversion::UserCreateOutputObjects()
4365{
2eedd4ed 4366
4367 if(fKFCreateAOD) {
4368
4369 //AOD
4370 if(!fAODGamma) fAODGamma = new TClonesArray("AliAODConversionPhoton", 0);
4371 else fAODGamma->Delete();
4372 fAODGamma->SetName(Form("%s_gamma", fAODBranchName.Data()));
4373
4374 /* if(!fAODPi0) fAODPi0 = new TClonesArray("AliAODConversionPhoton", 0);
4375 else fAODPi0->Delete();
4376 fAODPi0->SetName(Form("%s_Pi0", fAODBranchName.Data()));
4377
4378 if(!fAODOmega) fAODOmega = new TClonesArray("AliAODConversionPhoton", 0);
4379 else fAODOmega->Delete();
4380 fAODOmega->SetName(Form("%s_Omega", fAODBranchName.Data()));
4381 */
4382 //If delta AOD file name set, add in separate file. Else add in standard aod file.
4383 if(GetDeltaAODFileName().Length() > 0) {
4384 AddAODBranch("TClonesArray", &fAODGamma, GetDeltaAODFileName().Data());
4385 // AddAODBranch("TClonesArray", &fAODPi0, GetDeltaAODFileName().Data());
4386 // AddAODBranch("TClonesArray", &fAODOmega, GetDeltaAODFileName().Data());
4387 AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(GetDeltaAODFileName().Data());
4388 } else {
4389 AddAODBranch("TClonesArray", &fAODGamma);
4390 // AddAODBranch("TClonesArray", &fAODPi0);
4391 // AddAODBranch("TClonesArray", &fAODOmega);
4392 }
4393 }
04bf4381 4394
2eedd4ed 4395 // Create the output container
4396 if(fOutputContainer != NULL){
4397 delete fOutputContainer;
4398 fOutputContainer = NULL;
4399 }
4400 if(fOutputContainer == NULL){
4401 fOutputContainer = new TList();
4402 fOutputContainer->SetOwner(kTRUE);
4403 }
d7d7e825 4404
2eedd4ed 4405 //Adding the histograms to the output container
4406 fHistograms->GetOutputContainer(fOutputContainer);
d7d7e825 4407
4408
2eedd4ed 4409 if(fWriteNtuple){
4410 if(fGammaNtuple == NULL){
4411 fGammaNtuple = new TNtuple("V0ntuple","V0ntuple","OnTheFly:HasVertex:NegPIDProb:PosPIDProb:X:Y:Z:R:MotherCandidateNDF:MotherCandidateChi2:MotherCandidateEnergy:MotherCandidateEta:MotherCandidatePt:MotherCandidateMass:MotherCandidateWidth:MCMotherCandidatePT:EPOpeningAngle:ElectronEnergy:ElectronPt:ElectronEta:ElectronPhi:PositronEnergy:PositronPt:PositronEta:PositronPhi:HasSameMCMother:MotherMCParticlePIDCode",50000);
4412 }
4413 if(fNeutralMesonNtuple == NULL){
4414 fNeutralMesonNtuple = new TNtuple("NeutralMesonNtuple","NeutralMesonNtuple","test");
4415 }
4416 TList * ntupleTList = new TList();
4417 ntupleTList->SetOwner(kTRUE);
4418 ntupleTList->SetName("Ntuple");
4419 ntupleTList->Add((TNtuple*)fGammaNtuple);
4420 fOutputContainer->Add(ntupleTList);
4421 }
d7d7e825 4422
2eedd4ed 4423 fOutputContainer->SetName(GetName());
143874ce 4424
2eedd4ed 4425 PostData(1, fOutputContainer);
4426 PostData(2, fCFManager->GetParticleContainer()); // for CF
143874ce 4427
d7d7e825 4428}
4429
77ac6f3e 4430Double_t AliAnalysisTaskGammaConversion::GetMCOpeningAngle(const TParticle* const daughter0, const TParticle* const daughter1) const{
2eedd4ed 4431 //helper function
4432 TVector3 v3D0(daughter0->Px(),daughter0->Py(),daughter0->Pz());
4433 TVector3 v3D1(daughter1->Px(),daughter1->Py(),daughter1->Pz());
4434 return v3D0.Angle(v3D1);
d7d7e825 4435}
4436
4437void AliAnalysisTaskGammaConversion::CheckV0Efficiency(){
2eedd4ed 4438 // see header file for documentation
4439
4440 vector<Int_t> indexOfGammaParticle;
4441
4442 fStack = fV0Reader->GetMCStack();
a0b94e5c 4443
2eedd4ed 4444 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
4445 return; // aborts if the primary vertex does not have contributors.
4446 }
4447
4448 for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
4449 TParticle* particle = (TParticle *)fStack->Particle(iTracks);
4450 if(particle->GetPdgCode()==22){ //Gamma
4451 if(particle->GetNDaughters() >= 2){
4452 TParticle* electron=NULL;
4453 TParticle* positron=NULL;
4454 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
4455 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
4456 if(tmpDaughter->GetUniqueID() == 5){
4457 if(tmpDaughter->GetPdgCode() == 11){
4458 electron = tmpDaughter;
4459 }
4460 else if(tmpDaughter->GetPdgCode() == -11){
4461 positron = tmpDaughter;
4462 }
4463 }
4464 }
4465 if(electron!=NULL && positron!=0){
4466 if(electron->R()<160){
4467 indexOfGammaParticle.push_back(iTracks);
4468 }
4469 }
4470 }
4471 }
4472 }
a0b94e5c 4473
2eedd4ed 4474 Int_t nFoundGammas=0;
4475 Int_t nNotFoundGammas=0;
4476
4477 Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
4478 for(Int_t i=0;i<numberOfV0s;i++){
4479 fV0Reader->GetV0(i);
a0b94e5c 4480
2eedd4ed 4481 if(fV0Reader->HasSameMCMother() == kFALSE){
4482 continue;
4483 }
a0b94e5c 4484
2eedd4ed 4485 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
4486 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
a0b94e5c 4487
2eedd4ed 4488 if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
4489 continue;
4490 }
4491 if(negativeMC->GetPdgCode()==positiveMC->GetPdgCode()){
4492 continue;
4493 }
a0b94e5c 4494
2eedd4ed 4495 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
4496 //TParticle * v0Gamma = fV0Reader->GetMotherMCParticle();
4497 for(UInt_t mcIndex=0;mcIndex<indexOfGammaParticle.size();mcIndex++){
4498 if(negativeMC->GetFirstMother()==indexOfGammaParticle[mcIndex]){
4499 nFoundGammas++;
4500 }
4501 else{
4502 nNotFoundGammas++;
4503 }
4504 }
4505 }
d7d7e825 4506 }
d7d7e825 4507}
4508
4509
4510void AliAnalysisTaskGammaConversion::ProcessGammaElectronsForChicAnalysis(){
2eedd4ed 4511 // see header file for documantation
a0b94e5c 4512
2eedd4ed 4513 fESDEvent = fV0Reader->GetESDEvent();
a0b94e5c 4514
4515
2eedd4ed 4516 TClonesArray * vESDeNegTemp = new TClonesArray("AliESDtrack",0);
4517 TClonesArray * vESDePosTemp = new TClonesArray("AliESDtrack",0);
4518 TClonesArray * vESDxNegTemp = new TClonesArray("AliESDtrack",0);
4519 TClonesArray * vESDxPosTemp = new TClonesArray("AliESDtrack",0);
4520 TClonesArray * vESDeNegNoJPsi = new TClonesArray("AliESDtrack",0);
4521 TClonesArray * vESDePosNoJPsi = new TClonesArray("AliESDtrack",0);
a0b94e5c 4522
2eedd4ed 4523 /*
4524 vector <AliESDtrack*> vESDeNegTemp(0);
4525 vector <AliESDtrack*> vESDePosTemp(0);
4526 vector <AliESDtrack*> vESDxNegTemp(0);
4527 vector <AliESDtrack*> vESDxPosTemp(0);
4528 vector <AliESDtrack*> vESDeNegNoJPsi(0);
4529 vector <AliESDtrack*> vESDePosNoJPsi(0);
4530 */
a0b94e5c 4531
4532
2eedd4ed 4533 fHistograms->FillTable("Table_Electrons",0);//Count number of Events
a0b94e5c 4534
2eedd4ed 4535 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
4536 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
a0b94e5c 4537
2eedd4ed 4538 if(!curTrack){
4539 //print warning here
4540 continue;
4541 }
a0b94e5c 4542
2eedd4ed 4543 double p[3];if(!curTrack->GetConstrainedPxPyPz(p))continue;
4544 double r[3];curTrack->GetConstrainedXYZ(r);
a0b94e5c 4545
2eedd4ed 4546 TVector3 rXYZ(r);
a0b94e5c 4547
2eedd4ed 4548 fHistograms->FillTable("Table_Electrons",4);//Count number of ESD tracks
a0b94e5c 4549
2eedd4ed 4550 Bool_t flagKink = kTRUE;
4551 Bool_t flagTPCrefit = kTRUE;
4552 Bool_t flagTRDrefit = kTRUE;
4553 Bool_t flagITSrefit = kTRUE;
4554 Bool_t flagTRDout = kTRUE;
4555 Bool_t flagVertex = kTRUE;
a0b94e5c 4556
4557
2eedd4ed 4558 //Cuts ---------------------------------------------------------------
a0b94e5c 4559
2eedd4ed 4560 if(curTrack->GetKinkIndex(0) > 0){
4561 fHistograms->FillHistogram("Table_Electrons",5);//Count kink
4562 flagKink = kFALSE;
4563 }
a0b94e5c 4564
2eedd4ed 4565 ULong_t trkStatus = curTrack->GetStatus();
a0b94e5c 4566
2eedd4ed 4567 ULong_t tpcRefit = (trkStatus & AliESDtrack::kTPCrefit);
a0b94e5c 4568
2eedd4ed 4569 if(!tpcRefit){
4570 fHistograms->FillHistogram("Table_Electrons",9);//Count not TPCrefit
4571 flagTPCrefit = kFALSE;
4572 }
a0b94e5c 4573
2eedd4ed 4574 ULong_t itsRefit = (trkStatus & AliESDtrack::kITSrefit);
4575 if(!itsRefit){
4576 fHistograms->FillHistogram("Table_Electrons",10);//Count not ITSrefit
4577 flagITSrefit = kFALSE;
4578 }
a0b94e5c 4579
2eedd4ed 4580 ULong_t trdRefit = (trkStatus & AliESDtrack::kTRDrefit);
a0b94e5c 4581
2eedd4ed 4582 if(!trdRefit){
4583 fHistograms->FillHistogram("Table_Electrons",8); //Count not TRDrefit
4584 flagTRDrefit = kFALSE;
4585 }
a0b94e5c 4586
2eedd4ed 4587 ULong_t trdOut = (trkStatus & AliESDtrack::kTRDout);
a0b94e5c 4588
2eedd4ed 4589 if(!trdOut) {
4590 fHistograms->FillHistogram("Table_Electrons",7); //Count not TRDout
4591 flagTRDout = kFALSE;
4592 }
a0b94e5c 4593
2eedd4ed 4594 double nsigmaToVxt = GetSigmaToVertex(curTrack);
a0b94e5c 4595
2eedd4ed 4596 if(nsigmaToVxt > 3){
4597 fHistograms->FillHistogram("Table_Electrons",6); //Count Tracks with number of sigmas > 3
4598 flagVertex = kFALSE;
4599 }
a0b94e5c 4600
2eedd4ed 4601 if(! (flagKink && flagTPCrefit && flagITSrefit && flagTRDrefit && flagTRDout && flagVertex ) ) continue;
4602 fHistograms->FillHistogram("Table_Electrons",11);//Count Tracks passed Cuts
a0b94e5c 4603
4604
2eedd4ed 4605 Stat_t pid, weight;
4606 GetPID(curTrack, pid, weight);
a0b94e5c 4607
2eedd4ed 4608 if(pid!=0){
4609 fHistograms->FillHistogram("Table_Electrons",12); //Count Tracks with pid != 0
4610 }
a0b94e5c 4611
2eedd4ed 4612 if(pid == 0){
4613 fHistograms->FillHistogram("Table_Electrons",13); //Count Tracks with pid != 0
4614 }
a0b94e5c 4615
4616
4617
4618
a0b94e5c 4619
4620
2eedd4ed 4621 TLorentzVector curElec;
4622 curElec.SetXYZM(p[0],p[1],p[2],fElectronMass);
a0b94e5c 4623
4624
2eedd4ed 4625 if(fDoMCTruth){
4626 Int_t labelMC = TMath::Abs(curTrack->GetLabel());
4627 TParticle* curParticle = fStack->Particle(labelMC);
4628 if(curTrack->GetSign() > 0){
4629 if( pid == 0){
4630 fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
4631 fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
4632 } else {
4633 fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
4634 fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
4635 }
4636 }
4637 }
a0b94e5c 4638
4639
2eedd4ed 4640 if(curTrack->GetSign() > 0){
a0b94e5c 4641
2eedd4ed 4642 // vESDxPosTemp.push_back(curTrack);
4643 new((*vESDxPosTemp)[vESDxPosTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
a0b94e5c 4644
2eedd4ed 4645 if( pid == 0){
4646 fHistograms->FillHistogram("ESD_ElectronPosNegPt",curElec.Pt());
4647 fHistograms->FillHistogram("ESD_ElectronPosPt",curElec.Pt());
4648 // fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
4649 fHistograms->FillHistogram("ESD_ElectronPosNegEta",curElec.Eta());
4650 // fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
4651 // vESDePosTemp.push_back(curTrack);
4652 new((*vESDePosTemp)[vESDePosTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
4653 }
a0b94e5c 4654
2eedd4ed 4655 } else {
5e55d806 4656
2eedd4ed 4657 new((*vESDxNegTemp)[vESDxNegTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
a0b94e5c 4658
2eedd4ed 4659 if( pid == 0){
4660
4661 fHistograms->FillHistogram("ESD_ElectronPosNegPt",curElec.Pt());
4662 fHistograms->FillHistogram("ESD_ElectronNegPt",curElec.Pt());
4663 fHistograms->FillHistogram("ESD_ElectronPosNegEta",curElec.Eta());
4664 new((*vESDeNegTemp)[vESDeNegTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
4665
4666 }
a0b94e5c 4667
2eedd4ed 4668 }
a0b94e5c 4669
2eedd4ed 4670 }
a0b94e5c 4671
d7d7e825 4672
2eedd4ed 4673 Bool_t ePosJPsi = kFALSE;
4674 Bool_t eNegJPsi = kFALSE;
4675 Bool_t ePosPi0 = kFALSE;
4676 Bool_t eNegPi0 = kFALSE;
4677
4678 UInt_t iePosJPsi=0,ieNegJPsi=0,iePosPi0=0,ieNegPi0=0;
4679
4680 for(Int_t iNeg=0; iNeg < vESDeNegTemp->GetEntriesFast(); iNeg++){
4681 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetPdgCode() == 11)
4682 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetMother(0) > -1){
4683 Int_t labelMother = fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetMother(0);
4684 TParticle* partMother = fStack ->Particle(labelMother);
4685 if (partMother->GetPdgCode() == 111){
4686 ieNegPi0 = iNeg;
4687 eNegPi0 = kTRUE;
4688 }
4689 if(partMother->GetPdgCode() == 443){ //Mother JPsi
4690 fHistograms->FillTable("Table_Electrons",14);
4691 ieNegJPsi = iNeg;
4692 eNegJPsi = kTRUE;
4693 } else {
4694 // vESDeNegNoJPsi.push_back(vESDeNegTemp[iNeg]);
4695 new((*vESDeNegNoJPsi)[vESDeNegNoJPsi->GetEntriesFast()]) AliESDtrack(*(AliESDtrack*)(vESDeNegTemp->At(iNeg)));
4696 // cout<<"ESD No Positivo JPsi "<<endl;
4697 }
4698 }
4699 }
a0b94e5c 4700
2eedd4ed 4701 for(Int_t iPos=0; iPos < vESDePosTemp->GetEntriesFast(); iPos++){
4702 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetPdgCode() == -11)
4703 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetMother(0) > -1){
4704 Int_t labelMother = fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetMother(0);
4705 TParticle* partMother = fStack ->Particle(labelMother);
4706 if (partMother->GetPdgCode() == 111){
4707 iePosPi0 = iPos;
4708 ePosPi0 = kTRUE;
4709 }
4710 if(partMother->GetPdgCode() == 443){ //Mother JPsi
4711 fHistograms->FillTable("Table_Electrons",15);
4712 iePosJPsi = iPos;
4713 ePosJPsi = kTRUE;
4714 }
4715 else{
4716 // vESDePosNoJPsi.push_back(vESDePosTemp[iPos]);
4717 new((*vESDePosNoJPsi)[vESDePosNoJPsi->GetEntriesFast()]) AliESDtrack(*(AliESDtrack*)(vESDePosTemp->At(iPos)));
4718 // cout<<"ESD No Negativo JPsi "<<endl;
4719 }
4720 }
d7d7e825 4721 }
d7d7e825 4722
2eedd4ed 4723 if( eNegJPsi && ePosJPsi ){
4724 TVector3 tempeNegV,tempePosV;
4725 tempeNegV.SetXYZ(((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Px(),((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Py(),((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Pz());
4726 tempePosV.SetXYZ(((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Px(),((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Py(),((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Pz());
4727 fHistograms->FillTable("Table_Electrons",16);
4728 fHistograms->FillHistogram("ESD_ElectronPosNegJPsiAngle",tempeNegV.Angle(tempePosV));
4729 fHistograms->FillHistogram("MC_ElectronPosNegJPsiAngle",GetMCOpeningAngle(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->GetLabel())),
4730 fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->GetLabel()))));
4731 }
d7d7e825 4732
2eedd4ed 4733 if( eNegPi0 && ePosPi0 ){
4734 TVector3 tempeNegV,tempePosV;
4735 tempeNegV.SetXYZ(((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Px(),((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Py(),((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Pz());
4736 tempePosV.SetXYZ(((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Px(),((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Py(),((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Pz());
4737 fHistograms->FillHistogram("ESD_ElectronPosNegPi0Angle",tempeNegV.Angle(tempePosV));
4738 fHistograms->FillHistogram("MC_ElectronPosNegPi0Angle",GetMCOpeningAngle(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->GetLabel())),
4739 fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->GetLabel()))));
4740 }
a0b94e5c 4741
4742
2eedd4ed 4743 FillAngle("ESD_eNegePosAngleBeforeCut",GetTLorentzVector(vESDeNegTemp),GetTLorentzVector(vESDePosTemp));
a0b94e5c 4744
2eedd4ed 4745 CleanWithAngleCuts(*vESDeNegTemp,*vESDePosTemp,*fKFReconstructedGammasTClone);
d7d7e825 4746
2eedd4ed 4747 // vector <TLorentzVector> vCurrentTLVeNeg = GetTLorentzVector(fCurrentEventNegElectron);
4748 // vector <TLorentzVector> vCurrentTLVePos = GetTLorentzVector(fCurrentEventPosElectron);
a0b94e5c 4749
2eedd4ed 4750 TClonesArray vCurrentTLVeNeg = GetTLorentzVector(fCurrentEventNegElectronTClone);
4751 TClonesArray vCurrentTLVePos = GetTLorentzVector(fCurrentEventPosElectronTClone);
a0b94e5c 4752
4753
2eedd4ed 4754 FillAngle("ESD_eNegePosAngleAfterCut",vCurrentTLVeNeg,vCurrentTLVePos);
a0b94e5c 4755
4756
4757
4758
2eedd4ed 4759 //FillAngle("ESD_eNegePosAngleAfterCut",CurrentTLVeNeg,CurrentTLVePos);
a0b94e5c 4760
4761
2eedd4ed 4762 FillElectronInvMass("ESD_InvMass_ePluseMinus",vCurrentTLVeNeg,vCurrentTLVePos);
4763 FillElectronInvMass("ESD_InvMass_xPlusxMinus",GetTLorentzVector(vESDxNegTemp),GetTLorentzVector(vESDxPosTemp));
a0b94e5c 4764
4765
4766
2eedd4ed 4767 FillGammaElectronInvMass("ESD_InvMass_GammaePluseMinusChiC","ESD_InvMass_GammaePluseMinusChiCDiff",*fKFReconstructedGammasCutTClone,vCurrentTLVeNeg,vCurrentTLVePos);
a0b94e5c 4768
2eedd4ed 4769 FillGammaElectronInvMass("ESD_InvMass_GammaePluseMinusPi0","ESD_InvMass_GammaePluseMinusPi0Diff",
4770 *fKFReconstructedGammasCutTClone,vCurrentTLVeNeg,vCurrentTLVePos);
a0b94e5c 4771
2eedd4ed 4772 //BackGround
a0b94e5c 4773
2eedd4ed 4774 //Like Sign e+e-
4775 ElectronBackground("ESD_ENegBackground",vCurrentTLVeNeg);
4776 ElectronBackground("ESD_EPosBackground",vCurrentTLVePos);
4777 ElectronBackground("ESD_EPosENegBackground",vCurrentTLVeNeg);
4778 ElectronBackground("ESD_EPosENegBackground",vCurrentTLVePos);
a0b94e5c 4779
2eedd4ed 4780 // Like Sign e+e- no JPsi
4781 ElectronBackground("ESD_EPosENegNoJPsiBG",GetTLorentzVector(vESDeNegNoJPsi));
4782 ElectronBackground("ESD_EPosENegNoJPsiBG",GetTLorentzVector(vESDePosNoJPsi));
a0b94e5c 4783
2eedd4ed 4784 //Mixed Event
a0b94e5c 4785
2eedd4ed 4786 if( fCurrentEventPosElectronTClone->GetEntriesFast() > 0 && fCurrentEventNegElectronTClone->GetEntriesFast() > 0 && fKFReconstructedGammasCutTClone->GetEntriesFast() > 0 ){
4787 FillGammaElectronInvMass("ESD_EPosENegGammaBackgroundMX","ESD_EPosENegGammaBackgroundMXDiff",
4788 *fKFReconstructedGammasCutTClone,*fPreviousEventTLVNegElectronTClone,*fPreviousEventTLVPosElectronTClone);
4789 *fPreviousEventTLVNegElectronTClone = vCurrentTLVeNeg;
4790 *fPreviousEventTLVPosElectronTClone = vCurrentTLVePos;
a0b94e5c 4791
2eedd4ed 4792 }
a0b94e5c 4793
2eedd4ed 4794 /*
4795 //Photons P
4796 Double_t vtx[3];
4797 vtx[0]=0;vtx[1]=0;vtx[2]=0;
4798 for(UInt_t i=0;i<fKFReconstructedGammasChic.size();i++){
a0b94e5c 4799
2eedd4ed 4800 // if(fMCGammaChicTempCut[i]->GetMother(0) < 0) continue;
a0b94e5c 4801
4802
4803
2eedd4ed 4804 Int_t tempLabel = fStack->Particle(fMCGammaChicTempCut[i]->GetMother(0))->GetPdgCode();
4805 // cout<<" Label Pedro Gonzalez " <<tempLabel <<endl;
a0b94e5c 4806
2eedd4ed 4807 // cout<<" Label Distance"<<fKFReconstructedGammasChic[i].GetDistanceFromVertex(vtx)<<endl;
a0b94e5c 4808
2eedd4ed 4809 if( tempLabel == 10441 || tempLabel == 20443 || tempLabel == 445 )
a0b94e5c 4810
2eedd4ed 4811 fHistograms->FillHistogram("ESD_PhotonsMomentum",fKFReconstructedGammasChic[i].GetMomentum());
a0b94e5c 4812
4813
2eedd4ed 4814 }
a0b94e5c 4815
4816
2eedd4ed 4817 */
1e7846f4 4818
4819
2eedd4ed 4820 vESDeNegTemp->Delete();
4821 vESDePosTemp->Delete();
4822 vESDxNegTemp->Delete();
4823 vESDxPosTemp->Delete();
4824 vESDeNegNoJPsi->Delete();
4825 vESDePosNoJPsi->Delete();
1e7846f4 4826
2eedd4ed 4827 delete vESDeNegTemp;
4828 delete vESDePosTemp;
4829 delete vESDxNegTemp;
4830 delete vESDxPosTemp;
4831 delete vESDeNegNoJPsi;
4832 delete vESDePosNoJPsi;
d7d7e825 4833}
4834
6c84d371 4835/*
2eedd4ed 4836 void AliAnalysisTaskGammaConversion::FillAngle(TString histoName,vector <TLorentzVector> tlVeNeg, vector <TLorentzVector> tlVePos){
4837 //see header file for documentation
4838 for( UInt_t iNeg=0; iNeg < tlVeNeg.size(); iNeg++){
4839 for (UInt_t iPos=0; iPos < tlVePos.size(); iPos++){
4840 fHistograms->FillHistogram(histoName.Data(),tlVeNeg[iNeg].Vect().Angle(tlVePos[iPos].Vect()));
4841 }
4842 }
4843 }
6c84d371 4844*/
4845void AliAnalysisTaskGammaConversion::FillAngle(TString histoName,TClonesArray const tlVeNeg, TClonesArray const tlVePos){
2eedd4ed 4846 //see header file for documentation
4847 for( Int_t iNeg=0; iNeg < tlVeNeg.GetEntriesFast(); iNeg++){
4848 for (Int_t iPos=0; iPos < tlVePos.GetEntriesFast(); iPos++){
4849 fHistograms->FillHistogram(histoName.Data(),((TLorentzVector*)(tlVeNeg.At(iNeg)))->Vect().Angle(((TLorentzVector*)(tlVePos.At(iPos)))->Vect()));
4850 }
4851 }
d7d7e825 4852}
2eedd4ed 4853
6c84d371 4854void AliAnalysisTaskGammaConversion::FillElectronInvMass(TString histoName, TClonesArray const eNeg, TClonesArray const ePos){
2eedd4ed 4855 //see header file for documentation
4856 for( Int_t n=0; n < eNeg.GetEntriesFast(); n++){
4857 TLorentzVector en = (*(TLorentzVector*)(eNeg.At(n)));
4858 for (Int_t p=0; p < ePos.GetEntriesFast(); p++){
4859 TLorentzVector ep = (*(TLorentzVector*)(ePos.At(p)));
4860 TLorentzVector np = ep + en;
4861 fHistograms->FillHistogram(histoName.Data(),np.M());
4862 }
4863 }
d7d7e825 4864}
4865
6c84d371 4866void AliAnalysisTaskGammaConversion::FillGammaElectronInvMass(TString histoMass,TString histoDiff,TClonesArray const fKFGammas,
2eedd4ed 4867 TClonesArray const tlVeNeg,TClonesArray const tlVePos)
d7d7e825 4868{
2eedd4ed 4869 //see header file for documentation
a0b94e5c 4870
2eedd4ed 4871 for( Int_t iNeg=0; iNeg < tlVeNeg.GetEntriesFast(); iNeg++ ){
a0b94e5c 4872
2eedd4ed 4873 for (Int_t iPos=0; iPos < tlVePos.GetEntriesFast(); iPos++){
a0b94e5c 4874
2eedd4ed 4875 TLorentzVector xy = *((TLorentzVector *)(tlVePos.At(iPos))) + *((TLorentzVector *)(tlVeNeg.At(iNeg)));
a0b94e5c 4876
2eedd4ed 4877 for (Int_t iGam=0; iGam < fKFGammas.GetEntriesFast(); iGam++){
a0b94e5c 4878
6c84d371 4879 // AliKFParticle * gammaCandidate = &fKFGammas[iGam];
4880 AliKFParticle * gammaCandidate = (AliKFParticle *)(fKFGammas.At(iGam));
d7d7e825 4881 TLorentzVector g;
a0b94e5c 4882
d7d7e825 4883 g.SetXYZM(gammaCandidate->GetPx(),gammaCandidate->GetPy(),gammaCandidate->GetPz(),fGammaMass);
4884 TLorentzVector xyg = xy + g;
4885 fHistograms->FillHistogram(histoMass.Data(),xyg.M());
4886 fHistograms->FillHistogram(histoDiff.Data(),(xyg.M()-xy.M()));
2eedd4ed 4887 }
4888 }
4889 }
a0b94e5c 4890
d7d7e825 4891}
6c84d371 4892void AliAnalysisTaskGammaConversion::ElectronBackground(TString hBg, TClonesArray e)
d7d7e825 4893{
2eedd4ed 4894 // see header file for documentation
4895 for(Int_t i=0; i < e.GetEntriesFast(); i++) {
4896 for (Int_t j=i+1; j < e.GetEntriesFast(); j++) {
4897 TLorentzVector ee = (*(TLorentzVector*)(e.At(i))) + (*(TLorentzVector*)(e.At(j)));
4898 fHistograms->FillHistogram(hBg.Data(),ee.M());
4899 }
d7d7e825 4900 }
d7d7e825 4901}
4902
4903
6c84d371 4904void AliAnalysisTaskGammaConversion::CleanWithAngleCuts(TClonesArray const negativeElectrons,
4905 TClonesArray const positiveElectrons,
4906 TClonesArray const gammas){
2eedd4ed 4907 // see header file for documentation
a0b94e5c 4908
2eedd4ed 4909 UInt_t sizeN = negativeElectrons.GetEntriesFast();
4910 UInt_t sizeP = positiveElectrons.GetEntriesFast();
4911 UInt_t sizeG = gammas.GetEntriesFast();
a0b94e5c 4912
4913
4914
2eedd4ed 4915 vector <Bool_t> xNegBand(sizeN);
4916 vector <Bool_t> xPosBand(sizeP);
4917 vector <Bool_t> gammaBand(sizeG);
a0b94e5c 4918
4919
2eedd4ed 4920 for(UInt_t iNeg=0; iNeg < sizeN; iNeg++) xNegBand[iNeg]=kTRUE;
4921 for(UInt_t iPos=0; iPos < sizeP; iPos++) xPosBand[iPos]=kTRUE;
4922 for(UInt_t iGam=0; iGam < sizeG; iGam++) gammaBand[iGam]=kTRUE;
d7d7e825 4923
a0b94e5c 4924
2eedd4ed 4925 for(UInt_t iPos=0; iPos < sizeP; iPos++){
a0b94e5c 4926
2eedd4ed 4927 Double_t aP[3];
4928 ((AliESDtrack*)(positiveElectrons.At(iPos)))->GetConstrainedPxPyPz(aP);
a0b94e5c 4929
2eedd4ed 4930 TVector3 ePosV(aP[0],aP[1],aP[2]);
a0b94e5c 4931
2eedd4ed 4932 for(UInt_t iNeg=0; iNeg < sizeN; iNeg++){
a0b94e5c 4933
2eedd4ed 4934 Double_t aN[3];
4935 ((AliESDtrack*)(negativeElectrons.At(iNeg)))->GetConstrainedPxPyPz(aN);
4936 TVector3 eNegV(aN[0],aN[1],aN[2]);
a0b94e5c 4937
2eedd4ed 4938 if(ePosV.Angle(eNegV) < 0.05){ //e+e- from gamma
4939 xPosBand[iPos]=kFALSE;
4940 xNegBand[iNeg]=kFALSE;
4941 }
a0b94e5c 4942
2eedd4ed 4943 for(UInt_t iGam=0; iGam < sizeG; iGam++){
4944 AliKFParticle* gammaCandidate = (AliKFParticle*)gammas.At(iGam);
4945 TVector3 gammaCandidateVector(gammaCandidate->Px(),gammaCandidate->Py(),gammaCandidate->Pz());
4946 if(ePosV.Angle(gammaCandidateVector) < 0.05 || eNegV.Angle(gammaCandidateVector) < 0.05)
4947 gammaBand[iGam]=kFALSE;
4948 }
4949 }
4950 }
a0b94e5c 4951
2eedd4ed 4952 for(UInt_t iPos=0; iPos < sizeP; iPos++){
4953 if(xPosBand[iPos]){
4954 new((*fCurrentEventPosElectronTClone)[fCurrentEventPosElectronTClone->GetEntriesFast()]) AliESDtrack((*(AliESDtrack*)(positiveElectrons.At(iPos))));
4955 // fCurrentEventPosElectron.push_back(positiveElectrons[iPos]);
4956 }
4957 }
4958 for(UInt_t iNeg=0;iNeg < sizeN; iNeg++){
4959 if(xNegBand[iNeg]){
4960 new((*fCurrentEventNegElectronTClone)[fCurrentEventNegElectronTClone->GetEntriesFast()]) AliESDtrack((*(AliESDtrack*)(negativeElectrons.At(iNeg))));
4961 // fCurrentEventNegElectron.push_back(negativeElectrons[iNeg]);
4962 }
4963 }
4964 for(UInt_t iGam=0; iGam < sizeG; iGam++){
4965 if(gammaBand[iGam]){
4966 new((*fKFReconstructedGammasCutTClone)[fKFReconstructedGammasCutTClone->GetEntriesFast()]) AliKFParticle((*(AliKFParticle*)(gammas.At(iGam))));
4967 //fKFReconstructedGammasCut.push_back(*(AliKFParticle*)gammas->At(iGam));
4968 }
4969 }
d7d7e825 4970}
4971
4972
2eedd4ed 4973void AliAnalysisTaskGammaConversion::GetPID(const AliESDtrack *track, Stat_t &pid, Stat_t &weight)
d7d7e825 4974{
2eedd4ed 4975 // see header file for documentation
4976 pid = -1;
4977 weight = -1;
a0b94e5c 4978
2eedd4ed 4979 double wpart[5];
4980 double wpartbayes[5];
a0b94e5c 4981
2eedd4ed 4982 //get probability of the diffenrent particle types
4983 track->GetESDpid(wpart);
a0b94e5c 4984
2eedd4ed 4985 // Tentative particle type "concentrations"
4986 double c[5]={0.01, 0.01, 0.85, 0.10, 0.05};
a0b94e5c 4987
2eedd4ed 4988 //Bayes' formula
4989 double rcc = 0.;
4990 for (int i = 0; i < 5; i++){
4991 rcc+=(c[i] * wpart[i]);
4992 }
a0b94e5c 4993
a0b94e5c 4994
4995
2eedd4ed 4996 for (int i=0; i<5; i++) {
4997 if( rcc>0 || rcc<0){//Kenneth: not sure if the rcc<0 should be there, this is from fixing a coding violation where we are not allowed to say: rcc!=0 (RC19)
4998 wpartbayes[i] = c[i] * wpart[i] / rcc;
4999 }
5000 }
a0b94e5c 5001
2eedd4ed 5002 Float_t max=0.;
5003 int ipid=-1;
5004 //find most probable particle in ESD pid
5005 //0:Electron - 1:Muon - 2:Pion - 3:Kaon - 4:Proton
5006 for (int i = 0; i < 5; i++){
5007 if (wpartbayes[i] > max){
5008 ipid = i;
5009 max = wpartbayes[i];
5010 }
5011 }
a0b94e5c 5012
2eedd4ed 5013 pid = ipid;
5014 weight = max;
d7d7e825 5015}
2eedd4ed 5016
77ac6f3e 5017double AliAnalysisTaskGammaConversion::GetSigmaToVertex(const AliESDtrack* t)
d7d7e825 5018{
2eedd4ed 5019 // Calculates the number of sigma to the vertex.
5020
5021 Float_t b[2];
5022 Float_t bRes[2];
5023 Float_t bCov[3];
5024 t->GetImpactParameters(b,bCov);
5025 if (bCov[0]<=0 || bCov[2]<=0) {
5026 AliDebug(1, "Estimated b resolution lower or equal zero!");
5027 bCov[0]=0; bCov[2]=0;
5028 }
5029 bRes[0] = TMath::Sqrt(bCov[0]);
5030 bRes[1] = TMath::Sqrt(bCov[2]);
5031
5032 // -----------------------------------
5033 // How to get to a n-sigma cut?
5034 //
5035 // The accumulated statistics from 0 to d is
5036 //
5037 // -> Erf(d/Sqrt(2)) for a 1-dim gauss (d = n_sigma)
5038 // -> 1 - Exp(-d**2) for a 2-dim gauss (d*d = dx*dx + dy*dy != n_sigma)
5039 //
5040 // It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-x**2)/2)
5041 // Can this be expressed in a different way?
5042
5043 if (bRes[0] == 0 || bRes[1] ==0)
5044 return -1;
5045
5046 double d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
5047
5048 // stupid rounding problem screws up everything:
5049 // if d is too big, TMath::Exp(...) gets 0, and TMath::ErfInverse(1) that should be infinite, gets 0 :(
5050 if (TMath::Exp(-d * d / 2) < 1e-10)
5051 return 1000;
5052
5053
5054 d = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
5055 return d;
d7d7e825 5056}
6c84d371 5057
5058//vector <TLorentzVector> AliAnalysisTaskGammaConversion::GetTLorentzVector(vector <AliESDtrack*> esdTrack){
5059TClonesArray AliAnalysisTaskGammaConversion::GetTLorentzVector(TClonesArray *const esdTrack){
2eedd4ed 5060 //Return TLoresntz vector of track?
5061 // vector <TLorentzVector> tlVtrack(0);
5062 TClonesArray array("TLorentzVector",0);
5063
5064 for(Int_t itrack=0; itrack < esdTrack->GetEntriesFast(); itrack++){
5065 double p[3];
5066 //esdTrack[itrack]->GetConstrainedPxPyPz(p);
5067 ((AliESDtrack*)(esdTrack->At(itrack)))->GetConstrainedPxPyPz(p);
5068 TLorentzVector currentTrack;
5069 currentTrack.SetXYZM(p[0],p[1],p[2],fElectronMass);
5070 new((array)[array.GetEntriesFast()]) TLorentzVector(currentTrack);
5071 // tlVtrack.push_back(currentTrack);
5072 }
5073
5074 return array;
5075
5076 // return tlVtrack;
d7d7e825 5077}
77ac6f3e 5078Int_t AliAnalysisTaskGammaConversion::GetProcessType(const AliMCEvent * mcEvt) {
3c45d101 5079
2eedd4ed 5080 // Determine if the event was generated with pythia or phojet and return the process type
5081
5082 // Check if mcEvt is fine
5083 if (!mcEvt) { // coverty does not allow this, the check is done elsewhere
5084 AliFatal("NULL mc event");
5085 return -1;
5086 }
5087
5088 // Determine if it was a pythia or phojet header, and return the correct process type
5089 AliGenPythiaEventHeader * headPy = 0;
5090 AliGenDPMjetEventHeader * headPho = 0;
5091 AliGenEventHeader * htmp = mcEvt->GenEventHeader();
5092 if(!htmp) {
5093 AliFatal("Cannot Get MC Header!!");
5094 return -1;
5095 }
5096 if( TString(htmp->IsA()->GetName()) == "AliGenPythiaEventHeader") {
5097 headPy = (AliGenPythiaEventHeader*) htmp;
5098 } else if (TString(htmp->IsA()->GetName()) == "AliGenDPMjetEventHeader") {
5099 headPho = (AliGenDPMjetEventHeader*) htmp;
5100 } else {
5101 AliError("Unknown header");
5102 }
6746e1e1 5103
2eedd4ed 5104 // Determine process type
5105 if(headPy) {
5106 if(headPy->ProcessType() == 92 || headPy->ProcessType() == 93) {
5107 // single difractive
5108 return kProcSD;
5109 } else if (headPy->ProcessType() == 94) {
5110 // double diffractive
5111 return kProcDD;
5112 }
5113 else if(headPy->ProcessType() != 92 && headPy->ProcessType() != 93 && headPy->ProcessType() != 94) {
5114 // non difractive
5115 return kProcND;
5116 }
5117 } else if (headPho) {
5118 if(headPho->ProcessType() == 5 || headPho->ProcessType() == 6 ) {
5119 // single difractive
5120 return kProcSD;
5121 } else if (headPho->ProcessType() == 7) {
5122 // double diffractive
5123 return kProcDD;
5124 } else if(headPho->ProcessType() != 5 && headPho->ProcessType() != 6 && headPho->ProcessType() != 7 ) {
5125 // non difractive
5126 return kProcND;
5127 }
5128 }
5129
6746e1e1 5130
2eedd4ed 5131 // no process type found?
5132 AliError(Form("Unknown header: %s", htmp->IsA()->GetName()));
5133 return kProcUnknown;
5134}
6746e1e1 5135
6746e1e1 5136
2eedd4ed 5137Int_t AliAnalysisTaskGammaConversion::CalculateMultiplicityBin(){
5138 // Get Centrality bin
6746e1e1 5139
2eedd4ed 5140 Int_t multiplicity = 0;
6746e1e1 5141
2eedd4ed 5142 if ( fUseMultiplicity == 1 ) {
cc5a88a2 5143
2eedd4ed 5144 if (fMultiplicity>= 0 && fMultiplicity<= 5) multiplicity=1;
5145 if (fMultiplicity>= 6 && fMultiplicity<= 9) multiplicity=2;
5146 if (fMultiplicity>=10 && fMultiplicity<=14) multiplicity=3;
5147 if (fMultiplicity>=15 && fMultiplicity<=22) multiplicity=4;
5148 if (fMultiplicity>=23 ) multiplicity=5;
cc5a88a2 5149
2eedd4ed 5150 }
cc5a88a2 5151
2eedd4ed 5152 if ( fUseHBTMultiplicity == 1 ) {
5153
5154 if (fMultiplicity>= 0 && fMultiplicity<=11) multiplicity=1;
5155 if (fMultiplicity>=12 && fMultiplicity<=16) multiplicity=2;
5156 if (fMultiplicity>=17 && fMultiplicity<=22) multiplicity=3;
5157 if (fMultiplicity>=23 && fMultiplicity<=29) multiplicity=4;
5158 if (fMultiplicity>=30 && fMultiplicity<=36) multiplicity=5;
5159 if (fMultiplicity>=37 && fMultiplicity<=44) multiplicity=6;
5160 if (fMultiplicity>=45 && fMultiplicity<=57) multiplicity=7;
5161 if (fMultiplicity>=58 && fMultiplicity<=149) multiplicity=8;
5162
5163 /*
5164 if (fMultiplicity>= 0 && fMultiplicity<=5) multiplicity=1;
5165 if (fMultiplicity>=6 && fMultiplicity<=11) multiplicity=2;
5166 if (fMultiplicity>=12 && fMultiplicity<=16) multiplicity=3;
5167 if (fMultiplicity>=17 && fMultiplicity<=22) multiplicity=4;
5168 if (fMultiplicity>=23 ) multiplicity=5;
5169 */
cc5a88a2 5170
2eedd4ed 5171 }
cc5a88a2 5172
2eedd4ed 5173 return multiplicity;
6746e1e1 5174}