From c1d7e28914d0143f9cf05a617a9438e2ad64c7e0 Mon Sep 17 00:00:00 2001
From: Mark Hodgkinson <mhodgkin@aiatlas025.cern.ch>
Date: Thu, 23 Jul 2020 15:45:00 +0200
Subject: [PATCH] Add calib hit moments to neutral FlowElements. Update job
 options to enable PFNeutralFlowElementCreatorAlgorithm.cxx Update
 StreamESD/AOD to unclude all FlowElements from particle flow.

---
 Reconstruction/eflowRec/share/PFlowMTConfig.py             | 6 +++++-
 Reconstruction/eflowRec/share/eflowRecAODList.py           | 5 ++++-
 Reconstruction/eflowRec/share/eflowRecESDList.py           | 6 ++++++
 .../eflowRec/src/PFNeutralFlowElementCreatorAlgorithm.cxx  | 7 +++++++
 4 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/Reconstruction/eflowRec/share/PFlowMTConfig.py b/Reconstruction/eflowRec/share/PFlowMTConfig.py
index 6f2782293ca4..899a6296b80f 100644
--- a/Reconstruction/eflowRec/share/PFlowMTConfig.py
+++ b/Reconstruction/eflowRec/share/PFlowMTConfig.py
@@ -250,8 +250,12 @@ if jobproperties.eflowRecFlags.usePFEGammaPFOAssoc:
    PFEGammaPFOAssoc=PFEGammaPFOAssoc("PFEGammaPFOAssoc")
    topSequence += PFEGammaPFOAssoc
 
-#Add new FlowElement creator
+#Add new FlowElement creators
 from eflowRec.eflowRecConf import PFChargedFlowElementCreatorAlgorithm
 PFChargedFlowElementCreatorAlgorithm = PFChargedFlowElementCreatorAlgorithm("PFChargedFlowElementCreatorAlgorithm")
 topSequence += PFChargedFlowElementCreatorAlgorithm 
 
+from eflowRec.eflowRecConf import PFNeutralFlowElementCreatorAlgorithm
+PFNeutralFlowElementCreatorAlgorithm = PFNeutralFlowElementCreatorAlgorithm("PFNeutralFlowElementCreatorAlgorithm")
+topSequence += PFNeutralFlowElementCreatorAlgorithm 
+
diff --git a/Reconstruction/eflowRec/share/eflowRecAODList.py b/Reconstruction/eflowRec/share/eflowRecAODList.py
index d1f63a344856..e2928085636f 100644
--- a/Reconstruction/eflowRec/share/eflowRecAODList.py
+++ b/Reconstruction/eflowRec/share/eflowRecAODList.py
@@ -23,4 +23,7 @@ if True == jobproperties.eflowRecFlags.provideShowerSubtractedClusters:
     
 #Add new flow elements
 eflowRecAODList += [ "xAOD::FlowElementContainer#JetETMissChargedFlowElements"]
-eflowRecAODList += [ "xAOD::FlowElementAuxContainer#JetETMissChargedFlowElementsAux."]
\ No newline at end of file
+eflowRecAODList += [ "xAOD::FlowElementAuxContainer#JetETMissChargedFlowElementsAux."]
+
+eflowRecAODList += [ "xAOD::FlowElementContainer#JetETMissNeutralFlowElements"]
+eflowRecAODList += [ "xAOD::FlowElementAuxContainer#JetETMissNeutralFlowElementsAux."]
\ No newline at end of file
diff --git a/Reconstruction/eflowRec/share/eflowRecESDList.py b/Reconstruction/eflowRec/share/eflowRecESDList.py
index 227588d739f5..33b7d283111e 100644
--- a/Reconstruction/eflowRec/share/eflowRecESDList.py
+++ b/Reconstruction/eflowRec/share/eflowRecESDList.py
@@ -21,3 +21,9 @@ if True == jobproperties.eflowRecFlags.provideShowerSubtractedClusters:
     eflowRecESDList += [ "xAOD::CaloClusterContainer#PFCaloCluster"]
     eflowRecESDList += [ "xAOD::CaloClusterAuxContainer#PFCaloClusterAux."]
 
+#Add new flow elements
+eflowRecAODList += [ "xAOD::FlowElementContainer#JetETMissChargedFlowElements"]
+eflowRecAODList += [ "xAOD::FlowElementAuxContainer#JetETMissChargedFlowElementsAux."]
+
+eflowRecAODList += [ "xAOD::FlowElementContainer#JetETMissNeutralFlowElements"]
+eflowRecAODList += [ "xAOD::FlowElementAuxContainer#JetETMissNeutralFlowElementsAux."]
\ No newline at end of file
diff --git a/Reconstruction/eflowRec/src/PFNeutralFlowElementCreatorAlgorithm.cxx b/Reconstruction/eflowRec/src/PFNeutralFlowElementCreatorAlgorithm.cxx
index 5ecdd6abbb55..893c83be12eb 100644
--- a/Reconstruction/eflowRec/src/PFNeutralFlowElementCreatorAlgorithm.cxx
+++ b/Reconstruction/eflowRec/src/PFNeutralFlowElementCreatorAlgorithm.cxx
@@ -120,6 +120,13 @@ StatusCode PFNeutralFlowElementCreatorAlgorithm::createNeutralFlowElement(const
     this->addMoment(xAOD::CaloCluster::ISOLATION,"eflowRec_ISOLATION",*cluster,*thisFE);
     this->addMoment(xAOD::CaloCluster::SECOND_LAMBDA,"eflowRec_SECOND_LAMBDA",*cluster,*thisFE);
     this->addMoment(xAOD::CaloCluster::EM_PROBABILITY,"eflowRec_EM_PROBABILITY",*cluster,*thisFE);
+
+    if (m_useCalibHitTruth){
+      this->addMoment(xAOD::CaloCluster::ENG_CALIB_TOT,"eflowRec_ENG_CALIB_TOT",*cluster,*thisFE);
+      this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_EM,"eflowRec_ENG_CALIB_FRAC_EM",*cluster,*thisFE);
+      this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_HAD,"eflowRec_ENG_CALIB_FRAC_HAD",*cluster,*thisFE);
+      this->addMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_REST,"eflowRec_ENG_CALIB_FRAC_REST",*cluster,*thisFE);
+    }
   
   }//cluster loop
   return StatusCode::SUCCESS;
-- 
GitLab