From 75ef5a0b1a71ab4b1115a7dd2207edabdc6d346b Mon Sep 17 00:00:00 2001
From: Matthew Thomas Anthony <matthew.thomas.anthony@cern.ch>
Date: Tue, 17 Nov 2020 14:22:49 +0000
Subject: [PATCH] Added relevant class components for FE histogram filling.
 Compiles, but is not necessarily correct runtime at present

---
 .../PFlowValidation/PFODQA/CMakeLists.txt     |   2 +-
 .../PFODQA/src/LeptonCFEValidationPlots.cxx   |  31 +++++
 .../PFODQA/src/LeptonCFEValidationPlots.h     |  38 ++++++
 .../PFODQA/src/LeptonNFEValidationPlots.cxx   |  32 +++++
 .../PFODQA/src/LeptonNFEValidationPlots.h     |  39 ++++++
 .../PFlowValidation/PFODQA/src/PhysValFE.cxx  |  65 +++++++++-
 .../PFlowValidation/PFODQA/src/PhysValFE.h    |  23 ++++
 .../PFODQA/src/components/PFODQA_entries.cxx  |   1 -
 .../PFOHistUtils/LeptonFELinkerPlots.h        |  51 ++++++++
 .../PFOHistUtils/src/LeptonFELinkerPlots.cxx  | 118 ++++++++++++++++++
 10 files changed, 394 insertions(+), 6 deletions(-)
 create mode 100644 Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonCFEValidationPlots.cxx
 create mode 100644 Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonCFEValidationPlots.h
 create mode 100644 Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonNFEValidationPlots.cxx
 create mode 100644 Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonNFEValidationPlots.h
 create mode 100644 Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/LeptonFELinkerPlots.h
 create mode 100644 Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/LeptonFELinkerPlots.cxx

diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/CMakeLists.txt b/Reconstruction/PFlow/PFlowValidation/PFODQA/CMakeLists.txt
index c60af8ea994..a81d4070ac5 100644
--- a/Reconstruction/PFlow/PFlowValidation/PFODQA/CMakeLists.txt
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/CMakeLists.txt
@@ -7,4 +7,4 @@ atlas_subdir( PFODQA )
 atlas_add_component( PFODQA
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaMonitoringLib xAODCaloEvent xAODPFlow xAODTracking PFOHistUtils StoreGateLib TrkValHistUtils )
+                     LINK_LIBRARIES AthenaMonitoringLib xAODCaloEvent xAODPFlow xAODTracking PFOHistUtils StoreGateLib TrkValHistUtils xAODTau xAODEgamma xAODMuon )
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonCFEValidationPlots.cxx b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonCFEValidationPlots.cxx
new file mode 100644
index 00000000000..c92d21c74d5
--- /dev/null
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonCFEValidationPlots.cxx
@@ -0,0 +1,31 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "LeptonCFEValidationPlots.h"
+
+LeptonCFEValidationPlots::LeptonCFEValidationPlots(PlotBase* pParent, std::string sDir, std::string LeptonContainerName) : PlotBase(pParent, sDir),
+															   m_PhotonMatchedCFEPlots(this,"/Leptonlinks/",LeptonContainerName,false,22),
+															   m_ElectronMatchedCFEPlots(this,"/Leptonlinks/",LeptonContainerName,false,11),
+															   m_MuonMatchedCFEPlots(this,"/Leptonlinks/",LeptonContainerName,false,13),
+															   m_TauJetMatchedCFEPlots(this,"/Leptonlinks/",LeptonContainerName,false,17)
+{}
+
+void LeptonCFEValidationPlots::fill(const xAOD::Muon& muon){
+  //muon plots
+  m_MuonMatchedCFEPlots.fill(muon);
+}
+void LeptonCFEValidationPlots::fill(const xAOD::Electron& el){
+  //electron plots
+  m_ElectronMatchedCFEPlots.fill(el);
+}
+void LeptonCFEValidationPlots::fill(const xAOD::Photon& phot){
+  // photon plots
+  m_PhotonMatchedCFEPlots.fill(phot);
+}
+void LeptonCFEValidationPlots::fill(const xAOD::TauJet& tau){
+  // taujet plots
+  m_TauJetMatchedCFEPlots.fill(tau);
+}
+
+
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonCFEValidationPlots.h b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonCFEValidationPlots.h
new file mode 100644
index 00000000000..a523bbc20f9
--- /dev/null
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonCFEValidationPlots.h
@@ -0,0 +1,38 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef LEPTONCFEVALIDATIONPLOTS_H
+#define LEPTONCFEVALIDATIONPLOTS_H
+
+#include "TrkValHistUtils/PlotBase.h"
+
+
+
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/Photon.h"
+#include "xAODMuon/Muon.h"
+#include "xAODTau/TauJet.h"
+#include "PFOHistUtils/LeptonFELinkerPlots.h"
+
+class LeptonCFEValidationPlots : public PlotBase {
+
+ public:
+
+  /** Standard Constructor */
+  LeptonCFEValidationPlots(PlotBase* pParent,std::string sDir, std::string LeptonContainerName);
+
+  /** fill the histograms up */
+  void fill(const xAOD::Electron& el);
+  void fill(const xAOD::Muon& muon);
+  void fill(const xAOD::TauJet& tau);
+  void fill(const xAOD::Photon& phot);
+
+ private:
+  // Lepton plots of observables linked to FE
+  PFO::LeptonFELinkerPlots m_PhotonMatchedCFEPlots;
+  PFO::LeptonFELinkerPlots m_ElectronMatchedCFEPlots;
+  PFO::LeptonFELinkerPlots m_MuonMatchedCFEPlots;
+  PFO::LeptonFELinkerPlots m_TauJetMatchedCFEPlots;
+};
+#endif
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonNFEValidationPlots.cxx b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonNFEValidationPlots.cxx
new file mode 100644
index 00000000000..08c8f5a29aa
--- /dev/null
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonNFEValidationPlots.cxx
@@ -0,0 +1,32 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "LeptonNFEValidationPlots.h"
+
+LeptonNFEValidationPlots::LeptonNFEValidationPlots(PlotBase* pParent, const std::string& sDir, const std::string& LeptonContainerName) : PlotBase(pParent, sDir),
+														       m_PhotonMatchedNFEPlots(this,"/Leptonlinks/",LeptonContainerName,true,22),
+														       m_ElectronMatchedNFEPlots(this,"/Leptonlinks/",LeptonContainerName,true,11),
+														       m_MuonMatchedNFEPlots(this,"/Leptonlinks/",LeptonContainerName,true,13),
+														       m_TauJetMatchedNFEPlots(this,"/Leptonlinks/",LeptonContainerName,true,17)
+{}
+
+void LeptonNFEValidationPlots::fill(const xAOD::Photon& phot){
+  // photon plots
+  m_PhotonMatchedNFEPlots.fill(phot);
+}
+void LeptonNFEValidationPlots::fill(const xAOD::Electron& el){
+  //electron plots
+ m_ElectronMatchedNFEPlots.fill(el);
+}
+void LeptonNFEValidationPlots::fill(const xAOD::Muon& muon){
+  //muon plots
+   m_MuonMatchedNFEPlots.fill(muon);
+}
+
+void LeptonNFEValidationPlots::fill(const xAOD::TauJet& tau){
+  // taujet plots
+   m_TauJetMatchedNFEPlots.fill(tau);
+}
+
+
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonNFEValidationPlots.h b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonNFEValidationPlots.h
new file mode 100644
index 00000000000..ea61aa35c01
--- /dev/null
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/LeptonNFEValidationPlots.h
@@ -0,0 +1,39 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef LEPTONNFEVALIDATIONPLOTS_H
+#define LEPTONNFEVALIDATIONPLOTS_H
+
+#include "TrkValHistUtils/PlotBase.h"
+#include "PFOHistUtils/LeptonFELinkerPlots.h"
+
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/Photon.h"
+#include "xAODMuon/Muon.h"
+#include "xAODTau/TauJet.h"
+
+
+class LeptonNFEValidationPlots : public PlotBase {
+
+ public:
+
+  /** Standard Constructor */
+  LeptonNFEValidationPlots(PlotBase* pParent, const std::string& sDir, const std::string& LeptonContainerName);
+
+  /** fill the histograms up */
+  void fill(const xAOD::Electron& el);
+  void fill(const xAOD::Muon& muon);
+  void fill(const xAOD::TauJet& tau);
+  void fill(const xAOD::Photon& phot);
+
+ private:
+  // Lepton plots of observables linked to FE
+  PFO::LeptonFELinkerPlots m_PhotonMatchedNFEPlots;
+  PFO::LeptonFELinkerPlots m_ElectronMatchedNFEPlots;
+  PFO::LeptonFELinkerPlots m_MuonMatchedNFEPlots;
+  PFO::LeptonFELinkerPlots m_TauJetMatchedNFEPlots;
+
+  bool m_isNeutral=false;
+};
+#endif
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValFE.cxx b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValFE.cxx
index b0c9f4d2a36..872c706b1ef 100644
--- a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValFE.cxx
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValFE.cxx
@@ -21,6 +21,11 @@ StatusCode PhysValFE::initialize(){
   ATH_CHECK(m_vertexContainerReadHandleKey.initialize());
   ATH_CHECK(m_FEContainerHandleKey.initialize());
 
+  ATH_CHECK(m_MuonContainerHandleKey.initialize());
+  ATH_CHECK(m_ElectronContainerHandleKey.initialize());
+  ATH_CHECK(m_PhotonContainerHandleKey.initialize());
+  ATH_CHECK(m_TauJetContainerHandleKey.initialize());
+  
   return StatusCode::SUCCESS;
 }
 
@@ -30,19 +35,34 @@ StatusCode PhysValFE::bookHistograms(){
   std::string theName = "PFlow/FlowElement/"+m_FEContainerHandleKey.key();
   
   std::vector<HistData> hists;
+  std::vector<HistData> additional_hists;
   if (!m_useNeutralFE){
     m_FEChargedValidationPlots.reset(new PFOChargedValidationPlots(0,theName,"", theName));
     m_FEChargedValidationPlots->setDetailLevel(100);
     m_FEChargedValidationPlots->initialize();
     hists = m_FEChargedValidationPlots->retrieveBookedHistograms();
+    m_LeptonLinkerPlots_CFE.reset(new LeptonCFEValidationPlots(0,theName,theName));
+    m_LeptonLinkerPlots_CFE->setDetailLevel(100);
+    m_LeptonLinkerPlots_CFE->initialize();
+    m_LeptonLinkerPlots_CFE->retrieveBookedHistograms();
+    additional_hists=m_LeptonLinkerPlots_CFE->retrieveBookedHistograms();
   }
   else if (m_useNeutralFE){
     m_FENeutralValidationPlots.reset(new PFONeutralValidationPlots(0,theName, "",theName));
     m_FENeutralValidationPlots->setDetailLevel(100);
     m_FENeutralValidationPlots->initialize();
     hists = m_FENeutralValidationPlots->retrieveBookedHistograms();
+
+    m_LeptonLinkerPlots_NFE.reset(new LeptonNFEValidationPlots(0,theName,theName));
+    m_LeptonLinkerPlots_NFE->setDetailLevel(100);
+    m_LeptonLinkerPlots_NFE->initialize();
+    additional_hists=m_LeptonLinkerPlots_NFE->retrieveBookedHistograms();
   }
   
+  std::cout<<"#hists prior to insertion: "<< hists.size()<<", #additional hists: "<<additional_hists.size()<<", NFE? "<<m_useNeutralFE<<std::endl;  
+  hists.insert(hists.end(),additional_hists.begin(),additional_hists.end()); // append lepton-FE linker plots to collection of hists
+  std::cout<<"#hists after insertion: "<< hists.size()<<", NFE? "<<m_useNeutralFE<<std::endl;
+
   for (auto hist : hists) {
     ATH_CHECK(regHist(hist.first,hist.second,all));
   }
@@ -80,15 +100,12 @@ StatusCode PhysValFE::fillHistograms(){
      ATH_MSG_WARNING("Invalid ReadHandle for xAOD::FlowElementContainer with key: " << FEContainerReadHandle.key());
      return StatusCode::SUCCESS;
   }
-  bool readMatches=false;
+
 
   for (auto theFE : *FEContainerReadHandle){
     if(theFE){
        if (!m_useNeutralFE) m_FEChargedValidationPlots->fill(*theFE,theVertex);
        else if (m_useNeutralFE) m_FENeutralValidationPlots->fill(*theFE);
-       if(readMatches){
-	 std::cout<<"Element link reading functionality to be added"<<std::endl;
-       }
     }
     else ATH_MSG_WARNING("Invalid pointer to xAOD::FlowElement");
   }
@@ -98,7 +115,47 @@ StatusCode PhysValFE::fillHistograms(){
     ATH_MSG_WARNING("PFO readhandle is a dud");
     return StatusCode::SUCCESS;
   }
+
+  SG::ReadHandle<xAOD::MuonContainer> MuonContainerReadHandle(m_MuonContainerHandleKey);
+  if(!MuonContainerReadHandle.isValid()){
+    ATH_MSG_WARNING("Muon readhandle is a dud");
+  }
+  for (auto Muon: *MuonContainerReadHandle){
+    if(!m_useNeutralFE) m_LeptonLinkerPlots_CFE->fill(*Muon);
+    else m_LeptonLinkerPlots_NFE->fill(*Muon);
+  }
+  SG::ReadHandle<xAOD::ElectronContainer> ElectronContainerReadHandle(m_ElectronContainerHandleKey);
+  if(!ElectronContainerReadHandle.isValid()){
+    ATH_MSG_WARNING("Electron readhandle is a dud");
+  }
+
+  for (auto Electron: *ElectronContainerReadHandle){
+    if(!m_useNeutralFE) m_LeptonLinkerPlots_CFE->fill(*Electron);
+    else m_LeptonLinkerPlots_NFE->fill(*Electron);
+  }
+
+
+  SG::ReadHandle<xAOD::PhotonContainer> PhotonContainerReadHandle(m_PhotonContainerHandleKey);
+  if(!PhotonContainerReadHandle.isValid()){
+    ATH_MSG_WARNING("Photon readhandle is a dud");
+  }
+
+  for (auto Photon: *PhotonContainerReadHandle){
+    if(!m_useNeutralFE) m_LeptonLinkerPlots_CFE->fill(*Photon);
+    else m_LeptonLinkerPlots_NFE->fill(*Photon);
+  }
+
+  SG::ReadHandle<xAOD::TauJetContainer> TauJetContainerReadHandle(m_TauJetContainerHandleKey);
+  if(!TauJetContainerReadHandle.isValid()){
+    ATH_MSG_WARNING("TauJet readhandle is a dud");
+  }
+
+  for (auto Tau: *TauJetContainerReadHandle){
+    if(!m_useNeutralFE) m_LeptonLinkerPlots_CFE->fill(*Tau);
+    else m_LeptonLinkerPlots_NFE->fill(*Tau);
+  }
   
+
   return StatusCode::SUCCESS;
 
 }
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValFE.h b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValFE.h
index 046476493ce..479f68775f2 100644
--- a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValFE.h
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValFE.h
@@ -7,12 +7,18 @@
 
 #include "PFOChargedValidationPlots.h"
 #include "PFONeutralValidationPlots.h"
+#include "LeptonNFEValidationPlots.h"
+#include "LeptonCFEValidationPlots.h"
 #include "AthenaMonitoring/ManagedMonitorToolBase.h"
 #include <string>
 #include "xAODTracking/VertexContainer.h"
 #include "xAODPFlow/PFOContainer.h"
 #include "xAODPFlow/FlowElementContainer.h"
 #include "StoreGate/ReadHandleKey.h"
+#include "xAODMuon/MuonContainer.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODEgamma/PhotonContainer.h"
+#include "xAODTau/TauJetContainer.h"
 
 class PhysValFE : public ManagedMonitorToolBase {
 
@@ -42,11 +48,28 @@ public:
   /** ReadHandleKey to retrieve xAOD::PFOContainer */
   SG::ReadHandleKey<xAOD::PFOContainer> m_PFOContainerHandleKey{this,"PFOContainerName","JetETMissChargedParticleFlowObjects","ReadHandleKey for the PFO container"};
 
+  /** ReadHandleKey to retrieve MuonContainer */
+  SG::ReadHandleKey<xAOD::MuonContainer> m_MuonContainerHandleKey{this,"MuonContainerName","Muons","ReadHandleKey for the muon container"};
+
+  /** ReadHandleKey to retrieve ElectronContainer */
+  SG::ReadHandleKey<xAOD::ElectronContainer> m_ElectronContainerHandleKey{this,"ElectronContainerName","Electrons","ReadHandleKey for the electron container"};
+
+  /** ReadHandleKey to retrieve PhotonContainer */
+  SG::ReadHandleKey<xAOD::PhotonContainer> m_PhotonContainerHandleKey{this,"PhotonContainerName","Photons","ReadHandleKey for the photon container"};
+
+  /** ReadHandleKey to retrieve TauJetContainer */
+  SG::ReadHandleKey<xAOD::TauJetContainer> m_TauJetContainerHandleKey{this,"TauJetContainerName","TauJets","ReadHandleKey for the taujet container"};
+
+
   /** Pointer to class that deals with histograms for charged FE */
   std::unique_ptr<PFOChargedValidationPlots> m_FEChargedValidationPlots;
 
   /** Pointer to class that deals with histograms for neutral FE */
   std::unique_ptr<PFONeutralValidationPlots> m_FENeutralValidationPlots;
+
+  /** Pointer to class that deals with histograms for lepton links */
+  std::unique_ptr<LeptonCFEValidationPlots> m_LeptonLinkerPlots_CFE;
+  std::unique_ptr<LeptonNFEValidationPlots> m_LeptonLinkerPlots_NFE;
   
   /** Select whether to use neutral or charged FE */
   bool m_useNeutralFE;
diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/components/PFODQA_entries.cxx b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/components/PFODQA_entries.cxx
index d18f3461f6c..31c21dd697f 100644
--- a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/components/PFODQA_entries.cxx
+++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/components/PFODQA_entries.cxx
@@ -4,4 +4,3 @@
 DECLARE_COMPONENT( PhysValPFO )
 DECLARE_COMPONENT( PhysValFE )
 DECLARE_COMPONENT( PhysValCluster )
-
diff --git a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/LeptonFELinkerPlots.h b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/LeptonFELinkerPlots.h
new file mode 100644
index 00000000000..377158edff6
--- /dev/null
+++ b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/LeptonFELinkerPlots.h
@@ -0,0 +1,51 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef LEPTONFELINKERPLOTS_H
+#define LEPTONFELINKERPLOTS_H
+
+#include "TrkValHistUtils/PlotBase.h"
+#include "xAODPFlow/PFO.h"
+#include "xAODPFlow/FlowElement.h"
+#include "xAODEgamma/Electron.h"
+#include "xAODEgamma/Photon.h"
+#include "xAODMuon/Muon.h"
+#include "xAODTau/TauJet.h"
+
+namespace PFO {
+
+  class LeptonFELinkerPlots : public PlotBase {
+
+  public:
+
+    LeptonFELinkerPlots(PlotBase *pParent, std::string sDir, std::string LeptonContainerName, const bool& m_doNeutralFE, const int& m_LeptonID);
+    
+    void fill(const xAOD::Electron& el);
+    void fill(const xAOD::Muon& muon);
+    void fill(const xAOD::TauJet& tau);
+    void fill(const xAOD::Photon& phot);
+
+
+  private:
+     
+    TH1* m_electron_NMatchedCFE;
+    TH1* m_electron_NMatchedNFE;
+    
+    TH1* m_muon_NMatchedCFE;
+    TH1* m_muon_NMatchedNFE;
+    
+    TH1* m_tau_NMatchedCFE;
+    TH1* m_tau_NMatchedNFE;
+    
+    TH1* m_photon_NMatchedCFE;
+    TH1* m_photon_NMatchedNFE;
+    
+    void initializePlots();
+    std::string m_LeptonContainerName;
+    bool m_doNeutralFE;
+    int  m_LeptonID;
+  };
+
+}
+#endif
diff --git a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/LeptonFELinkerPlots.cxx b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/LeptonFELinkerPlots.cxx
new file mode 100644
index 00000000000..6cb42739746
--- /dev/null
+++ b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/LeptonFELinkerPlots.cxx
@@ -0,0 +1,118 @@
+/*
+  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "PFOHistUtils/LeptonFELinkerPlots.h"
+#include <iostream>
+#include "xAODPFlow/FlowElementContainer.h"
+#include "xAODMuon/MuonContainer.h"
+#include "xAODEgamma/ElectronContainer.h"
+#include "xAODEgamma/PhotonContainer.h"
+#include "xAODTau/TauJetContainer.h"
+#include "AthLinks/ElementLink.h"
+
+namespace PFO {
+  LeptonFELinkerPlots::LeptonFELinkerPlots(PlotBase* pParent, std::string sDir, std::string LeptonContainerName,const bool& doNeutralFE,const int& PID): 
+    PlotBase(pParent, sDir),
+    m_LeptonContainerName(LeptonContainerName),
+    m_doNeutralFE(doNeutralFE),
+    m_LeptonID(PID)
+    {
+      m_electron_NMatchedCFE=nullptr;
+      m_electron_NMatchedNFE=nullptr;
+
+      m_muon_NMatchedCFE=nullptr;
+      m_muon_NMatchedNFE=nullptr;
+
+      m_tau_NMatchedCFE=nullptr;
+      m_tau_NMatchedNFE=nullptr;
+
+      m_photon_NMatchedCFE=nullptr;
+      m_photon_NMatchedNFE=nullptr;
+    }
+
+  void LeptonFELinkerPlots::initializePlots(){
+    if(m_doNeutralFE)
+      {
+	if(m_LeptonID==11)
+	  m_electron_NMatchedNFE=Book1D("_electron_NMatchedNFE",m_LeptonContainerName+"_elecron_NMatchedNFE",20,0,20);
+	else if (m_LeptonID==13)
+	  m_muon_NMatchedNFE=Book1D("_muon_NMatchedNFE",m_LeptonContainerName+"_muon_NMatchedNFE",20,0,20);
+	else if (m_LeptonID==17)
+	  m_tau_NMatchedNFE=Book1D("_tau_NMatchedNFE",m_LeptonContainerName+"_tau_NMatchedNFE",20,0,20);
+	else 
+	  m_photon_NMatchedNFE=Book1D("_photon_NMatchedNFE",m_LeptonContainerName+"_photon_NMatchedNFE",20,0,20);
+      }
+    else{
+      if(m_LeptonID==11)
+	m_electron_NMatchedCFE=Book1D("_electron_NMatchedCFE",m_LeptonContainerName+"_elecron_NMatchedCFE",20,0,20);
+      else if (m_LeptonID==13)
+	m_muon_NMatchedCFE=Book1D("_muon_NMatchedCFE",m_LeptonContainerName+"_muon_NMatchedCFE",20,0,20);
+      else if(m_LeptonID==17)
+	m_tau_NMatchedCFE=Book1D("_tau_NMatchedCFE",m_LeptonContainerName+"_tau_NMatchedCFE",20,0,20);
+      else
+	m_photon_NMatchedCFE=Book1D("_photon_NMatchedCFE",m_LeptonContainerName+"_photon_NMatchedCFE",20,0,20);
+    };
+  }
+  
+  void LeptonFELinkerPlots::fill(const xAOD::Photon& phot){
+    int nMatched_FE=0;
+    SG::AuxElement::ConstAccessor<std::vector<ElementLink<xAOD::FlowElementContainer> > >acc_FE_phot_link_NFE("neutralFELinks");
+    SG::AuxElement::ConstAccessor<std::vector<ElementLink<xAOD::FlowElementContainer> > >acc_FE_phot_link_CFE("neutralFELinks");
+    if(acc_FE_phot_link_NFE.isAvailable(phot) and m_doNeutralFE){
+      nMatched_FE=(acc_FE_phot_link_NFE(phot)).size();
+      m_photon_NMatchedNFE->Fill(nMatched_FE);
+    }
+    else if (acc_FE_phot_link_CFE.isAvailable(phot) and !m_doNeutralFE){
+      nMatched_FE=(acc_FE_phot_link_CFE(phot)).size();
+      m_photon_NMatchedCFE->Fill(nMatched_FE);
+    }
+  }
+  void LeptonFELinkerPlots::fill(const xAOD::Electron& el){
+    int nMatched_FE=0;
+    SG::AuxElement::ConstAccessor<std::vector<ElementLink<xAOD::FlowElementContainer> > >acc_FE_el_link_NFE("neutralFELinks");
+    SG::AuxElement::ConstAccessor<std::vector<ElementLink<xAOD::FlowElementContainer> > >acc_FE_el_link_CFE("chargedFELinks");
+    
+    if(acc_FE_el_link_NFE.isAvailable(el) and m_doNeutralFE){
+      nMatched_FE=(acc_FE_el_link_NFE(el)).size();
+      m_electron_NMatchedNFE->Fill(nMatched_FE);
+    }
+    else if(acc_FE_el_link_CFE.isAvailable(el) and !m_doNeutralFE){
+      nMatched_FE=(acc_FE_el_link_CFE(el)).size();
+      m_electron_NMatchedCFE->Fill(nMatched_FE);
+    }
+  }
+ 
+  void LeptonFELinkerPlots::fill(const xAOD::Muon& mu){
+    int nMatched_FE=0;
+    SG::AuxElement::ConstAccessor<std::vector<ElementLink<xAOD::FlowElementContainer> > >acc_FE_mu_link_NFE("neutralFELinks");
+    SG::AuxElement::ConstAccessor<std::vector<ElementLink<xAOD::FlowElementContainer> > >acc_FE_mu_link_CFE("chargedFELinks");
+    if(acc_FE_mu_link_NFE.isAvailable(mu) and m_doNeutralFE){
+      nMatched_FE=(acc_FE_mu_link_NFE(mu)).size();
+      m_muon_NMatchedNFE->Fill(nMatched_FE);    
+    }
+    else if(acc_FE_mu_link_CFE.isAvailable(mu) and !m_doNeutralFE){
+      nMatched_FE=(acc_FE_mu_link_CFE(mu)).size();
+      m_muon_NMatchedCFE->Fill(nMatched_FE);    
+    }
+  }
+ 
+  void LeptonFELinkerPlots::fill(const xAOD::TauJet& tau){
+    int nMatched_FE=0;
+    SG::AuxElement::ConstAccessor<std::vector<ElementLink<xAOD::FlowElementContainer> > >acc_FE_tau_link_NFE("neutralFELinks");
+    SG::AuxElement::ConstAccessor<std::vector<ElementLink<xAOD::FlowElementContainer> > >acc_FE_tau_link_CFE("chargedFELinks");
+    if(acc_FE_tau_link_NFE.isAvailable(tau) and m_doNeutralFE){
+
+      nMatched_FE=(acc_FE_tau_link_NFE(tau)).size();
+      m_tau_NMatchedNFE->Fill(nMatched_FE);
+    }
+    else if(acc_FE_tau_link_NFE.isAvailable(tau) and !m_doNeutralFE){
+      nMatched_FE=(acc_FE_tau_link_CFE(tau)).size();
+      m_tau_NMatchedCFE->Fill(nMatched_FE);
+    }
+ 
+  }
+
+
+  
+} // end of PFO namespace
-- 
GitLab