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