1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Ana Marin, Kathrin Koch, Kenneth Aamodt *
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 **************************************************************************/
16 ////////////////////////////////////////////////
17 //---------------------------------------------
18 // Class used to do analysis on conversion pairs
19 //---------------------------------------------
20 ///////////////////////////////////////////////
26 #include "AliAnalysisTaskGammaConversion.h"
30 #include "AliESDtrackCuts.h"
32 //#include "AliCFManager.h" // for CF
33 //#include "AliCFContainer.h" // for CF
34 #include "AliESDInputHandler.h"
35 #include "AliAnalysisManager.h"
36 #include "AliAODPWG4Particle.h"
37 #include "AliAODPWG4ParticleCorrelation.h"
38 #include "AliAODConversionPhoton.h"
39 #include "AliGammaConversionBGHandler.h"
40 #include "AliESDCaloCluster.h" // for combining PHOS and GammaConv
41 #include "AliKFVertex.h"
42 #include "AliGenPythiaEventHeader.h"
43 #include "AliGenDPMjetEventHeader.h"
44 #include "AliGenEventHeader.h"
45 #include <AliMCEventHandler.h>
47 #include "AliTriggerAnalysis.h"
48 #include "AliCentrality.h"
49 #include "AliMultiplicity.h"
50 #include "AliAODHandler.h"
51 #include "AliKFConversionPhoton.h"
52 #include "AliKFConversionMother.h"
53 #include "AliESDVertex.h"
54 #include "AliESDTZERO.h"
56 class AliESDTrackCuts;
64 class AliMCEventHandler;
65 class AliESDInputHandler;
66 class AliAnalysisManager;
73 ClassImp(AliAnalysisTaskGammaConversion)
76 AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion():
81 fMCTruth(NULL), // for CF
82 fGCMCEvent(NULL), // for CF
84 fOutputContainer(NULL),
85 fCFManager(0x0), // for CF
87 fTriggerCINT1B(kFALSE),
89 fDoNeutralMeson(kFALSE),
90 fDoOmegaMeson(kFALSE),
94 fRecalculateV0ForGamma(kFALSE),
95 fKFReconstructedGammasTClone(NULL),
96 fKFReconstructedPi0sTClone(NULL),
97 fKFRecalculatedGammasTClone(NULL),
98 fCurrentEventPosElectronTClone(NULL),
99 fCurrentEventNegElectronTClone(NULL),
100 fKFReconstructedGammasCutTClone(NULL),
101 fPreviousEventTLVNegElectronTClone(NULL),
102 fPreviousEventTLVPosElectronTClone(NULL),
103 // fElectronRecalculatedv1(),
104 // fElectronRecalculatedv2(),
112 fMinOpeningAngleGhostCut(0.),
114 fCalculateBackground(kFALSE),
115 fWriteNtuple(kFALSE),
117 fNeutralMesonNtuple(NULL),
118 fTotalNumberOfAddedNtupleEntries(0),
119 fChargedParticles(NULL),
120 fChargedParticlesId(),
122 fMinPtForGammaJet(1.),
123 fMinIsoConeSize(0.2),
125 fMinPtGamChargedCorr(0.5),
127 fLeadingChargedIndex(-1),
134 fAODBranchName("GammaConv"),
136 fKFExchangeAOD(kFALSE),
138 fKFDeltaAODFileName(""),
139 fDoNeutralMesonV0MCCheck(kFALSE),
140 fUseTrackMultiplicityForBG(kTRUE),
141 fMoveParticleAccordingToVertex(kFALSE),
142 fApplyChi2Cut(kFALSE),
143 fNRandomEventsForBG(15),
144 fNDegreesPMBackground(15),
146 fCheckBGProbability(kTRUE),
147 fRemovePileUp(kFALSE),
148 fSelectV0AND(kFALSE),
149 fTriggerAnalysis(NULL),
152 fUseMultiplicityBin(0),
153 fUseHBTMultiplicity(0),
154 fUseHBTMultiplicityBin(0),
156 fUseCentralityBin(0),
158 fMaxChi2HadInt(100.),
159 fMaxErr2DHadInt(10.),
162 // Default constructor
164 /* Kenneth: the default constructor should not have any define input/output or the call to SetESDtrackCuts
165 // Common I/O in slot 0
166 DefineInput (0, TChain::Class());
167 DefineOutput(0, TTree::Class());
169 // Your private output
170 DefineOutput(1, TList::Class());
172 // Define standard ESD track cuts for Gamma-hadron correlation
177 AliAnalysisTaskGammaConversion::AliAnalysisTaskGammaConversion(const char* name):
178 AliAnalysisTaskSE(name),
182 fMCTruth(NULL), // for CF
183 fGCMCEvent(NULL), // for CF
185 fOutputContainer(0x0),
186 fCFManager(0x0), // for CF
188 fTriggerCINT1B(kFALSE),
190 fDoNeutralMeson(kFALSE),
191 fDoOmegaMeson(kFALSE),
195 fRecalculateV0ForGamma(kFALSE),
196 fKFReconstructedGammasTClone(NULL),
197 fKFReconstructedPi0sTClone(NULL),
198 fKFRecalculatedGammasTClone(NULL),
199 fCurrentEventPosElectronTClone(NULL),
200 fCurrentEventNegElectronTClone(NULL),
201 fKFReconstructedGammasCutTClone(NULL),
202 fPreviousEventTLVNegElectronTClone(NULL),
203 fPreviousEventTLVPosElectronTClone(NULL),
204 // fElectronRecalculatedv1(),
205 // fElectronRecalculatedv2(),
213 fMinOpeningAngleGhostCut(0.),
215 fCalculateBackground(kFALSE),
216 fWriteNtuple(kFALSE),
218 fNeutralMesonNtuple(NULL),
219 fTotalNumberOfAddedNtupleEntries(0),
220 fChargedParticles(NULL),
221 fChargedParticlesId(),
223 fMinPtForGammaJet(1.),
224 fMinIsoConeSize(0.2),
226 fMinPtGamChargedCorr(0.5),
228 fLeadingChargedIndex(-1),
235 fAODBranchName("GammaConv"),
237 fKFExchangeAOD(kFALSE),
239 fKFDeltaAODFileName(""),
240 fDoNeutralMesonV0MCCheck(kFALSE),
241 fUseTrackMultiplicityForBG(kTRUE),
242 fMoveParticleAccordingToVertex(kFALSE),
243 fApplyChi2Cut(kFALSE),
244 fNRandomEventsForBG(15),
245 fNDegreesPMBackground(15),
247 fCheckBGProbability(kTRUE),
248 fRemovePileUp(kFALSE),
249 fSelectV0AND(kFALSE),
250 fTriggerAnalysis(NULL),
253 fUseMultiplicityBin(0),
254 fUseHBTMultiplicity(0),
255 fUseHBTMultiplicityBin(0),
257 fUseCentralityBin(0),
259 fMaxChi2HadInt(100.),
260 fMaxErr2DHadInt(10.),
263 // Common I/O in slot 0, don't define when inheriting from AnalysisTaskSE
264 // DefineInput (0, TChain::Class());
265 // DefineOutput(0, TTree::Class());
267 // Your private output
268 DefineOutput(1, TList::Class());
269 DefineOutput(2, AliCFContainer::Class()); // for CF
270 DefineOutput(3, TClonesArray::Class());
272 // Define standard ESD track cuts for Gamma-hadron correlation
277 AliAnalysisTaskGammaConversion::~AliAnalysisTaskGammaConversion()
279 // Remove all pointers
281 if(fOutputContainer){
282 fOutputContainer->Clear() ;
283 delete fOutputContainer ;
298 delete fEsdTrackCuts;
320 if(fTriggerAnalysis) {
321 delete fTriggerAnalysis;
329 void AliAnalysisTaskGammaConversion::Init()
332 // AliLog::SetGlobalLogLevel(AliLog::kError);
334 void AliAnalysisTaskGammaConversion::SetESDtrackCuts()
337 if (fEsdTrackCuts!=NULL){
338 delete fEsdTrackCuts;
340 fEsdTrackCuts = new AliESDtrackCuts("AliESDtrackCuts");
341 //standard cuts from:
342 //http://aliceinfo.cern.ch/alicvs/viewvc/PWG0/dNdEta/CreateCuts.C?revision=1.4&view=markup
344 // Cuts used up to 3rd of March
346 // fEsdTrackCuts->SetMinNClustersTPC(50);
347 // fEsdTrackCuts->SetMaxChi2PerClusterTPC(3.5);
348 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
349 // fEsdTrackCuts->SetRequireITSRefit(kTRUE);
350 // fEsdTrackCuts->SetMaxNsigmaToVertex(3);
351 // fEsdTrackCuts->SetRequireSigmaToVertex(kTRUE);
353 //------- To be tested-----------
354 // Cuts used up to 26th of Agost
355 // Int_t minNClustersTPC = 70;
356 // Double_t maxChi2PerClusterTPC = 4.0;
357 // Double_t maxDCAtoVertexXY = 2.4; // cm
358 // Double_t maxDCAtoVertexZ = 3.2; // cm
359 // fEsdTrackCuts->SetRequireSigmaToVertex(kFALSE);
360 // fEsdTrackCuts->SetRequireTPCRefit(kTRUE);
361 // fEsdTrackCuts->SetRequireITSRefit(kTRUE);
362 // // fEsdTrackCuts->SetRequireTPCStandAlone(kTRUE);
363 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
364 // fEsdTrackCuts->SetMinNClustersTPC(minNClustersTPC);
365 // fEsdTrackCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);
366 // fEsdTrackCuts->SetMaxDCAToVertexXY(maxDCAtoVertexXY);
367 // fEsdTrackCuts->SetMaxDCAToVertexZ(maxDCAtoVertexZ);
368 // fEsdTrackCuts->SetDCAToVertex2D(kTRUE);
369 // fEsdTrackCuts->SetEtaRange(-0.8, 0.8);
370 // fEsdTrackCuts->SetPtRange(0.15);
372 // fEsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD,AliESDtrackCuts::kFirst);
375 // Using standard function for setting Cuts
376 Bool_t selectPrimaries=kTRUE;
377 fEsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
378 fEsdTrackCuts->SetMaxDCAToVertexZ(2);
379 fEsdTrackCuts->SetEtaRange(-0.8, 0.8);
380 fEsdTrackCuts->SetPtRange(0.15);
382 //----- From Jacek 10.03.03 ------------------/
383 // minNClustersTPC = 70;
384 // maxChi2PerClusterTPC = 4.0;
385 // maxDCAtoVertexXY = 2.4; // cm
386 // maxDCAtoVertexZ = 3.2; // cm
388 // esdTrackCuts->SetRequireSigmaToVertex(kFALSE);
389 // esdTrackCuts->SetRequireTPCRefit(kFALSE);
390 // esdTrackCuts->SetRequireTPCStandAlone(kTRUE);
391 // esdTrackCuts->SetAcceptKinkDaughters(kFALSE);
392 // esdTrackCuts->SetMinNClustersTPC(minNClustersTPC);
393 // esdTrackCuts->SetMaxChi2PerClusterTPC(maxChi2PerClusterTPC);
394 // esdTrackCuts->SetMaxDCAToVertexXY(maxDCAtoVertexXY);
395 // esdTrackCuts->SetMaxDCAToVertexZ(maxDCAtoVertexZ);
396 // esdTrackCuts->SetDCAToVertex2D(kTRUE);
400 // fEsdTrackCuts->SetAcceptKinkDaughters(kFALSE);
401 // fV0Reader->SetESDtrackCuts(fEsdTrackCuts);
404 void AliAnalysisTaskGammaConversion::UserExec(Option_t */*option*/)
406 // Execute analysis for current event
408 // Load the esdpid from the esdhandler if exists (tender was applied) otherwise set the Bethe Bloch parameters
409 Int_t eventQuality=-1;
411 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
412 AliESDInputHandler *esdHandler=0x0;
413 if ( (esdHandler=dynamic_cast<AliESDInputHandler*>(man->GetInputEventHandler())) && esdHandler->GetESDpid() ){
414 AliV0Reader::SetESDpid(esdHandler->GetESDpid());
416 //load esd pid bethe bloch parameters depending on the existance of the MC handler
417 // yes: MC parameters
418 // no: data parameters
419 if (!AliV0Reader::GetESDpid()){
421 AliV0Reader::InitESDpid();
423 AliV0Reader::InitESDpid(1);
428 if(fAODGamma) fAODGamma->Clear();
432 // To avoid crashes due to unzip errors. Sometimes the trees are not there.
434 AliMCEventHandler* mcHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
436 AliError("Could not retrive MC event handler!");
439 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
441 if (!mcHandler->InitOk() ){
443 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
445 if (!mcHandler->TreeK() ){
447 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
449 if (!mcHandler->TreeTR() ) {
451 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
454 if (eventQuality > -1) {
461 fV0Reader->SetInputAndMCEvent(InputEvent(), MCEvent());
463 //Process hadronic interactions
464 if(fDoHadInt == kTRUE){
465 ProcessHadronicInteraction(fESDEvent);
468 fV0Reader->Initialize();
469 fDoMCTruth = fV0Reader->GetDoMCTruth();
472 if(fKFReconstructedGammasTClone == NULL){
473 fKFReconstructedGammasTClone = new TClonesArray("AliKFConversionPhoton",0);
475 if(fCurrentEventPosElectronTClone == NULL){
476 fCurrentEventPosElectronTClone = new TClonesArray("AliESDtrack",0);
478 if(fCurrentEventNegElectronTClone == NULL){
479 fCurrentEventNegElectronTClone = new TClonesArray("AliESDtrack",0);
481 if(fKFReconstructedGammasCutTClone == NULL){
482 fKFReconstructedGammasCutTClone = new TClonesArray("AliKFConversionPhoton",0);
484 if(fPreviousEventTLVNegElectronTClone == NULL){
485 fPreviousEventTLVNegElectronTClone = new TClonesArray("TLorentzVector",0);
487 if(fPreviousEventTLVPosElectronTClone == NULL){
488 fPreviousEventTLVPosElectronTClone = new TClonesArray("TLorentzVector",0);
490 if(fChargedParticles == NULL){
491 fChargedParticles = new TClonesArray("AliESDtrack",0);
494 if(fKFReconstructedPi0sTClone == NULL){
495 fKFReconstructedPi0sTClone = new TClonesArray("AliKFConversionMother",0);
498 /* if(fKFRecalculatedGammasTClone == NULL){
499 fKFRecalculatedGammasTClone = new TClonesArray("AliKFParticle",0);
502 if(fTriggerAnalysis== NULL){
503 fTriggerAnalysis = new AliTriggerAnalysis;
507 fKFReconstructedGammasTClone->Delete();
508 fCurrentEventPosElectronTClone->Delete();
509 fCurrentEventNegElectronTClone->Delete();
510 fKFReconstructedGammasCutTClone->Delete();
511 fPreviousEventTLVNegElectronTClone->Delete();
512 fPreviousEventTLVPosElectronTClone->Delete();
513 fKFReconstructedPi0sTClone->Delete();
514 // fKFRecalculatedGammasTClone->Delete();
518 fChargedParticles->Delete();
520 fChargedParticlesId.clear();
523 //Clear the data in the v0Reader
524 // fV0Reader->UpdateEventByEventData();
527 // Process the MC information
533 if(!DoEventSelection()) {
539 //Process the v0 information with no cuts
542 // Process the v0 information
548 FillAODWithConversionGammas() ;
552 // Process reconstructed gammas
553 if(fDoNeutralMeson == kTRUE){
554 ProcessGammasForNeutralMesonAnalysis();
558 if(fDoMCTruth == kTRUE){
561 //Process reconstructed gammas electrons for Chi_c Analysis
562 if(fDoChic == kTRUE){
563 ProcessGammaElectronsForChicAnalysis();
565 // Process reconstructed gammas for gamma Jet/hadron correlations
567 ProcessGammasForGammaJetAnalysis();
570 //calculate background if flag is set
571 if(fCalculateBackground){
572 CalculateBackground();
575 if(fDoNeutralMeson == kTRUE){
576 // ProcessConvPHOSGammasForNeutralMesonAnalysis();
577 if(fDoOmegaMeson == kTRUE){
578 ProcessGammasForOmegaMesonAnalysis();
583 //Must set fForceAOD to true for the AOD to get filled. (Unless called by other task)
585 if (!AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()) {
586 AliFatal("Cannot run ESD filter without an output event handler");
589 if(fAODGamma && fAODGamma->GetEntriesFast() > 0) {
590 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
591 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
597 ///Make sure delta aod is filled if standard aod is filled (for synchronization when reading aod with standard aod)
598 if(fKFCreateAOD && !fKFExchangeAOD) {
599 AliAODHandler * aodhandler = dynamic_cast<AliAODHandler*>(AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler());
600 if (aodhandler && aodhandler->GetFillAOD()) {
601 AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillExtension(kTRUE);
606 //Clear the data in the v0Reader
607 fV0Reader->UpdateEventByEventData();
608 //if(fRecalculateV0ForGamma==kTRUE){
609 // RecalculateV0ForGamma();
612 PostData(1, fOutputContainer);
613 PostData(2, fCFManager->GetParticleContainer()); // for CF
617 Bool_t AliAnalysisTaskGammaConversion::DoEventSelection() {
620 Int_t eventQuality = -1;
622 //Take Only events with proper trigger
625 if(!fV0Reader->GetESDEvent()->IsTriggerClassFired("CINT1B-ABCE-NOPF-ALL")) return;
628 Bool_t v0A = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0A);
629 Bool_t v0C = fTriggerAnalysis->IsOfflineTriggerFired(fV0Reader->GetESDEvent(), AliTriggerAnalysis::kV0C);
630 Bool_t v0AND = v0A && v0C;
632 if(fSelectV0AND && !v0AND){
634 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
636 if(!fV0Reader->GetIsHeavyIon()){
637 CheckMesonProcessTypeEventQuality(eventQuality);
644 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
645 // cout<< "Event not taken"<< endl;
647 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
649 if(!fV0Reader->GetIsHeavyIon()){
650 CheckMesonProcessTypeEventQuality(eventQuality);
653 return kFALSE; // aborts if the primary vertex does not have contributors.
658 if(!fV0Reader->CheckForPrimaryVertexZ() ){
660 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
662 if(!fV0Reader->GetIsHeavyIon()){
663 CheckMesonProcessTypeEventQuality(eventQuality);
670 if(fV0Reader->GetESDEvent()->GetPrimaryVertexTracks()->GetNContributors()>0) {
671 fHistograms->FillHistogram("ESD_GlobalPrimaryVtxZ",fV0Reader->GetESDEvent()->GetPrimaryVertex()->GetZ());
673 if(fV0Reader->GetESDEvent()->GetPrimaryVertexSPD()->GetNContributors()>0) {
674 fHistograms->FillHistogram("ESD_SPDPrimaryVtxZ",fV0Reader->GetESDEvent()->GetPrimaryVertex()->GetZ());
678 if(fRemovePileUp && fV0Reader->GetESDEvent()->IsPileupFromSPD()) {
680 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
685 Int_t tTracklet=0, tITSTPC=0, tITSPure=0;
686 fV0Reader->GetESDEvent()->EstimateMultiplicity(tTracklet, tITSTPC, tITSPure, 0.8);
687 Int_t fMultiplicityITS = tITSPure;
689 fMultiplicity = fEsdTrackCuts->CountAcceptedTracks(fV0Reader->GetESDEvent());
690 Int_t fMultiplicityStandard = fMultiplicity;
692 if( fUseHBTMultiplicity==1) {
693 fMultiplicity = fMultiplicityITS;
698 fHistograms->FillHistogram("ESD_MultiplicityDeviation",fMultiplicityStandard,fMultiplicityITS);
702 if(fUseMultiplicity!=0 && CalculateMultiplicityBin()!=fUseMultiplicityBin ){
704 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
709 if(fUseHBTMultiplicity!=0 && CalculateMultiplicityBin()!=fUseHBTMultiplicityBin ){
711 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
716 if(fV0Reader->GetIsHeavyIon()){
717 if(fUseCentrality>0){
718 AliCentrality *esdCentrality = fV0Reader->GetESDEvent()->GetCentrality();
719 Int_t centralityC = -1;
721 if(fUseCentrality==1){
722 centralityC = esdCentrality->GetCentralityClass10("V0M");
723 if( centralityC != fUseCentralityBin ){
725 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
730 if(fUseCentrality==2){
731 centralityC = esdCentrality->GetCentralityClass10("CL1");
732 if( centralityC != fUseCentralityBin ){
734 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
739 ////////////////////////////////////// RRnew start /////////////////////////////////////////////////////
740 if(fUseCentrality==3){
741 centralityC = esdCentrality->GetCentralityClass10("V0M");
742 if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
744 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
747 if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
749 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
752 if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
754 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
757 if( (fUseCentralityBin == 3) && (centralityC!=0) && (centralityC!=1) ){ // 0-20%
759 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
762 if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
764 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
767 if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
769 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
772 if( (fUseCentralityBin == 7) && (centralityC!=6) && (centralityC!=7) ){ // 60-80%
774 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
777 if( (fUseCentralityBin == 8) && (centralityC>=8) ){ // 0-80%
779 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
782 if( (fUseCentralityBin == 9) && (centralityC>=9) ){ // 0-90%
784 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
789 if(fUseCentrality==4){
790 centralityC = esdCentrality->GetCentralityClass10("CL1");
791 if( (fUseCentralityBin == 0) && (centralityC!=0) ){ // 0-10%
793 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
796 if( (fUseCentralityBin == 1) && (centralityC!=1) ){ // 10-20%
798 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
801 if( (fUseCentralityBin == 2) && (centralityC!=2) && (centralityC!=3) ){ // 20-40%
803 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
806 if( (fUseCentralityBin == 4) && (centralityC!=4) && (centralityC!=5) ){ // 40-60%
808 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
811 if( (fUseCentralityBin == 6) && (centralityC!=6) && (centralityC!=7) && (centralityC!=8) ){ // 60-90%
813 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
817 ////////////////////////////////////// RRnew end ///////////////////////////////////////////////////////
825 fHistograms->FillHistogram("ESD_EventQuality",eventQuality);
829 fHistograms->FillHistogram("ESD_NumberOfGoodESDTracks",fMultiplicity);
830 if (fV0Reader->GetNumberOfContributorsVtx()>=1){
831 fHistograms->FillHistogram("ESD_NumberOfGoodESDTracksVtx",fMultiplicity);
841 ///_______________________________________________________________
842 void AliAnalysisTaskGammaConversion::PostAODEvent() {
843 ///Post AOD array to correct output slot
845 if(!fKFExchangeAOD) {
846 PostData(0, fAODGamma);
848 PostData(3, fAODGamma);
853 // void AliAnalysisTaskGammaConversion::ConnectInputData(Option_t *option){
854 // // see header file for documentation
855 // // printf(" ConnectInputData %s\n", GetName());
857 // AliAnalysisTaskSE::ConnectInputData(option);
859 // if(fV0Reader == NULL){
860 // // Write warning here cuts and so on are default if this ever happens
862 // fV0Reader->Initialize();
863 // fDoMCTruth = fV0Reader->GetDoMCTruth();
866 void AliAnalysisTaskGammaConversion::CheckMesonProcessTypeEventQuality(Int_t evtQ){
867 // Check meson process type event quality
868 fStack= MCEvent()->Stack();
869 fGCMCEvent=MCEvent();
873 for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
874 TParticle* particle = (TParticle *)fStack->Particle(iTracks);
879 // if(particle->GetPdgCode()!=111 || particle->GetPdgCode()!=221){
884 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
888 rapidity = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())));
892 if( particle->GetPdgCode()==111){
893 fHistograms->FillHistogram("MC_Test_AllPi0_Pt", particle->Pt());
894 if(particle->GetNDaughters()==2){
895 fHistograms->FillHistogram("MC_Test_2DaughPi0_Pt", particle->Pt());
896 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
897 fHistograms->FillHistogram("MC_Test_2DaughPi0_Rap_Pt", particle->Pt());
900 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
901 fHistograms->FillHistogram("MC_Test_Pi0_Rap_Pt", particle->Pt());
906 if(particle->GetPdgCode()==221){
907 fHistograms->FillHistogram("MC_Test_AllEta_Pt", particle->Pt());
908 if(particle->GetNDaughters()==2){
909 fHistograms->FillHistogram("MC_Test_2DaughEta_Pt", particle->Pt());
910 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
911 fHistograms->FillHistogram("MC_Test_2DaughEta_Rap_Pt", particle->Pt());
914 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
915 fHistograms->FillHistogram("MC_Test_Eta_Rap_Pt", particle->Pt());
921 if(particle->GetPdgCode()!=111){ //Pi0
926 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ) continue;
927 if(fV0Reader->GetIsHeavyIon()) continue;
930 switch(GetProcessType(fGCMCEvent)){
932 fHistograms->FillHistogram("MC_SD_EvtQ1_Pi0_Pt", particle->Pt());
935 fHistograms->FillHistogram("MC_DD_EvtQ1_Pi0_Pt", particle->Pt());
938 fHistograms->FillHistogram("MC_ND_EvtQ1_Pi0_Pt", particle->Pt());
941 AliError("Unknown Process");
945 switch(GetProcessType(fGCMCEvent)){
947 fHistograms->FillHistogram("MC_SD_EvtQ2_Pi0_Pt", particle->Pt());
950 fHistograms->FillHistogram("MC_DD_EvtQ2_Pi0_Pt", particle->Pt());
953 fHistograms->FillHistogram("MC_ND_EvtQ2_Pi0_Pt", particle->Pt());
956 AliError("Unknown Process");
961 switch(GetProcessType(fGCMCEvent)){
963 fHistograms->FillHistogram("MC_SD_EvtQ4_Pi0_Pt", particle->Pt());
966 fHistograms->FillHistogram("MC_DD_EvtQ4_Pi0_Pt", particle->Pt());
969 fHistograms->FillHistogram("MC_ND_EvtQ4_Pi0_Pt", particle->Pt());
972 AliError("Unknown Process");
977 switch(GetProcessType(fGCMCEvent)){
979 fHistograms->FillHistogram("MC_SD_EvtQ5_Pi0_Pt", particle->Pt());
982 fHistograms->FillHistogram("MC_DD_EvtQ5_Pi0_Pt", particle->Pt());
985 fHistograms->FillHistogram("MC_ND_EvtQ5_Pi0_Pt", particle->Pt());
988 AliError("Unknown Process");
996 void AliAnalysisTaskGammaConversion::ProcessMCData(){
997 // see header file for documentation
998 //InputEvent(), MCEvent());
1000 fStack = fV0Reader->GetMCStack();
1001 fMCTruth = fV0Reader->GetMCTruth(); // for CF
1002 fGCMCEvent = fV0Reader->GetMCEvent(); // for CF
1004 fStack= MCEvent()->Stack();
1005 fGCMCEvent=MCEvent();
1008 Double_t containerInput[3];
1010 if(!fGCMCEvent) cout << "NO MC INFO FOUND" << endl;
1011 fCFManager->SetEventInfo(fGCMCEvent);
1015 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
1016 return; // aborts if the primary vertex does not have contributors.
1020 Int_t nCharged150MeV = 0;
1022 for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
1023 // for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++) {
1024 TParticle* particle = (TParticle *)fStack->Particle(iTracks);
1029 //print warning here
1036 ///////////////////////Begin Chic Analysis/////////////////////////////
1038 if(particle->GetPdgCode() == 443){//Is JPsi
1039 if(particle->GetNDaughters()==2){
1040 if(TMath::Abs(fStack->Particle(particle->GetFirstDaughter())->GetPdgCode()) == 11 &&
1041 TMath::Abs(fStack->Particle(particle->GetLastDaughter())->GetPdgCode()) == 11){
1043 TParticle* daug0 = fStack->Particle(particle->GetFirstDaughter());
1044 TParticle* daug1 = fStack->Particle(particle->GetLastDaughter());
1045 if(TMath::Abs(daug0->Eta()) < 0.9 && TMath::Abs(daug1->Eta()) < 0.9)
1046 fHistograms->FillTable("Table_Electrons",3);//e+ e- from J/Psi inside acceptance
1048 if( TMath::Abs(daug0->Eta()) < 0.9){
1049 if(daug0->GetPdgCode() == -11)
1050 fHistograms->FillTable("Table_Electrons",1);//e+ from J/Psi inside acceptance
1052 fHistograms->FillTable("Table_Electrons",2);//e- from J/Psi inside acceptance
1055 if(TMath::Abs(daug1->Eta()) < 0.9){
1056 if(daug1->GetPdgCode() == -11)
1057 fHistograms->FillTable("Table_Electrons",1);//e+ from J/Psi inside acceptance
1059 fHistograms->FillTable("Table_Electrons",2);//e- from J/Psi inside acceptance
1064 // const int CHI_C0 = 10441;
1065 // const int CHI_C1 = 20443;
1066 // const int CHI_C2 = 445
1067 if(particle->GetPdgCode() == 22){//gamma from JPsi
1068 if(particle->GetMother(0) > -1){
1069 if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 10441 ||
1070 fStack->Particle(particle->GetMother(0))->GetPdgCode() == 20443 ||
1071 fStack->Particle(particle->GetMother(0))->GetPdgCode() == 445){
1072 if(TMath::Abs(particle->Eta()) < 1.2)
1073 fHistograms->FillTable("Table_Electrons",17);// gamma from chic inside accptance
1077 if(particle->GetPdgCode() == 10441 || particle->GetPdgCode() == 20443 || particle->GetPdgCode() == 445){
1078 if( particle->GetNDaughters() == 2){
1079 TParticle* daug0 = fStack->Particle(particle->GetFirstDaughter());
1080 TParticle* daug1 = fStack->Particle(particle->GetLastDaughter());
1082 if( (daug0->GetPdgCode() == 443 || daug0->GetPdgCode() == 22) && (daug1->GetPdgCode() == 443 || daug1->GetPdgCode() == 22) ){
1083 if( daug0->GetPdgCode() == 443){
1084 TParticle* daugE0 = fStack->Particle(daug0->GetFirstDaughter());
1085 TParticle* daugE1 = fStack->Particle(daug0->GetLastDaughter());
1086 if( TMath::Abs(daug1->Eta()) < 1.2 && TMath::Abs(daugE0->Eta()) < 0.9 && TMath::Abs(daugE1->Eta()) < 0.9 )
1087 fHistograms->FillTable("Table_Electrons",18);
1089 } else if (daug1->GetPdgCode() == 443){
1090 TParticle* daugE0 = fStack->Particle(daug1->GetFirstDaughter());
1091 TParticle* daugE1 = fStack->Particle(daug1->GetLastDaughter());
1092 if( TMath::Abs(daug0->Eta()) < 1.2 && TMath::Abs(daugE0->Eta()) < 0.9 && TMath::Abs(daugE1->Eta()) < 0.9 )
1093 fHistograms->FillTable("Table_Electrons",18);
1100 /////////////////////End Chic Analysis////////////////////////////
1102 // if(TMath::Abs(particle->Eta())> fV0Reader->GetEtaCut() ) continue;
1107 if(particle->Eta() <0.8 && particle->Eta() > (-0.8) && particle->GetPDG()->Charge() != 0) {
1109 if(particle->Pt()>0.150){
1115 if(particle->R()>fV0Reader->GetMaxRCut()) continue; // cuts on distance from collision point
1117 Double_t tmpPhi=particle->Phi();
1119 if(particle->Phi()> TMath::Pi()){
1120 tmpPhi = particle->Phi()-(2*TMath::Pi());
1124 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
1127 rapidity = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())));
1130 if( particle->GetPdgCode()==111){
1132 //AM move here, otherwise for evt we consider only pi0 to 2 g
1133 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1134 if(!fV0Reader->GetIsHeavyIon()) {
1136 switch(GetProcessType(fGCMCEvent)){
1138 fHistograms->FillHistogram("MC_SD_EvtQ3_Pi0_Pt", particle->Pt());
1141 fHistograms->FillHistogram("MC_DD_EvtQ3_Pi0_Pt", particle->Pt());
1144 fHistograms->FillHistogram("MC_ND_EvtQ3_Pi0_Pt", particle->Pt());
1147 AliError("Unknown Process");
1151 fHistograms->FillHistogram("MC_Test_AllPi0_Pt", particle->Pt());
1152 if(particle->GetNDaughters()==2){
1153 fHistograms->FillHistogram("MC_Test_2DaughPi0_Pt", particle->Pt());
1154 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1155 fHistograms->FillHistogram("MC_Test_2DaughPi0_Rap_Pt", particle->Pt());
1158 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1159 fHistograms->FillHistogram("MC_Test_Pi0_Rap_Pt", particle->Pt());
1164 if(particle->GetPdgCode()==221){
1165 fHistograms->FillHistogram("MC_Test_AllEta_Pt", particle->Pt());
1166 if(particle->GetNDaughters()==2){
1167 fHistograms->FillHistogram("MC_Test_2DaughEta_Pt", particle->Pt());
1168 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1169 fHistograms->FillHistogram("MC_Test_2DaughEta_Rap_Pt", particle->Pt());
1172 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1173 fHistograms->FillHistogram("MC_Test_Eta_Rap_Pt", particle->Pt());
1177 if( particle->GetPdgCode()==310 ){
1178 if(TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1179 fHistograms->FillHistogram("MC_K0S_Pt", particle->Pt());
1183 if(iTracks<=fStack->GetNprimary() ){
1184 if ( particle->GetPdgCode()== -211 || particle->GetPdgCode()== 211 ||
1185 particle->GetPdgCode()== 2212 || particle->GetPdgCode()==-2212 ||
1186 particle->GetPdgCode()== 321 || particle->GetPdgCode()==-321 ){
1187 if(TMath::Abs(particle->Eta())> 0.8 ) continue; // Eta cut used in charged particle spectrum
1188 //if( !particle->IsPhysicalPrimary() ){
1189 // cout<<"not Physical primary"<< particle->IsPhysicalPrimary()<<endl;
1191 if(particle->GetMother(0)>-1){
1192 // cout<<"Mother ::"<<fStack->Particle(particle->GetMother(0))->GetPdgCode()<<endl;
1193 if (fStack->Particle(particle->GetMother(0))->GetPdgCode()== -211 ||fStack->Particle(particle->GetMother(0))->GetPdgCode()== -3122 ){
1194 // cout<<"Mother K0, lambda::"<<fStack->Particle(particle->GetMother(0))->GetPdgCode()<<endl;
1199 fHistograms->FillHistogram("MC_PhysicalPrimaryCharged_Pt", particle->Pt());
1201 if (particle->GetPdgCode() == 211 ) fHistograms->FillHistogram("MC_PiPlus_Pt", particle->Pt());
1202 if (particle->GetPdgCode() == 321 ) fHistograms->FillHistogram("MC_KaonPlus_Pt", particle->Pt());
1203 if (particle->GetPdgCode() == 2212 ) fHistograms->FillHistogram("MC_Proton_Pt", particle->Pt());
1204 if (particle->GetPdgCode() == -211 ) fHistograms->FillHistogram("MC_PiMinus_Pt", particle->Pt());
1205 if (particle->GetPdgCode() == -321 ) fHistograms->FillHistogram("MC_KaonMinus_Pt", particle->Pt());
1206 if (particle->GetPdgCode() == -2212 ) fHistograms->FillHistogram("MC_AntiProton_Pt", particle->Pt());
1208 if(TMath::Abs(particle->Eta())<=0.8 ){
1209 if (particle->GetPdgCode() == 111 ) fHistograms->FillHistogram("MC_Pi0_Test_Pt", particle->Pt());
1214 //process the gammas
1215 if (particle->GetPdgCode() == 22){
1216 if(TMath::Abs(particle->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(particle->Eta())< fV0Reader->GetEtaCutMin()) continue;
1218 if(particle->GetMother(0) >-1 && fStack->Particle(particle->GetMother(0))->GetPdgCode() == 22){
1219 continue; // no photon as mothers!
1222 if(particle->GetMother(0) >= fStack->GetNprimary()){
1223 continue; // the gamma has a mother, and it is not a primary particle
1226 if(particle->GetMother(0) >-1){
1227 fHistograms->FillHistogram("MC_DecayAllGamma_Pt", particle->Pt()); // All
1228 switch(fStack->Particle(particle->GetMother(0))->GetPdgCode()){
1230 fHistograms->FillHistogram("MC_DecayPi0Gamma_Pt", particle->Pt());
1233 fHistograms->FillHistogram("MC_DecayRho0Gamma_Pt", particle->Pt());
1236 fHistograms->FillHistogram("MC_DecayEtaGamma_Pt", particle->Pt());
1239 fHistograms->FillHistogram("MC_DecayOmegaGamma_Pt", particle->Pt());
1242 fHistograms->FillHistogram("MC_DecayK0sGamma_Pt", particle->Pt());
1245 fHistograms->FillHistogram("MC_DecayEtapGamma_Pt", particle->Pt());
1248 fHistograms->FillHistogram("MC_DecayPhiGamma_Pt", particle->Pt());
1253 fHistograms->FillHistogram("MC_allGamma_Energy", particle->Energy());
1254 fHistograms->FillHistogram("MC_allGamma_Pt", particle->Pt());
1255 fHistograms->FillHistogram("MC_allGamma_Eta", particle->Eta());
1256 fHistograms->FillHistogram("MC_allGamma_Phi", tmpPhi);
1257 fHistograms->FillHistogram("MC_allGamma_Rapid", rapidity);
1261 containerInput[0] = particle->Pt();
1262 containerInput[1] = particle->Eta();
1263 if(particle->GetMother(0) >=0){
1264 containerInput[2] = fStack->Particle(particle->GetMother(0))->GetMass();
1266 containerInput[2]=-1;
1268 fCFManager->GetParticleContainer()->Fill(containerInput,kStepGenerated); // generated gamma
1271 if(particle->GetMother(0) < 0 || //Phojet p+p -> Direct Photons have no mother
1272 ((particle->GetMother(0) > -1) &&
1273 ((TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) < 10)||
1274 (TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) ==21) )) //Pythia p+p -> Direct Photons have quarksor gluons as mother
1276 fHistograms->FillHistogram("MC_allDirectGamma_Energy",particle->Energy());
1277 fHistograms->FillHistogram("MC_allDirectGamma_Pt", particle->Pt());
1278 fHistograms->FillHistogram("MC_allDirectGamma_Eta", particle->Eta());
1279 fHistograms->FillHistogram("MC_allDirectGamma_Phi", tmpPhi);
1280 fHistograms->FillHistogram("MC_allDirectGamma_Rapid", rapidity);
1283 // looking for conversion (electron + positron from pairbuilding (= 5) )
1284 TParticle* ePos = NULL;
1285 TParticle* eNeg = NULL;
1287 if(particle->GetNDaughters() >= 2){
1288 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
1289 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
1290 if(tmpDaughter->GetUniqueID() == 5){
1291 if(tmpDaughter->GetPdgCode() == 11){
1293 } else if(tmpDaughter->GetPdgCode() == -11){
1300 if(ePos == NULL || eNeg == NULL){ // means we do not have two daughters from pair production
1305 Double_t ePosPhi = ePos->Phi();
1306 if(ePos->Phi()> TMath::Pi()) ePosPhi = ePos->Phi()-(2*TMath::Pi());
1308 Double_t eNegPhi = eNeg->Phi();
1309 if(eNeg->Phi()> TMath::Pi()) eNegPhi = eNeg->Phi()-(2*TMath::Pi());
1311 if(ePos->Pt()<fV0Reader->GetSinglePtCut() || eNeg->Pt()<fV0Reader->GetSinglePtCut()){
1312 continue; // no reconstruction below the Pt cut
1315 if( TMath::Abs(ePos->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(ePos->Eta())< fV0Reader->GetEtaCutMin() ||
1316 TMath::Abs(eNeg->Eta())> fV0Reader->GetEtaCut() || TMath::Abs(eNeg->Eta())< fV0Reader->GetEtaCutMin() ) {
1320 if(ePos->R()>fV0Reader->GetMaxRCut()){
1321 continue; // cuts on distance from collision point
1324 if(TMath::Abs(ePos->Vz()) > fV0Reader->GetMaxZCut()){
1325 continue; // outside material
1327 if(TMath::Abs(eNeg->Vz()) > fV0Reader->GetMaxZCut()){
1328 continue; // outside material
1331 if( ePos->R() <= ((TMath::Abs(ePos->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue())){
1332 continue; // line cut to exclude regions where we do not reconstruct
1333 } else if ( fV0Reader->GetEtaCutMin() != -0.1 && ePos->R() >= ((TMath::Abs(ePos->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin()) ){
1337 if( eNeg->R() <= ((TMath::Abs(eNeg->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue())){
1338 continue; // line cut to exclude regions where we do not reconstruct
1339 } else if ( fV0Reader->GetEtaCutMin() != -0.1 && eNeg->R() >= ((TMath::Abs(eNeg->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin()) ){
1345 fCFManager->GetParticleContainer()->Fill(containerInput,kStepReconstructable); // reconstructable gamma
1347 fHistograms->FillHistogram("MC_ConvGamma_Energy", particle->Energy());
1348 fHistograms->FillHistogram("MC_ConvGamma_Pt", particle->Pt());
1349 // Move down, in the if that mother exists
1350 // if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 221)
1351 // fHistograms->FillHistogram("MC_ConvEtaGamma_Pt", particle->Pt());
1352 fHistograms->FillHistogram("MC_ConvGamma_Eta", particle->Eta());
1353 fHistograms->FillHistogram("MC_ConvGamma_Phi", tmpPhi);
1354 fHistograms->FillHistogram("MC_ConvGamma_Rapid", rapidity);
1355 fHistograms->FillHistogram("MC_ConvGamma_Pt_Eta", particle->Pt(),particle->Eta());
1357 fHistograms->FillHistogram("MC_E_Energy", eNeg->Energy());
1358 fHistograms->FillHistogram("MC_E_Pt", eNeg->Pt());
1359 fHistograms->FillHistogram("MC_E_Eta", eNeg->Eta());
1360 fHistograms->FillHistogram("MC_E_Phi", eNegPhi);
1362 fHistograms->FillHistogram("MC_P_Energy", ePos->Energy());
1363 fHistograms->FillHistogram("MC_P_Pt", ePos->Pt());
1364 fHistograms->FillHistogram("MC_P_Eta", ePos->Eta());
1365 fHistograms->FillHistogram("MC_P_Phi", ePosPhi);
1367 if(!fV0Reader->GetIsHeavyIon()){
1370 Int_t rBin = fHistograms->GetRBin(ePos->R());
1371 Int_t zBin = fHistograms->GetZBin(ePos->Vz());
1372 Int_t phiBin = fHistograms->GetPhiBin(particle->Phi());
1374 Double_t rITSTPCMin=40;
1375 Double_t rITSTPCInt=55;
1376 Double_t rITSTPCMax=72.5;
1378 TVector3 vtxPos(ePos->Vx(),ePos->Vy(),ePos->Vz());
1380 TString nameMCMappingPhiR="";
1381 nameMCMappingPhiR.Form("MC_Conversion_Mapping_Phi%02d_R%02d",phiBin,rBin);
1382 // fHistograms->FillHistogram(nameMCMappingPhiR, ePos->Vz(), particle->Eta());
1384 TString nameMCMappingPhi="";
1385 nameMCMappingPhi.Form("MC_Conversion_Mapping_Phi%02d",phiBin);
1386 // fHistograms->FillHistogram(nameMCMappingPhi, particle->Eta());
1387 //fHistograms->FillHistogram(nameMCMappingPhi, ePos->Vz(), particle->Eta());
1389 TString nameMCMappingR="";
1390 nameMCMappingR.Form("MC_Conversion_Mapping_R%02d",rBin);
1391 // fHistograms->FillHistogram(nameMCMappingR, particle->Eta());
1392 //fHistograms->FillHistogram(nameMCMappingR,ePos->Vz(), particle->Eta());
1394 TString nameMCMappingPhiInR="";
1395 nameMCMappingPhiInR.Form("MC_Conversion_Mapping_Phi_in_R_%02d",rBin);
1396 // fHistograms->FillHistogram(nameMCMappingPhiInR, tmpPhi);
1397 fHistograms->FillHistogram(nameMCMappingPhiInR, vtxPos.Phi());
1399 TString nameMCMappingZInR="";
1400 nameMCMappingZInR.Form("MC_Conversion_Mapping_Z_in_R_%02d",rBin);
1401 fHistograms->FillHistogram(nameMCMappingZInR,ePos->Vz() );
1404 TString nameMCMappingPhiInZ="";
1405 nameMCMappingPhiInZ.Form("MC_Conversion_Mapping_Phi_in_Z_%02d",zBin);
1406 // fHistograms->FillHistogram(nameMCMappingPhiInR, tmpPhi);
1407 fHistograms->FillHistogram(nameMCMappingPhiInZ, vtxPos.Phi());
1411 TString nameMCMappingFMDPhiInZ="";
1412 nameMCMappingFMDPhiInZ.Form("MC_Conversion_Mapping_FMD_Phi_in_Z_%02d",zBin);
1413 fHistograms->FillHistogram(nameMCMappingFMDPhiInZ, vtxPos.Phi());
1416 if(ePos->R()>rITSTPCMin && ePos->R()<rITSTPCInt){
1417 TString nameMCMappingITSTPCPhiInZ="";
1418 nameMCMappingITSTPCPhiInZ.Form("MC_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",zBin);
1419 fHistograms->FillHistogram(nameMCMappingITSTPCPhiInZ, vtxPos.Phi());
1422 if(ePos->R()>rITSTPCInt && ePos->R()<rITSTPCMax){
1423 TString nameMCMappingITSTPC2PhiInZ="";
1424 nameMCMappingITSTPC2PhiInZ.Form("MC_Conversion_Mapping_ITSTPC2_Phi_in_Z_%02d",zBin);
1425 fHistograms->FillHistogram(nameMCMappingITSTPC2PhiInZ, vtxPos.Phi());
1428 TString nameMCMappingRInZ="";
1429 nameMCMappingRInZ.Form("MC_Conversion_Mapping_R_in_Z_%02d",zBin);
1430 fHistograms->FillHistogram(nameMCMappingRInZ,ePos->R() );
1432 if(particle->Pt() > fLowPtMapping && particle->Pt()< fHighPtMapping){
1433 TString nameMCMappingMidPtPhiInR="";
1434 nameMCMappingMidPtPhiInR.Form("MC_Conversion_Mapping_MidPt_Phi_in_R_%02d",rBin);
1435 fHistograms->FillHistogram(nameMCMappingMidPtPhiInR, vtxPos.Phi());
1437 TString nameMCMappingMidPtZInR="";
1438 nameMCMappingMidPtZInR.Form("MC_Conversion_Mapping_MidPt_Z_in_R_%02d",rBin);
1439 fHistograms->FillHistogram(nameMCMappingMidPtZInR,ePos->Vz() );
1442 TString nameMCMappingMidPtPhiInZ="";
1443 nameMCMappingMidPtPhiInZ.Form("MC_Conversion_Mapping_MidPt_Phi_in_Z_%02d",zBin);
1444 fHistograms->FillHistogram(nameMCMappingMidPtPhiInZ, vtxPos.Phi());
1448 TString nameMCMappingMidPtFMDPhiInZ="";
1449 nameMCMappingMidPtFMDPhiInZ.Form("MC_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",zBin);
1450 fHistograms->FillHistogram(nameMCMappingMidPtFMDPhiInZ, vtxPos.Phi());
1453 TString nameMCMappingMidPtRInZ="";
1454 nameMCMappingMidPtRInZ.Form("MC_Conversion_Mapping_MidPt_R_in_Z_%02d",zBin);
1455 fHistograms->FillHistogram(nameMCMappingMidPtRInZ,ePos->R() );
1462 fHistograms->FillHistogram("MC_Conversion_R",ePos->R());
1463 fHistograms->FillHistogram("MC_Conversion_ZR",ePos->Vz(),ePos->R());
1464 fHistograms->FillHistogram("MC_Conversion_XY",ePos->Vx(),ePos->Vy());
1465 fHistograms->FillHistogram("MC_Conversion_OpeningAngle",GetMCOpeningAngle(ePos, eNeg));
1466 fHistograms->FillHistogram("MC_ConvGamma_E_AsymmetryP",particle->P(),eNeg->P()/particle->P());
1467 fHistograms->FillHistogram("MC_ConvGamma_P_AsymmetryP",particle->P(),ePos->P()/particle->P());
1470 if(particle->GetMother(0) < 0 || //Phojet p+p -> Direct Photons have no mother
1471 ((particle->GetMother(0) > -1) &&
1472 ((TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) < 10)||
1473 (TMath::Abs(fStack->Particle(particle->GetMother(0))->GetPdgCode()) ==21) )) //Pythia p+p -> Direct Photons have quarksor gluons as mother
1474 ){ // direct gamma, still inside converted
1475 fHistograms->FillHistogram("MC_ConvDirectGamma_Energy",particle->Energy());
1476 fHistograms->FillHistogram("MC_ConvDirectGamma_Pt", particle->Pt());
1477 fHistograms->FillHistogram("MC_ConvDirectGamma_Eta", particle->Eta());
1478 fHistograms->FillHistogram("MC_ConvDirectGamma_Phi", tmpPhi);
1479 fHistograms->FillHistogram("MC_ConvDirectGamma_Rapid", rapidity);
1481 } else{ // mother exits
1482 if(fStack->Particle(particle->GetMother(0))->GetPdgCode() == 221)
1483 fHistograms->FillHistogram("MC_ConvEtaGamma_Pt", particle->Pt());
1484 /* if( fStack->Particle(particle->GetMother(0))->GetPdgCode()==10441 ||//chic0
1485 fStack->Particle(particle->GetMother(0))->GetPdgCode()==20443 ||//psi2S
1486 fStack->Particle(particle->GetMother(0))->GetPdgCode()==445 //chic2
1488 fMCGammaChic.push_back(particle);
1491 } // end if mother exits
1492 } // end if particle is a photon
1496 // process motherparticles (2 gammas as daughters)
1497 // the motherparticle had already to pass the R and the eta cut, but no line cut.
1498 // the line cut is just valid for the conversions!
1500 // RR primary Pi0 debug ////////////////////////////////////////////////////////////////////////////////////////////
1501 if (particle->GetPdgCode()==111){
1502 if( TMath::Abs(rapidity) < fV0Reader->GetRapidityMesonCut() ){
1503 fHistograms->FillHistogram("MC_Pi0_Pt_vs_Rapid_allDaughters", particle->Pt(),rapidity);
1506 // end RR primary Pi0 debug ////////////////////////////////////////////////////////////////////////////////////////
1508 if(particle->GetNDaughters() == 2){
1510 TParticle* daughter0 = (TParticle*)fStack->Particle(particle->GetFirstDaughter());
1511 TParticle* daughter1 = (TParticle*)fStack->Particle(particle->GetLastDaughter());
1513 if(daughter0->GetPdgCode() != 22 || daughter1->GetPdgCode() != 22) continue; //check for gamma gamma daughters
1515 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ) continue;
1517 // Check the acceptance for both gammas
1518 Bool_t gammaEtaCut = kTRUE;
1519 if(TMath::Abs(daughter0->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(daughter0->Eta()) < fV0Reader->GetEtaCutMin() ||
1520 TMath::Abs(daughter1->Eta()) > fV0Reader->GetEtaCut() || TMath::Abs(daughter1->Eta()) < fV0Reader->GetEtaCutMin() ) gammaEtaCut = kFALSE;
1522 Bool_t gammaRCut = kTRUE;
1523 if(daughter0->R() > fV0Reader->GetMaxRCut() || daughter1->R() > fV0Reader->GetMaxRCut() ) gammaRCut = kFALSE;
1525 // check for conversions now -> have to pass eta, R and line cut!
1526 Bool_t daughter0Electron = kFALSE;
1527 Bool_t daughter0Positron = kFALSE;
1528 Bool_t daughter1Electron = kFALSE;
1529 Bool_t daughter1Positron = kFALSE;
1531 if(daughter0->GetNDaughters() >= 2){ // first gamma
1532 for(Int_t TrackIndex=daughter0->GetFirstDaughter();TrackIndex<=daughter0->GetLastDaughter();TrackIndex++){
1533 TParticle *tmpDaughter = fStack->Particle(TrackIndex);
1534 if(tmpDaughter->GetUniqueID() == 5){
1535 if(tmpDaughter->GetPdgCode() == 11){
1536 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1537 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1538 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1539 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1540 daughter0Electron = kTRUE;
1545 } else if(tmpDaughter->GetPdgCode() == -11){
1546 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1547 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1548 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1549 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1550 daughter0Positron = kTRUE;
1560 if(daughter1->GetNDaughters() >= 2){ // second gamma
1561 for(Int_t TrackIndex=daughter1->GetFirstDaughter();TrackIndex<=daughter1->GetLastDaughter();TrackIndex++){
1562 TParticle *tmpDaughter = fStack->Particle(TrackIndex);
1563 if(tmpDaughter->GetUniqueID() == 5){
1564 if(tmpDaughter->GetPdgCode() == 11){
1565 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1566 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1567 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1568 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1569 daughter1Electron = kTRUE;
1574 } else if(tmpDaughter->GetPdgCode() == -11){
1575 if( TMath::Abs(tmpDaughter->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(tmpDaughter->Eta()) >= fV0Reader->GetEtaCutMin() ){
1576 if( tmpDaughter->R() > ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlope()) - fV0Reader->GetLineCutZValue() ) ){
1577 if ( (fV0Reader->GetEtaCutMin() != -0.1 && tmpDaughter->R() < ((TMath::Abs(tmpDaughter->Vz()) * fV0Reader->GetLineCutZRSlopeMin()) - fV0Reader->GetLineCutZValueMin())) || fV0Reader->GetEtaCutMin() == -0.1 ){
1578 if(tmpDaughter->R()< fV0Reader->GetMaxRCut()){
1579 daughter1Positron = kTRUE;
1588 if(particle->GetPdgCode()==111){ //Pi0
1589 if( iTracks >= fStack->GetNprimary()){
1590 fHistograms->FillHistogram("MC_Pi0_Secondaries_Eta", particle->Eta());
1591 fHistograms->FillHistogram("MC_Pi0_Secondaries_Rapid", rapidity);
1592 fHistograms->FillHistogram("MC_Pi0_Secondaries_Phi", tmpPhi);
1593 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt", particle->Pt());
1594 fHistograms->FillHistogram("MC_Pi0_Secondaries_Energy", particle->Energy());
1595 fHistograms->FillHistogram("MC_Pi0_Secondaries_R", particle->R());
1596 fHistograms->FillHistogram("MC_Pi0_Secondaries_ZR", particle->Vz(),particle->R());
1597 fHistograms->FillHistogram("MC_Pi0_Secondaries_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1598 fHistograms->FillHistogram("MC_Pi0_Secondaries_XY", particle->Vx(),particle->Vy());//only fill from one daughter to avoid multiple filling
1600 if(gammaEtaCut && gammaRCut){
1601 //if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1602 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1603 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1604 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1605 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1606 fHistograms->FillHistogram("MC_Pi0_Secondaries_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1608 if(particle->GetMother(0) > -1){
1609 Int_t pdgPionMother=fStack->Particle(particle->GetMother(0))->GetPdgCode();
1610 if(pdgPionMother ==310 ){
1611 fHistograms->FillHistogram("MC_K0S_Pt_FromPi0", fStack->Particle(particle->GetMother(0))->Pt());
1617 fHistograms->FillHistogram("MC_Pi0_Eta", particle->Eta());
1618 fHistograms->FillHistogram("MC_Pi0_Rapid", rapidity);
1619 fHistograms->FillHistogram("MC_Pi0_Phi", tmpPhi);
1620 fHistograms->FillHistogram("MC_Pi0_Pt", particle->Pt());
1621 //if(fGCMCEvent->IsFromBGEvent(iTracks)) fHistograms->FillHistogram("MC_Pi0_Pt_under", particle->Pt());
1622 fHistograms->FillHistogram("MC_Pi0_Pt_vs_Rapid", particle->Pt(),rapidity);
1623 fHistograms->FillHistogram("MC_Pi0_Energy", particle->Energy());
1624 fHistograms->FillHistogram("MC_Pi0_R", particle->R());
1625 fHistograms->FillHistogram("MC_Pi0_ZR", particle->Vz(),particle->R());
1626 fHistograms->FillHistogram("MC_Pi0_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1627 fHistograms->FillHistogram("MC_Pi0_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling
1628 if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_Fiducial", particle->Pt());
1629 if(particle->GetMother(0) > -1){
1630 Int_t pdgPionMother=fStack->Particle(particle->GetMother(0))->GetPdgCode();
1631 if(pdgPionMother ==221 ){
1632 fHistograms->FillHistogram("MC_Pi0_Pt_FromEta", particle->Pt());
1633 }else if( pdgPionMother==223 ){
1634 fHistograms->FillHistogram("MC_Pi0_Pt_FromOmega", particle->Pt());
1635 }else if(TMath::Abs(pdgPionMother) ==213 ){
1636 fHistograms->FillHistogram("MC_Pi0_Pt_FromRhoPlusMinus", particle->Pt());
1638 fHistograms->FillHistogram("MC_Pi0_Pt_FromOthers", particle->Pt());
1641 fHistograms->FillHistogram("MC_Pi0_Pt_Direct", particle->Pt());
1644 if(gammaEtaCut && gammaRCut){
1645 // if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1646 fHistograms->FillHistogram("MC_Pi0_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1647 fHistograms->FillHistogram("MC_Pi0_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1648 if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_withinAcceptance_Fiducial", particle->Pt());
1649 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1650 fHistograms->FillHistogram("MC_Pi0_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1651 fHistograms->FillHistogram("MC_Pi0_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1652 fHistograms->FillHistogram("MC_Pi0_ZR_ConvGamma_withinAcceptance", particle->Vz(),particle->R());
1653 fHistograms->FillHistogram("MC_Pi0_ConvGamma_OpeningAngle_Pt", particle->Pt(),GetMCOpeningAngle(daughter0,daughter1));
1654 fHistograms->FillHistogram("MC_Pi0_ConvGamma_PtGamma_Pt", particle->Pt(),daughter0->Pt());
1655 fHistograms->FillHistogram("MC_Pi0_ConvGamma_PtGamma_Pt", particle->Pt(),daughter1->Pt());
1658 if((daughter0->Energy()+daughter1->Energy()) > 0.){
1659 alfa= TMath::Abs((daughter0->Energy()-daughter1->Energy())/(daughter0->Energy()+daughter1->Energy()));
1661 fHistograms->FillHistogram("MC_Pi0_alpha",alfa);
1662 if(TMath::Abs(particle->Eta())<0.9)fHistograms->FillHistogram("MC_Pi0_Pt_ConvGamma_withinAcceptance_Fiducial", particle->Pt());
1668 if(particle->GetPdgCode()==221){ //Eta
1669 fHistograms->FillHistogram("MC_Eta_Eta", particle->Eta());
1670 fHistograms->FillHistogram("MC_Eta_Rapid", rapidity);
1671 fHistograms->FillHistogram("MC_Eta_Phi",tmpPhi);
1672 fHistograms->FillHistogram("MC_Eta_Pt", particle->Pt());
1673 fHistograms->FillHistogram("MC_Eta_Pt_vs_Rapid", particle->Pt(),rapidity);
1674 fHistograms->FillHistogram("MC_Eta_Energy", particle->Energy());
1675 fHistograms->FillHistogram("MC_Eta_R", particle->R());
1676 fHistograms->FillHistogram("MC_Eta_ZR", particle->Vz(),particle->R());
1677 fHistograms->FillHistogram("MC_Eta_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1678 fHistograms->FillHistogram("MC_Eta_XY", particle->Vx(), particle->Vy());//only fill from one daughter to avoid multiple filling
1680 if(gammaEtaCut && gammaRCut){
1681 // if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1682 fHistograms->FillHistogram("MC_Eta_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1683 fHistograms->FillHistogram("MC_Eta_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1684 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1685 fHistograms->FillHistogram("MC_Eta_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1686 fHistograms->FillHistogram("MC_Eta_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1687 fHistograms->FillHistogram("MC_Eta_ZR_ConvGamma_withinAcceptance", particle->Vz(),particle->R());
1688 fHistograms->FillHistogram("MC_Eta_ConvGamma_OpeningAngle_Pt", particle->Pt(),GetMCOpeningAngle(daughter0,daughter1));
1689 fHistograms->FillHistogram("MC_Eta_ConvGamma_PtGamma_Pt", particle->Pt(),daughter0->Pt());
1690 fHistograms->FillHistogram("MC_Eta_ConvGamma_PtGamma_Pt", particle->Pt(),daughter1->Pt());
1693 if((daughter0->Energy()+daughter1->Energy()) > 0.){
1694 alfa= TMath::Abs((daughter0->Energy()-daughter1->Energy())/(daughter0->Energy()+daughter1->Energy()));
1696 fHistograms->FillHistogram("MC_Eta_alpha",alfa);
1701 // all motherparticles with 2 gammas as daughters
1702 fHistograms->FillHistogram("MC_Mother_R", particle->R());
1703 fHistograms->FillHistogram("MC_Mother_ZR", particle->Vz(),particle->R());
1704 fHistograms->FillHistogram("MC_Mother_XY", particle->Vx(),particle->Vy());
1705 fHistograms->FillHistogram("MC_Mother_Mass", particle->GetCalcMass());
1706 fHistograms->FillHistogram("MC_Mother_GammaDaughter_OpeningAngle", GetMCOpeningAngle(daughter0,daughter1));
1707 fHistograms->FillHistogram("MC_Mother_Energy", particle->Energy());
1708 fHistograms->FillHistogram("MC_Mother_Pt", particle->Pt());
1709 fHistograms->FillHistogram("MC_Mother_Eta", particle->Eta());
1710 fHistograms->FillHistogram("MC_Mother_Rapid", rapidity);
1711 fHistograms->FillHistogram("MC_Mother_Phi",tmpPhi);
1712 fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt",particle->GetMass(),particle->Pt());
1714 if(gammaEtaCut && gammaRCut){
1715 // if(TMath::Abs(daughter0->Eta()) <= fV0Reader->GetEtaCut() && TMath::Abs(daughter1->Eta()) <= fV0Reader->GetEtaCut() ){
1716 fHistograms->FillHistogram("MC_Mother_Pt_Eta_withinAcceptance", particle->Pt(),particle->Eta());
1717 fHistograms->FillHistogram("MC_Mother_Pt_Rapid_withinAcceptance", particle->Pt(),rapidity);
1718 fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt_withinAcceptance",particle->GetMass(),particle->Pt());
1719 if(daughter0Electron && daughter0Positron && daughter1Electron && daughter1Positron){
1720 fHistograms->FillHistogram("MC_Mother_Pt_Eta_ConvGamma_withinAcceptance", particle->Pt(),particle->Eta());
1721 fHistograms->FillHistogram("MC_Mother_Pt_Rapid_ConvGamma_withinAcceptance", particle->Pt(),rapidity);
1722 fHistograms->FillHistogram("MC_Mother_InvMass_vs_Pt_ConvGamma_withinAcceptance",particle->GetMass(),particle->Pt());
1724 } // end passed R and eta cut
1725 } // end if(particle->GetNDaughters() == 2)
1726 }// end for (Int_t iTracks = 0; iTracks < fStack->GetNtrack(); iTracks++)
1728 fHistograms->FillHistogram("ESD_TrueMult_vs_MeasMult", nCharged,fMultiplicity);
1729 fHistograms->FillHistogram("ESD_TrueMult_vs_MeasMult_pt150MeV", nCharged150MeV,fMultiplicity);
1730 //cout << "True " << nCharged << " Meas. " << fMultiplicity << endl;
1732 } // end ProcessMCData
1736 void AliAnalysisTaskGammaConversion::FillNtuple(){
1737 //Fills the ntuple with the different values
1739 if(fGammaNtuple == NULL){
1742 Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
1743 for(Int_t i=0;i<numberOfV0s;i++){
1744 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};
1745 AliESDv0 * cV0 = fV0Reader->GetV0(i);
1748 fV0Reader->GetPIDProbability(negPID,posPID);
1749 values[0]=cV0->GetOnFlyStatus();
1750 values[1]=fV0Reader->CheckForPrimaryVertex();
1753 values[4]=fV0Reader->GetX();
1754 values[5]=fV0Reader->GetY();
1755 values[6]=fV0Reader->GetZ();
1756 values[7]=fV0Reader->GetXYRadius();
1757 values[8]=fV0Reader->GetMotherCandidateNDF();
1758 values[9]=fV0Reader->GetMotherCandidateChi2();
1759 values[10]=fV0Reader->GetMotherCandidateEnergy();
1760 values[11]=fV0Reader->GetMotherCandidateEta();
1761 values[12]=fV0Reader->GetMotherCandidatePt();
1762 values[13]=fV0Reader->GetMotherCandidateMass();
1763 values[14]=fV0Reader->GetMotherCandidateWidth();
1764 // values[15]=fV0Reader->GetMotherMCParticle()->Pt(); MOVED TO THE END, HAS TO BE CALLED AFTER HasSameMother NB: still has the same entry in the array
1765 values[16]=fV0Reader->GetOpeningAngle();
1766 values[17]=fV0Reader->GetNegativeTrackEnergy();
1767 values[18]=fV0Reader->GetNegativeTrackPt();
1768 values[19]=fV0Reader->GetNegativeTrackEta();
1769 values[20]=fV0Reader->GetNegativeTrackPhi();
1770 values[21]=fV0Reader->GetPositiveTrackEnergy();
1771 values[22]=fV0Reader->GetPositiveTrackPt();
1772 values[23]=fV0Reader->GetPositiveTrackEta();
1773 values[24]=fV0Reader->GetPositiveTrackPhi();
1774 values[25]=fV0Reader->HasSameMCMother();
1775 if(values[25] != 0){
1776 values[26]=fV0Reader->GetMotherMCParticlePDGCode();
1777 values[15]=fV0Reader->GetMotherMCParticle()->Pt();
1779 fTotalNumberOfAddedNtupleEntries++;
1780 fGammaNtuple->Fill(values);
1782 fV0Reader->ResetV0IndexNumber();
1786 void AliAnalysisTaskGammaConversion::ProcessV0sNoCut(){
1787 // Process all the V0's without applying any cuts to it
1789 Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
1790 for(Int_t i=0;i<numberOfV0s;i++){
1791 /*AliESDv0 * cV0 = */fV0Reader->GetV0(i);
1793 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
1797 // if( !fV0Reader->GetV0(i)->GetOnFlyStatus()){
1798 if( !fV0Reader->CheckV0FinderStatus(fV0Reader->GetV0(i))){
1804 if( !((fV0Reader->GetNegativeESDTrack())->GetStatus() & AliESDtrack::kTPCrefit) ||
1805 !((fV0Reader->GetPositiveESDTrack())->GetStatus() & AliESDtrack::kTPCrefit) ){
1809 if( fV0Reader->GetNegativeESDTrack()->GetSign()== fV0Reader->GetPositiveESDTrack()->GetSign()){
1813 if( fV0Reader->GetNegativeESDTrack()->GetKinkIndex(0) > 0 ||
1814 fV0Reader->GetPositiveESDTrack()->GetKinkIndex(0) > 0) {
1817 if(TMath::Abs(fV0Reader->GetMotherCandidateEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetMotherCandidateEta())< fV0Reader->GetEtaCutMin()){
1820 if(TMath::Abs(fV0Reader->GetPositiveTrackEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetPositiveTrackEta())< fV0Reader->GetEtaCutMin()){
1823 if(TMath::Abs(fV0Reader->GetNegativeTrackEta())> fV0Reader->GetEtaCut() || TMath::Abs(fV0Reader->GetNegativeTrackEta())< fV0Reader->GetEtaCutMin()){
1826 if( fV0Reader->GetXYRadius() <= ((TMath::Abs(fV0Reader->GetZ())*fV0Reader->GetLineCutZRSlope())-fV0Reader->GetLineCutZValue()) ){ // cuts out regions where we do not reconstruct
1828 } else if ( fV0Reader->GetEtaCutMin() != -0.1 && fV0Reader->GetXYRadius() > ((TMath::Abs(fV0Reader->GetZ())*fV0Reader->GetLineCutZRSlopeMin())-fV0Reader->GetLineCutZValueMin()) ) {
1832 fHistograms->FillHistogram("ESD_NoCutAllV0_Pt", fV0Reader->GetMotherCandidatePt());
1834 // RRnewTOF start ///////////////////////////////////////////////
1835 UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus();
1836 UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus();
1838 Double_t t0pos = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetPositiveTrackP());
1839 Double_t t0neg = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetNegativeTrackP());
1841 Double_t timesPos[5];
1842 fV0Reader->GetPositiveESDTrack()->GetIntegratedTimes(timesPos);
1843 Double_t timesNeg[5];
1844 fV0Reader->GetNegativeESDTrack()->GetIntegratedTimes(timesNeg);
1846 Double_t TOFsignalPos = fV0Reader->GetPositiveTrackTOFsignal();
1847 Double_t TOFsignalNeg = fV0Reader->GetNegativeTrackTOFsignal();
1849 Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
1850 Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
1852 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_WOCutConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
1853 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_WOCutConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
1854 // RRnewTOF end /////////////////////////////////////////////////
1858 if(fV0Reader->HasSameMCMother() == kFALSE){
1862 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
1863 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
1865 if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
1868 if(negativeMC->GetPdgCode() == positiveMC->GetPdgCode()){
1872 if(negativeMC->GetUniqueID() != 5 || positiveMC->GetUniqueID() !=5){ // id 5 is conversion
1876 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
1877 fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
1878 if(negativeMC->GetMother(0) <= fStack->GetNprimary()){
1879 fHistograms->FillHistogram("ESD_NoCutConvPrimaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
1881 fHistograms->FillHistogram("ESD_NoCutConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
1882 fHistograms->FillHistogram("ESD_NoCutConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
1883 fHistograms->FillHistogram("ESD_NoCutConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
1884 fHistograms->FillHistogram("ESD_NoCutConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
1885 fHistograms->FillHistogram("ESD_NoCutConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
1886 fHistograms->FillHistogram("ESD_NoCutConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
1887 fHistograms->FillHistogram("ESD_NoCutConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
1888 fHistograms->FillHistogram("ESD_NoCutConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
1889 fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
1891 fHistograms->FillHistogram("ESD_NoCutConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
1892 fHistograms->FillHistogram("ESD_NoCutConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
1894 fHistograms->FillHistogram("ESD_NoCutConversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
1895 fHistograms->FillHistogram("ESD_NoCutConversion_R", fV0Reader->GetXYRadius());
1896 fHistograms->FillHistogram("ESD_NoCutConversion_MCR",fV0Reader->GetNegativeMCParticle()->R());
1897 fHistograms->FillHistogram("ESD_NoCutConversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
1898 fHistograms->FillHistogram("ESD_NoCutConversion_OpeningAngle", fV0Reader->GetOpeningAngle());
1899 fHistograms->FillHistogram("ESD_NoCutConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
1900 fHistograms->FillHistogram("ESD_NoCutConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
1901 fHistograms->FillHistogram("ESD_NoCutConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
1902 fHistograms->FillHistogram("ESD_NoCutConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
1904 fHistograms->FillHistogram("ESD_NoCutConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
1905 fHistograms->FillHistogram("ESD_NoCutConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
1906 fHistograms->FillHistogram("ESD_NoCutConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
1907 fHistograms->FillHistogram("ESD_NoCutConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
1909 //store MCTruth properties
1910 fHistograms->FillHistogram("ESD_NoCutConvGamma_MC_Pt_Eta", fV0Reader->GetMotherMCParticle()->Pt(),fV0Reader->GetMotherMCParticle()->Eta());
1911 fHistograms->FillHistogram("ESD_NoCutConversion_MC_ZR", negativeMC->Vz(),negativeMC->R());
1912 fHistograms->FillHistogram("ESD_NoCutConversion_MC_XY", negativeMC->Vx(),negativeMC->Vy());
1916 fV0Reader->ResetV0IndexNumber();
1919 void AliAnalysisTaskGammaConversion::ProcessV0s(){
1920 // see header file for documentation
1923 if(fWriteNtuple == kTRUE){
1927 Int_t nSurvivingV0s=0;
1928 fV0Reader->ResetNGoodV0s();
1929 while(fV0Reader->NextV0()){
1933 TVector3 vtxConv(fV0Reader->GetX(),fV0Reader->GetY(), fV0Reader->GetZ());
1935 //-------------------------- filling v0 information -------------------------------------
1936 fHistograms->FillHistogram("ESD_Conversion_R", fV0Reader->GetXYRadius());
1937 fHistograms->FillHistogram("ESD_Conversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
1938 fHistograms->FillHistogram("ESD_Conversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
1939 fHistograms->FillHistogram("ESD_Conversion_OpeningAngle", fV0Reader->GetOpeningAngle());
1940 fHistograms->FillHistogram("ESD_ConversionMapping_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
1941 fHistograms->FillHistogram("ESD_ConversionMapping_ZPhi", fV0Reader->GetZ(),vtxConv.Phi());
1942 fHistograms->FillHistogram("ESD_ConversionMapping_RPhi", fV0Reader->GetXYRadius(),vtxConv.Phi());
1944 if ( fV0Reader->GetMotherCandidatePt() >= 2.){
1945 fHistograms->FillHistogram("ESD_Conversion_minPt_R", fV0Reader->GetXYRadius());
1946 fHistograms->FillHistogram("ESD_Conversion_minPt_Z", fV0Reader->GetZ());
1949 // Specific histograms for beam pipe studies
1950 if( TMath::Abs(fV0Reader->GetZ()) < fV0Reader->GetLineCutZValue() && TMath::Abs(fV0Reader->GetZ()) > fV0Reader->GetLineCutZValueMin()){
1951 fHistograms->FillHistogram("ESD_Conversion_XY_BeamPipe", fV0Reader->GetX(),fV0Reader->GetY());
1952 fHistograms->FillHistogram("ESD_Conversion_RPhi_BeamPipe", vtxConv.Phi(),fV0Reader->GetXYRadius());
1956 fHistograms->FillHistogram("ESD_E_Energy", fV0Reader->GetNegativeTrackEnergy());
1957 fHistograms->FillHistogram("ESD_E_Pt", fV0Reader->GetNegativeTrackPt());
1958 fHistograms->FillHistogram("ESD_E_Eta", fV0Reader->GetNegativeTrackEta());
1959 fHistograms->FillHistogram("ESD_E_Phi", fV0Reader->GetNegativeTrackPhi());
1960 fHistograms->FillHistogram("ESD_E_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
1961 fHistograms->FillHistogram("ESD_E_nITSClusters", fV0Reader->GetNegativeTracknITSClusters());
1962 if ( fV0Reader->GetNegativeTrackPt()> 0.150){
1963 fHistograms->FillHistogram("ESD_E_minPt_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
1965 if ( fV0Reader->GetNegativeTracknITSClusters()==0){
1966 fHistograms->FillHistogram("ESD_E_onlyTPC_nTPCClusters", fV0Reader->GetNegativeTracknTPCClusters());
1969 Double_t eClsToF= 0;
1970 if(!fV0Reader->GetUseCorrectedTPCClsInfo()){
1971 if(fV0Reader->GetNegativeTracknTPCFClusters()!=0 ){
1972 eClsToF=(Double_t)fV0Reader->GetNegativeTracknTPCClusters()/(Double_t)fV0Reader->GetNegativeTracknTPCFClusters();
1975 eClsToF= fV0Reader->GetNegativeESDTrack()->GetTPCClusterInfo(2,0,fV0Reader->GetFirstTPCRow(fV0Reader->GetXYRadius()));
1977 fHistograms->FillHistogram("ESD_E_nTPCClustersToFP", fV0Reader->GetNegativeTrackP(),eClsToF );
1978 fHistograms->FillHistogram("ESD_E_nTPCClustersToFR", fV0Reader->GetXYRadius(),eClsToF );
1980 if(fV0Reader->GetNegativeTracknTPCClusters()!=0 ){
1981 fHistograms->FillHistogram("ESD_E_TPCchi2", fV0Reader->GetNegativeTrackTPCchi2()/(Double_t)fV0Reader->GetNegativeTracknTPCClusters());
1986 fHistograms->FillHistogram("ESD_P_Energy", fV0Reader->GetPositiveTrackEnergy());
1987 fHistograms->FillHistogram("ESD_P_Pt", fV0Reader->GetPositiveTrackPt());
1988 fHistograms->FillHistogram("ESD_P_Eta", fV0Reader->GetPositiveTrackEta());
1989 fHistograms->FillHistogram("ESD_P_Phi", fV0Reader->GetPositiveTrackPhi());
1990 fHistograms->FillHistogram("ESD_P_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
1991 fHistograms->FillHistogram("ESD_P_nITSClusters", fV0Reader->GetPositiveTracknITSClusters());
1992 if ( fV0Reader->GetPositiveTrackPt()> 0.150){
1993 fHistograms->FillHistogram("ESD_P_minPt_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
1995 if (fV0Reader->GetPositiveTracknITSClusters()==0){
1996 fHistograms->FillHistogram("ESD_P_onlyTPC_nTPCClusters", fV0Reader->GetPositiveTracknTPCClusters());
1999 Double_t pClsToF= 0;
2000 if(!fV0Reader->GetUseCorrectedTPCClsInfo()){
2001 if(fV0Reader->GetPositiveTracknTPCFClusters()!=0){
2002 pClsToF = (Double_t)fV0Reader->GetPositiveTracknTPCClusters()/(Double_t)fV0Reader->GetPositiveTracknTPCFClusters();
2005 pClsToF= fV0Reader->GetPositiveESDTrack()->GetTPCClusterInfo(2,0,fV0Reader->GetFirstTPCRow(fV0Reader->GetXYRadius()));
2008 fHistograms->FillHistogram("ESD_P_nTPCClustersToFP",fV0Reader->GetPositiveTrackP(), pClsToF);
2009 fHistograms->FillHistogram("ESD_P_nTPCClustersToFR",fV0Reader->GetXYRadius(), pClsToF);
2011 if(fV0Reader->GetPositiveTracknTPCClusters()!=0){
2012 fHistograms->FillHistogram("ESD_P_TPCchi2", fV0Reader->GetPositiveTrackTPCchi2()/(Double_t)fV0Reader->GetPositiveTracknTPCClusters());
2017 fHistograms->FillHistogram("ESD_ConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
2018 fHistograms->FillHistogram("ESD_ConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
2019 fHistograms->FillHistogram("ESD_ConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
2020 fHistograms->FillHistogram("ESD_ConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
2021 fHistograms->FillHistogram("ESD_ConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
2022 fHistograms->FillHistogram("ESD_ConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
2023 fHistograms->FillHistogram("ESD_ConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
2024 fHistograms->FillHistogram("ESD_ConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
2025 fHistograms->FillHistogram("ESD_ConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
2026 fHistograms->FillHistogram("ESD_ConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
2028 fHistograms->FillHistogram("ESD_ConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
2029 fHistograms->FillHistogram("ESD_ConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
2031 fHistograms->FillHistogram("ESD_ConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
2032 fHistograms->FillHistogram("ESD_ConvGamma_CosPoint_RecCosPoint",fV0Reader->GetCosPointingAngle(),fV0Reader->GetV0CosineOfPointingAngle(fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ()));
2033 fHistograms->FillHistogram("ESD_ConvGamma_PsiPair", fV0Reader->GetPsiPair(fV0Reader->GetCurrentV0()));
2035 fHistograms->FillHistogram("ESD_ConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
2036 fHistograms->FillHistogram("ESD_ConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
2037 fHistograms->FillHistogram("ESD_ConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
2039 fHistograms->FillHistogram("ESD_ConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
2040 fHistograms->FillHistogram("ESD_ConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
2041 fHistograms->FillHistogram("ESD_ConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
2042 fHistograms->FillHistogram("ESD_ConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
2043 fHistograms->FillHistogram("ESD_ConvGamma_E_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kElectron));
2044 fHistograms->FillHistogram("ESD_ConvGamma_P_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kElectron));
2045 fHistograms->FillHistogram("ESD_ConvGamma_PiPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kPion));
2046 fHistograms->FillHistogram("ESD_ConvGamma_PiMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kPion));
2047 fHistograms->FillHistogram("ESD_ConvGamma_KPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kKaon));
2048 fHistograms->FillHistogram("ESD_ConvGamma_KMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kKaon));
2049 fHistograms->FillHistogram("ESD_ConvGamma_PPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kProton));
2050 fHistograms->FillHistogram("ESD_ConvGamma_PMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kProton));
2051 fHistograms->FillHistogram("ESD_ConvGamma_MuPl_SigdEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetNegativeESDTrack(),AliPID::kMuon));
2052 fHistograms->FillHistogram("ESD_ConvGamma_MuMi_SigdEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetESDpid()->NumberOfSigmasTPC(fV0Reader->GetPositiveESDTrack(),AliPID::kMuon));
2055 UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus(); //moved up here from below RRnewTOF
2056 UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus();
2057 // RRnewTOF start ///////////////////////////////////////////////
2058 Double_t t0pos = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetPositiveTrackP());
2059 Double_t t0neg = fV0Reader->GetESDpid()->GetTOFResponse().GetStartTime(fV0Reader->GetNegativeTrackP());
2061 Double_t timesPos[5];
2062 fV0Reader->GetPositiveESDTrack()->GetIntegratedTimes(timesPos);
2063 Double_t timesNeg[5];
2064 fV0Reader->GetNegativeESDTrack()->GetIntegratedTimes(timesNeg);
2066 Double_t TOFsignalPos = fV0Reader->GetPositiveTrackTOFsignal();
2067 Double_t TOFsignalNeg = fV0Reader->GetNegativeTrackTOFsignal();
2069 Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
2070 Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
2072 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_ConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
2073 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) fHistograms->FillHistogram("ESD_ConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
2074 // RRnewTOF end /////////////////////////////////////////////////
2078 fV0Reader->GetPIDProbability(negPID,posPID);
2079 fHistograms->FillHistogram("ESD_ConvGamma_E_EProbP",fV0Reader->GetNegativeTrackP(),negPID);
2080 fHistograms->FillHistogram("ESD_ConvGamma_P_EProbP",fV0Reader->GetPositiveTrackP(),posPID);
2082 Double_t negPIDmupi=0;
2083 Double_t posPIDmupi=0;
2084 fV0Reader->GetPIDProbabilityMuonPion(negPIDmupi,posPIDmupi);
2085 fHistograms->FillHistogram("ESD_ConvGamma_E_mupiProbP",fV0Reader->GetNegativeTrackP(),negPIDmupi);
2086 fHistograms->FillHistogram("ESD_ConvGamma_P_mupiProbP",fV0Reader->GetPositiveTrackP(),posPIDmupi);
2088 Double_t armenterosQtAlpha[2] = {0,0};
2089 if(fV0Reader->GetUseESDQtCut() == 0){
2090 fV0Reader->GetArmenterosQtAlpha(fV0Reader->GetNegativeKFParticle(),
2091 fV0Reader->GetPositiveKFParticle(),
2092 fV0Reader->GetMotherCandidateKFCombination(),
2095 else if(fV0Reader->GetUseESDQtCut() == 1){
2096 fV0Reader->GetArmenterosQtAlpha(fV0Reader->GetCurrentV0(), armenterosQtAlpha);
2098 else if(fV0Reader->GetUseESDQtCut() == 2 || fV0Reader->GetUseESDQtCut() == 3){
2099 fV0Reader->GetArmenterosQtAlpha(fV0Reader->GetNegativeKFParticle(),
2100 fV0Reader->GetPositiveKFParticle(),
2102 fV0Reader->GetUseESDQtCut());
2105 fHistograms->FillHistogram("ESD_ConvGamma_alfa_qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
2106 fHistograms->FillHistogram("ESD_ConvGamma_Pt_Qt",fV0Reader->GetMotherCandidatePt(),armenterosQtAlpha[0]);
2108 if(!fV0Reader->GetIsHeavyIon()){
2109 fHistograms->FillHistogram("3DPlots_Conversion_XYZ", fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ());
2110 //fHistograms->FillHistogram("3DPlots_Conversion_ZRPhi", fV0Reader->GetZ(),fV0Reader->GetXYRadius(), vtxConv.Phi());
2113 Int_t rBin = fHistograms->GetRBin(fV0Reader->GetXYRadius());
2114 Int_t zBin = fHistograms->GetZBin(fV0Reader->GetZ());
2115 Int_t phiBin = fHistograms->GetPhiBin(fV0Reader->GetNegativeTrackPhi());
2117 Double_t rITSTPCMin=40;
2118 Double_t rITSTPCInt=55;
2119 Double_t rITSTPCMax=72.5;
2121 // Double_t motherCandidateEta= fV0Reader->GetMotherCandidateEta();
2123 TString nameESDMappingPhiR="";
2124 nameESDMappingPhiR.Form("ESD_Conversion_Mapping_Phi%02d_R%02d",phiBin,rBin);
2125 //fHistograms->FillHistogram(nameESDMappingPhiR, fV0Reader->GetZ(), motherCandidateEta);
2127 TString nameESDMappingPhi="";
2128 nameESDMappingPhi.Form("ESD_Conversion_Mapping_Phi%02d",phiBin);
2129 //fHistograms->FillHistogram(nameESDMappingPhi, fV0Reader->GetZ(), motherCandidateEta);
2131 TString nameESDMappingR="";
2132 nameESDMappingR.Form("ESD_Conversion_Mapping_R%02d",rBin);
2133 //fHistograms->FillHistogram(nameESDMappingR, fV0Reader->GetZ(), motherCandidateEta);
2135 TString nameESDMappingPhiInR="";
2136 nameESDMappingPhiInR.Form("ESD_Conversion_Mapping_Phi_in_R_%02d",rBin);
2137 // fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetMotherCandidatePhi());
2138 fHistograms->FillHistogram(nameESDMappingPhiInR, vtxConv.Phi());
2140 TString nameESDMappingZInR="";
2141 nameESDMappingZInR.Form("ESD_Conversion_Mapping_Z_in_R_%02d",rBin);
2142 fHistograms->FillHistogram(nameESDMappingZInR, fV0Reader->GetZ());
2144 TString nameESDMappingPhiInZ="";
2145 nameESDMappingPhiInZ.Form("ESD_Conversion_Mapping_Phi_in_Z_%02d",zBin);
2146 // fHistograms->FillHistogram(nameESDMappingPhiInR, fV0Reader->GetMotherCandidatePhi());
2147 fHistograms->FillHistogram(nameESDMappingPhiInZ, vtxConv.Phi());
2149 if(fV0Reader->GetXYRadius()<rFMD){
2150 TString nameESDMappingFMDPhiInZ="";
2151 nameESDMappingFMDPhiInZ.Form("ESD_Conversion_Mapping_FMD_Phi_in_Z_%02d",zBin);
2152 fHistograms->FillHistogram(nameESDMappingFMDPhiInZ, vtxConv.Phi());
2153 fHistograms->FillHistogram("ESD_ConversionMapping_FMD_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2155 if(fV0Reader->GetXYRadius()>rFMD && fV0Reader->GetXYRadius()<rITSTPCMin){
2156 fHistograms->FillHistogram("ESD_ConversionMapping_FMD2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2159 if(fV0Reader->GetXYRadius()>rITSTPCMin && fV0Reader->GetXYRadius()<rITSTPCInt){
2160 TString nameESDMappingITSTPCPhiInZ="";
2161 nameESDMappingITSTPCPhiInZ.Form("ESD_Conversion_Mapping_ITSTPC_Phi_in_Z_%02d",zBin);
2162 fHistograms->FillHistogram(nameESDMappingITSTPCPhiInZ, vtxConv.Phi());
2163 fHistograms->FillHistogram("ESD_ConversionMapping_ITSTPC_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2166 if(fV0Reader->GetXYRadius()>rITSTPCInt && fV0Reader->GetXYRadius()<rITSTPCMax){
2167 TString nameESDMappingITSTPC2PhiInZ="";
2168 nameESDMappingITSTPC2PhiInZ.Form("ESD_Conversion_Mapping_ITSTPC2_Phi_in_Z_%02d",zBin);
2169 fHistograms->FillHistogram(nameESDMappingITSTPC2PhiInZ, vtxConv.Phi());
2170 fHistograms->FillHistogram("ESD_ConversionMapping_ITSTPC2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2173 TString nameESDMappingRInZ="";
2174 nameESDMappingRInZ.Form("ESD_Conversion_Mapping_R_in_Z_%02d",zBin);
2175 fHistograms->FillHistogram(nameESDMappingRInZ, fV0Reader->GetXYRadius());
2177 if(fV0Reader->GetMotherCandidatePt() > fLowPtMapping && fV0Reader->GetMotherCandidatePt()< fHighPtMapping){
2178 TString nameESDMappingMidPtPhiInR="";
2179 nameESDMappingMidPtPhiInR.Form("ESD_Conversion_Mapping_MidPt_Phi_in_R_%02d",rBin);
2180 fHistograms->FillHistogram(nameESDMappingMidPtPhiInR, vtxConv.Phi());
2182 TString nameESDMappingMidPtZInR="";
2183 nameESDMappingMidPtZInR.Form("ESD_Conversion_Mapping_MidPt_Z_in_R_%02d",rBin);
2184 fHistograms->FillHistogram(nameESDMappingMidPtZInR, fV0Reader->GetZ());
2186 TString nameESDMappingMidPtPhiInZ="";
2187 nameESDMappingMidPtPhiInZ.Form("ESD_Conversion_Mapping_MidPt_Phi_in_Z_%02d",zBin);
2188 fHistograms->FillHistogram(nameESDMappingMidPtPhiInZ, vtxConv.Phi());
2189 if(fV0Reader->GetXYRadius()<rFMD){
2190 TString nameESDMappingMidPtFMDPhiInZ="";
2191 nameESDMappingMidPtFMDPhiInZ.Form("ESD_Conversion_Mapping_MidPt_FMD_Phi_in_Z_%02d",zBin);
2192 fHistograms->FillHistogram(nameESDMappingMidPtFMDPhiInZ, vtxConv.Phi());
2194 TString nameESDMappingMidPtRInZ="";
2195 nameESDMappingMidPtRInZ.Form("ESD_Conversion_Mapping_MidPt_R_in_Z_%02d",zBin);
2196 fHistograms->FillHistogram(nameESDMappingMidPtRInZ, fV0Reader->GetXYRadius());
2203 new((*fKFReconstructedGammasTClone)[fKFReconstructedGammasTClone->GetEntriesFast()]) AliKFConversionPhoton(fV0Reader);
2206 //----------------------------------- checking for "real" conversions (MC match) --------------------------------------
2208 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2209 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2211 Double_t rITSTPCMin=40;
2212 Double_t rITSTPCInt=55;
2213 Double_t rITSTPCMax=72.5;
2215 if(fV0Reader->HasSameMCMother() == kFALSE){
2216 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_R", fV0Reader->GetXYRadius());
2217 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_Z", fV0Reader->GetZ());
2218 fHistograms->FillHistogram("ESD_TrueConvCombSelected_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
2219 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2220 fHistograms->FillHistogram("ESD_TrueConvCombinatorialMinPt_R", fV0Reader->GetXYRadius());
2221 fHistograms->FillHistogram("ESD_TrueConvCombinatorialMinPt_Z", fV0Reader->GetZ());
2223 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_Pt", fV0Reader->GetMotherCandidatePt());
2224 fHistograms->FillHistogram("ESD_TrueConvCombinatorialDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2225 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
2226 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElec_R", fV0Reader->GetXYRadius());
2227 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElec_Pt", fV0Reader->GetMotherCandidatePt());
2229 if(TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==211){
2230 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPi_R", fV0Reader->GetXYRadius());
2231 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPi_Pt", fV0Reader->GetMotherCandidatePt());
2232 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2234 if((TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==2211) ||
2235 (TMath::Abs(negativeMC->GetPdgCode())==2212 && TMath::Abs(positiveMC->GetPdgCode())==211)){
2236 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiP_R", fV0Reader->GetXYRadius());
2237 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiP_Pt", fV0Reader->GetMotherCandidatePt());
2238 fHistograms->FillHistogram("ESD_TrueConvCombinatorialPiPDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2240 if((TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==211) ||
2241 (TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==11)){
2242 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElecPi_R", fV0Reader->GetXYRadius());
2243 fHistograms->FillHistogram("ESD_TrueConvCombinatorialElecPi_Pt", fV0Reader->GetMotherCandidatePt());
2245 if( (statusPos & AliESDtrack::kTOFpid) && ( TMath::Abs(positiveMC->GetPdgCode()) != 11 ) && !(statusPos & AliESDtrack::kTOFmismatch) )
2246 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_DaughtersNotElec_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);//RRnewTOF
2247 if( (statusNeg & AliESDtrack::kTOFpid) && ( TMath::Abs(negativeMC->GetPdgCode()) != 11 ) && !(statusNeg & AliESDtrack::kTOFmismatch) )
2248 fHistograms->FillHistogram("ESD_TrueConvCombinatorial_DaughtersNotElec_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);//RRnewTOF
2252 // Moved up to check true electron background
2253 // TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2254 // TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2256 if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
2257 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_R", fV0Reader->GetXYRadius());
2258 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Z", fV0Reader->GetZ());
2259 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2260 fHistograms->FillHistogram("ESD_TrueConvHadronicBckMinPt_R", fV0Reader->GetXYRadius());
2261 fHistograms->FillHistogram("ESD_TrueConvHadronicBckMinPt_Z", fV0Reader->GetZ());
2263 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Pt", fV0Reader->GetMotherCandidatePt());
2264 fHistograms->FillHistogram("ESD_TrueConvHadronicBckDaughter_Pt", negativeMC->Pt(),positiveMC->Pt());
2265 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) )
2266 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Daughters_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);//RRnewTOF
2267 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) )
2268 fHistograms->FillHistogram("ESD_TrueConvHadronicBck_Daughters_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);//RRnewTOF
2269 if((TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==2211) ||
2270 (TMath::Abs(negativeMC->GetPdgCode())==2212 && TMath::Abs(positiveMC->GetPdgCode())==211)){
2271 fHistograms->FillHistogram("ESD_TrueConvLambda_R", fV0Reader->GetXYRadius());
2272 fHistograms->FillHistogram("ESD_TrueConvLambda_Pt", fV0Reader->GetMotherCandidatePt());
2274 if(TMath::Abs(negativeMC->GetPdgCode())==211 && TMath::Abs(positiveMC->GetPdgCode())==211){
2275 fHistograms->FillHistogram("ESD_TrueConvMeson_R", fV0Reader->GetXYRadius());
2276 fHistograms->FillHistogram("ESD_TrueConvMeson_Pt", fV0Reader->GetMotherCandidatePt());
2282 if(negativeMC->GetPdgCode()==positiveMC->GetPdgCode()){
2286 //UInt_t statusPos = fV0Reader->GetPositiveESDTrack()->GetStatus(); moved higher
2287 //UInt_t statusNeg = fV0Reader->GetNegativeESDTrack()->GetStatus();
2288 UChar_t itsPixelPos = fV0Reader->GetPositiveESDTrack()->GetITSClusterMap();
2289 UChar_t itsPixelNeg = fV0Reader->GetNegativeESDTrack()->GetITSClusterMap();
2291 // Using the UniqueID Phojet does not get the Dalitz right
2292 // if( (negativeMC->GetUniqueID() == 4 && positiveMC->GetUniqueID() ==4) ||
2293 // (negativeMC->GetUniqueID() == 0 && positiveMC->GetUniqueID() ==0) ){// fill r distribution for Dalitz decays
2294 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 111){ //pi0
2295 fHistograms->FillHistogram("ESD_TrueDalitzContamination_R", fV0Reader->GetXYRadius());
2296 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_R", fV0Reader->GetXYRadius());
2297 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_Z", fV0Reader->GetZ());
2298 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2299 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0MinPt_R", fV0Reader->GetXYRadius());
2300 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0MinPt_Z", fV0Reader->GetZ());
2303 //--------Histos for HFE
2305 if(statusPos & AliESDtrack::kTOFpid){
2306 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SinglePos_R", fV0Reader->GetXYRadius());
2307 if( TESTBIT(itsPixelPos, 0) ){
2308 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SinglePos_kFirst_R", fV0Reader->GetXYRadius());
2311 if(statusNeg & AliESDtrack::kTOFpid){
2312 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SingleNeg_R", fV0Reader->GetXYRadius());
2313 if( TESTBIT(itsPixelNeg, 0) ){
2314 fHistograms->FillHistogram("ESD_TrueConvDalitzPi0_SingleNeg_kFirst_R", fV0Reader->GetXYRadius());
2317 //--------------------------------------------------------
2320 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 221){ //eta
2321 fHistograms->FillHistogram("ESD_TrueConvDalitzEta_R", fV0Reader->GetXYRadius());
2322 fHistograms->FillHistogram("ESD_TrueConvDalitzEta_Z", fV0Reader->GetZ());
2323 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2324 fHistograms->FillHistogram("ESD_TrueConvDalitzEtaMinPt_R", fV0Reader->GetXYRadius());
2325 fHistograms->FillHistogram("ESD_TrueConvDalitzEtaMinPt_Z", fV0Reader->GetZ());
2331 if(negativeMC->GetUniqueID() != 5 || positiveMC->GetUniqueID() !=5){// check if the daughters come from a conversion
2335 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
2337 Double_t containerInput[3];
2338 containerInput[0] = fV0Reader->GetMotherCandidatePt();
2339 containerInput[1] = fV0Reader->GetMotherCandidateEta();
2340 containerInput[2] = fV0Reader->GetMotherCandidateMass();
2341 fCFManager->GetParticleContainer()->Fill(containerInput,kStepTrueGamma); // for CF
2344 // RRnewTOF start ///////////////////////////////////////////////
2345 if( (statusPos & AliESDtrack::kTOFpid) && !(statusPos & AliESDtrack::kTOFmismatch) ) {
2346 fHistograms->FillHistogram("ESD_TrueConvGamma_EandP_P_dT", fV0Reader->GetPositiveTrackP(), dTpos);
2348 if( (statusNeg & AliESDtrack::kTOFpid) && !(statusNeg & AliESDtrack::kTOFmismatch) ) {
2349 fHistograms->FillHistogram("ESD_TrueConvGamma_EandP_P_dT", fV0Reader->GetNegativeTrackP(), dTneg);
2351 // RRnewTOF end /////////////////////////////////////////////////
2352 if (fV0Reader->HasSameMCMother() == kTRUE){
2353 fHistograms->FillHistogram("ESD_TrueConvGammaSelected_Alpha_Qt",armenterosQtAlpha[1],armenterosQtAlpha[0]);
2354 fHistograms->FillHistogram("ESD_TrueConvGammaSelected_Pt_Qt",fV0Reader->GetMotherCandidatePt(),armenterosQtAlpha[0]);
2356 // RRnewTOF end /////////////////////////////////////////////////
2358 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt", fV0Reader->GetMotherCandidatePt());
2359 fHistograms->FillHistogram("ESD_TrueConvGamma_CosPoint_RecCosPoint",fV0Reader->GetCosPointingAngle(),fV0Reader->GetV0CosineOfPointingAngle(fV0Reader->GetX(),fV0Reader->GetY(),fV0Reader->GetZ()));
2360 fHistograms->FillHistogram("ESD_TrueConvGamma_PsiPair", fV0Reader->GetPsiPair(fV0Reader->GetCurrentV0()));
2361 if(negativeMC->GetMother(0) <= fStack->GetNprimary()){ // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
2362 fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
2363 fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_R", fV0Reader->GetXYRadius());
2364 fHistograms->FillHistogram("ESD_TrueConvPrimaryGamma_Z", fV0Reader->GetZ());
2365 if( fV0Reader->GetMotherCandidatePt() > 2. ) {
2366 fHistograms->FillHistogram("ESD_TrueConvPrimaryGammaMinPt_R", fV0Reader->GetXYRadius());
2367 fHistograms->FillHistogram("ESD_TrueConvPrimaryGammaMinPt_Z", fV0Reader->GetZ());
2371 fHistograms->FillHistogram("ESD_TrueConvSecondaryGamma_Pt", fV0Reader->GetMotherCandidatePt());
2372 if(fV0Reader->GetMotherMCParticle()->GetMother(0) > -1){
2373 if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetPdgCode() == 310){
2374 fHistograms->FillHistogram("ESD_TrueConvSecondaryGammaFromK0s_Pt", fV0Reader->GetMotherCandidatePt());
2376 if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetMother(0) > -1 &&
2377 fStack->Particle(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
2378 fHistograms->FillHistogram("ESD_TrueConvSecondaryGammaFromXFromK0s_Pt", fV0Reader->GetMotherCandidatePt());
2382 if(fV0Reader->GetMotherMCParticle()->GetMother(0) > -1){
2383 if(fStack->Particle(fV0Reader->GetMotherMCParticle()->GetMother(0))->GetPdgCode() == 221){ // Use just gamma from eta for ratio esdtruegamma / mcconvgamma
2384 fHistograms->FillHistogram("ESD_TrueConvEtaGamma_Pt", fV0Reader->GetMotherCandidatePt());
2387 fHistograms->FillHistogram("ESD_TrueConvGamma_Energy", fV0Reader->GetMotherCandidateEnergy());
2388 fHistograms->FillHistogram("ESD_TrueConvGamma_Eta", fV0Reader->GetMotherCandidateEta());
2389 fHistograms->FillHistogram("ESD_TrueConvGamma_Phi", fV0Reader->GetMotherCandidatePhi());
2390 fHistograms->FillHistogram("ESD_TrueConvGamma_Mass", fV0Reader->GetMotherCandidateMass());
2391 fHistograms->FillHistogram("ESD_TrueConvGamma_Width", fV0Reader->GetMotherCandidateWidth());
2392 fHistograms->FillHistogram("ESD_TrueConvGamma_Chi2", fV0Reader->GetMotherCandidateChi2());
2393 fHistograms->FillHistogram("ESD_TrueConvGamma_NDF", fV0Reader->GetMotherCandidateNDF());
2394 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Eta", fV0Reader->GetMotherCandidatePt(),fV0Reader->GetMotherCandidateEta());
2395 fHistograms->FillHistogram("ESD_TrueConvGamma_Rapid", fV0Reader->GetMotherCandidateRapidity());
2396 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLength",fV0Reader->GetNegativeNTPCClusters());
2397 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLength",fV0Reader->GetPositiveNTPCClusters());
2398 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLengthVSInvMass",fV0Reader->GetNegativeNTPCClusters(),fV0Reader->GetMotherCandidateMass());
2399 fHistograms->FillHistogram("ESD_TrueConvGamma_TrackLengthVSInvMass",fV0Reader->GetPositiveNTPCClusters(),fV0Reader->GetMotherCandidateMass());
2401 fHistograms->FillHistogram("ESD_TrueConvGamma_Pt_Chi2", fV0Reader->GetMotherCandidatePt(), fV0Reader->GetMotherCandidateChi2());
2402 fHistograms->FillHistogram("ESD_TrueConvGamma_Eta_Chi2", fV0Reader->GetMotherCandidateEta(), fV0Reader->GetMotherCandidateChi2());
2403 if ( fV0Reader->GetMotherCandidatePt() > 2. ) {
2404 fHistograms->FillHistogram("ESD_TrueConversionMinPt_R", fV0Reader->GetXYRadius());
2405 fHistograms->FillHistogram("ESD_TrueConversionMinPt_Z", fV0Reader->GetZ());
2408 fHistograms->FillHistogram("ESD_TrueConversion_E_nTPCClustersToFR", fV0Reader->GetXYRadius(),eClsToF );
2409 fHistograms->FillHistogram("ESD_TrueConversion_P_nTPCClustersToFR",fV0Reader->GetXYRadius(), pClsToF);
2411 fHistograms->FillHistogram("ESD_TrueConversion_XY", fV0Reader->GetX(),fV0Reader->GetY());
2412 fHistograms->FillHistogram("ESD_TrueConversion_R", fV0Reader->GetXYRadius());
2413 fHistograms->FillHistogram("ESD_TrueConversion_Z", fV0Reader->GetZ());
2414 fHistograms->FillHistogram("ESD_TrueConversion_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
2415 fHistograms->FillHistogram("ESD_TrueConversionMapping_ZR", fV0Reader->GetZ(),fV0Reader->GetXYRadius());
2416 fHistograms->FillHistogram("ESD_TrueConversionMapping_ZPhi", fV0Reader->GetZ(),vtxConv.Phi());
2417 fHistograms->FillHistogram("ESD_TrueConversionMapping_RPhi", fV0Reader->GetXYRadius(),vtxConv.Phi());
2418 if(fV0Reader->GetXYRadius()<rFMD){
2419 fHistograms->FillHistogram("ESD_TrueConversionMapping_FMD_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2421 if(fV0Reader->GetXYRadius()>rFMD && fV0Reader->GetXYRadius()<rITSTPCMin){
2422 fHistograms->FillHistogram("ESD_TrueConversionMapping_FMD2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2424 if(fV0Reader->GetXYRadius()>rITSTPCMin && fV0Reader->GetXYRadius()<rITSTPCInt){
2425 fHistograms->FillHistogram("ESD_TrueConversionMapping_ITSTPC_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2427 if(fV0Reader->GetXYRadius()>rITSTPCInt && fV0Reader->GetXYRadius()<rITSTPCMax){
2428 fHistograms->FillHistogram("ESD_TrueConversionMapping_ITSTPC2_ZPhi",fV0Reader->GetZ() ,vtxConv.Phi());
2431 fHistograms->FillHistogram("ESD_TrueConversion_OpeningAngle", fV0Reader->GetOpeningAngle());
2433 //----Histos for HFE--------------------------------------
2435 if(statusPos & AliESDtrack::kTOFpid){
2436 fHistograms->FillHistogram("ESD_TrueConversion_SinglePos_R", positiveMC->R(),fV0Reader->GetPositiveMCParticle()->Pt());
2437 if( TESTBIT(itsPixelPos, 0) ){
2438 fHistograms->FillHistogram("ESD_TrueConversion_SinglePos_kFirst_R", positiveMC->R(),fV0Reader->GetPositiveMCParticle()->Pt());
2441 if(statusNeg & AliESDtrack::kTOFpid){
2442 fHistograms->FillHistogram("ESD_TrueConversion_SingleNeg_R", negativeMC->R(),fV0Reader->GetNegativeMCParticle()->Pt());
2443 if( TESTBIT(itsPixelNeg, 0) ){
2444 fHistograms->FillHistogram("ESD_TrueConversion_SingleNeg_kFirst_R", negativeMC->R(),fV0Reader->GetNegativeMCParticle()->Pt());
2447 //--------------------------------------------------------
2449 fHistograms->FillHistogram("ESD_TrueConvGamma_CosPointingAngle", fV0Reader->GetCosPointingAngle());
2450 fHistograms->FillHistogram("ESD_TrueConvGamma_DcaDaughters", fV0Reader->GetDcaDaughters());
2451 fHistograms->FillHistogram("ESD_TrueConvGamma_NormDcaDistDaughters", fV0Reader->GetNormDcaDistDaughters());
2452 fHistograms->FillHistogram("ESD_TrueConvGamma_LikelihoodAP", fV0Reader->GetLikelihoodAP());
2453 if (fV0Reader->GetMotherCandidateP() != 0) {
2454 fHistograms->FillHistogram("ESD_TrueConvGamma_E_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetNegativeTrackP()/fV0Reader->GetMotherCandidateP());
2455 fHistograms->FillHistogram("ESD_TrueConvGamma_P_AsymmetryP",fV0Reader->GetMotherCandidateP(),fV0Reader->GetPositiveTrackP()/fV0Reader->GetMotherCandidateP());
2457 cout << "Error::fV0Reader->GetNegativeTrackP() == 0 !!!" << endl;
2460 fHistograms->FillHistogram("ESD_TrueConvGamma_E_dEdxP",fV0Reader->GetNegativeTrackP(),fV0Reader->GetNegativeTrackTPCdEdx());
2461 fHistograms->FillHistogram("ESD_TrueConvGamma_P_dEdxP",fV0Reader->GetPositiveTrackP(),fV0Reader->GetPositiveTrackTPCdEdx());
2463 //store MCTruth properties
2464 fHistograms->FillHistogram("ESD_TrueConvGamma_MC_Pt_Eta", fV0Reader->GetMotherMCParticle()->Pt(),fV0Reader->GetMotherMCParticle()->Eta());
2465 fHistograms->FillHistogram("ESD_TrueConversion_MC_ZR", negativeMC->Vz(),negativeMC->R());
2466 fHistograms->FillHistogram("ESD_TrueConversion_MC_XY", negativeMC->Vx(),negativeMC->Vy());
2469 //___________________________________________Resolution______________________________________________________
2470 // Different Ways of Producing a Gamma
2471 // Standard V0 Information
2472 Double_t mcPt = fV0Reader->GetMotherMCParticle()->Pt();
2473 Double_t mcR = fV0Reader->GetNegativeMCParticle()->R();
2474 Double_t mcZ = fV0Reader->GetNegativeMCParticle()->Vz();
2475 Double_t resPt = 0.;
2479 AliKFParticle AliKFPosParticle(*(fV0Reader->GetExternalTrackParamP(fV0Reader->GetCurrentV0())),-11);
2480 AliKFParticle AliKFNegParticle(*(fV0Reader->GetExternalTrackParamN(fV0Reader->GetCurrentV0())),11);
2482 // Resolution Normal V0 unchanged from the On-fly/Offline
2483 Double_t xyz[3] = {0,0,0};
2484 fV0Reader->GetCurrentV0()->GetXYZ(xyz[0],xyz[1],xyz[2]);
2485 resPt = mcPt-fV0Reader->GetCurrentV0()->Pt();
2486 resR = mcR-TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]);
2488 fHistograms->FillHistogram("Resolution_Gamma_AbsdPt_Pt", mcPt, resPt);
2489 fHistograms->FillHistogram("Resolution_Gamma_AbsdR_R", mcR,resR);
2490 fHistograms->FillHistogram("Resolution_Gamma_AbsdZ_Z", mcZ,resZ);
2492 // Resolution Recalculated V0
2493 resR = mcR-fV0Reader->GetXYRadius();
2494 resZ = mcZ-fV0Reader->GetZ();
2495 // No pt, because we not recalculate v0 pt
2496 fHistograms->FillHistogram("Resolution_GammaRecalcPos_AbsdR_R", mcR,resR);
2497 fHistograms->FillHistogram("Resolution_GammaRecalcPos_AbsdZ_Z", mcZ,resZ);
2499 // Resolution ConstructGamma
2500 AliKFParticle constructGammaKF;
2501 constructGammaKF.ConstructGamma(AliKFNegParticle,AliKFPosParticle);
2502 resPt = mcPt-constructGammaKF.GetPt();
2503 resR = mcR-constructGammaKF.GetR();
2504 resZ = mcZ-constructGammaKF.GetZ();
2505 fHistograms->FillHistogram("Resolution_GammaConstr_AbsdPt_Pt", mcPt, resPt);
2506 fHistograms->FillHistogram("Resolution_GammaConstr_AbsdR_R", mcR,resR);
2507 fHistograms->FillHistogram("Resolution_GammaConstr_AbsdZ_Z", mcZ,resZ);
2508 if(constructGammaKF.GetNDF() !=0)
2509 fHistograms->FillHistogram("Resolution_GammaConstr_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
2512 // Construct Gamma + Mass Constrained
2513 constructGammaKF.SetMassConstraint(0,0.0001);
2514 resPt = mcPt-constructGammaKF.GetPt();
2515 resR = mcR-constructGammaKF.GetR();
2516 resZ = mcZ-constructGammaKF.GetZ();
2517 fHistograms->FillHistogram("Resolution_GammaConstrMass_AbsdPt_Pt", mcPt, resPt);
2518 fHistograms->FillHistogram("Resolution_GammaConstrMass_AbsdR_R", mcR,resR);
2519 fHistograms->FillHistogram("Resolution_GammaConstrMass_AbsdZ_Z", mcZ,resZ);
2520 if(constructGammaKF.GetNDF() !=0)
2521 fHistograms->FillHistogram("Resolution_GammaConstrMass_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
2523 // Construct Gamma + ProductionVertex
2524 constructGammaKF.ConstructGamma(AliKFNegParticle,AliKFPosParticle);
2525 AliKFVertex primaryVertexImprovedConstruct(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
2526 primaryVertexImprovedConstruct+=constructGammaKF;
2527 constructGammaKF.SetProductionVertex(primaryVertexImprovedConstruct);
2528 resPt = mcPt-constructGammaKF.GetPt();
2529 resR = mcR-constructGammaKF.GetR();
2530 resZ = mcZ-constructGammaKF.GetZ();
2531 fHistograms->FillHistogram("Resolution_GammaConstrVtx_AbsdPt_Pt", mcPt, resPt);
2532 fHistograms->FillHistogram("Resolution_GammaConstrVtx_AbsdR_R", mcR,resR);
2533 fHistograms->FillHistogram("Resolution_GammaConstrVtx_AbsdZ_Z", mcZ,resZ);
2534 if(constructGammaKF.GetNDF() !=0)
2535 fHistograms->FillHistogram("Resolution_GammaConstrVtx_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
2537 // Construct Gamma + Mass Constrained + Production Vtx
2538 constructGammaKF.ConstructGamma(AliKFNegParticle,AliKFPosParticle);
2539 constructGammaKF.SetMassConstraint(0,0.0001);
2540 AliKFVertex primaryVertexImprovedConstructC(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
2541 primaryVertexImprovedConstructC+=constructGammaKF;
2542 constructGammaKF.SetProductionVertex(primaryVertexImprovedConstructC);
2543 resPt = mcPt-constructGammaKF.GetPt();
2544 resR = mcR-constructGammaKF.GetR();
2545 resZ = mcZ-constructGammaKF.GetZ();
2546 fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_AbsdPt_Pt", mcPt, resPt);
2547 fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_AbsdR_R", mcR,resR);
2548 fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_AbsdZ_Z", mcZ,resZ);
2549 if(constructGammaKF.GetNDF() !=0)
2550 fHistograms->FillHistogram("Resolution_GammaConstrMassVtx_Chi2NDF", constructGammaKF.GetChi2()/constructGammaKF.GetNDF());
2552 // Resolution Normal Gamma
2553 AliKFParticle normalGammaKF(AliKFNegParticle,AliKFPosParticle);
2554 resPt = mcPt-normalGammaKF.GetPt();
2555 resR = mcR-normalGammaKF.GetR();
2556 resZ = mcZ-normalGammaKF.GetZ();
2557 fHistograms->FillHistogram("Resolution_GammaNormal_AbsdPt_Pt", mcPt, resPt);
2558 fHistograms->FillHistogram("Resolution_GammaNormal_AbsdR_R", mcR,resR);
2559 fHistograms->FillHistogram("Resolution_GammaNormal_AbsdZ_Z", mcZ,resZ);
2560 if(normalGammaKF.GetNDF() !=0)
2561 fHistograms->FillHistogram("Resolution_GammaNormal_Chi2NDF", normalGammaKF.GetChi2()/normalGammaKF.GetNDF());
2563 // Normal Gamma + Mass Constrained
2564 normalGammaKF.SetMassConstraint(0,0.0001);
2565 resPt = mcPt-normalGammaKF.GetPt();
2566 resR = mcR-normalGammaKF.GetR();
2567 resZ = mcZ-normalGammaKF.GetZ();
2568 fHistograms->FillHistogram("Resolution_GammaNormalMass_AbsdPt_Pt", mcPt, resPt);
2569 fHistograms->FillHistogram("Resolution_GammaNormalMass_AbsdR_R", mcR,resR);
2570 fHistograms->FillHistogram("Resolution_GammaNormalMass_AbsdZ_Z", mcZ,resZ);
2571 if(normalGammaKF.GetNDF() !=0)
2572 fHistograms->FillHistogram("Resolution_GammaNormalMass_Chi2NDF", normalGammaKF.GetChi2()/normalGammaKF.GetNDF());
2574 // Normal Gamma + ProductionVertex
2575 AliKFParticle normalGammaKFVtx(AliKFNegParticle,AliKFPosParticle);
2576 AliKFVertex primaryVertexImprovedNormal(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
2577 primaryVertexImprovedNormal+=normalGammaKFVtx;
2578 normalGammaKFVtx.SetProductionVertex(primaryVertexImprovedNormal);
2579 resPt = mcPt-normalGammaKFVtx.GetPt();
2580 resR = mcR-normalGammaKFVtx.GetR();
2581 resZ = mcZ-normalGammaKFVtx.GetZ();
2582 fHistograms->FillHistogram("Resolution_GammaNormalVtx_AbsdPt_Pt", mcPt, resPt);
2583 fHistograms->FillHistogram("Resolution_GammaNormalVtx_AbsdR_R", mcR,resR);
2584 fHistograms->FillHistogram("Resolution_GammaNormalVtx_AbsdZ_Z", mcZ,resZ);
2585 if(normalGammaKFVtx.GetNDF() !=0)
2586 fHistograms->FillHistogram("Resolution_GammaNormalVtx_Chi2NDF", normalGammaKFVtx.GetChi2()/normalGammaKFVtx.GetNDF());
2588 // Normal Gamma + Mass Constrained + Production Vtx
2589 AliKFParticle normalGammaKFMassVtx(AliKFNegParticle,AliKFPosParticle);
2590 normalGammaKFMassVtx.SetMassConstraint(0,0.0001);
2591 AliKFVertex primaryVertexImprovedNormalMassVtx(*(fV0Reader->GetESDEvent()->GetPrimaryVertex()));
2592 primaryVertexImprovedNormalMassVtx+=normalGammaKFMassVtx;
2593 normalGammaKFMassVtx.SetProductionVertex(primaryVertexImprovedNormalMassVtx);
2594 resPt = mcPt-normalGammaKFMassVtx.GetPt();
2595 resR = mcR-normalGammaKFMassVtx.GetR();
2596 resZ = mcZ-normalGammaKFMassVtx.GetZ();
2597 fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_AbsdPt_Pt", mcPt, resPt);
2598 fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_AbsdR_R", mcR,resR);
2599 fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_AbsdZ_Z", mcZ,resZ);
2600 if(normalGammaKFMassVtx.GetNDF() !=0)
2601 fHistograms->FillHistogram("Resolution_GammaNormalMassVtx_Chi2NDF", normalGammaKFMassVtx.GetChi2()/normalGammaKFMassVtx.GetNDF());
2604 // ---------- End new Resolution ------------------
2605 Double_t mcpt = fV0Reader->GetMotherMCParticle()->Pt();
2606 Double_t esdpt = fV0Reader->GetMotherCandidatePt();
2607 Double_t resdPt = 0.;
2609 resdPt = ((esdpt - mcpt)/mcpt)*100.;
2610 } else if(mcpt < 0){
2611 cout<<"Pt of MC particle is negative, this will cause wrong calculation of resPt"<<endl;
2614 TVector3 vtxConvRes(fV0Reader->GetX(),fV0Reader->GetY(), fV0Reader->GetZ());
2616 fHistograms->FillHistogram("Resolution_Gamma_dPt_Pt", mcpt, resdPt);
2617 fHistograms->FillHistogram("Resolution_MCPt_ESDPt", mcpt,esdpt);
2618 fHistograms->FillHistogram("Resolution_Gamma_dPt_Phi", vtxConvRes.Phi(), resdPt);
2620 fHistograms->FillHistogram("Resolution_Gamma_minPt_dPt_Phi", vtxConvRes.Phi(), resdPt);
2623 Double_t resdZ = 0.;
2624 if(fV0Reader->GetNegativeMCParticle()->Vz() != 0){
2625 resdZ = ((fV0Reader->GetZ() -fV0Reader->GetNegativeMCParticle()->Vz())/fV0Reader->GetNegativeMCParticle()->Vz())*100.;
2627 Double_t resdZAbs = 0.;
2628 resdZAbs = (fV0Reader->GetZ() -fV0Reader->GetNegativeMCParticle()->Vz());
2630 fHistograms->FillHistogram("Resolution_dZAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdZAbs);
2631 fHistograms->FillHistogram("Resolution_dZAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdZAbs);
2632 fHistograms->FillHistogram("Resolution_dZAbs_VS_Phi", vtxConvRes.Phi(), resdZAbs);
2633 fHistograms->FillHistogram("Resolution_dZ", fV0Reader->GetNegativeMCParticle()->Vz(), resdZ);
2634 fHistograms->FillHistogram("Resolution_MCZ_ESDZ", fV0Reader->GetNegativeMCParticle()->Vz(),fV0Reader->GetZ());
2636 // new for dPt_Pt-histograms for Electron and Positron
2639 UInt_t kTRDoutN, statusN;
2641 // new for dPt_Pt-histograms for Electron and Positron
2642 if (fV0Reader->GetNegativeMCParticle()->GetPdgCode() == 11) {
2643 mcEpt = fV0Reader->GetNegativeMCParticle()->Pt();
2645 mcEpt = fV0Reader->GetPositiveMCParticle()->Pt();
2648 resEdPt = ((fV0Reader->GetNegativeTrackPt()-mcEpt)/mcEpt)*100.;
2650 statusN = fV0Reader->GetNegativeESDTrack()->GetStatus();
2651 kTRDoutN = (statusN & AliESDtrack::kTRDout);
2652 nITSclsE= fV0Reader->GetNegativeTracknITSClusters();
2654 // filling Resolution_Pt_dPt with respect to the Number of ITS clusters for Positrons
2656 case 0: // 0 ITS clusters
2657 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS0", mcEpt, resEdPt);
2659 case 1: // 1 ITS cluster
2660 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS1", mcEpt, resEdPt);
2662 case 2: // 2 ITS clusters
2663 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS2", mcEpt, resEdPt);
2665 case 3: // 3 ITS clusters
2666 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS3", mcEpt, resEdPt);
2668 case 4: // 4 ITS clusters
2669 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS4", mcEpt, resEdPt);
2671 case 5: // 5 ITS clusters
2672 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS5", mcEpt, resEdPt);
2674 case 6: // 6 ITS clusters
2675 fHistograms->FillHistogram("Resolution_E_dPt_Pt_ITS6", mcEpt, resEdPt);
2678 //Filling histograms with respect to Electron resolution
2679 fHistograms->FillHistogram("Resolution_E_dPt_Pt", mcEpt, resEdPt);
2680 fHistograms->FillHistogram("Resolution_E_dPt_Phi", vtxConvRes.Phi(), resEdPt);
2681 if (fV0Reader->GetNegativeTrackPt()> 0.150){
2682 fHistograms->FillHistogram("Resolution_E_minPt_dPt_Phi", vtxConvRes.Phi(), resEdPt);
2686 fHistograms->FillHistogram("Resolution_E_nTRDtracklets_ESDPt", fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDntracklets());
2687 fHistograms->FillHistogram("Resolution_E_nTRDtracklets_MCPt", mcEpt, fV0Reader->GetNegativeESDTrack()->GetTRDntracklets());
2688 fHistograms->FillHistogram("Resolution_E_nTRDclusters_ESDPt",fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDncls());
2689 fHistograms->FillHistogram("Resolution_E_nTRDclusters_MCPt",mcEpt, fV0Reader->GetNegativeESDTrack()->GetTRDncls());
2690 fHistograms->FillHistogram("Resolution_E_TRDsignal_ESDPt", fV0Reader->GetNegativeTrackPt(), fV0Reader->GetNegativeESDTrack()->GetTRDsignal());
2694 if (fV0Reader->GetPositiveMCParticle()->GetPdgCode() == -11) {
2695 mcPpt = fV0Reader->GetPositiveMCParticle()->Pt();
2697 mcPpt = fV0Reader->GetNegativeMCParticle()->Pt();
2700 Double_t resPdPt = 0;
2702 resPdPt = ((fV0Reader->GetPositiveTrackPt()-mcPpt)/mcPpt)*100.;
2705 UInt_t statusP = fV0Reader->GetPositiveESDTrack()->GetStatus();
2706 // AliESDtrack * posTr= fV0Reader->GetPositiveESDTrack();
2707 UInt_t kTRDoutP = (statusP & AliESDtrack::kTRDout);
2709 Int_t nITSclsP = fV0Reader->GetPositiveTracknITSClusters();
2710 // filling Resolution_Pt_dPt with respect to the Number of ITS clusters for Positrons
2712 case 0: // 0 ITS clusters
2713 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS0", mcPpt, resPdPt);
2715 case 1: // 1 ITS cluster
2716 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS1", mcPpt, resPdPt);
2718 case 2: // 2 ITS clusters
2719 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS2", mcPpt, resPdPt);
2721 case 3: // 3 ITS clusters
2722 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS3", mcPpt, resPdPt);
2724 case 4: // 4 ITS clusters
2725 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS4", mcPpt, resPdPt);
2727 case 5: // 5 ITS clusters
2728 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS5", mcPpt, resPdPt);
2730 case 6: // 6 ITS clusters
2731 fHistograms->FillHistogram("Resolution_P_dPt_Pt_ITS6", mcPpt, resPdPt);
2734 //Filling histograms with respect to Positron resolution
2735 fHistograms->FillHistogram("Resolution_P_dPt_Pt", mcPpt, resPdPt);
2736 fHistograms->FillHistogram("Resolution_P_dPt_Phi", vtxConvRes.Phi(), resPdPt);
2737 if (fV0Reader->GetPositiveTrackPt()> 0.150){
2738 fHistograms->FillHistogram("Resolution_P_minPt_dPt_Phi", vtxConvRes.Phi(), resPdPt);
2742 fHistograms->FillHistogram("Resolution_P_nTRDtracklets_ESDPt", fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDntracklets());
2743 fHistograms->FillHistogram("Resolution_P_nTRDtracklets_MCPt", mcPpt, fV0Reader->GetPositiveESDTrack()->GetTRDntracklets());
2744 fHistograms->FillHistogram("Resolution_P_nTRDclusters_ESDPt",fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDncls());
2745 fHistograms->FillHistogram("Resolution_P_nTRDclusters_MCPt",mcPpt, fV0Reader->GetPositiveESDTrack()->GetTRDncls());
2746 fHistograms->FillHistogram("Resolution_P_TRDsignal_ESDPt", fV0Reader->GetPositiveTrackPt(), fV0Reader->GetPositiveESDTrack()->GetTRDsignal());
2750 Double_t resdR = 0.;
2751 if(fV0Reader->GetNegativeMCParticle()->R() != 0){
2752 resdR = ((fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R())/fV0Reader->GetNegativeMCParticle()->R())*100.;
2754 Double_t resdRAbs = 0.;
2755 resdRAbs = (fV0Reader->GetXYRadius() - fV0Reader->GetNegativeMCParticle()->R());
2757 fHistograms->FillHistogram("Resolution_dRAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdRAbs);
2758 fHistograms->FillHistogram("Resolution_dRAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdRAbs);
2759 fHistograms->FillHistogram("Resolution_dRAbs_VS_Phi", vtxConvRes.Phi(), resdRAbs);
2760 fHistograms->FillHistogram("Resolution_dR", fV0Reader->GetNegativeMCParticle()->R(), resdR);
2761 fHistograms->FillHistogram("Resolution_MCR_ESDR", fV0Reader->GetNegativeMCParticle()->R(),fV0Reader->GetXYRadius());
2762 fHistograms->FillHistogram("Resolution_R_dPt", fV0Reader->GetNegativeMCParticle()->R(), resdPt);
2764 fHistograms->FillHistogram("Resolution_minPt_R_dPt", fV0Reader->GetNegativeMCParticle()->R(), resdPt);
2767 Double_t resdPhiAbs=0.;
2769 resdPhiAbs= (vtxConvRes.Phi()-fV0Reader->GetNegativeMCParticle()->Phi());
2770 fHistograms->FillHistogram("Resolution_MCPhi_ESDPhi", fV0Reader->GetNegativeMCParticle()->Phi(),vtxConvRes.Phi());
2771 fHistograms->FillHistogram("Resolution_dPhiAbs_VS_R", fV0Reader->GetNegativeMCParticle()->R(), resdPhiAbs);
2772 fHistograms->FillHistogram("Resolution_dPhiAbs_VS_Z", fV0Reader->GetNegativeMCParticle()->Vz(), resdPhiAbs);
2773 fHistograms->FillHistogram("Resolution_dPhiAbs_VS_Phi", vtxConvRes.Phi(), resdPhiAbs);
2774 }//if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22)
2776 }//while(fV0Reader->NextV0)
2777 fHistograms->FillHistogram("ESD_NumberOfSurvivingV0s", nSurvivingV0s);
2778 fHistograms->FillHistogram("ESD_NumberOfV0s", fV0Reader->GetNumberOfV0s());
2779 fHistograms->FillHistogram("ESD_NumberOfContributorsVtx", fV0Reader->GetNumberOfContributorsVtx());
2780 fV0Reader->ResetV0IndexNumber();
2785 //_____________________________________________________________________________________
2786 void AliAnalysisTaskGammaConversion::ProcessGammasForOmegaMesonAnalysis(){
2787 // omega meson analysis pi0+gamma decay
2788 for(Int_t firstPi0Index=0;firstPi0Index<fKFReconstructedPi0sTClone->GetEntriesFast();firstPi0Index++){
2789 AliKFConversionMother * omegaCandidatePi0Daughter = (AliKFConversionMother *)fKFReconstructedPi0sTClone->At(firstPi0Index);
2790 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
2792 AliKFConversionPhoton * omegaCandidateGammaDaughter = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
2793 if(omegaCandidatePi0Daughter->GetGammaLabel(0)==firstGammaIndex || omegaCandidatePi0Daughter->GetGammaLabel(1)==firstGammaIndex){
2797 AliKFParticle omegaCandidate(*omegaCandidatePi0Daughter,*omegaCandidateGammaDaughter);
2798 Double_t massOmegaCandidate = 0.;
2799 Double_t widthOmegaCandidate = 0.;
2801 omegaCandidate.GetMass(massOmegaCandidate,widthOmegaCandidate);
2803 if ( massOmegaCandidate > 733 && massOmegaCandidate < 833 ) {
2804 //AddOmegaToAOD(&omegaCandidate, massOmegaCandidate, firstPi0Index, firstGammaIndex);
2807 fHistograms->FillHistogram("ESD_Omega_InvMass_vs_Pt",massOmegaCandidate ,omegaCandidate.GetPt());
2808 fHistograms->FillHistogram("ESD_Omega_InvMass",massOmegaCandidate);
2810 //delete omegaCandidate;
2812 }// end of omega reconstruction in pi0+gamma channel
2814 if(fDoJet == kTRUE){
2815 AliKFParticle* negPiKF=NULL;
2816 AliKFParticle* posPiKF=NULL;
2817 Int_t piPlusMotherLabel=-1;
2818 Int_t piMinusMotherLabel=-1;
2820 // look at the pi+pi+pi0 channel
2821 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2822 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2823 if (posTrack->GetSign()<0) continue;
2824 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
2825 if (posPiKF) delete posPiKF; posPiKF=NULL;
2826 posPiKF = new AliKFParticle( *(posTrack) ,211);
2828 TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2829 if(positiveMCParticle->GetMother(0)>-1){
2830 piPlusMotherLabel = positiveMCParticle->GetMother(0);
2834 for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
2835 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
2836 if( negTrack->GetSign()>0) continue;
2837 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2838 if (negPiKF) delete negPiKF; negPiKF=NULL;
2839 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2840 AliKFParticle omegaCandidatePipPinPi0(*omegaCandidatePi0Daughter,*posPiKF,*negPiKF);
2841 Double_t massOmegaCandidatePipPinPi0 = 0.;
2842 Double_t widthOmegaCandidatePipPinPi0 = 0.;
2844 omegaCandidatePipPinPi0.GetMass(massOmegaCandidatePipPinPi0,widthOmegaCandidatePipPinPi0);
2846 if ( massOmegaCandidatePipPinPi0 > 733 && massOmegaCandidatePipPinPi0 < 833 ) {
2847 // AddOmegaToAOD(&omegaCandidatePipPinPi0, massOmegaCandidatePipPinPi0, -1, -1);
2850 fHistograms->FillHistogram("ESD_OmegaPipPinPi0_InvMass_vs_Pt",massOmegaCandidatePipPinPi0 ,omegaCandidatePipPinPi0.GetPt());
2851 fHistograms->FillHistogram("ESD_OmegaPipPinPi0_InvMass",massOmegaCandidatePipPinPi0);
2855 TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[jCh])->GetLabel()));
2856 if(negativeMCParticle->GetMother(0)>-1){
2857 piMinusMotherLabel = negativeMCParticle->GetMother(0);
2858 if( piMinusMotherLabel == piPlusMotherLabel){
2859 Int_t geantCode=fStack->Particle(TMath::Abs(piPlusMotherLabel))->GetPdgCode();
2860 if(geantCode == 221 || geantCode == 223){
2861 fHistograms->FillHistogram("ESD_TrueOmegaPipPinPi0_InvMass_vs_Pt",massOmegaCandidatePipPinPi0 ,omegaCandidatePipPinPi0.GetPt());
2869 // delete omegaCandidatePipPinPi0;
2873 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
2875 } // checking ig gammajet because in that case the chargedparticle list is created
2878 ////////////////////////
2881 if(fDoJet == kTRUE){
2882 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
2883 AliKFConversionPhoton * rhoCandidateGammaDaughter = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
2884 Int_t gamma1MotherLabel=-1;
2886 Int_t indexKF1 = rhoCandidateGammaDaughter->GetV0Index();
2887 if(indexKF1<fV0Reader->GetNumberOfV0s()){
2888 fV0Reader->GetV0(indexKF1);//updates to the correct v0
2890 if(fV0Reader->HasSameMCMother() == kTRUE){
2891 //cout<<"This v0 is a real v0!!!!"<<endl;
2892 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
2893 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
2894 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
2895 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
2896 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
2897 gamma1MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
2905 AliKFParticle* posPiKF=NULL;
2906 AliKFParticle* negPiKF=NULL;
2907 Int_t piPlusMotherLabel=-1;
2908 Int_t piMinusMotherLabel=-1;
2910 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2911 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2912 if (posTrack->GetSign()<0) continue;
2913 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
2914 if (posPiKF) delete posPiKF; posPiKF=NULL;
2915 posPiKF = new AliKFParticle( *(posTrack) ,211);
2916 AliKFParticle rhoPlusCandidate(*posPiKF,*rhoCandidateGammaDaughter);
2917 Double_t massRhoPlusCandidate = 0.;
2918 Double_t widthRhoPlusCandidate = 0.;
2920 rhoPlusCandidate.GetMass(massRhoPlusCandidate,widthRhoPlusCandidate);
2921 fHistograms->FillHistogram("ESD_RhoPlus_InvMass_vs_Pt",massRhoPlusCandidate ,rhoPlusCandidate.GetPt());
2922 fHistograms->FillHistogram("ESD_RhoPlus_InvMass",massRhoPlusCandidate);
2926 TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2927 if(positiveMCParticle->GetMother(0)>-1){
2928 piPlusMotherLabel = positiveMCParticle->GetMother(0);
2929 if(piPlusMotherLabel == gamma1MotherLabel){
2930 //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
2931 //cout<<"RhoPlus::" << geantCode<< endl;
2932 fHistograms->FillHistogram("ESD_TrueRhoPlus_InvMass_vs_Pt",massRhoPlusCandidate ,rhoPlusCandidate.GetPt());
2936 for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
2937 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
2938 if (negTrack->GetSign()>0) continue;
2939 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2940 if (negPiKF) delete negPiKF; negPiKF=NULL;
2941 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2942 AliKFParticle rho0Candidate(*posPiKF,*negPiKF,*rhoCandidateGammaDaughter);
2943 Double_t massRho0Candidate = 0.;
2944 Double_t widthRho0Candidate = 0.;
2946 rho0Candidate.GetMass(massRho0Candidate,widthRho0Candidate);
2947 fHistograms->FillHistogram("ESD_Rho0_InvMass_vs_Pt",massRho0Candidate ,rho0Candidate.GetPt());
2948 fHistograms->FillHistogram("ESD_Rho0_InvMass",massRho0Candidate);
2951 TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[jCh])->GetLabel()));
2952 if(negativeMCParticle->GetMother(0)>-1){
2953 piMinusMotherLabel = negativeMCParticle->GetMother(0);
2954 if( piMinusMotherLabel == piPlusMotherLabel && piMinusMotherLabel==gamma1MotherLabel ){
2955 Int_t geantCode=fStack->Particle(TMath::Abs(piPlusMotherLabel))->GetPdgCode();
2956 if(geantCode == 221 || geantCode == 113){
2957 fHistograms->FillHistogram("ESD_TrueRho0_InvMass_vs_Pt",massRho0Candidate ,rho0Candidate.GetPt());
2966 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
2969 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
2970 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
2971 if (negTrack->GetSign()>0) continue;
2972 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
2973 if (negPiKF) delete negPiKF; negPiKF=NULL;
2974 negPiKF = new AliKFParticle( *(negTrack) ,-211);
2975 AliKFParticle rhoMinusCandidate(*negPiKF,*rhoCandidateGammaDaughter);
2976 Double_t massRhoMinusCandidate = 0.;
2977 Double_t widthRhoMinusCandidate = 0.;
2979 rhoMinusCandidate.GetMass(massRhoMinusCandidate,widthRhoMinusCandidate);
2980 fHistograms->FillHistogram("ESD_RhoMinus_InvMass_vs_Pt",massRhoMinusCandidate ,rhoMinusCandidate.GetPt());
2981 fHistograms->FillHistogram("ESD_RhoMinus_InvMass",massRhoMinusCandidate);
2984 TParticle * negativeMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
2985 Int_t pionMotherLabel=-1;
2987 if(negativeMCParticle->GetMother(0)>-1){
2988 pionMotherLabel = negativeMCParticle->GetMother(0);
2989 if(pionMotherLabel == gamma1MotherLabel){
2990 //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
2991 //cout<<"RhoMinus::" << geantCode<< endl;
2992 fHistograms->FillHistogram("ESD_TrueRhoMinus_InvMass_vs_Pt",massRhoMinusCandidate ,rhoMinusCandidate.GetPt());
2997 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
2999 AliKFParticle* posProtKF=NULL;
3002 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
3003 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
3004 if (posTrack->GetSign()<0) continue;
3005 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kProton))>2.) continue;
3006 if (posProtKF) delete posProtKF; posProtKF=NULL;
3007 posProtKF = new AliKFParticle( *(posTrack) ,2212);
3008 AliKFParticle deltaPlusCandidate(*posProtKF,*rhoCandidateGammaDaughter);
3009 Double_t massDeltaPlusCandidate = 0.;
3010 Double_t widthDeltaPlusCandidate = 0.;
3012 deltaPlusCandidate.GetMass(massDeltaPlusCandidate,widthDeltaPlusCandidate);
3013 fHistograms->FillHistogram("ESD_DeltaPlus_InvMass_vs_Pt",massDeltaPlusCandidate ,deltaPlusCandidate.GetPt());
3014 fHistograms->FillHistogram("ESD_DeltaPlus_InvMass",massDeltaPlusCandidate);
3017 TParticle * positiveMCParticle = fStack->Particle(TMath::Abs(fESDEvent->GetTrack(fChargedParticlesId[iCh])->GetLabel()));
3018 Int_t protonMotherLabel=-1;
3020 if(positiveMCParticle->GetMother(0)>-1){
3021 protonMotherLabel = positiveMCParticle->GetMother(0);
3022 if(protonMotherLabel == gamma1MotherLabel){
3023 //Int_t geantCode=fStack->Particle(TMath::Abs(pionMotherLabel))->GetPdgCode();
3024 //cout<<"RhoPlus::" << geantCode<< endl;
3025 fHistograms->FillHistogram("ESD_TrueDeltaPlus_InvMass_vs_Pt",massDeltaPlusCandidate ,deltaPlusCandidate.GetPt());
3031 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL; if (posProtKF) delete posProtKF; posProtKF=NULL;
3035 if(fCalculateBackground){
3037 AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
3039 Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
3041 if(fUseTrackMultiplicityForBG == kTRUE){
3042 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
3044 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
3047 AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
3049 // Background calculation for the omega
3050 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
3051 AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);
3053 if(fMoveParticleAccordingToVertex == kTRUE){
3054 bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
3056 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3057 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3059 if(fMoveParticleAccordingToVertex == kTRUE){
3060 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
3063 for(Int_t firstPi0Index=0;firstPi0Index<fKFReconstructedPi0sTClone->GetEntriesFast();firstPi0Index++){
3064 AliKFParticle * omegaCandidatePi0Daughter = (AliKFParticle *)fKFReconstructedPi0sTClone->At(firstPi0Index);
3065 AliKFParticle * omegaBckCandidate = new AliKFParticle(*omegaCandidatePi0Daughter,previousGoodV0);
3066 Double_t massOmegaBckCandidate = 0.;
3067 Double_t widthOmegaBckCandidate = 0.;
3069 omegaBckCandidate->GetMass(massOmegaBckCandidate,widthOmegaBckCandidate);
3072 fHistograms->FillHistogram("ESD_Omega_Bck_InvMass_vs_Pt",massOmegaBckCandidate ,omegaBckCandidate->GetPt());
3073 fHistograms->FillHistogram("ESD_Omega_Bck_InvMass",massOmegaBckCandidate);
3075 delete omegaBckCandidate;
3078 // Bck for gamma pi+ pi-
3080 AliKFParticle* posPiKF=NULL;
3081 AliKFParticle* negPiKF=NULL;
3083 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
3084 AliESDtrack* posTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
3085 if (posTrack->GetSign()<0) continue;
3086 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(posTrack,AliPID::kPion))>2.) continue;
3087 if (posPiKF) delete posPiKF; posPiKF=NULL;
3088 posPiKF = new AliKFParticle( *(posTrack) ,211);
3090 for(Int_t jCh=0;jCh<fChargedParticles->GetEntriesFast();jCh++){
3091 AliESDtrack* negTrack = (AliESDtrack*)(fChargedParticles->At(jCh));
3092 if (negTrack->GetSign()>0) continue;
3093 if(TMath::Abs(fV0Reader->GetESDpid()->NumberOfSigmasTPC(negTrack,AliPID::kPion))>2.) continue;
3094 if (negPiKF) delete negPiKF; negPiKF=NULL;
3095 negPiKF = new AliKFParticle( *(negTrack) ,-211);
3096 AliKFParticle rho0BckCandidate(*posPiKF,*negPiKF,previousGoodV0);
3097 Double_t massRho0BckCandidate = 0.;
3098 Double_t widthRho0BckCandidate = 0.;
3100 rho0BckCandidate.GetMass(massRho0BckCandidate,widthRho0BckCandidate);
3101 fHistograms->FillHistogram("ESD_Rho0Bck_InvMass_vs_Pt",massRho0BckCandidate ,rho0BckCandidate.GetPt());
3102 fHistograms->FillHistogram("ESD_Rho0Bck_InvMass",massRho0BckCandidate);
3107 if (posPiKF) delete posPiKF; posPiKF=NULL; if (negPiKF) delete negPiKF; negPiKF=NULL;
3112 } // end of checking if background calculation is available
3116 void AliAnalysisTaskGammaConversion::ProcessGammasForNeutralMesonAnalysis(){
3117 // see header file for documentation
3119 // for(UInt_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammas.size();firstGammaIndex++){
3120 // for(UInt_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFReconstructedGammas.size();secondGammaIndex++){
3122 fESDEvent = fV0Reader->GetESDEvent();
3124 if(fKFReconstructedGammasTClone->GetEntriesFast()>fV0Reader->GetNumberOfV0s()){
3125 cout<<"Warning, number of entries in the tclone is bigger than number of v0s"<<endl;
3128 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
3129 for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();secondGammaIndex++){
3131 // AliKFParticle * twoGammaDecayCandidateDaughter0 = &fKFReconstructedGammas[firstGammaIndex];
3132 // AliKFParticle * twoGammaDecayCandidateDaughter1 = &fKFReconstructedGammas[secondGammaIndex];
3134 AliKFConversionPhoton * twoGammaDecayCandidateDaughter0 = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(firstGammaIndex);
3135 AliKFConversionPhoton * twoGammaDecayCandidateDaughter1 = (AliKFConversionPhoton *)fKFReconstructedGammasTClone->At(secondGammaIndex);
3137 if(twoGammaDecayCandidateDaughter0->GetTrackLabelPositive()==twoGammaDecayCandidateDaughter1->GetTrackLabelPositive()||
3138 twoGammaDecayCandidateDaughter0->GetTrackLabelPositive()==twoGammaDecayCandidateDaughter1->GetTrackLabelNegative()||
3139 twoGammaDecayCandidateDaughter0->GetTrackLabelNegative()==twoGammaDecayCandidateDaughter1->GetTrackLabelPositive()||
3140 twoGammaDecayCandidateDaughter0->GetTrackLabelNegative()==twoGammaDecayCandidateDaughter1->GetTrackLabelNegative())continue;
3142 AliKFConversionMother *twoGammaCandidate = new AliKFConversionMother(*twoGammaDecayCandidateDaughter0,*twoGammaDecayCandidateDaughter1);
3143 twoGammaCandidate->SetGammaLabels(firstGammaIndex,secondGammaIndex);
3145 Double_t massTwoGammaCandidate = 0.;
3146 Double_t widthTwoGammaCandidate = 0.;
3147 Double_t chi2TwoGammaCandidate =10000.;
3148 twoGammaCandidate->GetMass(massTwoGammaCandidate,widthTwoGammaCandidate);
3149 // if(twoGammaCandidate->GetNDF()>0){
3150 // chi2TwoGammaCandidate = twoGammaCandidate->GetChi2()/twoGammaCandidate->GetNDF();
3151 chi2TwoGammaCandidate = twoGammaCandidate->GetChi2();
3153 fHistograms->FillHistogram("ESD_Mother_Chi2",chi2TwoGammaCandidate);
3154 if((chi2TwoGammaCandidate>0 && chi2TwoGammaCandidate<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
3156 TVector3 momentumVectorTwoGammaCandidate(twoGammaCandidate->GetPx(),twoGammaCandidate->GetPy(),twoGammaCandidate->GetPz());
3157 TVector3 spaceVectorTwoGammaCandidate(twoGammaCandidate->GetX(),twoGammaCandidate->GetY(),twoGammaCandidate->GetZ());
3159 Double_t openingAngleTwoGammaCandidate = twoGammaCandidate->GetOpeningAngle();
3161 Double_t rapidity=twoGammaCandidate->GetRapidity();
3163 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut()){
3164 delete twoGammaCandidate;
3165 continue; // rapidity cut
3168 Double_t alfa=twoGammaCandidate->GetAlpha();
3171 if(openingAngleTwoGammaCandidate < fMinOpeningAngleGhostCut){
3172 delete twoGammaCandidate;
3173 continue; // minimum opening angle to avoid using ghosttracks
3176 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3177 fHistograms->FillHistogram("ESD_Mother_GammaDaughter_OpeningAngle", openingAngleTwoGammaCandidate);
3178 fHistograms->FillHistogram("ESD_Mother_Energy", twoGammaCandidate->GetE());
3179 fHistograms->FillHistogram("ESD_Mother_Pt", momentumVectorTwoGammaCandidate.Pt());
3180 fHistograms->FillHistogram("ESD_Mother_Eta", momentumVectorTwoGammaCandidate.Eta());
3181 fHistograms->FillHistogram("ESD_Mother_Rapid", rapidity);
3182 fHistograms->FillHistogram("ESD_Mother_Phi", spaceVectorTwoGammaCandidate.Phi());
3183 fHistograms->FillHistogram("ESD_Mother_Mass", massTwoGammaCandidate);
3184 fHistograms->FillHistogram("ESD_Mother_alfa", alfa);
3185 if( (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) ){
3186 fHistograms->FillHistogram("ESD_Mother_alfa_Pi0", alfa);
3187 fHistograms->FillHistogram("ESD_Mother_Pt_alpha_Pi0", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3189 if( (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) ){
3190 fHistograms->FillHistogram("ESD_Mother_alfa_Eta", alfa);
3191 fHistograms->FillHistogram("ESD_Mother_Pt_alpha_Eta", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3194 fHistograms->FillHistogram("ESD_Mother_R", spaceVectorTwoGammaCandidate.Pt()); // Pt in Space == R!!!
3195 fHistograms->FillHistogram("ESD_Mother_ZR", twoGammaCandidate->GetZ(), spaceVectorTwoGammaCandidate.Pt());
3196 fHistograms->FillHistogram("ESD_Mother_XY", twoGammaCandidate->GetX(), twoGammaCandidate->GetY());
3197 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3198 fHistograms->FillHistogram("ESD_Mother_InvMass",massTwoGammaCandidate);
3199 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3202 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_E_alpha",massTwoGammaCandidate ,twoGammaCandidate->GetE());
3205 if(fCalculateBackground){
3206 /* Kenneth, just for testing*/
3207 AliGammaConversionBGHandler * bgHandlerTest = fV0Reader->GetBGHandler();
3209 Int_t zbin= bgHandlerTest->GetZBinIndex(fV0Reader->GetVertexZ());
3212 if(fUseTrackMultiplicityForBG == kTRUE){
3213 multKAA=fV0Reader->CountESDTracks();
3214 mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
3216 else{// means we use #v0s for multiplicity
3217 multKAA=fV0Reader->GetNGoodV0s();
3218 mbin = bgHandlerTest->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
3220 // cout<<"Filling bin number "<<zbin<<" and "<<mbin<<endl;
3221 // cout<<"Corresponding to z = "<<fV0Reader->GetVertexZ()<<" and m = "<<multKAA<<endl;
3222 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3223 fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass",zbin,mbin),massTwoGammaCandidate);
3224 fHistograms->FillHistogram(Form("%d%dESD_Mother_InvMass_vs_Pt",zbin,mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3225 /* end Kenneth, just for testing*/
3226 fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3229 /* if(fCalculateBackground){
3230 AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
3231 Int_t mbin= bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
3232 fHistograms->FillHistogram(Form("%dESD_Mother_InvMass_vs_Pt",mbin),massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3234 // if(fDoNeutralMesonV0MCCheck){
3236 //Kenneth: Checking the eta of the gamma to check the difference between 0.9 and 1.2
3237 Int_t indexKF1 = twoGammaDecayCandidateDaughter0->GetV0Index();
3238 if(indexKF1<fV0Reader->GetNumberOfV0s()){
3239 fV0Reader->GetV0(indexKF1);//updates to the correct v0
3240 Double_t eta1 = fV0Reader->GetMotherCandidateEta();
3241 Bool_t isRealPi0=kFALSE;
3242 Bool_t isRealEta=kFALSE;
3243 Int_t gamma1MotherLabel=-1;
3244 if(fV0Reader->HasSameMCMother() == kTRUE){
3245 //cout<<"This v0 is a real v0!!!!"<<endl;
3246 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
3247 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
3248 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
3249 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
3250 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
3251 gamma1MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
3254 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==111){
3255 gamma1MotherLabel=-111;
3257 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==221){
3258 gamma1MotherLabel=-221;
3262 Int_t indexKF2 = twoGammaDecayCandidateDaughter1->GetV0Index();
3263 if(indexKF1 == indexKF2){
3264 cout<<"index of the two KF particles are the same.... should not happen"<<endl;
3266 if(indexKF2<fV0Reader->GetNumberOfV0s()){
3267 fV0Reader->GetV0(indexKF2);
3268 Double_t eta2 = fV0Reader->GetMotherCandidateEta();
3269 Int_t gamma2MotherLabel=-1;
3270 if(fV0Reader->HasSameMCMother() == kTRUE){
3271 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
3272 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
3273 if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){
3274 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){
3275 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
3276 gamma2MotherLabel=fV0Reader->GetMotherMCParticle()->GetFirstMother();
3279 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==111){
3280 gamma2MotherLabel=-111;
3282 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() ==221){
3283 gamma2MotherLabel=-221;
3288 if(gamma1MotherLabel>=0 && gamma1MotherLabel==gamma2MotherLabel){
3289 if(fV0Reader->CheckIfPi0IsMother(gamma1MotherLabel)){
3292 if(fV0Reader->CheckIfEtaIsMother(gamma1MotherLabel)){
3297 //cout << "alpha " << alfa << endl;
3298 if(isRealPi0)fHistograms->FillHistogram("ESD_TruePi0_alpha",alfa);
3299 if(isRealEta)fHistograms->FillHistogram("ESD_TrueEta_alpha",alfa);
3301 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3302 if(TMath::Abs(eta1)>0.9 && TMath::Abs(eta2)>0.9){
3303 // fHistograms->FillHistogram("ESD_Mother_InvMass_1212",massTwoGammaCandidate);
3304 // fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3305 if(isRealPi0 || isRealEta){
3306 fHistograms->FillHistogram("ESD_TruePi0_InvMass_1212",massTwoGammaCandidate);
3307 fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_1212",openingAngleTwoGammaCandidate);
3308 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3309 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3310 fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
3311 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3312 if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
3313 fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3314 if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
3315 fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3319 if(!isRealPi0 && !isRealEta){
3320 if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
3321 fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3323 fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3325 if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221){
3326 fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3329 } else if(TMath::Abs(eta1)>0.9 || TMath::Abs(eta2)>0.9){
3330 // fHistograms->FillHistogram("ESD_Mother_InvMass_0912",massTwoGammaCandidate);
3331 // fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3333 if(isRealPi0 || isRealEta){
3334 fHistograms->FillHistogram("ESD_TruePi0_InvMass_0912",massTwoGammaCandidate);
3335 fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_0912",openingAngleTwoGammaCandidate);
3336 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3337 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3338 fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
3339 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3340 if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
3341 fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3342 if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
3343 fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3345 if(!isRealPi0 && !isRealEta){
3346 if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
3347 fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3349 fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3351 if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221){
3352 fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3356 // fHistograms->FillHistogram("ESD_Mother_InvMass_0909",massTwoGammaCandidate);
3357 // fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3358 if(isRealPi0 || isRealEta){
3359 fHistograms->FillHistogram("ESD_TruePi0_InvMass_0909",massTwoGammaCandidate);
3360 fHistograms->FillHistogram("ESD_TruePi0_OpeningAngle_0909",openingAngleTwoGammaCandidate);
3361 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3362 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3363 fHistograms->FillHistogram("ESD_TruePi0_InvMass",massTwoGammaCandidate);
3364 fHistograms->FillHistogram("ESD_TruePi0_InvMass_vs_Pt_alpha",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3365 if( (isRealPi0) && (massTwoGammaCandidate > 0.1) && (massTwoGammaCandidate < 0.15) )
3366 fHistograms->FillHistogram("ESD_TruePi0_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3367 if( (isRealEta) && (massTwoGammaCandidate > 0.5) && (massTwoGammaCandidate < 0.57) )
3368 fHistograms->FillHistogram("ESD_TrueEta_Pt_alpha", momentumVectorTwoGammaCandidate.Pt(), alfa); //RR_alpha
3369 if(gamma1MotherLabel > fV0Reader->GetMCStack()->GetNprimary()){
3370 fHistograms->FillHistogram("ESD_TruePi0Sec_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3371 TParticle * secPi0MC = (TParticle*)fStack->Particle(fV0Reader->GetMotherMCParticle()->GetFirstMother());
3372 if (secPi0MC->GetMother(0) >-1){
3373 if(fStack->Particle(secPi0MC->GetMother(0))->GetPdgCode()==kK0Short){
3374 fHistograms->FillHistogram("ESD_TruePi0SecFromK0S_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3375 if(massTwoGammaCandidate>0.09 && massTwoGammaCandidate<0.145){
3376 fHistograms->FillHistogram("ESD_K0SFromSecPi0_Pt",fStack->Particle(secPi0MC->GetMother(0))->Pt());
3382 if(!isRealPi0 && !isRealEta){
3383 if(gamma1MotherLabel>-1 && gamma2MotherLabel>-1){
3384 fHistograms->FillHistogram("ESD_TrueBckGG_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3386 fHistograms->FillHistogram("ESD_TrueBckCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3388 if(gamma1MotherLabel==-111 || gamma2MotherLabel==-111 || gamma1MotherLabel==-221 || gamma2MotherLabel==-221 ){
3389 fHistograms->FillHistogram("ESD_TruePi0DalitzCont_InvMass_vs_Pt",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3397 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3398 if ( TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())<0.9 && TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())<0.9 ){
3399 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_Fiducial",massTwoGammaCandidate ,momentumVectorTwoGammaCandidate.Pt());
3400 fHistograms->FillHistogram("ESD_Mother_InvMass_Fiducial",massTwoGammaCandidate);
3403 if(TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())>0.9 && TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())>0.9){
3404 fHistograms->FillHistogram("ESD_Mother_InvMass_1212",massTwoGammaCandidate);
3405 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt1212",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3407 else if(TMath::Abs(twoGammaDecayCandidateDaughter0->GetEta())>0.9 || TMath::Abs(twoGammaDecayCandidateDaughter1->GetEta())>0.9){
3408 fHistograms->FillHistogram("ESD_Mother_InvMass_0912",massTwoGammaCandidate);
3409 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0912",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3412 fHistograms->FillHistogram("ESD_Mother_InvMass_0909",massTwoGammaCandidate);
3413 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt0909",massTwoGammaCandidate,momentumVectorTwoGammaCandidate.Pt());
3416 Double_t lowMassPi0=0.1;
3417 Double_t highMassPi0=0.15;
3418 if ( ( massTwoGammaCandidate > lowMassPi0) && (massTwoGammaCandidate < highMassPi0) ){
3419 new((*fKFReconstructedPi0sTClone)[fKFReconstructedPi0sTClone->GetEntriesFast()]) AliKFConversionMother(*twoGammaCandidate);
3422 if( fKFCreateAOD ) {
3425 Double_t lowMassEta=0.4;
3426 Double_t highMassEta=0.7;
3428 if ( ( massTwoGammaCandidate > lowMassPi0) && (massTwoGammaCandidate < highMassPi0) ){
3430 TagDaughter(twoGammaCandidate->GetGammaLabel(0));
3431 TagDaughter(twoGammaCandidate->GetGammaLabel(1));
3432 // AddPionToAOD(twoGammaCandidate);
3433 } else if ( ( massTwoGammaCandidate > lowMassEta) && (massTwoGammaCandidate < highMassEta) ){
3434 TagDaughter(twoGammaCandidate->GetGammaLabel(0));
3435 TagDaughter(twoGammaCandidate->GetGammaLabel(1));
3436 // AddPionToAOD(twoGammaCandidate);
3442 delete twoGammaCandidate;
3447 ///__________________________________________________________________________________
3448 void AliAnalysisTaskGammaConversion::AddGammaToAOD(AliKFConversionPhoton * kfParticle) {
3450 //Fill AOD with particles
3451 TClonesArray *branch=fAODGamma;
3453 new((*branch)[branch->GetEntriesFast()]) AliAODConversionPhoton(kfParticle);
3454 static_cast<AliAODConversionPhoton*>(branch->Last())->SetMass(kfParticle->M());
3461 /*///__________________________________________________________________________________
3462 void AliAnalysisTaskGammaConversion::AddPionToAOD(AliKFConversionMother * kfParticle) {
3465 TClonesArray *branch=fAODPi0;
3468 new((*branch)[branch->GetEntriesFast()]) AliAODConversionMother(kfParticle);
3471 TagDaughter(kfParticle->GetGammaLabel(0));
3472 TagDaughter(kfParticle->GetGammaLabel(1));
3475 ///__________________________________________________________________________________
3476 void AliAnalysisTaskGammaConversion::AddOmegaToAOD(AliKFParticle * kfParticle, Int_t daughter1, Int_t daughter2) {
3480 TClonesArray *branch=fAODOmega;
3482 // AliAODConversionPhoton * fdaughter1 = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(daughter1));
3483 // AliAODConversionPhoton * fdaughter2 = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(daughter2));
3486 // new((*branch)[branch->GetEntriesFast()]) AliAODConversionMother(kfParticle);
3489 TagDaughter(daughter1);
3490 TagDaughter(daughter2);
3495 ///__________________________________________________________________________________
3496 void AliAnalysisTaskGammaConversion::TagDaughter(Int_t gammaIndex) {
3497 //Set conversion tag on pion daughters
3498 AliAODConversionPhoton * daughter = dynamic_cast<AliAODConversionPhoton*>(fAODGamma->At(gammaIndex));
3500 daughter->SetTag(kTRUE);
3502 AliError("Daughter not in gamma tree!!");
3506 ///___________________________________________________________________________________
3507 void AliAnalysisTaskGammaConversion::FillAODWithConversionGammas(){
3508 // Fill AOD with reconstructed Gamma
3509 for(Int_t gammaIndex=0;gammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();gammaIndex++){
3510 AliKFConversionPhoton * gammakf = dynamic_cast<AliKFConversionPhoton*>(fKFReconstructedGammasTClone->At(gammaIndex));
3512 AddGammaToAOD(gammakf);
3518 void AliAnalysisTaskGammaConversion::ProcessConvPHOSGammasForNeutralMesonAnalysis(){
3520 // see header file for documentation
3521 // Analyse Pi0 with one photon from Phos and 1 photon from conversions
3526 vtx[0] = fV0Reader->GetPrimaryVertex()->GetX();
3527 vtx[1] = fV0Reader->GetPrimaryVertex()->GetY();
3528 vtx[2] = fV0Reader->GetPrimaryVertex()->GetZ();
3531 // Loop over all CaloClusters and consider only the PHOS ones:
3532 AliESDCaloCluster *clu;
3533 TLorentzVector pPHOS;
3534 TLorentzVector gammaPHOS;
3535 TLorentzVector gammaGammaConv;
3536 TLorentzVector pi0GammaConvPHOS;
3537 TLorentzVector gammaGammaConvBck;
3538 TLorentzVector pi0GammaConvPHOSBck;
3541 for (Int_t i=0; i<fV0Reader->GetESDEvent()->GetNumberOfCaloClusters(); i++) {
3542 clu = fV0Reader->GetESDEvent()->GetCaloCluster(i);
3543 if ( !clu->IsPHOS() || clu->E()<0.1 ) continue;
3544 clu ->GetMomentum(pPHOS ,vtx);
3545 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
3546 AliKFParticle * twoGammaDecayCandidateDaughter0 = (AliKFParticle *)fKFReconstructedGammasTClone->At(firstGammaIndex);
3547 gammaGammaConv.SetXYZM(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz(),0.);
3548 gammaPHOS.SetXYZM(pPHOS.Px(),pPHOS.Py(),pPHOS.Pz(),0.);
3549 pi0GammaConvPHOS=gammaGammaConv+gammaPHOS;
3550 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS",pi0GammaConvPHOS.M());
3551 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvPHOS",pi0GammaConvPHOS.M(),pi0GammaConvPHOS.Pt());
3553 TVector3 v3D0(twoGammaDecayCandidateDaughter0->Px(),twoGammaDecayCandidateDaughter0->Py(),twoGammaDecayCandidateDaughter0->Pz());
3554 TVector3 v3D1(gammaPHOS.Px(),gammaPHOS.Py(),gammaPHOS.Pz());
3555 Double_t opanConvPHOS= v3D0.Angle(v3D1);
3556 if ( opanConvPHOS < 0.35){
3557 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS_OpanLow",pi0GammaConvPHOS.M());
3559 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvPHOS_OpanHigh",pi0GammaConvPHOS.M());
3564 // Now the LorentVector pPHOS is obtained and can be paired with the converted proton
3566 //==== End of the PHOS cluster selection ============
3567 TLorentzVector pEMCAL;
3568 TLorentzVector gammaEMCAL;
3569 TLorentzVector pi0GammaConvEMCAL;
3570 TLorentzVector pi0GammaConvEMCALBck;
3572 for (Int_t i=0; i<fV0Reader->GetESDEvent()->GetNumberOfCaloClusters(); i++) {
3573 clu = fV0Reader->GetESDEvent()->GetCaloCluster(i);
3574 if ( !clu->IsEMCAL() || clu->E()<0.1 ) continue;
3575 if (clu->GetNCells() <= 1) continue;
3576 if ( clu->GetTOF()*1e9 < 550 || clu->GetTOF()*1e9 > 750) continue;
3578 clu ->GetMomentum(pEMCAL ,vtx);
3579 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
3580 AliKFParticle * twoGammaDecayCandidateDaughter0 = (AliKFParticle *)fKFReconstructedGammasTClone->At(firstGammaIndex);
3581 gammaGammaConv.SetXYZM(twoGammaDecayCandidateDaughter0->Px(),
3582 twoGammaDecayCandidateDaughter0->Py(),
3583 twoGammaDecayCandidateDaughter0->Pz(),0.);
3584 gammaEMCAL.SetXYZM(pEMCAL.Px(),pEMCAL.Py(),pEMCAL.Pz(),0.);
3585 pi0GammaConvEMCAL=gammaGammaConv+gammaEMCAL;
3586 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL",pi0GammaConvEMCAL.M());
3587 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvEMCAL",pi0GammaConvEMCAL.M(),pi0GammaConvEMCAL.Pt());
3588 TVector3 v3D0(twoGammaDecayCandidateDaughter0->Px(),
3589 twoGammaDecayCandidateDaughter0->Py(),
3590 twoGammaDecayCandidateDaughter0->Pz());
3591 TVector3 v3D1(gammaEMCAL.Px(),gammaEMCAL.Py(),gammaEMCAL.Pz());
3594 Double_t opanConvEMCAL= v3D0.Angle(v3D1);
3595 if ( opanConvEMCAL < 0.35){
3596 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_OpanLow",pi0GammaConvEMCAL.M());
3598 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_OpanHigh",pi0GammaConvEMCAL.M());
3602 if(fCalculateBackground){
3603 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
3604 AliGammaConversionKFVector * previousEventV0s = fV0Reader->GetBGGoodV0s(nEventsInBG);
3605 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3606 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3607 gammaGammaConvBck.SetXYZM(previousGoodV0.Px(),
3608 previousGoodV0.Py(),
3609 previousGoodV0.Pz(),0.);
3610 pi0GammaConvEMCALBck=gammaGammaConvBck+gammaEMCAL;
3611 fHistograms->FillHistogram("ESD_Mother_InvMass_GammaConvEMCAL_Bck",pi0GammaConvEMCALBck.M());
3612 fHistograms->FillHistogram("ESD_Mother_InvMass_vs_Pt_GammaConvEMCAL_Bck",pi0GammaConvEMCALBck.M(),
3613 pi0GammaConvEMCALBck.Pt());
3617 // Now the LorentVector pEMCAL is obtained and can be paired with the converted proton
3618 } // end of checking if background photons are available
3620 //==== End of the PHOS cluster selection ============
3625 void AliAnalysisTaskGammaConversion::MoveParticleAccordingToVertex(AliKFParticle * particle,const AliGammaConversionBGHandler::GammaConversionVertex *vertex){
3626 //see header file for documentation
3628 Double_t dx = vertex->fX - fESDEvent->GetPrimaryVertex()->GetX();
3629 Double_t dy = vertex->fY - fESDEvent->GetPrimaryVertex()->GetY();
3630 Double_t dz = vertex->fZ - fESDEvent->GetPrimaryVertex()->GetZ();
3632 // cout<<"dx, dy, dz: ["<<dx<<","<<dy<<","<<dz<<"]"<<endl;
3633 particle->X() = particle->GetX() - dx;
3634 particle->Y() = particle->GetY() - dy;
3635 particle->Z() = particle->GetZ() - dz;
3638 void AliAnalysisTaskGammaConversion::RotateKFParticle(AliKFParticle * kfParticle,Double_t angle){
3639 // Before rotate needs to be moved to position 0,0,0, ; move back after rotation
3640 Double_t dx = fESDEvent->GetPrimaryVertex()->GetX()-0.;
3641 Double_t dy = fESDEvent->GetPrimaryVertex()->GetY()-0.;
3642 Double_t dz = fESDEvent->GetPrimaryVertex()->GetZ()-0.;
3644 kfParticle->X() = kfParticle->GetX() - dx;
3645 kfParticle->Y() = kfParticle->GetY() - dy;
3646 kfParticle->Z() = kfParticle->GetZ() - dz;
3649 // Rotate the kf particle
3650 Double_t c = cos(angle);
3651 Double_t s = sin(angle);
3654 for( Int_t i=0; i<8; i++ ){
3655 for( Int_t j=0; j<8; j++){
3659 for( int i=0; i<8; i++ ){
3662 mA[0][0] = c; mA[0][1] = s;
3663 mA[1][0] = -s; mA[1][1] = c;
3664 mA[3][3] = c; mA[3][4] = s;
3665 mA[4][3] = -s; mA[4][4] = c;
3669 for( Int_t i=0; i<8; i++ ){
3671 for( Int_t k=0; k<8; k++){
3672 mAp[i]+=mA[i][k] * kfParticle->GetParameter(k);
3676 for( Int_t i=0; i<8; i++){
3677 kfParticle->Parameter(i) = mAp[i];
3680 for( Int_t i=0; i<8; i++ ){
3681 for( Int_t j=0; j<8; j++ ){
3683 for( Int_t k=0; k<8; k++ ){
3684 mAC[i][j]+= mA[i][k] * kfParticle->GetCovariance(k,j);
3689 for( Int_t i=0; i<8; i++ ){
3690 for( Int_t j=0; j<=i; j++ ){
3692 for( Int_t k=0; k<8; k++){
3693 xx+= mAC[i][k]*mA[j][k];
3695 kfParticle->Covariance(i,j) = xx;
3699 Double_t dx1 = 0.-fESDEvent->GetPrimaryVertex()->GetX();
3700 Double_t dy1 = 0.-fESDEvent->GetPrimaryVertex()->GetY();
3701 Double_t dz1 = 0.-fESDEvent->GetPrimaryVertex()->GetZ();
3703 kfParticle->X() = kfParticle->GetX() - dx1;
3704 kfParticle->Y() = kfParticle->GetY() - dy1;
3705 kfParticle->Z() = kfParticle->GetZ() - dz1;
3710 void AliAnalysisTaskGammaConversion::CalculateBackground(){
3711 // see header file for documentation
3714 TClonesArray * currentEventV0s = fV0Reader->GetCurrentEventGoodV0s();
3716 AliGammaConversionBGHandler * bgHandler = fV0Reader->GetBGHandler();
3718 Int_t zbin= bgHandler->GetZBinIndex(fV0Reader->GetVertexZ());
3720 if(fUseTrackMultiplicityForBG == kTRUE){
3721 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->CountESDTracks());
3724 mbin = bgHandler->GetMultiplicityBinIndex(fV0Reader->GetNGoodV0s());
3727 if(fDoRotation == kTRUE){
3729 for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
3730 AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent));
3731 for(Int_t iCurrent2=iCurrent+1;iCurrent2<currentEventV0s->GetEntriesFast();iCurrent2++){
3732 for(Int_t nRandom=0;nRandom<fNRandomEventsForBG;nRandom++){
3734 AliKFParticle currentEventGoodV02 = *(AliKFParticle *)(currentEventV0s->At(iCurrent2));
3736 if(fCheckBGProbability == kTRUE){
3737 Double_t massBGprob =0.;
3738 Double_t widthBGprob = 0.;
3739 AliKFParticle *backgroundCandidateProb = new AliKFParticle(currentEventGoodV0,currentEventGoodV02);
3740 backgroundCandidateProb->GetMass(massBGprob,widthBGprob);
3741 if(massBGprob>0.1 && massBGprob<0.14){
3742 if(fRandom.Rndm()>bgHandler->GetBGProb(zbin,mbin)){
3743 delete backgroundCandidateProb;
3747 delete backgroundCandidateProb;
3750 Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
3752 Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
3754 RotateKFParticle(¤tEventGoodV02,rotationValue);
3756 AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,currentEventGoodV02);
3758 Double_t massBG =0.;
3759 Double_t widthBG = 0.;
3760 Double_t chi2BG =10000.;
3761 backgroundCandidate->GetMass(massBG,widthBG);
3762 // if(backgroundCandidate->GetNDF()>0){
3763 chi2BG = backgroundCandidate->GetChi2();
3764 if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
3766 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
3767 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
3769 Double_t openingAngleBG = currentEventGoodV0.GetAngle(currentEventGoodV02);
3772 if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0) {
3775 rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
3777 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
3778 delete backgroundCandidate;
3779 continue; // rapidity cut
3784 if( (currentEventGoodV0.GetE()+currentEventGoodV02.GetE()) != 0){
3785 alfa=TMath::Abs((currentEventGoodV0.GetE()-currentEventGoodV02.GetE())
3786 /(currentEventGoodV0.GetE()+currentEventGoodV02.GetE()));
3790 if(openingAngleBG < fMinOpeningAngleGhostCut ){
3791 delete backgroundCandidate;
3792 continue; // minimum opening angle to avoid using ghosttracks
3796 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3797 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
3798 fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
3799 fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
3800 fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
3801 fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
3802 fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
3803 fHistograms->FillHistogram("ESD_Background_Mass", massBG);
3804 fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3805 fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3806 fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
3807 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
3808 fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
3809 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
3811 if(massBG>0.1 && massBG<0.15){
3812 fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
3813 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3815 if(massBG>0.5 && massBG<0.57){
3816 fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
3817 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3820 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(currentEventGoodV02.GetEta())<0.9 ){
3821 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
3822 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
3825 fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
3826 fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
3827 fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin), momentumVectorbackgroundCandidate.Pt());
3828 fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
3829 fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
3830 fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
3831 fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
3832 fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3833 fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3834 fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
3835 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3836 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
3838 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(currentEventGoodV02.GetEta())<0.9 ){
3839 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3840 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
3844 fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
3849 delete backgroundCandidate;
3854 else{ // means no rotation
3855 AliGammaConversionBGHandler::GammaConversionVertex *bgEventVertex = NULL;
3857 if(fUseTrackMultiplicityForBG){
3858 // cout<<"Using charged track multiplicity for background calculation"<<endl;
3859 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
3861 AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);//fV0Reader->GetBGGoodV0s(nEventsInBG);
3863 if(fMoveParticleAccordingToVertex == kTRUE){
3864 bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
3867 for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
3868 AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent));
3869 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3870 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3871 AliKFParticle previousGoodV0test = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
3873 //cout<<"Primary Vertex event: ["<<fESDEvent->GetPrimaryVertex()->GetX()<<","<<fESDEvent->GetPrimaryVertex()->GetY()<<","<<fESDEvent->GetPrimaryVertex()->GetZ()<<"]"<<endl;
3874 //cout<<"BG prim Vertex event: ["<<bgEventVertex->fX<<","<<bgEventVertex->fY<<","<<bgEventVertex->fZ<<"]"<<endl;
3876 //cout<<"XYZ of particle before transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
3877 if(fMoveParticleAccordingToVertex == kTRUE){
3878 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
3880 //cout<<"XYZ of particle after transport: ["<<previousGoodV0.X()<<","<<previousGoodV0.Y()<<","<<previousGoodV0.Z()<<"]"<<endl;
3882 AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
3884 Double_t massBG =0.;
3885 Double_t widthBG = 0.;
3886 Double_t chi2BG =10000.;
3887 backgroundCandidate->GetMass(massBG,widthBG);
3889 // if(backgroundCandidate->GetNDF()>0){
3890 // chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
3891 chi2BG = backgroundCandidate->GetChi2();
3892 if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
3894 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
3895 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
3897 Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
3901 if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() <= 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() <= 0){
3902 cout << "Error: |Pz| > E !!!! " << endl;
3905 rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
3907 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
3908 delete backgroundCandidate;
3909 continue; // rapidity cut
3914 if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
3915 alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
3916 /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
3920 if(openingAngleBG < fMinOpeningAngleGhostCut ){
3921 delete backgroundCandidate;
3922 continue; // minimum opening angle to avoid using ghosttracks
3926 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
3927 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
3928 fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
3929 fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
3930 fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
3931 fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
3932 fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
3933 fHistograms->FillHistogram("ESD_Background_Mass", massBG);
3934 fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3935 fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3936 fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
3937 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
3938 fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
3939 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
3941 if(massBG>0.1 && massBG<0.15){
3942 fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
3943 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3945 if(massBG>0.5 && massBG<0.57){
3946 fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
3947 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
3950 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
3951 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
3952 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
3956 fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
3957 fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
3958 fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin), momentumVectorbackgroundCandidate.Pt());
3959 fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
3960 fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
3961 fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
3962 fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
3963 fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
3964 fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
3965 fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
3966 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3967 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
3969 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
3970 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
3971 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
3976 fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
3980 delete backgroundCandidate;
3985 else{ // means using #V0s for multiplicity
3987 // cout<<"Using the v0 multiplicity to calculate background"<<endl;
3989 fHistograms->FillHistogram("ESD_Background_z_m",zbin,mbin);
3990 fHistograms->FillHistogram("ESD_Mother_multpilicityVSv0s",fV0Reader->CountESDTracks(),fV0Reader->GetNumberOfV0s());
3992 for(Int_t nEventsInBG=0;nEventsInBG <fV0Reader->GetNBGEvents();nEventsInBG++){
3993 AliGammaConversionKFVector * previousEventV0s = bgHandler->GetBGGoodV0s(zbin,mbin,nEventsInBG);// fV0Reader->GetBGGoodV0s(nEventsInBG);
3994 if(previousEventV0s){
3996 if(fMoveParticleAccordingToVertex == kTRUE){
3997 bgEventVertex = bgHandler->GetBGEventVertex(zbin,mbin,nEventsInBG);
4000 for(Int_t iCurrent=0;iCurrent<currentEventV0s->GetEntriesFast();iCurrent++){
4001 AliKFParticle currentEventGoodV0 = *(AliKFParticle *)(currentEventV0s->At(iCurrent));
4002 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
4003 AliKFParticle previousGoodV0 = (AliKFParticle)(*(previousEventV0s->at(iPrevious)));
4005 if(fMoveParticleAccordingToVertex == kTRUE){
4006 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
4009 AliKFParticle *backgroundCandidate = new AliKFParticle(currentEventGoodV0,previousGoodV0);
4010 Double_t massBG =0.;
4011 Double_t widthBG = 0.;
4012 Double_t chi2BG =10000.;
4013 backgroundCandidate->GetMass(massBG,widthBG);
4015 /* if(backgroundCandidate->GetNDF()>0){
4016 chi2BG = backgroundCandidate->GetChi2()/backgroundCandidate->GetNDF();
4017 {//remember to remove
4018 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
4019 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
4021 Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
4022 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle_nochi2", openingAngleBG);
4025 chi2BG = backgroundCandidate->GetChi2();
4026 if((chi2BG>0 && chi2BG<fV0Reader->GetChi2CutMeson()) || fApplyChi2Cut == kFALSE){
4027 TVector3 momentumVectorbackgroundCandidate(backgroundCandidate->GetPx(),backgroundCandidate->GetPy(),backgroundCandidate->GetPz());
4028 TVector3 spaceVectorbackgroundCandidate(backgroundCandidate->GetX(),backgroundCandidate->GetY(),backgroundCandidate->GetZ());
4030 Double_t openingAngleBG = currentEventGoodV0.GetAngle(previousGoodV0);
4033 if(backgroundCandidate->GetE() - backgroundCandidate->GetPz() == 0 || backgroundCandidate->GetE() + backgroundCandidate->GetPz() == 0){
4036 rapidity = 0.5*(TMath::Log((backgroundCandidate->GetE() +backgroundCandidate->GetPz()) / (backgroundCandidate->GetE()-backgroundCandidate->GetPz())));
4038 if(TMath::Abs(rapidity) > fV0Reader->GetRapidityMesonCut() ){
4039 delete backgroundCandidate;
4040 continue; // rapidity cut
4045 if( (currentEventGoodV0.GetE()+previousGoodV0.GetE()) != 0){
4046 alfa=TMath::Abs((currentEventGoodV0.GetE()-previousGoodV0.GetE())
4047 /(currentEventGoodV0.GetE()+previousGoodV0.GetE()));
4051 if(openingAngleBG < fMinOpeningAngleGhostCut ){
4052 delete backgroundCandidate;
4053 continue; // minimum opening angle to avoid using ghosttracks
4056 if(alfa>fV0Reader->GetAlphaMinCutMeson() && alfa<fV0Reader->GetAlphaCutMeson()){
4057 fHistograms->FillHistogram("ESD_Background_GammaDaughter_OpeningAngle", openingAngleBG);
4058 fHistograms->FillHistogram("ESD_Background_Energy", backgroundCandidate->GetE());
4059 fHistograms->FillHistogram("ESD_Background_Pt", momentumVectorbackgroundCandidate.Pt());
4060 fHistograms->FillHistogram("ESD_Background_Eta", momentumVectorbackgroundCandidate.Eta());
4061 fHistograms->FillHistogram("ESD_Background_Rapidity", rapidity);
4062 fHistograms->FillHistogram("ESD_Background_Phi", spaceVectorbackgroundCandidate.Phi());
4063 fHistograms->FillHistogram("ESD_Background_Mass", massBG);
4064 fHistograms->FillHistogram("ESD_Background_R", spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
4065 fHistograms->FillHistogram("ESD_Background_ZR", backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
4066 fHistograms->FillHistogram("ESD_Background_XY", backgroundCandidate->GetX(), backgroundCandidate->GetY());
4067 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt",massBG,momentumVectorbackgroundCandidate.Pt());
4068 fHistograms->FillHistogram("ESD_Background_InvMass",massBG);
4071 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_alpha",massBG,momentumVectorbackgroundCandidate.Pt());
4073 if(massBG>0.1 && massBG<0.15){
4074 fHistograms->FillHistogram("ESD_Background_alfa_Pi0", alfa);
4075 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Pi0", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
4077 if(massBG>0.5 && massBG<0.57){
4078 fHistograms->FillHistogram("ESD_Background_alfa_Eta", alfa);
4079 fHistograms->FillHistogram("ESD_Background_Pt_alpha_Eta", momentumVectorbackgroundCandidate.Pt(), alfa); //RR_alpha
4082 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
4083 fHistograms->FillHistogram("ESD_Background_InvMass_vs_Pt_Fiducial",massBG,momentumVectorbackgroundCandidate.Pt());
4084 fHistograms->FillHistogram("ESD_Background_InvMass_Fiducial",massBG);
4087 if(massBG>0.5 && massBG<0.6){
4088 fHistograms->FillHistogram("ESD_Background_alfa_pt0506",momentumVectorbackgroundCandidate.Pt(),alfa);
4090 if(massBG>0.3 && massBG<0.4){
4091 fHistograms->FillHistogram("ESD_Background_alfa_pt0304",momentumVectorbackgroundCandidate.Pt(),alfa);
4095 fHistograms->FillHistogram(Form("%d%dESD_Background_GammaDaughter_OpeningAngle",zbin,mbin), openingAngleBG);
4096 fHistograms->FillHistogram(Form("%d%dESD_Background_Energy",zbin,mbin), backgroundCandidate->GetE());
4097 fHistograms->FillHistogram(Form("%d%dESD_Background_Pt",zbin,mbin), momentumVectorbackgroundCandidate.Pt());
4098 fHistograms->FillHistogram(Form("%d%dESD_Background_Eta",zbin,mbin), momentumVectorbackgroundCandidate.Eta());
4099 fHistograms->FillHistogram(Form("%d%dESD_Background_Rapidity",zbin,mbin), rapidity);
4100 fHistograms->FillHistogram(Form("%d%dESD_Background_Phi",zbin,mbin), spaceVectorbackgroundCandidate.Phi());
4101 fHistograms->FillHistogram(Form("%d%dESD_Background_Mass",zbin,mbin), massBG);
4102 fHistograms->FillHistogram(Form("%d%dESD_Background_R",zbin,mbin), spaceVectorbackgroundCandidate.Pt()); // Pt in Space == R!!!!
4103 fHistograms->FillHistogram(Form("%d%dESD_Background_ZR",zbin,mbin), backgroundCandidate->GetZ(), spaceVectorbackgroundCandidate.Pt());
4104 fHistograms->FillHistogram(Form("%d%dESD_Background_XY",zbin,mbin), backgroundCandidate->GetX(), backgroundCandidate->GetY());
4105 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
4106 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass",zbin,mbin),massBG);
4108 if ( TMath::Abs(currentEventGoodV0.GetEta())<0.9 && TMath::Abs(previousGoodV0.GetEta())<0.9 ){
4109 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_vs_Pt_Fiducial",zbin,mbin),massBG,momentumVectorbackgroundCandidate.Pt());
4110 fHistograms->FillHistogram(Form("%d%dESD_Background_InvMass_Fiducial",zbin,mbin),massBG);
4115 fHistograms->FillHistogram("ESD_Background_InvMass_vs_E_alpha",massBG ,backgroundCandidate->GetE());
4119 delete backgroundCandidate;
4124 } // end else (means use #v0s as multiplicity)
4125 } // end no rotation
4129 void AliAnalysisTaskGammaConversion::ProcessGammasForGammaJetAnalysis(){
4130 //ProcessGammasForGammaJetAnalysis
4132 Double_t distIsoMin;
4134 CreateListOfChargedParticles();
4137 // for(UInt_t gammaIndex=0;gammaIndex<fKFReconstructedGammas.size();gammaIndex++){
4138 for(Int_t gammaIndex=0;gammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();gammaIndex++){
4139 AliKFParticle * currentGamma = (AliKFParticle*)fKFReconstructedGammasTClone->At(gammaIndex);
4140 TVector3 momentumVectorCurrentGamma(currentGamma->GetPx(),currentGamma->GetPy(),currentGamma->GetPz());
4141 if( momentumVectorCurrentGamma.Pt()> fMinPtForGammaJet){
4142 distIsoMin=GetMinimumDistanceToCharge(gammaIndex);
4143 if (distIsoMin > fMinIsoConeSize && fLeadingChargedIndex>=0){
4144 CalculateJetCone(gammaIndex);
4150 //____________________________________________________________________
4151 Bool_t AliAnalysisTaskGammaConversion::IsGoodImpPar(const AliESDtrack *const track)
4154 // check whether particle has good DCAr(Pt) impact
4155 // parameter. Only for TPC+ITS tracks (7*sigma cut)
4156 // Origin: Andrea Dainese
4159 Float_t d0z0[2],covd0z0[3];
4160 track->GetImpactParameters(d0z0,covd0z0);
4161 Float_t sigma= 0.0050+0.0060/TMath::Power(track->Pt(),0.9);
4162 Float_t d0max = 7.*sigma;
4163 if(TMath::Abs(d0z0[0]) < d0max) return kTRUE;
4169 void AliAnalysisTaskGammaConversion::CreateListOfChargedParticles(){
4170 // CreateListOfChargedParticles
4172 fESDEvent = fV0Reader->GetESDEvent();
4173 Int_t numberOfESDTracks=0;
4174 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
4175 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
4180 // Not needed if Standard function used.
4181 // if(!IsGoodImpPar(curTrack)){
4185 if(fEsdTrackCuts->AcceptTrack(curTrack) ){
4186 new((*fChargedParticles)[fChargedParticles->GetEntriesFast()]) AliESDtrack(*curTrack);
4187 // fChargedParticles.push_back(curTrack);
4188 fChargedParticlesId.push_back(iTracks);
4189 numberOfESDTracks++;
4192 // Moved to UserExec using CountAcceptedTracks function. runjet is not needed by default
4193 // fHistograms->FillHistogram("ESD_NumberOfGoodESDTracks",numberOfESDTracks);
4194 // cout<<"esdtracks::"<< numberOfESDTracks<<endl;
4195 // if (fV0Reader->GetNumberOfContributorsVtx()>=1){
4196 // fHistograms->FillHistogram("ESD_NumberOfGoodESDTracksVtx",numberOfESDTracks);
4200 void AliAnalysisTaskGammaConversion::CalculateJetCone(Int_t gammaIndex){
4204 Double_t coneSize=0.3;
4207 // AliKFParticle * currentGamma = &fKFReconstructedGammas[gammaIndex];
4208 AliKFParticle * currentGamma = (AliKFParticle*)fKFReconstructedGammasTClone->At(gammaIndex);
4210 TVector3 momentumVectorCurrentGamma(currentGamma->GetPx(),currentGamma->GetPy(),currentGamma->GetPz());
4212 AliESDtrack* leadingCharged = (AliESDtrack*)(fChargedParticles->At(fLeadingChargedIndex));
4214 Double_t momLeadingCharged[3];
4215 leadingCharged->GetConstrainedPxPyPz(momLeadingCharged);
4217 TVector3 momentumVectorLeadingCharged(momLeadingCharged[0],momLeadingCharged[1],momLeadingCharged[2]);
4219 Double_t phi1=momentumVectorLeadingCharged.Phi();
4220 Double_t eta1=momentumVectorLeadingCharged.Eta();
4221 Double_t phi3=momentumVectorCurrentGamma.Phi();
4223 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
4224 AliESDtrack* curTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
4225 Int_t chId = fChargedParticlesId[iCh];
4226 if(fLeadingChargedIndex==chId || fLeadingChargedIndex==chId) continue;
4228 curTrack->GetConstrainedPxPyPz(mom);
4229 TVector3 momentumVectorChargedParticle(mom[0],mom[1],mom[2]);
4230 Double_t phi2=momentumVectorChargedParticle.Phi();
4231 Double_t eta2=momentumVectorChargedParticle.Eta();
4235 if( TMath::Abs(phi2 - phi1) <= ( TMath::TwoPi()-coneSize) ){
4236 cone = TMath::Sqrt( TMath::Power((eta2-eta1),2)+ TMath::Power((phi2-phi1),2) );
4238 if( (phi2 - phi1)> TMath::TwoPi()-coneSize ){
4239 cone = TMath::Sqrt( TMath::Power((eta2-eta1),2)+ TMath::Power((phi2-TMath::TwoPi()-phi1),2) );
4241 if( (phi2 - phi1)< -(TMath::TwoPi()-coneSize) ){
4242 cone = TMath::Sqrt( TMath::Power((eta2-eta1),2)+ TMath::Power((phi2+TMath::TwoPi()-phi1),2) );
4246 if(cone <coneSize&& momentumVectorChargedParticle.Pt()>fMinPtJetCone ){
4247 ptJet+= momentumVectorChargedParticle.Pt();
4248 Double_t ffzHdrGam = momentumVectorChargedParticle.Pt()/momentumVectorCurrentGamma.Pt();
4249 Double_t imbalanceHdrGam=-momentumVectorChargedParticle.Dot(momentumVectorCurrentGamma)/momentumVectorCurrentGamma.Mag2();
4250 fHistograms->FillHistogram("ESD_FFzHdrGam",ffzHdrGam);
4251 fHistograms->FillHistogram("ESD_ImbalanceHdrGam",imbalanceHdrGam);
4255 Double_t dphiHdrGam=phi3-phi2;
4256 if ( dphiHdrGam < (-TMath::PiOver2())){
4257 dphiHdrGam+=(TMath::TwoPi());
4260 if ( dphiHdrGam > (3.*TMath::PiOver2()) ){
4261 dphiHdrGam-=(TMath::TwoPi());
4264 if (momentumVectorChargedParticle.Pt()>fMinPtGamChargedCorr){
4265 fHistograms->FillHistogram("ESD_dphiHdrGamIsolated",dphiHdrGam);
4274 Double_t AliAnalysisTaskGammaConversion::GetMinimumDistanceToCharge(Int_t indexHighestPtGamma){
4275 // GetMinimumDistanceToCharge
4277 Double_t fIsoMin=100.;
4278 Double_t ptLeadingCharged=-1.;
4280 fLeadingChargedIndex=-1;
4282 AliKFConversionPhoton * gammaHighestPt = (AliKFConversionPhoton*)fKFReconstructedGammasTClone->At(indexHighestPtGamma);
4283 TVector3 momentumVectorgammaHighestPt(gammaHighestPt->GetPx(),gammaHighestPt->GetPy(),gammaHighestPt->GetPz());
4285 Double_t phi1=momentumVectorgammaHighestPt.Phi();
4286 Double_t eta1=momentumVectorgammaHighestPt.Eta();
4288 for(Int_t iCh=0;iCh<fChargedParticles->GetEntriesFast();iCh++){
4289 AliESDtrack* curTrack = (AliESDtrack*)(fChargedParticles->At(iCh));
4290 Int_t chId = fChargedParticlesId[iCh];
4291 if(gammaHighestPt->GetTrackLabelPositive()==chId || gammaHighestPt->GetTrackLabelNegative()==chId) continue;
4293 curTrack->GetConstrainedPxPyPz(mom);
4294 TVector3 momentumVectorChargedParticle(mom[0],mom[1],mom[2]);
4295 Double_t phi2=momentumVectorChargedParticle.Phi();
4296 Double_t eta2=momentumVectorChargedParticle.Eta();
4297 Double_t iso=pow( (pow( (eta1-eta2),2)+ pow((phi1-phi2),2)),0.5 );
4299 if(momentumVectorChargedParticle.Pt()>fMinPtIsoCone ){
4305 Double_t dphiHdrGam=phi1-phi2;
4306 if ( dphiHdrGam < (-TMath::PiOver2())){
4307 dphiHdrGam+=(TMath::TwoPi());
4310 if ( dphiHdrGam > (3.*TMath::PiOver2()) ){
4311 dphiHdrGam-=(TMath::TwoPi());
4313 if (momentumVectorChargedParticle.Pt()>fMinPtGamChargedCorr){
4314 fHistograms->FillHistogram("ESD_dphiHdrGam",dphiHdrGam);
4317 if (dphiHdrGam>0.9*TMath::Pi() && dphiHdrGam<1.1*TMath::Pi()){
4318 if (momentumVectorChargedParticle.Pt()> ptLeadingCharged && momentumVectorChargedParticle.Pt()>0.1*momentumVectorgammaHighestPt.Pt()){
4319 ptLeadingCharged=momentumVectorChargedParticle.Pt();
4320 fLeadingChargedIndex=iCh;
4325 fHistograms->FillHistogram("ESD_MinimumIsoDistance",fIsoMin);
4330 Int_t AliAnalysisTaskGammaConversion::GetIndexHighestPtGamma(){
4331 //GetIndexHighestPtGamma
4333 Int_t indexHighestPtGamma=-1;
4335 fGammaPtHighest = -100.;
4337 for(Int_t firstGammaIndex=0;firstGammaIndex<fKFReconstructedGammasTClone->GetEntriesFast();firstGammaIndex++){
4338 AliKFParticle * gammaHighestPtCandidate = (AliKFParticle*)fKFReconstructedGammasTClone->At(firstGammaIndex);
4339 TVector3 momentumVectorgammaHighestPtCandidate(gammaHighestPtCandidate->GetPx(),gammaHighestPtCandidate->GetPy(),gammaHighestPtCandidate->GetPz());
4340 if (momentumVectorgammaHighestPtCandidate.Pt() > fGammaPtHighest){
4341 fGammaPtHighest=momentumVectorgammaHighestPtCandidate.Pt();
4342 //gammaHighestPt = gammaHighestPtCandidate;
4343 indexHighestPtGamma=firstGammaIndex;
4347 return indexHighestPtGamma;
4352 void AliAnalysisTaskGammaConversion::Terminate(Option_t */*option*/)
4354 // Terminate analysis
4356 AliDebug(1,"Do nothing in Terminate");
4359 void AliAnalysisTaskGammaConversion::UserCreateOutputObjects()
4365 if(!fAODGamma) fAODGamma = new TClonesArray("AliAODConversionPhoton", 0);
4366 else fAODGamma->Delete();
4367 fAODGamma->SetOwner(kTRUE);
4368 fAODGamma->SetName(Form("%s_gamma", fAODBranchName.Data()));
4370 if(GetDeltaAODFileName().Length() > 0) {
4371 AddAODBranch("TClonesArray", &fAODGamma, GetDeltaAODFileName().Data());
4372 AliAnalysisManager::GetAnalysisManager()->RegisterExtraFile(GetDeltaAODFileName().Data());
4374 AddAODBranch("TClonesArray", &fAODGamma);
4378 // Create the output container
4379 if(fOutputContainer != NULL){
4380 delete fOutputContainer;
4381 fOutputContainer = NULL;
4383 if(fOutputContainer == NULL){
4384 fOutputContainer = new TList();
4385 fOutputContainer->SetOwner(kTRUE);
4388 //Adding the histograms to the output container
4389 fHistograms->GetOutputContainer(fOutputContainer);
4393 if(fGammaNtuple == NULL){
4394 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);
4396 if(fNeutralMesonNtuple == NULL){
4397 fNeutralMesonNtuple = new TNtuple("NeutralMesonNtuple","NeutralMesonNtuple","test");
4399 TList * ntupleTList = new TList();
4400 ntupleTList->SetOwner(kTRUE);
4401 ntupleTList->SetName("Ntuple");
4402 ntupleTList->Add((TNtuple*)fGammaNtuple);
4403 fOutputContainer->Add(ntupleTList);
4406 fOutputContainer->SetName(GetName());
4408 PostData(0, fAODGamma);
4409 PostData(1, fOutputContainer);
4410 PostData(2, fCFManager->GetParticleContainer()); // for CF
4411 PostData(3, fAODGamma);
4414 Double_t AliAnalysisTaskGammaConversion::GetMCOpeningAngle(const TParticle* const daughter0, const TParticle* const daughter1) const{
4416 TVector3 v3D0(daughter0->Px(),daughter0->Py(),daughter0->Pz());
4417 TVector3 v3D1(daughter1->Px(),daughter1->Py(),daughter1->Pz());
4418 return v3D0.Angle(v3D1);
4421 void AliAnalysisTaskGammaConversion::CheckV0Efficiency(){
4422 // see header file for documentation
4424 vector<Int_t> indexOfGammaParticle;
4426 fStack = fV0Reader->GetMCStack();
4428 if(fV0Reader->CheckForPrimaryVertex() == kFALSE){
4429 return; // aborts if the primary vertex does not have contributors.
4432 for (Int_t iTracks = 0; iTracks < fStack->GetNprimary(); iTracks++) {
4433 TParticle* particle = (TParticle *)fStack->Particle(iTracks);
4434 if(particle->GetPdgCode()==22){ //Gamma
4435 if(particle->GetNDaughters() >= 2){
4436 TParticle* electron=NULL;
4437 TParticle* positron=NULL;
4438 for(Int_t daughterIndex=particle->GetFirstDaughter();daughterIndex<=particle->GetLastDaughter();daughterIndex++){
4439 TParticle *tmpDaughter = fStack->Particle(daughterIndex);
4440 if(tmpDaughter->GetUniqueID() == 5){
4441 if(tmpDaughter->GetPdgCode() == 11){
4442 electron = tmpDaughter;
4444 else if(tmpDaughter->GetPdgCode() == -11){
4445 positron = tmpDaughter;
4449 if(electron!=NULL && positron!=0){
4450 if(electron->R()<160){
4451 indexOfGammaParticle.push_back(iTracks);
4458 Int_t nFoundGammas=0;
4459 Int_t nNotFoundGammas=0;
4461 Int_t numberOfV0s = fV0Reader->GetNumberOfV0s();
4462 for(Int_t i=0;i<numberOfV0s;i++){
4463 fV0Reader->GetV0(i);
4465 if(fV0Reader->HasSameMCMother() == kFALSE){
4469 TParticle * negativeMC = (TParticle*)fV0Reader->GetNegativeMCParticle();
4470 TParticle * positiveMC = (TParticle*)fV0Reader->GetPositiveMCParticle();
4472 if(TMath::Abs(negativeMC->GetPdgCode())!=11 || TMath::Abs(positiveMC->GetPdgCode())!=11){
4475 if(negativeMC->GetPdgCode()==positiveMC->GetPdgCode()){
4479 if(fV0Reader->GetMotherMCParticle()->GetPdgCode() == 22){
4480 //TParticle * v0Gamma = fV0Reader->GetMotherMCParticle();
4481 for(UInt_t mcIndex=0;mcIndex<indexOfGammaParticle.size();mcIndex++){
4482 if(negativeMC->GetFirstMother()==indexOfGammaParticle[mcIndex]){
4493 //_____________________________________________________________________
4494 void AliAnalysisTaskGammaConversion::ProcessHadronicInteraction(AliESDEvent *event){
4496 // Process pairs of tracks to get a material budget map
4500 if (event) AliKFParticle::SetField(event->GetMagneticField()); // set mean magnetic field for KF particles
4501 // TTreeSRedirector *fpcstream = new TTreeSRedirector("eventInfoHadInt.root");
4502 // 1. Calculate total dEdx for all TPC tracks
4504 const Int_t kMinCl=50;
4505 const Double_t kEpsilon=0.000001;
4506 const Float_t kMinRatio=0.7;
4507 const Float_t kMinDist=1.5;
4508 const Float_t kMinDistChi2=8.; //
4509 const Float_t kMaxDistZ=300.; // max distanceZ
4510 const Float_t kMaxDistR=250.; // max distanceR
4511 const Double_t kMaxChi2 =36.; // maximal chi2 to define the vertex
4512 const Double_t kMaxDistVertexSec=2.; // maximal distance to secondary vertex
4513 const Double_t kMinPtHadTrack = fPtMinHadInt;
4514 Float_t arrayRBins[6] = {5.75,9.5,21.,35.,42.,55.};
4516 Double_t szz=1.; // number to be taken from the OCDB - now it can be hack
4517 Double_t stt = 0.006667; //
4520 AliESDVertex *vertexSPD = (AliESDVertex *)event->GetPrimaryVertexSPD();
4521 // AliESDVertex * spdVertex = (AliESDVertex *)event->GetPrimaryVertexSPD();
4522 // AliESDVertex * trackVertex = (AliESDVertex *)event->GetPrimaryVertexTracks();
4523 // AliESDVertex * tpcVertex = (AliESDVertex *)event->GetPrimaryVertexTPC();
4524 // AliESDTZERO * tzero = (AliESDTZERO *)event->GetESDTZERO() ;
4526 Double_t tpcSignalTotPrim=0;
4527 Double_t tpcSignalTotSec=0;
4531 Int_t ntracks=event->GetNumberOfTracks();
4532 if ( ntracks<=2 ) return;
4537 Float_t dca0[2]={0};
4538 Float_t dca1[2]={0};
4540 //1. Calculate total dEdx for primary and secondary tracks
4541 // and count primaries and secondaries
4542 Int_t *rejectTrack = new Int_t[ntracks];
4543 Float_t *trackUsedInVtx = new Float_t[ntracks];
4545 for (Int_t ii=0; ii<ntracks; ii++){
4546 trackUsedInVtx[ii] = 0.;
4548 Int_t nTracksCont = 0;
4550 for (Int_t itrack=0; itrack<ntracks; itrack++){
4551 AliESDtrack *track=event->GetTrack(itrack);
4552 rejectTrack[itrack]=0;
4553 if (!track) continue;
4554 if ((track->Pt())<kMinPtHadTrack){ rejectTrack[itrack]+=32; continue;}
4555 if (track->GetTPCNcls()<=kMinCl) {rejectTrack[itrack]+=64; continue;} // skip short tracks
4557 if ((1.+track->GetTPCNcls())/(1.+track->GetTPCNclsF())<=kMinRatio){rejectTrack[itrack]+=128; continue;}
4558 if (!track->GetInnerParam()) continue; // skip not TPC tracks
4559 if (track->GetKinkIndex(0)!=0) {rejectTrack[itrack]+=16;continue;} // skip kinks
4560 track->GetImpactParameters(dca,cov);
4561 if (TMath::Abs(dca[0])>kMaxDistR && TMath::Abs(dca[1])>kMaxDistZ){rejectTrack[itrack]+=256; continue;}
4562 // remove too dip secondaries
4563 if (TMath::Abs(dca[0])<kMinDist && TMath::Abs(dca[1])<kMinDist){
4564 tpcSignalTotPrim+=track->GetTPCsignal();
4566 rejectTrack[itrack]+=256;
4568 tpcSignalTotSec+=track->GetTPCsignal();
4571 if (cov[0]>kEpsilon &&TMath::Abs(dca[0])>kEpsilon &&TMath::Sqrt(dca[0]*dca[0]/(TMath::Abs(cov[0])))<kMinDistChi2) rejectTrack[itrack]+=1; // primary
4572 if (cov[0]>kEpsilon &&TMath::Abs(dca[0])>kEpsilon &&TMath::Abs(dca[0])<kMinDist) rejectTrack[itrack]+=1; // primary
4573 if (track->GetTPCsignal()<40) rejectTrack[itrack]+=16;
4575 if (CheckLooper(itrack, event)) rejectTrack[itrack]+=2; // looper
4576 if (CheckV0(itrack,event)) rejectTrack[itrack]+=4; //indentified V0 rejection (K0s, Lambda, gamma conv)
4578 // UInt_t status = track->GetStatus();
4579 if (!track->IsOn(AliVTrack::kITSrefit) && !fDoMCTruth){
4581 Double_t *covar = (Double_t*)track->GetInnerParam()->GetCovariance();
4583 //remove -systematic error estimate
4585 Double_t sigmazz = covar[track->GetIndex(1,1)];
4586 Double_t dr = TMath::Abs(TMath::Sqrt((track->GetX()*track->GetX()+track->GetY()*track->GetY())) - TMath::Sqrt((track->GetInnerParam()->GetX()*track->GetInnerParam()->GetX()+track->GetInnerParam()->GetY()*track->GetInnerParam()->GetY()))) ;
4588 Double_t sigmazz0 = sigmazz -szz*szz - stt*stt*dr*dr;
4589 // cout << "old sigma z: "<<sigmazz << " new sigma z: " << sigmazz0 << endl;
4590 if (sigmazz0<0) sigmazz0=0.1; // should not happen - the code should be protected
4591 covar[track->GetIndex(1,1)]=sigmazz0;
4593 // + rescale the correlation terms
4595 Double_t ratio = TMath::Sqrt(sigmazz0/sigmazz);
4596 for (Int_t index=0; index<5; index++){
4597 Int_t jindex = track->GetIndex(index,1);
4598 covar[jindex]*=ratio;
4605 // 2. Find secondary vertices - double loop
4608 AliKFVertex vertexStored[15];
4609 Int_t kVertexArr[15][7];
4610 for (Int_t ii = 0; ii < 15; ii++){
4611 for (Int_t bb = 0; bb < 7; bb++){
4612 kVertexArr[ii][bb] = 0;
4615 Int_t kTrackArr[500][7];
4616 for (Int_t ii = 0; ii < 500; ii++){
4617 for (Int_t bb = 0; bb < 7; bb++){
4618 kTrackArr[ii][bb] = 0;
4622 Int_t nVertices = 0;
4623 Int_t nVerticesPassed = 0;
4625 for (Int_t itrack0=0; itrack0<ntracks; itrack0++){
4626 if (rejectTrack[itrack0]) continue; // skip
4627 AliESDtrack *track0=event->GetTrack(itrack0);
4628 if (!track0) continue;
4630 track0->GetImpactParameters(dca[0],dca[1]);
4631 track0->GetImpactParameters(dca0[0],dca0[1]);
4633 AliKFParticle part0;
4634 if (!track0->IsOn(AliVTrack::kITSrefit)){
4635 part0=AliKFParticle(*track0->GetInnerParam(),211); //assuming pion mass
4637 part0=AliKFParticle(*track0,211); //assuming pion mass
4639 if (track0->Charge()*part0.Q()<0) part0.Q()*=-1; // change sign if opposite
4641 for (Int_t itrack1=itrack0+1; itrack1<ntracks; itrack1++){
4642 if (rejectTrack[itrack1]) continue; // skip
4643 AliESDtrack *track1=event->GetTrack(itrack1);
4644 if (!track1) continue;
4645 track1->GetImpactParameters(dca1[0],dca1[1]);
4646 track1->GetImpactParameters(dca[0],dca[1]);
4647 AliKFParticle part1; // assuming pion mass
4648 if (!track1->IsOn(AliVTrack::kITSrefit)){
4649 part1=AliKFParticle(*track1->GetInnerParam(),211); //assuming pion mass
4651 part1=AliKFParticle(*track1,211); //assuming pion mass
4653 if (track1->Charge()*part1.Q()<0) part1.Q()*=-1; // change sign if opposite
4660 if ((vertex.GetChi2()/vertex.GetNDF())> kMaxChi2) continue;
4661 if (TMath::Abs(vertex.GetX())>kMaxDistR) continue;
4662 if (TMath::Abs(vertex.GetY())>kMaxDistR) continue;
4663 if (TMath::Abs(vertex.GetZ())>kMaxDistZ) continue;
4664 Double_t errX2=vertex.GetErrX();
4665 Double_t errY2=vertex.GetErrY();
4666 Double_t errZ2=vertex.GetErrZ();
4668 Double_t err3D=TMath::Sqrt(errX2*errX2+errY2*errY2+errZ2*errZ2/10.);
4669 if (err3D>kMaxDistVertexSec) continue;
4670 if (err3D*TMath::Sqrt(vertex.GetChi2()+0.00001)>kMaxDistVertexSec) continue;
4673 dvertex += (vertexSPD->GetX()-vertex.GetX())*(vertexSPD->GetX()-vertex.GetX());
4674 dvertex += (vertexSPD->GetY()-vertex.GetY())*(vertexSPD->GetY()-vertex.GetY());
4675 dvertex += (vertexSPD->GetZ()-vertex.GetZ())*(vertexSPD->GetZ()-vertex.GetZ());
4676 dvertex=TMath::Sqrt(dvertex+0.00000001);
4677 if (err3D>0.2*dvertex) continue;
4678 if (err3D*TMath::Sqrt(vertex.GetChi2()+0.000001)>0.1*dvertex) continue;
4679 Double_t radius = TMath::Sqrt((vertex.GetX()*vertex.GetX()+vertex.GetY()*vertex.GetY()));
4681 for (Int_t bb= 0; bb < 6; bb++){
4682 if (radius > arrayRBins[bb]) {
4683 if (track0->HasPointOnITSLayer(bb) || track1->HasPointOnITSLayer(bb) ) continue;
4686 AliKFVertex vertex2;
4695 trackUsedInVtx[itrack0] +=1.;
4696 trackUsedInVtx[itrack1] +=1.;
4699 kTrackArr[itrack0][0]+= 1;
4700 kTrackArr[itrack1][0]+= 1;
4701 kVertexArr[nVertices][0] = 2;
4702 kVertexArr[nVertices][1] = 1;
4703 kVertexArr[nVertices][2] = itrack0;
4704 kVertexArr[nVertices][3] = itrack1;
4706 for (Int_t itrack2=0; itrack2<ntracks; itrack2++){
4707 if (rejectTrack[itrack2]) continue; // skip
4708 if (itrack2==itrack0) continue;
4709 if (itrack2==itrack1) continue;
4710 AliESDtrack *track2=event->GetTrack(itrack2);
4711 if (!track2) continue;
4712 track2->GetImpactParameters(dca[0],dca[1]);
4713 if (TMath::Abs(track2->GetD(vertex.GetX(), vertex.GetY(),event->GetMagneticField()))>kMaxDistVertexSec) continue;
4714 Double_t vtxx[3]={vertex2.GetX(),vertex2.GetY(),vertex2.GetZ()};
4715 Double_t svtxx[3]={vertex.GetErrX(),vertex.GetErrY(),vertex.GetErrZ()};
4716 AliESDVertex vtx(vtxx,svtxx);
4718 AliExternalTrackParam param;
4719 if (!track2->IsOn(AliVTrack::kITSrefit)){
4720 param= *track2->GetInnerParam(); //assuming pion mass
4724 Double_t delta[2]={0,0};
4725 if (!param.PropagateToDCA(&vtx,event->GetMagneticField(),kMaxDistVertexSec,delta)) continue;
4726 if (TMath::Abs(delta[0])>kMaxDistVertexSec) continue;
4727 if (TMath::Abs(delta[1])>kMaxDistVertexSec) continue;
4728 if (TMath::Abs(delta[0])>6.*TMath::Sqrt(param.GetSigmaY2()+vertex2.GetErrY()*vertex2.GetErrY())+0.1) continue;
4729 if (TMath::Abs(delta[1])>6.*TMath::Sqrt(param.GetSigmaZ2()+vertex2.GetErrZ()*vertex2.GetErrZ())+0.5) continue;
4731 AliKFParticle part2(param,211); // assuming pion mass
4732 if (track2->Charge()*part2.Q()<0) part2.Q()*=-1; // change sign if opposite
4734 for (Int_t cc= 0; cc < 6; cc++){
4735 if (radius > arrayRBins[cc]){
4736 if (track2->HasPointOnITSLayer(cc) ) continue;
4742 // rejectTrack[itrack0]+=10; // do noit reuse the track
4743 // rejectTrack[itrack1]+=10; // do not reuse the track
4744 // rejectTrack[itrack2]+=10;
4745 trackUsedInVtx[itrack2] +=1.;
4746 // cout << "track number " << itrack2 << " used times " << trackUsedInVtx[itrack2] << endl;
4748 kTrackArr[itrack2][0]+= 1;
4749 kVertexArr[nVertices][0] = nTracksCont;
4750 kVertexArr[nVertices][1] = 1;
4751 kVertexArr[nVertices][nTracksCont+1] = itrack2;
4754 // if (nVertices == 0){
4755 // cout << "new Event" << endl;
4757 // cout << "Vertex " << nVertices << " nTracks " << kVertexArr[nVertices][0] << endl;
4758 // for (Int_t ii = 2 ; ii < kVertexArr[nVertices][0]+2; ii++){
4759 // cout << "\t Track " << kVertexArr[nVertices][ii] << endl;
4761 vertexStored[nVertices]= vertex2;
4763 // Double_t errX=vertex2.GetErrX();
4764 // Double_t errY=vertex2.GetErrY();
4765 // Double_t errZ=vertex2.GetErrZ();
4766 // Double_t vx = vertex2.GetX();
4767 // Double_t vy = vertex2.GetY();
4768 // Double_t vz = vertex2.GetZ();
4769 // Double_t vr = sqrt((Double_t)(vx*vx + vy*vy));
4770 // Double_t vphi = vertex2.GetPhi();
4771 // Double_t vphi2 = TMath::ATan2(vy, vx);
4772 // cout << "\t Quality \t errX: " <<errX << "\t errY: " << errY << "\t errZ: " << errZ << "\t Chi2/ndf: " << vertex2.GetChi2()/vertex2.GetNDF() << endl;
4773 // cout << "\t Position \t x: " << vx << "\t y: " << vy << "\t z: " << vz <<"\t r: " << vr << "\t phi: " << vphi << "\t phi dir calc: " << vphi2 << endl;
4774 // Double_t vNDCA = vertex2.GetDcaV0Daughters()/vertex2.GetDistSigma()
4776 // (*fpcstream)<<"ntracks="<<ntracks<<
4777 // "ntracksTPC="<<ntracksTPC<<
4778 // "nPrim="<<nTPCPrim<< // number of primaries
4779 // "nSec="<<nTPCSec<< // number of secondaries
4780 // "sigPrim="<<tpcSignalTotPrim<< // total dEdx in primaries
4781 // "sigSec="<<tpcSignalTotSec<< // total dEdx in secondaries
4782 // "v.="<<&vertex<< // KF vertex
4783 // "v2.="<<&vertex2<< // KF vertex all tracks
4786 // "rphi0="<<dca0[0]<<
4787 // "rphi1="<<dca1[0]<<
4788 // "radius="<<radius<<
4795 // "err2D="<<err2D<<
4796 // "err3D="<<err3D<<
4797 // "dvertex="<<dvertex<<
4801 fHistograms->FillHistogram("ESD_HadIntQual_nTracks", ntracks);
4802 fHistograms->FillHistogram("ESD_HadIntQual_ntracksTPC", ntracksTPC);
4806 Int_t verticesRejectedInLoop = 0;
4807 for (Int_t ll = 0; ll < nVertices; ll++){
4808 if (kVertexArr[ll][1] == 0) continue;
4809 for (Int_t kk = 0; kk < nVertices; kk++){
4810 Int_t trackUsedTwice = 0;
4811 Int_t numberOfTracksUsedTwice = 0;
4812 Int_t trackNumberTrackUsedTwice[10];
4813 if (ll == kk) continue;
4814 if (kVertexArr[kk][1] == 0 || kVertexArr[ll][1] == 0 ) continue;
4815 // cout << "Vertex " << ll << " nTracks " << kVertexArr[ll][0] << endl;
4816 for (Int_t ii = 2 ; ii < kVertexArr[ll][0]+2; ii++){
4817 // cout << "\t Track " << kVertexArr[ll][ii] << endl;
4818 // cout << "\t Vertex " << kk << " nTracks " << kVertexArr[kk][0] << endl;
4819 for (Int_t jj = 2 ; jj < kVertexArr[kk][0]+2; jj++){
4820 // cout << "\t\t Track " << kVertexArr[kk][jj] << endl;
4821 if (kVertexArr[ll][ii] == kVertexArr[kk][jj]){
4822 // cout << "\t\t track used twice" << endl;
4824 trackNumberTrackUsedTwice[numberOfTracksUsedTwice] = kVertexArr[kk][jj];
4825 numberOfTracksUsedTwice++;
4830 if (trackUsedTwice){
4831 if (vertexStored[ll].GetChi2()/vertexStored[ll].GetNDF() < vertexStored[kk].GetChi2()/vertexStored[kk].GetNDF()){
4832 // cout << "\t Vertex " << kk <<"\t track used twice: " << numberOfTracksUsedTwice << "\t tracks left for vertex: " << kVertexArr[kk][0]-numberOfTracksUsedTwice << endl;
4833 if ( kVertexArr[kk][0]-numberOfTracksUsedTwice < 2){
4834 kVertexArr[kk][1] = 0;
4836 for (Int_t count = 0; count < numberOfTracksUsedTwice; count++){
4837 for (Int_t hh = 2; hh < kVertexArr[kk][0]+2; hh++){
4838 if (kVertexArr[kk][hh] == trackNumberTrackUsedTwice[count]){
4839 // cout << "\t track to be removed " << trackNumberTrackUsedTwice[count] << " from position "<< hh <<endl;
4840 for (Int_t ii = kVertexArr[kk][0]+2-hh; ii > 1; ii--){
4841 Int_t pos = kVertexArr[kk][0]+2-ii;
4842 kVertexArr[kk][pos] = kVertexArr[kk][pos+1];
4844 kVertexArr[kk][0] -=1;
4848 AliESDtrack *track0=event->GetTrack(kVertexArr[kk][2]);
4849 AliKFParticle part0;
4850 if (!track0->IsOn(AliVTrack::kITSrefit)){
4851 part0=AliKFParticle(*track0->GetInnerParam(),211); //assuming pion mass
4853 part0=AliKFParticle(*track0,211); //assuming pion mass
4856 if (track0->Charge()*part0.Q()<0) part0.Q()*=-1; // change sign if opposite
4861 // cout << "\t Vertex " << kk << " nTracks " << kVertexArr[kk][0] << endl;
4862 for (Int_t ii = 2 ; ii < kVertexArr[kk][0]+2; ii++){
4863 // cout << "\t \t Track " << kVertexArr[kk][ii] << endl;
4865 AliESDtrack *track1=event->GetTrack(kVertexArr[kk][ii]);
4866 AliKFParticle part1;
4867 if (!track1->IsOn(AliVTrack::kITSrefit)){
4868 part1=AliKFParticle(*track1->GetInnerParam(),211); //assuming pion mass
4870 part1=AliKFParticle(*track1,211); //assuming pion mass
4873 if (track1->Charge()*part1.Q()<0) part1.Q()*=-1; // change sign if opposite
4877 vertexStored[kk]=vertex;
4878 // cout << "\t removing tracks from vtx " << kk << "new chi2/ndf: " << vertexStored[kk].GetChi2()/vertexStored[kk].GetNDF() <<endl;
4879 // cout << "Vertex " << kk << " nTracks " << kVertexArr[kk][0] << endl;
4880 // for (Int_t ii = 2 ; ii < kVertexArr[kk][0]+2; ii++){
4881 // cout << "\t Track " << kVertexArr[kk][ii] << endl;
4883 // Double_t errX=vertex.GetErrX();
4884 // Double_t errY=vertex.GetErrY();
4885 // Double_t errZ=vertex.GetErrZ();
4886 // Double_t vx = vertex.GetX();
4887 // Double_t vy = vertex.GetY();
4888 // Double_t vz = vertex.GetZ();
4889 // Double_t vr = sqrt((Double_t)(vx*vx + vy*vy));
4890 // Double_t vphi = TMath::ATan2(vy, vx);
4891 // cout << "\t Quality \t errX: " <<errX << "\t errY: " << errY << "\t errZ: " << errZ << "\t Chi2/ndf: " << vertex.GetChi2()/vertex.GetNDF() << endl;
4892 // cout << "\t Position \t x: " << vx << "\t y: " << vy << "\t z: " << vz <<"\t r: " << vr << "\t phi: " << vphi << endl;
4894 kVertexArr[kk][1] = 1;
4895 verticesRejectedInLoop--;
4898 // cout << "\t rejected vertex " << kk << endl;
4900 kVertexArr[ll][1] = 0;
4901 // cout << "\t Vertex " << ll << "\t track used twice: " << numberOfTracksUsedTwice << "\t tracks left for vertex: " << kVertexArr[ll][0]-numberOfTracksUsedTwice << endl;
4902 if ( kVertexArr[ll][0]-numberOfTracksUsedTwice < 2){
4903 kVertexArr[ll][1] = 0;
4905 for (Int_t count = 0; count < numberOfTracksUsedTwice; count++){
4906 for (Int_t hh = 2; hh < kVertexArr[ll][0]+2; hh++){
4907 if (kVertexArr[ll][hh] == trackNumberTrackUsedTwice[count]){
4908 // cout << "\t track to be removed " << trackNumberTrackUsedTwice[count] << " from position "<< hh <<endl;
4909 for (Int_t ii = kVertexArr[ll][0]+2-hh; ii > 1; ii--){
4910 Int_t pos = kVertexArr[ll][0]+2-ii;
4911 kVertexArr[ll][pos] = kVertexArr[ll][pos+1];
4913 kVertexArr[ll][0] -=1;
4916 AliESDtrack *track0=event->GetTrack(kVertexArr[ll][2]);
4917 AliKFParticle part0(*track0,211); //assuming pion mass
4918 if (track0->Charge()*part0.Q()<0) part0.Q()*=-1; // change sign if opposite
4923 // cout << "\t Vertex " << ll << " nTracks " << kVertexArr[ll][0] << endl;
4924 for (Int_t ii = 2 ; ii < kVertexArr[ll][0]+2; ii++){
4925 // cout << "\t \t Track " << kVertexArr[ll][ii] << endl;
4927 AliESDtrack *track1=event->GetTrack(kVertexArr[ll][ii]);
4928 AliKFParticle part1(*track1,211); // assuming pion mass
4929 if (track1->Charge()*part1.Q()<0) part1.Q()*=-1; // change sign if opposite
4933 vertexStored[ll]=vertex;
4934 // cout << "\t removing tracks from vtx " << ll << "new chi2/ndf: " << vertexStored[ll].GetChi2()/vertexStored[ll].GetNDF() <<endl;
4935 // cout << "Vertex " << ll << " nTracks " << kVertexArr[ll][0] << endl;
4936 // for (Int_t ii = 2 ; ii < kVertexArr[ll][0]+2; ii++){
4937 // cout << "\t Track " << kVertexArr[ll][ii] << endl;
4939 // Double_t errX=vertex.GetErrX();
4940 // Double_t errY=vertex.GetErrY();
4941 // Double_t errZ=vertex.GetErrZ();
4942 // Double_t vx = vertex.GetX();
4943 // Double_t vy = vertex.GetY();
4944 // Double_t vz = vertex.GetZ();
4945 // Double_t vr = sqrt((Double_t)(vx*vx + vy*vy));
4946 // Double_t vphi = TMath::ATan2(vy, vx);
4947 // cout << "\t Quality \t errX: " <<errX << "\t errY: " << errY << "\t errZ: " << errZ << "\t Chi2/ndf: " << vertex.GetChi2()/vertex.GetNDF() << endl;
4948 // cout << "\t Position \t x: " << vx << "\t y: " << vy << "\t z: " << vz <<"\t r: " << vr << "\t phi: " << vphi << endl;
4950 kVertexArr[ll][1] = 1;
4951 verticesRejectedInLoop--;
4954 verticesRejectedInLoop++;
4958 // if (nVertices > 0){
4959 // cout << "Selected Vertices___________________________________" << endl;
4961 for (Int_t fin = 0; fin < nVertices; fin++){
4962 if (kVertexArr[fin][1] == 0) continue;
4963 Double_t errX=vertexStored[fin].GetErrX();
4964 Double_t errY=vertexStored[fin].GetErrY();
4965 Double_t errZ=vertexStored[fin].GetErrZ();
4966 Double_t err3D=TMath::Sqrt(errX*errX+errY*errY+errZ*errZ/10.);
4967 Double_t err2D=TMath::Sqrt(errX*errX+errY*errY);
4968 Double_t vx = vertexStored[fin].GetX();
4969 Double_t vy = vertexStored[fin].GetY();
4970 Double_t vz = vertexStored[fin].GetZ();
4971 Double_t vr = sqrt((Double_t)(vx*vx + vy*vy));
4972 Double_t vphi = TMath::ATan2(vy, vx);
4973 // cout << "Vertex " << fin << " nTracks " << kVertexArr[fin][0] << endl;
4974 for (Int_t ii = 2 ; ii < kVertexArr[fin][0]+2; ii++){
4975 // cout << "\t Track " << kVertexArr[fin][ii] << endl;
4977 // cout << "\t Quality \t errX: " <<errX << "\t errY: " << errY << "\t errZ: " << errZ << "\t Chi2/ndf: " << vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF() << endl;
4978 // cout << "\t Position \t x: " << vx << "\t y: " << vy << "\t z: " << vz <<"\t r: " << vr << "\t phi:" << vphi << endl;
4980 fHistograms->FillHistogram("ESD_HadIntQual_nTracksSecVtx", kVertexArr[fin][0]);
4981 fHistograms->FillHistogram("ESD_HadIntQual_ErrX", errX);
4982 // fHistograms->FillHistogram("ESD_HadIntQual_NormDCA", vNDCA);
4983 fHistograms->FillHistogram("ESD_HadIntQual_ErrY", errY);
4984 fHistograms->FillHistogram("ESD_HadIntQual_ErrZ", errZ);
4985 fHistograms->FillHistogram("ESD_HadIntQual_Err2D", err2D);
4986 fHistograms->FillHistogram("ESD_HadIntQual_Err3D", err3D);
4987 fHistograms->FillHistogram("ESD_HadIntQual_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
4988 Double_t chi2PerDOF = vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF();
4989 if ( chi2PerDOF< fMaxChi2HadInt && err2D < fMaxErr2DHadInt ){
4990 fHistograms->FillHistogram("ESD_HadIntMap_ZR", vz,vr);
4991 fHistograms->FillHistogram("ESD_HadIntMap_XY", vx,vy);
4993 fHistograms->FillHistogram("ESD_HadIntMap_ZPhi", vz,vphi);
4994 fHistograms->FillHistogram("ESD_HadIntMap_RPhi", vr,vphi);
4996 Double_t rITSTPCMin=45;
4997 Double_t rITSTPCMax=80;
5000 fHistograms->FillHistogram("ESD_HadIntMap_FMD_ZPhi", vz,vphi);
5002 if(vr>rFMD && vr<rITSTPCMin){
5003 fHistograms->FillHistogram("ESD_HadIntMap_FMD2_ZPhi", vz,vphi);
5006 if(vr>rITSTPCMin && vr<rITSTPCMax){
5007 fHistograms->FillHistogram("ESD_HadIntMap_ITSTPC_ZPhi", vz,vphi);
5009 Double_t rHotZoneMin = 5.7;
5010 Double_t rHotZoneMax = 50.;
5011 Double_t zHotZoneMin = 45.;
5012 Double_t zHotZoneMax = 75.;
5014 if (vr>rHotZoneMin && vr < rHotZoneMax){
5015 fHistograms->FillHistogram("ESD_HadIntMap_HotZone_ZPhi", vz,vphi);
5016 if (vz < zHotZoneMax && vz > zHotZoneMin){
5017 fHistograms->FillHistogram("ESD_HadIntMap_HotZone_XY", vx,vy);
5021 Double_t zBeamPipeInner = 30.;
5022 Double_t zOuterParts = 90.;
5023 if (vz < zBeamPipeInner && vz > - zBeamPipeInner) {
5024 fHistograms->FillHistogram("ESD_HadIntMapInnerBeampipe_XY", vx,vy);
5025 fHistograms->FillHistogram("ESD_HadIntMapInnerParts_XY", vx,vy);
5027 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_ErrX", errX);
5028 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_ErrY", errY);
5029 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_ErrZ", errZ);
5030 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_Err2D", err2D);
5031 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_Err3D", err3D);
5032 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallR_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
5036 if (vz > zOuterParts ) fHistograms->FillHistogram("ESD_HadIntMapPosZOuterParts_XY", vx,vy);
5037 if (vz > zBeamPipeInner && vz < zOuterParts ) {
5038 fHistograms->FillHistogram("ESD_HadIntMapPosZFMD_XY", vx,vy);
5040 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_ErrX", errX);
5041 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_ErrY", errY);
5042 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_ErrZ", errZ);
5043 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_Err2D", err2D);
5044 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_Err3D", err3D);
5045 fHistograms->FillHistogram("ESD_HadIntQualAftCutsSmallROut_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
5048 if (vz < -zBeamPipeInner && vz > -zOuterParts ) fHistograms->FillHistogram("ESD_HadIntMapNegZFMD_XY", vx,vy);
5050 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_ErrX", errX);
5051 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_ErrY", errY);
5052 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_ErrZ", errZ);
5053 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_Err2D", err2D);
5054 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_Err3D", err3D);
5055 fHistograms->FillHistogram("ESD_HadIntQualAftCuts_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
5057 if (kVertexArr[fin][0]>2 ){
5058 fHistograms->FillHistogram("ESD_HadIntMap3_ZR", vz,vr);
5059 fHistograms->FillHistogram("ESD_HadIntMap3_XY", vx,vy);
5061 fHistograms->FillHistogram("ESD_HadIntMap3_ZPhi", vz,vphi);
5062 fHistograms->FillHistogram("ESD_HadIntMap3_RPhi", vr,vphi);
5065 fHistograms->FillHistogram("ESD_HadIntMap3_FMD_ZPhi", vz,vphi);
5067 if(vr>rFMD && vr<rITSTPCMin){
5068 fHistograms->FillHistogram("ESD_HadIntMap3_FMD2_ZPhi", vz,vphi);
5071 if (vr>rITSTPCMin && vr<rITSTPCMax){
5072 fHistograms->FillHistogram("ESD_HadIntMap3_ITSTPC_ZPhi", vz,vphi);
5074 if (vz < zBeamPipeInner && vz > - zBeamPipeInner) {
5075 fHistograms->FillHistogram("ESD_HadIntMap3InnerBeampipe_XY", vx,vy);
5076 fHistograms->FillHistogram("ESD_HadIntMap3InnerParts_XY", vx,vy);
5078 if (vz > zOuterParts ) fHistograms->FillHistogram("ESD_HadIntMap3PosZOuterParts_XY", vx,vy);
5079 if (vz > zBeamPipeInner && vz < zOuterParts ) {
5080 fHistograms->FillHistogram("ESD_HadIntMap3PosZFMD_XY", vx,vy);
5082 if (vz < -zBeamPipeInner && vz > -zOuterParts ) fHistograms->FillHistogram("ESD_HadIntMap3NegZFMD_XY", vx,vy);
5084 if (vr>rHotZoneMin && vr < rHotZoneMax){
5085 fHistograms->FillHistogram("ESD_HadIntMap3_HotZone_ZPhi", vz,vphi);
5086 if (vz < zHotZoneMax && vz > zHotZoneMin){
5087 fHistograms->FillHistogram("ESD_HadIntMap3_HotZone_XY", vx,vy);
5090 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_ErrX", errX);
5091 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_ErrY", errY);
5092 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_ErrZ", errZ);
5093 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_Err2D", err2D);
5094 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_Err3D", err3D);
5095 fHistograms->FillHistogram("ESD_HadIntQual3AftCuts_Chi2PerDOF", vertexStored[fin].GetChi2()/vertexStored[fin].GetNDF());
5101 // if (nVertices > 0){
5102 // cout << "number of total vertices: "<< nVertices << endl;
5103 // cout << "number of total vertices passing selection: "<< nVerticesPassed << endl;
5104 // cout << "vertices rejected in loop: " << verticesRejectedInLoop << endl;
5106 delete [] rejectTrack;
5110 Bool_t AliAnalysisTaskGammaConversion::CheckLooper(Int_t index, AliESDEvent *event){
5112 // check if given track is looper candidate
5113 // if looper return kTRUE
5115 Int_t ntracks=event->GetNumberOfTracks();
5117 const Double_t ktglCut=0.03;
5118 const Double_t kalphaCut=0.4;
5120 AliESDtrack * track0 = event->GetTrack(index);
5121 AliESDtrack * track1P = 0;
5122 for (Int_t itrack1=0; itrack1<ntracks; itrack1++){
5123 if (itrack1==index) continue;
5124 AliESDtrack *track1=event->GetTrack(itrack1);
5125 if (!track1) continue;
5126 if (TMath::Abs(TMath::Abs(track1->GetTgl())-TMath::Abs(track0->GetTgl()))>ktglCut) continue;
5127 if (TMath::Abs(TMath::Abs(track1->GetAlpha())-TMath::Abs(track0->GetAlpha()))>kalphaCut) continue;
5137 Bool_t AliAnalysisTaskGammaConversion::CheckV0(Int_t index, AliESDEvent *event){
5139 // check if given track is V0 candidata
5140 // if looper return kTRUE
5143 Int_t ntracks=event->GetNumberOfTracks();
5145 const Double_t kSigmaMass=0.001;
5146 const Int_t kChi2Cut=10;
5148 AliESDtrack * track0 = event->GetTrack(index);
5149 AliExternalTrackParam pL(*track0);
5150 AliKFParticle part0El(*track0, 11); //assuming mass e
5151 AliKFParticle part0Pi(*track0, 211); //assuming mass pion
5152 AliKFParticle part0P(*track0, 2212); //assuming mass proton
5153 if (track0->Charge()*part0El.Q()<0) {
5154 part0El.Q()*=-1; // change sign if opposite
5155 part0Pi.Q()*=-1; // change sign if opposite
5156 part0P.Q()*=-1; // change sign if opposite
5161 Bool_t isLambdaBar=0;
5163 for (Int_t itrack1=0; itrack1<ntracks; itrack1++){
5164 if (itrack1==index) continue;
5165 AliESDtrack *track1=event->GetTrack(itrack1);
5166 if (!track1) continue;
5167 if (track1->Charge()*track0->Charge()>0) continue;
5168 AliKFParticle part1El(*track1, 11); //assuming mass e
5169 AliKFParticle part1Pi(*track1, 211); //assuming mass pion
5170 AliKFParticle part1P(*track1, 2212); //assuming mass proton
5171 if (track1->Charge()*part1El.Q()<0) {
5172 part1El.Q()*=-1; // change sign if opposite
5173 part1Pi.Q()*=-1; // change sign if opposite
5174 part1P.Q()*=-1; // change sign if opposite
5177 AliKFVertex vertexG; // gamma conversion candidate
5180 AliKFVertex vertexGC; // gamma conversion candidate
5183 vertexGC.SetMassConstraint(0,kSigmaMass);
5184 AliKFVertex vertexK0; // K0s candidate
5187 AliKFVertex vertexK0C; // K0s candidate
5190 vertexK0C.SetMassConstraint(0.497614,kSigmaMass);
5191 AliKFVertex vertexLambda; // Lambda candidate
5192 vertexLambda+=part0Pi;
5193 vertexLambda+=part1P;
5194 AliKFVertex vertexLambdaC; // Lambda candidate
5195 vertexLambdaC+=part0Pi;
5196 vertexLambdaC+=part1Pi;
5197 vertexLambdaC.SetMassConstraint(1.115683,kSigmaMass);
5198 AliKFVertex vertexLambdaB; // Lambda candidate
5199 vertexLambdaB+=part0Pi;
5200 vertexLambdaB+=part1P;
5201 AliKFVertex vertexLambdaBC; // LambdaBar candidate
5202 vertexLambdaBC+=part0Pi;
5203 vertexLambdaBC+=part1Pi;
5204 vertexLambdaBC.SetMassConstraint(1.115683,kSigmaMass);
5206 if (vertexGC.GetChi2()<kChi2Cut && vertexG.GetMass()<0.06) isGamma=kTRUE;
5207 if (vertexK0C.GetChi2()<kChi2Cut&&TMath::Abs(vertexK0.GetMass()-0.5)<0.06) isK0=kTRUE;
5208 if (vertexLambdaC.GetChi2()<kChi2Cut&&TMath::Abs(vertexLambda.GetMass()-1.1)<0.06) isLambda=kTRUE;
5209 if (vertexLambdaBC.GetChi2()<kChi2Cut&&TMath::Abs(vertexLambdaB.GetMass()-1.1)<0.06) isLambdaBar=kTRUE;
5210 if (isGamma||isK0||isLambda||isLambdaBar) {
5215 if (index1>0) return kTRUE;
5220 void AliAnalysisTaskGammaConversion::ProcessGammaElectronsForChicAnalysis(){
5221 // see header file for documantation
5223 fESDEvent = fV0Reader->GetESDEvent();
5226 TClonesArray * vESDeNegTemp = new TClonesArray("AliESDtrack",0);
5227 TClonesArray * vESDePosTemp = new TClonesArray("AliESDtrack",0);
5228 TClonesArray * vESDxNegTemp = new TClonesArray("AliESDtrack",0);
5229 TClonesArray * vESDxPosTemp = new TClonesArray("AliESDtrack",0);
5230 TClonesArray * vESDeNegNoJPsi = new TClonesArray("AliESDtrack",0);
5231 TClonesArray * vESDePosNoJPsi = new TClonesArray("AliESDtrack",0);
5234 vector <AliESDtrack*> vESDeNegTemp(0);
5235 vector <AliESDtrack*> vESDePosTemp(0);
5236 vector <AliESDtrack*> vESDxNegTemp(0);
5237 vector <AliESDtrack*> vESDxPosTemp(0);
5238 vector <AliESDtrack*> vESDeNegNoJPsi(0);
5239 vector <AliESDtrack*> vESDePosNoJPsi(0);
5243 fHistograms->FillTable("Table_Electrons",0);//Count number of Events
5245 for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
5246 AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
5249 //print warning here
5253 double p[3];if(!curTrack->GetConstrainedPxPyPz(p))continue;
5254 double r[3];curTrack->GetConstrainedXYZ(r);
5258 fHistograms->FillTable("Table_Electrons",4);//Count number of ESD tracks
5260 Bool_t flagKink = kTRUE;
5261 Bool_t flagTPCrefit = kTRUE;
5262 Bool_t flagTRDrefit = kTRUE;
5263 Bool_t flagITSrefit = kTRUE;
5264 Bool_t flagTRDout = kTRUE;
5265 Bool_t flagVertex = kTRUE;
5268 //Cuts ---------------------------------------------------------------
5270 if(curTrack->GetKinkIndex(0) > 0){
5271 fHistograms->FillHistogram("Table_Electrons",5);//Count kink
5275 ULong_t trkStatus = curTrack->GetStatus();
5277 ULong_t tpcRefit = (trkStatus & AliESDtrack::kTPCrefit);
5280 fHistograms->FillHistogram("Table_Electrons",9);//Count not TPCrefit
5281 flagTPCrefit = kFALSE;
5284 ULong_t itsRefit = (trkStatus & AliESDtrack::kITSrefit);
5286 fHistograms->FillHistogram("Table_Electrons",10);//Count not ITSrefit
5287 flagITSrefit = kFALSE;
5290 ULong_t trdRefit = (trkStatus & AliESDtrack::kTRDrefit);
5293 fHistograms->FillHistogram("Table_Electrons",8); //Count not TRDrefit
5294 flagTRDrefit = kFALSE;
5297 ULong_t trdOut = (trkStatus & AliESDtrack::kTRDout);
5300 fHistograms->FillHistogram("Table_Electrons",7); //Count not TRDout
5301 flagTRDout = kFALSE;
5304 double nsigmaToVxt = GetSigmaToVertex(curTrack);
5306 if(nsigmaToVxt > 3){
5307 fHistograms->FillHistogram("Table_Electrons",6); //Count Tracks with number of sigmas > 3
5308 flagVertex = kFALSE;
5311 if(! (flagKink && flagTPCrefit && flagITSrefit && flagTRDrefit && flagTRDout && flagVertex ) ) continue;
5312 fHistograms->FillHistogram("Table_Electrons",11);//Count Tracks passed Cuts
5316 GetPID(curTrack, pid, weight);
5319 fHistograms->FillHistogram("Table_Electrons",12); //Count Tracks with pid != 0
5323 fHistograms->FillHistogram("Table_Electrons",13); //Count Tracks with pid != 0
5331 TLorentzVector curElec;
5332 curElec.SetXYZM(p[0],p[1],p[2],fElectronMass);
5336 Int_t labelMC = TMath::Abs(curTrack->GetLabel());
5337 TParticle* curParticle = fStack->Particle(labelMC);
5338 if(curTrack->GetSign() > 0){
5340 fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
5341 fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
5343 fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
5344 fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
5350 if(curTrack->GetSign() > 0){
5352 // vESDxPosTemp.push_back(curTrack);
5353 new((*vESDxPosTemp)[vESDxPosTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
5356 fHistograms->FillHistogram("ESD_ElectronPosNegPt",curElec.Pt());
5357 fHistograms->FillHistogram("ESD_ElectronPosPt",curElec.Pt());
5358 // fHistograms->FillHistogram("MC_ElectronPosNegPt",curParticle->Pt());
5359 fHistograms->FillHistogram("ESD_ElectronPosNegEta",curElec.Eta());
5360 // fHistograms->FillHistogram("MC_ElectronPosNegEta",curParticle->Eta());
5361 // vESDePosTemp.push_back(curTrack);
5362 new((*vESDePosTemp)[vESDePosTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
5367 new((*vESDxNegTemp)[vESDxNegTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
5371 fHistograms->FillHistogram("ESD_ElectronPosNegPt",curElec.Pt());
5372 fHistograms->FillHistogram("ESD_ElectronNegPt",curElec.Pt());
5373 fHistograms->FillHistogram("ESD_ElectronPosNegEta",curElec.Eta());
5374 new((*vESDeNegTemp)[vESDeNegTemp->GetEntriesFast()]) AliESDtrack(*curTrack);
5383 Bool_t ePosJPsi = kFALSE;
5384 Bool_t eNegJPsi = kFALSE;
5385 Bool_t ePosPi0 = kFALSE;
5386 Bool_t eNegPi0 = kFALSE;
5388 UInt_t iePosJPsi=0,ieNegJPsi=0,iePosPi0=0,ieNegPi0=0;
5390 for(Int_t iNeg=0; iNeg < vESDeNegTemp->GetEntriesFast(); iNeg++){
5391 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetPdgCode() == 11)
5392 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetMother(0) > -1){
5393 Int_t labelMother = fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(iNeg)))->GetLabel()))->GetMother(0);
5394 TParticle* partMother = fStack ->Particle(labelMother);
5395 if (partMother->GetPdgCode() == 111){
5399 if(partMother->GetPdgCode() == 443){ //Mother JPsi
5400 fHistograms->FillTable("Table_Electrons",14);
5404 // vESDeNegNoJPsi.push_back(vESDeNegTemp[iNeg]);
5405 new((*vESDeNegNoJPsi)[vESDeNegNoJPsi->GetEntriesFast()]) AliESDtrack(*(AliESDtrack*)(vESDeNegTemp->At(iNeg)));
5406 // cout<<"ESD No Positivo JPsi "<<endl;
5411 for(Int_t iPos=0; iPos < vESDePosTemp->GetEntriesFast(); iPos++){
5412 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetPdgCode() == -11)
5413 if(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetMother(0) > -1){
5414 Int_t labelMother = fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iPos)))->GetLabel()))->GetMother(0);
5415 TParticle* partMother = fStack ->Particle(labelMother);
5416 if (partMother->GetPdgCode() == 111){
5420 if(partMother->GetPdgCode() == 443){ //Mother JPsi
5421 fHistograms->FillTable("Table_Electrons",15);
5426 // vESDePosNoJPsi.push_back(vESDePosTemp[iPos]);
5427 new((*vESDePosNoJPsi)[vESDePosNoJPsi->GetEntriesFast()]) AliESDtrack(*(AliESDtrack*)(vESDePosTemp->At(iPos)));
5428 // cout<<"ESD No Negativo JPsi "<<endl;
5433 if( eNegJPsi && ePosJPsi ){
5434 TVector3 tempeNegV,tempePosV;
5435 tempeNegV.SetXYZ(((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Px(),((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Py(),((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->Pz());
5436 tempePosV.SetXYZ(((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Px(),((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Py(),((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->Pz());
5437 fHistograms->FillTable("Table_Electrons",16);
5438 fHistograms->FillHistogram("ESD_ElectronPosNegJPsiAngle",tempeNegV.Angle(tempePosV));
5439 fHistograms->FillHistogram("MC_ElectronPosNegJPsiAngle",GetMCOpeningAngle(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(ieNegJPsi)))->GetLabel())),
5440 fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iePosJPsi)))->GetLabel()))));
5443 if( eNegPi0 && ePosPi0 ){
5444 TVector3 tempeNegV,tempePosV;
5445 tempeNegV.SetXYZ(((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Px(),((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Py(),((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->Pz());
5446 tempePosV.SetXYZ(((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Px(),((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Py(),((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->Pz());
5447 fHistograms->FillHistogram("ESD_ElectronPosNegPi0Angle",tempeNegV.Angle(tempePosV));
5448 fHistograms->FillHistogram("MC_ElectronPosNegPi0Angle",GetMCOpeningAngle(fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDeNegTemp->At(ieNegPi0)))->GetLabel())),
5449 fStack->Particle(TMath::Abs(((AliESDtrack*)(vESDePosTemp->At(iePosPi0)))->GetLabel()))));
5453 FillAngle("ESD_eNegePosAngleBeforeCut",GetTLorentzVector(vESDeNegTemp),GetTLorentzVector(vESDePosTemp));
5455 CleanWithAngleCuts(*vESDeNegTemp,*vESDePosTemp,*fKFReconstructedGammasTClone);
5457 // vector <TLorentzVector> vCurrentTLVeNeg = GetTLorentzVector(fCurrentEventNegElectron);
5458 // vector <TLorentzVector> vCurrentTLVePos = GetTLorentzVector(fCurrentEventPosElectron);
5460 TClonesArray vCurrentTLVeNeg = GetTLorentzVector(fCurrentEventNegElectronTClone);
5461 TClonesArray vCurrentTLVePos = GetTLorentzVector(fCurrentEventPosElectronTClone);
5464 FillAngle("ESD_eNegePosAngleAfterCut",vCurrentTLVeNeg,vCurrentTLVePos);
5469 //FillAngle("ESD_eNegePosAngleAfterCut",CurrentTLVeNeg,CurrentTLVePos);
5472 FillElectronInvMass("ESD_InvMass_ePluseMinus",vCurrentTLVeNeg,vCurrentTLVePos);
5473 FillElectronInvMass("ESD_InvMass_xPlusxMinus",GetTLorentzVector(vESDxNegTemp),GetTLorentzVector(vESDxPosTemp));
5477 FillGammaElectronInvMass("ESD_InvMass_GammaePluseMinusChiC","ESD_InvMass_GammaePluseMinusChiCDiff",*fKFReconstructedGammasCutTClone,vCurrentTLVeNeg,vCurrentTLVePos);
5479 FillGammaElectronInvMass("ESD_InvMass_GammaePluseMinusPi0","ESD_InvMass_GammaePluseMinusPi0Diff",
5480 *fKFReconstructedGammasCutTClone,vCurrentTLVeNeg,vCurrentTLVePos);
5485 ElectronBackground("ESD_ENegBackground",vCurrentTLVeNeg);
5486 ElectronBackground("ESD_EPosBackground",vCurrentTLVePos);
5487 ElectronBackground("ESD_EPosENegBackground",vCurrentTLVeNeg);
5488 ElectronBackground("ESD_EPosENegBackground",vCurrentTLVePos);
5490 // Like Sign e+e- no JPsi
5491 ElectronBackground("ESD_EPosENegNoJPsiBG",GetTLorentzVector(vESDeNegNoJPsi));
5492 ElectronBackground("ESD_EPosENegNoJPsiBG",GetTLorentzVector(vESDePosNoJPsi));
5496 if( fCurrentEventPosElectronTClone->GetEntriesFast() > 0 && fCurrentEventNegElectronTClone->GetEntriesFast() > 0 && fKFReconstructedGammasCutTClone->GetEntriesFast() > 0 ){
5497 FillGammaElectronInvMass("ESD_EPosENegGammaBackgroundMX","ESD_EPosENegGammaBackgroundMXDiff",
5498 *fKFReconstructedGammasCutTClone,*fPreviousEventTLVNegElectronTClone,*fPreviousEventTLVPosElectronTClone);
5499 *fPreviousEventTLVNegElectronTClone = vCurrentTLVeNeg;
5500 *fPreviousEventTLVPosElectronTClone = vCurrentTLVePos;
5507 vtx[0]=0;vtx[1]=0;vtx[2]=0;
5508 for(UInt_t i=0;i<fKFReconstructedGammasChic.size();i++){
5510 // if(fMCGammaChicTempCut[i]->GetMother(0) < 0) continue;
5514 Int_t tempLabel = fStack->Particle(fMCGammaChicTempCut[i]->GetMother(0))->GetPdgCode();
5515 // cout<<" Label Pedro Gonzalez " <<tempLabel <<endl;
5517 // cout<<" Label Distance"<<fKFReconstructedGammasChic[i].GetDistanceFromVertex(vtx)<<endl;
5519 if( tempLabel == 10441 || tempLabel == 20443 || tempLabel == 445 )
5521 fHistograms->FillHistogram("ESD_PhotonsMomentum",fKFReconstructedGammasChic[i].GetMomentum());
5530 vESDeNegTemp->Delete();
5531 vESDePosTemp->Delete();
5532 vESDxNegTemp->Delete();
5533 vESDxPosTemp->Delete();
5534 vESDeNegNoJPsi->Delete();
5535 vESDePosNoJPsi->Delete();
5537 delete vESDeNegTemp;
5538 delete vESDePosTemp;
5539 delete vESDxNegTemp;
5540 delete vESDxPosTemp;
5541 delete vESDeNegNoJPsi;
5542 delete vESDePosNoJPsi;
5546 void AliAnalysisTaskGammaConversion::FillAngle(TString histoName,vector <TLorentzVector> tlVeNeg, vector <TLorentzVector> tlVePos){
5547 //see header file for documentation
5548 for( UInt_t iNeg=0; iNeg < tlVeNeg.size(); iNeg++){
5549 for (UInt_t iPos=0; iPos < tlVePos.size(); iPos++){
5550 fHistograms->FillHistogram(histoName.Data(),tlVeNeg[iNeg].Vect().Angle(tlVePos[iPos].Vect()));
5555 void AliAnalysisTaskGammaConversion::FillAngle(TString histoName,TClonesArray const tlVeNeg, TClonesArray const tlVePos){
5556 //see header file for documentation
5557 for( Int_t iNeg=0; iNeg < tlVeNeg.GetEntriesFast(); iNeg++){
5558 for (Int_t iPos=0; iPos < tlVePos.GetEntriesFast(); iPos++){
5559 fHistograms->FillHistogram(histoName.Data(),((TLorentzVector*)(tlVeNeg.At(iNeg)))->Vect().Angle(((TLorentzVector*)(tlVePos.At(iPos)))->Vect()));
5564 void AliAnalysisTaskGammaConversion::FillElectronInvMass(TString histoName, TClonesArray const eNeg, TClonesArray const ePos){
5565 //see header file for documentation
5566 for( Int_t n=0; n < eNeg.GetEntriesFast(); n++){
5567 TLorentzVector en = (*(TLorentzVector*)(eNeg.At(n)));
5568 for (Int_t p=0; p < ePos.GetEntriesFast(); p++){
5569 TLorentzVector ep = (*(TLorentzVector*)(ePos.At(p)));
5570 TLorentzVector np = ep + en;
5571 fHistograms->FillHistogram(histoName.Data(),np.M());
5576 void AliAnalysisTaskGammaConversion::FillGammaElectronInvMass(TString histoMass,TString histoDiff,TClonesArray const fKFGammas,
5577 TClonesArray const tlVeNeg,TClonesArray const tlVePos)
5579 //see header file for documentation
5581 for( Int_t iNeg=0; iNeg < tlVeNeg.GetEntriesFast(); iNeg++ ){
5583 for (Int_t iPos=0; iPos < tlVePos.GetEntriesFast(); iPos++){
5585 TLorentzVector xy = *((TLorentzVector *)(tlVePos.At(iPos))) + *((TLorentzVector *)(tlVeNeg.At(iNeg)));
5587 for (Int_t iGam=0; iGam < fKFGammas.GetEntriesFast(); iGam++){
5589 // AliKFParticle * gammaCandidate = &fKFGammas[iGam];
5590 AliKFParticle * gammaCandidate = (AliKFParticle *)(fKFGammas.At(iGam));
5593 g.SetXYZM(gammaCandidate->GetPx(),gammaCandidate->GetPy(),gammaCandidate->GetPz(),fGammaMass);
5594 TLorentzVector xyg = xy + g;
5595 fHistograms->FillHistogram(histoMass.Data(),xyg.M());
5596 fHistograms->FillHistogram(histoDiff.Data(),(xyg.M()-xy.M()));
5602 void AliAnalysisTaskGammaConversion::ElectronBackground(TString hBg, TClonesArray e)
5604 // see header file for documentation
5605 for(Int_t i=0; i < e.GetEntriesFast(); i++) {
5606 for (Int_t j=i+1; j < e.GetEntriesFast(); j++) {
5607 TLorentzVector ee = (*(TLorentzVector*)(e.At(i))) + (*(TLorentzVector*)(e.At(j)));
5608 fHistograms->FillHistogram(hBg.Data(),ee.M());
5614 void AliAnalysisTaskGammaConversion::CleanWithAngleCuts(TClonesArray const negativeElectrons,
5615 TClonesArray const positiveElectrons,
5616 TClonesArray const gammas){
5617 // see header file for documentation
5619 UInt_t sizeN = negativeElectrons.GetEntriesFast();
5620 UInt_t sizeP = positiveElectrons.GetEntriesFast();
5621 UInt_t sizeG = gammas.GetEntriesFast();
5625 vector <Bool_t> xNegBand(sizeN);
5626 vector <Bool_t> xPosBand(sizeP);
5627 vector <Bool_t> gammaBand(sizeG);
5630 for(UInt_t iNeg=0; iNeg < sizeN; iNeg++) xNegBand[iNeg]=kTRUE;
5631 for(UInt_t iPos=0; iPos < sizeP; iPos++) xPosBand[iPos]=kTRUE;
5632 for(UInt_t iGam=0; iGam < sizeG; iGam++) gammaBand[iGam]=kTRUE;
5635 for(UInt_t iPos=0; iPos < sizeP; iPos++){
5638 ((AliESDtrack*)(positiveElectrons.At(iPos)))->GetConstrainedPxPyPz(aP);
5640 TVector3 ePosV(aP[0],aP[1],aP[2]);
5642 for(UInt_t iNeg=0; iNeg < sizeN; iNeg++){
5645 ((AliESDtrack*)(negativeElectrons.At(iNeg)))->GetConstrainedPxPyPz(aN);
5646 TVector3 eNegV(aN[0],aN[1],aN[2]);
5648 if(ePosV.Angle(eNegV) < 0.05){ //e+e- from gamma
5649 xPosBand[iPos]=kFALSE;
5650 xNegBand[iNeg]=kFALSE;
5653 for(UInt_t iGam=0; iGam < sizeG; iGam++){
5654 AliKFParticle* gammaCandidate = (AliKFParticle*)gammas.At(iGam);
5655 TVector3 gammaCandidateVector(gammaCandidate->Px(),gammaCandidate->Py(),gammaCandidate->Pz());
5656 if(ePosV.Angle(gammaCandidateVector) < 0.05 || eNegV.Angle(gammaCandidateVector) < 0.05)
5657 gammaBand[iGam]=kFALSE;
5662 for(UInt_t iPos=0; iPos < sizeP; iPos++){
5664 new((*fCurrentEventPosElectronTClone)[fCurrentEventPosElectronTClone->GetEntriesFast()]) AliESDtrack((*(AliESDtrack*)(positiveElectrons.At(iPos))));
5665 // fCurrentEventPosElectron.push_back(positiveElectrons[iPos]);
5668 for(UInt_t iNeg=0;iNeg < sizeN; iNeg++){
5670 new((*fCurrentEventNegElectronTClone)[fCurrentEventNegElectronTClone->GetEntriesFast()]) AliESDtrack((*(AliESDtrack*)(negativeElectrons.At(iNeg))));
5671 // fCurrentEventNegElectron.push_back(negativeElectrons[iNeg]);
5674 for(UInt_t iGam=0; iGam < sizeG; iGam++){
5675 if(gammaBand[iGam]){
5676 new((*fKFReconstructedGammasCutTClone)[fKFReconstructedGammasCutTClone->GetEntriesFast()]) AliKFParticle((*(AliKFParticle*)(gammas.At(iGam))));
5677 //fKFReconstructedGammasCut.push_back(*(AliKFParticle*)gammas->At(iGam));
5683 void AliAnalysisTaskGammaConversion::GetPID(const AliESDtrack *track, Stat_t &pid, Stat_t &weight)
5685 // see header file for documentation
5690 double wpartbayes[5];
5692 //get probability of the diffenrent particle types
5693 track->GetESDpid(wpart);
5695 // Tentative particle type "concentrations"
5696 double c[5]={0.01, 0.01, 0.85, 0.10, 0.05};
5700 for (int i = 0; i < 5; i++){
5701 rcc+=(c[i] * wpart[i]);
5706 for (int i=0; i<5; i++) {
5707 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)
5708 wpartbayes[i] = c[i] * wpart[i] / rcc;
5714 //find most probable particle in ESD pid
5715 //0:Electron - 1:Muon - 2:Pion - 3:Kaon - 4:Proton
5716 for (int i = 0; i < 5; i++){
5717 if (wpartbayes[i] > max){
5719 max = wpartbayes[i];
5727 double AliAnalysisTaskGammaConversion::GetSigmaToVertex(const AliESDtrack* t)
5729 // Calculates the number of sigma to the vertex.
5734 t->GetImpactParameters(b,bCov);
5735 if (bCov[0]<=0 || bCov[2]<=0) {
5736 AliDebug(1, "Estimated b resolution lower or equal zero!");
5737 bCov[0]=0; bCov[2]=0;
5739 bRes[0] = TMath::Sqrt(bCov[0]);
5740 bRes[1] = TMath::Sqrt(bCov[2]);
5742 // -----------------------------------
5743 // How to get to a n-sigma cut?
5745 // The accumulated statistics from 0 to d is
5747 // -> Erf(d/Sqrt(2)) for a 1-dim gauss (d = n_sigma)
5748 // -> 1 - Exp(-d**2) for a 2-dim gauss (d*d = dx*dx + dy*dy != n_sigma)
5750 // It means that for a 2-dim gauss: n_sigma(d) = Sqrt(2)*ErfInv(1 - Exp((-x**2)/2)
5751 // Can this be expressed in a different way?
5753 if (bRes[0] == 0 || bRes[1] ==0)
5756 double d = TMath::Sqrt(TMath::Power(b[0]/bRes[0],2) + TMath::Power(b[1]/bRes[1],2));
5758 // stupid rounding problem screws up everything:
5759 // if d is too big, TMath::Exp(...) gets 0, and TMath::ErfInverse(1) that should be infinite, gets 0 :(
5760 if (TMath::Exp(-d * d / 2) < 1e-10)
5764 d = TMath::ErfInverse(1 - TMath::Exp(-d * d / 2)) * TMath::Sqrt(2);
5768 //vector <TLorentzVector> AliAnalysisTaskGammaConversion::GetTLorentzVector(vector <AliESDtrack*> esdTrack){
5769 TClonesArray AliAnalysisTaskGammaConversion::GetTLorentzVector(TClonesArray *const esdTrack){
5770 //Return TLoresntz vector of track?
5771 // vector <TLorentzVector> tlVtrack(0);
5772 TClonesArray array("TLorentzVector",0);
5774 for(Int_t itrack=0; itrack < esdTrack->GetEntriesFast(); itrack++){
5776 //esdTrack[itrack]->GetConstrainedPxPyPz(p);
5777 ((AliESDtrack*)(esdTrack->At(itrack)))->GetConstrainedPxPyPz(p);
5778 TLorentzVector currentTrack;
5779 currentTrack.SetXYZM(p[0],p[1],p[2],fElectronMass);
5780 new((array)[array.GetEntriesFast()]) TLorentzVector(currentTrack);
5781 // tlVtrack.push_back(currentTrack);
5788 Int_t AliAnalysisTaskGammaConversion::GetProcessType(const AliMCEvent * mcEvt) {
5790 // Determine if the event was generated with pythia or phojet and return the process type
5792 // Check if mcEvt is fine
5793 if (!mcEvt) { // coverty does not allow this, the check is done elsewhere
5794 AliFatal("NULL mc event");
5798 // Determine if it was a pythia or phojet header, and return the correct process type
5799 AliGenPythiaEventHeader * headPy = 0;
5800 AliGenDPMjetEventHeader * headPho = 0;
5801 AliGenEventHeader * htmp = mcEvt->GenEventHeader();
5803 AliFatal("Cannot Get MC Header!!");
5806 if( TString(htmp->IsA()->GetName()) == "AliGenPythiaEventHeader") {
5807 headPy = (AliGenPythiaEventHeader*) htmp;
5808 } else if (TString(htmp->IsA()->GetName()) == "AliGenDPMjetEventHeader") {
5809 headPho = (AliGenDPMjetEventHeader*) htmp;
5811 AliError("Unknown header");
5814 // Determine process type
5816 if(headPy->ProcessType() == 92 || headPy->ProcessType() == 93) {
5817 // single difractive
5819 } else if (headPy->ProcessType() == 94) {
5820 // double diffractive
5823 else if(headPy->ProcessType() != 92 && headPy->ProcessType() != 93 && headPy->ProcessType() != 94) {
5827 } else if (headPho) {
5828 if(headPho->ProcessType() == 5 || headPho->ProcessType() == 6 ) {
5829 // single difractive
5831 } else if (headPho->ProcessType() == 7) {
5832 // double diffractive
5834 } else if(headPho->ProcessType() != 5 && headPho->ProcessType() != 6 && headPho->ProcessType() != 7 ) {
5841 // no process type found?
5842 AliError(Form("Unknown header: %s", htmp->IsA()->GetName()));
5843 return kProcUnknown;
5847 Int_t AliAnalysisTaskGammaConversion::CalculateMultiplicityBin(){
5848 // Get Centrality bin
5850 Int_t multiplicity = 0;
5852 if ( fUseMultiplicity == 1 ) {
5854 if (fMultiplicity>= 0 && fMultiplicity<= 5) multiplicity=1;
5855 if (fMultiplicity>= 6 && fMultiplicity<= 9) multiplicity=2;
5856 if (fMultiplicity>=10 && fMultiplicity<=14) multiplicity=3;
5857 if (fMultiplicity>=15 && fMultiplicity<=22) multiplicity=4;
5858 if (fMultiplicity>=23 ) multiplicity=5;
5862 if ( fUseHBTMultiplicity == 1 ) {
5864 if (fMultiplicity>= 0 && fMultiplicity<=11) multiplicity=1;
5865 if (fMultiplicity>=12 && fMultiplicity<=16) multiplicity=2;
5866 if (fMultiplicity>=17 && fMultiplicity<=22) multiplicity=3;
5867 if (fMultiplicity>=23 && fMultiplicity<=29) multiplicity=4;
5868 if (fMultiplicity>=30 && fMultiplicity<=36) multiplicity=5;
5869 if (fMultiplicity>=37 && fMultiplicity<=44) multiplicity=6;
5870 if (fMultiplicity>=45 && fMultiplicity<=57) multiplicity=7;
5871 if (fMultiplicity>=58 && fMultiplicity<=149) multiplicity=8;
5874 if (fMultiplicity>= 0 && fMultiplicity<=5) multiplicity=1;
5875 if (fMultiplicity>=6 && fMultiplicity<=11) multiplicity=2;
5876 if (fMultiplicity>=12 && fMultiplicity<=16) multiplicity=3;
5877 if (fMultiplicity>=17 && fMultiplicity<=22) multiplicity=4;
5878 if (fMultiplicity>=23 ) multiplicity=5;
5883 return multiplicity;