diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronJetDRAssociator.h b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronJetDRAssociator.h index eb8c11f7a88533049f7afc583d012584ecfc2cbe..4e5dcd3c5d62c8bd74597e9bcf7bff0ff064ecc4 100644 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronJetDRAssociator.h +++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronJetDRAssociator.h @@ -18,6 +18,7 @@ #define EGAMMAD3PDMAKER_ELECTRONJETDRASSOCIATOR_H +#include "D3PDMakerInterfaces/ICollectionGetterRegistryTool.h" #include "D3PDMakerUtils/MultiAssociationTool.h" #include "xAODEgamma/Electron.h" #include "xAODJet/Jet.h" @@ -34,7 +35,6 @@ namespace Trk { class VxCandidate; } namespace D3PD { -class ICollectionGetterRegistryTool; class ICollectionGetterTool; diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronL2TriggerObjectAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronL2TriggerObjectAssociationTool.cxx deleted file mode 100644 index c1ae0676d5f37e6a0f625dc415dd62d689e8d5a6..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronL2TriggerObjectAssociationTool.cxx +++ /dev/null @@ -1,187 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/ElectronL2TriggerObjectAssociationTool.cxx - * @author scott snyder <snyder@bnl.gov> - * @date Aug, 2009 - * @brief Associate from an electron to its matching L2 trigger object. - */ - - -#include "ElectronL2TriggerObjectAssociationTool.h" -#include "D3PDMakerInterfaces/ICollectionGetterRegistryTool.h" -#include "SGTools/BaseInfo.h" -#include "FourMomUtils/P4Helpers.h" -#include "AthenaKernel/errorcheck.h" - - -SG_ADD_BASE(TrigElectron, SG_VIRTUAL(INavigable4Momentum)); - - -namespace D3PD { - - -/** - * @brief Rank results of trigger association. - * @param tool The tool that calls us. - * @param p0 The source object for the association. - * @param p1 First object to compare. - * @param p2 Second object to compare. - * - * When we associate to trigger objects, we may have several candidates - * at the same (eta, phi). Just picking the first one is bad, because - * the ordering of these objects can change from run to run. So we use - * this to rank among objects with the same (eta, phi). - * - * Note that for TrigElectron objects, the metric used for trigger matching - * is based on the cluster (eta,phi), not the electron (eta,phi). - * Thus, we can have two TrigElectron's with the same metric - * distance from the source object but with different DR. - * - * This version ranks first by @c dr, then by @c pt, then by tracking algorithm, - * then by ethad1. - */ -inline -bool lessForTriggerAssociation (IAlgTool* tool, - const I4Momentum* p0, - const TrigElectron* p1, - const TrigElectron* p2) -{ - float dr1 = P4Helpers::deltaR (*p0, *p1); - float dr2 = P4Helpers::deltaR (*p0, *p2); - if (CxxUtils::fpcompare::less (dr2, dr1)) - return true; - if (CxxUtils::fpcompare::less (dr1, dr2)) - return false; - - if (CxxUtils::fpcompare::less (p1->pt(), p2->pt())) - return true; - if (CxxUtils::fpcompare::less (p2->pt(), p1->pt())) - return false; - if ((int)p1->trackAlgo() < (int)p2->trackAlgo()) - return true; - if ((int)p2->trackAlgo() < (int)p1->trackAlgo()) - return false; - if (CxxUtils::fpcompare::less (p2->Ethad1(), p1->Ethad1())) - return true; - if (CxxUtils::fpcompare::less (p1->Ethad1(), p2->Ethad1())) - return false; - - // Break remaining ties by the order in the collection, if it was supplied. - ElectronL2TriggerObjectAssociationTool* atool = - dynamic_cast<ElectronL2TriggerObjectAssociationTool*> (tool); - if (!atool) return false; - return atool->compareInSequence (p1, p2); -} - - - /** - * This function is used to calculate the distance between the TrigElectron - * and the track associated to the offline electron. - * - * @param l2 The LVL2 TrigElectron object - * @param offl The egamma offline electron object - * @returns The "distance" between the two objects - */ - float ElectronTrigElectronDistanceFunctor:: - calculateDistance( const TrigElectron* l2, - const egamma* offl ) const { - - // Check if we can actually perform this calculation: - if( offl->nTrackParticles() && offl->trackParticle() ) { - return DeltaRDistanceFunctor< TrigElectron, - Rec::TrackParticle >::deltaR( l2, - offl->trackParticle() ); - } else { - REPORT_MESSAGE_WITH_CONTEXT( MSG::DEBUG, "ElectronTrigElectronDistanceFunctor" ) - << "Offline electron has no track. Using the position of the egamma object."; - return DeltaRDistanceFunctor< TrigElectron, egamma >::deltaR( l2, - offl ); - } - } - - -/** - * @brief Compare two objects by their position in a supplied collection. - * @param p1 First object to compare. - * @param p2 Second object to compare. - */ -bool -ElectronL2TriggerObjectAssociationTool::compareInSequence - (const TrigElectron* p1, - const TrigElectron* p2) -{ - if (m_targetLabel.empty()) - return false; - - // No way to pass a StatusCode back from here. - // If this gets an error, it'll be logged. - // We generally wouldn't get an error anyway, - // since we turn on AllowMissing. - m_map.reset().ignore(); - - int i1 = m_map.findIndex (p1); - int i2 = m_map.findIndex (p2); - return i1 < i2; -} - - -/** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ -ElectronL2TriggerObjectAssociationTool::ElectronL2TriggerObjectAssociationTool - (const std::string& type, - const std::string& name, - const IInterface* parent) - : Base (type, name, parent), - m_map (this, m_targetLabel, m_registry, true) -{ - declareProperty ("Target", m_targetLabel, - "Label of getter for the sequence to define the final " - "disambiguation of TrigElectrons. " - "Leave blank to not do this."); - declareProperty ("CollectionGetterRegistry", m_registry, - "The ICollectionGetterRegistryTool instance."); - declareProperty ("UseMCMetric", m_useMCMetric = false, - "Use a special metric designed for MC files?"); - - if (setProperty ("ChainPattern", "L2_e.*").isFailure()) { - REPORT_MESSAGE (MSG::ERROR) << "Can't set ChainPattern property for tool " - << type << "/" << name; - } -} - - -/** - * @brief Configure during initialization: type-check. - * @param tree Our parent for tuple making. - * @param ti Gives the type of the object being passed to @c resetUntyped. - * - * @c configureD3PD should check that the type of the object coming as input - * (to @c getUntyped) - * is compatible with what it expects, and raise an error otherwise. - */ -StatusCode -ElectronL2TriggerObjectAssociationTool::configureD3PD (D3PD::IAddVariable* tree, - const std::type_info& ti) -{ - CHECK( ElectronL2TriggerObjectAssociationToolBase::configureD3PD (tree, ti) ); - - if( m_useMCMetric ) setMetric( &m_metric ); - - if (!m_targetLabel.empty()) - CHECK( m_map.configureD3PD() ); - - return StatusCode::SUCCESS; -} - - -} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronL2TriggerObjectAssociationTool.h b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronL2TriggerObjectAssociationTool.h deleted file mode 100644 index 707b336eb28469d4db02cc8d80f73d13fe05e074..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/ElectronL2TriggerObjectAssociationTool.h +++ /dev/null @@ -1,141 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/ElectronL2TriggerObjectAssociationTool.h - * @author scott snyder <snyder@bnl.gov> - * @date Aug, 2009 - * @brief Associate from an electron to its matching L2 trigger object. - */ - - -#ifndef EGAMMAD3PDMAKER_ELECTRONL2TRIGGEROBJECTASSOCIATIONTOOL_H -#define EGAMMAD3PDMAKER_ELECTRONL2TRIGGEROBJECTASSOCIATIONTOOL_H - - -// Forward declaration to ensure this overload is visible -// when the TriggerObjectAssociationTool code is instantiated. -class TrigElectron; -class I4Momentum; -class IAlgTool; -namespace D3PD { -bool lessForTriggerAssociation (IAlgTool* tool, - const I4Momentum* p0, - const TrigElectron* p1, - const TrigElectron* p2); -} - - -#include "TriggerD3PDMaker/TriggerObjectAssociationTool.h" -#include "TrigObjectMatching/DistanceFunctor.h" -#include "D3PDMakerUtils/IndexMap.h" -#include "egammaEvent/egamma.h" -#include "TrigParticle/TrigElectronContainer.h" -#include "GaudiKernel/ToolHandle.h" - - -namespace D3PD { - - -class ICollectionGetterRegistryTool; - - /** - * @short Special metric for matching LVL2 electrons to offline ones - * - * Since the cluster information is missing in MC10a and MC10b, - * we can't use the default metric for matching offline electrons - * to trigger electrons. - * - * This metric compares the eta and phi position returned by the - * TrigElectron object to the eta and phi of the track associated - * to the offline electron. - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * - * $Revision: 363585 $ - * $Date$ - */ - class ElectronTrigElectronDistanceFunctor : - public DistanceFunctor< TrigElectron, egamma > { - - private: - virtual float calculateDistance( const TrigElectron* l2, - const egamma* offl ) const; - - }; // class ElectronTrigElectronDistanceFunctor - - -/** - * @brief Associate from an electron to its matching L2 trigger object. - */ -typedef TriggerObjectAssociationTool<egamma, TrigElectron> - ElectronL2TriggerObjectAssociationToolBase; - -class ElectronL2TriggerObjectAssociationTool - : public ElectronL2TriggerObjectAssociationToolBase -{ -public: - typedef ElectronL2TriggerObjectAssociationToolBase Base; - - - /** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ - ElectronL2TriggerObjectAssociationTool (const std::string& type, - const std::string& name, - const IInterface* parent); - - - /** - * @brief Configure during initialization: type-check. - * @param tree Our parent for tuple making. - * @param ti Gives the type of the object being passed to @c resetUntyped. - * - * @c configureD3PD should check that the type of the object coming as input - * (to @c getUntyped) - * is compatible with what it expects, and raise an error otherwise. - */ - virtual StatusCode configureD3PD (D3PD::IAddVariable* tree, - const std::type_info& ti); - - - /** - * @brief Compare two objects by their position in a supplied collection. - * @param p1 First object to compare. - * @param p2 Second object to compare. - */ - bool compareInSequence (const TrigElectron* p1, - const TrigElectron* p2); - - - -private: - /// Property: Label of getter for the sequence to define the final - /// disambiguation of TrigElectrons. Leave blank to not do this. - std::string m_targetLabel; - - /// Property: The ICollectionGetterRegistryTool instance. - ToolHandle<ICollectionGetterRegistryTool> m_registry; - - // Collection used for final object disambiguation. - IndexMap m_map; - - /// Property: Use special metric designed for MC? - bool m_useMCMetric; - /// Special distance metric when running on MC - ElectronTrigElectronDistanceFunctor m_metric; -}; - - -} // namespace D3PD - - - -#endif // not EGAMMAD3PDMAKER_ELECTRONL2TRIGGEROBJECTASSOCIATIONTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/PhotonL2TriggerObjectAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/PhotonL2TriggerObjectAssociationTool.cxx deleted file mode 100644 index 9f50c4a8933f8d7b27ffd0eb2485052be6521006..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/PhotonL2TriggerObjectAssociationTool.cxx +++ /dev/null @@ -1,72 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/PhotonL2TriggerObjectAssociationTool.cxx - * @author scott snyder <snyder@bnl.gov> - * @date Aug, 2009 - * @brief Associate from a photon to its matching L2 trigger object. - */ - - -#include "PhotonL2TriggerObjectAssociationTool.h" -#include "SGTools/BaseInfo.h" - - -SG_ADD_BASE(TrigPhoton, SG_VIRTUAL(INavigable4Momentum)); - - -namespace D3PD { - - - /** - * This function is used to calculate the distance between the TrigPhoton - * and the cluster associated to the offline photon. - * - * @param l2 The LVL2 TrigPhoton object - * @param offl The egamma offline photon object - * @returns The "distance" between the two objects - */ - float PhotonTrigPhotonDistanceFunctor:: - calculateDistance( const TrigPhoton* l2, - const egamma* offl ) const { - - // Check if we can actually perform this calculation: - if( offl->cluster() ) { - return DeltaRDistanceFunctor< TrigPhoton, CaloCluster >::deltaR( l2, - offl->cluster() ); - } else { - REPORT_MESSAGE_WITH_CONTEXT( MSG::WARNING, "PhotonTrigPhotonDistanceFunctor" ) - << "Offline photon has no cluster. Using the position of the egamma object."; - return DeltaRDistanceFunctor< TrigPhoton, egamma >::deltaR( l2, - offl ); - } - } - - -/** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ -PhotonL2TriggerObjectAssociationTool::PhotonL2TriggerObjectAssociationTool - (const std::string& type, - const std::string& name, - const IInterface* parent) - : Base (type, name, parent) -{ - setMetric( &m_metric ); - - if (setProperty ("ChainPattern", "L2_g.*").isFailure()) { - REPORT_MESSAGE (MSG::ERROR) << "Can't set ChainPattern property for tool " - << type << "/" << name; - } -} - - -} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/PhotonL2TriggerObjectAssociationTool.h b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/PhotonL2TriggerObjectAssociationTool.h deleted file mode 100644 index d0d2d6930e571497aac2abeb02616ce51dbdc2f2..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/PhotonL2TriggerObjectAssociationTool.h +++ /dev/null @@ -1,91 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/PhotonL2TriggerObjectAssociationTool.h - * @author scott snyder <snyder@bnl.gov> - * @date Aug, 2009 - * @brief Associate from a photon to its matching L2 trigger object. - */ - - -#ifndef EGAMMAD3PDMAKER_PHOTONL2TRIGGEROBJECTASSOCIATIONTOOL_H -#define EGAMMAD3PDMAKER_PHOTONL2TRIGGEROBJECTASSOCIATIONTOOL_H - - -#include "TriggerD3PDMaker/TriggerObjectAssociationTool.h" -#include "egammaEvent/egamma.h" -#include "TrigParticle/TrigPhoton.h" -#include "TrigParticle/TrigPhotonContainer.h" - - -namespace D3PD { - - - /** - * @short Special metric for matching LVL2 photons to offline ones - * - * TrigMatchTool doesn't provide a special metric for matching - * TrigPhoton objects to offline photons. To make sure that the - * distance between these object combinations is calculated as - * we would like, we should use this metric for now. - * - * This metric compares the eta and phi position returned by the - * TrigPhoton object to the eta and phi of the cluster associated - * to the offline photon. - * - * This metric is not motivated by the MC10a/MC10b problems, it - * should be used for all data types. - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * - * $Revision: 363585 $ - * $Date$ - */ - class PhotonTrigPhotonDistanceFunctor : - public DistanceFunctor< TrigPhoton, egamma > { - - private: - virtual float calculateDistance( const TrigPhoton* l2, - const egamma* offl ) const; - - }; // class PhotonTrigPhotonDistanceFunctor - - -/** - * @brief Associate from a photon to its matching L2 trigger object. - */ -typedef TriggerObjectAssociationTool<egamma, TrigPhoton> - PhotonL2TriggerObjectAssociationToolBase; -class PhotonL2TriggerObjectAssociationTool - : public PhotonL2TriggerObjectAssociationToolBase -{ -public: - typedef PhotonL2TriggerObjectAssociationToolBase Base; - - - /** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ - PhotonL2TriggerObjectAssociationTool (const std::string& type, - const std::string& name, - const IInterface* parent); - -private: - /// Special distance metric - PhotonTrigPhotonDistanceFunctor m_metric; -}; - - -} // namespace D3PD - - - -#endif // not EGAMMAD3PDMAKER_PHOTONL2TRIGGEROBJECTASSOCIATIONTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/components/egammaD3PDMaker_entries.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/components/egammaD3PDMaker_entries.cxx index 085539050ca2df02eb9074be4355674b05b34c7c..5d352bbfeb09c560ee9aeb5f05b6733374d8d2e2 100644 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/components/egammaD3PDMaker_entries.cxx +++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/components/egammaD3PDMaker_entries.cxx @@ -6,12 +6,7 @@ #include "../ElectronTrackParticleAssociationTool.h" #include "../egammaClusterAssociationTool.h" #include "../egammaGenParticleAssociationTool.h" -#include "../egammaL1TriggerObjectAssociationTool.h" -#include "../egammaEFElectronTriggerObjectAssociationTool.h" -#include "../egammaEFPhotonTriggerObjectAssociationTool.h" #include "../ElectronJetDRAssociator.h" -#include "../ElectronL2TriggerObjectAssociationTool.h" -#include "../PhotonL2TriggerObjectAssociationTool.h" #include "../egammaObjectDecisionFillerTool.h" #include "../xAODElectronObjectDecisionFillerTool.h" #include "../xAODPhotonObjectDecisionFillerTool.h" @@ -28,12 +23,7 @@ DECLARE_COMPONENT( D3PD::egammaTruthClassificationFillerTool ) DECLARE_COMPONENT( D3PD::ElectronTrackParticleAssociationTool ) DECLARE_COMPONENT( D3PD::egammaClusterAssociationTool ) DECLARE_COMPONENT( D3PD::egammaGenParticleAssociationTool ) -DECLARE_COMPONENT( D3PD::egammaL1TriggerObjectAssociationTool ) -DECLARE_COMPONENT( D3PD::egammaEFElectronTriggerObjectAssociationTool ) -DECLARE_COMPONENT( D3PD::egammaEFPhotonTriggerObjectAssociationTool ) DECLARE_COMPONENT( D3PD::ElectronJetDRAssociator ) -DECLARE_COMPONENT( D3PD::ElectronL2TriggerObjectAssociationTool ) -DECLARE_COMPONENT( D3PD::PhotonL2TriggerObjectAssociationTool ) DECLARE_COMPONENT( D3PD::egammaObjectDecisionFillerTool ) DECLARE_COMPONENT( D3PD::xAODElectronObjectDecisionFillerTool ) DECLARE_COMPONENT( D3PD::xAODPhotonObjectDecisionFillerTool ) diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFElectronTriggerObjectAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFElectronTriggerObjectAssociationTool.cxx deleted file mode 100644 index 40754e57f1b0793ef66430323901c028ee2483ba..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFElectronTriggerObjectAssociationTool.cxx +++ /dev/null @@ -1,122 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/egammaEFTriggerObjectAssociationTool.cxx - * @author scott snyder <snyder@bnl.gov> - * @date Aug, 2009 - * @brief Associate from an egamma to its matching EF trigger object. - */ - - -#include "egammaEFElectronTriggerObjectAssociationTool.h" -#include "egammaEFPhotonTriggerObjectAssociationTool.h" -#include "D3PDMakerInterfaces/ICollectionGetterRegistryTool.h" - - -namespace D3PD { - - /** - * This function is used to calculate the distance between the EF electron - * and the track associated to the offline electron. - * - * @param ef The EF electron object - * @param offl The egamma offline electron object - * @returns The "distance" between the two objects - */ - float ElectronEFElectronDistanceFunctor:: - calculateDistance( const egamma* ef, - const egamma* offl ) const { - - // Check if we can actually perform this calculation: - if( offl->nTrackParticles() && offl->trackParticle() ) { - return DeltaRDistanceFunctor< egamma, - Rec::TrackParticle >::deltaR( ef, - offl->trackParticle() ); - } else { - REPORT_MESSAGE_WITH_CONTEXT( MSG::DEBUG, "ElectronEFElectronDistanceFunctor" ) - << "Offline electron has no track. Using the position of the egamma object."; - return DeltaRDistanceFunctor< egamma, egamma >::deltaR( ef, - offl ); - } - } - - -/** - * @brief Compare two objects by their position in a supplied collection. - * @param p1 First object to compare. - * @param p2 Second object to compare. - */ -bool -egammaEFElectronTriggerObjectAssociationTool::compareInSequence - (const egamma* p1, - const egamma* p2) -{ - if (m_targetLabel.empty()) - return false; - - // No way to pass a StatusCode back from here. - // If this gets an error, it'll be logged. - // We generally wouldn't get an error anyway, - // since we turn on AllowMissing. - m_map.reset().ignore(); - - int i1 = m_map.findIndex (p1); - int i2 = m_map.findIndex (p2); - return i1 < i2; -} - - -/** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ -egammaEFElectronTriggerObjectAssociationTool::egammaEFElectronTriggerObjectAssociationTool - (const std::string& type, - const std::string& name, - const IInterface* parent) - : Base (type, name, parent), - m_map (this, m_targetLabel, m_registry, true) -{ - declareProperty ("Target", m_targetLabel, - "Label of getter for the sequence to define the final " - "disambiguation of egammas. " - "Leave blank to not do this."); - declareProperty ("CollectionGetterRegistry", m_registry, - "The ICollectionGetterRegistryTool instance."); - declareProperty ("UseMCMetric", m_useMCMetric = false, - "Use a special metric designed for MC files?"); -} - - -/** - * @brief Configure during initialization: type-check. - * @param tree Our parent for tuple making. - * @param ti Gives the type of the object being passed to @c resetUntyped. - * - * @c configureD3PD should check that the type of the object coming as input - * (to @c getUntyped) - * is compatible with what it expects, and raise an error otherwise. - */ -StatusCode -egammaEFElectronTriggerObjectAssociationTool::configureD3PD (D3PD::IAddVariable* tree, - const std::type_info& ti) -{ - CHECK( Base::configureD3PD (tree, ti) ); - - if( m_useMCMetric ) setMetric( &m_metric ); - - if (!m_targetLabel.empty()) - CHECK( m_map.configureD3PD() ); - - return StatusCode::SUCCESS; -} - - -} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFElectronTriggerObjectAssociationTool.h b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFElectronTriggerObjectAssociationTool.h deleted file mode 100644 index 0f283814a669d653a1c771a1a7b375b8258f69df..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFElectronTriggerObjectAssociationTool.h +++ /dev/null @@ -1,134 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/egammaEFElectronTriggerObjectAssociationTool.h - * @author scott snyder <snyder@bnl.gov> - * @date Aug, 2009 - * @brief Associate from an egamma to its matching EF electron trigger object. - */ - - -#ifndef EGAMMAD3PDMAKER_EGAMMAEFELECTRONTRIGGEROBJECTASSOCIATIONTOOL_H -#define EGAMMAD3PDMAKER_EGAMMAEFELECTRONTRIGGEROBJECTASSOCIATIONTOOL_H - - -// Forward declaration to ensure this overload is visible -// when the TriggerObjectAssociationTool code is instantiated. -#include "egammaEFlessForTriggerAssociation.h" - - -#include "TriggerD3PDMaker/TriggerObjectAssociationTool.h" -#include "TrigObjectMatching/DistanceFunctor.h" -#include "D3PDMakerUtils/IndexMap.h" -#include "egammaEvent/egamma.h" -#include "egammaEvent/egammaContainer.h" -#include "GaudiKernel/ToolHandle.h" - - -namespace D3PD { - - -class ICollectionGetterRegistryTool; - - - /** - * @short Special metric for matching EF electrons to offline ones - * - * Since the cluster information is missing in MC10a and MC10b, - * we can't use the default metric for matching offline electrons - * to trigger electrons. - * - * This metric compares the eta and phi position returned by the - * EF electron object to the eta and phi of the track associated - * to the offline electron. - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * - * $Revision: 364392 $ - * $Date$ - */ - class ElectronEFElectronDistanceFunctor : - public DistanceFunctor< egamma, egamma > { - - private: - virtual float calculateDistance( const egamma* ef, - const egamma* offl ) const; - - }; // class ElectronEFElectronDistanceFunctor - - -/** - * @brief Associate from an egamma to its matching EF trigger object. - */ -typedef TriggerObjectAssociationTool<egamma, egamma> - egammaEFElectronTriggerObjectAssociationToolBase; - -class egammaEFElectronTriggerObjectAssociationTool - : public egammaEFElectronTriggerObjectAssociationToolBase -{ -public: - typedef egammaEFElectronTriggerObjectAssociationToolBase Base; - - - /** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ - egammaEFElectronTriggerObjectAssociationTool (const std::string& type, - const std::string& name, - const IInterface* parent); - - - /** - * @brief Configure during initialization: type-check. - * @param tree Our parent for tuple making. - * @param ti Gives the type of the object being passed to @c resetUntyped. - * - * @c configureD3PD should check that the type of the object coming as input - * (to @c getUntyped) - * is compatible with what it expects, and raise an error otherwise. - */ - virtual StatusCode configureD3PD (D3PD::IAddVariable* tree, - const std::type_info& ti); - - - /** - * @brief Compare two objects by their position in a supplied collection. - * @param p1 First object to compare. - * @param p2 Second object to compare. - */ - bool compareInSequence (const egamma* p1, - const egamma* p2); - - - -private: - /// Property: Label of getter for the sequence to define the final - /// disambiguation of TrigElectrons. Leave blank to not do this. - std::string m_targetLabel; - - /// Property: The ICollectionGetterRegistryTool instance. - ToolHandle<ICollectionGetterRegistryTool> m_registry; - - // Collection used for final object disambiguation. - IndexMap m_map; - - /// Property: Use special metric designed for MC? - bool m_useMCMetric; - /// Special distance metric when running on MC - ElectronEFElectronDistanceFunctor m_metric; -}; - - -} // namespace D3PD - - - -#endif // not EGAMMAD3PDMAKER_EGAMMAEFELECTRONTRIGGEROBJECTASSOCIATIONTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFPhotonTriggerObjectAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFPhotonTriggerObjectAssociationTool.cxx deleted file mode 100644 index 87d6cf4b126190b5febf26fc0e8dfa0429968a53..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFPhotonTriggerObjectAssociationTool.cxx +++ /dev/null @@ -1,119 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/egammaEFTriggerObjectAssociationTool.cxx - * @author scott snyder <snyder@bnl.gov> - * @date Aug, 2009 - * @brief Associate from an egamma to its matching EF trigger object. - */ - - -#include "egammaEFPhotonTriggerObjectAssociationTool.h" -#include "D3PDMakerInterfaces/ICollectionGetterRegistryTool.h" - - -namespace D3PD { - - /** - * This function is used to calculate the distance between the EF photon - * and the cluster associated to the offline photon. - * - * @param ef The EF photon object - * @param offl The egamma offline photon object - * @returns The "distance" between the two objects - */ - float PhotonEFPhotonDistanceFunctor:: - calculateDistance( const egamma* ef, - const egamma* offl ) const { - - // Check if we can actually perform this calculation: - if( offl->cluster() ) { - return DeltaRDistanceFunctor< egamma, - CaloCluster >::deltaR( ef, - offl->cluster() ); - } else { - REPORT_MESSAGE_WITH_CONTEXT( MSG::WARNING, "PhotonEFPhotonDistanceFunctor" ) - << "Offline photon has no cluster. Using the position of the egamma object."; - return DeltaRDistanceFunctor< egamma, egamma >::deltaR( ef, - offl ); - } - } - - -/** - * @brief Compare two objects by their position in a supplied collection. - * @param p1 First object to compare. - * @param p2 Second object to compare. - */ -bool -egammaEFPhotonTriggerObjectAssociationTool::compareInSequence - (const egamma* p1, - const egamma* p2) -{ - if (m_targetLabel.empty()) - return false; - - // No way to pass a StatusCode back from here. - // If this gets an error, it'll be logged. - // We generally wouldn't get an error anyway, - // since we turn on AllowMissing. - m_map.reset().ignore(); - - int i1 = m_map.findIndex (p1); - int i2 = m_map.findIndex (p2); - return i1 < i2; -} - - -/** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ -egammaEFPhotonTriggerObjectAssociationTool::egammaEFPhotonTriggerObjectAssociationTool - (const std::string& type, - const std::string& name, - const IInterface* parent) - : Base (type, name, parent), - m_map (this, m_targetLabel, m_registry, true) -{ - declareProperty ("Target", m_targetLabel, - "Label of getter for the sequence to define the final " - "disambiguation of egammas. " - "Leave blank to not do this."); - declareProperty ("CollectionGetterRegistry", m_registry, - "The ICollectionGetterRegistryTool instance."); -} - - -/** - * @brief Configure during initialization: type-check. - * @param tree Our parent for tuple making. - * @param ti Gives the type of the object being passed to @c resetUntyped. - * - * @c configureD3PD should check that the type of the object coming as input - * (to @c getUntyped) - * is compatible with what it expects, and raise an error otherwise. - */ -StatusCode -egammaEFPhotonTriggerObjectAssociationTool::configureD3PD (D3PD::IAddVariable* tree, - const std::type_info& ti) -{ - CHECK( Base::configureD3PD (tree, ti) ); - - setMetric( &m_metric ); - - if (!m_targetLabel.empty()) - CHECK( m_map.configureD3PD() ); - - return StatusCode::SUCCESS; -} - - -} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFPhotonTriggerObjectAssociationTool.h b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFPhotonTriggerObjectAssociationTool.h deleted file mode 100644 index eefaa7f6a7a5cb4daf445a735134af55003cd9e3..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFPhotonTriggerObjectAssociationTool.h +++ /dev/null @@ -1,136 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/egammaEFPhotonTriggerObjectAssociationTool.h - * @author scott snyder <snyder@bnl.gov> - * @date Aug, 2009 - * @brief Associate from an egamma to its matching EF photon trigger object. - */ - - -#ifndef EGAMMAD3PDMAKER_EGAMMAEFPHOTONTRIGGEROBJECTASSOCIATIONTOOL_H -#define EGAMMAD3PDMAKER_EGAMMAEFPHOTONTRIGGEROBJECTASSOCIATIONTOOL_H - - -// Forward declaration to ensure this overload is visible -// when the TriggerObjectAssociationTool code is instantiated. -#include "egammaEFlessForTriggerAssociation.h" - - -#include "TriggerD3PDMaker/TriggerObjectAssociationTool.h" -#include "TrigObjectMatching/DistanceFunctor.h" -#include "D3PDMakerUtils/IndexMap.h" -#include "egammaEvent/egamma.h" -#include "egammaEvent/egammaContainer.h" -#include "GaudiKernel/ToolHandle.h" - - -namespace D3PD { - - -class ICollectionGetterRegistryTool; - - - /** - * @short Special metric for matching EF photons to offline ones - * - * TrigMatchTool doesn't provide a special metric for matching - * EF photon objects to offline photons. To make sure that the - * distance between these object combinations is calculated as - * we would like, we should use this metric for now. - * - * This metric compares the eta and phi position returned by the - * EF photon object to the eta and phi of the cluster associated - * to the offline photon. - * - * This metric is not motivated by the MC10a/MC10b problems, it - * should be used for all data types. - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * - * $Revision: 364392 $ - * $Date$ - */ - class PhotonEFPhotonDistanceFunctor : - public DistanceFunctor< egamma, egamma > { - - private: - virtual float calculateDistance( const egamma* ef, - const egamma* offl ) const; - - }; // class PhotonEFPhotonDistanceFunctor - - -/** - * @brief Associate from an egamma to its matching EF trigger object. - */ -typedef TriggerObjectAssociationTool<egamma, egamma> - egammaEFPhotonTriggerObjectAssociationToolBase; - -class egammaEFPhotonTriggerObjectAssociationTool - : public egammaEFPhotonTriggerObjectAssociationToolBase -{ -public: - typedef egammaEFPhotonTriggerObjectAssociationToolBase Base; - - - /** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ - egammaEFPhotonTriggerObjectAssociationTool (const std::string& type, - const std::string& name, - const IInterface* parent); - - - /** - * @brief Configure during initialization: type-check. - * @param tree Our parent for tuple making. - * @param ti Gives the type of the object being passed to @c resetUntyped. - * - * @c configureD3PD should check that the type of the object coming as input - * (to @c getUntyped) - * is compatible with what it expects, and raise an error otherwise. - */ - virtual StatusCode configureD3PD (D3PD::IAddVariable* tree, - const std::type_info& ti); - - - /** - * @brief Compare two objects by their position in a supplied collection. - * @param p1 First object to compare. - * @param p2 Second object to compare. - */ - bool compareInSequence (const egamma* p1, - const egamma* p2); - - - -private: - /// Property: Label of getter for the sequence to define the final - /// disambiguation of TrigElectrons. Leave blank to not do this. - std::string m_targetLabel; - - /// Property: The ICollectionGetterRegistryTool instance. - ToolHandle<ICollectionGetterRegistryTool> m_registry; - - // Collection used for final object disambiguation. - IndexMap m_map; - - /// Special distance metric when running on MC - PhotonEFPhotonDistanceFunctor m_metric; -}; - - -} // namespace D3PD - - - -#endif // not EGAMMAD3PDMAKER_EGAMMAEFPHOTONTRIGGEROBJECTASSOCIATIONTOOL_H diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFlessForTriggerAssociation.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFlessForTriggerAssociation.cxx deleted file mode 100644 index b181656b82422ab6a1c543752ba79ae58109083f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFlessForTriggerAssociation.cxx +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: egammaEFlessForTriggerAssociation.cxx 364392 2011-05-07 15:08:08Z krasznaa $ - -// Local include(s): -#include "egammaEFlessForTriggerAssociation.h" -#include "egammaEFElectronTriggerObjectAssociationTool.h" -#include "egammaEFPhotonTriggerObjectAssociationTool.h" - -namespace D3PD { - - /** - * @brief Rank results of trigger association. - * @param tool The tool that calls us. - * @param p0 The source object for the association. - * @param p1 First object to compare. - * @param p2 Second object to compare. - * - * When we associate to trigger objects, we may have several candidates - * at the same (eta, phi). Just picking the first one is bad, because - * the ordering of these objects can change from run to run. So we use - * this to rank among objects with the same (eta, phi). - * - * This same function is used by egammaEFElectronTriggerObjectAssociationTool - * and egammaEFPhotonTriggerObjectAssociationTool. Unfortunately the original - * design kind of breaks down in this use case... - */ - bool lessForTriggerAssociation( IAlgTool* tool, - const I4Momentum* /*p0*/, - const egamma* p1, - const egamma* p2 ) { - - // Break ties by the order in the collection, if it was supplied. - egammaEFElectronTriggerObjectAssociationTool* eltool = - dynamic_cast<egammaEFElectronTriggerObjectAssociationTool*> (tool); - - if( eltool ) { - return eltool->compareInSequence (p1, p2); - } - - egammaEFPhotonTriggerObjectAssociationTool* phtool = - dynamic_cast<egammaEFPhotonTriggerObjectAssociationTool*> (tool); - - if( phtool ) { - return phtool->compareInSequence (p1, p2); - } - - REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "lessForTriggerAssociation" ) - << "Unknown tool type received"; - return false; - } - -} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFlessForTriggerAssociation.h b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFlessForTriggerAssociation.h deleted file mode 100644 index f1a5e08516a991c90f4248ac9cc6b076c4cc2543..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaEFlessForTriggerAssociation.h +++ /dev/null @@ -1,21 +0,0 @@ -// Dear emacs, this is -*- c++ -*- - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: egammaEFlessForTriggerAssociation.h 364392 2011-05-07 15:08:08Z krasznaa $ -#ifndef EGAMMAD3PDMAKER_EGAMMAEFLESSFORTRIGGERASSOCIATION_H -#define EGAMMAD3PDMAKER_EGAMMAEFLESSFORTRIGGERASSOCIATION_H - -class IAlgTool; -class egamma; -class I4Momentum; -namespace D3PD { - bool lessForTriggerAssociation (IAlgTool* tool, - const I4Momentum* p0, - const egamma* p1, - const egamma* p2); -} - -#endif // EGAMMAD3PDMAKER_EGAMMAEFLESSFORTRIGGERASSOCIATION_H diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaL1TriggerObjectAssociationTool.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaL1TriggerObjectAssociationTool.cxx deleted file mode 100644 index d8fb6379edb1603726783dbc2e4f89cbcdaf7a0a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaL1TriggerObjectAssociationTool.cxx +++ /dev/null @@ -1,42 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/egammaL1TriggerObjectAssociationTool.cxx - * @author scott snyder <snyder@bnl.gov> - * @date Aug, 2009 - * @brief Associate from an egamma to its matching L1 trigger object. - */ - - -#include "egammaL1TriggerObjectAssociationTool.h" -#include "AthenaKernel/errorcheck.h" - - -namespace D3PD { - - -/** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ -egammaL1TriggerObjectAssociationTool::egammaL1TriggerObjectAssociationTool - (const std::string& type, - const std::string& name, - const IInterface* parent) - : Base (type, name, parent) -{ - if (setProperty ("ChainPattern", "L1_EM.*").isFailure()) { - REPORT_MESSAGE (MSG::ERROR) << "Can't set ChainPattern property for tool " - << type << "/" << name; - } -} - - -} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaL1TriggerObjectAssociationTool.h b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaL1TriggerObjectAssociationTool.h deleted file mode 100644 index a7cf2ccf05c8c6e7b85bb6607a9d32c08ab4bee7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/src/egammaL1TriggerObjectAssociationTool.h +++ /dev/null @@ -1,57 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id$ -/** - * @file egammaD3PDMaker/src/egammaL1TriggerObjectAssociationTool.h - * @author scott snyder <snyder@bnl.gov> - * @date Oct, 2009 - * @brief Associate from an egamma to its matching L1 trigger object. - */ - - -#ifndef EGAMMAD3PDMAKER_EGAMMAL1TRIGGEROBJECTASSOCIATIONTOOL_H -#define EGAMMAD3PDMAKER_EGAMMAL1TRIGGEROBJECTASSOCIATIONTOOL_H - - -#include "TriggerD3PDMaker/TriggerObjectAssociationTool.h" -#include "AnalysisTriggerEvent/EmTau_ROI.h" -#include "egammaEvent/egamma.h" - - -namespace D3PD { - - -/** - * @brief Associate from an egamma to its matching L1 trigger object. - */ -typedef TriggerObjectAssociationTool<egamma, EmTau_ROI> - egammaL1TriggerObjectAssociationToolBase; - -class egammaL1TriggerObjectAssociationTool - : public egammaL1TriggerObjectAssociationToolBase -{ -public: - typedef egammaL1TriggerObjectAssociationToolBase Base; - - - /** - * @brief Standard Gaudi tool constructor. - * @param type The name of the tool type. - * @param name The tool name. - * @param parent The tool's Gaudi parent. - */ - egammaL1TriggerObjectAssociationTool (const std::string& type, - const std::string& name, - const IInterface* parent); -}; - - -} // namespace D3PD - - - -#endif // not EGAMMAD3PDMAKER_EGAMMAL1TRIGGEROBJECTASSOCIATIONTOOL_H