From c264a456236e68cf6992536107155831d27e7d48 Mon Sep 17 00:00:00 2001
From: Hass AbouZeid <hass.abouzeid@cern.ch>
Date: Wed, 19 Apr 2017 11:33:41 +0000
Subject: [PATCH] Merge branch 'PFOHistUtils_ATLJETMET_738' into '21.0'

Pfo hist utils atljetmet 738

See merge request !880

Former-commit-id: 429444ea8e9bbc73717de80473b6d2b798a4b2ec
---
 Event/xAOD/xAODPFlow/Root/PFO_v1.cxx          |   4 +
 .../PFOHistUtils/PFOClusterMomentPlots.h      |  39 +++---
 .../src/PFOClusterMomentPlots.cxx             | 125 +++++++-----------
 .../eflowMomentCalculatorToolDefault.py       |   1 +
 .../eflowRec/src/eflowObjectCreatorTool.cxx   |   2 +-
 5 files changed, 70 insertions(+), 101 deletions(-)

diff --git a/Event/xAOD/xAODPFlow/Root/PFO_v1.cxx b/Event/xAOD/xAODPFlow/Root/PFO_v1.cxx
index 467b52149bdf..f08360e6d5e8 100644
--- a/Event/xAOD/xAODPFlow/Root/PFO_v1.cxx
+++ b/Event/xAOD/xAODPFlow/Root/PFO_v1.cxx
@@ -509,6 +509,10 @@ namespace xAOD {
       myAttribute = xAOD::PFODetails::eflowRec_AVG_TILE_Q;
       return true;
     }
+    else if (momentType == xAOD::CaloCluster::EM_PROBABILITY){
+      myAttribute = xAOD::PFODetails::eflowRec_EM_PROBABILITY;
+      return true;
+    }    
     else return false;
 
   }
diff --git a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/PFOClusterMomentPlots.h b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/PFOClusterMomentPlots.h
index a5321ac61960..1a3743950b70 100644
--- a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/PFOClusterMomentPlots.h
+++ b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/PFOClusterMomentPlots.h
@@ -14,29 +14,26 @@ namespace PFO {
 
   public:
 
-     PFOClusterMomentPlots(PlotBase *pParent, std::string sDir, std::string sPFOContainerName);
-
-     void fill(const xAOD::PFO& PFO);
-
+    PFOClusterMomentPlots(PlotBase *pParent, std::string sDir, std::string sPFOContainerName);
+    
+    void fill(const xAOD::PFO& PFO);
+    
   private:
 
-     TH1* m_PFO_LATERAL;
-     TH1* m_PFO_LONGITUDINAL;
-     TH1* m_PFO_SECOND_R;
-     TH1* m_PFO_CENTER_LAMBDA;
-     TH1* m_PFO_FIRST_ENG_DENS;
-     TH1* m_PFO_ENG_FRAC_MAX;
-     TH1* m_PFO_ISOLATION;
-     TH1* m_PFO_ENG_BAD_CELLS;
-     TH1* m_PFO_N_BAD_CELLS;
-     TH1* m_PFO_BADLARQ_FRAC;
-     TH1* m_PFO_ENG_POS;
-     TH1* m_PFO_SIGNIFICANCE;
-     TH1* m_PFO_AVG_LAR_Q;
-     TH1* m_PFO_AVG_TILE_Q;
-
-     void initializePlots();
-     std::string m_sPFOContainerName;
+    TH1* m_PFO_SECOND_R;
+    TH1* m_PFO_CENTER_LAMBDA;
+    TH1* m_PFO_ISOLATION;
+    TH1* m_PFO_ENG_BAD_CELLS;
+    TH1* m_PFO_N_BAD_CELLS;
+    TH1* m_PFO_BADLARQ_FRAC;
+    TH1* m_PFO_ENG_POS;
+    TH1* m_PFO_AVG_LAR_Q;
+    TH1* m_PFO_AVG_TILE_Q;
+    TH1* m_PFO_EM_PROBABILTY;
+    TH1* m_PFO_SECOND_LAMBDA;
+    
+    void initializePlots();
+    std::string m_sPFOContainerName;
 
   };
 
diff --git a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/PFOClusterMomentPlots.cxx b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/PFOClusterMomentPlots.cxx
index 2e3a989fe848..1fe5243f0c4c 100644
--- a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/PFOClusterMomentPlots.cxx
+++ b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/PFOClusterMomentPlots.cxx
@@ -7,112 +7,79 @@
 namespace PFO {
 
   PFOClusterMomentPlots::PFOClusterMomentPlots(PlotBase* pParent, std::string sDir, std::string sPFOContainerName) : PlotBase(pParent, sDir), m_sPFOContainerName(sPFOContainerName){
-    m_PFO_LATERAL = nullptr;
-    m_PFO_LONGITUDINAL = nullptr;
     m_PFO_SECOND_R = nullptr;
     m_PFO_CENTER_LAMBDA = nullptr;
-    m_PFO_FIRST_ENG_DENS = nullptr;
-    m_PFO_ENG_FRAC_MAX = nullptr;
     m_PFO_ISOLATION = nullptr;
     m_PFO_ENG_BAD_CELLS = nullptr;
     m_PFO_N_BAD_CELLS = nullptr;
     m_PFO_BADLARQ_FRAC = nullptr;
     m_PFO_ENG_POS = nullptr;
-    m_PFO_SIGNIFICANCE = nullptr;
     m_PFO_AVG_LAR_Q = nullptr;
     m_PFO_AVG_TILE_Q = nullptr;
-}
+    m_PFO_EM_PROBABILTY = nullptr;
+    m_PFO_SECOND_LAMBDA = nullptr;
+  }
 
   void PFOClusterMomentPlots::initializePlots(){
 
-    m_PFO_LATERAL = Book1D("PFO_LATERAL",m_sPFOContainerName + "_LATERAL",60,-1.0,2.0);
-    m_PFO_LONGITUDINAL = Book1D("PFO_LONGITUDINAL",m_sPFOContainerName + "_LONGITUDINAL",60,-1.0,2.0);
     m_PFO_SECOND_R = Book1D("PFO_SECOND_R",m_sPFOContainerName + "_SECOND_R",60,-1.0,50.0); 
     m_PFO_CENTER_LAMBDA = Book1D("PFO_CENTER_LAMBDA",m_sPFOContainerName + "_CENTER_LAMBDA",60,-1.0,3000.0);
-    m_PFO_FIRST_ENG_DENS = Book1D("PFO_FIRST_ENG_DENS",m_sPFOContainerName + "_FIRST_ENG_DENS",26,-1.0,0.3);
-    m_PFO_ENG_FRAC_MAX = Book1D("PFO_ENG_FRAC_MAX",m_sPFOContainerName + "_ENG_FRAC_MAX",60,-1.0,2.0);
     m_PFO_ISOLATION = Book1D("PFO_ISOLATION",m_sPFOContainerName + "_ISOLATION",60,-1.0,2.0);
     m_PFO_ENG_BAD_CELLS = Book1D("PFO_ENG_BAD_CELLS",m_sPFOContainerName + "_ENG_BAD_CELLS",20,-1.0,1);
     m_PFO_N_BAD_CELLS = Book1D("PFO_N_BAD_CELLS",m_sPFOContainerName + "_N_BAD_CELLS",30,-1.0,2.0);
     m_PFO_BADLARQ_FRAC = Book1D("PFO_BADLARQ_FRAC",m_sPFOContainerName + "_BADLARQ_FRAC",25,-1.0,1.5);
     m_PFO_ENG_POS = Book1D("PFO_ENG_POS",m_sPFOContainerName + "_ENG_POS",60,-100.0,10000.0);
-    m_PFO_SIGNIFICANCE = Book1D("PFO_SIGNIFICANCE",m_sPFOContainerName + "_SIGNIFICANCE",300,-20.0,20.0);
     m_PFO_AVG_LAR_Q = Book1D("PFO_AVG_LAR_Q",m_sPFOContainerName + "_AVG_LAR_Q",240,-1.0,200.0);
     m_PFO_AVG_TILE_Q = Book1D("PFO_AVG_TILE_Q",m_sPFOContainerName + "_AVG_TILE_Q",21,-1.0,20.0);
-
+    m_PFO_EM_PROBABILTY = Book1D("PFO_EM_PROBABILTY",m_sPFOContainerName + "_EM_PROBABILTY",20,0,1);
+    m_PFO_SECOND_LAMBDA = Book1D("PFO_SECOND_LAMBDA",m_sPFOContainerName + "_SECOND_LAMBDA",60,-1.0,3000.0);
   }
 
   void PFOClusterMomentPlots::fill(const xAOD::PFO& PFO){
 
-    float moment_LATERAL = 0.0;
-    bool gotMoment = PFO.getClusterMoment(moment_LATERAL,xAOD::CaloCluster::LATERAL);
-    if (true == gotMoment) m_PFO_LATERAL->Fill(moment_LATERAL);
-    else m_PFO_LATERAL->Fill(-1.0);
-
-    float moment_LONGITUDINAL = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_LONGITUDINAL,xAOD::CaloCluster::LONGITUDINAL);
-    if (true == gotMoment) m_PFO_LONGITUDINAL->Fill(moment_LONGITUDINAL);
-    else m_PFO_LONGITUDINAL->Fill(-1.0);
+    float moment_SECOND_R = -1.0;
+    PFO.getClusterMoment(moment_SECOND_R,xAOD::CaloCluster::SECOND_R);
+    m_PFO_SECOND_R->Fill(moment_SECOND_R);
+        
+    float moment_CENTER_LAMBDA = -1.0;
+    PFO.getClusterMoment(moment_CENTER_LAMBDA,xAOD::CaloCluster::CENTER_LAMBDA);
+    m_PFO_CENTER_LAMBDA->Fill(moment_CENTER_LAMBDA);
     
-    float moment_SECOND_R = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_SECOND_R,xAOD::CaloCluster::SECOND_R);
-    if (true == gotMoment) m_PFO_SECOND_R->Fill(moment_SECOND_R);
-    else m_PFO_SECOND_R->Fill(-1.0);
-
-    float moment_CENTER_LAMBDA = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_CENTER_LAMBDA,xAOD::CaloCluster::CENTER_LAMBDA);
-    if (true == gotMoment) m_PFO_CENTER_LAMBDA->Fill(moment_CENTER_LAMBDA);
-    else m_PFO_CENTER_LAMBDA->Fill(-1.0);
+    float moment_ISOLATION = -1.0;
+    PFO.getClusterMoment(moment_ISOLATION,xAOD::CaloCluster::ISOLATION);
+    m_PFO_ISOLATION->Fill(moment_ISOLATION);
+
+    float moment_ENG_BAD_CELLS = -1.0;
+    PFO.getClusterMoment(moment_ENG_BAD_CELLS,xAOD::CaloCluster::ENG_BAD_CELLS);
+    m_PFO_ENG_BAD_CELLS->Fill(moment_ENG_BAD_CELLS);
+
+    float moment_N_BAD_CELLS = -1.0;
+    PFO.getClusterMoment(moment_N_BAD_CELLS,xAOD::CaloCluster::N_BAD_CELLS);
+    m_PFO_N_BAD_CELLS->Fill(moment_N_BAD_CELLS);
+
+    float moment_BADLARQ_FRAC = -1.0;
+    PFO.getClusterMoment(moment_BADLARQ_FRAC,xAOD::CaloCluster::BADLARQ_FRAC);
+    m_PFO_BADLARQ_FRAC->Fill(moment_BADLARQ_FRAC);
+
+    float moment_ENG_POS = -1.0;
+    PFO.getClusterMoment(moment_ENG_POS,xAOD::CaloCluster::ENG_POS);
+    m_PFO_ENG_POS->Fill(moment_ENG_POS);
+
+    float moment_AVG_LAR_Q = -1.0;
+    PFO.getClusterMoment(moment_AVG_LAR_Q,xAOD::CaloCluster::AVG_LAR_Q);
+    m_PFO_AVG_LAR_Q->Fill(moment_AVG_LAR_Q);
+
+    float moment_AVG_TILE_Q = -1.0;
+    PFO.getClusterMoment(moment_AVG_TILE_Q,xAOD::CaloCluster::AVG_TILE_Q);
+    m_PFO_AVG_TILE_Q->Fill(moment_AVG_TILE_Q);
+
+    float moment_EM_PROBABILTY = -1.0;
+    PFO.getClusterMoment(moment_EM_PROBABILTY,xAOD::CaloCluster::EM_PROBABILITY);
+    m_PFO_EM_PROBABILTY->Fill(moment_EM_PROBABILTY);
     
-    float moment_FIRST_ENG_DENS = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_FIRST_ENG_DENS,xAOD::CaloCluster::FIRST_ENG_DENS);
-    if (true == gotMoment) m_PFO_FIRST_ENG_DENS->Fill(moment_FIRST_ENG_DENS);
-    else m_PFO_FIRST_ENG_DENS->Fill(-1.0);
-
-    float moment_ENG_FRAC_MAX = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_ENG_FRAC_MAX,xAOD::CaloCluster::ENG_FRAC_MAX);
-    if (true == gotMoment) m_PFO_ENG_FRAC_MAX->Fill(moment_ENG_FRAC_MAX);
-    else m_PFO_ENG_FRAC_MAX->Fill(-1.0);
-
-    float moment_ISOLATION = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_ISOLATION,xAOD::CaloCluster::ISOLATION);
-    if (true == gotMoment) m_PFO_ISOLATION->Fill(moment_ISOLATION);
-    else m_PFO_ISOLATION->Fill(-1.0);
-
-    float moment_ENG_BAD_CELLS = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_ENG_BAD_CELLS,xAOD::CaloCluster::ENG_BAD_CELLS);
-    if (true == gotMoment) m_PFO_ENG_BAD_CELLS->Fill(moment_ENG_BAD_CELLS);
-    else m_PFO_ENG_BAD_CELLS->Fill(-1.0);
-
-    float moment_N_BAD_CELLS = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_N_BAD_CELLS,xAOD::CaloCluster::N_BAD_CELLS);
-    if (true == gotMoment) m_PFO_N_BAD_CELLS->Fill(moment_N_BAD_CELLS);
-    else m_PFO_N_BAD_CELLS->Fill(-1.0);
-
-    float moment_BADLARQ_FRAC = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_BADLARQ_FRAC,xAOD::CaloCluster::BADLARQ_FRAC);
-    if (true == gotMoment) m_PFO_BADLARQ_FRAC->Fill(moment_BADLARQ_FRAC);
-    else m_PFO_BADLARQ_FRAC->Fill(-1.0);
-
-    float moment_ENG_POS = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_ENG_POS,xAOD::CaloCluster::ENG_POS);
-    if (true == gotMoment) m_PFO_ENG_POS->Fill(moment_ENG_POS);
-    else m_PFO_ENG_POS->Fill(-1.0);
-
-    float moment_SIGNIFICANCE = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_SIGNIFICANCE,xAOD::CaloCluster::SIGNIFICANCE);
-    if (true == gotMoment) m_PFO_SIGNIFICANCE->Fill(moment_SIGNIFICANCE);
-    else m_PFO_SIGNIFICANCE->Fill(-1.0);
-
-    float moment_AVG_LAR_Q = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_AVG_LAR_Q,xAOD::CaloCluster::AVG_LAR_Q);
-    if (true == gotMoment) m_PFO_AVG_LAR_Q->Fill(moment_AVG_LAR_Q);
-    else m_PFO_AVG_LAR_Q->Fill(-1.0);
-
-    float moment_AVG_TILE_Q = 0.0;
-    gotMoment = PFO.getClusterMoment(moment_AVG_TILE_Q,xAOD::CaloCluster::AVG_TILE_Q);
-    if (true == gotMoment) m_PFO_AVG_TILE_Q->Fill(moment_AVG_TILE_Q);
-    else m_PFO_AVG_TILE_Q->Fill(-1.0);
+    float moment_SECOND_LAMBDA = -1.0;
+    PFO.getClusterMoment(moment_SECOND_LAMBDA,xAOD::CaloCluster::SECOND_LAMBDA);
+    m_PFO_SECOND_LAMBDA->Fill(moment_SECOND_LAMBDA);
 
   }
 
diff --git a/Reconstruction/eflowRec/python/eflowMomentCalculatorToolDefault.py b/Reconstruction/eflowRec/python/eflowMomentCalculatorToolDefault.py
index 4a9255a165de..370b9537e8cc 100644
--- a/Reconstruction/eflowRec/python/eflowMomentCalculatorToolDefault.py
+++ b/Reconstruction/eflowRec/python/eflowMomentCalculatorToolDefault.py
@@ -47,6 +47,7 @@ class eflowMomentCalculatorToolDefault(eflowMomentCalculatorTool) :
             ,"FIRST_ENG_DENS" 
             ,"SECOND_ENG_DENS"
             ,"ISOLATION"
+            ,"EM_PROBABILITY"
             ]
 
         #ClusterMomentsMaker.AODMomentsNames = [
diff --git a/Reconstruction/eflowRec/src/eflowObjectCreatorTool.cxx b/Reconstruction/eflowRec/src/eflowObjectCreatorTool.cxx
index 7554ab3020fe..47478b2dfbe2 100644
--- a/Reconstruction/eflowRec/src/eflowObjectCreatorTool.cxx
+++ b/Reconstruction/eflowRec/src/eflowObjectCreatorTool.cxx
@@ -476,7 +476,7 @@ void eflowObjectCreatorTool::addMoment(xAOD::CaloCluster::MomentType momentType,
   bool isRetrieved = theCluster->retrieveMoment(momentType, moment);
   if (true == isRetrieved) {
     xAOD::PFODetails::PFOAttributes myAttribute = pfoAttribute;
-    float float_moment = static_cast<float>(moment);    
+    float float_moment = static_cast<float>(moment);
     thePFO->setAttribute(myAttribute, float_moment);
   }
   else if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << " Could not retrieve moment from the CaloCluster " << endmsg;
-- 
GitLab