From 509232b8436afd764d3692d04aebe63bb38d75e7 Mon Sep 17 00:00:00 2001 From: Pavol Strizenec <pavol.strizenec@cern.ch> Date: Sat, 27 Mar 2021 21:34:06 +0100 Subject: [PATCH] adding beamSpotWeight --- .../PFODQA/src/ClusterValidationPlots.cxx | 10 +- .../PFODQA/src/ClusterValidationPlots.h | 12 +- .../PFODQA/src/PhysValCluster.cxx | 46 +++---- .../PFODQA/src/PhysValCluster.h | 16 +-- .../PFOHistUtils/ClusterMomentPlots.h | 12 +- .../PFOHistUtils/PFOHistUtils/ClusterPlots.h | 13 +- .../PFOHistUtils/src/ClusterMomentPlots.cxx | 114 +++++++++--------- .../PFOHistUtils/src/ClusterPlots.cxx | 66 +++++----- 8 files changed, 146 insertions(+), 143 deletions(-) diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/ClusterValidationPlots.cxx b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/ClusterValidationPlots.cxx index 06a1f03382b3..3118b1205ceb 100644 --- a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/ClusterValidationPlots.cxx +++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/ClusterValidationPlots.cxx @@ -1,15 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "ClusterValidationPlots.h" -ClusterValidationPlots::ClusterValidationPlots(PlotBase* pParent, std::string sDir, std::string sClusterContainerName) : PlotBase(pParent, sDir),m_ClusterPlots(this,"PFO_JetETMiss/",sClusterContainerName),m_ClusterMomentPlots(this,"PFO_JetETMiss/",sClusterContainerName) +ClusterValidationPlots::ClusterValidationPlots(PlotBase* pParent, std::string sDir, SG::ReadHandleKey<xAOD::CaloClusterContainer>& sClusterContainerName) : PlotBase(pParent, sDir),m_ClusterPlots(this,"PFO_JetETMiss/",sClusterContainerName),m_ClusterMomentPlots(this,"PFO_JetETMiss/",sClusterContainerName) {} -void ClusterValidationPlots::fill(const xAOD::CaloCluster& theCluster){ - m_ClusterPlots.fill(theCluster); - m_ClusterMomentPlots.fill(theCluster); +void ClusterValidationPlots::fill(const xAOD::CaloCluster& theCluster, const xAOD::EventInfo& eventInfo){ + m_ClusterPlots.fill(theCluster, eventInfo); + m_ClusterMomentPlots.fill(theCluster, eventInfo); } diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/ClusterValidationPlots.h b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/ClusterValidationPlots.h index d062bfe8ce27..835490066250 100644 --- a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/ClusterValidationPlots.h +++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/ClusterValidationPlots.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef CLUSTERVALIDATIONPLOTS_H @@ -8,17 +8,21 @@ #include "TrkValHistUtils/PlotBase.h" #include "PFOHistUtils/ClusterPlots.h" #include "PFOHistUtils/ClusterMomentPlots.h" -#include "xAODCaloEvent/CaloCluster.h" +#include "xAODEventInfo/EventInfo.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODCaloEvent/CaloClusterContainer.h" + + class ClusterValidationPlots : public PlotBase { public: /** Standard Constructor */ - ClusterValidationPlots(PlotBase* pParent, std::string sDir, std::string sClusterContainerName); + ClusterValidationPlots(PlotBase* pParent, std::string sDir, SG::ReadHandleKey<xAOD::CaloClusterContainer>& sClusterContainerName); /** fill the histograms up */ - void fill(const xAOD::CaloCluster& theCluster); + void fill(const xAOD::CaloCluster& theCluster, const xAOD::EventInfo& eventInfo); private: /** 4-vector histograms */ diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValCluster.cxx b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValCluster.cxx index 78e8af556d0b..38d77b508a10 100644 --- a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValCluster.cxx +++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValCluster.cxx @@ -1,27 +1,27 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "PhysValCluster.h" #include "xAODCaloEvent/CaloClusterContainer.h" +#include "xAODEventInfo/EventInfo.h" +#include "GaudiKernel/EventContext.h" PhysValCluster::PhysValCluster (const std::string& type, const std::string& name, const IInterface* parent ) : ManagedMonitorToolBase( type, name, parent ) { - declareProperty( "ClusterContainerName", m_clusterContainerName=""); } -PhysValCluster::~PhysValCluster() {} - StatusCode PhysValCluster::initialize(){ - ATH_CHECK(ManagedMonitorToolBase::initialize()); - return StatusCode::SUCCESS; + ATH_CHECK(m_clusterContainerName.initialize()); + ATH_CHECK(m_eventInfoName.initialize()); + return ManagedMonitorToolBase::initialize(); } StatusCode PhysValCluster::bookHistograms(){ - std::string theName = "TopoClusters/TopoClusters_JetETMiss/JetETMiss_"+m_clusterContainerName; + std::string theName = "TopoClusters/TopoClusters_JetETMiss/JetETMiss_"+m_clusterContainerName.key(); - m_clusterValidationPlots.reset(new ClusterValidationPlots(0,theName, theName)); + m_clusterValidationPlots.reset(new ClusterValidationPlots(0,theName, m_clusterContainerName)); m_clusterValidationPlots->setDetailLevel(100); m_clusterValidationPlots->initialize(); std::vector<HistData> hists = m_clusterValidationPlots->retrieveBookedHistograms(); @@ -36,30 +36,22 @@ StatusCode PhysValCluster::bookHistograms(){ StatusCode PhysValCluster::fillHistograms(){ - const xAOD::CaloClusterContainer* theClusterContainer = NULL; - - if( evtStore()->contains<xAOD::CaloClusterContainer>(m_clusterContainerName)){ - - ATH_CHECK( evtStore()->retrieve(theClusterContainer,m_clusterContainerName) ); + const EventContext& ctx = Gaudi::Hive::currentContext(); + SG::ReadHandle<xAOD::EventInfo> evInfoHdl{m_eventInfoName, ctx}; + if(!evInfoHdl.isValid()){ + ATH_MSG_ERROR("Do not have EventInfo with key " << m_eventInfoName.key()); + return StatusCode::FAILURE; + } - if (!theClusterContainer){ - ATH_MSG_WARNING(" Have NULL pointer to xAOD::CaloClusterContainer "); - return StatusCode::FAILURE; - } - - xAOD::CaloClusterContainer::const_iterator firstCluster = theClusterContainer->begin(); - xAOD::CaloClusterContainer::const_iterator lastCluster = theClusterContainer->end(); + SG::ReadHandle<xAOD::CaloClusterContainer> clusHdl{m_clusterContainerName, ctx}; - for (; firstCluster != lastCluster; ++firstCluster) { - const xAOD::CaloCluster* theCluster = *firstCluster; - m_clusterValidationPlots->fill(*theCluster); + if(clusHdl.isValid()){ + for(auto cluster: *clusHdl) { + m_clusterValidationPlots->fill(*cluster,*evInfoHdl); } } - else ATH_MSG_WARNING(" Cluster container : " << m_clusterContainerName << " not found"); + else ATH_MSG_WARNING(" Cluster container : " << m_clusterContainerName.key() << " not found"); return StatusCode::SUCCESS; } -StatusCode PhysValCluster::procHistograms(){ - return StatusCode::SUCCESS; -} diff --git a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValCluster.h b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValCluster.h index 81819f4343db..87b3890cb774 100644 --- a/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValCluster.h +++ b/Reconstruction/PFlow/PFlowValidation/PFODQA/src/PhysValCluster.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef PHYSVALCLUSTER_H @@ -7,7 +7,10 @@ #include "ClusterValidationPlots.h" #include "AthenaMonitoring/ManagedMonitorToolBase.h" -#include <string> +#include "StoreGate/ReadHandle.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODEventInfo/EventInfo.h" +#include "xAODCaloEvent/CaloClusterContainer.h" class PhysValCluster : public ManagedMonitorToolBase { @@ -16,19 +19,18 @@ class PhysValCluster : public ManagedMonitorToolBase { /** Standard Constructor */ PhysValCluster (const std::string& type, const std::string& name, const IInterface* parent ); - /** Standard Destructor */ - virtual ~PhysValCluster(); - /** Standard AlgTool Functions */ virtual StatusCode initialize(); virtual StatusCode bookHistograms(); virtual StatusCode fillHistograms(); - virtual StatusCode procHistograms(); private: /** String that defines with Cluster container to use */ - std::string m_clusterContainerName; + SG::ReadHandleKey<xAOD::CaloClusterContainer> m_clusterContainerName{this, "ClusterContainerName", "", "Validated cluster container key"}; + /** Event info key */ + SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoName{this, "EventInfoName", "EventInfo", "Key for event info"}; + /** Pointer to class that defines which histogram blocks to fill */ std::unique_ptr<ClusterValidationPlots> m_clusterValidationPlots; diff --git a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/ClusterMomentPlots.h b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/ClusterMomentPlots.h index 4c559bf56e2f..e92ca40348a5 100644 --- a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/ClusterMomentPlots.h +++ b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/ClusterMomentPlots.h @@ -1,12 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef CLUSTERMOMENTPLOTS_H #define CLUSTERMOMENTPLOTS_H #include "TrkValHistUtils/PlotBase.h" -#include "xAODCaloEvent/CaloCluster.h" +#include "xAODEventInfo/EventInfo.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODCaloEvent/CaloClusterContainer.h" namespace PFO { @@ -14,9 +16,9 @@ namespace PFO { public: - ClusterMomentPlots(PlotBase *pParent, std::string sDir, std::string sClusterContainerName); + ClusterMomentPlots(PlotBase *pParent, std::string sDir, SG::ReadHandleKey<xAOD::CaloClusterContainer>& sClusterContainerName); - void fill(const xAOD::CaloCluster& cluster); + void fill(const xAOD::CaloCluster& cluster, const xAOD::EventInfo& eventInfo); private: @@ -40,7 +42,7 @@ namespace PFO { TH1* m_EM_PROBABILITY; void initializePlots(); - std::string m_sClusterContainerName; + SG::ReadHandleKey<xAOD::CaloClusterContainer> m_sClusterContainerName; }; diff --git a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/ClusterPlots.h b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/ClusterPlots.h index d027299d7ae5..07ad1032c17d 100644 --- a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/ClusterPlots.h +++ b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/PFOHistUtils/ClusterPlots.h @@ -1,12 +1,15 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef CLUSTERPLOTS_H #define CLUSTERPLOTS_H #include "TrkValHistUtils/PlotBase.h" -#include "xAODCaloEvent/CaloCluster.h" +#include "xAODEventInfo/EventInfo.h" +#include "StoreGate/ReadHandleKey.h" +#include "xAODCaloEvent/CaloClusterContainer.h" + namespace PFO { @@ -14,9 +17,9 @@ namespace PFO { public: - ClusterPlots(PlotBase *pParent, std::string sDir, std::string sClusterContainerName); + ClusterPlots(PlotBase *pParent, std::string sDir, SG::ReadHandleKey<xAOD::CaloClusterContainer>& sClusterContainerName); - void fill(const xAOD::CaloCluster& Cluster); + void fill(const xAOD::CaloCluster& Cluster, const xAOD::EventInfo& eventInfo); private: TH1* m_Cluster_pt; @@ -40,7 +43,7 @@ namespace PFO { TH1* m_Cluster_eSample_HAD; void initializePlots(); - std::string m_sClusterContainerName; + SG::ReadHandleKey<xAOD::CaloClusterContainer> m_sClusterContainerName; }; diff --git a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/ClusterMomentPlots.cxx b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/ClusterMomentPlots.cxx index a50dd2be866e..7c014102fadc 100644 --- a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/ClusterMomentPlots.cxx +++ b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/ClusterMomentPlots.cxx @@ -1,12 +1,12 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "PFOHistUtils/ClusterMomentPlots.h" namespace PFO { - ClusterMomentPlots::ClusterMomentPlots(PlotBase* pParent, std::string sDir, std::string sClusterContainerName) : PlotBase(pParent, sDir), m_sClusterContainerName(sClusterContainerName){ + ClusterMomentPlots::ClusterMomentPlots(PlotBase* pParent, std::string sDir, SG::ReadHandleKey<xAOD::CaloClusterContainer>& sClusterContainerName) : PlotBase(pParent, sDir), m_sClusterContainerName(sClusterContainerName){ m_LATERAL = nullptr; m_LONGITUDINAL = nullptr; m_SECOND_R = nullptr; @@ -30,118 +30,118 @@ namespace PFO { void ClusterMomentPlots::initializePlots(){ - m_LATERAL = Book1D("PFO_LATERAL",m_sClusterContainerName + "_LATERAL",60,-1.0,2.0); - m_LONGITUDINAL = Book1D("PFO_LONGITUDINAL",m_sClusterContainerName + "_LONGITUDINAL",60,-1.0,2.0); - m_SECOND_R = Book1D("PFO_SECOND_R",m_sClusterContainerName + "_SECOND_R",60,-1.0,50.0); - m_CENTER_LAMBDA = Book1D("PFO_CENTER_LAMBDA",m_sClusterContainerName + "_CENTER_LAMBDA",60,-1.0,3000.0); - m_FIRST_ENG_DENS = Book1D("PFO_FIRST_ENG_DENS",m_sClusterContainerName + "_FIRST_ENG_DENS",60,-1.0,2.0); - m_ENG_FRAC_MAX = Book1D("PFO_ENG_FRAC_MAX",m_sClusterContainerName + "_ENG_FRAC_MAX",60,-1.0,2.0); - m_ISOLATION = Book1D("PFO_ISOLATION",m_sClusterContainerName + "_ISOLATION",60,-1.0,2.0); - m_ENG_BAD_CELLS = Book1D("PFO_ENG_BAD_CELLS",m_sClusterContainerName + "_ENG_BAD_CELLS",120,-1.0,100.0); - m_N_BAD_CELLS = Book1D("PFO_N_BAD_CELLS",m_sClusterContainerName + "_N_BAD_CELLS",120,-1.0,20.0); - m_BADLARQ_FRAC = Book1D("PFO_BADLARQ_FRAC",m_sClusterContainerName + "_BADLARQ_FRAC",140,-3.0,5.0); - m_ENG_POS = Book1D("PFO_ENG_POS",m_sClusterContainerName + "_ENG_POS",60,-100.0,10000.0); - m_SIGNIFICANCE = Book1D("PFO_SIGNIFICANCE",m_sClusterContainerName + "_SIGNIFICANCE",300,-20.0,20.0); - m_AVG_LAR_Q = Book1D("PFO_AVG_LAR_Q",m_sClusterContainerName + "_AVG_LAR_Q",240,-1.0,200.0); - m_AVG_TILE_Q = Book1D("PFO_AVG_TILE_Q",m_sClusterContainerName + "_AVG_TILE_Q",240,-1.0,200.0); - m_CELL_SIG_SAMPLING = Book1D("PFO_CELL_SIG_SAMPLING",m_sClusterContainerName + "_CELL_SIG_SAMPLING",31,-1.0,30); - m_ENG_BAD_HV_CELLS = Book1D("PFO_ENG_BAD_HV_CELLS",m_sClusterContainerName + "_ENG_BAD_HV_CELLS",500,-5000.0,20000.0); - m_N_BAD_HV_CELLS = Book1D("PFO_N_BAD_HV_CELLS",m_sClusterContainerName + "_N_BAD_HV_CELLS",50,-1.0,100.0); - m_EM_PROBABILITY = Book1D("PFO_EM_PROBABILITY",m_sClusterContainerName + "_EM_PROBABILITY",50,-0.05,1.05); + m_LATERAL = Book1D("PFO_LATERAL",m_sClusterContainerName.key() + "_LATERAL",60,-1.0,2.0); + m_LONGITUDINAL = Book1D("PFO_LONGITUDINAL",m_sClusterContainerName.key() + "_LONGITUDINAL",60,-1.0,2.0); + m_SECOND_R = Book1D("PFO_SECOND_R",m_sClusterContainerName.key() + "_SECOND_R",60,-1.0,50.0); + m_CENTER_LAMBDA = Book1D("PFO_CENTER_LAMBDA",m_sClusterContainerName.key() + "_CENTER_LAMBDA",60,-1.0,3000.0); + m_FIRST_ENG_DENS = Book1D("PFO_FIRST_ENG_DENS",m_sClusterContainerName.key() + "_FIRST_ENG_DENS",60,-1.0,2.0); + m_ENG_FRAC_MAX = Book1D("PFO_ENG_FRAC_MAX",m_sClusterContainerName.key() + "_ENG_FRAC_MAX",60,-1.0,2.0); + m_ISOLATION = Book1D("PFO_ISOLATION",m_sClusterContainerName.key() + "_ISOLATION",60,-1.0,2.0); + m_ENG_BAD_CELLS = Book1D("PFO_ENG_BAD_CELLS",m_sClusterContainerName.key() + "_ENG_BAD_CELLS",120,-1.0,100.0); + m_N_BAD_CELLS = Book1D("PFO_N_BAD_CELLS",m_sClusterContainerName.key() + "_N_BAD_CELLS",120,-1.0,20.0); + m_BADLARQ_FRAC = Book1D("PFO_BADLARQ_FRAC",m_sClusterContainerName.key() + "_BADLARQ_FRAC",140,-3.0,5.0); + m_ENG_POS = Book1D("PFO_ENG_POS",m_sClusterContainerName.key() + "_ENG_POS",60,-100.0,10000.0); + m_SIGNIFICANCE = Book1D("PFO_SIGNIFICANCE",m_sClusterContainerName.key() + "_SIGNIFICANCE",300,-20.0,20.0); + m_AVG_LAR_Q = Book1D("PFO_AVG_LAR_Q",m_sClusterContainerName.key() + "_AVG_LAR_Q",240,-1.0,200.0); + m_AVG_TILE_Q = Book1D("PFO_AVG_TILE_Q",m_sClusterContainerName.key() + "_AVG_TILE_Q",240,-1.0,200.0); + m_CELL_SIG_SAMPLING = Book1D("PFO_CELL_SIG_SAMPLING",m_sClusterContainerName.key() + "_CELL_SIG_SAMPLING",31,-1.0,30); + m_ENG_BAD_HV_CELLS = Book1D("PFO_ENG_BAD_HV_CELLS",m_sClusterContainerName.key() + "_ENG_BAD_HV_CELLS",500,-5000.0,20000.0); + m_N_BAD_HV_CELLS = Book1D("PFO_N_BAD_HV_CELLS",m_sClusterContainerName.key() + "_N_BAD_HV_CELLS",50,-1.0,100.0); + m_EM_PROBABILITY = Book1D("PFO_EM_PROBABILITY",m_sClusterContainerName.key() + "_EM_PROBABILITY",50,-0.05,1.05); } - void ClusterMomentPlots::fill(const xAOD::CaloCluster& cluster){ + void ClusterMomentPlots::fill(const xAOD::CaloCluster& cluster, const xAOD::EventInfo& eventInfo){ double moment_LATERAL = 0.0; bool gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::LATERAL,moment_LATERAL); - if (true == gotMoment) m_LATERAL->Fill(moment_LATERAL); - else m_LATERAL->Fill(-1.0); + if (true == gotMoment) m_LATERAL->Fill(moment_LATERAL,eventInfo.beamSpotWeight()); + else m_LATERAL->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_LONGITUDINAL = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::LONGITUDINAL,moment_LONGITUDINAL); - if (true == gotMoment) m_LONGITUDINAL->Fill(moment_LONGITUDINAL); - else m_LONGITUDINAL->Fill(-1.0); + if (true == gotMoment) m_LONGITUDINAL->Fill(moment_LONGITUDINAL,eventInfo.beamSpotWeight()); + else m_LONGITUDINAL->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_SECOND_R = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::SECOND_R,moment_SECOND_R); - if (true == gotMoment) m_SECOND_R->Fill(moment_SECOND_R); - else m_SECOND_R->Fill(-1.0); + if (true == gotMoment) m_SECOND_R->Fill(moment_SECOND_R,eventInfo.beamSpotWeight()); + else m_SECOND_R->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_CENTER_LAMBDA = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::CENTER_LAMBDA,moment_CENTER_LAMBDA); - if (true == gotMoment) m_CENTER_LAMBDA->Fill(moment_CENTER_LAMBDA); - else m_CENTER_LAMBDA->Fill(-1.0); + if (true == gotMoment) m_CENTER_LAMBDA->Fill(moment_CENTER_LAMBDA,eventInfo.beamSpotWeight()); + else m_CENTER_LAMBDA->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_FIRST_ENG_DENS = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::FIRST_ENG_DENS,moment_FIRST_ENG_DENS); - if (true == gotMoment) m_FIRST_ENG_DENS->Fill(moment_FIRST_ENG_DENS); - else m_FIRST_ENG_DENS->Fill(-1.0); + if (true == gotMoment) m_FIRST_ENG_DENS->Fill(moment_FIRST_ENG_DENS,eventInfo.beamSpotWeight()); + else m_FIRST_ENG_DENS->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_ENG_FRAC_MAX = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::ENG_FRAC_MAX,moment_ENG_FRAC_MAX); - if (true == gotMoment) m_ENG_FRAC_MAX->Fill(moment_ENG_FRAC_MAX); - else m_ENG_FRAC_MAX->Fill(-1.0); + if (true == gotMoment) m_ENG_FRAC_MAX->Fill(moment_ENG_FRAC_MAX,eventInfo.beamSpotWeight()); + else m_ENG_FRAC_MAX->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_ISOLATION = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::ISOLATION,moment_ISOLATION); - if (true == gotMoment) m_ISOLATION->Fill(moment_ISOLATION); - else m_ISOLATION->Fill(-1.0); + if (true == gotMoment) m_ISOLATION->Fill(moment_ISOLATION,eventInfo.beamSpotWeight()); + else m_ISOLATION->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_ENG_BAD_CELLS = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::ENG_BAD_CELLS,moment_ENG_BAD_CELLS); - if (true == gotMoment) m_ENG_BAD_CELLS->Fill(moment_ENG_BAD_CELLS); - else m_ENG_BAD_CELLS->Fill(-1.0); + if (true == gotMoment) m_ENG_BAD_CELLS->Fill(moment_ENG_BAD_CELLS,eventInfo.beamSpotWeight()); + else m_ENG_BAD_CELLS->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_N_BAD_CELLS = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::N_BAD_CELLS,moment_N_BAD_CELLS); - if (true == gotMoment) m_N_BAD_CELLS->Fill(moment_N_BAD_CELLS); - else m_N_BAD_CELLS->Fill(-1.0); + if (true == gotMoment) m_N_BAD_CELLS->Fill(moment_N_BAD_CELLS,eventInfo.beamSpotWeight()); + else m_N_BAD_CELLS->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_BADLARQ_FRAC = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::BADLARQ_FRAC,moment_BADLARQ_FRAC); - if (true == gotMoment) m_BADLARQ_FRAC->Fill(moment_BADLARQ_FRAC); - else m_BADLARQ_FRAC->Fill(-1.0); + if (true == gotMoment) m_BADLARQ_FRAC->Fill(moment_BADLARQ_FRAC,eventInfo.beamSpotWeight()); + else m_BADLARQ_FRAC->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_ENG_POS = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::ENG_POS,moment_ENG_POS); - if (true == gotMoment) m_ENG_POS->Fill(moment_ENG_POS); - else m_ENG_POS->Fill(-1.0); + if (true == gotMoment) m_ENG_POS->Fill(moment_ENG_POS,eventInfo.beamSpotWeight()); + else m_ENG_POS->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_SIGNIFICANCE = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::SIGNIFICANCE,moment_SIGNIFICANCE); - if (true == gotMoment) m_SIGNIFICANCE->Fill(moment_SIGNIFICANCE); - else m_SIGNIFICANCE->Fill(-1.0); + if (true == gotMoment) m_SIGNIFICANCE->Fill(moment_SIGNIFICANCE,eventInfo.beamSpotWeight()); + else m_SIGNIFICANCE->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_AVG_LAR_Q = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::AVG_LAR_Q,moment_AVG_LAR_Q); - if (true == gotMoment) m_AVG_LAR_Q->Fill(moment_AVG_LAR_Q); - else m_AVG_LAR_Q->Fill(-1.0); + if (true == gotMoment) m_AVG_LAR_Q->Fill(moment_AVG_LAR_Q,eventInfo.beamSpotWeight()); + else m_AVG_LAR_Q->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_AVG_TILE_Q = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::AVG_TILE_Q,moment_AVG_TILE_Q); - if (true == gotMoment) m_AVG_TILE_Q->Fill(moment_AVG_TILE_Q); - else m_AVG_TILE_Q->Fill(-1.0); + if (true == gotMoment) m_AVG_TILE_Q->Fill(moment_AVG_TILE_Q,eventInfo.beamSpotWeight()); + else m_AVG_TILE_Q->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_CELL_SIG_SAMPLING = 0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::CELL_SIG_SAMPLING,moment_CELL_SIG_SAMPLING); - if (true == gotMoment) m_CELL_SIG_SAMPLING->Fill(moment_CELL_SIG_SAMPLING); - else m_CELL_SIG_SAMPLING->Fill(-1.0); + if (true == gotMoment) m_CELL_SIG_SAMPLING->Fill(moment_CELL_SIG_SAMPLING,eventInfo.beamSpotWeight()); + else m_CELL_SIG_SAMPLING->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_ENG_BAD_HV_CELLS = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::ENG_BAD_HV_CELLS,moment_ENG_BAD_HV_CELLS); - if (true == gotMoment) m_ENG_BAD_HV_CELLS->Fill(moment_ENG_BAD_HV_CELLS); - else m_ENG_BAD_HV_CELLS->Fill(-1.0); + if (true == gotMoment) m_ENG_BAD_HV_CELLS->Fill(moment_ENG_BAD_HV_CELLS,eventInfo.beamSpotWeight()); + else m_ENG_BAD_HV_CELLS->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_N_BAD_HV_CELLS = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::N_BAD_HV_CELLS,moment_N_BAD_HV_CELLS); - if (true == gotMoment) m_N_BAD_HV_CELLS->Fill(moment_N_BAD_HV_CELLS); - else m_N_BAD_HV_CELLS->Fill(-1.0); + if (true == gotMoment) m_N_BAD_HV_CELLS->Fill(moment_N_BAD_HV_CELLS,eventInfo.beamSpotWeight()); + else m_N_BAD_HV_CELLS->Fill(-1.0,eventInfo.beamSpotWeight()); double moment_EM_PROBABILITY = 0.0; gotMoment = cluster.retrieveMoment(xAOD::CaloCluster::EM_PROBABILITY,moment_EM_PROBABILITY); - if (true == gotMoment) m_EM_PROBABILITY->Fill(moment_EM_PROBABILITY); - else m_EM_PROBABILITY->Fill(-1.0); + if (true == gotMoment) m_EM_PROBABILITY->Fill(moment_EM_PROBABILITY,eventInfo.beamSpotWeight()); + else m_EM_PROBABILITY->Fill(-1.0,eventInfo.beamSpotWeight()); } diff --git a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/ClusterPlots.cxx b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/ClusterPlots.cxx index b6f5202340d5..a5de072cb644 100644 --- a/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/ClusterPlots.cxx +++ b/Reconstruction/PFlow/PFlowValidation/PFOHistUtils/src/ClusterPlots.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "PFOHistUtils/ClusterPlots.h" @@ -7,61 +7,61 @@ namespace PFO { - ClusterPlots::ClusterPlots(PlotBase* pParent, std::string sDir, std::string sClusterContainerName) : PlotBase(pParent, sDir), m_sClusterContainerName(sClusterContainerName){} + ClusterPlots::ClusterPlots(PlotBase* pParent, std::string sDir, SG::ReadHandleKey<xAOD::CaloClusterContainer>& sClusterContainerName) : PlotBase(pParent, sDir), m_sClusterContainerName(sClusterContainerName){} void ClusterPlots::initializePlots(){ - m_Cluster_pt = Book1D("Cluster_Pt",m_sClusterContainerName + "_Pt (Entries/1 GeV)",300,-100.0,200.0); - m_Cluster_eta = Book1D("Cluster_Eta",m_sClusterContainerName + "_Eta (Entries/0.1)",100,-5.0,5.0); - m_Cluster_phi = Book1D("Cluster_Phi",m_sClusterContainerName + "_Phi (Entries/0.1)",64,-3.2,3.2); - m_Cluster_m = Book1D("Cluster_m",m_sClusterContainerName + "_m (Entries/100 MeV)",100,0.0,10.0); + m_Cluster_pt = Book1D("Cluster_Pt",m_sClusterContainerName.key() + "_Pt (Entries/1 GeV)",300,-100.0,200.0); + m_Cluster_eta = Book1D("Cluster_Eta",m_sClusterContainerName.key() + "_Eta (Entries/0.1)",100,-5.0,5.0); + m_Cluster_phi = Book1D("Cluster_Phi",m_sClusterContainerName.key() + "_Phi (Entries/0.1)",64,-3.2,3.2); + m_Cluster_m = Book1D("Cluster_m",m_sClusterContainerName.key() + "_m (Entries/100 MeV)",100,0.0,10.0); - m_Cluster_ptEM = Book1D("Cluster_PtEM",m_sClusterContainerName + "_PtEM (Entries/1 GeV)",300,-100.0,200.0); - m_Cluster_etaEM = Book1D("Cluster_EtaEM",m_sClusterContainerName + "_EtaEM (Entries/0.1)",100,-5.0,5.0); - m_Cluster_phiEM = Book1D("Cluster_PhiEM",m_sClusterContainerName + "_PhiEM (Entries/0.1)",64,-3.2,3.2); - m_Cluster_mEM = Book1D("Cluster_mEM",m_sClusterContainerName + "_mEM (Entries/100 MeV)",100,0.0,10.0); + m_Cluster_ptEM = Book1D("Cluster_PtEM",m_sClusterContainerName.key() + "_PtEM (Entries/1 GeV)",300,-100.0,200.0); + m_Cluster_etaEM = Book1D("Cluster_EtaEM",m_sClusterContainerName.key() + "_EtaEM (Entries/0.1)",100,-5.0,5.0); + m_Cluster_phiEM = Book1D("Cluster_PhiEM",m_sClusterContainerName.key() + "_PhiEM (Entries/0.1)",64,-3.2,3.2); + m_Cluster_mEM = Book1D("Cluster_mEM",m_sClusterContainerName.key() + "_mEM (Entries/100 MeV)",100,0.0,10.0); - m_Cluster_time = Book1D("Cluster_time",m_sClusterContainerName + "_time (Entries)",30,-200.0,100.0); - m_Cluster_clusterSize = Book1D("Cluster_clusterSize",m_sClusterContainerName + "_clusterSize (Entries)",20,0.0,20.0); + m_Cluster_time = Book1D("Cluster_time",m_sClusterContainerName.key() + "_time (Entries)",30,-200.0,100.0); + m_Cluster_clusterSize = Book1D("Cluster_clusterSize",m_sClusterContainerName.key() + "_clusterSize (Entries)",20,0.0,20.0); - m_Cluster_eta_lowpt = Book1D("Cluster_Eta_lowPt",m_sClusterContainerName + "_Eta_lowPt (Entries/0.1)",100,-5.0,5.0); - m_Cluster_pt_interval = Book1D("Cluster_Pt_interval",m_sClusterContainerName + "_Pt_interval (Entries/1 GeV)", 980, 20.0, 1000.0); - m_Cluster_pt_zoom = Book1D("Cluster_Pt_zoom",m_sClusterContainerName + "_Pt_zomm (Entries/0.1 GeV)",3000,-100.0,200.0); + m_Cluster_eta_lowpt = Book1D("Cluster_Eta_lowPt",m_sClusterContainerName.key() + "_Eta_lowPt (Entries/0.1)",100,-5.0,5.0); + m_Cluster_pt_interval = Book1D("Cluster_Pt_interval",m_sClusterContainerName.key() + "_Pt_interval (Entries/1 GeV)", 980, 20.0, 1000.0); + m_Cluster_pt_zoom = Book1D("Cluster_Pt_zoom",m_sClusterContainerName.key() + "_Pt_zomm (Entries/0.1 GeV)",3000,-100.0,200.0); - m_Cluster_eSample_EM = Book1D("Cluster_eSample_EM",m_sClusterContainerName +"_eSample_EM (Entries/1 GeV) ",300,-100.0,200.0); - m_Cluster_eSample_HAD = Book1D("Cluster_eSample_HAD",m_sClusterContainerName +"_eSample_HAD (Entries/1 GeV) ",300,-100.0,200.0); + m_Cluster_eSample_EM = Book1D("Cluster_eSample_EM",m_sClusterContainerName.key() +"_eSample_EM (Entries/1 GeV) ",300,-100.0,200.0); + m_Cluster_eSample_HAD = Book1D("Cluster_eSample_HAD",m_sClusterContainerName.key() +"_eSample_HAD (Entries/1 GeV) ",300,-100.0,200.0); } - void ClusterPlots::fill(const xAOD::CaloCluster& Cluster){ - m_Cluster_pt->Fill(Cluster.pt()/1000.0); - m_Cluster_eta->Fill(Cluster.eta()); - m_Cluster_phi->Fill(Cluster.phi()); - m_Cluster_m->Fill(Cluster.m()/1000.0); + void ClusterPlots::fill(const xAOD::CaloCluster& Cluster, const xAOD::EventInfo& eventInfo){ + m_Cluster_pt->Fill(Cluster.pt()/1000.0,eventInfo.beamSpotWeight()); + m_Cluster_eta->Fill(Cluster.eta(),eventInfo.beamSpotWeight()); + m_Cluster_phi->Fill(Cluster.phi(),eventInfo.beamSpotWeight()); + m_Cluster_m->Fill(Cluster.m()/1000.0,eventInfo.beamSpotWeight()); - m_Cluster_ptEM->Fill((Cluster.rawE()/cosh(Cluster.rawEta()))/1000.0); - m_Cluster_etaEM->Fill(Cluster.rawEta()); - m_Cluster_phiEM->Fill(Cluster.rawPhi()); - m_Cluster_mEM->Fill(Cluster.rawM()/1000.0); + m_Cluster_ptEM->Fill((Cluster.rawE()/cosh(Cluster.rawEta()))/1000.0,eventInfo.beamSpotWeight()); + m_Cluster_etaEM->Fill(Cluster.rawEta(),eventInfo.beamSpotWeight()); + m_Cluster_phiEM->Fill(Cluster.rawPhi(),eventInfo.beamSpotWeight()); + m_Cluster_mEM->Fill(Cluster.rawM()/1000.0,eventInfo.beamSpotWeight()); - m_Cluster_time->Fill(Cluster.time()); - m_Cluster_clusterSize->Fill(Cluster.clusterSize()); + m_Cluster_time->Fill(Cluster.time(),eventInfo.beamSpotWeight()); + m_Cluster_clusterSize->Fill(Cluster.clusterSize(),eventInfo.beamSpotWeight()); if (Cluster.pt()/1000.0 > -20 && Cluster.pt()/1000.0 < 20){ - m_Cluster_eta_lowpt->Fill(Cluster.eta()); + m_Cluster_eta_lowpt->Fill(Cluster.eta(),eventInfo.beamSpotWeight()); } - m_Cluster_pt_interval->Fill(Cluster.pt()/1000.0); - m_Cluster_pt_zoom->Fill(Cluster.pt()/1000.0); + m_Cluster_pt_interval->Fill(Cluster.pt()/1000.0,eventInfo.beamSpotWeight()); + m_Cluster_pt_zoom->Fill(Cluster.pt()/1000.0,eventInfo.beamSpotWeight()); float eSample_EM; eSample_EM = Cluster.eSample(CaloSampling::PreSamplerB) + Cluster.eSample(CaloSampling::EMB1) + Cluster.eSample(CaloSampling::EMB2) + Cluster.eSample(CaloSampling::EMB3) + Cluster.eSample(CaloSampling::PreSamplerE) + Cluster.eSample(CaloSampling::EME1) + Cluster.eSample(CaloSampling::EME2) + Cluster.eSample(CaloSampling::EME3) + Cluster.eSample(CaloSampling::FCAL0); - m_Cluster_eSample_EM->Fill((double)eSample_EM/1000.0); + m_Cluster_eSample_EM->Fill((double)eSample_EM/1000.0,eventInfo.beamSpotWeight()); float eSample_HAD; eSample_HAD = Cluster.eSample(CaloSampling::TileBar0) + Cluster.eSample(CaloSampling::TileBar1) + Cluster.eSample(CaloSampling::TileBar2) + Cluster.eSample(CaloSampling::HEC0) + Cluster.eSample(CaloSampling::HEC1) + Cluster.eSample(CaloSampling::HEC2) + Cluster.eSample(CaloSampling::HEC3) + Cluster.eSample(CaloSampling::FCAL1) + Cluster.eSample(CaloSampling::FCAL2); - m_Cluster_eSample_HAD->Fill((double)eSample_HAD/1000.0); + m_Cluster_eSample_HAD->Fill((double)eSample_HAD/1000.0,eventInfo.beamSpotWeight()); } -- GitLab