1)Terminate() method implemented in the frame. Simple examples on what to do with...
[u/mrichter/AliRoot.git] / PWG4 / PartCorrDep / AliAnaPi0EbE.cxx
index b8ed86f449233261c023d4b0eaeff5946bcc7e97..67d4b59780f8f8fa7ffbfd8d6e66b1a501b8e003 100755 (executable)
@@ -36,8 +36,9 @@
 #include "AliIsolationCut.h"\r
 #include "AliNeutralMesonSelection.h"\r
 #include "AliCaloPID.h"\r
+#include "AliMCAnalysisUtils.h"\r
 #include "AliAODPWG4ParticleCorrelation.h"\r
-\r
+    #include "AliStack.h"\r
 ClassImp(AliAnaPi0EbE)\r
   \r
 //____________________________________________________________________________\r
@@ -264,24 +265,42 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
                AliAODPWG4Particle * photon1 =  (AliAODPWG4Particle*) (GetInputAODBranch()->At(iphoton));\r
                mom1 = *(photon1->Momentum());\r
                \r
-               //Play with the MC stack if available\r
-               \r
+       \r
                for(Int_t jphoton = iphoton+1; jphoton < GetInputAODBranch()->GetEntriesFast()-1; jphoton++){\r
                        \r
                        AliAODPWG4ParticleCorrelation * photon2 =  (AliAODPWG4ParticleCorrelation*) (GetInputAODBranch()->At(jphoton));\r
                        mom2 = *(photon2->Momentum());\r
+               \r
                        //Select good pair (good phi, pt cuts, aperture and invariant mass)\r
                        if(GetNeutralMesonSelection()->SelectPair(mom1, mom2))\r
                        {\r
-                               if(GetDebug()>1) printf("Selected gamma pair: pt %f, phi %f, eta%f \n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta());\r
-                               \r
+                               if(GetDebug()>1) \r
+                                       printf("Selected gamma pair: pt %f, phi %f, eta%f \n",(mom1+mom2).Pt(), (mom1+mom2).Phi()*180./3.1416, (mom1+mom2).Eta());\r
                                \r
+                                               //Play with the MC stack if available\r
                                if(IsDataMC()){\r
                                        //Check origin of the candidates\r
-                                       tag1 = GetCaloPID()->CheckOrigin(photon1->GetLabel(), GetMCStack());\r
-                                       tag2 = GetCaloPID()->CheckOrigin(photon2->GetLabel(), GetMCStack());\r
+                                       tag1 = GetMCAnalysisUtils()->CheckOrigin(photon1->GetLabel(), GetMCStack());\r
+                                       tag2 = GetMCAnalysisUtils()->CheckOrigin(photon2->GetLabel(), GetMCStack());\r
+                                       \r
                                        if(GetDebug() > 0) printf("Origin of: photon1 %d; photon2 %d \n",tag1, tag2);\r
-                                       if(tag1 == AliCaloPID::kMCPi0Decay && tag2 == AliCaloPID::kMCPi0Decay) tag = AliCaloPID::kMCPi0;\r
+                                       if(tag1 == AliMCAnalysisUtils::kMCPi0Decay && tag2 == AliMCAnalysisUtils::kMCPi0Decay){\r
+                                       \r
+                                        //Check if pi0 mother is the same\r
+                                       Int_t label1 = photon1->GetLabel();\r
+                                       TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree\r
+                                       label1 = mother1->GetFirstMother();\r
+                                       //mother1 = GetMCStack()->Particle(label1);//pi0\r
+                                       \r
+                                       Int_t label2 = photon2->GetLabel();\r
+                                       TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree\r
+                                       label2 = mother2->GetFirstMother();\r
+                                       //mother2 = GetMCStack()->Particle(label2);//pi0\r
+                                       \r
+                                       //printf("mother1 %d, mother2 %d\n",label1,label2);\r
+                                       if(label1 == label2)\r
+                                               tag = AliMCAnalysisUtils::kMCPi0;\r
+                                       }\r
                                }//Work with stack also   \r
                                \r
                                //Create AOD for analysis\r
@@ -339,10 +358,25 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
                                \r
                                if(IsDataMC()){\r
                                        //Check origin of the candidates\r
-                                       tag1 = GetCaloPID()->CheckOrigin(photon1->GetLabel(), GetMCStack());\r
-                                       tag2 = GetCaloPID()->CheckOrigin(photon2->GetLabel(), GetMCStack());\r
+                                       tag1 = GetMCAnalysisUtils()->CheckOrigin(photon1->GetLabel(), GetMCStack());\r
+                                       tag2 = GetMCAnalysisUtils()->CheckOrigin(photon2->GetLabel(), GetMCStack());\r
                                        if(GetDebug() > 0) printf("Origin of: photon1 %d; photon2 %d \n",tag1, tag2);\r
-                                       if(tag1 == AliCaloPID::kMCPi0Decay && tag2 == AliCaloPID::kMCPi0Decay) tag = AliCaloPID::kMCPi0;\r
+                                       if(tag1 == AliMCAnalysisUtils::kMCPi0Decay && tag2 == AliMCAnalysisUtils::kMCPi0Decay){\r
+                                               //Check if pi0 mother is the same\r
+                                               Int_t label1 = photon1->GetLabel();\r
+                                               TParticle * mother1 = GetMCStack()->Particle(label1);//photon in kine tree\r
+                                               label1 = mother1->GetFirstMother();\r
+                                               //mother1 = GetMCStack()->Particle(label1);//pi0\r
+                                       \r
+                                               Int_t label2 = photon2->GetLabel();\r
+                                               TParticle * mother2 = GetMCStack()->Particle(label2);//photon in kine tree\r
+                                               label2 = mother2->GetFirstMother();\r
+                                               //mother2 = GetMCStack()->Particle(label2);//pi0\r
+                                       \r
+                                               //printf("mother1 %d, mother2 %d\n",label1,label2);\r
+                                               if(label1 == label2)\r
+                                                       tag = AliMCAnalysisUtils::kMCPi0;\r
+                                       }\r
                                }//Work with stack also   \r
                                \r
                                //Create AOD for analysis\r
@@ -454,7 +488,7 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
                //Play with the MC stack if available\r
                //Check origin of the candidates\r
                if(IsDataMC()){\r
-                       aodph.SetTag(GetCaloPID()->CheckOrigin(calo->GetLabel(0),GetMCStack()));\r
+                       aodph.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(0),GetMCStack()));\r
                        if(GetDebug() > 0) printf("AliAnaPi0EbE::FillAOD: Origin of candidate %d\n",aodph.GetTag());\r
                }//Work with stack also   \r
                \r
@@ -496,7 +530,7 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
                fhEtaPi0 ->Fill(pt,eta);\r
                \r
                if(IsDataMC()){\r
-                       if(pi0->GetTag()== AliCaloPID::kMCPi0Decay){\r
+                       if(pi0->GetTag()== AliMCAnalysisUtils::kMCPi0){\r
                                fhPtMCPi0  ->Fill(pt);\r
                                fhPhiMCPi0 ->Fill(pt,phi);\r
                                fhEtaMCPi0 ->Fill(pt,eta);\r