- fixed MC routines in CaloConv task, added corresponding addtasks
authorfbock <friederike.bock@cern.ch>
Wed, 23 Jul 2014 13:28:43 +0000 (15:28 +0200)
committerfbock <friederike.bock@cern.ch>
Wed, 23 Jul 2014 13:28:43 +0000 (15:28 +0200)
PWGGA/GammaConv/AliAODConversionPhoton.cxx
PWGGA/GammaConv/AliAODConversionPhoton.h
PWGGA/GammaConv/AliAnalysisTaskGammaConvCalo.cxx
PWGGA/GammaConv/AliAnalysisTaskGammaConvCalo.h
PWGGA/GammaConv/AliCaloPhotonCuts.cxx
PWGGA/GammaConv/AliCaloPhotonCuts.h
PWGGA/GammaConv/macros/AddTask_GammaConvCalo_PbPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvCalo_pPb.C
PWGGA/GammaConv/macros/AddTask_GammaConvCalo_pp.C
PWGGA/GammaConv/macros/AddTask_GammaConvV1_pPb.C

index f69f7ba..7431b33 100644 (file)
@@ -1,3 +1,5 @@
+#include "AliAODMCParticle.h"
+#include "AliAODMCHeader.h"
 #include "AliAODConversionPhoton.h"
 #include "AliKFConversionPhoton.h"
 
@@ -9,8 +11,15 @@ AliAODConversionPhoton::AliAODConversionPhoton() :
 AliAODConversionParticle(),
 AliConversionPhotonBase(),
 fDCArPrimVtx(0),
-fDCAzPrimVtx(0)
+fDCAzPrimVtx(0),
+fCaloPhoton(0),
+fNCaloPhotonMCLabels(0),
+fCaloPhotonMCFlags(0)
 {
+       // initialize calo photon MC labels
+       for (Int_t i =0; i<50; i++){
+               fCaloPhotonMCLabels[i]=-1;              
+       }
   //Standard constructor
 }
 
@@ -18,22 +27,40 @@ AliAODConversionPhoton::AliAODConversionPhoton(AliKFConversionPhoton *kfphoton)
 AliAODConversionParticle(kfphoton),
 AliConversionPhotonBase(*((AliConversionPhotonBase*)kfphoton)),
 fDCArPrimVtx(0),
-fDCAzPrimVtx(0)
+fDCAzPrimVtx(0),
+fCaloPhoton(0),
+fNCaloPhotonMCLabels(0),
+fCaloPhotonMCFlags(0)
 {
     //Constructor from kfphoton
 
     // puts the mass to zero and store dilepton mass
            SetMass(kfphoton->M());
-                       //SetE(P());
+
+       //SetE(P());
+               
+       // initialize calo photon MC labels
+       for (Int_t i =0; i<50; i++){
+               fCaloPhotonMCLabels[i]=-1;              
+       }
+       
 }
 
 AliAODConversionPhoton::AliAODConversionPhoton(TLorentzVector *vec) :
 AliAODConversionParticle(vec),
 AliConversionPhotonBase(),
 fDCArPrimVtx(0),
-fDCAzPrimVtx(0)
+fDCAzPrimVtx(0),
+fCaloPhoton(0),
+fNCaloPhotonMCLabels(0),
+fCaloPhotonMCFlags(0)
 {
     //Constructor from TLorentzVector
+
+       // initialize calo photon MC labels
+       for (Int_t i =0; i<50; i++){
+               fCaloPhotonMCLabels[i]=-1;              
+       }
 }
 
 
@@ -42,9 +69,17 @@ AliAODConversionPhoton::AliAODConversionPhoton(const AliAODConversionPhoton & or
 AliAODConversionParticle(original),
 AliConversionPhotonBase(original),
 fDCArPrimVtx(original.fDCArPrimVtx),
-fDCAzPrimVtx(original.fDCAzPrimVtx)
+fDCAzPrimVtx(original.fDCAzPrimVtx),
+fCaloPhoton(original.fCaloPhoton),
+fNCaloPhotonMCLabels(original.fNCaloPhotonMCLabels),
+fCaloPhotonMCFlags(original.fCaloPhotonMCFlags)
 {
-  //Copy constructor
+       //Copy constructor
+       
+       // initialize calo photon MC labels
+       for (Int_t i =0; i<50; i++){
+               fCaloPhotonMCLabels[i]=original.fCaloPhotonMCLabels[i];         
+       }
 }
 
 AliAODConversionPhoton::~AliAODConversionPhoton()
@@ -84,3 +119,335 @@ void AliAODConversionPhoton::CalculateDistanceOfClossetApproachToPrimVtx(const A
    return;
 }
 
+
+void AliAODConversionPhoton::SetCaloPhotonMCFlags(AliStack *MCStack){
+       
+       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
+       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 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 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
+       
+       
+       TParticle* Photon;
+       if (fNCaloPhotonMCLabels==0) return;
+       Photon = MCStack->Particle(GetCaloPhotonMCLabel(0));
+       
+       if(Photon == NULL){
+               return;
+       }
+
+
+       Int_t particleMotherLabel = Photon->GetMother(0);
+       Int_t particleGrandMotherLabel = -1; 
+       Int_t particleMotherPDG = -1; 
+       Int_t particleGrandMotherPDG = -1; 
+       Int_t particleMotherNDaugthers = 0;
+       Int_t particleGrandMotherNDaugthers = 0;
+       if (particleMotherLabel > -1){
+               particleMotherNDaugthers = MCStack->Particle(Photon->GetMother(0))->GetNDaughters();
+               particleGrandMotherLabel = MCStack->Particle(Photon->GetMother(0))->GetMother(0);
+               particleMotherPDG = MCStack->Particle(Photon->GetMother(0))->GetPdgCode();
+               if (particleGrandMotherLabel > -1){
+                       particleGrandMotherPDG = MCStack->Particle(MCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode();
+                       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){
+               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
+               if (abs(particleMotherPDG) == 11){                                                                      // check whether photon stems from electron
+                       isPhotonWithElecMother = kTRUE;
+                       if (particleGrandMotherLabel > -1){                                                                     // test whether first particle has a grandmother
+                               if (abs(particleGrandMotherPDG) == 22 ) isShower = kTRUE;       // check whether grandmother is a photon (meaning this is most likely a shower)
+                       }       
+               }                       
+       }
+       // Check wether the first contribution was electron
+       if( abs(MCStack->Particle(GetCaloPhotonMCLabel(0))->GetPdgCode()) == 11 ){
+               isElectron=kTRUE;       
+               if (particleMotherLabel > -1) {
+                       // was it a conversion
+                       if (abs(particleMotherPDG) == 22) isConversion = kTRUE;
+                       // did it decay via the dalitz channel
+                       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)
+                               isShower = kTRUE; 
+                       }       
+               }
+       }
+       
+       // check wether 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();
+                                       }
+                               }
+                               
+                               if (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
+                                               if (abs(dummyPart->GetPdgCode()) == 11 && dummyPartMotherLabel == particleMotherLabel ) isDalitzMerged = kTRUE;
+                                       }       
+                               }       
+//                             cout << i << "\t" <<GetCaloPhotonMCLabel(i) << "\t" << dummyPart->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 
+
+                                       if (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
+                                                       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
+                                                       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
+                                                       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
+                                                       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;                
+       }               
+       
+}
+
+void AliAODConversionPhoton::SetCaloPhotonMCFlagsAOD(AliVEvent* event){
+       
+       TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(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
+       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 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 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
+       
+       
+       AliAODMCParticle* Photon;
+       if (fNCaloPhotonMCLabels==0) return;
+       Photon = (AliAODMCParticle*) AODMCTrackArray->At(GetCaloPhotonMCLabel(0));
+       
+       if(Photon == NULL){
+               return;
+       }
+
+       AliAODMCParticle* PhotonMother;
+       AliAODMCParticle* PhotonGrandMother;
+       Int_t particleMotherLabel = Photon->GetMother();
+       Int_t particleGrandMotherLabel = -1; 
+       Int_t particleMotherPDG = -1; 
+       Int_t particleGrandMotherPDG = -1; 
+       Int_t particleMotherNDaugthers = 0;
+       Int_t particleGrandMotherNDaugthers = 0;
+       if (particleMotherLabel > -1){
+               PhotonMother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
+               particleMotherNDaugthers = PhotonMother->GetNDaughters();
+               particleGrandMotherLabel = PhotonMother->GetMother();
+               particleMotherPDG = PhotonMother->GetPdgCode();
+               if (particleGrandMotherLabel > -1){
+                       PhotonGrandMother = (AliAODMCParticle*) AODMCTrackArray->At(PhotonMother->GetMother());
+                       particleGrandMotherPDG = PhotonGrandMother->GetPdgCode();
+                       particleGrandMotherNDaugthers = PhotonGrandMother->GetNDaughters();
+               }       
+       }
+               
+       // Check wether 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
+               if (abs(particleMotherPDG) == 11){                                                                      // check whether photon stems from electron
+                       isPhotonWithElecMother = kTRUE;
+                       if (particleGrandMotherLabel > -1){                                                                     // test whether first particle has a grandmother
+                               if (abs(particleGrandMotherPDG) == 22 ) isShower = kTRUE;       // check whether grandmother is a photon (meaning this is most likely a shower)
+                       }       
+               }                       
+       }
+       // Check wether the first contribution was electron
+       if(abs(Photon->GetPdgCode()) == 11 ){
+               isElectron=kTRUE;       
+               if (particleMotherLabel > -1) {
+                       // was it a conversion
+                       if (abs(particleMotherPDG) == 22) isConversion = kTRUE;
+                       // did it decay via the dalitz channel
+                       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)
+                               isShower = kTRUE; 
+                       }       
+               }
+       }
+       
+       // check wether 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();
+                                       }
+                               }
+                               
+                               if (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
+                                               if (abs(dummyPart->GetPdgCode()) == 11 && dummyPartMotherLabel == particleMotherLabel ) isDalitzMerged = kTRUE;
+                                       }       
+                               }       
+//                             cout << i << "\t" <<GetCaloPhotonMCLabel(i) << "\t" << dummyPart->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 
+
+                                       if (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
+                                                       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
+                                                       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
+                                                       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
+                                                       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
index 15bbd1f..a8cb039 100644 (file)
@@ -7,45 +7,80 @@
 
 class AliAODConversionPhoton : public AliAODConversionParticle, public AliConversionPhotonBase {
 
- public: 
-
-  //Constructors
-  AliAODConversionPhoton();    
-  AliAODConversionPhoton(AliKFConversionPhoton *kfphoton);
-  AliAODConversionPhoton(TLorentzVector *vec);
-
-  //Copy Constructor
-  AliAODConversionPhoton(const AliAODConversionPhoton & g);           
-  //assignment operator
-  AliAODConversionPhoton & operator = (const AliAODConversionPhoton & g);
-
-  //Destructor
-  virtual ~AliAODConversionPhoton();
-
-  // Overwrite GetLabelFunctions to Make it accessible via AliAODConversionParticle
-  virtual Int_t GetLabel(Int_t i) const { return AliConversionPhotonBase::GetTrackLabel(i); };
-  virtual Int_t GetLabel1() const { return AliConversionPhotonBase::GetTrackLabelPositive(); };
-  virtual Int_t GetLabel2() const { return AliConversionPhotonBase::GetTrackLabelNegative(); };
-
-  virtual Double_t GetPhotonMass() const {return AliAODConversionParticle::M();}
-  virtual Double_t GetPhotonPt() const {return AliAODConversionParticle::Pt();}
-  virtual Double_t GetPhotonP() const {return AliAODConversionParticle::P();}
-  virtual Double_t GetPhotonEta() const {return AliAODConversionParticle::Eta();}
-  virtual Double_t GetPhotonTheta() const {return AliAODConversionParticle::Theta();}
-  virtual Double_t GetPhotonPhi() const {return AliAODConversionParticle::Phi();}
-  virtual Double_t GetPx() const { return AliAODConversionParticle::Px();}
-  virtual Double_t GetPy() const { return AliAODConversionParticle::Py();}
-  virtual Double_t GetPz() const { return AliAODConversionParticle::Pz();}
-  void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex* primVertex);
-  void SetMassToZero() { SetE(P()); }
-  Float_t GetDCAzToPrimVtx()const {return fDCAzPrimVtx;}
-  Float_t GetDCArToPrimVtx()const {return fDCArPrimVtx;}
-  
-  Float_t fDCArPrimVtx;
-  Float_t fDCAzPrimVtx;
-  
-  
-  ClassDef(AliAODConversionPhoton,2)
+       public: 
+
+               enum caloPhotonMCFlags_t {
+                       kIsPhoton                               = 0x001, kIsElectron            = 0x002, kIsConversion  = 0x004, kIsConversionFullyContained    = 0x008,
+                       kIsMerged                               = 0x010, kIsMergedPartConv      = 0x020, kIsDalitz              = 0x040, kIsDalitzMerged                                = 0x080,
+                       kIsPhotonWithElecMother = 0x100, kIsShower                      = 0x200
+               };
+               
+               //Constructors
+               AliAODConversionPhoton();    
+               AliAODConversionPhoton(AliKFConversionPhoton *kfphoton);
+               AliAODConversionPhoton(TLorentzVector *vec);
+
+               //Copy Constructor
+               AliAODConversionPhoton(const AliAODConversionPhoton & g);           
+               //assignment operator
+               AliAODConversionPhoton & operator = (const AliAODConversionPhoton & g);
+
+               //Destructor
+               virtual ~AliAODConversionPhoton();
+
+               // Overwrite GetLabelFunctions to Make it accessible via AliAODConversionParticle
+               virtual Int_t GetLabel(Int_t i) const { return AliConversionPhotonBase::GetTrackLabel(i); };
+               virtual Int_t GetLabel1() const { return AliConversionPhotonBase::GetTrackLabelPositive(); };
+               virtual Int_t GetLabel2() const { return AliConversionPhotonBase::GetTrackLabelNegative(); };
+
+               virtual Double_t GetPhotonMass() const {return AliAODConversionParticle::M();}
+               virtual Double_t GetPhotonPt() const {return AliAODConversionParticle::Pt();}
+               virtual Double_t GetPhotonP() const {return AliAODConversionParticle::P();}
+               virtual Double_t GetPhotonEta() const {return AliAODConversionParticle::Eta();}
+               virtual Double_t GetPhotonTheta() const {return AliAODConversionParticle::Theta();}
+               virtual Double_t GetPhotonPhi() const {return AliAODConversionParticle::Phi();}
+               virtual Double_t GetPx() const { return AliAODConversionParticle::Px();}
+               virtual Double_t GetPy() const { return AliAODConversionParticle::Py();}
+               virtual Double_t GetPz() const { return AliAODConversionParticle::Pz();}
+               void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex* primVertex);
+               void SetMassToZero() { SetE(P()); }
+               
+               Float_t GetDCAzToPrimVtx()const {return fDCAzPrimVtx;}
+               Float_t GetDCArToPrimVtx()const {return fDCArPrimVtx;}
+               
+               void SetIsCaloPhoton(){fCaloPhoton =1;}
+               Bool_t GetIsCaloPhoton(){return fCaloPhoton;}
+               void SetCaloPhotonMCLabel(Int_t i, Int_t labelCaloPhoton){fCaloPhotonMCLabels[i] = labelCaloPhoton;}
+               Int_t GetCaloPhotonMCLabel(Int_t i){return fCaloPhotonMCLabels[i];}
+               void SetNCaloPhotonMCLabels(Int_t nLabels){fNCaloPhotonMCLabels = nLabels;}
+               Int_t GetNCaloPhotonMCLabels(){return fNCaloPhotonMCLabels;}
+               void SetCaloPhotonMCFlags(AliStack *MCStack);
+               void SetCaloPhotonMCFlagsAOD(AliVEvent* event);
+               
+               //Calo cluster MC identifiers
+               Bool_t IsLargestComponentPhoton(){return fCaloPhotonMCFlags&kIsPhoton;}                                         // largest contribution to cluster is photon
+               Bool_t IsLargestComponentElectron(){return fCaloPhotonMCFlags&kIsElectron;}                                     // largest contribution to cluster is electron
+               Bool_t IsConversion(){return fCaloPhotonMCFlags&kIsConversion;}                                                         // largest contribution to cluster is converted electron
+               Bool_t IsConversionFullyContained(){return fCaloPhotonMCFlags&kIsConversionFullyContained;}     // largest contribution to cluster is converted electron & other electron has been found in cluster as well
+               Bool_t IsMerged(){return fCaloPhotonMCFlags&kIsMerged;}                                                                         // largest contribution to cluster is photon, second photon or electron from dalitz decay is found in cluster as well
+               Bool_t IsMergedPartConv(){return fCaloPhotonMCFlags&kIsMergedPartConv;}                                         // cluster contains more than 1 particle belonging to the same mother particle (i.e. pi0, eta ...) 
+                                                                                                                                                                                                       // & at least one of the decays was a conversion
+               Bool_t IsDalitz(){return fCaloPhotonMCFlags&kIsDalitz;}                                                                         // cluster contains particle from Dalitz decay
+               Bool_t IsDalitzMerged(){return fCaloPhotonMCFlags&kIsDalitzMerged;}                                                     // cluster contains particle from Dalitz decay & more than one particle of this decay is contained in cluster
+               Bool_t IsPhotonWithElecMother(){return fCaloPhotonMCFlags&kIsPhotonWithElecMother;}                     // largest contribution to cluster is photon which stems from an electron (i.e. radiation)
+               Bool_t IsShower(){return fCaloPhotonMCFlags&kIsShower;}                                                                         // largest contribution to cluster seems to stem from a shower
+               Bool_t IsEMNonLeading(){return !(fCaloPhotonMCFlags&kIsPhoton) && !(fCaloPhotonMCFlags&kIsElectron);} // largest contribution is from hadron
+               
+               
+               Float_t fDCArPrimVtx;
+               Float_t fDCAzPrimVtx;
+               Bool_t fCaloPhoton;
+               Int_t fNCaloPhotonMCLabels;
+               Int_t fCaloPhotonMCFlags;
+               Int_t fCaloPhotonMCLabels[50];
+               
+       
+       ClassDef(AliAODConversionPhoton,3)
 };
 
 
index c74127b..57f61e3 100644 (file)
@@ -154,6 +154,12 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(): AliAnalysisTaskSE(
        fHistoMCSecEtaPt(NULL),
        fHistoMCSecEtaSource(NULL),
        fHistoTrueMotherInvMassPt(NULL),
+       fHistoTrueMotherCaloPhotonInvMassPt(NULL),
+       fHistoTrueMotherCaloConvertedPhotonInvMassPt(NULL),
+       fHistoTrueMotherCaloElectronInvMassPt(NULL),
+       fHistoTrueMotherCaloMergedClusterInvMassPt(NULL),
+       fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
+       fHistoTrueMotherCaloMergedClusterPartConvInvMassPt(NULL),
        fHistoTruePrimaryMotherInvMassPt(NULL),
        fHistoTruePrimaryMotherW0WeightingInvMassPt(NULL),
        fProfileTruePrimaryMotherWeightsInvMassPt(NULL),
@@ -174,7 +180,6 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(): AliAnalysisTaskSE(
        fHistoTrueEtaPtAlpha(NULL),
        fHistoTruePi0PtOpenAngle(NULL),
        fHistoTrueEtaPtOpenAngle(NULL),
-       fHistoTrueMotherDalitzInvMassPt(NULL),
        fHistoTrueConvGammaPt(NULL),
        fHistoTrueConvPi0GammaPt(NULL),
        fHistoTrueConvGammaEta(NULL),
@@ -184,9 +189,19 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(): AliAnalysisTaskSE(
        fHistoTrueSecondaryConvGammaPt(NULL),
        fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
        fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
-       fHistoTrueDalitzPsiPairDeltaPhi(NULL),
-       fHistoTrueGammaPsiPairDeltaPhi(NULL),
        fHistoTrueClusGammaPt(NULL),
+       fHistoTrueClusUnConvGammaPt(NULL),
+       fHistoTrueClusElectronPt(NULL),
+       fHistoTrueClusConvGammaPt(NULL),
+       fHistoTrueClusConvGammaFullyPt(NULL),
+       fHistoTrueClusMergedGammaPt(NULL),
+       fHistoTrueClusMergedPartConvGammaPt(NULL),
+       fHistoTrueClusDalitzPt(NULL),
+       fHistoTrueClusDalitzMergedPt(NULL),
+       fHistoTrueClusPhotonFromElecMotherPt(NULL),
+       fHistoTrueClusShowerPt(NULL),
+       fHistoTrueClusEMNonLeadingPt(NULL),
+       fHistoTrueNLabelsInClus(NULL),
        fHistoTruePrimaryClusGammaPt(NULL),
        fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
        fHistoNEvents(NULL),
@@ -213,6 +228,7 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(): AliAnalysisTaskSE(
        fDoMesonAnalysis(kTRUE),
        fDoMesonQA(0),
        fDoPhotonQA(0),
+       fDoClusterQA(0),
        fIsFromMBHeader(kTRUE),
        fIsMC(kFALSE),
        fMinE(0.1),
@@ -318,6 +334,12 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(const char *name):
        fHistoMCSecEtaPt(NULL),
        fHistoMCSecEtaSource(NULL),
        fHistoTrueMotherInvMassPt(NULL),
+       fHistoTrueMotherCaloPhotonInvMassPt(NULL),
+       fHistoTrueMotherCaloConvertedPhotonInvMassPt(NULL),
+       fHistoTrueMotherCaloElectronInvMassPt(NULL),
+       fHistoTrueMotherCaloMergedClusterInvMassPt(NULL),
+       fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
+       fHistoTrueMotherCaloMergedClusterPartConvInvMassPt(NULL),
        fHistoTruePrimaryMotherInvMassPt(NULL),
        fHistoTruePrimaryMotherW0WeightingInvMassPt(NULL),
        fProfileTruePrimaryMotherWeightsInvMassPt(NULL),
@@ -338,7 +360,6 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(const char *name):
        fHistoTrueEtaPtAlpha(NULL),
        fHistoTruePi0PtOpenAngle(NULL),
        fHistoTrueEtaPtOpenAngle(NULL),
-       fHistoTrueMotherDalitzInvMassPt(NULL),
        fHistoTrueConvGammaPt(NULL),
        fHistoTrueConvPi0GammaPt(NULL),
        fHistoTrueConvGammaEta(NULL),
@@ -348,9 +369,19 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(const char *name):
        fHistoTrueSecondaryConvGammaPt(NULL),
        fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
        fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
-       fHistoTrueDalitzPsiPairDeltaPhi(NULL),
-       fHistoTrueGammaPsiPairDeltaPhi(NULL),
        fHistoTrueClusGammaPt(NULL),
+       fHistoTrueClusUnConvGammaPt(NULL),
+       fHistoTrueClusElectronPt(NULL),
+       fHistoTrueClusConvGammaPt(NULL),
+       fHistoTrueClusConvGammaFullyPt(NULL),
+       fHistoTrueClusMergedGammaPt(NULL),
+       fHistoTrueClusMergedPartConvGammaPt(NULL),
+       fHistoTrueClusDalitzPt(NULL),
+       fHistoTrueClusDalitzMergedPt(NULL),
+       fHistoTrueClusPhotonFromElecMotherPt(NULL),
+       fHistoTrueClusShowerPt(NULL),
+       fHistoTrueClusEMNonLeadingPt(NULL),
+       fHistoTrueNLabelsInClus(NULL),
        fHistoTruePrimaryClusGammaPt(NULL),
        fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
        fHistoNEvents(NULL),
@@ -377,6 +408,7 @@ AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(const char *name):
        fDoMesonAnalysis(kTRUE),
        fDoMesonQA(0),
        fDoPhotonQA(0),
+       fDoClusterQA(0),
        fIsFromMBHeader(kTRUE),
        fIsMC(kFALSE),
        fMinE(0.1),
@@ -745,84 +777,100 @@ void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
   
        if(fIsMC){
                // MC Histogramms
-               fMCList = new TList*[fnCuts];
+               fMCList         = new TList*[fnCuts];
                // True Histogramms
-               fTrueList = new TList*[fnCuts];
+               fTrueList       = new TList*[fnCuts];
                // Selected Header List
-               fHeaderNameList = new TList*[fnCuts];
-               fHistoMCHeaders = new TH1I*[fnCuts];
-               fHistoMCAllGammaPt = new TH1F*[fnCuts];
-               fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
-               fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
-               fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
-               fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
-               fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
-               fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
-               fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
-               fHistoMCConvGammaPt = new TH1F*[fnCuts];
-               fHistoTrueConvGammaPt = new TH1F*[fnCuts];
-               fHistoTrueConvPi0GammaPt = new TH1F*[fnCuts];
+               fHeaderNameList                                         = new TList*[fnCuts];
+               fHistoMCHeaders                                         = new TH1I*[fnCuts];
+               fHistoMCAllGammaPt                                      = new TH1F*[fnCuts];
+               fHistoMCDecayGammaPi0Pt                         = new TH1F*[fnCuts];
+               fHistoMCDecayGammaRhoPt                         = new TH1F*[fnCuts];
+               fHistoMCDecayGammaEtaPt                         = new TH1F*[fnCuts];
+               fHistoMCDecayGammaOmegaPt                       = new TH1F*[fnCuts];
+               fHistoMCDecayGammaEtapPt                        = new TH1F*[fnCuts];
+               fHistoMCDecayGammaPhiPt                         = new TH1F*[fnCuts];
+               fHistoMCDecayGammaSigmaPt                       = new TH1F*[fnCuts];
+               fHistoMCConvGammaPt                             = new TH1F*[fnCuts];
+               fHistoTrueConvGammaPt                           = new TH1F*[fnCuts];
+               fHistoTrueConvPi0GammaPt                        = new TH1F*[fnCuts];
     
-               fHistoCombinatorialPt = new TH2F*[fnCuts];
-               fHistoTruePrimaryConvGammaPt = new TH1F*[fnCuts];
-               fHistoTruePrimaryConvGammaESDPtMCPt = new TH2F*[fnCuts];
-               fHistoTrueSecondaryConvGammaPt = new TH1F*[fnCuts];
-               fHistoTrueSecondaryConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
-               fHistoTrueSecondaryConvGammaFromXFromLambdaPt = new TH1F*[fnCuts];
+               fHistoCombinatorialPt                                                   = new TH2F*[fnCuts];
+               fHistoTruePrimaryConvGammaPt                                    = new TH1F*[fnCuts];
+               fHistoTruePrimaryConvGammaESDPtMCPt                     = new TH2F*[fnCuts];
+               fHistoTrueSecondaryConvGammaPt                                  = new TH1F*[fnCuts];
+               fHistoTrueSecondaryConvGammaFromXFromK0sPt              = new TH1F*[fnCuts];
+               fHistoTrueSecondaryConvGammaFromXFromLambdaPt   = new TH1F*[fnCuts];
     
-               fHistoTrueDalitzPsiPairDeltaPhi= new TH2F*[fnCuts];
-               fHistoTrueGammaPsiPairDeltaPhi= new TH2F*[fnCuts];
-
-               fHistoTrueClusGammaPt = new TH1F*[fnCuts];
-               fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
+               fHistoTrueClusGammaPt                           = new TH1F*[fnCuts];
+               fHistoTruePrimaryClusGammaPt            = new TH1F*[fnCuts];
                fHistoTruePrimaryClusGammaESDPtMCPt = new TH2F*[fnCuts];
 
                if (fDoPhotonQA > 0){
-                       fHistoMCConvGammaR = new TH1F*[fnCuts];
-                       fHistoMCConvGammaEta = new TH1F*[fnCuts];
-                       fHistoTrueConvGammaEta = new TH1F*[fnCuts];
+                       fHistoMCConvGammaR                                      = new TH1F*[fnCuts];
+                       fHistoMCConvGammaEta                            = new TH1F*[fnCuts];
+                       fHistoTrueConvGammaEta                          = new TH1F*[fnCuts];
+               }
+               if (fDoClusterQA > 0){  
+                       fHistoTrueClusUnConvGammaPt             = new TH1F*[fnCuts];
+                       fHistoTrueClusElectronPt                        = new TH1F*[fnCuts];
+                       fHistoTrueClusConvGammaPt                       = new TH1F*[fnCuts];
+                       fHistoTrueClusConvGammaFullyPt          = new TH1F*[fnCuts];
+                       fHistoTrueClusMergedGammaPt             = new TH1F*[fnCuts];
+                       fHistoTrueClusMergedPartConvGammaPt = new TH1F*[fnCuts];
+                       fHistoTrueClusDalitzPt                          = new TH1F*[fnCuts];
+                       fHistoTrueClusDalitzMergedPt            = new TH1F*[fnCuts];
+                       fHistoTrueClusPhotonFromElecMotherPt= new TH1F*[fnCuts];
+                       fHistoTrueClusShowerPt                          = new TH1F*[fnCuts];
+                       fHistoTrueClusEMNonLeadingPt            = new TH1F*[fnCuts];
+                       fHistoTrueNLabelsInClus                         = new TH1F*[fnCuts];                    
                }
     
                if(fDoMesonAnalysis){
-                       fHistoMCPi0Pt = new TH1F*[fnCuts];
-                       fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
-                       fHistoMCEtaPt = new TH1F*[fnCuts];
-                       fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
-                       fHistoMCPi0InAccPt = new TH1F*[fnCuts];
-                       fHistoMCEtaInAccPt = new TH1F*[fnCuts];
+                       fHistoMCPi0Pt                                   = new TH1F*[fnCuts];
+                       fHistoMCPi0WOWeightPt                   = new TH1F*[fnCuts];
+                       fHistoMCEtaPt                                   = new TH1F*[fnCuts];
+                       fHistoMCEtaWOWeightPt                   = new TH1F*[fnCuts];
+                       fHistoMCPi0InAccPt                              = new TH1F*[fnCuts];
+                       fHistoMCEtaInAccPt                              = new TH1F*[fnCuts];
       
-                       fHistoTrueMotherInvMassPt = new TH2F*[fnCuts];
-                       fHistoTruePrimaryMotherInvMassPt = new TH2F*[fnCuts];
+                       fHistoTrueMotherInvMassPt                                       = new TH2F*[fnCuts];
+                       fHistoTruePrimaryMotherInvMassPt                        = new TH2F*[fnCuts];
                        fHistoTruePrimaryMotherW0WeightingInvMassPt = new TH2F*[fnCuts];
-                       fProfileTruePrimaryMotherWeightsInvMassPt = new TProfile2D*[fnCuts];
-                       fHistoTrueSecondaryMotherInvMassPt = new TH2F*[fnCuts];
-                       fHistoTrueSecondaryMotherFromK0sInvMassPt = new TH2F*[fnCuts];
-                       fHistoTrueSecondaryMotherFromEtaInvMassPt = new TH2F*[fnCuts];
+                       fProfileTruePrimaryMotherWeightsInvMassPt       = new TProfile2D*[fnCuts];
+                       fHistoTrueSecondaryMotherInvMassPt                      = new TH2F*[fnCuts];
+                       fHistoTrueSecondaryMotherFromK0sInvMassPt       = new TH2F*[fnCuts];
+                       fHistoTrueSecondaryMotherFromEtaInvMassPt       = new TH2F*[fnCuts];
                        fHistoTrueSecondaryMotherFromLambdaInvMassPt = new TH2F*[fnCuts];
-                       fHistoTrueMotherDalitzInvMassPt = new TH2F*[fnCuts];
                        if (fDoMesonQA > 0){
-                               fHistoMCPi0PtY = new TH2F*[fnCuts];
-                               fHistoMCEtaPtY = new TH2F*[fnCuts];
-                               fHistoMCK0sPt = new TH1F*[fnCuts];
-                               fHistoMCK0sWOWeightPt = new TH1F*[fnCuts];
-                               fHistoMCK0sPtY = new TH2F*[fnCuts];
-                               fHistoMCSecPi0PtvsSource= new TH2F*[fnCuts];
-                               fHistoMCSecPi0Source = new TH1F*[fnCuts];
-                               fHistoMCSecEtaPt = new TH1F*[fnCuts];
-                               fHistoMCSecEtaSource = new TH1F*[fnCuts];
-                               fHistoTruePrimaryPi0MCPtResolPt = new TH2F*[fnCuts];
-                               fHistoTruePrimaryEtaMCPtResolPt = new TH2F*[fnCuts];
-                               fHistoTrueK0sWithPi0DaughterMCPt = new TH1F*[fnCuts];
-                               fHistoTrueEtaWithPi0DaughterMCPt = new TH1F*[fnCuts];
-                               fHistoTrueLambdaWithPi0DaughterMCPt = new TH1F*[fnCuts];
-                               fHistoTrueBckGGInvMassPt = new TH2F*[fnCuts];
-                               fHistoTrueBckContInvMassPt = new TH2F*[fnCuts];
-                               fHistoTruePi0PtY = new TH2F*[fnCuts];
-                               fHistoTrueEtaPtY = new TH2F*[fnCuts];
-                               fHistoTruePi0PtAlpha = new TH2F*[fnCuts];
-                               fHistoTrueEtaPtAlpha = new TH2F*[fnCuts];
-                               fHistoTruePi0PtOpenAngle = new TH2F*[fnCuts];
-                               fHistoTrueEtaPtOpenAngle = new TH2F*[fnCuts];
+                               fHistoMCPi0PtY                                                          = new TH2F*[fnCuts];
+                               fHistoMCEtaPtY                                                          = new TH2F*[fnCuts];
+                               fHistoMCK0sPt                                                           = new TH1F*[fnCuts];
+                               fHistoMCK0sWOWeightPt                                           = new TH1F*[fnCuts];
+                               fHistoMCK0sPtY                                                          = new TH2F*[fnCuts];
+                               fHistoMCSecPi0PtvsSource                                        = new TH2F*[fnCuts];
+                               fHistoMCSecPi0Source                                            = new TH1F*[fnCuts];
+                               fHistoMCSecEtaPt                                                        = new TH1F*[fnCuts];
+                               fHistoMCSecEtaSource                                            = new TH1F*[fnCuts];
+                               fHistoTrueMotherCaloPhotonInvMassPt                     = new TH2F*[fnCuts];
+                               fHistoTrueMotherCaloConvertedPhotonInvMassPt= new TH2F*[fnCuts];
+                               fHistoTrueMotherCaloElectronInvMassPt           = new TH2F*[fnCuts];
+                               fHistoTrueMotherCaloMergedClusterInvMassPt      = new TH2F*[fnCuts];
+                               fHistoTrueMotherCaloMergedClusterPartConvInvMassPt      = new TH2F*[fnCuts];
+                               fHistoTrueMotherCaloEMNonLeadingInvMassPt       = new TH2F*[fnCuts];
+                               fHistoTruePrimaryPi0MCPtResolPt                         = new TH2F*[fnCuts];
+                               fHistoTruePrimaryEtaMCPtResolPt                         = new TH2F*[fnCuts];
+                               fHistoTrueK0sWithPi0DaughterMCPt                        = new TH1F*[fnCuts];
+                               fHistoTrueEtaWithPi0DaughterMCPt                        = new TH1F*[fnCuts];
+                               fHistoTrueLambdaWithPi0DaughterMCPt             = new TH1F*[fnCuts];
+                               fHistoTrueBckGGInvMassPt                                        = new TH2F*[fnCuts];
+                               fHistoTrueBckContInvMassPt                                      = new TH2F*[fnCuts];
+                               fHistoTruePi0PtY                                                        = new TH2F*[fnCuts];
+                               fHistoTrueEtaPtY                                                        = new TH2F*[fnCuts];
+                               fHistoTruePi0PtAlpha                                            = new TH2F*[fnCuts];
+                               fHistoTrueEtaPtAlpha                                            = new TH2F*[fnCuts];
+                               fHistoTruePi0PtOpenAngle                                        = new TH2F*[fnCuts];
+                               fHistoTrueEtaPtOpenAngle                                        = new TH2F*[fnCuts];
                        }
                }
     
@@ -958,23 +1006,49 @@ void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
                        fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaFromXFromK0sPt[iCut]);
                        fHistoTrueSecondaryConvGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromLambda_Pt", "ESD_TrueSecondaryConvGammaFromXFromLambda_Pt",250,0,25);
                        fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaFromXFromLambdaPt[iCut]);
-      
-                       fHistoTrueDalitzPsiPairDeltaPhi[iCut] = new TH2F("ESD_TrueDalitzPsiPairDeltaPhi_Pt", "ESD_TrueDalitzPsiPairDeltaPhi_Pt",100,-0.5,2,100,-0.5,0.5);
-                       fTrueList[iCut]->Add(fHistoTrueDalitzPsiPairDeltaPhi[iCut]);
-                       
-                       fHistoTrueGammaPsiPairDeltaPhi[iCut] = new TH2F("ESD_TrueGammaPsiPairDeltaPhi_Pt", "ESD_TrueGammaPsiPairDeltaPhi_Pt",100,-0.5,2,100,-0.5,0.5);
-                       fTrueList[iCut]->Add(fHistoTrueGammaPsiPairDeltaPhi[iCut]);
-      
+                             
                        fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",250,0,25,250,0,25);
                        fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaESDPtMCPt[iCut]);
                
-                       fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",250,0,25);
+                       fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",250,0,25);
                        fTagOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
                        fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",250,0,25);
                        fTagOutputList[iCut]->Add(fHistoTruePrimaryClusGammaPt[iCut]);
                        fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_MCPt",250,0,25,250,0,25);
                        fTagOutputList[iCut]->Add(fHistoTruePrimaryClusGammaESDPtMCPt[iCut]);
 
+                       if (fDoPhotonQA > 0){
+                               fHistoTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
+                               fTrueList[iCut]->Add(fHistoTrueConvGammaEta[iCut]);             
+                       }       
+                       if (fDoClusterQA > 0){  
+                               fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt","TrueClusUnConvGamma_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusUnConvGammaPt[iCut]);
+                               fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
+
+                               fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaPt[iCut]);
+                               fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaFullyPt[iCut]);
+                               fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusMergedGammaPt[iCut]);
+                               fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusMergedPartConvGammaPt[iCut]);
+                               fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
+                               fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusDalitzMergedPt[iCut]);
+                               fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusPhotonFromElecMotherPt[iCut]);
+                               fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",250,0,25);
+                               fTagOutputList[iCut]->Add(fHistoTrueClusShowerPt[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);
+                               fTagOutputList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);       
+                       }       
+
                        if(fDoMesonAnalysis){
                                fHistoTrueMotherInvMassPt[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt","ESD_TrueMother_InvMass_Pt",800,0,0.8,250,0,25);
                                fTrueList[iCut]->Add(fHistoTrueMotherInvMassPt[iCut]);
@@ -997,9 +1071,20 @@ void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
                                fTrueList[iCut]->Add(fHistoTrueSecondaryMotherFromEtaInvMassPt[iCut]);
                                fHistoTrueSecondaryMotherFromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherFromLambda_InvMass_Pt","ESD_TrueSecondaryMotherFromLambda_InvMass_Pt",800,0,0.8,250,0,25);
                                fTrueList[iCut]->Add(fHistoTrueSecondaryMotherFromLambdaInvMassPt[iCut]);
-                               fHistoTrueMotherDalitzInvMassPt[iCut] = new TH2F("ESD_TrueDalitz_InvMass_Pt","ESD_TrueDalitz_InvMass_Pt",800,0,0.8,250,0,25);
-                               fTrueList[iCut]->Add(fHistoTrueMotherDalitzInvMassPt[iCut]);
                                if (fDoMesonQA > 0){
+                                       fHistoTrueMotherCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloPhoton_InvMass_Pt","ESD_TrueMotherCaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueMotherCaloPhotonInvMassPt[iCut]);
+                                       fHistoTrueMotherCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloConvertedPhoton_InvMass_Pt","ESD_TrueMotherCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueMotherCaloConvertedPhotonInvMassPt[iCut]);
+                                       fHistoTrueMotherCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloElectron_InvMass_Pt","ESD_TrueMotherCaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueMotherCaloElectronInvMassPt[iCut]);
+                                       fHistoTrueMotherCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloMergedCluster_InvMass_Pt","ESD_TrueMotherCaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueMotherCaloMergedClusterInvMassPt[iCut]);
+                                       fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt","ESD_TrueMotherCaloEMNonLeading_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]);
+                                       fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueMotherCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
+                                       fTrueList[iCut]->Add(fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[iCut]);
+                                       
                                        fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
                                        fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
                                        SetLogBinningXTH2(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
@@ -1038,10 +1123,6 @@ void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
                                        fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
                                        SetLogBinningXTH2(fHistoTrueEtaPtOpenAngle[iCut]);
                                        fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
-          
-                                       fHistoTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
-                                       fTrueList[iCut]->Add(fHistoTrueConvGammaEta[iCut]);
-          
                                }
                        }
                }
@@ -1293,62 +1374,38 @@ void AliAnalysisTaskGammaConvCalo::ProcessClusters()
                // convert to AODConversionPhoton
                AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
                if(!PhotonCandidate) continue;
-
+               
+               // Flag Photon as CaloPhoton
+               PhotonCandidate->SetIsCaloPhoton();
                // get MC label
-               Int_t mclab[2] = {0,0};         
                if(fIsMC){
-                       mclab[0] = clus->GetLabel();
-                       mclab[1] = clus->GetLabel();
-//                     cout << "mclabels: " << mclab[0] << " " << mclab[1] << endl;
+                       Int_t* mclabelsCluster = clus->GetLabels();
+                       PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
+//                     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]);
+//                                     Int_t pdgCode = fMCStack->Particle(mclabelsCluster[k])->GetPdgCode();
+//                                     cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
+                               }       
+                       }
                }
                
-               PhotonCandidate->SetMCLabel(mclab);
-               
-       //    fIsFromMBHeader = kTRUE;
-       //    if(fIsMC){
-       //      Int_t isPosFromMBHeader
-       //      = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclab, fMCStack, fInputEvent);
-       //      if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
-       // 
-       //      Int_t isNegFromMBHeader
-       //      = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclab, fMCStack, fInputEvent);
-       //      if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
-       //      
-       //      if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
-       //    }
+               fIsFromMBHeader = kTRUE; 
+               // test whether largest contribution to cluster orginates in added signals
+               if (fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCStack, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
                
                fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
                fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
                
-       //    if(fIsFromMBHeader){
-       //      fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
-       //      if (fDoPhotonQA > 0){
-       //        fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
-       //        fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
-       //      }
-       //    }
-
                if(fIsMC){
-                       ProcessTrueClusterCandidates(PhotonCandidate);
+                       if(fInputEvent->IsA()==AliESDEvent::Class()){
+                               ProcessTrueClusterCandidates(PhotonCandidate);
+                       } else {
+                               ProcessTrueClusterCandidatesAOD(PhotonCandidate);
+                       }       
                }
                
-       //    if (fIsFromMBHeader && fDoPhotonQA == 2){
-       //      if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
-       //        fPtGamma = PhotonCandidate->Pt();
-       //        fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
-       //        fRConvPhoton = PhotonCandidate->GetConversionRadius();
-       //        fEtaPhoton = PhotonCandidate->GetPhotonEta();
-       //        fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
-       //        fTreeConvGammaPtDcazCat[fiCut]->Fill();
-       //    } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
-       //        fPtGamma = PhotonCandidate->Pt();
-       //        fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
-       //        fRConvPhoton = PhotonCandidate->GetConversionRadius();
-       //        fEtaPhoton = PhotonCandidate->GetPhotonEta();
-       //        fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
-       //        fTreeConvGammaPtDcazCat[fiCut]->Fill();
-       //      }
-       //    }
                delete tmpvec;
        }
        
@@ -1357,23 +1414,47 @@ void AliAnalysisTaskGammaConvCalo::ProcessClusters()
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidates(AliAODConversionPhoton *TruePhotonCandidate)
 {
+               
+       TParticle *Photon = NULL;
+       if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
+       fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
        
-       TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack);
-       
+       if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCStack->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
+               else return;
+               
        if(Photon == NULL){
        //    cout << "no photon" << endl;
                return;
        }
-       
-       if(Photon->GetPdgCode() != 22){
-       //    cout << "pdg code: " << Photon->GetPdgCode() << endl;
-               return; // Particle is no Photon
-       }
+
+       TruePhotonCandidate->SetCaloPhotonMCFlags(fMCStack);
        
        // True Photon
        if(fIsFromMBHeader){
-               fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-               if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
+               if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+               if (fDoClusterQA > 0){
+                       if (TruePhotonCandidate->IsLargestComponentPhoton()) 
+                               fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsLargestComponentElectron()) 
+                               fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) 
+                               fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained()) 
+                               fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
+                               fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsMergedPartConv())
+                               fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsDalitz()) 
+                               fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsDalitzMerged()) 
+                               fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsPhotonWithElecMother()) 
+                               fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsShower()) 
+                               fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+               }
        }
 
        if(Photon->GetMother(0) <= fMCStack->GetNprimary()){
@@ -1382,32 +1463,73 @@ void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidates(AliAODConversion
                        fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
                        fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
                }
+       }       
+       return;
+}
+
+
+//________________________________________________________________________
+void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate)
+{
+       AliAODMCParticle *Photon = NULL;
+       TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
+       if (AODMCTrackArray){
+               if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
+               if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
+                       else return;
+       } else {
+               AliInfo("AODMCTrackArray could not be loaded");
+               return;
        }
 
-       // maybe later
-       //  else{
-       //    if(fIsFromMBHeader){
-       //      fCharPhotonMCInfo = 2;
-       //      fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-       //      if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
-       //         fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122){
-       //        fHistoTrueSecondaryConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-       //        fCharPhotonMCInfo = 5;
-       //      }
-       //      if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
-       //         fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
-       //        fHistoTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
-       //        fCharPhotonMCInfo = 4;
-       //      }
-       //      if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
-       //         fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221){
-       //        fCharPhotonMCInfo = 3;
-       //      }
-       //    }
-       //  }
+       if(Photon == NULL){
+       //    cout << "no photon" << endl;
+               return;
+       }
+       TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent);
        
-}
+       // True Photon
+       if(fIsFromMBHeader){
+               if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+               if (fDoClusterQA > 0){
+                       if (TruePhotonCandidate->IsLargestComponentPhoton()) 
+                               fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsLargestComponentElectron()) 
+                               fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) 
+                               fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained()) 
+                               fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
+                               fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsMergedPartConv())
+                               fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsDalitz()) 
+                               fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsDalitzMerged()) 
+                               fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsPhotonWithElecMother()) 
+                               fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       if (TruePhotonCandidate->IsShower()) 
+                               fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+               }
+       }
 
+       // True Photon
+       if(fIsFromMBHeader){
+               fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+//             if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
+       }
+
+       if(Photon->IsPrimary()){
+               // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
+               if(fIsFromMBHeader){
+                       fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
+                       fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
+               }
+       }       
+}
 
 //________________________________________________________________________
 void AliAnalysisTaskGammaConvCalo::ProcessPhotonCandidates()
@@ -1606,18 +1728,14 @@ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidatesAOD(AliAODConversi
                fCharPhotonMCInfo = 1;
                return; //One Particle is not a electron
        }
+       
        if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
                fCharPhotonMCInfo = 1;
                return; // Same Charge
        }
        
-       AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
-       AliVTrack * electronCandidate = ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetTrack(fInputEvent,TruePhotonCandidate->GetTrackLabelNegative() );
-       AliVTrack * positronCandidate = ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetTrack(fInputEvent,TruePhotonCandidate->GetTrackLabelPositive() );
-       Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronCandidate->Phi()-positronCandidate->Phi());
-       
+       AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());   
        if(Photon->GetPdgCode() != 22){
-               fHistoTrueDalitzPsiPairDeltaPhi[fiCut]->Fill(deltaPhi,TruePhotonCandidate->GetPsiPair());
                fCharPhotonMCInfo = 1;
                return; // Mother is no Photon
        }
@@ -1635,7 +1753,6 @@ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidatesAOD(AliAODConversi
                fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
                if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
        }
-       fHistoTrueGammaPsiPairDeltaPhi[fiCut]->Fill(deltaPhi,TruePhotonCandidate->GetPsiPair());
        if(Photon->IsPrimary()){
                // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
                if(fIsFromMBHeader){
@@ -1700,12 +1817,8 @@ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidates(AliAODConversionP
        if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
        
        TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack);
-       AliVTrack * electronCandidate = ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetTrack(fInputEvent,TruePhotonCandidate->GetTrackLabelNegative() );
-       AliVTrack * positronCandidate = ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetTrack(fInputEvent,TruePhotonCandidate->GetTrackLabelPositive() );
-       Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronCandidate->Phi()-positronCandidate->Phi());
        
        if(Photon->GetPdgCode() != 22){
-               fHistoTrueDalitzPsiPairDeltaPhi[fiCut]->Fill(deltaPhi,TruePhotonCandidate->GetPsiPair());
                return; // Mother is no Photon
        }
        
@@ -1716,7 +1829,6 @@ void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidates(AliAODConversionP
                fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
                if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
        }
-       fHistoTrueGammaPsiPairDeltaPhi[fiCut]->Fill(deltaPhi,TruePhotonCandidate->GetPsiPair());
        if(posDaughter->GetMother(0) <= fMCStack->GetNprimary()){
                // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
                if(fIsFromMBHeader){
@@ -2187,10 +2299,10 @@ void AliAnalysisTaskGammaConvCalo::CalculatePi0Candidates(){
                                                //                   cout << "gamma 1: " << gamma1->GetV0Index()<< "\t"<< gamma1->GetPx() << "\t" << gamma1->GetPy() << "\t" <<  gamma1->GetPz() << "\t" << endl;
                                                //                    cout << "pi0: "<<fInvMass << "\t" << fPt <<"\t" << fDCAzGammaMin << "\t" << fDCAzGammaMax << "\t" << (Int_t)fCharFlag << "\t" << (Int_t)fCharMesonMCInfo <<endl;
                                                if (fIsHeavyIon == 1 && fPt > 0.399 && fPt < 20. ) {
-                                               if (fInvMass > 0.08 && fInvMass < 0.2) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
-                                               if ((fInvMass > 0.45 && fInvMass < 0.6) &&  (fPt > 0.999 && fPt < 20.) )fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
+                                                       if (fInvMass > 0.08 && fInvMass < 0.2) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
+                                                       if ((fInvMass > 0.45 && fInvMass < 0.6) &&  (fPt > 0.999 && fPt < 20.) )fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
                                                } else if (fPt > 0.299 && fPt < 20. )  {
-                                               if ( (fInvMass > 0.08 && fInvMass < 0.2) || (fInvMass > 0.45 && fInvMass < 0.6)) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
+                                                       if ( (fInvMass > 0.08 && fInvMass < 0.2) || (fInvMass > 0.45 && fInvMass < 0.6)) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
                                                }
                                        }
                                }
@@ -2209,160 +2321,136 @@ void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidates(AliAODConversionMo
        if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
                Bool_t isTruePi0 = kFALSE;
                Bool_t isTrueEta = kFALSE;
-               Bool_t isTruePi0Dalitz = kFALSE;
-               Bool_t isTrueEtaDalitz = kFALSE;
-               Bool_t gamma0DalitzCand = kFALSE;
-               Bool_t gamma1DalitzCand = kFALSE;
                Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(MCStack);
                Int_t gamma0MotherLabel = -1;
                if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
-               // Daughters Gamma 0
-               TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(MCStack);
-               TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(MCStack);
-               TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
-               if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){  // Electrons ...
-                       if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
-                               if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
-                                       gamma0MotherLabel=gammaMC0->GetFirstMother();
+                       // Daughters Gamma 0
+                       TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(MCStack);
+                       TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(MCStack);
+                       TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
+                       if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){  // Electrons ...
+                               if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
+                                       if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
+                                               gamma0MotherLabel=gammaMC0->GetFirstMother();
+                                       }
                                }
                        }
-                       if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
-                               gamma0DalitzCand = kTRUE;
-                               gamma0MotherLabel=-111;
+               }
+               if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
+               
+               Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0);     // get most probable MC label
+               Int_t gamma1MotherLabel = -1;
+               // check if 
+
+               if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
+                       // Daughters Gamma 1
+                       TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
+                       if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){              // largest component is electro magnetic
+                               // get mother of interest (pi0 or eta)
+                               if (TrueGammaCandidate1->IsLargestComponentPhoton()){                                                                                                           // for photons its the direct mother 
+                                       gamma1MotherLabel=gammaMC1->GetMother(0);
+                               } else if (TrueGammaCandidate1->IsLargestComponentElectron()){                                                                                          // for electrons its either the direct mother or for conversions the grandmother
+                                       if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
+                                       else gamma1MotherLabel=gammaMC1->GetMother(0); 
+                               }
+                       } else {
+                               if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       }       
+               }
+                               
+               if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
+                       if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
+                               isTruePi0=kTRUE;
                        }
-                       if(gammaMC0->GetPdgCode() ==221){ // Dalitz candidate
-                               gamma0DalitzCand = kTRUE;
-                               gamma0MotherLabel=-221;
+                       if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
+                               isTrueEta=kTRUE;
                        }
                }
-               }
-               if(TrueGammaCandidate1->GetV0Index()<fInputEvent->GetNumberOfV0s()){
-                       Int_t gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(MCStack);
-                       Int_t gamma1MotherLabel = -1;
-                       if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
-                               // Daughters Gamma 1
-                               TParticle * negativeMC = (TParticle*)TrueGammaCandidate1->GetNegativeMCDaughter(MCStack);
-                               TParticle * positiveMC = (TParticle*)TrueGammaCandidate1->GetPositiveMCDaughter(MCStack);
-                               TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
-                               if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){  // Electrons ...
-                                       if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
-                                               if(gammaMC1->GetPdgCode() == 22){ // ... with Gamma Mother
-                                               gamma1MotherLabel=gammaMC1->GetFirstMother();
-                                               }
-                                       }
-                                       if(gammaMC1->GetPdgCode() ==111 ){ // Dalitz candidate
-                                               gamma1DalitzCand = kTRUE;
-                                               gamma1MotherLabel=-111;
+               
+               if(isTruePi0 || isTrueEta){// True Pion or Eta
+                       fHistoTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       if (fDoMesonQA > 0){
+                               if (TrueGammaCandidate1->IsLargestComponentPhoton()) 
+                                       fHistoTrueMotherCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               if (TrueGammaCandidate1->IsLargestComponentElectron()) 
+                                       fHistoTrueMotherCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion())
+                                       fHistoTrueMotherCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               if (TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() )
+                                       fHistoTrueMotherCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               if (TrueGammaCandidate1->IsMergedPartConv()) 
+                                       fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       }
+                       if (fDoMesonQA > 0){
+                               if (isTruePi0){
+                                       if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
+                                               fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
+                                               fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
+                                               fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
                                        }
-                                       if(gammaMC1->GetPdgCode() ==221){ // Dalitz candidate
-                                               gamma1DalitzCand = kTRUE;
-                                               gamma1MotherLabel=-221;
+                               } else if (isTrueEta){
+                                       if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
+                                               fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
+                                               fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
+                                               fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
                                        }
                                }
                        }
-                       if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
-                               if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
-                                       isTruePi0=kTRUE;
-                               }
-                               if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
-                                       isTrueEta=kTRUE;
+                       if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
+                               Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma0MotherLabel))->GetMother(0);
+                               Float_t weightedSec= 1;
+                               if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
+                                       weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, fMCStack, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
+                                       //cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
                                }
-                       }
-                       
-                       //Identify Dalitz candidate
-                       if (gamma1DalitzCand || gamma0DalitzCand){
-                               if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
-                                       if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
-                                       if (gamma0MotherLabel == -221) isTrueEtaDalitz = kTRUE;
-                               }
-                               if (gamma1DalitzCand && gamma1MCLabel >=0 && gamma1MCLabel==gamma0MotherLabel){
-                                       if (gamma1MotherLabel == -111) isTruePi0Dalitz = kTRUE;
-                                       if (gamma1MotherLabel == -221) isTrueEtaDalitz = kTRUE;
-                               }
-                       }
-                       
-                       
-                       if(isTruePi0 || isTrueEta){// True Pion or Eta
-                               fHistoTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                               if (fDoMesonQA > 0){
-                                       if (isTruePi0){
-                                               if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
-                                                       fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
-                                                       fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
-                                                       fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
-                                               }
-                                       } else if (isTrueEta){
-                                               if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
-                                                       fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
-                                                       fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
-                                                       fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
-                                               }
-                                       }
-                               }
-                               if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
-                                       Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetMother(0);
-                                       Float_t weightedSec= 1;
-                                       if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
-                                               weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, fMCStack, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
-                                               //cout << "MC input \t"<<i << "\t" <<  particle->Pt()<<"\t"<<weighted << endl;
+                               fHistoTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
+                               fCharMesonMCInfo = 2;
+                               if (secMotherLabel >-1){
+                                       if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
+                                               fCharMesonMCInfo = 4;
+                                               fHistoTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
+                                               if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
                                        }
-                                       fHistoTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
-                                       fCharMesonMCInfo = 2;
-                                       if (secMotherLabel >-1){
-                                               if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
-                                                       fCharMesonMCInfo = 4;
-                                                       fHistoTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
-                                                       if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
-                                               }
-                                               if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221){
+                                       if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221){
                                                fCharMesonMCInfo = 3;
                                                fHistoTrueSecondaryMotherFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
                                                if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
-                                               }
-                                               if(MCStack->Particle(secMotherLabel)->GetPdgCode()==3122){
-                                                       fCharMesonMCInfo = 7;
-                                                       fHistoTrueSecondaryMotherFromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
-                                                       if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
-                                               }
                                        }
-                               } else { // Only primary pi0 for efficiency calculation
-                                       fCharMesonMCInfo = 6;
-                                       Float_t weighted= 1;
-                                       if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
-                                               if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
-                                                       weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, fMCStack, fInputEvent);
-                                                       //                      cout << "rec \t " <<gamma1MotherLabel << "\t" <<  weighted << endl;
-                                               }
+                                       if(MCStack->Particle(secMotherLabel)->GetPdgCode()==3122){
+                                               fCharMesonMCInfo = 7;
+                                               fHistoTrueSecondaryMotherFromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
+                                               if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
                                        }
-                                       fHistoTruePrimaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
-                                       fHistoTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                                       fProfileTruePrimaryMotherWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
-                                       
-                                       
-                                       if (fDoMesonQA > 0){
-                                               if(isTruePi0){ // Only primary pi0 for resolution
-                                                       fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
-                                               }
-                                               if (isTrueEta){ // Only primary eta for resolution
-                                                       fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
-                                               }
+                               }
+                       } else { // Only primary pi0 for efficiency calculation
+                               fCharMesonMCInfo = 6;
+                               Float_t weighted= 1;
+                               if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
+                                       if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
+                                               weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, fMCStack, fInputEvent);
+                                               //                      cout << "rec \t " <<gamma1MotherLabel << "\t" <<  weighted << endl;
                                        }
                                }
-                       } else if(!isTruePi0 && !isTrueEta){ // Background
+                               fHistoTruePrimaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
+                               fHistoTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                               fProfileTruePrimaryMotherWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
+                                       
                                if (fDoMesonQA > 0){
-                                       if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
-                                               fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                                               fCharMesonMCInfo = 1;
-                                       } else { // No photon or without mother
-                                               fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       if(isTruePi0){ // Only primary pi0 for resolution
+                                               fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
+                                       }
+                                       if (isTrueEta){ // Only primary eta for resolution
+                                               fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
                                        }
                                }
-                               if( isTruePi0Dalitz || isTrueEtaDalitz ){
-                                       // Dalitz
-                                       fCharMesonMCInfo = 5;
-                                       fHistoTrueMotherDalitzInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-                               } else if (gamma0DalitzCand || gamma1DalitzCand){
-                                       if (fDoMesonQA > 0)fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       }
+               } else if(!isTruePi0 && !isTrueEta){ // Background
+                       if (fDoMesonQA > 0){
+                               if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
+                                       fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                                       fCharMesonMCInfo = 1;
+                               } else { // No photon or without mother
+                                       fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                                }
                        }
                }
@@ -2376,10 +2464,6 @@ void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidatesAOD(AliAODConversio
        TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
        Bool_t isTruePi0 = kFALSE;
        Bool_t isTrueEta = kFALSE;
-       Bool_t isTruePi0Dalitz = kFALSE;
-       Bool_t isTrueEtaDalitz = kFALSE;
-       Bool_t gamma0DalitzCand = kFALSE;
-       Bool_t gamma1DalitzCand = kFALSE;
        
        AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
        AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
@@ -2403,70 +2487,56 @@ void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidatesAOD(AliAODConversio
                                gamma0MotherLabel=gammaMC0->GetMother();
                                }
                        }
-                       if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
-                               gamma0DalitzCand = kTRUE;
-                               gamma0MotherLabel=-111;
-                       }
-                       if(gammaMC0->GetPdgCode() ==221){ // Dalitz candidate
-                               gamma0DalitzCand = kTRUE;
-                               gamma0MotherLabel=-221;
-                       }
                }
-       }
-       positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelPositive()));
-       negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelNegative()));
-       
-       Int_t gamma1MCLabel = -1;
+       }       
+
+       Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0);     // get most probable MC label
        Int_t gamma1MotherLabel = -1;
-       if(!positiveMC||!negativeMC)
-               return;
-       
-       if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
-               gamma1MCLabel = positiveMC->GetMother();
-       }
+               // check if 
+
        if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
                // Daughters Gamma 1
                AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
-               if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){  // Electrons ...
-                       if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
-                               if(gammaMC1->GetPdgCode() == 22){ // ... with Gamma Mother
+               if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){              // largest component is electro magnetic
+                       // get mother of interest (pi0 or eta)
+                       if (TrueGammaCandidate1->IsLargestComponentPhoton()){                                                                                                           // for photons its the direct mother 
                                gamma1MotherLabel=gammaMC1->GetMother();
-                               }
-                       }
-                       if(gammaMC1->GetPdgCode() ==111 ){ // Dalitz candidate
-                               gamma1DalitzCand = kTRUE;
-                               gamma1MotherLabel=-111;
-                       }
-                       if(gammaMC1->GetPdgCode() ==221){ // Dalitz candidate
-                               gamma1DalitzCand = kTRUE;
-                               gamma1MotherLabel=-221;
+                       } else if (TrueGammaCandidate1->IsLargestComponentElectron()){                                                                                          // for electrons its either the direct mother or for conversions the grandmother
+                               if (TrueGammaCandidate1->IsConversion()){
+                                       AliAODMCParticle * gammaGrandMotherMC1 =  static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
+                                       gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
+                               } else gamma1MotherLabel=gammaMC1->GetMother(); 
                        }
-               }
+               } else {
+                       if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+               }       
        }
+                       
        if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
-               if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
+               if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
                        isTruePi0=kTRUE;
                }
-               if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 221){
+               if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 221){
                        isTrueEta=kTRUE;
                }
        }
        
-       //Identify Dalitz candidate
-       if (gamma1DalitzCand || gamma0DalitzCand){
-               if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
-                       if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
-                       if (gamma0MotherLabel == -221) isTrueEtaDalitz = kTRUE;
-               }
-               if (gamma1DalitzCand && gamma1MCLabel >=0 && gamma1MCLabel==gamma0MotherLabel){
-                       if (gamma1MotherLabel == -111) isTruePi0Dalitz = kTRUE;
-                       if (gamma1MotherLabel == -221) isTrueEtaDalitz = kTRUE;
-               }
-       }
-       
        if(isTruePi0 || isTrueEta){// True Pion or Eta
                fHistoTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                if (fDoMesonQA > 0){
+                       if (TrueGammaCandidate1->IsLargestComponentPhoton()) 
+                               fHistoTrueMotherCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       if (TrueGammaCandidate1->IsLargestComponentElectron()) 
+                               fHistoTrueMotherCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion())
+                               fHistoTrueMotherCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       if (TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() )
+                               fHistoTrueMotherCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+                       if (TrueGammaCandidate1->IsMergedPartConv()) 
+                               fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
+               }
+
+               if (fDoMesonQA > 0){
                        if (isTruePi0){
                                if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
                                fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
@@ -2541,13 +2611,6 @@ void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidatesAOD(AliAODConversio
                                fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
                        }
                }
-               if( isTruePi0Dalitz || isTrueEtaDalitz ){
-                       // Dalitz
-                       fCharMesonMCInfo = 5;
-                       fHistoTrueMotherDalitzInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-               } else if (gamma0DalitzCand || gamma1DalitzCand){
-                       if (fDoMesonQA > 0)fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
-               }
        }
 }
 
@@ -2615,7 +2678,6 @@ void AliAnalysisTaskGammaConvCalo::CalculateBackground(){
                                                        RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
                                                }
                                        
-                                       
                                                AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
                                                backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
                                                if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
index e471463..350d720 100644 (file)
@@ -46,6 +46,7 @@ class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
                void RelabelAODPhotonCandidates(Bool_t mode);
                void ProcessTruePhotonCandidates( AliAODConversionPhoton* TruePhotonCandidate);
                void ProcessTrueClusterCandidates( AliAODConversionPhoton* TruePhotonCandidate);
+               void ProcessTrueClusterCandidatesAOD( AliAODConversionPhoton* TruePhotonCandidate);
                void ProcessTruePhotonCandidatesAOD( AliAODConversionPhoton* TruePhotonCandidate);
                void ProcessTrueMesonCandidates( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
                void ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1);
@@ -54,6 +55,7 @@ class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
                void SetDoMesonAnalysis(Bool_t flag){fDoMesonAnalysis = flag;}
                void SetDoMesonQA(Int_t flag){fDoMesonQA = flag;}
                void SetDoPhotonQA(Int_t flag){fDoPhotonQA = flag;}
+               void SetDoClusterQA(Int_t flag){fDoClusterQA = flag;}
                
            // Setting the cut lists for the conversion photons
                void SetEventCutList(Int_t nCuts, TList *CutArray){
@@ -220,6 +222,12 @@ class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
                TH1F                                                            **fHistoMCSecEtaSource;                         //! array of histos with secondary eta, source
                // MC validated reconstructed quantities mesons
                TH2F                                                            **fHistoTrueMotherInvMassPt;                                    //! array of histos with validated mothers, invMass, pt
+               TH2F                                                            **fHistoTrueMotherCaloPhotonInvMassPt;                  //! array of histos with validated mothers, photon leading, invMass, pt
+               TH2F                                                            **fHistoTrueMotherCaloConvertedPhotonInvMassPt; //! array of histos with validated mothers, converted photon leading, invMass, pt
+               TH2F                                                            **fHistoTrueMotherCaloElectronInvMassPt;                //! array of histos with validated mothers, electron leading, invMass, pt
+               TH2F                                                            **fHistoTrueMotherCaloMergedClusterInvMassPt;   //! array of histos with validated mothers, merged cluster invMass, pt
+               TH2F                                                            **fHistoTrueMotherCaloEMNonLeadingInvMassPt;    //! array of histos with validated mothers, EM non leading, invMass, pt
+               TH2F                                                            **fHistoTrueMotherCaloMergedClusterPartConvInvMassPt; //! array of histos with validated mothers, merged cluster part conv, invMass, pt
                TH2F                                                            **fHistoTruePrimaryMotherInvMassPt;                             //! array of histos with validated weighted primary mothers, invMass, pt
                TH2F                                                            **fHistoTruePrimaryMotherW0WeightingInvMassPt;  //! array of histos with validated unweighted primary mothers, invMass, pt
                TProfile2D                                                      **fProfileTruePrimaryMotherWeightsInvMassPt;    //! array of profiles with weights for validated primary mothers, invMass, pt   
@@ -233,14 +241,13 @@ class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
                TH2F                                                            **fHistoTrueSecondaryMotherFromLambdaInvMassPt; //! array of histos with validated secondary mothers from Lambda, invMass, pt
                TH1F                                                            **fHistoTrueLambdaWithPi0DaughterMCPt;                  //! array of histos with lambda with reconstructed pi0 as daughter, pt
                TH2F                                                            **fHistoTrueBckGGInvMassPt;                                             //! array of histos with pure gamma gamma combinatorial BG, invMass, pt
-               TH2F                                                            **fHistoTrueBckContInvMassPt;                                   //! array of histos with        contamination BG, invMass, pt
-               TH2F                                                            **fHistoTruePi0PtY;                                                             //! array of histos with        validated pi0, pt, Y
+               TH2F                                                            **fHistoTrueBckContInvMassPt;                                   //! array of histos with contamination BG, invMass, pt
+               TH2F                                                            **fHistoTruePi0PtY;                                                             //! array of histos with validated pi0, pt, Y
                TH2F                                                            **fHistoTrueEtaPtY;                                                             //! array of histos with validated eta, pt, Y
                TH2F                                                            **fHistoTruePi0PtAlpha;                                                 //! array of histos with validated pi0, pt, alpha
                TH2F                                                            **fHistoTrueEtaPtAlpha;                                                 //! array of histos with validated eta, pt, alpha
                TH2F                                                            **fHistoTruePi0PtOpenAngle;                                             //! array of histos with validated pi0, pt, openAngle
                TH2F                                                            **fHistoTrueEtaPtOpenAngle;                                             //! array of histos with validated eta, pt, openAngle
-               TH2F                                                            **fHistoTrueMotherDalitzInvMassPt;                              //! array of histos with validated mother, but Dalitz decay, invMass, pt
                // MC validated reconstructed quantities photons
                TH1F                                                            **fHistoTrueConvGammaPt;                                                //! array of histos with validated conversion photon, pt
                TH1F                                                            **fHistoTrueConvPi0GammaPt;                                             //! array of histos with validated conversion photon from pi0, pt
@@ -251,11 +258,21 @@ class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
                TH1F                                                            **fHistoTrueSecondaryConvGammaPt;                               //! array of histos with validated secondary conversion photon, pt  
                TH1F                                                            **fHistoTrueSecondaryConvGammaFromXFromK0sPt;   //! array of histos with validated secondary conversion photon from K0s, pt  
                TH1F                                                            **fHistoTrueSecondaryConvGammaFromXFromLambdaPt;//! array of histos with validated secondary conversion photon from Lambda, pt  
-               TH2F                                                            **fHistoTrueDalitzPsiPairDeltaPhi;                              //! array of histos with validated dalitz virtual photon, delta phi, psi pair  
-               TH2F                                                            **fHistoTrueGammaPsiPairDeltaPhi;                               //! array of histos with validated conversion photon, delta phi, psi pair
-               TH1F                                                            ** fHistoTrueClusGammaPt;                                               //! array of histos with validated cluster, pt
-               TH1F                                                            ** fHistoTruePrimaryClusGammaPt;                                //! array of histos with validated primary cluster, pt
-               TH2F                                                            ** fHistoTruePrimaryClusGammaESDPtMCPt;                 //! array of histos with validated primary cluster, rec Pt, MC pt
+               TH1F                                                            **fHistoTrueClusGammaPt;                                                //! array of histos with validated cluster (electron or photon), pt
+               TH1F                                                            **fHistoTrueClusUnConvGammaPt;                                  //! array of histos with validated unconverted photon, pt
+               TH1F                                                            **fHistoTrueClusElectronPt;                                             //! array of histos with validated electron, pt
+               TH1F                                                            **fHistoTrueClusConvGammaPt;                                    //! array of histos with validated converted photon, pt
+               TH1F                                                            **fHistoTrueClusConvGammaFullyPt;                               //! array of histos with validated converted photon, fully contained, pt
+               TH1F                                                            **fHistoTrueClusMergedGammaPt;                                  //! array of histos with validated merged photons, electrons, dalitz, pt
+               TH1F                                                            **fHistoTrueClusMergedPartConvGammaPt;                  //! array of histos with validated merged partially converted photons, pt
+               TH1F                                                            **fHistoTrueClusDalitzPt;                                               //! array of histos with validated Dalitz decay, pt
+               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                                                            **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
+               TH2F                                                            **fHistoTruePrimaryClusGammaESDPtMCPt;                  //! array of histos with validated primary cluster, rec Pt, MC pt
 
                // event histograms
                TH1I                                                            **fHistoNEvents;                                                                //! array of histos with event information
@@ -284,6 +301,7 @@ class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
                Bool_t                                                          fDoMesonAnalysis;                                       // flag for meson analysis
                Int_t                                                           fDoMesonQA;                                                     // flag for meson QA
                Int_t                                                           fDoPhotonQA;                                            // flag for photon QA
+               Int_t                                                           fDoClusterQA;                                           // flag for cluster QA
                Bool_t                                                          fIsFromMBHeader;                                        // flag for MC headers
                Bool_t                                                          fIsMC;                                                          // flag for MC information
 
@@ -304,7 +322,7 @@ class AliAnalysisTaskGammaConvCalo : public AliAnalysisTaskSE {
                AliAnalysisTaskGammaConvCalo(const AliAnalysisTaskGammaConvCalo&); // Prevent copy-construction
                AliAnalysisTaskGammaConvCalo &operator=(const AliAnalysisTaskGammaConvCalo&); // Prevent assignment
 
-               ClassDef(AliAnalysisTaskGammaConvCalo, 2);
+               ClassDef(AliAnalysisTaskGammaConvCalo, 3);
 };
 
 #endif
index 0ddb95a..563a784 100644 (file)
@@ -40,6 +40,7 @@
 #include "AliV0ReaderV1.h"
 #include "AliAODMCParticle.h"
 #include "AliAODMCHeader.h"
+#include "AliPicoTrack.h"
 
 class iostream;
 
@@ -49,17 +50,17 @@ ClassImp(AliCaloPhotonCuts)
 
 
 const char* AliCaloPhotonCuts::fgkCutNames[AliCaloPhotonCuts::kNCuts] = {
-       "ClusterType",                  //0              
-       "EtaMin",                               //1
-       "EtaMax",                               //2
-       "PhiMin",                               //3
-       "PhiMax",                               //4
-       "DistanceToBadChannel", //5
-       "Timing",                               //6
-       "TrackMatching",                //7
-       "ExoticCell",                   //8
-       "MinEnergy",                    //9
-       "MinNCells",                    //10
+       "ClusterType",          //0   0: all,    1: EMCAL,   2: PHOS
+       "EtaMin",               //1   0: -10,    1: -0.6687, 2: -0,5, 3: -2
+       "EtaMax",               //2   0: 10,     1: 0.66465, 2: 0.5,  3: 2
+       "PhiMin",               //3   0: -10000, 1: 1.39626
+       "PhiMax",               //4   0: 10000, 1: 3.125
+       "DistanceToBadChannel", //5   0: 0,      1: 5
+       "Timing",               //6   0: no cut
+       "TrackMatching",        //7   0: 0,      1: 5
+       "ExoticCell",           //8   0: no cut
+       "MinEnergy",            //9   0: no cut, 1: 0.05,    2: 0.1,  3: 0.15, 4: 0.2, 5: 0.3, 6: 0.5, 7: 0.75, 8: 1, 9: 1.25 (all GeV)
+       "MinNCells",            //10  0: no cut, 1: 1,       2: 2,    3: 3,    4: 4,   5: 5,   6: 6
        "MinM02",                               //11
        "MaxM02",                               //12
        "MinM20",                               //13
@@ -116,6 +117,7 @@ AliCaloPhotonCuts::AliCaloPhotonCuts(const char *name,const char *title) :
        fHistClusterTimevsEAfterQA(NULL),
        fHistExoticCellBeforeQA(NULL),
        fHistExoticCellAfterQA(NULL),
+       fHistNMatchedTracks(NULL),
        fHistDistanceTrackToClusterBeforeQA(NULL),
        fHistDistanceTrackToClusterAfterQA(NULL),
        fHistEnergyOfClusterBeforeQA(NULL),
@@ -182,6 +184,7 @@ AliCaloPhotonCuts::AliCaloPhotonCuts(const AliCaloPhotonCuts &ref) :
        fHistClusterTimevsEAfterQA(NULL),
        fHistExoticCellBeforeQA(NULL),
        fHistExoticCellAfterQA(NULL),
+       fHistNMatchedTracks(NULL),
        fHistDistanceTrackToClusterBeforeQA(NULL),
        fHistDistanceTrackToClusterAfterQA(NULL),
        fHistEnergyOfClusterBeforeQA(NULL),
@@ -288,9 +291,11 @@ void AliCaloPhotonCuts::InitCutHistograms(TString name){
        fHistograms->Add(fHistExoticCellBeforeQA);
        fHistExoticCellAfterQA=new TH2F(Form("ExoticCell_afterClusterQA %s",GetCutNumber().Data()),"ExoticCell_afterClusterQA",400,0,40,50,0.75,1);
        fHistograms->Add(fHistExoticCellAfterQA);
-       fHistDistanceTrackToClusterBeforeQA = new TH1F(Form("DistanceToTrack_beforeClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_beforeClusterQA",200,0,40);
+       fHistNMatchedTracks = new TH1F(Form("NMatchedTracks_%s",GetCutNumber().Data()),"NMatchedTracks",22,-1.5,20.5);
+       fHistograms->Add(fHistNMatchedTracks);
+       fHistDistanceTrackToClusterBeforeQA = new TH1F(Form("DistanceToTrack_beforeClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_beforeClusterQA",200,0,2);
        fHistograms->Add(fHistDistanceTrackToClusterBeforeQA);
-       fHistDistanceTrackToClusterAfterQA = new TH1F(Form("DistanceToTrack_afterClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_afterClusterQA",200,0,40);
+       fHistDistanceTrackToClusterAfterQA = new TH1F(Form("DistanceToTrack_afterClusterQA %s",GetCutNumber().Data()),"DistanceToTrack_afterClusterQA",200,0,2);
        fHistograms->Add(fHistDistanceTrackToClusterAfterQA);
        fHistEnergyOfClusterBeforeQA = new TH1F(Form("EnergyOfCluster_beforeClusterQA %s",GetCutNumber().Data()),"EnergyOfCluster_beforeClusterQA",300,0,30);
        fHistograms->Add(fHistEnergyOfClusterBeforeQA);
@@ -514,11 +519,38 @@ Bool_t AliCaloPhotonCuts::ClusterQualityCuts(AliVCluster* cluster, AliVEvent *ev
        if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex);
        cutIndex++;
 
+       Double_t minR = 999.0;
+       // get the minimum radius of tracks to cluster
+       if(fHistDistanceTrackToClusterBeforeQA || fHistDistanceTrackToClusterAfterQA){
+               Float_t pos[3];
+               cluster->GetPosition(pos);  // Get cluster position
+               
+               TVector3 cp(pos);
+               int NtrMatched = 0;
+               NtrMatched = cluster->GetNTracksMatched();
+               fHistNMatchedTracks->Fill(NtrMatched);
+               //loop over tracks for Jet QA
+               TList *l = event->GetList();
+               TClonesArray *tracks = dynamic_cast<TClonesArray*>(l->FindObject("Tracks"));
+               for(int itrack = 0; itrack < NtrMatched; itrack++){
+                       AliVTrack *trackcluster = static_cast<AliVTrack*>(tracks->At(itrack));
+                       if (! trackcluster) {
+                               AliError(Form("Couldn't get ESD track %d\n", itrack));
+                               continue;
+                       }
+                       Double_t dphi = -999.0;
+                       Double_t deta = -999.0;
+                       AliPicoTrack::GetEtaPhiDiff(trackcluster, cluster, dphi, deta);
+                       Double_t dr = sqrt(dphi*dphi + deta+deta);
+                       if(dr < minR)
+                               minR = dr;
+               }//loop over tracks
+       }
        
        // Fill Histos before Cuts
        if(fHistClusterTimevsEBeforeQA) fHistClusterTimevsEBeforeQA->Fill(cluster->GetTOF(), cluster->E());
 //     if(fHistExoticCellBeforeQA) fHistExoticCellBeforeQA->Fill(cluster->E(), );
-       if(fHistDistanceTrackToClusterBeforeQA) fHistDistanceTrackToClusterBeforeQA->Fill(cluster->GetEmcCpvDistance());
+       if(fHistDistanceTrackToClusterBeforeQA) fHistDistanceTrackToClusterBeforeQA->Fill(minR);
        if(fHistEnergyOfClusterBeforeQA) fHistEnergyOfClusterBeforeQA->Fill(cluster->E());
        if(fHistNCellsBeforeQA) fHistNCellsBeforeQA->Fill(cluster->GetNCells());
        if(fHistM02BeforeQA) fHistM02BeforeQA->Fill(cluster->GetM02());
@@ -537,10 +569,38 @@ Bool_t AliCaloPhotonCuts::ClusterQualityCuts(AliVCluster* cluster, AliVEvent *ev
 
        // Minimum distance to track
        if (fUseDistTrackToCluster){
-               if(cluster->GetEmcCpvDistance() < fMinDistTrackToCluster){
-                       if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //2
+               Float_t pos[3];
+               cluster->GetPosition(pos);  // Get cluster position
+               TVector3 cp(pos);
+               int NtrMatched = 0;
+               NtrMatched = cluster->GetNTracksMatched();
+               
+               //loop over tracks for Jet QA
+               TList *l = event->GetList();
+               TClonesArray *tracks = dynamic_cast<TClonesArray*>(l->FindObject("Tracks"));
+
+               for(int itrack = 0; itrack < NtrMatched; itrack++){
+               AliVTrack *trackcluster = static_cast<AliVTrack*>(tracks->At(itrack));
+               if (! trackcluster) {
+                       AliError(Form("Couldn't get ESD track %d\n", itrack));
+                       continue;
+               }
+               Double_t dphi = -999.0;
+               Double_t deta = -999.0;
+               AliPicoTrack::GetEtaPhiDiff(trackcluster, cluster, dphi, deta);
+               Double_t dr = sqrt(dphi*dphi + deta+deta);
+               if(dr < fMinDistTrackToCluster){
                        return kFALSE;
                }
+               
+               }//loop over tracks
+
+       /*
+               if(cluster->GetEmcCpvDistance() < fMinDistTrackToCluster){
+                               if(fHistClusterIdentificationCuts)fHistClusterIdentificationCuts->Fill(cutIndex); //2
+                               return kFALSE;
+                       }
+       */
        }       
        cutIndex++;//3, next cut
 
@@ -620,6 +680,7 @@ Bool_t AliCaloPhotonCuts::ClusterQualityCuts(AliVCluster* cluster, AliVEvent *ev
        if(fHistClusterEtavsPhiAfterQA) fHistClusterEtavsPhiAfterQA->Fill(phiCluster,etaCluster);
        if(fHistClusterTimevsEAfterQA) fHistClusterTimevsEAfterQA->Fill(cluster->GetTOF(), cluster->E());
 //     if(fHistExoticCellAfterQA) fHistExoticCellAfterQA->Fill(cluster->E(), );
+       if(fHistDistanceTrackToClusterAfterQA) fHistDistanceTrackToClusterAfterQA->Fill(minR);
        if(fHistDistanceTrackToClusterAfterQA) fHistDistanceTrackToClusterAfterQA->Fill(cluster->GetEmcCpvDistance());
        if(fHistEnergyOfClusterAfterQA) fHistEnergyOfClusterAfterQA->Fill(cluster->E());
        if(fHistNCellsAfterQA) fHistNCellsAfterQA->Fill(cluster->GetNCells());
@@ -1050,7 +1111,7 @@ Bool_t AliCaloPhotonCuts::SetMaxPhiCut(Int_t maxPhi)
        switch(maxPhi){
        case 0: 
                if (!fUsePhiCut) fUsePhiCut=0;
-               fMaxPhiCut=-10000;
+               fMaxPhiCut=10000;
                break;
        case 1: 
                if (!fUsePhiCut) fUsePhiCut=1;
index 1216b96..c445a50 100644 (file)
@@ -172,6 +172,7 @@ class AliCaloPhotonCuts : public AliAnalysisCuts {
                TH2F* fHistClusterTimevsEAfterQA;                       // Cluster time vs E after cluster quality cuts
                TH2F* fHistExoticCellBeforeQA;                          // Exotic cell: 1-Ecross/E cell vs Ecluster before acceptance cuts
                TH2F* fHistExoticCellAfterQA;                           // Exotic cell: 1-Ecross/E cell vs Ecluster after cluster quality cuts
+               TH1F* fHistNMatchedTracks;                                      // number of matched tracks
                TH1F* fHistDistanceTrackToClusterBeforeQA;      // distance cluster to track before acceptance cuts
                TH1F* fHistDistanceTrackToClusterAfterQA;       // distance cluster to track after cluster quality cuts
                TH1F* fHistEnergyOfClusterBeforeQA;                     // enery per cluster before acceptance cuts
index c8650d0..819b555 100644 (file)
@@ -226,7 +226,8 @@ void AddTask_GammaConvCalo_PbPb(    Int_t trainConfig = 1,  //change different s
        task->SetDoMesonAnalysis(kTRUE);
        task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
        task->SetDoPhotonQA(enableQAPhotonTask);  //Attention new switch small for Photon QA
-
+       task->SetDoClusterQA(1);  //Attention new switch small for Cluster QA
+       
        //connect containers
        AliAnalysisDataContainer *coutput =
                mgr->CreateContainer(Form("GammaConvCalo_%i",trainConfig), TList::Class(),
index 12f487f..6b7b5e9 100644 (file)
@@ -194,6 +194,7 @@ void AddTask_GammaConvCalo_pPb(  Int_t trainConfig = 1,  //change different set
        task->SetDoMesonAnalysis(kTRUE);
        task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
        task->SetDoPhotonQA(enableQAPhotonTask);  //Attention new switch small for Photon QA
+       task->SetDoClusterQA(1);  //Attention new switch small for Cluster QA
 
        //connect containers
        AliAnalysisDataContainer *coutput =
index a7a6cf9..271f5b0 100644 (file)
@@ -178,7 +178,8 @@ void AddTask_GammaConvCalo_pp(  Int_t trainConfig = 1,  //change different set o
        task->SetDoMesonAnalysis(kTRUE);
        task->SetDoMesonQA(enableQAMesonTask); //Attention new switch for Pi0 QA
        task->SetDoPhotonQA(enableQAPhotonTask);  //Attention new switch small for Photon QA
-
+       task->SetDoClusterQA(1);  //Attention new switch small for Cluster QA
+       
        //connect containers
        AliAnalysisDataContainer *coutput =
                mgr->CreateContainer(Form("GammaConvCalo_%i",trainConfig), TList::Class(),
index 53cc16e..e39e326 100644 (file)
@@ -130,13 +130,13 @@ void AddTask_GammaConvV1_pPb(  Int_t trainConfig = 1,  //change different set of
                eventCutArray[ 2] = "8000012"; photonCutArray[ 2] = "012092170008260400000"; mesonCutArray[ 2] = "01624035009000"; //New STANDARD CUT |eta| < 0.6, |y| < 0.5
                eventCutArray[ 3] = "8000012"; photonCutArray[ 3] = "002092370023220000000"; mesonCutArray[ 3] = "01621035009000";                       
        } else if (trainConfig == 3) {
-               eventCutArray[ 0] = "8000011"; photonCutArray[ 0] = "002092770023220000000"; mesonCutArray[ 0] = "01621035009000";                       
-               eventCutArray[ 1] = "8000011"; photonCutArray[ 1] = "002092551023220000000"; mesonCutArray[ 1] = "01621035009000";                       
+               eventCutArray[ 0] = "8000011"; photonCutArray[ 0] = "002092770023220000000"; mesonCutArray[ 0] = "01621035009000";
+               eventCutArray[ 1] = "8000011"; photonCutArray[ 1] = "002092551023220000000"; mesonCutArray[ 1] = "01621035009000";
                eventCutArray[ 2] = "8000011"; photonCutArray[ 2] = "002092170003220000000"; mesonCutArray[ 2] = "01621035009000"; //just tighten Psi pair
                eventCutArray[ 3] = "8000011"; photonCutArray[ 3] = "002092170003260000000"; mesonCutArray[ 3] = "01621035009000"; //tighten Psi pair and chi2 in 2D
        } else if (trainConfig == 4) {
-               eventCutArray[ 0] = "8000012"; photonCutArray[ 0] = "002092770023220000000"; mesonCutArray[ 0] = "01621035009000";                       
-               eventCutArray[ 1] = "8000012"; photonCutArray[ 1] = "002092551023220000000"; mesonCutArray[ 1] = "01621035009000";                          
+               eventCutArray[ 0] = "8000012"; photonCutArray[ 0] = "002092770023220000000"; mesonCutArray[ 0] = "01621035009000";
+               eventCutArray[ 1] = "8000012"; photonCutArray[ 1] = "002092551023220000000"; mesonCutArray[ 1] = "01621035009000";
                eventCutArray[ 2] = "8000012"; photonCutArray[ 2] = "002092170003220000000"; mesonCutArray[ 2] = "01621035009000"; //just tighten Psi pair
                eventCutArray[ 3] = "8000012"; photonCutArray[ 3] = "002092170003260000000"; mesonCutArray[ 3] = "01621035009000"; //tighten Psi pair and chi2 in 2D
        } else if (trainConfig == 5) {