1)AliAODParticleCorrelation.h: Data member fIsolation changed from float to bool
[u/mrichter/AliRoot.git] / PWG4 / PartCorrDep / AliAnaPi0EbE.cxx
index 67d4b59780f8f8fa7ffbfd8d6e66b1a501b8e003..e9d501565573719509f0d023e7801af823931d3c 100755 (executable)
@@ -139,7 +139,9 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
        fhEtaPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");\r
        outputContainer->Add(fhEtaPi0) ;\r
        \r
-       if(IsDataMC()){\r
+       if(IsDataMC()) {
+         if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) || 
+            GetReader()->GetDataType() != AliCaloTrackReader::kMC){\r
                \r
                fhPtMCPi0  = new TH1F("hPtMCPi0","Identified pi0 from pi0",nptbins,ptmin,ptmax); \r
                fhPtMCPi0->SetYTitle("N");\r
@@ -175,6 +177,7 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
                fhEtaMCNoPi0->SetXTitle("p_{T #pi^{0}} (GeV/c)");\r
                outputContainer->Add(fhEtaMCNoPi0) ;\r
                \r
+       }
        }//Histos with MC\r
     \r
        \r
@@ -275,7 +278,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
                        if(GetNeutralMesonSelection()->SelectPair(mom1, mom2))\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
+                                       printf("AliAnaPi0EbE::kIMCalo::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
@@ -283,7 +286,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
                                        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(GetDebug() > 0) printf("AliAnaPi0EbE::kIMCalo::Origin of: photon1 %d; photon2 %d \n",tag1, tag2);\r
                                        if(tag1 == AliMCAnalysisUtils::kMCPi0Decay && tag2 == AliMCAnalysisUtils::kMCPi0Decay){\r
                                        \r
                                         //Check if pi0 mother is the same\r
@@ -318,7 +321,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeter()
                \r
        }//1st photon loop\r
        \r
-       if(GetDebug() > 1) printf("End fill AODs \n");  \r
+       if(GetDebug() > 1) printf("AliAnaPi0EbE::kIMCalo::End fill AODs \n");  \r
        \r
 }\r
 \r
@@ -354,13 +357,13 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
                        mom2 = *(photon2->Momentum());\r
                        //Select good pair (good phi, pt cuts, aperture and invariant mass)\r
                        if(GetNeutralMesonSelection()->SelectPair(mom1, mom2)){\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
+                               if(GetDebug() > 1) printf("AliAnaPi0EbE::kIMCaloCTS::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(IsDataMC()){\r
                                        //Check origin of the candidates\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(GetDebug() > 0) printf("AliAnaPi0EbE::kIMCaloCTS::Origin of: photon1 %d; photon2 %d \n",tag1, tag2);\r
                                        if(tag1 == AliMCAnalysisUtils::kMCPi0Decay && tag2 == AliMCAnalysisUtils::kMCPi0Decay){\r
                                                //Check if pi0 mother is the same\r
                                                Int_t label1 = photon1->GetLabel();\r
@@ -395,7 +398,7 @@ void  AliAnaPi0EbE::MakeInvMassInCalorimeterAndCTS()
                \r
        }//1st photon loop\r
        \r
-       if(GetDebug() > 1) printf("End fill AODs \n");  \r
+       if(GetDebug() > 1) printf("AliAnaPi0EbE::kIMCaloCTS::End fill AODs \n");  \r
        \r
 }\r
 \r
@@ -421,7 +424,7 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
        for(Int_t icalo = 0; icalo < pl->GetEntriesFast(); icalo++){\r
                AliAODCaloCluster * calo = (AliAODCaloCluster*) (pl->At(icalo));        \r
                \r
-               //Cluster selection, not charged, with photon id and in fidutial cut\r
+               //Cluster selection, not charged, with pi0 id and in fidutial cut\r
                //Get Momentum vector, \r
                calo->GetMomentum(mom,vertex);//Assume that come from vertex in straight line\r
                //If too small or big pt, skip it\r
@@ -433,10 +436,13 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
                }\r
                \r
                //Create AOD for analysis\r
-               AliAODPWG4Particle aodph = AliAODPWG4Particle(mom);\r
-               aodph.SetLabel(calo->GetLabel(0));\r
-               aodph.SetDetector(fCalorimeter);\r
-               if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Min pt cut and fidutial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodph.Pt(),aodph.Phi(),aodph.Eta());    \r
+               AliAODPWG4Particle aodpi0 = AliAODPWG4Particle(mom);\r
+               aodpi0.SetLabel(calo->GetLabel(0));\r
+               //Set the indeces of the original caloclusters  
+               aodpi0.SetCaloLabel(calo->GetID(),-1);
+               aodpi0.SetDetector(fCalorimeter);\r
+               if(GetDebug() > 1) 
+                 printf("AliAnaPi0EbE::kSSCalo::::FillAOD: Min pt cut and fidutial cut passed: pt %3.2f, phi %2.2f, eta %1.2f\n",aodpi0.Pt(),aodpi0.Phi(),aodpi0.Eta());       \r
                \r
                //Check Distance to Bad channel, set bit.\r
                Double_t distBad=calo->GetDistToBadChannel() ; //Distance to bad channel\r
@@ -444,20 +450,21 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
                if(distBad < fMinDist) //In bad channel (PHOS cristal size 2.2x2.2 cm)\r
                        continue ;\r
                \r
-               if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Bad channel cut passed %4.2f\n",distBad);\r
+               if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: Bad channel cut passed %4.2f\n",distBad);\r
                \r
-               if(distBad > fMinDist3) aodph.SetDistToBad(2) ;\r
-               else if(distBad > fMinDist2) aodph.SetDistToBad(1) ; \r
-               else aodph.SetDistToBad(0) ;\r
+               if(distBad > fMinDist3) aodpi0.SetDistToBad(2) ;\r
+               else if(distBad > fMinDist2) aodpi0.SetDistToBad(1) ; \r
+               else aodpi0.SetDistToBad(0) ;\r
                \r
                //Check PID\r
                //PID selection or bit setting\r
                if(GetReader()->GetDataType() == AliCaloTrackReader::kMC){\r
                        //Get most probable PID, check PID weights (in MC this option is mandatory)\r
-                       aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights\r
-                       if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PDG of identified particle %d\n",aodph.GetPdg());\r
-                       //If primary is not photon, skip it.\r
-                       if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ;\r
+                       aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights\r
+                       if(GetDebug() > 1) 
+                         printf("AliAnaPi0EbE::kSSCalo::::FillAOD: PDG of identified particle %d\n",aodpi0.GetPdg());\r
+                       //If primary is not pi0, skip it.\r
+                       if(aodpi0.GetPdg() != AliCaloPID::kPi0) continue ;\r
                }                                       \r
                else if(IsCaloPIDOn()){\r
                        //Skip matched clusters with tracks\r
@@ -466,38 +473,41 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
                        //Get most probable PID, 2 options check PID weights \r
                        //or redo PID, recommended option for EMCal.            \r
                        if(!IsCaloPIDRecalculationOn())\r
-                               aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights\r
+                               aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,calo->PID(),mom.E()));//PID with weights\r
                        else\r
-                               aodph.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated\r
+                               aodpi0.SetPdg(GetCaloPID()->GetPdg(fCalorimeter,mom,calo));//PID recalculated\r
                        \r
-                       if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PDG of identified particle %d\n",aodph.GetPdg());\r
+                       if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: PDG of identified particle %d\n",aodpi0.GetPdg());\r
                        \r
-                       //If cluster does not pass pid, not photon, skip it.\r
-                       if(aodph.GetPdg() != AliCaloPID::kPhoton) continue ;                    \r
+                       //If cluster does not pass pid, not pi0, skip it.\r
+                       if(aodpi0.GetPdg() != AliCaloPID::kPi0) continue ;                      \r
                        \r
                }\r
                else{\r
                        //Set PID bits for later selection (AliAnaPi0 for example)\r
                        //GetPDG already called in SetPIDBits.\r
-                       GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodph);\r
-                       if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: PID Bits set \n");            \r
+                       GetCaloPID()->SetPIDBits(fCalorimeter,calo,&aodpi0);\r
+                       if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: PID Bits set \n");         \r
                }\r
                \r
-               if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: Photon selection cuts passed: pT %3.2f, pdg %d\n",aodph.Pt(), aodph.GetPdg());\r
+               if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: Pi0 selection cuts passed: pT %3.2f, pdg %d\n",aodpi0.Pt(), aodpi0.GetPdg());\r
                \r
                //Play with the MC stack if available\r
                //Check origin of the candidates\r
                if(IsDataMC()){\r
-                       aodph.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(0),GetMCStack()));\r
-                       if(GetDebug() > 0) printf("AliAnaPi0EbE::FillAOD: Origin of candidate %d\n",aodph.GetTag());\r
+                 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) || 
+                    GetReader()->GetDataType() != AliCaloTrackReader::kMC){\r
+                       aodpi0.SetTag(GetMCAnalysisUtils()->CheckOrigin(calo->GetLabel(0),GetMCStack()));\r
+                       if(GetDebug() > 0) printf("AliAnaPi0EbE::kSSCalo::EbE::FillAOD: Origin of candidate %d\n",aodpi0.GetTag());\r
+                 }
                }//Work with stack also   \r
                \r
-               //Add AOD with photon object to aod branch\r
-               AddAODParticle(aodph);\r
+               //Add AOD with pi0 object to aod branch\r
+               AddAODParticle(aodpi0);\r
                \r
        }//loop\r
        \r
-       if(GetDebug() > 1) printf("AliAnaPhoton::FillAOD: End fill AODs \n");  \r
+       if(GetDebug() > 1) printf("AliAnaPi0EbE::kSSCalo::::FillAOD: End fill AODs \n");  \r
        \r
 }\r
 //__________________________________________________________________\r
@@ -510,7 +520,7 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
        \r
        //Loop on stored AOD pi0\r
        Int_t naod = GetOutputAODBranch()->GetEntriesFast();\r
-       if(GetDebug() > 0) printf("pi0 aod branch entries %d\n", naod);\r
+       if(GetDebug() > 0) printf("AliAnaPi0EbE::Histo::pi0 aod branch entries %d\n", naod);\r
        \r
        for(Int_t iaod = 0; iaod < naod ; iaod++){\r
                \r
@@ -530,6 +540,8 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
                fhEtaPi0 ->Fill(pt,eta);\r
                \r
                if(IsDataMC()){\r
+                 if((GetReader()->GetDataType() == AliCaloTrackReader::kMC && fAnaType!=kSSCalo) || 
+                    GetReader()->GetDataType() != AliCaloTrackReader::kMC){\r
                        if(pi0->GetTag()== AliMCAnalysisUtils::kMCPi0){\r
                                fhPtMCPi0  ->Fill(pt);\r
                                fhPhiMCPi0 ->Fill(pt,phi);\r
@@ -540,6 +552,7 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
                                fhPhiMCNoPi0 ->Fill(pt,phi);\r
                                fhEtaMCNoPi0 ->Fill(pt,eta);\r
                        }\r
+                 }
                }//Histograms with MC\r
                \r
        }// aod loop\r
@@ -547,6 +560,23 @@ void  AliAnaPi0EbE::MakeAnalysisFillHistograms()
 }\r
 \r
 \r
+//____________________________________________________________________________
+void AliAnaPi0EbE::Init()
+{
+  
+  //Init
+  //Do some checks
+  if(fCalorimeter == "PHOS" && !GetReader()->IsPHOSSwitchedOn()){
+    printf("!!ABORT: You want to use PHOS in analysis but it is not read!! \n!!Check the configuration file!!\n");
+    abort();
+  }
+  else  if(fCalorimeter == "EMCAL" && !GetReader()->IsEMCALSwitchedOn()){
+    printf("!!ABORT: You want to use EMCAL in analysis but it is not read!! \n!!Check the configuration file!!\n");
+    abort();
+  }
+  
+}
+
 //____________________________________________________________________________\r
 void AliAnaPi0EbE::InitParameters()\r
 {\r
@@ -556,7 +586,7 @@ void AliAnaPi0EbE::InitParameters()
        SetOutputAODName("pi0s");\r
        fInputAODGammaConvName = "gammaconv" ;\r
        fAnaType = kIMCalo ;\r
-       fCalorimeter = "PHOS" ;\r
+       fCalorimeter = "EMCAL" ;\r
        fMinDist  = 2.;\r
        fMinDist2 = 4.;\r
        fMinDist3 = 5.;\r