From cc579963041c469badffaadbab7d8170bc8cab68 Mon Sep 17 00:00:00 2001 From: fbock Date: Wed, 30 Jul 2014 14:30:38 +0200 Subject: [PATCH] - fixes in AliAnalysisTaskGammaConvCalo.cxx --- PWGGA/GammaConv/AliAODConversionPhoton.cxx | 431 ++++++++++-------- PWGGA/GammaConv/AliAODConversionPhoton.h | 17 +- .../AliAnalysisTaskGammaConvCalo.cxx | 39 +- .../GammaConv/AliAnalysisTaskGammaConvCalo.h | 2 + 4 files changed, 292 insertions(+), 197 deletions(-) diff --git a/PWGGA/GammaConv/AliAODConversionPhoton.cxx b/PWGGA/GammaConv/AliAODConversionPhoton.cxx index 164aa0a6a7f..bdb43294350 100644 --- a/PWGGA/GammaConv/AliAODConversionPhoton.cxx +++ b/PWGGA/GammaConv/AliAODConversionPhoton.cxx @@ -14,12 +14,16 @@ fDCArPrimVtx(0), fDCAzPrimVtx(0), fCaloPhoton(0), fNCaloPhotonMCLabels(0), +fNCaloPhotonMotherMCLabels(0), fCaloPhotonMCFlags(0) { // initialize calo photon MC labels - for (Int_t i =0; i<50; i++){ + for (Int_t i =0; i<20; i++){ fCaloPhotonMCLabels[i]=-1; } + for (Int_t i =0; i<20; i++){ + fCaloPhotonMotherMCLabels[i]=-1; + } //Standard constructor } @@ -30,6 +34,7 @@ fDCArPrimVtx(0), fDCAzPrimVtx(0), fCaloPhoton(0), fNCaloPhotonMCLabels(0), +fNCaloPhotonMotherMCLabels(0), fCaloPhotonMCFlags(0) { //Constructor from kfphoton @@ -40,9 +45,12 @@ fCaloPhotonMCFlags(0) //SetE(P()); // initialize calo photon MC labels - for (Int_t i =0; i<50; i++){ + for (Int_t i =0; i<20; i++){ fCaloPhotonMCLabels[i]=-1; } + for (Int_t i =0; i<20; i++){ + fCaloPhotonMotherMCLabels[i]=-1; + } } @@ -53,14 +61,18 @@ fDCArPrimVtx(0), fDCAzPrimVtx(0), fCaloPhoton(0), fNCaloPhotonMCLabels(0), +fNCaloPhotonMotherMCLabels(0), fCaloPhotonMCFlags(0) { //Constructor from TLorentzVector // initialize calo photon MC labels - for (Int_t i =0; i<50; i++){ + for (Int_t i =0; i<20; i++){ fCaloPhotonMCLabels[i]=-1; } + for (Int_t i =0; i<20; i++){ + fCaloPhotonMotherMCLabels[i]=-1; + } } @@ -72,14 +84,18 @@ fDCArPrimVtx(original.fDCArPrimVtx), fDCAzPrimVtx(original.fDCAzPrimVtx), fCaloPhoton(original.fCaloPhoton), fNCaloPhotonMCLabels(original.fNCaloPhotonMCLabels), +fNCaloPhotonMotherMCLabels(original.fNCaloPhotonMotherMCLabels), fCaloPhotonMCFlags(original.fCaloPhotonMCFlags) { //Copy constructor // initialize calo photon MC labels - for (Int_t i =0; i<50; i++){ + for (Int_t i =0; i<20; i++){ fCaloPhotonMCLabels[i]=original.fCaloPhotonMCLabels[i]; } + for (Int_t i =0; i<20; i++){ + fCaloPhotonMotherMCLabels[i]=original.fCaloPhotonMotherMCLabels[i]; + } } AliAODConversionPhoton::~AliAODConversionPhoton() @@ -126,13 +142,13 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlags(AliStack *MCStack){ Bool_t isElectron = kFALSE; // largest contribution to cluster is electron Bool_t isConversion = kFALSE; // largest contribution to cluster is converted electron Bool_t isConversionFullyContained = kFALSE; // largest contribution to cluster is converted electron, second electron has been found in same cluster - Bool_t isMerged = kFALSE; // largest contribution to cluster is photon, second photon or electron from dalitz has been found in same cluster + Bool_t isMerged = kFALSE; // cluster contains more than one particle from the same decay Bool_t isMergedPartConv = kFALSE; // cluster contains more than one particle from the same decay and at least one of the particles came from a conversion - Bool_t isDalitz = kFALSE; // this cluster was created by a particle stemming from a dality decay - Bool_t isDalitzMerged = kFALSE; // this cluster was created by a particle stemming from a dality decay and more than one particle of the dalitz decay is contained in the cluster + Bool_t isDalitz = kFALSE; // this cluster was created by a particle stemming from a dalitz decay + Bool_t isDalitzMerged = kFALSE; // this cluster was created by a particle stemming from a dalitz decay and more than one particle of the dalitz decay is contained in the cluster Bool_t isPhotonWithElecMother = kFALSE; // this cluster is from a photon with an electron as mother Bool_t isShower = kFALSE; // this cluster contains as a largest contribution a particle from a shower or radiative process - + Bool_t isSubLeadingEM = kFALSE; // cluster contains at least one electron or photon from a pi0, eta or eta_prime in subleading contribution TParticle* Photon; if (fNCaloPhotonMCLabels==0) return; @@ -142,7 +158,6 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlags(AliStack *MCStack){ return; } - Int_t particleMotherLabel = Photon->GetMother(0); Int_t particleGrandMotherLabel = -1; Int_t particleMotherPDG = -1; @@ -158,13 +173,27 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlags(AliStack *MCStack){ particleGrandMotherNDaugthers = MCStack->Particle(MCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetNDaughters(); } } - - // Check wether the first contribution was photon - if(MCStack->Particle(GetCaloPhotonMCLabel(0))->GetPdgCode() == 22){ + + //determine mother/grandmother of leading particle and if it is pion/eta/eta_prime: fill array fCaloPhotonMotherMCLabels at position 0 + if (particleMotherLabel > -1){ + if( abs(particleMotherPDG) == 111 || abs(particleMotherPDG) == 221 || abs(particleMotherPDG) == 331 ){ + fCaloPhotonMotherMCLabels[0] = particleMotherLabel; + fNCaloPhotonMotherMCLabels++; + } + else if (particleGrandMotherLabel > -1){ + if ( abs(particleMotherPDG) == 22 && (abs(particleGrandMotherPDG) == 111 || abs(particleGrandMotherPDG) == 221 || abs(particleGrandMotherPDG) == 331) ){ + fCaloPhotonMotherMCLabels[0] = particleGrandMotherLabel; + fNCaloPhotonMotherMCLabels++; + } + } + } + + // Check whether the first contribution was photon + if(abs(MCStack->Particle(GetCaloPhotonMCLabel(0))->GetPdgCode()) == 22){ isPhoton=kTRUE; // did it decay via the dalitz channel if (particleMotherLabel > -1 && particleMotherNDaugthers == 3) isDalitz = kTRUE; - // Test wether particle stems from a shower or radiation + // Test whether particle stems from a shower or radiation if (abs(particleMotherPDG) == 11){ // check whether photon stems from electron isPhotonWithElecMother = kTRUE; if (particleGrandMotherLabel > -1){ // test whether first particle has a grandmother @@ -172,9 +201,9 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlags(AliStack *MCStack){ } } } - // Check wether the first contribution was electron + // Check whether the first contribution was electron if( abs(MCStack->Particle(GetCaloPhotonMCLabel(0))->GetPdgCode()) == 11 ){ - isElectron=kTRUE; + isElectron=kTRUE; if (particleMotherLabel > -1) { // was it a conversion if (abs(particleMotherPDG) == 22) isConversion = kTRUE; @@ -182,100 +211,118 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlags(AliStack *MCStack){ if (particleGrandMotherLabel > -1 && particleGrandMotherNDaugthers == 3 ) isDalitz = kTRUE; } if (particleGrandMotherLabel > -1){ // check whether electron has a grandmother - if (abs(particleGrandMotherPDG) == 11 || abs(particleGrandMotherPDG) == 22){ // test wether electron has photon or electron as grandmother (meaning will most likely be a shower) + if (abs(particleGrandMotherPDG) == 11 || abs(particleGrandMotherPDG) == 22){ // test whether electron has photon or electron as grandmother (meaning will most likely be a shower) isShower = kTRUE; } } } - - // check wether there were other contributions to the cluster + + + // check whether there were other contributions to the cluster if (fNCaloPhotonMCLabels>1){ - // largest contribution was from photon and is not from shower or electron mother - if (isPhoton && (!isShower || !isPhotonWithElecMother )){ -// cout << "largest contribution is photon, with mother: " << particleMotherLabel <<"(" << particleMotherPDG<< ")" << "\t with " << particleMotherNDaugthers << " daugthers and grand mother: " << particleGrandMotherLabel <<"(" << particleGrandMotherPDG << ")" << endl; - - TParticle* dummyPart =NULL; - for (Int_t i = 1; i< fNCaloPhotonMCLabels; i++){ - if (i > 49) continue; // abort if more than 20 entries to the cluster have been checked (more are not stored in these objects) - dummyPart = MCStack->Particle(GetCaloPhotonMCLabel(i)); - Int_t dummyPartMotherLabel = dummyPart->GetMother(0); - Int_t dummyPartGrandMotherLabel = -1; - Int_t dummyPartMotherPDG = -1; - Int_t dummyPartGrandMotherPDG = -1; - - // check wether this particle has a mother & obtain the pdg code - if (dummyPartMotherLabel > -1){ - dummyPartGrandMotherLabel = MCStack->Particle(dummyPart->GetMother(0))->GetMother(0); - dummyPartMotherPDG = MCStack->Particle(dummyPart->GetMother(0))->GetPdgCode(); - // check wether this particle has a grandmother & obtain its pdg code - if (dummyPartGrandMotherLabel > -1){ - dummyPartGrandMotherPDG = MCStack->Particle(MCStack->Particle(dummyPart->GetMother(0))->GetMother(0))->GetPdgCode(); - } + TParticle* dummyPart =NULL; + for (Int_t i = 1; i< fNCaloPhotonMCLabels; i++){ + if (i > 19) continue; // abort if more than 20 entries to the cluster have been checked (more are not stored in these objects) + dummyPart = MCStack->Particle(GetCaloPhotonMCLabel(i)); + Int_t dummyPartMotherLabel = dummyPart->GetMother(0); + Int_t dummyPartGrandMotherLabel = -1; + Int_t dummyPartMotherPDG = -1; + Int_t dummyPartGrandMotherPDG = -1; + // check whether this particle has a mother & obtain the pdg code + if (dummyPartMotherLabel > -1){ + dummyPartGrandMotherLabel = MCStack->Particle(dummyPart->GetMother(0))->GetMother(0); + dummyPartMotherPDG = MCStack->Particle(dummyPart->GetMother(0))->GetPdgCode(); + // check whether this particle has a grandmother & obtain its pdg code + if (dummyPartGrandMotherLabel > -1){ + dummyPartGrandMotherPDG = MCStack->Particle(MCStack->Particle(dummyPart->GetMother(0))->GetMother(0))->GetPdgCode(); } - - if (particleMotherLabel > -1){ // test whether first particle has a mother + } + // largest contribution was from photon and is not from shower or electron mother + if (isPhoton && (!isShower || !isPhotonWithElecMother )){ + if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){ // test whether first particle has a mother if (dummyPartMotherLabel == particleMotherLabel) isMerged = kTRUE; // test whether current and first particle have the same mother => i.e. other gamma from decay or dalitz electron if (dummyPartGrandMotherLabel > -1){ // test whether first particle has a grandmother - // check wether particle is an electron from a conversion of a photon from the original mother - if (abs(dummyPart->GetPdgCode()) == 11 && dummyPartGrandMotherLabel == particleMotherLabel ) isMergedPartConv = kTRUE; - // check wether particle is an electron from a dalitz decay from the original mother + // check whether particle is an electron from a conversion of a photon from the original mother + if (abs(dummyPart->GetPdgCode()) == 11 && dummyPartGrandMotherLabel == particleMotherLabel ) isMergedPartConv = kTRUE; + // check whether particle is an electron from a dalitz decay from the original mother if (abs(dummyPart->GetPdgCode()) == 11 && dummyPartMotherLabel == particleMotherLabel ) isDalitzMerged = kTRUE; - } - } -// cout << i << "\t" <GetPdgCode() << "\t mother is: " << dummyPartMotherLabel <<"(" << dummyPartMotherPDG<< ")"<< "\t grandmother is: " << dummyPartGrandMotherLabel<<"(" << dummyPartGrandMotherPDG<< ")"<< endl; - - } - } - // largest contribution was from electron & not a from a shower - if (isElectron && !isShower){ -// cout << "largest contribution is electron, with mother: " << particleMotherLabel <<"(" << particleMotherPDG<< ")" << "\t and grand mother: " << particleGrandMotherLabel <<"(" << particleGrandMotherPDG << ")" << endl; - TParticle* dummyPart =NULL; - for (Int_t i = 1; i< fNCaloPhotonMCLabels; i++){ - if (i > 49) continue; - - dummyPart = MCStack->Particle(GetCaloPhotonMCLabel(i)); - Int_t dummyPartMotherLabel = dummyPart->GetMother(0); - Int_t dummyPartGrandMotherLabel = -1; - Int_t dummyPartMotherPDG = -1; - Int_t dummyPartGrandMotherPDG = -1; - - // check wether this particle has a mother & obtain the pdg code - if (dummyPartMotherLabel > -1){ - dummyPartGrandMotherLabel = MCStack->Particle(dummyPart->GetMother(0))->GetMother(0); - dummyPartMotherPDG = MCStack->Particle(dummyPart->GetMother(0))->GetPdgCode(); - // check wether this particle has a grandmother & obtain its pdg code - if (dummyPartGrandMotherLabel > -1){ - dummyPartGrandMotherPDG = MCStack->Particle(MCStack->Particle(dummyPart->GetMother(0))->GetMother(0))->GetPdgCode(); } } - - if (particleMotherLabel > -1){ // test whether first particle has a mother - if (isConversion && dummyPartMotherLabel == particleMotherLabel) isConversionFullyContained = kTRUE; // test whether conversion is fully contained in cluster + } + + // largest contribution was from electron & not a from a shower + if (isElectron && !isShower){ + if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){ // test whether first particle has a mother + if (isConversion && dummyPartMotherLabel == particleMotherLabel) isConversionFullyContained = kTRUE; // test whether conversion is fully contained in cluster - if (particleGrandMotherLabel > -1){ // test whether first particle has a grandmother + if (dummyPartGrandMotherLabel > -1 && particleGrandMotherLabel > -1){ // test whether first particle has a grandmother if (abs(dummyPart->GetPdgCode()) == 22){ // test whether this particle is a photon - // check wether orginal electron and this photon stem from the same particle and electron stems from conversion + // check whether orginal electron and this photon stem from the same particle and electron stems from conversion if( dummyPartMotherLabel == particleGrandMotherLabel && (abs(dummyPartMotherPDG) != 11 || abs(dummyPartMotherPDG) != 22 ) ) isMergedPartConv = kTRUE; - // check wether orginal electron and this photon stem from the same particle and electron originated in dalitz + // check whether orginal electron and this photon stem from the same particle and electron originated in dalitz if( dummyPartMotherLabel == particleMotherLabel && (abs(dummyPartMotherPDG) != 11 || abs(dummyPartMotherPDG) != 22 ) ) isDalitzMerged = kTRUE; } if (abs(dummyPart->GetPdgCode()) == 11) { - // check wether orginal electron and this electron stem from the same particle and electron stems from conversion + // check whether orginal electron and this electron stem from the same particle and electron stems from conversion if( dummyPartGrandMotherLabel == particleGrandMotherLabel && (abs(dummyPartGrandMotherPDG) != 11 || abs(dummyPartGrandMotherPDG) != 22 ) ) isMergedPartConv = kTRUE; - // check wether orginal electron and this electron stem from the same particle and electron originated in dalitz decay + // check whether orginal electron and this electron stem from the same particle and electron originated in dalitz decay if( dummyPartMotherLabel == particleMotherLabel && abs(particleMotherPDG) != 22 && (abs(dummyPartGrandMotherPDG) != 11 || abs(dummyPartGrandMotherPDG) != 22 ) ) isDalitzMerged = kTRUE; } - - } - } -// cout << i << "\t" << GetCaloPhotonMCLabel(i) << "\t" << dummyPart->GetPdgCode() << "\t mother is: " << dummyPartMotherLabel <<"(" << dummyPartMotherPDG<< ")"<< "\t grandmother is: " << dummyPartGrandMotherLabel<<"(" << dummyPartGrandMotherPDG<< ")"<< endl; - - } + + } + } + } + + if (dummyPartMotherLabel > -1){ // test whether particle has a mother + if (abs(dummyPart->GetPdgCode()) == 22){ // test whether particle is a photon + //check if photon directly comes from a pion/eta/eta_prime decay + if ( abs(dummyPartMotherPDG) == 111 || abs(dummyPartMotherPDG) == 221 || abs(dummyPartMotherPDG) == 331){ + fCaloPhotonMotherMCLabels[i] = dummyPartMotherLabel; + Bool_t helpN=true; + for(Int_t j=0; jGetPdgCode()) == 11){ //test whether particle is an electron + //check if electron comes from a pion decay + if ( abs(dummyPartMotherPDG) == 111){ + fCaloPhotonMotherMCLabels[i] = dummyPartMotherLabel; + Bool_t helpN=true; + for(Int_t j=0; j -1){ //if it is not a dalitz decay, test whether particle has a grandmother + //check if it is a conversion electron that has pion/eta/eta_prime as grandmother + if ( abs(dummyPartMotherPDG) == 22 && (abs(dummyPartGrandMotherPDG) == 111 || abs(dummyPartGrandMotherPDG) == 221 || abs(dummyPartGrandMotherPDG) == 331)){ + fCaloPhotonMotherMCLabels[i] = dummyPartGrandMotherLabel; + Bool_t helpN=true; + for(Int_t j=0; j(event->FindListObject(AliAODMCParticle::StdBranchName())); if (!AODMCTrackArray) return; - Bool_t isPhoton = kFALSE; // largest contribution to cluster is photon Bool_t isElectron = kFALSE; // largest contribution to cluster is electron Bool_t isConversion = kFALSE; // largest contribution to cluster is converted electron @@ -294,9 +340,12 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlagsAOD(AliVEvent* event){ Bool_t isDalitzMerged = kFALSE; // this cluster was created by a particle stemming from a dality decay and more than one particle of the dalitz decay is contained in the cluster Bool_t isPhotonWithElecMother = kFALSE; // this cluster is from a photon with an electron as mother Bool_t isShower = kFALSE; // this cluster contains as a largest contribution a particle from a shower or radiative process - + Bool_t isSubLeadingEM = kFALSE; // cluster contains at least one electron or photon from a pi0 or eta in subleading contribution AliAODMCParticle* Photon; + AliAODMCParticle* PhotonMother; + AliAODMCParticle* PhotonGrandMother; + if (fNCaloPhotonMCLabels==0) return; Photon = (AliAODMCParticle*) AODMCTrackArray->At(GetCaloPhotonMCLabel(0)); @@ -304,8 +353,6 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlagsAOD(AliVEvent* event){ return; } - AliAODMCParticle* PhotonMother; - AliAODMCParticle* PhotonGrandMother; Int_t particleMotherLabel = Photon->GetMother(); Int_t particleGrandMotherLabel = -1; Int_t particleMotherPDG = -1; @@ -323,13 +370,27 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlagsAOD(AliVEvent* event){ particleGrandMotherNDaugthers = PhotonGrandMother->GetNDaughters(); } } + + //determine mother/grandmother of leading particle and if it is pion/eta/eta_prime: fill array fCaloPhotonMotherMCLabels at position 0 + if (particleMotherLabel > -1){ + if( abs(particleMotherPDG) == 111 || abs(particleMotherPDG) == 221 || abs(particleMotherPDG) == 331 ){ + fCaloPhotonMotherMCLabels[0] = particleMotherLabel; + fNCaloPhotonMotherMCLabels++; + } + else if (particleGrandMotherLabel > -1){ + if ( abs(particleMotherPDG) == 22 && (abs(particleGrandMotherPDG) == 111 || abs(particleGrandMotherPDG) == 221 || abs(particleGrandMotherPDG) == 331) ){ + fCaloPhotonMotherMCLabels[0] = particleGrandMotherLabel; + fNCaloPhotonMotherMCLabels++; + } + } + } - // Check wether the first contribution was photon + // Check whether the first contribution was photon if(abs(Photon->GetPdgCode()) == 22){ isPhoton=kTRUE; // did it decay via the dalitz channel if (particleMotherLabel > -1 && particleMotherNDaugthers == 3) isDalitz = kTRUE; - // Test wether particle stems from a shower or radiation + // Test whether particle stems from a shower or radiation if (abs(particleMotherPDG) == 11){ // check whether photon stems from electron isPhotonWithElecMother = kTRUE; if (particleGrandMotherLabel > -1){ // test whether first particle has a grandmother @@ -337,7 +398,7 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlagsAOD(AliVEvent* event){ } } } - // Check wether the first contribution was electron + // Check whether the first contribution was electron if(abs(Photon->GetPdgCode()) == 11 ){ isElectron=kTRUE; if (particleMotherLabel > -1) { @@ -347,108 +408,122 @@ void AliAODConversionPhoton::SetCaloPhotonMCFlagsAOD(AliVEvent* event){ if (particleGrandMotherLabel > -1 && particleGrandMotherNDaugthers == 3 ) isDalitz = kTRUE; } if (particleGrandMotherLabel > -1){ // check whether electron has a grandmother - if (abs(particleGrandMotherPDG) == 11 || abs(particleGrandMotherPDG) == 22){ // test wether electron has photon or electron as grandmother (meaning will most likely be a shower) + if (abs(particleGrandMotherPDG) == 11 || abs(particleGrandMotherPDG) == 22){ // test whether electron has photon or electron as grandmother (meaning will most likely be a shower) isShower = kTRUE; } } } - // check wether there were other contributions to the cluster + + // check whether there were other contributions to the cluster if (fNCaloPhotonMCLabels>1){ - // largest contribution was from photon and is not from shower or electron mother - if (isPhoton && (!isShower || !isPhotonWithElecMother )){ -// cout << "largest contribution is photon, with mother: " << particleMotherLabel <<"(" << particleMotherPDG<< ")" << "\t with " << particleMotherNDaugthers << " daugthers and grand mother: " << particleGrandMotherLabel <<"(" << particleGrandMotherPDG << ")" << endl; - - AliAODMCParticle* dummyPart =NULL; - AliAODMCParticle* dummyPartMother = NULL; - AliAODMCParticle* dummyPartGrandMother = NULL; - - for (Int_t i = 1; i< fNCaloPhotonMCLabels; i++){ - if (i > 49) continue; // abort if more than 20 entries to the cluster have been checked (more are not stored in these objects) - dummyPart = (AliAODMCParticle*) AODMCTrackArray->At(GetCaloPhotonMCLabel(i)); - Int_t dummyPartMotherLabel = dummyPart->GetMother(); - Int_t dummyPartGrandMotherLabel = -1; - Int_t dummyPartMotherPDG = -1; - Int_t dummyPartGrandMotherPDG = -1; - - // check wether this particle has a mother & obtain the pdg code - if (dummyPartMotherLabel > -1){ - dummyPartMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPart->GetMother()); - dummyPartGrandMotherLabel = dummyPartMother->GetMother(); - dummyPartMotherPDG = dummyPartMother->GetPdgCode(); - // check wether this particle has a grandmother & obtain its pdg code - if (dummyPartGrandMotherLabel > -1){ - dummyPartGrandMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPartMother->GetMother()); - dummyPartGrandMotherPDG = dummyPartGrandMother->GetPdgCode(); - } + AliAODMCParticle* dummyPart =NULL; + AliAODMCParticle* dummyPartMother = NULL; + AliAODMCParticle* dummyPartGrandMother = NULL; + for (Int_t i = 1; i< fNCaloPhotonMCLabels; i++){ + if (i > 19) continue; // abort if more than 20 entries to the cluster have been checked (more are not stored in these objects) + dummyPart = (AliAODMCParticle*) AODMCTrackArray->At(GetCaloPhotonMCLabel(i)); + Int_t dummyPartMotherLabel = dummyPart->GetMother(); + Int_t dummyPartGrandMotherLabel = -1; + Int_t dummyPartMotherPDG = -1; + Int_t dummyPartGrandMotherPDG = -1; + + // check whether this particle has a mother & obtain the pdg code + if (dummyPartMotherLabel > -1){ + dummyPartMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPart->GetMother()); + dummyPartGrandMotherLabel = dummyPartMother->GetMother(); + dummyPartMotherPDG = dummyPartMother->GetPdgCode(); + // check whether this particle has a grandmother & obtain its pdg code + if (dummyPartGrandMotherLabel > -1){ + dummyPartGrandMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPartMother->GetMother()); + dummyPartGrandMotherPDG = dummyPartGrandMother->GetPdgCode(); } - - if (particleMotherLabel > -1){ // test whether first particle has a mother + } + + // largest contribution was from photon and is not from shower or electron mother + if (isPhoton && (!isShower || !isPhotonWithElecMother )){ + if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){ // test whether first particle has a mother if (dummyPartMotherLabel == particleMotherLabel) isMerged = kTRUE; // test whether current and first particle have the same mother => i.e. other gamma from decay or dalitz electron if (dummyPartGrandMotherLabel > -1){ // test whether first particle has a grandmother - // check wether particle is an electron from a conversion of a photon from the original mother - if (abs(dummyPart->GetPdgCode()) == 11 && dummyPartGrandMotherLabel == particleMotherLabel ) isMergedPartConv = kTRUE; - // check wether particle is an electron from a dalitz decay from the original mother + // check whether particle is an electron from a conversion of a photon from the original mother + if (abs(dummyPart->GetPdgCode()) == 11 && dummyPartGrandMotherLabel == particleMotherLabel ) isMergedPartConv = kTRUE; + // check whether particle is an electron from a dalitz decay from the original mother if (abs(dummyPart->GetPdgCode()) == 11 && dummyPartMotherLabel == particleMotherLabel ) isDalitzMerged = kTRUE; - } - } -// cout << i << "\t" <GetPdgCode() << "\t mother is: " << dummyPartMotherLabel <<"(" << dummyPartMotherPDG<< ")"<< "\t grandmother is: " << dummyPartGrandMotherLabel<<"(" << dummyPartGrandMotherPDG<< ")"<< endl; - - } - } - // largest contribution was from electron & not a from a shower - if (isElectron && !isShower){ -// cout << "largest contribution is electron, with mother: " << particleMotherLabel <<"(" << particleMotherPDG<< ")" << "\t and grand mother: " << particleGrandMotherLabel <<"(" << particleGrandMotherPDG << ")" << endl; - AliAODMCParticle* dummyPart =NULL; - AliAODMCParticle* dummyPartMother = NULL; - AliAODMCParticle* dummyPartGrandMother = NULL; - - for (Int_t i = 1; i< fNCaloPhotonMCLabels; i++){ - if (i > 49) continue; - - dummyPart = (AliAODMCParticle*)AODMCTrackArray->At(GetCaloPhotonMCLabel(i)); - Int_t dummyPartMotherLabel = dummyPart->GetMother(); - Int_t dummyPartGrandMotherLabel = -1; - Int_t dummyPartMotherPDG = -1; - Int_t dummyPartGrandMotherPDG = -1; - - if (dummyPartMotherLabel > -1){ - dummyPartMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPart->GetMother()); - dummyPartGrandMotherLabel = dummyPartMother->GetMother(); - dummyPartMotherPDG = dummyPartMother->GetPdgCode(); - // check wether this particle has a grandmother & obtain its pdg code - if (dummyPartGrandMotherLabel > -1){ - dummyPartGrandMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyPartMother->GetMother()); - dummyPartGrandMotherPDG = dummyPartGrandMother->GetPdgCode(); } } - - if (particleMotherLabel > -1){ // test whether first particle has a mother - if (isConversion && dummyPartMotherLabel == particleMotherLabel) isConversionFullyContained = kTRUE; // test whether conversion is fully contained in cluster + } + + // largest contribution was from electron & not a from a shower + if (isElectron && !isShower){ + if (dummyPartMotherLabel > -1 && particleMotherLabel > -1){ // test whether first particle has a mother + if (isConversion && dummyPartMotherLabel == particleMotherLabel) isConversionFullyContained = kTRUE; // test whether conversion is fully contained in cluster - if (particleGrandMotherLabel > -1){ // test whether first particle has a grandmother + if (dummyPartGrandMotherLabel > -1 && particleGrandMotherLabel > -1){ // test whether first particle has a grandmother if (abs(dummyPart->GetPdgCode()) == 22){ // test whether this particle is a photon - // check wether orginal electron and this photon stem from the same particle and electron stems from conversion + // check whether orginal electron and this photon stem from the same particle and electron stems from conversion if( dummyPartMotherLabel == particleGrandMotherLabel && (abs(dummyPartMotherPDG) != 11 || abs(dummyPartMotherPDG) != 22 ) ) isMergedPartConv = kTRUE; - // check wether orginal electron and this photon stem from the same particle and electron originated in dalitz + // check whether orginal electron and this photon stem from the same particle and electron originated in dalitz if( dummyPartMotherLabel == particleMotherLabel && (abs(dummyPartMotherPDG) != 11 || abs(dummyPartMotherPDG) != 22 ) ) isDalitzMerged = kTRUE; } if (abs(dummyPart->GetPdgCode()) == 11) { - // check wether orginal electron and this electron stem from the same particle and electron stems from conversion + // check whether orginal electron and this electron stem from the same particle and electron stems from conversion if( dummyPartGrandMotherLabel == particleGrandMotherLabel && (abs(dummyPartGrandMotherPDG) != 11 || abs(dummyPartGrandMotherPDG) != 22 ) ) isMergedPartConv = kTRUE; - // check wether orginal electron and this electron stem from the same particle and electron originated in dalitz decay + // check whether orginal electron and this electron stem from the same particle and electron originated in dalitz decay if( dummyPartMotherLabel == particleMotherLabel && abs(particleMotherPDG) != 22 && (abs(dummyPartGrandMotherPDG) != 11 || abs(dummyPartGrandMotherPDG) != 22 ) ) isDalitzMerged = kTRUE; } - - } - } -// cout << i << "\t" << GetCaloPhotonMCLabel(i) << "\t" << dummyPart->GetPdgCode() << "\t mother is: " << dummyPartMotherLabel <<"(" << dummyPartMotherPDG<< ")"<< "\t grandmother is: " << dummyPartGrandMotherLabel<<"(" << dummyPartGrandMotherPDG<< ")"<< endl; - - } - } - } - fCaloPhotonMCFlags = isPhoton *1 + isElectron *2 + isConversion*4+ isConversionFullyContained *8 + isMerged *16 + isMergedPartConv*32 + isDalitz *64 + isDalitzMerged *128 + isPhotonWithElecMother *256 + isShower * 512; -// cout << "isPhoton: \t" << isPhoton << "\t isElectron: \t" << isElectron << "\t isConversion: \t" << isConversion << "\t isConversionFullyContained: \t" << isConversionFullyContained << "\t isMerged: \t" << isMerged << "\t isMergedPartConv: \t" << isMergedPartConv << "\t isPhotonWithElecMother: \t" << isPhotonWithElecMother<< "\t isDalitz: \t" << isDalitz << "\t isDalitzMerged: \t" << isDalitzMerged << "\t isShower: \t" << isShower << "\t"<< fCaloPhotonMCFlags<< endl; - -} \ No newline at end of file + } + } + } + + if (dummyPartMotherLabel > -1){ // test whether particle has a mother + if (abs(dummyPart->GetPdgCode()) == 22){ // test whether particle is a photon + //check if photon directly comes from a pion/eta/eta_prime decay + if ( abs(dummyPartMotherPDG) == 111 || abs(dummyPartMotherPDG) == 221 || abs(dummyPartMotherPDG) == 331){ + fCaloPhotonMotherMCLabels[i] = dummyPartMotherLabel; + Bool_t helpN=true; + for(Int_t j=0; jGetPdgCode()) == 11){ //test whether particle is an electron + //check if electron comes from a pion decay + if ( abs(dummyPartMotherPDG) == 111){ + fCaloPhotonMotherMCLabels[i] = dummyPartMotherLabel; + Bool_t helpN=true; + for(Int_t j=0; j -1){ //if it is not a dalitz decay, test whether particle has a grandmother + //check if it is a conversion electron that has pion/eta/eta_prime as grandmother + if ( abs(dummyPartMotherPDG) == 22 && (abs(dummyPartGrandMotherPDG) == 111 || abs(dummyPartGrandMotherPDG) == 221 || abs(dummyPartGrandMotherPDG) == 331)){ + fCaloPhotonMotherMCLabels[i] = dummyPartGrandMotherLabel; + Bool_t helpN=true; + for(Int_t j=0; jAdd(fHistoTrueClusPhotonFromElecMotherPt[iCut]); fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",250,0,25); fTagOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]); + fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",250,0,25); + fTagOutputList[iCut]->Add(fHistoTrueClusSubLeadingPt[iCut]); + fHistoTrueClusNParticles[iCut] = new TH1I("TrueClusNParticles","TrueClusNParticles",20,0,20); + fTagOutputList[iCut]->Add(fHistoTrueClusNParticles[iCut]); fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",250,0,25); fTagOutputList[iCut]->Add(fHistoTrueClusEMNonLeadingPt[iCut]); fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus","TrueNLabelsInClus",100,-0.5,99.5); @@ -1384,7 +1394,7 @@ void AliAnalysisTaskGammaConvCalo::ProcessClusters() // cout << clus->GetNLabels() << endl; if (clus->GetNLabels()>0){ for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){ - if (k< 50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]); + if (k< 20)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]); // Int_t pdgCode = fMCStack->Particle(mclabelsCluster[k])->GetPdgCode(); // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl; } @@ -1454,6 +1464,9 @@ void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidates(AliAODConversion fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt()); if (TruePhotonCandidate->IsShower()) fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt()); + if (TruePhotonCandidate->IsSubLeadingEM()) + fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt()); + fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels()); } } @@ -1483,7 +1496,7 @@ void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidatesAOD(AliAODConvers } if(Photon == NULL){ - // cout << "no photon" << endl; + // cout << "no photon" << endl; return; } TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent); @@ -1513,6 +1526,9 @@ void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidatesAOD(AliAODConvers fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt()); if (TruePhotonCandidate->IsShower()) fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt()); + if (TruePhotonCandidate->IsSubLeadingEM()) + fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt()); + fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels()); } } @@ -1786,7 +1802,7 @@ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidatesAOD(AliAODConversi //________________________________________________________________________ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidates(AliAODConversionPhoton *TruePhotonCandidate) { - + Double_t magField = fInputEvent->GetMagneticField(); if( magField < 0.0 ){ magField = 1.0; @@ -1794,7 +1810,7 @@ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidates(AliAODConversionP else { magField = -1.0; } - + // Process True Photons TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack); TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack); @@ -1815,7 +1831,7 @@ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidates(AliAODConversionP if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge - + TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack); if(Photon->GetPdgCode() != 22){ @@ -1859,18 +1875,17 @@ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidates(AliAODConversionP } } } - + // pi0 photon //Bool_t bpi0 = 0; Int_t imother = Photon->GetMother(0); - if (imother > -1){ - AliMCParticle *McMother = static_cast(fMCEvent->GetTrack(imother)); - if(McMother->PdgCode() == 111){ - fHistoTrueConvPi0GammaPt[fiCut]->Fill(TruePhotonCandidate->Pt()); - } + if(imother > -1){ + AliMCParticle* McMother = static_cast(fMCEvent->GetTrack(imother)); + //cout << fMCEvent->GetRunNumber() << " " << imother << " " << fMCEvent->GetNumberOfTracks() << endl; + if(McMother->PdgCode() == 111) fHistoTrueConvPi0GammaPt[fiCut]->Fill(TruePhotonCandidate->Pt()); } + return; } - //________________________________________________________________________ void AliAnalysisTaskGammaConvCalo::ProcessAODMCParticles() { diff --git a/PWGGA/GammaConv/AliAnalysisTaskGammaConvCalo.h b/PWGGA/GammaConv/AliAnalysisTaskGammaConvCalo.h index 350d7209484..3eeb2d8172f 100644 --- a/PWGGA/GammaConv/AliAnalysisTaskGammaConvCalo.h +++ b/PWGGA/GammaConv/AliAnalysisTaskGammaConvCalo.h @@ -269,6 +269,8 @@ class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE { TH1F **fHistoTrueClusDalitzMergedPt; //! array of histos with validated Dalitz decay, more than one decay product in cluster, pt TH1F **fHistoTrueClusPhotonFromElecMotherPt; //! array of histos with validated photon from electron, pt TH1F **fHistoTrueClusShowerPt; //! array of histos with validated shower, pt + TH1F **fHistoTrueClusSubLeadingPt; //! array of histos with pi0/eta/eta_prime in subleading contribution + TH1I **fHistoTrueClusNParticles; //! array of histos with number of different particles (pi0/eta/eta_prime) contributing to cluster TH1F **fHistoTrueClusEMNonLeadingPt; //! array of histos with cluster with largest energy by hadron TH1F **fHistoTrueNLabelsInClus; //! array of histos with number of labels in cluster TH1F **fHistoTruePrimaryClusGammaPt; //! array of histos with validated primary cluster, pt -- 2.39.3