diff --git a/PhysicsAnalysis/TopPhys/QuickAna/CMakeLists.txt b/PhysicsAnalysis/TopPhys/QuickAna/CMakeLists.txt deleted file mode 100644 index d44902f7ce720de124471eff0c65c7d39a61475e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/CMakeLists.txt +++ /dev/null @@ -1,200 +0,0 @@ -# $Id: CMakeLists.txt 780993 2016-10-28 13:22:53Z krasznaa $ - -# The name of the package: -atlas_subdir( QuickAna ) - -# Extra dependencies, based on the build environment: -set( extra_deps ) -if( XAOD_STANDALONE ) - set( extra_deps PhysicsAnalysis/D3PDTools/EventLoop - PRIVATE Control/xAODRootAccessInterfaces Control/xAODRootAccess ) -else() - set( extra_deps PRIVATE Control/AthenaBaseComps Control/AthAnalysisBaseComps - Control/StoreGate GaudiKernel ) -endif() - -# The dependencies of the package: -atlas_depends_on_subdirs( - PUBLIC - Control/AthContainers - Control/AthToolSupport/AsgTools - Event/xAOD/xAODEgamma - Event/xAOD/xAODJet - Event/xAOD/xAODMuon - Event/xAOD/xAODTau - Event/xAOD/xAODCore - Event/xAOD/xAODMissingET - Event/xAOD/xAODEventInfo - Event/xAOD/xAODTruth - PhysicsAnalysis/AnalysisCommon/AssociationUtils - PhysicsAnalysis/AnalysisCommon/IsolationSelection - PhysicsAnalysis/AnalysisCommon/PATInterfaces - PhysicsAnalysis/D3PDTools/RootCoreUtils - ${extra_deps} - Event/EventPrimitives - Event/xAOD/xAODBase - Event/xAOD/xAODTracking - PhysicsAnalysis/AnalysisCommon/PileupReweighting - PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection - PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection - PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool - PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools - PhysicsAnalysis/ElectronPhotonID/IsolationCorrections - PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection - PhysicsAnalysis/JetMissingEtID/JetSelectorTools - PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency - PhysicsAnalysis/MuonID/MuonsIDAnalysis/MuonEfficiencyCorrections - PhysicsAnalysis/MuonID/MuonsIDAnalysis/MuonMomentumCorrections - PhysicsAnalysis/MuonID/MuonSelectorTools - PhysicsAnalysis/TauID/TauAnalysisTools - Reconstruction/Jet/JetCalibTools - Reconstruction/Jet/JetJvtEfficiency - Reconstruction/Jet/JetMomentTools - Reconstruction/Jet/JetResolution - Reconstruction/Jet/JetUncertainties - Reconstruction/MET/METInterface - Reconstruction/MET/METUtilities - Tools/PathResolver - Trigger/TrigAnalysis/TrigDecisionTool - Trigger/TrigAnalysis/TriggerMatchingTool - Trigger/TrigConfiguration/TrigConfxAOD ) - -# External(s) used by the package: -find_package( Boost COMPONENTS program_options ) -find_package( ROOT COMPONENTS Core Hist RIO Gpad ) -find_package( GTest ) - -# Libraries in the package: -if( XAOD_STANDALONE ) - atlas_add_root_dictionary( QuickAnaLib QuickAnaLibCintDict - ROOT_HEADERS QuickAna/Configuration.h QuickAna/ELExample.h - QuickAna/QuickAna.h QuickAna/ValidationEL.h QuickAna/xAODTruth.h - Root/LinkDef.h - EXTERNAL_PACKAGES ROOT ) -endif() - -set( extra_public_libs ) -set( extra_private_libs ) -if( XAOD_STANDALONE ) - set( extra_public_libs EventLoop ) - set( extra_private_libs xAODRootAccessInterfaces xAODRootAccess ) -else() - set( extra_public_libs ) - set( extra_private_libs AthAnalysisBaseCompsLib StoreGateLib ) -endif() -atlas_add_library( QuickAnaLib - QuickAna/*.h Root/*.cxx ${QuickAnaLibCintDict} - PUBLIC_HEADERS QuickAna - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthContainers AsgTools xAODEgamma xAODJet xAODMuon xAODTau - xAODCore xAODMissingET xAODEventInfo xAODTruth AssociationUtilsLib - IsolationSelectionLib PATInterfaces RootCoreUtils ${extra_public_libs} - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} - EventPrimitives xAODBase xAODTracking PileupReweightingLib - ElectronEfficiencyCorrectionLib ElectronPhotonFourMomentumCorrectionLib - ElectronPhotonShowerShapeFudgeToolLib ElectronPhotonSelectorToolsLib - IsolationCorrectionsLib PhotonEfficiencyCorrectionLib JetSelectorToolsLib - xAODBTaggingEfficiencyLib MuonEfficiencyCorrectionsLib - MuonMomentumCorrectionsLib MuonSelectorToolsLib TauAnalysisToolsLib - JetCalibToolsLib JetJvtEfficiencyLib JetMomentToolsLib JetResolutionLib - JetUncertaintiesLib METInterface METUtilitiesLib PathResolver - TrigDecisionToolLib TriggerMatchingToolLib TrigConfxAODLib - ${extra_private_libs} ) - -if( NOT XAOD_STANDALONE ) - atlas_add_component( QuickAna - src/*.h src/*.cxx src/components/*.cxx - LINK_LIBRARIES GaudiKernel AthenaBaseComps xAODEgamma QuickAnaLib ) -endif() - -# Executable(s) in the package: -if( XAOD_STANDALONE ) - foreach( exec quickana_basic quickana_multi_wp quickana_output - quickana_systematics quickana_test_or quickana_truth ) - atlas_add_executable( ${exec} - util/${exec}.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} PATInterfaces xAODRootAccess - RootCoreUtils QuickAnaLib ) - endforeach() - - atlas_add_executable( quickana_trigger - util/quickana_trigger.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} PATInterfaces - xAODRootAccess AsgTools TrigConfxAODLib TrigDecisionToolLib - QuickAnaLib ) - - atlas_add_executable( quickana_validate - util/quickana_validate.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} EventLoop - PATInterfaces SampleHandler xAODRootAccess QuickAnaLib ) -endif() - -# Test(s) in the package: -atlas_add_test( gt_KinSelect - SOURCES test/gt_KinSelect.cxx - INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} - LINK_LIBRARIES ${GTEST_LIBRARIES} AsgTools xAODJet QuickAnaLib ) - -atlas_add_test( it_BaseTools_test - SOURCES test/it_BaseTools_test.cxx - INCLUDE_DIRS ${GTEST_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${GTEST_LIBRARIES} ${Boost_LIBRARIES} AsgTools - AssociationUtilsLib ElectronEfficiencyCorrectionLib - ElectronPhotonFourMomentumCorrectionLib ElectronPhotonSelectorToolsLib - IsolationCorrectionsLib IsolationSelectionLib JetCalibToolsLib - JetJvtEfficiencyLib JetMomentToolsLib JetResolutionLib JetSelectorToolsLib - JetUncertaintiesLib METUtilitiesLib MuonEfficiencyCorrectionsLib - MuonMomentumCorrectionsLib MuonSelectorToolsLib PhotonEfficiencyCorrectionLib - PileupReweightingLib TauAnalysisToolsLib TrigConfxAODLib - xAODBTaggingEfficiencyLib ElectronPhotonShowerShapeFudgeToolLib ) - -foreach( test inc_AnaToolCorrect inc_AnaToolSelect inc_AnaToolWeight - inc_IAnaTool inc_IEventObjects inc_IQuickAna inc_MessageCheck - inc_OutputToolXAOD inc_xAODInclude ) - atlas_add_test( ${test} - SOURCES test/${test}.cxx - LINK_LIBRARIES QuickAnaLib ) -endforeach() - -if( XAOD_STANDALONE ) - foreach( test ut_MessageCheck ut_OutputToolXAOD ut_event_data_filler - ut_xaod_truth ) - atlas_add_test( ${test} - SOURCES test/${test}.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} PATInterfaces xAODRootAccess - xAODEventInfo xAODEgamma xAODMissingET xAODCore RootCoreUtils - QuickAnaLib ) - endforeach() - - atlas_add_test( ut_eventloop_example SCRIPT test/ut_eventloop_example.sh ) - atlas_add_test( ut_python SCRIPT test/ut_python.py ) - atlas_add_test( ut_python_no_qa SCRIPT test/ut_python_no_qa.py ) - atlas_add_test( ut_quickana_basic SCRIPT test/ut_quickana_basic.sh ) - atlas_add_test( ut_quickana_hammercloud - SCRIPT test/ut_quickana_hammercloud.sh ) - atlas_add_test( ut_quickana_multi_wp SCRIPT test/ut_quickana_multi_wp.sh ) - atlas_add_test( ut_quickana_optimized SCRIPT test/ut_quickana_optimized.sh ) - atlas_add_test( ut_quickana_output SCRIPT test/ut_quickana_output.sh ) - atlas_add_test( ut_quickana_trigger SCRIPT test/ut_quickana_trigger.sh ) - atlas_add_test( ut_quickana_validate SCRIPT test/ut_quickana_validate.sh ) - atlas_add_test( ut_quickana_validate_electron - SCRIPT test/ut_quickana_validate_electron.sh ) - atlas_add_test( ut_quickana_validate_jet - SCRIPT test/ut_quickana_validate_jet.sh ) - atlas_add_test( ut_quickana_validate_fat_jet - SCRIPT test/ut_quickana_validate_fat_jet.sh ) - atlas_add_test( ut_quickana_validate_muon - SCRIPT test/ut_quickana_validate_muon.sh ) - atlas_add_test( ut_quickana_validate_photon - SCRIPT test/ut_quickana_validate_photon.sh ) - atlas_add_test( ut_quickana_validate_tau - SCRIPT test/ut_quickana_validate_tau.sh ) -endif() - -# Install files from the package: -atlas_install_joboptions( share/*.py ) -atlas_install_data( share/*.conf ) diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaTool.h deleted file mode 100644 index cb381b8eaba3f3fe42e259bd2c91972f6fd947c8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaTool.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ANA_TOOL_H -#define QUICK_ANA__ANA_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <AsgTools/AsgTool.h> -#include <QuickAna/IAnaTool.h> - -namespace ana -{ - /// \brief The base class for all the tools constituting object - /// definitions. - /// \par Rationale - /// Most object definitions should derive from this class instead - /// of from IAnaTool directly, since this class contains quite a - /// bit of boilerplate code. - class AnaTool : virtual public IAnaTool, virtual public asg::AsgTool - { - // - // public interface - // - - ASG_TOOL_CLASS (AnaTool, ana::IAnaTool) - - - /// \brief test the invariant of this container - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaTool (const std::string& name); - - - - // - // protected interface - // - - /// \brief register the given systematics tool - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - /// \par Rationale - /// for now this is mainly used for managing the - /// systematics, but at a later stage there may be other uses - /// for this as well. - protected: - void registerTool (CP::ISystematicsTool *tool); - - /// \copydoc registerTool(CP::ISystematicsTool*) - /// \par Rationale - /// there are two versions here, so that it can be - /// called directly both with tools that implement - /// ISystematicsTool and those that do not need it. - /// \sa registerTool(CP::ISystematicsTool*) - protected: - void registerTool (IAsgTool *tool); - - - - // - // inherited interface - // - - public: - virtual bool - isAffectedBySystematic (const CP::SystematicVariation& systematic) const - override; - - public: - virtual CP::SystematicSet - affectingSystematics () const override; - - public: - virtual CP::SystematicSet - recommendedSystematics () const override; - - public: - virtual CP::SystematicCode - applySystematicVariation (const CP::SystematicSet& systConfig) override; - - public: - virtual void - fillEventDataSource (EventData& event) const override; - - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) - override; - - public: - virtual StatusCode - getInitialConfiguration (InternalConfiguration& conf) override; - - public: - virtual StatusCode - useInitialConfiguration (const InternalConfiguration& conf) override; - - - - // - // private interface - // - - /// \brief the list of registered systematics tools - private: - std::vector<CP::ISystematicsTool*> m_systematicsTools; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolCorrect.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolCorrect.h deleted file mode 100644 index 48851179e97759994d9ed212535503ddff4e6258..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolCorrect.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ANA_TOOL_CORRECT_H -#define QUICK_ANA__ANA_TOOL_CORRECT_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> -#include <QuickAna/SelectionData.h> - -namespace ana -{ - /// \brief The base class for tools implementing basic object - /// corrections. - template<class XAODContainer> - class AnaToolCorrect : virtual public IAnaTool, public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (AnaToolCorrect, ana::IAnaTool) - - - ///\brief the container type we are operating on - public: - typedef XAODContainer ContainerType; - - - ///\brief the object type we are operating on - public: - typedef typename XAODContainer::base_value_type XAODObject; - - - /// \brief standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - AnaToolCorrect (const std::string& name); - - - /// \copydoc IAnaTool::setObjectType - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// \copydoc IAnaTool::step - public: - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - public: - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - public: - virtual unsigned outputTypes () const override; - - - /// \copydoc IAnaTool::useConfiguration - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) - override; - - - /// \copydoc IAnaTool::execute - public: - virtual StatusCode execute (IEventObjects& objects) override; - - - /// \brief run the calibration on this object - /// \param object the object to evaluate - /// \param[out] accept whether the object passes basic object selection - /// \par Guarantee - /// basic - /// \par Failures - /// tool dependent - public: - virtual StatusCode correctObject (XAODObject& object) = 0; - - - /// \brief add a cut with the given name and selection step - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - /// \pre !isInitialized() - public: - void registerCut (SelectionStep step, const std::string& name, - SelectionCut& cut); - - - - // - // private interface - // - - /// \brief the type of object we work on - private: - ObjectType m_type; - - /// \brief the selection data - private: - SelectionData m_selection; - }; -} - -#include <QuickAna/AnaToolCorrect.icc> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolCorrect.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolCorrect.icc deleted file mode 100644 index b46b9829b23177ad45bf693d9d88fb28a01668ad..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolCorrect.icc +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <QuickAna/IEventObjects.h> - -namespace ana -{ - template<class XAODContainer> AnaToolCorrect<XAODContainer> :: - AnaToolCorrect (const std::string& name) - : AsgTool (name), AnaTool (name), - m_type (ObjectTypeInfo::fromXAOD<XAODContainer>::base) - {} - - - - template<class XAODContainer> StatusCode AnaToolCorrect<XAODContainer> :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - if ((ObjectTypeInfo::fromXAOD<XAODContainer>::support & (1 << type)) == 0) - { - ATH_MSG_ERROR ("unsupported object type"); - return StatusCode::FAILURE; - } - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point in correct step"); - return StatusCode::FAILURE; - } - m_type = type; - return StatusCode::SUCCESS; - } - - - - template<class XAODContainer> AnalysisStep AnaToolCorrect<XAODContainer> :: - step () const - { - return STEP_CORRECT; - } - - - - template<class XAODContainer> unsigned AnaToolCorrect<XAODContainer> :: - inputTypes () const - { - return 1 << m_type; - } - - - - template<class XAODContainer> unsigned AnaToolCorrect<XAODContainer> :: - outputTypes () const - { - return 1 << m_type; - } - - - - template<class XAODContainer> StatusCode AnaToolCorrect<XAODContainer> :: - useConfiguration (const InternalConfiguration& configuration) - { - ATH_CHECK (AnaTool::useConfiguration (configuration)); - ATH_CHECK (m_selection.initialize (configuration, "")); - return StatusCode::SUCCESS; - } - - - - template<class XAODContainer> StatusCode AnaToolCorrect<XAODContainer> :: - execute (IEventObjects& objects) - { - for (auto object : *objects.get<ContainerType>(m_type)) - { - ATH_CHECK (m_selection.prepare (object)); - ATH_CHECK (this->correctObject (*object)); - m_selection.apply (); - } - return StatusCode::SUCCESS; - } - - - - template<class XAODContainer> void AnaToolCorrect<XAODContainer> :: - registerCut (SelectionStep step, const std::string& name, - SelectionCut& cut) - { - m_selection.registerCut (step, name, cut); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolRetrieve.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolRetrieve.h deleted file mode 100644 index d46d81c1d726056386564819b14179a955773e34..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolRetrieve.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ANA_TOOL_RETRIEVE_H -#define QUICK_ANA__ANA_TOOL_RETRIEVE_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> - -namespace ana -{ - /// \brief The tool class implementing basic object retrieval. - - class AnaToolRetrieve : virtual public IAnaTool, public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (AnaToolRetrieve, ana::IAnaTool) - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaToolRetrieve (const std::string& name); - - - /// \brief initializing constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaToolRetrieve (const std::string& name, const std::string& containerName); - - - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - public: - virtual AnalysisStep step () const override; - - public: - virtual unsigned inputTypes () const override; - - public: - virtual unsigned outputTypes () const override; - - public: - virtual void - fillEventDataSource (EventData& event) const override; - - public: - virtual StatusCode execute (IEventObjects& objects) override; - - public: - virtual StatusCode - getInitialConfiguration (InternalConfiguration& conf) override; - - public: - std::string m_containerName; - - - - // - // private interface - // - - /// \brief the type of object we work on - private: - ObjectType m_type; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelect.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelect.h deleted file mode 100644 index 0a48d4287f80015746dbd2a57802c7e2d2444dfb..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelect.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ANA_TOOL_SELECT_H -#define QUICK_ANA__ANA_TOOL_SELECT_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> -#include <QuickAna/SelectionData.h> - -namespace ana -{ - /// \brief The base class for tools implementing basic object - /// selection. - template<class XAODContainer> - class AnaToolSelect : virtual public IAnaTool, public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (AnaToolSelect, ana::IAnaTool) - - - ///\brief the container type we are operating on - public: - typedef XAODContainer ContainerType; - - - ///\brief the object type we are operating on - public: - typedef typename XAODContainer::base_value_type XAODObject; - - - /// \copydoc IAnaTool::setObjectType - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaToolSelect (const std::string& name); - - - /// \copydoc IAnaTool::step - public: - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - public: - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - public: - virtual unsigned outputTypes () const override; - - - /// \copydoc IAnaTool::useConfiguration - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) - override; - - - /// \copydoc IAnaTool::execute - public: - virtual StatusCode execute (IEventObjects& objects) override; - - - /// \brief run the selection on this object - /// \param object the object to evaluate - /// \param[out] accept whether the object passes object selection - /// \par Guarantee - /// basic - /// \par Failures - /// tool dependent - public: - virtual StatusCode - selectObject (XAODObject& object) = 0; - - - /// \brief add a cut with the given name and selection step - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - /// \pre !isInitialized() - public: - void registerCut (SelectionStep step, const std::string& name, - SelectionCut& cut); - - - - // - // private interface - // - - /// \brief the type of object we work on - private: - ObjectType m_type; - - /// \brief our working point, or the empty string if this is the - /// only working point - private: - std::string m_workingPoint; - - /// \brief the selection data - private: - SelectionData m_selection; - }; -} - -#include <QuickAna/AnaToolSelect.icc> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelect.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelect.icc deleted file mode 100644 index 1926669c423f03729a5ff9cd6413508e1f2a06e8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelect.icc +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <QuickAna/IEventObjects.h> -#include <QuickAna/ObjectTypeInfo.h> -#include <RootCoreUtils/Assert.h> - -namespace ana -{ - template<class XAODContainer> AnaToolSelect<XAODContainer> :: - AnaToolSelect (const std::string& name) - : AsgTool (name), AnaTool (name), - m_type (ObjectTypeInfo::fromXAOD<XAODContainer>::base) - {} - - - - template<class XAODContainer> StatusCode AnaToolSelect<XAODContainer> :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - // TODO: needs a comment! - if ((ObjectTypeInfo::fromXAOD<XAODContainer>::support & (1 << type)) == 0) - { - ATH_MSG_ERROR ("unsupported object type"); - return StatusCode::FAILURE; - } - m_type = type; - m_workingPoint = workingPoint; - return StatusCode::SUCCESS; - } - - - - template<class XAODContainer> StatusCode AnaToolSelect<XAODContainer> :: - useConfiguration (const InternalConfiguration& configuration) - { - ATH_CHECK (AnaTool::useConfiguration (configuration)); - ATH_CHECK (m_selection.initialize (configuration, m_workingPoint)); - return StatusCode::SUCCESS; - } - - - - template<class XAODContainer> AnalysisStep AnaToolSelect<XAODContainer> :: - step () const - { - return STEP_SELECT; - } - - - - template<class XAODContainer> unsigned AnaToolSelect<XAODContainer> :: - inputTypes () const - { - return 1 << m_type; - } - - - - template<class XAODContainer> unsigned AnaToolSelect<XAODContainer> :: - outputTypes () const - { - return 1 << m_type; - } - - - - template<class XAODContainer> StatusCode AnaToolSelect<XAODContainer> :: - execute (IEventObjects& objects) - { - for (auto object : *objects.get<ContainerType>(m_type)) - { - ATH_CHECK (m_selection.prepare (object)); - if (m_selection.needSelectionTool()) - ATH_CHECK (this->selectObject (*object)); - m_selection.apply (); - } - return StatusCode::SUCCESS; - } - - - - template<class XAODContainer> void AnaToolSelect<XAODContainer> :: - registerCut (SelectionStep step, const std::string& name, - SelectionCut& cut) - { - RCU_CHANGE_INVARIANT (this); - m_selection.registerCut (step, name, cut); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelectCombine.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelectCombine.h deleted file mode 100644 index b2c387b6170561ce2ea6ff813841f6f637217fe0..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelectCombine.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ANA_TOOL_SELECT_COMBINE_H -#define QUICK_ANA__ANA_TOOL_SELECT_COMBINE_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <AthContainers/AuxElement.h> -#include <QuickAna/AnaTool.h> - -namespace ana -{ - /// \brief The tool class that merges the selection flags from the - /// different workings points into a single one - - class AnaToolSelectCombine : virtual public IAnaTool, public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (AnaToolSelectCombine, ana::IAnaTool) - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaToolSelectCombine (const std::string& name); - - - /// \brief initializing constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaToolSelectCombine (const std::string& name, const std::vector<std::string>& workingPoints); - - - /// \copydoc IAnaTool::setObjectType - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// \copydoc IAnaTool::step - public: - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - public: - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - public: - virtual unsigned outputTypes () const override; - - - /// \copydoc IAnaTool::useConfiguration - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) - override; - - - /// \copydoc IAnaTool::execute - public: - virtual StatusCode execute (IEventObjects& objects) override; - - - /// \brief the list of working points to combine - public: - std::vector<std::string> m_workingPoints; - - - - // - // private interface - // - - /// \brief the type of object we work on - private: - ObjectType m_type; - - /// \brief the data for the different selection steps - private: - struct Data - { - /// \brief the field to write out the selection - public: - SG::AuxElement::Accessor<SelectType> select; - - /// \brief the input fields to combine - public: - std::vector<SG::AuxElement::ConstAccessor<SelectType>> inputSelect; - - Data (const InternalConfiguration& configuration, - const std::vector<std::string>& workingPoints, - SelectionStep step); - }; - - /// \brief the different data values - private: - std::vector<Data> m_data; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelectInit.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelectInit.h deleted file mode 100644 index 5c100b96cad661156a346dccae45234be152f181..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelectInit.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ANA_TOOL_SELECT_INIT_H -#define QUICK_ANA__ANA_TOOL_SELECT_INIT_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <AthContainers/AuxElement.h> -#include <QuickAna/AnaTool.h> - -namespace ana -{ - /// \brief The tool class that takes care of setting the selection - /// flags to true at the beginning - - class AnaToolSelectInit : virtual public IAnaTool, public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (AnaToolSelectInit, ana::IAnaTool) - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaToolSelectInit (const std::string& name); - - - /// \copydoc IAnaTool::setObjectType - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// \copydoc IAnaTool::step - public: - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - public: - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - public: - virtual unsigned outputTypes () const override; - - - /// \copydoc IAnaTool::useConfiguration - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) - override; - - - /// \copydoc IAnaTool::execute - public: - virtual StatusCode execute (IEventObjects& objects) override; - - - - // - // private interface - // - - /// \brief the type of object we work on - private: - ObjectType m_type; - - /// \brief the selection fields - private: - std::vector<SG::AuxElement::Accessor<SelectType>> m_select; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelectSpread.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelectSpread.h deleted file mode 100644 index 4abf80d6bb1653a4a62d0499932ddde06e46cadf..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSelectSpread.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ANA_TOOL_SELECT_SPREAD_H -#define QUICK_ANA__ANA_TOOL_SELECT_SPREAD_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <AthContainers/AuxElement.h> -#include <QuickAna/AnaTool.h> - -namespace ana -{ - /// \brief The tool class that takes care of copying the global - /// selection flags to the individual working points. - /// - /// this is used twice (when using multiple working points), first - /// to copy the selection flags from the working point independent - /// tools to the different working points. then again after the - /// overlap removal tool it copies over the objects that fail the - /// overlap removal. - - class AnaToolSelectSpread : virtual public IAnaTool, public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (AnaToolSelectSpread, ana::IAnaTool) - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaToolSelectSpread (const std::string& name); - - - /// \brief initializing constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaToolSelectSpread (const std::string& name, const std::vector<std::string>& workingPoints, bool first); - - - /// \copydoc IAnaTool::setObjectType - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// \copydoc IAnaTool::step - public: - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - public: - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - public: - virtual unsigned outputTypes () const override; - - - /// \copydoc IAnaTool::useConfiguration - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) - override; - - - /// \copydoc IAnaTool::execute - public: - virtual StatusCode execute (IEventObjects& objects) override; - - - /// \brief the list of working points to spread - public: - std::vector<std::string> m_workingPoints; - - - - // - // private interface - // - - /// \brief the type of object we work on - private: - ObjectType m_type; - - /// \brief whether we are spreading for the first time, - /// i.e. whether we create the decorations without looking at them - private: - bool m_first; - - /// \brief the data for the different selection steps - private: - struct Data - { - /// \brief the field to write out the selection - public: - SG::AuxElement::ConstAccessor<SelectType> select; - - /// \brief the input fields to combine - public: - std::vector<SG::AuxElement::Accessor<SelectType>> outputSelect; - - Data (const InternalConfiguration& configuration, - const std::vector<std::string>& workingPoints, - SelectionStep step); - }; - - /// \brief the different data values - private: - std::vector<Data> m_data; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSequence.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSequence.h deleted file mode 100644 index bbc1274c8b7f376ecc59d18cf06c911a483935fe..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolSequence.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ANA_TOOL_SEQUENCE_H -#define QUICK_ANA__ANA_TOOL_SEQUENCE_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -#include <list> -#include <memory> -#include <vector> - -namespace ana -{ - /// \brief this class defines/manages a tool sequence - /// - /// A tool sequence is similar to an algorithm sequence, but it - /// allows to have named slots in it, which allow different options - /// for merging multiple sequences together, e.g. a tool can request - /// to be merged into a specific slot of another sequence and then - /// gets merged in there. - - class AnaToolSequence - { - // - // public interface - // - - // no copying - AnaToolSequence (const AnaToolSequence&) = delete; - AnaToolSequence& operator = (const AnaToolSequence&) = delete; - - - /// \brief test the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - public: - AnaToolSequence (); - - - /// \brief standard move constructor - /// \par Guarantee - /// no-fail - public: - AnaToolSequence (AnaToolSequence&& that); - - - /// \brief standard move assignment - /// \par Guarantee - /// no-fail - public: - AnaToolSequence& operator = (AnaToolSequence&& that); - - - /// \brief standard swap function - /// \par Guarantee - /// no-fail - public: - void swap (AnaToolSequence& that); - - - /// \brief add a new tool to the sequence - /// \brief Guarantee - /// strong - /// \brief Failures - /// out of memory I - public: - void addTool (std::unique_ptr<IAnaTool> val_definition); - - - /// \brief add a new label to the sequence - /// \brief Guarantee - /// strong - /// \brief Failures - /// out of memory II - public: - void addLabel (const std::string& val_label); - - - /// \brief STL-empty function - /// \par Guarantee - /// no-fail - public: - bool empty () const; - - - /// \brief STL-iterator - public: - typedef std::list<std::pair<std::unique_ptr<IAnaTool>,std::string>>::iterator iterator; - - - /// \brief STL-begin function - /// \par Guarantee - /// no-fail - public: - iterator begin (); - - - /// \brief STL-end function - /// \par Guarantee - /// no-fail - public: - iterator end (); - - - - // - // private interface - // - - /// \brief the list of tools/slots in the sequence - private: - std::list<std::pair<std::unique_ptr<IAnaTool>,std::string>> m_tools; - }; - - - - /// \brief make all definitions from the configuration - /// - /// this is used to separate the tool generation completely from - /// the tool scheduler - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory III - /// \par Failures - /// invalid configuration - StatusCode - makeToolSequence (const std::vector<DefinitionConf>& confList, - const DefinitionArgs& masterArgs, - AnaToolSequence& tools); -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolWeight.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolWeight.h deleted file mode 100644 index a3572aa9183b11f89b7b6b71ac0475524b2d7360..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolWeight.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ANA_TOOL_WEIGHT_H -#define QUICK_ANA__ANA_TOOL_WEIGHT_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include "AthContainers/AuxElement.h" - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> - -namespace ana -{ - /// \brief The base class for tools implementing basic object - /// weights. - template<class XAODContainer> - class AnaToolWeight : virtual public IAnaTool, public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (AnaToolWeight, ana::IAnaTool) - - - ///\brief the container type we are operating on - public: - typedef XAODContainer ContainerType; - - - ///\brief the object type we are operating on - public: - typedef typename XAODContainer::base_value_type XAODObject; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - AnaToolWeight (const std::string& name); - - - /// \copydoc IAnaTool::setObjectType - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// \copydoc IAnaTool::step - public: - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - public: - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - public: - virtual unsigned outputTypes () const override; - - - /// \copydoc IAnaTool::execute - public: - virtual StatusCode execute (IEventObjects& objects) override; - - - /// \brief calculate the weight for this event - /// \param object the object to evaluate - /// \param[out] weight the calculated weight - /// \par Guarantee - /// basic - /// \par Failures - /// tool dependent - /// \post result > 0 - public: - virtual StatusCode objectWeight (const XAODObject& object, float& weight) = 0; - - - // - // private interface - // - - /// \brief the type of object we work on - private: - ObjectType m_type; - - /// \brief the field to read in the selection - private: - SG::AuxElement::ConstAccessor<SelectType> m_select; - - /// \brief the field to write out the weight - private: - SG::AuxElement::Accessor<float> m_weight; - }; -} - -#include <QuickAna/AnaToolWeight.icc> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolWeight.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolWeight.icc deleted file mode 100644 index dd03e44e195f87aa2dd16cfcff4fb99559dcbd77..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/AnaToolWeight.icc +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <QuickAna/IEventObjects.h> - -namespace ana -{ - template<class XAODContainer> AnaToolWeight<XAODContainer> :: - AnaToolWeight (const std::string& name) - : AsgTool (name), AnaTool (name), - m_type (ObjectTypeInfo::fromXAOD<XAODContainer>::base), - m_select ("ana_select"), m_weight ("ana_weight") - {} - - - - template<class XAODContainer> StatusCode AnaToolWeight<XAODContainer> :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - if ((ObjectTypeInfo::fromXAOD<XAODContainer>::support & (1 << type)) == 0) - { - ATH_MSG_ERROR ("unsupported object type"); - return StatusCode::FAILURE; - } - m_type = type; - if (!workingPoint.empty()) - { - m_select = "ana_select_" + workingPoint; - m_weight = "ana_weight_" + workingPoint; - } - return StatusCode::SUCCESS; - } - - - - template<class XAODContainer> AnalysisStep AnaToolWeight<XAODContainer> :: - step () const - { - return STEP_WEIGHT; - } - - - - template<class XAODContainer> unsigned AnaToolWeight<XAODContainer> :: - inputTypes () const - { - return 1 << m_type; - } - - - - template<class XAODContainer> unsigned AnaToolWeight<XAODContainer> :: - outputTypes () const - { - return 1 << m_type; - } - - - - template<class XAODContainer> StatusCode AnaToolWeight<XAODContainer> :: - execute (IEventObjects& objects) - { - for (auto object : *objects.get<ContainerType>(m_type)) - { - float weight = 1; - if (m_select (*object)) - { - ATH_CHECK (this->objectWeight (*object, weight)); - if (!(weight > 0)) - { - ATH_MSG_WARNING ("object weight of " << weight << - " is not allowed: pt=" << object->pt() << - " eta=" << object->eta() << - " phi=" << object->phi()); - //return StatusCode::FAILURE; - } - } else - { - weight = 1; - } - m_weight (*object) = weight; - } - return StatusCode::SUCCESS; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/Configuration.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/Configuration.h deleted file mode 100644 index 3ff91ea073be142c4f93dcc6511da54b5793d1b6..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/Configuration.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__CONFIGURATION_H -#define QUICK_ANA__CONFIGURATION_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <AsgTools/MsgLevel.h> - -#include <string> -#include <vector> - -namespace ana -{ - /// \brief the overall configuration options for QuickAna - struct Configuration - { - /// \brief whether we intent to run on data - /// - /// this option may go away at some point if we figure out how to - /// obtain this information from the input file. - public: - bool isDataFlag = false; - bool isAFIIFlag = false; - - /// global message level to apply to all tools created by QuickAna. - public: - unsigned msgLevel = MSG::INFO; - - /// \brief the EventInfo definition to use - public: - std::string eventinfoDef; - - /// \brief the EventSelect definition to use - public: - std::string eventSelectDef; - - - /// \brief the electron definition - /// - /// e.g. tight, loose, default, none, etc. - public: - std::string electronDef; - - - /// \brief the electron kinematic selection - /// - /// e.g. pt>50e3 - public: - std::string electronKine; - - - /// \brief the photon definition - /// - /// e.g. tight, loose, default, none, etc. - public: - std::string photonDef; - - - /// \brief the photon kinematic selection - /// - /// e.g. pt>50e3 - public: - std::string photonKine; - - - /// \brief the muon definition - /// - /// e.g. tight, loose, default, none, etc. - public: - std::string muonDef; - - - /// \brief the muon kinematic selection - /// - /// e.g. pt>50e3 - public: - std::string muonKine; - - - /// \brief the tau definition - /// - /// e.g. tight, loose, default, none, etc. - public: - std::string tauDef; - - - /// \brief the tau kinematic selection - /// - /// e.g. pt>50e3 - public: - std::string tauKine; - - - /// \brief the jet definition - /// - /// e.g. antikt04, default, none, etc. - public: - std::string jetDef; - - - /// \brief the jet kinematic selection - /// - /// e.g. pt>50e3 - public: - std::string jetKine; - - - /// \brief the fat jet definition - /// - /// e.g. antikt10, default, none, etc. - public: - std::string fatJetDef; - - - /// \brief the fat jet kinematic selection - /// - /// e.g. pt>50e3 - public: - std::string fatJetKine; - - - /// \brief the met definition - /// - /// e.g. default, none, etc. - public: - std::string metDef; - - - /// \brief the second met definition - /// - /// This is so you can evaluate regular and track MET at the same - /// time. - public: - std::string met2Def; - - - /// \brief the overlap removal definition - /// - /// e.g. default, none, etc. - public: - std::string orDef; - - - /// \brief string that contains triggers used seperated by spaces - /// - /// e.g. "", "HLT_mu20_iloose_L1MU15", "HLT_mu20_iloose_L1MU15 HLT_e24_tight1_iloose" - public: - std::string triggerDef; - - - /// \brief the files with the vertex distribution in data - public: - std::vector<std::string> muDataFiles; - - - /// \brief the file with the vertex distribution for the current MC - public: - std::vector<std::string> muMcFiles; - - - /// \brief the scheduler to use - public: - std::string schedulerDef; - - - /// \brief the name of the selection decoration for the MET tool - public: - std::string selectionNameMET; - - - /// \brief the name of the selection decoration for the OR tool - public: - std::string selectionNameOR; - - - /// \brief the name of the selection decoration for the final - /// analysis objects - public: - std::string selectionName; - - - /// effects: standard default constructor - /// guarantee: strong - /// failures: out of memory I - public: - Configuration (); - - - /// effects: standard destructor - /// guarantee: no-fail - /// rationale: virtual destructor for base class - public: - virtual ~Configuration () {}; - - - /// effects: set the configuration to the given one - /// guarantee: basic - /// failures: out of memory II - /// rationale: this is essentially the standard assignment - /// operator, but I introduced it as an explicit function to - /// make it more clear what is happening and to avoid awkward - /// cast or using statements - public: - void setConfig (const Configuration& conf); - - - /// \brief declare the properties for the given object - /// \par Guarantee - /// basic - /// \par Failures - /// property declaration failures - public: - template<class T> void declareConfigProperties (T& obj); - }; -} - -#include <QuickAna/Configuration.icc> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/Configuration.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/Configuration.icc deleted file mode 100644 index acac469ab4692a795862cd9987f931068fade987..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/Configuration.icc +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -namespace ana -{ - template<class T> void Configuration :: - declareConfigProperties (T& obj) - { -#ifdef ROOTCORE - obj.declareProperty ("isDataFlag", isDataFlag, "flag to indicate whether we are running on data"); - obj.declareProperty ("isAFIIFlag", isAFIIFlag, "flag to indicate whether we are running on AFII MC"); -#endif - obj.declareProperty ("toolMsgLevel", msgLevel, "message level for internal tools"); - obj.declareProperty ("eventinfoDef", eventinfoDef, "event info object definition"); - obj.declareProperty ("eventSelectDef", eventSelectDef, "event select definition"); - obj.declareProperty ("electronDef", electronDef, "electron object definition"); - obj.declareProperty ("electronKine", electronKine, "electron kinematic selection"); - obj.declareProperty ("photonDef", photonDef, "photon object definition"); - obj.declareProperty ("photonKine", photonKine, "photon kinematic selection"); - obj.declareProperty ("muonDef", muonDef, "muon object definition"); - obj.declareProperty ("muonKine", muonKine, "muon kinematic selection"); - obj.declareProperty ("tauDef", tauDef, "tau object definition"); - obj.declareProperty ("tauKine", tauKine, "tau kinematic selection"); - obj.declareProperty ("jetDef", jetDef, "jet object definition"); - obj.declareProperty ("jetKine", jetKine, "jet kinematic selection"); - obj.declareProperty ("fatJetDef", fatJetDef, "fat jet object definition"); - obj.declareProperty ("fatJetKine", fatJetKine, "fat jet kinematic selection"); - obj.declareProperty ("metDef", metDef, "met definition"); - obj.declareProperty ("met2Def", met2Def, "second met definition"); - obj.declareProperty ("orDef", orDef, "overlap removal definition"); - obj.declareProperty ("triggerDef", triggerDef, "trigger definition"); - obj.declareProperty ("muDataFiles", muDataFiles, "the files with the mu distribution in data"); - obj.declareProperty ("muMcFiles", muMcFiles, "the files with the mu distribution in MC"); - obj.declareProperty ("schedulerDef", schedulerDef, "scheduler definition"); - obj.declareProperty ("selectionNameMET", selectionNameMET, "the name of the selection decoration for the MET tool"); - obj.declareProperty ("selectionNameOR", selectionNameOR, "the name of the selection decoration for the OR tool"); - obj.declareProperty ("selectionName", selectionName, "the name of the selection decoration for the final analysis objects"); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/DefinitionArgs.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/DefinitionArgs.h deleted file mode 100644 index a21f8e97034fc31f18a5d5ab8b029f9eed323d00..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/DefinitionArgs.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__DEFINITION_ARGS_H -#define QUICK_ANA__DEFINITION_ARGS_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaToolSequence.h> -#include <list> -#include <memory> -#include <string> - -namespace ana -{ - /// \brief the arguments passed into the makeXXX functions - /// - /// Object definitions are created via factory methods. In order to - /// make the interface of the factory methods stable it takes as an - /// argument a single object of this class. The class itself can - /// then be altered as the need for additional arguments to the - /// factory method arises. - /// - /// This is also used (partially filled) inside the definition maker - /// to pass around arguments. This is mostly to avoid lengthy - /// argument lists, particularly when they are passed through - /// multiple functions - - class DefinitionArgs - { - // - // public interface - // - - // not copyable - DefinitionArgs (const DefinitionArgs&) = delete; - DefinitionArgs& operator = (const DefinitionArgs&) = delete; - - - /// \brief check the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - DefinitionArgs (const std::string& val_prefix, - InternalConfiguration *val_configuration); - - - /// \brief standard move constructor - /// \par Guarantee - /// no-fail - public: - DefinitionArgs (DefinitionArgs&&) = default; - - - /// \brief make a clone of this definition (without the associated - /// tool sequence) - /// - /// I use this instead of the copy constructor to make it clear - /// that the tool sequence does not get copied. - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - DefinitionArgs cloneConf () const; - - - /// \brief the prefix to use for tools to be created - /// - /// tools need to have unique names, and this is the way to ensure - /// them. - /// \par Guarantee - /// no-fail - /// \post !result.empty() - public: - const std::string& prefix () const; - - - /// \brief add to the prefix - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - void addToPrefix (const std::string& extension); - - - /// \brief the internal configuration to use - /// \par Guarantee - /// no-fail - /// \post result != nullptr - public: - InternalConfiguration *configuration () const; - - - /// \brief whether this is the first working point for the object - /// definition - /// \par Guarantee - /// no-fail - public: - bool firstWP () const; - - /// \brief set the value of \ref firstWP - /// \par Guarantee - /// no-fail - public: - void setFirstWP (bool val_firstWP); - - - /// \brief add a new tool to the tool sequence - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - public: - void add (std::unique_ptr<IAnaTool> val_tool); - - - /// \brief whether the definition has been filled called to fill - /// the sequence - /// \par Guarantee - /// no-fail - public: - bool filled () const; - - - /// \brief extract the sequence created - /// \par Guarantee - /// no-fail - public: - AnaToolSequence&& extractSequence (); - - - - // - // private interface - // - - /// \brief the value of \ref prefix - private: - std::string m_prefix; - - /// \brief the value of \ref firstWP - private: - bool m_firstWP = true; - - /// \brief the value of \ref configuration - private: - InternalConfiguration *m_configuration; - - /// \brief the tool sequence defined - private: - AnaToolSequence m_sequence; - - - - // - // legacy interface - // - - /// \brief the object type we are creating this for - /// \par Guarantee - /// no-fail - public: - ObjectType type () const; - - /// \brief set the value of \ref type - /// \par Guarantee - /// no-fail - public: - void setType (ObjectType val_type); - - - /// \brief the name of the definition - /// \par Guarantee - /// no-fail - public: - const std::string& name () const; - - /// \brief set the value of \ref name - /// \par Guarantee - /// no-fail - public: - void setName (const std::string& val_name); - - - /// \brief members directly corresponding to accessors - private: - ObjectType m_type; - private: - std::string m_name; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/DefinitionConf.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/DefinitionConf.h deleted file mode 100644 index a9f70e1151e274c993579b596678625cee0fbb45..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/DefinitionConf.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__DEFINITION_CONF_H -#define QUICK_ANA__DEFINITION_CONF_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -#include <string> -#include <vector> - -namespace ana -{ - /// \brief the configuration information for an individual object - /// definition - /// - /// this is meant as a temporary until Steve's new configuration - /// mechanism is in place - - struct DefinitionConf - { - // - // public interface - // - - /// \brief make the tools from this definition - /// \par Guarantee - /// basic - /// \par Failures - /// tool creation failures - public: - StatusCode makeTools (const DefinitionArgs& args, - AnaToolSequence& sequence); - - - /// \brief the object type of this definition - /// \par Guarantee - /// no-fail - public: - ObjectType defType () const; - - /// \brief set the value of \ref defType - /// \par Guarantee - /// no-fail - public: - void setDefType (ObjectType val_defType); - - - /// \brief the name of the definition point - /// \sa wpName - /// \par Guarantee - /// no-fail - public: - const std::string& defName () const; - - /// \brief set the value of \ref defName - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - void setDefName (const std::string& val_defName); - - - /// \brief the name of the working point, or the empty string if - /// this is not a working point - /// - /// For now this is the same as \ref defName but some point this - /// should probably be split in two: One specifying the name of - /// the definition, the other the name of the decoration, so that - /// the user can use the same working point multiple times with - /// slightly different tool configurations. - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - std::string wpName () const; - - - /// \brief whether this is the first working point for this - /// definition - /// \par Guarantee - /// no-fail - public: - bool firstWP () const; - - /// \brief set the value of \ref firstWP - /// \par Guarantee - /// no-fail - public: - void setFirstWP (bool val_firstWP); - - - /// \brief whether we have multiple working points for this - /// definition - /// \par Guarantee - /// no-fail - public: - bool multiWP () const; - - /// \brief set the value of \ref multiWP - /// \par Guarantee - /// no-fail - public: - void setMultiWP (bool val_multiWP); - - - /// \brief make the configuration object for object definitions - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - static DefinitionConf - makeObjectDefinitionConf (ObjectType type, const std::string& name); - - - /// \brief make the configuration object for the IParticle common - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - static DefinitionConf - makeIParticleCommonConf (ObjectType type, - const std::vector<std::string>& workingPoints); - - - /// \brief make the configuration object for the kinematic selection - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - static DefinitionConf - makeKinSelectConf (ObjectType type, const std::string& kinSelect); - - - /// \brief make the configuration object for the EventSelect base tool - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - public: - static DefinitionConf - makeEventSelectBaseConf (); - - - /// \brief make the configuration object for the IsData tool - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - public: - static DefinitionConf - makeIsDataConf (); - - - /// \brief make the configuration object for the pileup - /// reweighting tool - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - static DefinitionConf - makePileupConf (const std::vector<std::string>& muDataFiles, - const std::vector<std::string>& muMcFiles); - - - /// \brief make the configuration list from the global - /// configuration - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - public: - static StatusCode - makeConfigList (std::vector<DefinitionConf>& confList, - const Configuration& config); - - - - // - // private interface - // - - /// \brief the value of \ref defType - private: - ObjectType m_defType = OBJECT_JET; - - /// \brief the value of \ref defName - private: - std::string m_defName; - - /// \brief the value of \ref firstWP - private: - bool m_firstWP = true; - - /// \brief the value of \ref multiWP - private: - bool m_multiWP = true; - - - /// \brief the different modes of configuration - /// - /// Didn't quite know how to call this. Essentially I want to be - /// able to create all tools in one go through a DefinitionConf - /// list. To do that, I need to have special modes for all the - /// tools that are not part of an object definition - /// - /// For a more sophisticated implementation this could potentially - /// be extended to use a class hierarchy here, or extend the - /// factory method from the object definitions. - private: - enum class Mode - { - /// \brief an actual object definition - OBJECT_DEFINITION, - - /// \brief the IParticle common definition - IPARTICLE_COMMON, - - /// \brief the KinSelect definition - KINSELECT, - - /// \brief the IsData definition - ISDATA, - - /// \brief the EventSelectBase definition - EVENTSELECTBASE, - - /// \brief the pileup definition - PILEUP - }; - - /// \brief the \ref Mode for this object - private: - Mode m_mode = Mode::OBJECT_DEFINITION; - - /// \brief the list of working point names for \ref - /// Mode::IPARTICLE_COMMON - private: - std::vector<std::string> m_wpNameList; - - /// \brief the kinematic selection string for \ref Mode::KINSELECT - private: - std::string m_kinSelect; - - /// \brief the data file for \ref Mode::PILEUP - private: - std::vector<std::string> m_muDataFiles; - - /// \brief the mc file for \ref Mode::PILEUP - private: - std::vector<std::string> m_muMcFiles; - - /// \brief make the IParticle-common tools - private: - StatusCode makeIParticleCommonTools (DefinitionArgs& args); - - /// \brief make the kinematic selection tool - private: - StatusCode makeKinSelectTool (DefinitionArgs& args); - - /// \brief make the IsData tool - private: - StatusCode makeIsDataTool (DefinitionArgs& args); - - /// \brief make the IsData tool - private: - StatusCode makeEventSelectBaseTool (DefinitionArgs& args); - - /// \brief make the Pileup tool - private: - StatusCode makePileupTool (DefinitionArgs& args); - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/DefinitionMaker.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/DefinitionMaker.h deleted file mode 100644 index 1d8f26311c69ad7dd27daf7000906f2ab4aeba1e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/DefinitionMaker.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__DEFINITION_MAKER_H -#define QUICK_ANA__DEFINITION_MAKER_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <functional> -#include <string> -#include <vector> - -class StatusCode; - -namespace ana -{ - /// \brief this object wraps the factory method that creates an - /// object definition - /// - /// Usually even the advanced user has nothing to do with this class - /// directly. The instances get instantiated and registered via the - /// various *DEFINITION_MAKER* macros. - - class DefinitionMaker - { - // - // static interface - // - - /// \brief add a new object definition - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - public: - static void addDefinition (DefinitionMaker val_definition); - - - /// \brief make a new definition - /// \brief Guarantee - /// basic - /// \brief Failures - /// out of memory III\n - /// no definitions matching the name\n - /// multiple definitions matching the name - public: - static StatusCode makeDefinition (DefinitionArgs& args); - - - /// effects: make all definitions from the configuration - /// guarantee: basic - /// failures: out of memory III - /// failures: invalid configuration - /// rationale: this is used to separate the tool generation - /// completely from the tool scheduler - public: - static StatusCode - makeDefinitions (const Configuration& config, - InternalConfiguration& internal, - const std::string& prefix, - std::vector<IAnaTool*>& tools); - - - // - // public interface - // - - /// \brief check the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// no-fail - public: - DefinitionMaker (ObjectType val_type, const std::string& val_name, - const std::function<StatusCode (DefinitionArgs&)>& val_function); - - - - // - // private interface - // - - /// \brief the object type for which this definition is defined - private: - ObjectType m_type; - - /// \brief the name of the object definition - private: - std::vector<std::string> m_names; - - /// \brief the actual factory method - private: - std::function<StatusCode (DefinitionArgs&)> m_function; - - - - // - // legacy interface - // - - /// \brief make a new definition, or do nothing - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory III - /// \par Failures - /// definition maker didn't do anything - /// \pre args.listSize() == 0 - private: - StatusCode - doMakeDefinition (DefinitionArgs& args, bool& foundName) const; - }; -} - -/// TODO: REALLY needs documentation -#define QUICK_ANA_DEFINITION_MAKER(type,name,call) \ - namespace { \ - int QUICK_ANA_JOIN_STR (quickAnaInit, __LINE__) () { \ - ::ana::DefinitionMaker::addDefinition (::ana::DefinitionMaker ((type), (name), [] (::ana::DefinitionArgs& args) {return (call);})); \ - return 0; } \ - int QUICK_ANA_JOIN_STR (quickAnaDummy, __LINE__) = QUICK_ANA_JOIN_STR (quickAnaInit, __LINE__) (); } - -#define QUICK_ANA_EVENTINFO_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_EVENTINFO, name, call) -#define QUICK_ANA_EVENT_SELECT_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_EVENT_SELECT, name, call) -#define QUICK_ANA_JET_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_JET, name, call) -#define QUICK_ANA_PHOTON_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_PHOTON, name, call) -#define QUICK_ANA_ELECTRON_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_ELECTRON, name, call) -#define QUICK_ANA_MUON_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_MUON, name, call) -#define QUICK_ANA_TAU_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_TAU, name, call) -#define QUICK_ANA_MET_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_MET, name, call) -#define QUICK_ANA_OR_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_OVERLAP_REMOVAL, name, call) -#define QUICK_ANA_TRIGGER_DEFINITION_MAKER(name,call) \ - QUICK_ANA_DEFINITION_MAKER (::ana::OBJECT_TRIGGER, name, call) - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ELExample.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ELExample.h deleted file mode 100644 index b773801281ed8dc49b301e24e1b1268bcd981303..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ELExample.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QuickAna_ELExample_H -#define QuickAna_ELExample_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - -#ifdef ROOTCORE - -#include <QuickAna/Global.h> - -#include <EventLoop/Algorithm.h> -#include <QuickAna/Configuration.h> -#include <memory> - -class TH1; - -namespace ana -{ - class ELExample : public EL::Algorithm, public ana::Configuration - { - /// description: the quickana tool handle - public: - std::unique_ptr<IQuickAna> quickAna; //! - - /// description: the histograms we create and fill - public: - TH1 *muon_n; //! - - - - // this is a standard constructor - ELExample (); - - // these are the functions inherited from Algorithm - virtual EL::StatusCode setupJob (EL::Job& job); - virtual EL::StatusCode fileExecute (); - virtual EL::StatusCode histInitialize (); - virtual EL::StatusCode changeInput (bool firstFile); - virtual EL::StatusCode initialize (); - virtual EL::StatusCode execute (); - virtual EL::StatusCode postExecute (); - virtual EL::StatusCode finalize (); - virtual EL::StatusCode histFinalize (); - - // this is needed to distribute the algorithm to the workers - ClassDef(ELExample, 1); - }; -} - -#endif - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ElectronTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ElectronTool.h deleted file mode 100644 index c7e8faed180ddaa6c28b50f157f169301b7b0476..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ElectronTool.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ELECTRON_TOOL_H -#define QUICK_ANA__ELECTRON_TOOL_H - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaToolCorrect.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/AnaToolSelect.h> -#include <QuickAna/AnaToolWeight.h> -#include <QuickAna/SelectionCut.h> -#include <QuickAna/xAODInclude.h> - -/// Forward declarations -class IAsgElectronIsEMSelector; -class IAsgElectronLikelihoodTool; -namespace CP{ - class IEgammaCalibrationAndSmearingTool; - class IIsolationSelectionTool; - class IIsolationCorrectionTool; -} -class IAsgElectronEfficiencyCorrectionTool; - -namespace ana -{ - /// @brief Tool for the pre-correction of electrons - /// - /// Applies corrections independent on systematics - /// - class ElectronToolPreCorrect : virtual public AnaToolCorrect<xAOD::ElectronContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS (ElectronToolPreCorrect, ana::IAnaTool) - - public: - // Public interface methods - - /// Standard constructor - ElectronToolPreCorrect (const std::string& name); - - /// \copydoc IAnaTool::step - public: - virtual AnalysisStep step () const override; - - /// Initialize this tool - StatusCode initialize() override; - - /// Run the correction on this event - virtual StatusCode - correctObject (xAOD::Electron& electron) override; - - private: - // CP tools - - /// The likelihood selection tool - asg::AnaToolHandle<IAsgElectronLikelihoodTool> m_likelihoodTool_loose; - asg::AnaToolHandle<IAsgElectronLikelihoodTool> m_likelihoodTool_medium; - asg::AnaToolHandle<IAsgElectronLikelihoodTool> m_likelihoodTool_tight; - }; - - - - /// @brief Tool for the correction of electrons - /// - /// Applies correction-related systematics as well - /// - class ElectronToolCorrect : virtual public AnaToolCorrect<xAOD::ElectronContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS (ElectronToolCorrect, ana::IAnaTool) - - public: - // Public interface methods - - /// Standard constructor - ElectronToolCorrect (const std::string& name); - - /// Initialize this tool - StatusCode initialize() override; - - /// Run the correction on this event - virtual StatusCode - correctObject (xAOD::Electron& electron) override; - - private: - // Configuration - - /// Is this AF2? - bool m_isAF2; - /// Is this data? - bool m_isData; - - // CP tools - - /// The calibration tool - asg::AnaToolHandle<CP::IEgammaCalibrationAndSmearingTool> m_calibration; - /// The CP isolation correction tool - asg::AnaToolHandle<CP::IIsolationCorrectionTool> m_isoCorrTool; - - SelectionCut cut_correction; - SelectionCut cut_isoCorr_tool; - }; - - - - /// @brief Tool for selection of analysis electrons - /// - /// Applies common electron selections - /// - class ElectronToolSelect : virtual public AnaToolSelect<xAOD::ElectronContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS (ElectronToolSelect, ana::IAnaTool) - - public: - // Public interface methods - - /// Standard constructor - ElectronToolSelect (const std::string& name); - - /// Initialize this tool - StatusCode initialize() override; - - /// Apply selection on this object - virtual StatusCode - selectObject (xAOD::Electron& electron) override; - - private: - - // Configuration - - /// The selection string - std::string m_idStr; - /// Minimum PT requirement - float m_ptMin; - /// Maximum |eta| requirement - float m_etaMax; - - /// Use isolation cut - bool m_isolationOn; - /// Isolation working point - std::string m_isolationWP; - - /// Use a different ID at analysis level - std::string m_idAna; - /// Apply looser impact parameter cuts - bool m_looseImpactCut; - - - // CP tools - - /// The isolation selection tool - asg::AnaToolHandle<CP::IIsolationSelectionTool> m_isolationTool; - - // the different cuts - SelectionCut cut_id; - SelectionCut cut_OQ; - SelectionCut cut_ptMin; - SelectionCut cut_clusEta; - SelectionCut cut_d0; - SelectionCut cut_z0; - SelectionCut cut_isolationTool; - SelectionCut cut_idAna; - }; - - - - /// @brief Tool for calculating weights for analysis electrons - /// - /// Applies the electron reco and ID efficiency scale factors - /// - class ElectronToolWeight : virtual public AnaToolWeight<xAOD::ElectronContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS (ElectronToolWeight, ana::IAnaTool) - - public: - // Public interface methods - - /// Standard constructor - ElectronToolWeight (const std::string& name); - - /// Initialize this tool - StatusCode initialize() override; - - /// Calculate the weight for this event - virtual StatusCode - objectWeight (const xAOD::Electron& elecron, float& weight) override; - - public: - // CP tools - - /// The efficiency correction tools - currently need one for each of - /// ID, reco, and trigger efficiencies. - asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> m_efficiencyTool_reco; - asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> m_efficiencyTool_id; - asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> m_efficiencyTool_iso; - - private: - // Configuration - - /// The selection string - std::string m_idStr; - /// The isolation WP - std::string m_isoStr; - /// Use tight ID at analysis level - std::string m_idAna; - /// Is this AF2? - bool m_isAF2; - }; - - - StatusCode makeElectronTool(DefinitionArgs& args, - const std::string& id, - const bool isolationOn = false, - const std::string& isolationWP = "Gradient", - const std::string& idAna = "", - const bool looseImpactCut=false); - -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventData.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventData.h deleted file mode 100644 index 1e608c2447eef68ede79bfb8dcb3bb9f2d21324d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventData.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__EVENT_DATA_H -#define QUICK_ANA__EVENT_DATA_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <PATInterfaces/SystematicSet.h> -#include <unordered_map> - -namespace ana -{ - /// \brief the list of all container names we put into the event - /// - /// This is meant to be used in several places: - /// - The output tool can use this to determine which containers it - /// has to write out - /// - If this structure is written out as part of the xAOD - /// meta-data, the user can use it to determine the content of a - /// file when reading it back, i.e. which object types and - /// systematics are contained and what containers to retrieve for - /// each. - /// - In a similar manner to reading a fully corrected xAOD file, - /// this would also allow users to run QuickAna in one algorithm - /// and then retrieve the QuickAna output from another algorithm. - /// - /// The interface here is probably going to change: For one thing I - /// want to phase out the ObjectType enum, so this will have to be - /// changed from ObjectType to string at some point in the future. - /// For another, it might be nice to provide a retrieve function as - /// well. Also, I probably need some functions to check which - /// containers and systematics are actually defined. And there may - /// be some changes as well to make this consistent with how xAOD - /// meta-data is used. - /// - /// For now this is just bolted on to the rest of the QuickAna - /// implementation, but the hope is that I can eventually integrate - /// this more closely into the rest of the implementation, which may - /// require some further changes. - - class EventData - { - // - // public interface - // - - /// \brief test the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// no-fail - public: - EventData (); - - - /// \brief get the list of object types available - /// - /// This is a set instead of a bit-map to make it easier to - /// migrate from ObjectType to std::string in the future. - /// \par Guarantee - /// no-fail - public: - const std::set<ObjectType>& getObjectTypes () const; - - - /// \brief get the list of systematics configured - /// \par Guarantee - /// no-fail - public: - const std::set<CP::SystematicSet>& getSystematics () const; - - - /// \brief get the name of the given collection for the given - /// systematic, or the empty string if that collection is not - /// defined. - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II\n - /// unknown systematic for the given collection - /// \pre unsigned (type) < EnumSize<ObjectType>::dataSize - public: - const std::string& - getName (ObjectType type, const CP::SystematicSet& sys) const; - - /// \brief set the name returned by \ref getName - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - /// \pre unsigned (type) < EnumSize<ObjectType>::dataSize - /// \pre !val_name.empty() - public: - void - setName (ObjectType type, const CP::SystematicSet& sys, - const std::string& val_name); - - /// \brief get the list of all unique names for one object type - /// \pre unsigned (type) < EnumSize<ObjectType>::dataSize - public: - std::vector<std::string> - getNames (ObjectType type) const; - - - /// \brief get the name of the original collection from which the - /// collection returned by \ref getName was copied - /// - /// This is for shallow copies only. This is just an empty string - /// if the given collection was not obtained by shallow-copying an - /// input container. - /// - /// This is meant solely for providing the output tool with all - /// the information it needs. ordinary users should not need to - /// access this information at all. - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II\n - /// unknown systematic for the given collection - /// \pre unsigned (type) < EnumSize<ObjectType>::dataSize - public: - const std::string& - getSourceName (ObjectType type, const CP::SystematicSet& sys) const; - - /// \brief set the name returned by \ref getName - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - /// \pre unsigned (type) < EnumSize<ObjectType>::dataSize - /// \pre !val_name.empty() - public: - void - setSourceName (ObjectType type, const CP::SystematicSet& sys, - const std::string& val_sourceName); - - /// \brief get the list of all unique source names for one object type - /// \pre unsigned (type) < EnumSize<ObjectType>::dataSize - public: - std::vector<std::string> - getSourceNames (ObjectType type) const; - - - - // - // private interface - // - - /// \brief the value of \ref getObjectTypes - private: - std::set<ObjectType> m_objectTypes; - - /// \brief the value of \ref getSystematics - private: - std::set<CP::SystematicSet> m_systematics; - - /// \brief the value of \ref getName - private: - std::unordered_map<CP::SystematicSet,std::string> m_names [EnumSize<ObjectType>::dataSize]; - - /// \brief the value of \ref getSourceName - private: - std::unordered_map<CP::SystematicSet,std::string> m_sourceNames [EnumSize<ObjectType>::dataSize]; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventInfoIsData.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventInfoIsData.h deleted file mode 100644 index 1cfa1f3c08501f942ad638d587ec27c18b644725..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventInfoIsData.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__EVENT_INFO_IS_DATA_H -#define QUICK_ANA__EVENT_INFO_IS_DATA_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> - -namespace ana -{ - /// \brief this tool checks whether the isData flag in the input - /// event matches the isData flag from configuration - - class EventInfoIsData : public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (EventInfoIsData, ana::IAnaTool) - - - /// \brief test the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - EventInfoIsData (const std::string& name, bool isData = false); - - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - public: - virtual StatusCode execute (IEventObjects& objects) override; - - - /// \copydoc IAnaTool::setObjectType - /// \sa IAnaTool::setObjectType - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - /// \copydoc IAnaTool::step - /// \sa IAnaTool::step - public: - virtual AnalysisStep step () const override; - - /// \copydoc IAnaTool::inputTypes - /// \sa IAnaTool::inputTypes - public: - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - /// \sa IAnaTool::outputTypes - public: - virtual unsigned outputTypes () const override; - - - - // - // private interface - // - - /// \brief whether we already checked one of the events - /// - /// for performance reasons we only check the first event, and - /// skip the rest - private: - bool m_checkedInput = false; - - /// \brief whether we expect this to be data - private: - bool m_isData = false; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventInfoTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventInfoTool.h deleted file mode 100644 index 514eb4ba74a36008816755d1e533352850499251..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventInfoTool.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__EVENTINFO_TOOL_H -#define QUICK_ANA__EVENTINFO_TOOL_H - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> - -namespace ana -{ - /// TODO: this class needs documentation - class EventInfoTool : public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (EventInfoTool, ana::IAnaTool) - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - EventInfoTool (const std::string& name); - - - /// \copydoc IAnaTool::setObjectType - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - public: - StatusCode initialize() override; - - - /// returns: the processing step we are working on - /// guarantee: no-fail - public: - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - public: - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - public: - virtual unsigned outputTypes () const override; - - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - public: - virtual StatusCode execute (IEventObjects& objects) override; - - - /// description: the EVENTINFO tool - public: - // - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventObjects.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventObjects.h deleted file mode 100644 index dcdb3f7e6948e2dc8ef82026731610c261b56fa4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventObjects.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__EVENT_OBJECTS_H -#define QUICK_ANA__EVENT_OBJECTS_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/IEventObjects.h> - -namespace ana -{ - class EventObjects : public IEventObjects - { - // - // public interface - // - - /// \brief standard constructor - /// \par Guarantee - /// no-fail - public: - EventObjects (); - - - /// \brief clear the content for the next event - /// \param store the store to use - /// \par Guarantee - /// no-fail - /// \pre store != nullptr - public: - void clear (StoreType *store, const std::string& postfix); - - - - // - // inherited interface - // - - /// \copydoc IEventObjects::getVoid - public: - virtual void *getVoid (ObjectType type) const override; - - /// \copydoc IEventObjects::addCopy - public: - virtual StatusCode addCopy (ObjectType type, const std::string& name) override; - - /// \copydoc IEventObjects::addNew - public: - virtual StatusCode addNew (ObjectType type) override; - - /// \copydoc IEventObjects::eventWeight - public: - virtual float eventWeight () const override; - - - - // - // private interface - // - - /// \brief the different objects returned by \ref getVoid - private: - void *m_objects [ObjectTypeInfo::numTypes]; - - /// \brief the value of \ref eventWeight - private: - float m_eventWeight; - - /// \brief the postfix for the current systematic - private: - std::string m_postfix; - - /// description: the TStore object we are using - private: - StoreType *m_store; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventSelectBaseTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventSelectBaseTool.h deleted file mode 100644 index 8573e1fc65d8459fd27b5324cffaa282636752fa..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventSelectBaseTool.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__EVENT_SELECT_BASE_TOOL_H -#define QUICK_ANA__EVENT_SELECT_BASE_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> -#include <QuickAna/SelectionData.h> - -namespace ana -{ - - /// @brief An AnaTool used to initialize the EventSelect object - /// - class EventSelectBaseTool : virtual public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (EventSelectBaseTool, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - EventSelectBaseTool (const std::string& name); - - /// \copydoc IAnaTool::setObjectType - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - /// returns: the processing step we are working on - /// guarantee: no-fail - virtual AnalysisStep step () const override; - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes () const override; - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes () const override; - - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) - override; - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode execute (IEventObjects& objects) override; - - /// \brief the selection fields - private: - std::vector<SG::AuxElement::Accessor<SelectType>> m_select; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventSelectHasVertex.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventSelectHasVertex.h deleted file mode 100644 index aa357d59491d00b49637514eba3cc930c41613c6..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/EventSelectHasVertex.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__EVENT_SELECT_HAS_VERTEX_H -#define QUICK_ANA__EVENT_SELECT_HAS_VERTEX_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> -#include <QuickAna/SelectionCut.h> -#include <QuickAna/SelectionData.h> - -namespace ana -{ - - /// @brief An AnaTool used to initialize the EventSelect object - /// - class EventSelectHasVertex : virtual public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (EventSelectHasVertex, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - EventSelectHasVertex (const std::string& name); - - StatusCode initialize() override; - - /// \copydoc IAnaTool::setObjectType - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) - override; - - /// returns: the processing step we are working on - /// guarantee: no-fail - virtual AnalysisStep step () const override; - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes () const override; - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes () const override; - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode execute (IEventObjects& objects) override; - - - /// \brief the selection data - private: - SelectionData m_selection; - - private: - SelectionCut cut_vertex; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/FatJetTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/FatJetTool.h deleted file mode 100644 index 8f9c30045000caa528cfcd0a788733c06b90ce87..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/FatJetTool.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__FAT_JET_TOOL_H -#define QUICK_ANA__FAT_JET_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaToolCorrect.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/AnaToolSelect.h> -#include <QuickAna/AnaToolWeight.h> -#include <QuickAna/SelectionCut.h> -#include <QuickAna/xAODInclude.h> - -class IJetCalibrationTool; -class ICPJetUncertaintiesTool; -class IJERTool; -class IJERSmearingTool; -class IJetSelector; -class IBTaggingEfficiencyTool; - -namespace ana -{ - /// TODO: this class needs documentation - class FatJetToolCorrect : public AnaToolCorrect<xAOD::JetContainer> - { - // - // public interface - // - - ASG_TOOL_CLASS (FatJetToolCorrect, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - FatJetToolCorrect (const std::string& name); - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - - /// effects: run the calibration on this event - /// returns: whether we accepted the event - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode - correctObject (xAOD::Jet& jet) override; - - private: - - /// description: the calibration tool - asg::AnaToolHandle<IJetCalibrationTool> m_calibration_tool; - - /// description: the uncertainties tool - asg::AnaToolHandle<ICPJetUncertaintiesTool> m_uncertainties_tool; - - /// description: the resolution tool - asg::AnaToolHandle<IJERTool> m_resolution_tool; - - /// description: the smearing tool - asg::AnaToolHandle<IJERSmearingTool> m_smearing_tool; - }; - - - - /// TODO: this class needs documentation - class FatJetToolSelect : public AnaToolSelect<xAOD::JetContainer> - { - // - // public interface - // - - ASG_TOOL_CLASS (FatJetToolSelect, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - FatJetToolSelect (const std::string& name); - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - - /// returns: whether the object passes object selection - /// guarantee: basic - /// failures: definition dependent - virtual StatusCode - selectObject (xAOD::Jet& jet) override; - - private: - - SelectionCut cut_eta; - SelectionCut cut_pt; - }; - - - - class FatJetToolWeight : public AnaToolWeight<xAOD::JetContainer> - { - // - // public interface - // - - ASG_TOOL_CLASS (FatJetToolWeight, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - FatJetToolWeight (const std::string& name); - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - - /// effects: calculate the weight for this event - /// returns: the calculated weight - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode - objectWeight (const xAOD::Jet& jet, float& weight) override; - - private: - - /// description: the b-tagging efficiency tool - // asg::AnaToolHandle<IBTaggingEfficiencyTool> m_btagging_eff_tool; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/Global.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/Global.h deleted file mode 100644 index b6405835c826d8a5285c19a710e89cf214f5cee9..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/Global.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__GLOBAL_H -#define QUICK_ANA__GLOBAL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -class StatusCode; - -#ifndef ROOTCORE -class StoreGateSvc; -#endif - -namespace asg -{ -#ifdef ROOTCORE - class SgTEvent; -#endif -} - -namespace xAOD -{ -#ifdef ROOTCORE - class TEvent; - class TStore; -#endif -} - -namespace CP -{ - class SystematicSet; -} - -namespace ana -{ - template<class T> struct EnumSize; - - - /// description: this enum contains the list of analysis steps that - /// are to be performed, in the order in which they are performed - enum AnalysisStep - { - /// description: retrieve the object from the file - STEP_RETRIEVE, - - /// \brief attach all the selection decorations to the objects - STEP_SELECT_INIT, - - /// \brief perform the pileup reweighting - STEP_PILEUP_REWEIGHT, - - /// \brief get the trigger decision and basic trig matching - STEP_TRIG_DECISION, - - /// description: apply "corrections" independent on systematics - // (like adding some aux data that's independent on systematics) - STEP_PRECORRECT, - - /// description: apply the basic object corrections - STEP_CORRECT, - - /// description: split the selection path for the different - /// working points - STEP_SPLIT_SELECT, - - /// description: apply the kinematic selection of objects - STEP_KINSELECT, - - /// description: apply the object specific selection of objects - STEP_SELECT, - - /// description: combine the selection from the multiple working - /// points into an overall selection - STEP_SUPER_SELECT, - - /// description: applying the overlap removal - STEP_OVERLAP_REMOVAL, - - /// description: applying trigger and trigger matching - STEP_TRIGGER, - - /// \brief spread out the result of the overlap removal to the - /// various working points - STEP_SPREAD_SELECT, - - /// description: apply the MET correction - STEP_MET, - - /// description: calculate the weight of the objects and the - /// overall event - STEP_WEIGHT, - - /// description: the actual analysis - STEP_ANALYSIS - }; - - /// \brief the various object types we have to deal with - enum ObjectType - { - OBJECT_EVENTINFO, - OBJECT_EVENT_SELECT, - OBJECT_JET, - OBJECT_FAT_JET, - OBJECT_ELECTRON, - OBJECT_PHOTON, - OBJECT_MUON, - OBJECT_TAU, - OBJECT_MET, - OBJECT_MET2, - OBJECT_OVERLAP_REMOVAL, - OBJECT_TRIGGER, - OBJECT_NONE - }; - - template<> struct EnumSize<ObjectType> - { - static const unsigned size = unsigned (OBJECT_NONE) + 1; - - /// \brief the number of object types that have actual objects - /// associated - static const unsigned dataSize = unsigned (OBJECT_OVERLAP_REMOVAL); - }; - - /// \brief the type used for accept/select decorations - typedef char SelectType; - - class AnaTool; - template<class XAODContainer> class AnaToolCorrect; - class AnaToolRetrieve; - template<class XAODContainer> class AnaToolSelect; - class AnaToolSelectAll; - class AnaToolSelectCombine; - class AnaToolSelectSpread; - class AnaToolSequence; - template<class XAODContainer> class AnaToolWeight; - struct Configuration; - class DefinitionArgs; - struct DefinitionConf; - class DefinitionMaker; - class EventData; - class EventObjects; - class IAnaTool; - class IEventObjects; - class IQuickAna; - class IToolScheduler; - class InternalConfiguration; - class IsolationBase; - class KinObjectSelect; - class KinSelectTool; - struct ObjectTypeInfo; - class OptimizedObjects; - class OptimizedScheduler; - class OptimizedStore; - class OptimizedTool; - class QuickAna; - enum class SelectionChoice; - class SelectionCut; - class SelectionData; - enum class SelectionStep; - class ToolScheduler; - - /// \brief the type of underlying store -#ifdef ROOTCORE - typedef asg::SgTEvent StoreType; -#else - typedef StoreGateSvc StoreType; -#endif - -#ifdef ROOTCORE - class ELExample; - class ValidationEL; - class ValidationHists; -#endif -} - -#define QUICK_ANA_JOIN_STR(a,b) QUICK_ANA_JOIN_STR_HIDDEN(a,b) -#define QUICK_ANA_JOIN_STR_HIDDEN(a,b) a ## b - - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/HZZElectronTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/HZZElectronTool.h deleted file mode 100644 index 9c020d211db594530c176c2d276f0077d5afa147..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/HZZElectronTool.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ZZ4l_MUON_TOOL_H -#define QUICK_ANA__ZZ4l_MUON_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -// #include <QuickAna/ElectronTool.h> - -#include <QuickAna/AnaToolSelect.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/SelectionCut.h> - -namespace CP -{ - class IIsolationSelectionTool; -} -class IAsgElectronLikelihoodTool; - -namespace WPType{ - enum { - _HZZ4l, - _SMZZ4l, - _ZHinv - }; -} - -namespace ana -{ - - class HZZElectronTool : public AnaToolSelect<xAOD::ElectronContainer> - { // added by Cong for ZZ4l - - ASG_TOOL_CLASS (HZZElectronTool, ana::IAnaTool) - - - public: - HZZElectronTool (const std::string& name); - - - public: - StatusCode initialize() override; - - - public: - virtual StatusCode - selectObject (xAOD::Electron& electron) override; - - public: - std::string m_selection; - int m_wp; - std::string m_isoStr; - - /// description: the selection tool - public: - asg::AnaToolHandle<IAsgElectronLikelihoodTool> m_selectionTool; - asg::AnaToolHandle<CP::IIsolationSelectionTool> m_isolationTool; - - private: - SelectionCut cut_Pt; - SelectionCut cut_Eta; - SelectionCut cut_OQ; - SelectionCut cut_selectionTool; - SelectionCut cut_Z0; - SelectionCut cut_D0; - SelectionCut cut_Iso; - }; - - StatusCode makeHZZElectronTool(DefinitionArgs& args, - const std::string& selection = "LooseLLH", - int WP = WPType::_HZZ4l, - const std::string& isolationWPString = "FixedCutLoose" ); - - - -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/HZZMuonTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/HZZMuonTool.h deleted file mode 100644 index 978962d32cfeae96bf996eb3d759d0432d4e7139..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/HZZMuonTool.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ZZ4l_MUON_TOOL_H -#define QUICK_ANA__ZZ4l_MUON_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -// #include <QuickAna/MuonTool.h> - -#include <QuickAna/AnaToolSelect.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/SelectionCut.h> - -namespace CP -{ - class IMuonSelectionTool; - class IIsolationSelectionTool; -} - -namespace WPType{ - enum { - _HZZ4l, - _SMZZ4l, - _ZHinv, - _Hmumu - }; -} - - -namespace ana -{ - - class HZZMuonTool : public AnaToolSelect<xAOD::MuonContainer> - { // added by Cong for ZZ4l - - ASG_TOOL_CLASS (HZZMuonTool, ana::IAnaTool) - - - public: - HZZMuonTool (const std::string& name); - - - public: - StatusCode initialize() override; - - - public: - virtual StatusCode - selectObject (xAOD::Muon& muon) override; - - public: - xAOD::Muon::Quality m_quality; - int m_wp; - std::string m_isoStr; - - /// description: the selection tool - public: - asg::AnaToolHandle<CP::IMuonSelectionTool> m_selection; - asg::AnaToolHandle<CP::IIsolationSelectionTool> m_isolationTool; - - private: - SelectionCut cut_ID; - SelectionCut cut_Pt; - SelectionCut cut_D0; - SelectionCut cut_Z0; - - SelectionCut cut_CB; - SelectionCut cut_Eta; - SelectionCut cut_Iso; - - }; - - StatusCode makeHZZMuonTool(DefinitionArgs& args, - const xAOD::Muon::Quality& quality=xAOD::Muon::Loose, - int WP = WPType::_HZZ4l, - const std::string& isolationWPString = "FixedCutLoose" ); - - - -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IAnaTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IAnaTool.h deleted file mode 100644 index de7671c3a8d5044c51e8ee6d373b6978a35b272d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IAnaTool.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__I_ANA_TOOL_H -#define QUICK_ANA__I_ANA_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <PATInterfaces/ISystematicsTool.h> - -namespace ana -{ - /// \brief The interface class for all the tools constituting object - /// definitions. - class IAnaTool : public CP::ISystematicsTool - { - // - // public interface - // - - ASG_TOOL_INTERFACE(IAnaTool) - - - /// \brief fill the initial configuration before initialize - /// - /// this is mostly used so that retrieval tools can broadcast the - /// input collections they are using - /// \par Guarantee - /// basic - /// \par Failures - /// tool dependent - public: - virtual StatusCode - getInitialConfiguration (InternalConfiguration& conf) = 0; - - - /// \brief use the initial configuration before initialize - /// - /// \par Guarantee - /// basic - /// \par Failures - /// tool dependent - public: - virtual StatusCode - useInitialConfiguration (const InternalConfiguration& conf) = 0; - - - /// \brief set the object type to work on - /// - /// this is called straight after the tool is created and before - /// it is initialized. the primary reason for this function is to - /// allow jet definitions to be used for either jets or fat jets. - /// \param type the object type we work on - /// \param workingPoint the name of the working point we are - /// working on or the empty string if this is a sole working - /// point or working points do not apply - /// \par Guarantee - /// strong - /// \par Failures - /// unsupported object type - /// \warn this interface may change when I introduce multiple - /// simultaneous working points - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) = 0; - - - /// \brief the processing step we are working on - /// \par Guarantee - /// no-fail - public: - virtual AnalysisStep step () const = 0; - - - /// \brief a bit-map indicating which object types we use - /// \par Guarantee - /// no-fail - public: - virtual unsigned inputTypes () const = 0; - - - /// \brief a bit-map indicating which output types we will create - /// \par Guarantee - /// no-fail - public: - virtual unsigned outputTypes () const = 0; - - - /// \brief fill the source component of the \ref EventData - /// - /// This is meant to be implemented by the retrieval tools that - /// perform the shallow copy to document what they do. All other - /// tools can safely ignore this. - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - public: - virtual void - fillEventDataSource (EventData& event) const = 0; - - - /// \brief extract whatever we need from the given configuration object - /// \par Guarantee - /// basic - /// \par Failures - /// tool failures - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) = 0; - - - /// \brief apply this analysis tool to the objects - /// \param objects the objects to apply this too - /// \par Guarantee - /// basic - /// \par Failures - /// tool dependent - public: - virtual StatusCode execute (IEventObjects& objects) = 0; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IEventObjects.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IEventObjects.h deleted file mode 100644 index 00e171867daefb789417cea6f2b78aca47224c3f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IEventObjects.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__I_EVENT_OBJECTS_H -#define QUICK_ANA__I_EVENT_OBJECTS_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/xAODInclude.h> -#include <QuickAna/xAODEventSelect.h> - -namespace ana -{ - /// \brief The interface class for accessing the correct event - /// objects. - /// - /// This is in essence a wrapper around StoreGate or TEvent/TStore, - /// using ObjectType to stand in for the name (and also implying the - /// type). - - class IEventObjects - { - // - // public interface - // - - /// \brief standard virtual destructor for base class - /// \par Guarantee - /// no-fail - public: - virtual ~IEventObjects () = default; - - - /// \brief the object or object container for the given object - /// type or NULL if it hasn't been filled (yet). - /// \par Guarantee - /// no-fail - public: - template<class T> T *get (ObjectType type) const; - - - /// \brief the object container as a \ref xAOD::IParticleContainer - /// \par Guarantee - /// strong - /// \par Failures - /// object type not of IParticle type - public: - xAOD::IParticleContainer *getParticles (ObjectType type); - - - /// \brief get the object or object container for the given object - /// type or NULL if it hasn't been filled (yet). - /// \par Guarantee - /// no-fail - /// \warn this has to be cast exactly to the type defined by \ref - /// ObjecTypeInfo::asXAOD. it is much easier to go with the - /// \ref get function instead. - public: - virtual void *getVoid (ObjectType type) const = 0; - - - /// \brief add a shallow copy of the input container with the - /// given name - /// \par Guarantee - /// basic - /// \par Failures - /// object already initialized\n - /// input object not found\n - /// shallow copy failures - public: - virtual StatusCode addCopy (ObjectType type, const std::string& name) = 0; - - - /// \brief add a new container of the given type - /// \par Guarantee - /// basic - /// \par Failures - /// object already initialized\n - /// object creation failures - public: - virtual StatusCode addNew (ObjectType type) = 0; - - - /// \brief the event weight - /// - /// \warn this is a dummy for now and the mechanism might change - /// at some point - public: - virtual float eventWeight () const = 0; - - - /// \brief the eventinfo object - /// \par Guarantee - /// no-fail - public: - xAOD::EventInfo *eventinfo () const; - - - /// \brief the eventinfo object - /// \par Guarantee - /// no-fail - public: - EventSelectType *eventSelect () const; - - - /// \brief the muon container - /// \par Guarantee - /// no-fail - public: - xAOD::MuonContainer *muons () const; - - - /// \brief the tau container - /// \par Guarantee - /// no-fail - public: - xAOD::TauJetContainer *taus () const; - - - /// \brief the electron container - /// \par Guarantee - /// no-fail - public: - xAOD::ElectronContainer *electrons () const; - - - /// \brief the photon container - /// \par Guarantee - /// no-fail - public: - xAOD::PhotonContainer *photons () const; - - - /// \brief the jet container - /// \par Guarantee - /// no-fail - public: - xAOD::JetContainer *jets () const; - - - /// \brief the fat jet container - /// \par Guarantee - /// no-fail - public: - xAOD::JetContainer *fat_jets () const; - - - /// \brief the met container - /// \par Guarantee - /// no-fail - public: - xAOD::MissingETContainer *met () const; - - - /// \brief the met container - /// \par Guarantee - /// no-fail - public: - xAOD::MissingETContainer *met2 () const; - }; -} - -#include <QuickAna/IEventObjects.icc> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IEventObjects.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IEventObjects.icc deleted file mode 100644 index ad04ae5e0c5e852b45d7c1a8317b919b3c2e0a02..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IEventObjects.icc +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <QuickAna/ObjectTypeInfo.h> -#include <RootCoreUtils/ThrowMsg.h> - -namespace ana -{ - template<class T> T *IEventObjects :: - get (ObjectType type) const - { - if (!(ObjectTypeInfo::fromXAOD<T>::support & (1 << type))) - RCU_THROW_MSG ("unsupported xAOD type for object type"); - return static_cast<T*> (getVoid (type)); - } - - - - inline xAOD::EventInfo *IEventObjects :: - eventinfo () const - { - return get<xAOD::EventInfo> (OBJECT_EVENTINFO); - } - - - - inline EventSelectType *IEventObjects :: - eventSelect () const - { - return get<xAOD::EventInfo> (OBJECT_EVENT_SELECT); - } - - - inline xAOD::MuonContainer *IEventObjects :: - muons () const - { - return get<xAOD::MuonContainer> (OBJECT_MUON); - } - - - - inline xAOD::TauJetContainer *IEventObjects :: - taus () const - { - return get<xAOD::TauJetContainer> (OBJECT_TAU); - } - - - - inline xAOD::ElectronContainer *IEventObjects :: - electrons () const - { - return get<xAOD::ElectronContainer> (OBJECT_ELECTRON); - } - - - - inline xAOD::PhotonContainer *IEventObjects :: - photons () const - { - return get<xAOD::PhotonContainer> (OBJECT_PHOTON); - } - - - - inline xAOD::JetContainer *IEventObjects :: - jets () const - { - return get<xAOD::JetContainer> (OBJECT_JET); - } - - - - inline xAOD::JetContainer *IEventObjects :: - fat_jets () const - { - return get<xAOD::JetContainer> (OBJECT_FAT_JET); - } - - - - inline xAOD::MissingETContainer *IEventObjects :: - met () const - { - return get<xAOD::MissingETContainer> (OBJECT_MET); - } - - - - inline xAOD::MissingETContainer *IEventObjects :: - met2 () const - { - return get<xAOD::MissingETContainer> (OBJECT_MET2); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IOutputTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IOutputTool.h deleted file mode 100644 index 6bc47ee0f36b73fac3ea06cead2b4d545135b353..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IOutputTool.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__I_OUTPUT_TOOL_H -#define QUICK_ANA__I_OUTPUT_TOOL_H - -#include <QuickAna/Global.h> - -#include <AsgTools/IAsgTool.h> - -namespace ana -{ - - /// @class IOutputTool - /// @brief Interface for tools that write persistent objects. - /// - /// The persistent format could be an xAOD file, a flat ntuple, etc. - /// - /// @author Steve Farrell <Steven.Farrell.cern.ch> - /// - class IOutputTool : virtual public asg::IAsgTool - { - - /// Interface declaration - ASG_TOOL_INTERFACE(IOutputTool) - - public: - - /// Virtual destructor - virtual ~IOutputTool(){}; - - /// Write the configured containers to the output. - virtual StatusCode write() = 0; - - }; // class IOutputTool - - - /// Common tool interface class for tools that write containers to - /// a persistent output format. That format could be an xAOD file, - /// a flat ntuple, etc. - /// - /// The write method (for now) accepts a suffix, which would be used - /// to specify the systematic-dependent container names, typically with - /// a basename specified via configuration. - /// - /// This interface is still subject to change. - /// - class IOutputToolOld : virtual public asg::IAsgTool - { - - /// Interface declaration - ASG_TOOL_INTERFACE(IOutputToolOld) - - public: - - /// Virtual destructor - virtual ~IOutputToolOld(){}; - - /// Write the configured containers to the output. - virtual StatusCode write(xAOD::TEvent* outputStore, - const std::string& suffix = "") = 0; - - }; // class IOutputToolOld - -} // namespace ana - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IQuickAna.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IQuickAna.h deleted file mode 100644 index 4f490a9ffeec7aef1f248d9709707185c3f9d6b8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IQuickAna.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__I_QUICK_ANA_H -#define QUICK_ANA__I_QUICK_ANA_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <PATInterfaces/ISystematicsTool.h> -#include <QuickAna/xAODInclude.h> - -namespace ana -{ - class IQuickAna : public CP::ISystematicsTool - { - // - // public interface - // - - // ASG_TOOL_INTERFACE(IQuickAna) - - /// effects: process the current event - /// guarantee: basic - public: - virtual StatusCode process () = 0; - - - /// effects: process the given event - /// guarantee: basic - public: -#ifdef ROOTCORE - StatusCode process (xAOD::TEvent& event); -#endif - - - /// effects: calculate the weight for this event - /// returns: the calculated weight - /// guarantee: basic - /// failures: tool dependent - public: - virtual float weight () = 0; - - - /// description: the weight for the event (without object weights) - /// guarantee: no-fail - public: - virtual float eventWeight () = 0; - - - /// description the overall object structure - /// guarantee: no-fail - public: - virtual const IEventObjects& objects () const = 0; - - - /// \brief get the internal configuration structure - public: - virtual const InternalConfiguration& internalConfiguration () = 0; - - - /// description: the various object collections we are using, or - /// NULL if they are disabled - /// guarantee: no-fail - public: - //virtual xAOD::EventInfoContainer* eventinfo () const = 0; - virtual xAOD::EventInfo* eventinfo () const = 0; - virtual xAOD::MuonContainer* muons () const = 0; - virtual xAOD::ElectronContainer* electrons () const = 0; - virtual xAOD::PhotonContainer* photons () const = 0; - virtual xAOD::TauJetContainer* taus () const = 0; - virtual xAOD::JetContainer* jets () const = 0; - virtual xAOD::JetContainer* fat_jets () const = 0; - virtual xAOD::MissingET* met () const = 0; - virtual xAOD::MissingET* met2 () const = 0; - - - /// \brief the list of systematics configured - /// \par Guarantee - /// no-fail - /// \pre initialize() has been called - public: - virtual const std::vector<CP::SystematicSet>& systematics () const = 0; - - - /// \brief set the value of \ref systematics - /// \par Guarantee - /// basic - /// \par Failures - /// systematics configuration error - /// \pre initialize() has been called - public: - virtual StatusCode - setSystematics (const std::vector<CP::SystematicSet>& val_systematics) = 0; - - - /// \brief make an EventData object describing the objects created - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - virtual EventData getEventData () const = 0; - }; -} - -#include <QuickAna/IQuickAna.icc> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IQuickAna.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IQuickAna.icc deleted file mode 100644 index be3131600c59dd06d116a1735a24afe79551e7f7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IQuickAna.icc +++ /dev/null @@ -1,14 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -namespace ana -{ -#ifdef ROOTCORE - inline StatusCode IQuickAna :: - process (xAOD::TEvent& /*event*/) - { - return process (); - } -#endif -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IToolScheduler.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IToolScheduler.h deleted file mode 100644 index c3486019c18cfa7e1f3e703c0c678db3340f4f7a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IToolScheduler.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__I_TOOL_SCHEDULER_H -#define QUICK_ANA__I_TOOL_SCHEDULER_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <AsgTools/IAsgTool.h> -#include <vector> -#include <memory> - -namespace CP -{ - class SystematicSet; -} - -namespace ana -{ - /// TODO: needs documentation - class IToolScheduler : virtual public asg::IAsgTool - { - // - // public interface - // - - ASG_TOOL_INTERFACE(IToolScheduler) - - - /// effects: add all the tools from the configuration - /// guarantee: basic - /// failures: tool creation errors - /// failures: out of memory III - public: - StatusCode addTools (const Configuration& conf, InternalConfiguration& internal, - const std::string& prefix); - - /// effects: add another tool to the scheduler - /// guarantee: strong - /// failures: out of memory I - public: - virtual StatusCode addTool (std::unique_ptr<IAnaTool> tool) = 0; - - /// returns: the list of all systematics the tools can be affected by - /// guarantee: strong - /// failures: out of memory II - public: - virtual CP::SystematicSet affectingSystematics () const = 0; - - /// returns: the list of all systematics the tools recommend to use - /// guarantee: strong - /// failures: out of memory II - public: - virtual CP::SystematicSet recommendedSystematics() const = 0; - - /// effects: configure this tool for the given list of systematic - /// variations. any requested systematics that are not - /// affecting this tool will be silently ignored (unless they - /// cause other errors). - /// guarantee: basic - /// failures: tool specific - public: - virtual StatusCode - applySystematicVariation (const CP::SystematicSet& systConfig) = 0; - - /// effects: fill the event objects structure with the fully - /// corrected objects for the current systematics - /// guarantee: basic - /// failures: tool specific - /// warning: this should only be called once per event - public: - virtual StatusCode - fillEventObjects (IEventObjects*& object) = 0; - - /// \brief the list of systematics configured - /// \par Guarantee - /// no-fail - /// \pre initialize() has been called - public: - virtual const std::vector<CP::SystematicSet>& systematics () const = 0; - - /// \brief set the value of \ref systematics - /// \par Guarantee - /// basic - /// \par Failures - /// systematics configuration error - /// \pre initialize() has been called - public: - virtual StatusCode - setSystematics (const std::vector<CP::SystematicSet>& val_systematics) = 0; - - - /// \brief make an EventData object describing the objects created - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - virtual EventData getEventData () const = 0; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/InternalConfiguration.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/InternalConfiguration.h deleted file mode 100644 index ec42b2c9ffe4ce9583f220af2b28dee23834913b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/InternalConfiguration.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__INTERNAL_CONFIGURATION_H -#define QUICK_ANA__INTERNAL_CONFIGURATION_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -#include <QuickAna/SelectionStep.h> -#include <AsgTools/MsgLevel.h> -#include <string> -#include <vector> - -namespace ana -{ - /// \brief This structure holds internal configuration information, - /// based on the overall QuickAna configuration as well as the - /// configuration of the individual tools/objects. - - class InternalConfiguration - { - // - // public interface - // - - /// \brief fetch the configuration options from the global - /// configuration - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - public: - void fetchConfiguration (const Configuration& conf); - - - /// \brief whether we are running on data - /// \par Guarantee - /// no-fail - public: - bool isData () const; - - - /// \brief whether we are running on AFII MC - /// \par Guarantee - /// no-fail - public: - bool isAFII () const; - - - /// \brief is MET being configured? - public: - bool doingMET() const - { return m_doingMet; } - - /// \brief get the list of LumiCalc files - public: - const std::vector<std::string>& muDataFiles() const - { return m_muDataFiles; } - - /// \brief global message level for QuickAna internal tools - /// \par Guarantee - /// no-fail - public: - MSG::Level msgLevel() const; - - - /// \brief what electron WP is the key one (for SFs) - /// \par Guarantee - /// no-fail - public: - std::string electronWP () const; - std::string electronIsolationWP () const; - void setElectronWP(std::string WP); - void setElectronIsolationWP(std::string WP); - - /// \brief what muon WP is the key one (for SFs) - /// \par Guarantee - /// no-fail - public: - std::string muonWP () const; - std::string muonIsolationWP () const; - void setMuonWP(std::string WP); - void setMuonIsolationWP(std::string WP); - - - /// \brief the names of the decorations for the different - /// selection stages. - /// - /// this is set from the global configuration object. - /// \par Guarantee - /// no-fail - public: - const std::string& selectionName (SelectionStep step) const; - - - /// \brief the input container name for the given object type - /// - /// this is used for the output tool, as well as to communicate - /// the jet collection used to the MET tool - /// \par Guarantee - /// no-fail - public: - const std::string& inputName (ObjectType type) const; - - /// \brief set the value of \ref inputName - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II\n - /// inputName already set\n - /// object type does not correspond to actual objects - public: - void setInputName (ObjectType type, const std::string& val_inputName); - - - private: - // - // private interface - // - - /// \brief the value of \ref isData - bool m_isData; - - /// \brief the value of \ref isAFII - bool m_isAFII; - - /// \brief whether MET is configured in current job - bool m_doingMet; - - /// \brief the LumicCalc muDataFiles for luminosity fractions. - /// Currently used by the PileupReweightTool in the muon SF tools. - std::vector<std::string> m_muDataFiles; - - /// \brief global tool output level - MSG::Level m_msgLevel; - - /// \brief the value of \ref ElectronWP - std::string m_eleWP; - - /// \brief the value of \ref ElectronIsolationWP - std::string m_eleIsoWP; - - /// \brief the value of \ref MuonWP - std::string m_muonWP; - - /// \brief the value of \ref MuonIsolationWP - std::string m_muonIsoWP; - - /// \brief the value of \ref selectionName - std::string m_selectionName [EnumSize<SelectionStep>::dataSize]; - - /// \brief the value of \ref inputName - std::string m_inputName [EnumSize<ObjectType>::size]; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IsolationTools.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IsolationTools.h deleted file mode 100644 index 345d347b0bfbf55b5e152d328968444473bf232a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/IsolationTools.h +++ /dev/null @@ -1,246 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__ISOLATIONTOOLS_H_ -#define QUICK_ANA__ISOLATIONTOOLS_H_ - -#include <QuickAna/Global.h> - -#include <IsolationSelection/IsolationSelectionTool.h> - -// Note: just a copy of the class in TopObjectSelectionTools, with minimal edits -// -- Used for now to conveniently replicate the top group selections -// -- We can of course design something better later -// Note: copied from TopObjectSelection-00-00- and then updated independently -// -- Will probably get rid of this pretty soon - -namespace ana { - -/** - * @brief A common base for implementing isolation cuts. Probably these - * isolation tools should be in individual files? Time will tell. - */ -class IsolationBase { -public: - ///Create - IsolationBase(); - - ///Destroy! - virtual ~IsolationBase(); - - /** - * @brief For applying isolation cuts to the analysis (tight) lepton. - * - * Note that you must implement this otherwise it wont compile. Ha. - * - * @param p The lepton - * @return True if it passes the isolation cuts, false otherwise. - */ - virtual bool passSelection(const xAOD::IParticle& p) const = 0; - - /** - * @brief For applying loose isolation cuts to the loose lepton. - * - * Note that you must implement this otherwise it wont compile. Ha. - * - * @param p The lepton - * @return True if it passes the isolation cuts, false otherwise. - */ - virtual bool passSelectionLoose(const xAOD::IParticle& p) const = 0; - - /** - * @brief Because people like to know what isolation cuts they're applying. - * - * @param os Where to print things to, e.g. cout. - */ - virtual void print(std::ostream& os) const = 0; -}; - -/** - * @brief These should give you access to xAOD::Iso::topoetcone20, 30, 40 - * and ptcone20, 30, 40 - * - * They are only correct in the derivations, they will be wrong in the primary - * xAOD. - * - * It performs an absolute cut on the quantity you specify. If you need more - * fancy things, we should implement them. Don't you want to look at using - * RelativePTVarCone instead though? - */ -class AbsoluteIsolationDC14 : public IsolationBase { -public: - /** - * @brief Absolute cut on topoetcone or ptcone. - * - * Construct with something like: - * - * @code - * new IsolationDC14(xAOD::Iso::topoetcone20, 5000.) - * @endcode - * - * We didn't bother implementing the loose selection yet. I left that as - * an exercise for the reader. - * - * @param type I think xAOD::Iso::topoetcone20, 30, 40 and ptcone20, 30, 40 - * are allowed. - * @param value A number in MeV. - */ - AbsoluteIsolationDC14(const xAOD::Iso::IsolationType type, double value); - bool passSelection(const xAOD::IParticle& p) const override final; - bool passSelectionLoose(const xAOD::IParticle& p) const override final; - void print(std::ostream& os) const override final; - -private: - ///What to cut on (topoetcone20, 30, 40 or ptcone20, 30, 40). - xAOD::Iso::IsolationType m_type; - - ///The value, in MeV, to cut. - double m_cutvalue; -}; - -/** - * @brief Yay DC14 now has isolation! This should allow you to cut on the - * isolation (ptvarcone) as a fraction of the pt of the lepton. - */ -class RelativePTVarCone : public IsolationBase { -public: - /** - * @brief Cut on the mini-isolation (aka ptvarcone) as a fraction of the - * pt of the lepton. - * - * @param size Cone size (*10). i.e. 20, 30, 40 for the analysis - * @param fraction For the tight (analysis) leptons - * @param sizeLoose Cone size for the loose lepton definition - * @param fractionLoose Fraction for the loose lepton definition - */ - RelativePTVarCone(unsigned int size, double fraction, unsigned int sizeLoose, double fractionLoose); - - /** - * @brief Does this particle pass the isolation cuts for the main analysis - * definitions? - * - * @param p Particle that we're worried about. - * @return True if it passes the isolation cuts. - */ - bool passSelection(const xAOD::IParticle& p) const override final; - - /** - * @brief Does this particle pass the isolation cuts for the loose analysis - * definitions (useful for background estimates)? - * - * @param p Particle that we're worried about. - * @return True if it passes the isolation cuts. - */ - bool passSelectionLoose(const xAOD::IParticle& p) const override final; - - ///Come on, you really need me to tell you what this does? - void print(std::ostream& os) const override final; - -private: - ///The name of the variable to access, e.g. ptvarcone20 formed in the constructor. - std::string m_size; - - ///For the main analysis object selection - double m_fraction; - - ///Name of the variable to access for the loose object definition - std::string m_sizeLoose; - - ///For the objects used in the looser object selection (e.g. matrix method fakes) - double m_fractionLoose; -}; - -/** - * @brief Danilo's approximation of mini-isolation which has been calculated - * in AnalysisTop and applied as a decoration to the objects. - * - * This gave you something to work with before the DC14 derivations included - * isolation (which they should by the time you read this). Probably other - * options will be better, and almost certainly faster if we don't need to load - * all the tracks! - */ -class ApproxPTVarCone : public IsolationBase { -public: - /** - * @brief An approximation of mini-isolation. - * - * This applies some sort of fractional cut to mini-iso / particle pT. - * - * @param fraction For the tight (analysis) leptons - * @param fractionLoose For leptons that will be used in the background - * estimate. - */ - ApproxPTVarCone(double fraction, double fractionLoose); - - /** - * @brief Does this particle pass the isolation cuts for the main analysis - * definitions? - * - * @param p Particle that we're worried about. - * @return True if it passes the isolation cuts. - */ - bool passSelection(const xAOD::IParticle& p) const override final; - - /** - * @brief Does this particle pass the isolation cuts for the loose analysis - * definitions (useful for background estimates)? - * - * @param p Particle that we're worried about. - * @return True if it passes the isolation cuts. - */ - bool passSelectionLoose(const xAOD::IParticle& p) const override final; - - ///Come on, you really need me to tell you what this does? - void print(std::ostream& os) const override final; - -private: - ///For the main analysis object selection - double m_fraction; - - ///For the objects used in the looser object selection (e.g. matrix method fakes) - double m_fractionLoose; -}; - -/** - * @brief Apply the cuts to etcone and ptcone like we used to in Run-I - */ -class StandardIsolation : public IsolationBase { -public: - /** - * @brief Applies the cuts to etcone and ptcone like we used to in Run-I - * - * This sets up the isolation tool and configures it with the cuts. - */ - StandardIsolation(const std::string& obj_type_str); - - /** - * @brief Does this particle pass the isolation cuts for the main analysis - * definitions? - * - * @param p Particle that we're worried about. - * @return True if it passes the isolation cuts. - */ - bool passSelection(const xAOD::IParticle& p) const override final; - - /** - * @brief Does this particle pass the isolation cuts for the loose analysis - * definitions (useful for background estimates)? - * - * @param p Particle that we're worried about. - * @return True if it passes the isolation cuts. - */ - bool passSelectionLoose(const xAOD::IParticle& p) const override final; - - ///Come on, you really need me to tell you what this does? - virtual void print(std::ostream& os) const override final; - -private: - ///Official isolation tool - CP::IsolationSelectionTool m_isolationTool; - CP::IsolationSelectionTool m_isolationToolLoose; -}; - -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/JetTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/JetTool.h deleted file mode 100644 index 70a5fb429477b2f29104c1b5cab59a5c3e0af7d7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/JetTool.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__JET_TOOL_H -#define QUICK_ANA__JET_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaToolCorrect.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/AnaToolSelect.h> -#include <QuickAna/AnaToolWeight.h> -#include <QuickAna/SelectionCut.h> - -// Forward declarations -class IJetCalibrationTool; -class ICPJetUncertaintiesTool; -class IJERTool; -class IJERSmearingTool; -class IJetSelector; -class IBTaggingEfficiencyTool; -class IBTaggingSelectionTool; -class IJetUpdateJvt; - -namespace CP { - class IJetJvtEfficiency; -} - -namespace ana -{ - - /// @class JetToolCorrect - /// @brief QuickAna tool for applying CP corrections to jets - /// - class JetToolCorrect : public AnaToolCorrect<xAOD::JetContainer> - { - - ASG_TOOL_CLASS (JetToolCorrect, ana::IAnaTool) - - public: - // - // public interface - // - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - JetToolCorrect (const std::string& name); - - /// \copydoc IAnaTool::useInitialConfiguration - virtual StatusCode - useInitialConfiguration (const InternalConfiguration& conf) override; - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - /// effects: run the calibration on this event - /// returns: whether we accepted the event - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode - correctObject (xAOD::Jet& jet) override; - - private: - /// @name CP tool handles - /// @{ - - /// description: the calibration tool - asg::AnaToolHandle<IJetCalibrationTool> m_calibration_tool; - - /// description: the uncertainties tool - asg::AnaToolHandle<ICPJetUncertaintiesTool> m_uncertainties_tool; - - /// description: the resolution tool - asg::AnaToolHandle<IJERTool> m_resolution_tool; - - /// description: the smearing tool - asg::AnaToolHandle<IJERSmearingTool> m_smearing_tool; - - /// description: the JVT recalculation tool - asg::AnaToolHandle<IJetUpdateJvt> m_jvt_tool; - - /// The JVT efficiency tool - asg::AnaToolHandle<CP::IJetJvtEfficiency> m_jvtEffTool; - - /// description: the b-tagged jet selection tool - asg::AnaToolHandle<IBTaggingSelectionTool> m_bsel_tool; - asg::AnaToolHandle<IBTaggingSelectionTool> m_bsel_OR_tool; - - /// description: the cleaning tool - asg::AnaToolHandle<IJetSelector> m_cleaning_tool; - - /// @} - - private: - /// @name Configurations set from InternalConfiguration - /// @{ - - /// \brief whether we run on data - bool m_isData = false; - /// \brief whether we run on AFII MC - bool m_isAFII = false; - /// \brief the name of the jet container - std::string m_jetContainer; - - /// @} - - private: - /// @name Configuration tool properties - /// @{ - - /// Master switch to enable/disable all b-tagging - bool m_enableBTagging; - /// B-tag algorithm - std::string m_btagger; - /// B-tag working point - std::string m_btagWP; - /// Optional b-tag working point specifically for overlap removal - std::string m_btagWP_OR; - - /// @} - - private: - /// @name Cutflow bookkeeping - /// @{ - SelectionCut cut_calibration_tool; - SelectionCut cut_uncertainties_tool; - SelectionCut cut_smearing_tool; - SelectionCut cut_cleaning_tool; - /// @} - }; - - - - /// @class JetToolSelect - /// @brief QuickAna tool for applying standard selections to jets - /// - class JetToolSelect : public AnaToolSelect<xAOD::JetContainer> - { - - ASG_TOOL_CLASS (JetToolSelect, ana::IAnaTool) - - public: - // - // public interface - // - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - JetToolSelect (const std::string& name); - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - /// returns: whether the object passes object selection - /// guarantee: basic - /// failures: definition dependent - virtual StatusCode - selectObject (xAOD::Jet& jet) override; - - public: - /// @name Configurations -- public memebers - /// @todo stop using public config members. - /// @{ - - ///\brief At what step should the JVT cut be applied? - SelectionStep m_jvt_cut_step; - - /// @} - - private: - /// @name Cutflow bookkeeping - /// @{ - SelectionCut cut_jvt; - /// @} - }; - - - - /// @class JetToolWeight - /// @brief QuickAna tool for applying CP scale factors to jets. - /// - class JetToolWeight : public AnaToolWeight<xAOD::JetContainer> - { - - ASG_TOOL_CLASS (JetToolWeight, ana::IAnaTool) - - public: - // - // public interface - // - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - JetToolWeight (const std::string& name); - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes () const override; - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes () const override; - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - /// \copydoc IAnaTool::execute - /// Required to implement an event weight - virtual StatusCode execute (IEventObjects& objects) override; - - /// effects: calculate the weight for this event - /// returns: the calculated weight - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode - objectWeight (const xAOD::Jet& jet, float& weight) override; - - private: - /// @name CP tool handles - /// @{ - - /// description: the b-tagging efficiency tool - asg::AnaToolHandle<IBTaggingEfficiencyTool> m_btagging_eff_tool; - - /// The JVT efficiency tool - asg::AnaToolHandle<CP::IJetJvtEfficiency> m_jvtEffTool; - - /// @} - - private: - /// @name Configurations -- tool properties - /// @{ - SG::AuxElement::ConstAccessor<SelectType> m_anaSelect; - SG::AuxElement::Accessor<float> m_anaWeight; - - /// B-tagger and working point - std::string m_btagger; - std::string m_btagWP; - - /// @} - }; - - - - // Maker function for jet tools - StatusCode makeJetTool (DefinitionArgs& args, - const std::string& collection, - const SelectionStep& jvt_step=SelectionStep::MET, - const std::string& btagWP=""); -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/KinObjectSelect.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/KinObjectSelect.h deleted file mode 100644 index 0d43fadb0fb63f1e3f9b5605e576f64ec2990001..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/KinObjectSelect.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__KIN_OBJECT_SELECT_H -#define QUICK_ANA__KIN_OBJECT_SELECT_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/xAODInclude.h> - -namespace ana -{ - /// TODO: needs documentation - class KinObjectSelect - { - // - // public interface - // - - /// effects: construct a kinematic selector based on the given formula - /// guarantee: strong - /// failures: out of memory II - /// failures: formula errors - public: - KinObjectSelect (const std::string& formula); - - - /// effects: apply this selection to the given particle - /// guarantee: strong - /// failures: xAOD errors - public: - bool select (const xAOD::IParticle& particle) const; - - // - // private interface - // - - /// description: the function we use internally - private: - std::function<bool(const xAOD::IParticle&)> m_function; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/KinSelectTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/KinSelectTool.h deleted file mode 100644 index dc686467c742e8356f799dc3a5c50965e4231283..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/KinSelectTool.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__KIN_SELECT_TOOL_H -#define QUICK_ANA__KIN_SELECT_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> -#include <QuickAna/SelectionCut.h> -#include <QuickAna/SelectionData.h> - -namespace ana -{ - /// TODO: needs documentation - class KinSelectTool : public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (KinSelectTool, ana::IAnaTool) - - - /// \copydoc IAnaTool::setObjectType - public: - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - KinSelectTool (const std::string& name); - - - /// \brief standard destructor - /// - /// This is explicitly defined, to break include dependencies - /// \par Guarantee - /// no-fail - public: - ~KinSelectTool (); - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - public: - StatusCode initialize() override; - - - /// \copydoc IAnaTool::useConfiguration - public: - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) - override; - - - /// returns: the processing step we are working on - /// guarantee: no-fail - public: - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - public: - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - public: - virtual unsigned outputTypes () const override; - - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - public: - virtual StatusCode execute (IEventObjects& objects) override; - - - /// description: the object type we work on - public: - ObjectType m_objectType; - - /// description: the selection string - public: - std::string m_selection; - - /// description: the actual object selector - private: - std::unique_ptr<KinObjectSelect> m_selectObject; - - /// \brief the selection data - private: - SelectionData m_selectionData; - - /// \brief the selection cut - private: - SelectionCut cut_kin_select; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/LegacyORTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/LegacyORTool.h deleted file mode 100644 index 08e8be437139f98be0639fc65f129e384e6784d1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/LegacyORTool.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__LEGACY_OR_TOOL_H -#define QUICK_ANA__LEGACY_OR_TOOL_H - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/xAODInclude.h> - -class IOverlapRemovalTool; - -namespace ana -{ - /// @brief An AnaTool which provides the object overlap removal - /// - /// This implementation uses the legacy overlap removal tool from - /// AssociationUtils. It is going to be deprecated in favor of the new - /// ORTool based on the multi-tool design of AssociationUtils. - /// - class LegacyORTool : public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (LegacyORTool, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - LegacyORTool (const std::string& name); - - - /// \copydoc IAnaTool::setObjectType - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - - /// returns: the processing step we are working on - /// guarantee: no-fail - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes () const override; - - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode execute (IEventObjects& objects) override; - - - /// Enum for specifying various overlap removal variants - enum OR_Type { - Default = 0, - run1_top_default, - run1_SSbjets, - run1_susy_default - }; - - protected: - - /// \brief print overlap removal debugging information - void printObj (const char* APP_NAME, const char* type, - const xAOD::IParticle* obj) const; - - private: - - // Configuration - - /// description: the OverlapRemoval tool - asg::AnaToolHandle<IOverlapRemovalTool> m_ortool; - - /// OR input decoration name - std::string m_orInputLabel; - - /// OR output decoration name - std::string m_orOutputLabel; - - /// Which OR recommendations are we following? - // warning: please leave this as a simple integer property, or it - // will not compile in Athena!!! - // OR_Type m_or_type; - int m_or_type; - - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MasterOutputToolXAOD.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MasterOutputToolXAOD.h deleted file mode 100644 index 32ebaf84f0c6c07aab47149067d6f568befcad1a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MasterOutputToolXAOD.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__MASTER_OUTPUT_TOOL_XAOD_H -#define QUICK_ANA__MASTER_OUTPUT_TOOL_XAOD_H - -// Shouldn't be used in Athena -#ifdef ROOTCORE - -// Infrastructure includes -#include "AsgTools/AsgTool.h" - -// Local includes -#include "QuickAna/Global.h" -#include "QuickAna/IOutputTool.h" -#include "QuickAna/EventData.h" -#include "AsgTools/AnaToolHandle.h" - -namespace ana -{ - - /// @class MasterOutputToolXAOD - /// @brief A tool which manages and applies a set of IOutputTools. - /// - /// This tool can be configured from the EventData object. - /// - /// @author Steve Farrell <Steven.Farrell@cern.ch> - /// - class MasterOutputToolXAOD : public IOutputTool, public asg::AsgTool - { - - /// We don't actually need an Athena constructor currently - ASG_TOOL_CLASS(MasterOutputToolXAOD, IOutputTool) - - public: - - /// Standard constructor - MasterOutputToolXAOD(const std::string& name); - - /// Initialize the tool - virtual StatusCode initialize() override; - - /// Execute the output writing - virtual StatusCode write() override; - - private: - - /// EventData meta-data for holding container information. - EventData m_eventData; - - /// List of object types to write out. Defaults to 'all'. - std::vector<ObjectType> m_outputTypes; - - /// Handle array of output tools for each object type. - std::vector< asg::AnaToolHandle<IOutputTool> > m_outputTools; - - }; // class MasterOutputToolXAOD - -} // namespace ana - -#endif // ROOTCORE - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MessageCheck.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MessageCheck.h deleted file mode 100644 index 743c9ea4758685f8198ead94f996483d2ebf2adb..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MessageCheck.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__MESSAGE_CHECK_H -#define QUICK_ANA__MESSAGE_CHECK_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <AsgTools/MessageCheck.h> - -namespace ana -{ - ANA_MSG_HEADER (msgToolHandle) - ANA_MSG_HEADER (msgConfiguration) - ANA_MSG_HEADER (msgIsolationTools) - ANA_MSG_HEADER (msgStore) - ANA_MSG_HEADER (msgScheduler) - ANA_MSG_HEADER (msgSelection) - ANA_MSG_HEADER (msgObjectDefinition) - ANA_MSG_HEADER (msgKinSelect) - ANA_MSG_HEADER (msgUserCode) - - void enableStatusCodeFailure (); -} - - -/// \brief check whether the given expression was successful, updating -/// the cut value as appropriate -/// -/// This is the same as \ref ANA_CHECK, except for updating the cut -/// value and checking whether the status code is out of validity. If -/// it is out of valitidy range, it will still end the function, but -/// report success. -#define QA_CHECK_CUT(CUT,EXP) \ - { const auto sc__ = EXP; \ - typedef typename std::decay<decltype(sc__)>::type scType__; \ - if (::asg::CheckHelper<scType__>::isSuccess (sc__)) { \ - (CUT).setPassedIf (true); \ - } else if (::asg::CheckHelper<scType__>::isOutOfValidityRange (sc__)) { \ - (CUT).setFailedIf (true); \ - return ::asg::CheckHelper<AsgToolsCheckResultType>::successCode(); \ - } else { \ - ANA_MSG_ERROR ("Failed to call \"" << #EXP << "\""); \ - return ::asg::CheckHelper<AsgToolsCheckResultType>::failureCode(); \ - } } - -/// \brief check whether the given expression was successful, updating -/// the weight on success -/// -/// Since the exact type of the weight argument varies across scale -/// factor tools, it is passed in as an extra argument, and the macro -/// performs a type conversion. -/// -/// This is the same as \ref ANA_CHECK, except for updating the weight -/// value and checking whether the status code is out of validity. If -/// it is out of valitidy range, it will *not* end the function nor -/// set the weight, but print out a warning message that this -/// happened. -#define QA_CHECK_WEIGHT(TYPE,WEIGHT,EXP) \ - { auto& weight__ = WEIGHT; \ - TYPE WEIGHT = 1; \ - const auto sc__ = EXP; \ - typedef typename std::decay<decltype(sc__)>::type scType__; \ - if (::asg::CheckHelper<scType__>::isSuccess (sc__)) { \ - weight__ = WEIGHT; \ - } else if (::asg::CheckHelper<scType__>::isOutOfValidityRange (sc__)) { \ - ANA_MSG_WARNING("OutOfValidityRange for: " << #EXP); \ - } else { \ - ANA_MSG_ERROR ("Failed to call \"" << #EXP << "\""); \ - return ::asg::CheckHelper<AsgToolsCheckResultType>::failureCode(); \ - } } - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MetTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MetTool.h deleted file mode 100644 index 98aeca787c3b95e7a6f2d832cf8bc7edab9a7131..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MetTool.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__MET_TOOL_H -#define QUICK_ANA__MET_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// This module declares the MetTool for calculating the MissingET and its -// associated systematics in QuickAna. Latest recommendations come from -// the following page: -// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetEtmissRecommendationsMC15 -// - - -#include <QuickAna/Global.h> - -#include <AthContainers/AuxElement.h> -#include <QuickAna/AnaTool.h> -#include <AsgTools/AnaToolHandle.h> - -class IMETMaker; -class IMETSystematicsTool; -class IJetModifier; - -namespace ana -{ - - /// @brief An AnaTool used to calculate MET and the MET systematics. - /// - class MetTool : virtual public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (MetTool, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - MetTool (const std::string& name); - - /// \copydoc IAnaTool::setObjectType - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - /// returns: the processing step we are working on - /// guarantee: no-fail - virtual AnalysisStep step () const override; - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes () const override; - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes () const override; - - /// \copydoc IAnaTool::useInitialConfiguration - virtual StatusCode - useInitialConfiguration (const InternalConfiguration& conf) override; - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - /// \copydoc IAnaTool::useConfiguration - virtual StatusCode - useConfiguration (const InternalConfiguration& configuration) override; - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode execute (IEventObjects& objects) override; - - private: - - /// Configurations -- through InternalConfiguration - - /// \brief whether we run on data - bool m_isData = false; - /// \brief whether we are using AF2 - bool m_isAF2 = false; - /// \brief the name of the jet input container - std::string m_jetContainer; - - /// \brief the object type we work on - private: - ObjectType m_type = OBJECT_MET; - - /// Configurations -- tool properties - - bool m_includeTauTerm; - bool m_doTST; - bool m_doJVTCut; - bool m_doTrackMET; - bool m_doORCaloTaggedMuons; - bool m_doMuJetEMScale; - std::string m_jetSelection; - double m_uniqueFrac; - double m_jetCut; - bool m_doFJVT; - - private: - - /// description: the MET tool - asg::AnaToolHandle<IMETMaker> m_metutil; - asg::AnaToolHandle<IMETSystematicsTool> m_metSystTool; - /// description: the fJVT tool - asg::AnaToolHandle<IJetModifier> m_fjvtTool; - - /// \brief the accessor to the selection - SG::AuxElement::Accessor<SelectType> m_accessor; - }; - -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MuonTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MuonTool.h deleted file mode 100644 index fc28be8d20ff17d00afeaa07a649c36d06ee0b3b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/MuonTool.h +++ /dev/null @@ -1,239 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__MUON_TOOL_H -#define QUICK_ANA__MUON_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaToolCorrect.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/AnaToolSelect.h> -#include <QuickAna/AnaToolWeight.h> -#include <QuickAna/SelectionCut.h> - -namespace CP -{ - class IMuonCalibrationAndSmearingTool; - class IMuonSelectionTool; - class IIsolationSelectionTool; - class IMuonEfficiencyScaleFactors; - class IPileupReweightingTool; -} - -namespace ana -{ - class MuonToolCorrect : public AnaToolCorrect<xAOD::MuonContainer> - { - // - // public interface - // - - ASG_TOOL_CLASS (MuonToolCorrect, ana::IAnaTool) - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - MuonToolCorrect (const std::string& name); - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - public: - StatusCode initialize() override; - - - /// effects: run the calibration on this event - /// returns: whether we accepted the event - /// guarantee: basic - /// failures: tool dependent - public: - virtual StatusCode - correctObject (xAOD::Muon& muon) override; - - - /// description: the calibration/smearing tool - private: - asg::AnaToolHandle<CP::IMuonCalibrationAndSmearingTool> m_calib_smear; - - private: - SelectionCut cut_calib_tool; - - }; - - - - class MuonToolSelect : public AnaToolSelect<xAOD::MuonContainer> - { - // - // public interface - // - - ASG_TOOL_CLASS (MuonToolSelect, ana::IAnaTool) - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - MuonToolSelect (const std::string& name); - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - public: - StatusCode initialize() override; - - - /// returns: whether the object passes object selection - /// guarantee: basic - /// failures: definition dependent - public: - virtual StatusCode - selectObject (xAOD::Muon& muon) override; - - - public: - /// description: desired quality - xAOD::Muon::Quality m_quality; - - private: - - // Configuration - - /// Use isolation cut - bool m_isolationOn; - /// Isolation working point - std::string m_isolationWP; - /// Apply z0/d0/isolation cuts after MET and OR? - bool m_inclusiveMET; - /// Apply looser impact parameter cuts - bool m_looseImpactCut; - /// Point above which to apply the high pT cuts - float m_high_pT; - /// Don't apply a TRT cut -- only for specific derivations - bool m_noTRT; - /// Apply the high-pT bad muon veto - bool m_doBadMuVeto; - - // CP tools - - /// description: the selection tool - asg::AnaToolHandle<CP::IMuonSelectionTool> m_selection; - /// description: the selection tool for high-pT working point - asg::AnaToolHandle<CP::IMuonSelectionTool> m_selectionHPT; - /// description: the isolation selection tool - asg::AnaToolHandle<CP::IIsolationSelectionTool> m_isolationTool; - - SelectionCut cut_selection; - SelectionCut cut_d0; - SelectionCut cut_z0; - SelectionCut cut_high_pT; - SelectionCut cut_isolationTool; - }; - - - - - - class MuonToolWeight : public AnaToolWeight<xAOD::MuonContainer> - { - // - // public interface - // - - ASG_TOOL_CLASS (MuonToolWeight, ana::IAnaTool) - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - MuonToolWeight (const std::string& name); - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - public: - StatusCode initialize() override; - - - /// effects: calculate the weight for this event - /// returns: the calculated weight - /// guarantee: basic - /// failures: tool dependent - public: - virtual StatusCode - objectWeight (const xAOD::Muon& muon, float& weight) override; - - - private: - // CP tools - - /// description: the reco efficiency correction tool - asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> m_efficiency_scale; - /// description: the reco efficiency correction tool for high-pT - asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> m_efficiency_scaleHPT; - - /// description: the TTVA efficiency correction tool - asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> m_ttva_efficiency_scale; - - /// description: the isolation efficiency correction tool - asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> m_isolation_scale; - - /// description: the bad muon veto efficiency correction tool - asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> m_badmuonveto_scale; - - private: - /// Configuration: - - /// Isolation working point string - std::string m_isolationWP; - /// Point above which to apply the high pT cuts - float m_high_pT; - /// Don't apply a TRT cut -- only for specific derivations - bool m_noTRT; - /// Apply the high-pT bad muon veto - bool m_doBadMuVeto; - - public: - /// description: desired quality - xAOD::Muon::Quality m_quality; - }; - - - StatusCode makeMuonTool(DefinitionArgs& args, - const xAOD::Muon::Quality& quality, - const bool& isolationOn = false, - const std::string& isolationWPString = "Gradient", - const bool& inclusiveMET=false, - const bool& looseImpactCut=false, - const float& high_pT=-1., - const bool noTRT=false, - const bool badMuVeto=false); - -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ORTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ORTool.h deleted file mode 100644 index c97168470ce5a3d3901a1b1d966d0b88402899bc..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ORTool.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OR_TOOL_H -#define QUICK_ANA__OR_TOOL_H - -/// This file defines the overlap removal tool: ORTool - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> -#include <AsgTools/AnaToolHandle.h> -#include <AssociationUtils/ToolBox.h> -#include <AssociationUtils/OverlapRemovalInit.h> -#include <QuickAna/xAODInclude.h> - -// Forward declarations -namespace ORUtils -{ - class IOverlapRemovalTool; - class IOverlapTool; -} - -namespace ana -{ - - /// @brief QuickAna tool for applying standard overlap removal. - /// - /// This AnaTool uses the overlap removal tools from AssociationUtils. - /// It is able to apply either the harmonization note recommendations or the - /// updated overlap removal recommendations via the RecommendationSet - /// configuration property. - /// - /// For more details on the overlap removal recommendations, see the - /// AssociationUtils documentation: - /// https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/AnalysisCommon/AssociationUtils/trunk/doc/README.rst - /// - /// @author Steve Farrell <Steven.Farrell@cern.ch> - /// - class ORTool : public AnaTool - { - - ASG_TOOL_CLASS(ORTool, ana::IAnaTool) - - public: - - /// @brief Standard constructor - /// - /// @par guarantee: strong - /// @par failures: out of memory II - ORTool(const std::string& name); - - /// \copydoc IAnaTool::setObjectType - virtual StatusCode - setObjectType(ObjectType type, const std::string& workingPoint) override; - - /// @brief Initialize this tool - /// - /// @par guarantee: basic - /// @par failures: configuration errors - StatusCode initialize() override; - - /// @brief Returns the processing step we are working on - /// - /// @par guarantee: no-fail - virtual AnalysisStep step() const override; - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes() const override; - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes() const override; - - /// @brief Apply overlap removal to the objects. - /// - /// @par guarantee: basic - /// @par failures: tool dependent - virtual StatusCode execute(IEventObjects& objects) override; - - private: - - // Configuration - - /// The OR toolbox - ORUtils::ToolBox m_orToolBox; - - /// OR config flags - ORUtils::ORFlags m_orFlags; - - /// QuickAna analysis selection name - std::string m_anaSelectionName; - - /// Sliding-DR option: 'muon', 'electron', 'both' - std::string m_slidingConeType; - - /// Use JVT for prioritization - bool m_jvtPriorities; - - /// Muon Jet removal pT - bool m_applyRelPt; - - }; // class ORTool - -} // namespace ana - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ObjectTypeInfo.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ObjectTypeInfo.h deleted file mode 100644 index aab79c2a24d423bc43a2ffc3374a6a3c4a6eae97..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ObjectTypeInfo.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OBJECT_TYPE_INFO_H -#define QUICK_ANA__OBJECT_TYPE_INFO_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <string> - -namespace ana -{ - /// \brief This class contains various static information about the - /// different object types. - /// - /// This is mostly to help in using ObjectType inside templates, to - /// match them to the right objects, etc. - - struct ObjectTypeInfo - { - /// \brief the number of object types available - static const unsigned numTypes = OBJECT_OVERLAP_REMOVAL; - - /// \brief the number of object types available as definitions - static const unsigned numDefTypes = OBJECT_NONE + 1; - - - /// \brief the string name of the type - static const std::string name [numDefTypes]; - - - /// \brief whether this object type supports an IParticle interface - static bool supportsIParticle (ObjectType type); - - - /// \brief the actual object type associated with this - template<unsigned> struct asXAOD; - - - /// \brief the object types supported for a given xAOD type - template<class T> struct fromXAOD; - }; -} - -#include <QuickAna/ObjectTypeInfo.icc> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ObjectTypeInfo.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ObjectTypeInfo.icc deleted file mode 100644 index 839c1901f87f333e6f67a4d0c0b3221c415299c3..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ObjectTypeInfo.icc +++ /dev/null @@ -1,147 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OBJECT_TYPE_INFO_ICC -#define QUICK_ANA__OBJECT_TYPE_INFO_ICC - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/xAODInclude.h> -#include <QuickAna/xAODEventSelect.h> - -namespace ana -{ - template<> struct ObjectTypeInfo::asXAOD<OBJECT_EVENTINFO> - { - /// \brief the actual type - typedef xAOD::EventInfo type; - }; - - template<> struct ObjectTypeInfo::asXAOD<OBJECT_EVENT_SELECT> - { - /// \brief the actual type - typedef EventSelectType type; - }; - - template<> struct ObjectTypeInfo::asXAOD<OBJECT_JET> - { - /// \brief the actual type - typedef xAOD::JetContainer type; - }; - - template<> struct ObjectTypeInfo::asXAOD<OBJECT_FAT_JET> - { - /// \brief the actual type - typedef xAOD::JetContainer type; - }; - - template<> struct ObjectTypeInfo::asXAOD<OBJECT_ELECTRON> - { - /// \brief the actual type - typedef xAOD::ElectronContainer type; - }; - - template<> struct ObjectTypeInfo::asXAOD<OBJECT_PHOTON> - { - /// \brief the actual type - typedef xAOD::PhotonContainer type; - }; - - template<> struct ObjectTypeInfo::asXAOD<OBJECT_MUON> - { - /// \brief the actual type - typedef xAOD::MuonContainer type; - }; - - template<> struct ObjectTypeInfo::asXAOD<OBJECT_TAU> - { - /// \brief the actual type - typedef xAOD::TauJetContainer type; - }; - - template<> struct ObjectTypeInfo::asXAOD<OBJECT_MET> - { - /// \brief the actual type - typedef xAOD::MissingETContainer type; - }; - - template<> struct ObjectTypeInfo::asXAOD<OBJECT_MET2> - { - /// \brief the actual type - typedef xAOD::MissingETContainer type; - }; - - template<> struct ObjectTypeInfo::fromXAOD<xAOD::EventInfo> - { - /// \brief the mask of supported types - static const unsigned support = (1 << OBJECT_EVENTINFO) | (1 << OBJECT_EVENT_SELECT); - - /// \brief the object type to use by default - static const ObjectType base = OBJECT_EVENTINFO; - }; - - template<> struct ObjectTypeInfo::fromXAOD<xAOD::MuonContainer> - { - /// \brief the mask of supported types - static const unsigned support = 1 << OBJECT_MUON; - - /// \brief the object type to use by default - static const ObjectType base = OBJECT_MUON; - }; - - template<> struct ObjectTypeInfo::fromXAOD<xAOD::TauJetContainer> - { - /// \brief the mask of supported types - static const unsigned support = 1 << OBJECT_TAU; - - /// \brief the object type to use by default - static const ObjectType base = OBJECT_TAU; - }; - - template<> struct ObjectTypeInfo::fromXAOD<xAOD::ElectronContainer> - { - /// \brief the mask of supported types - static const unsigned support = 1 << OBJECT_ELECTRON; - - /// \brief the object type to use by default - static const ObjectType base = OBJECT_ELECTRON; - }; - - template<> struct ObjectTypeInfo::fromXAOD<xAOD::PhotonContainer> - { - /// \brief the mask of supported types - static const unsigned support = 1 << OBJECT_PHOTON; - - /// \brief the object type to use by default - static const ObjectType base = OBJECT_PHOTON; - }; - - template<> struct ObjectTypeInfo::fromXAOD<xAOD::JetContainer> - { - /// \brief the mask of supported types - static const unsigned support = (1 << OBJECT_JET) | (1 << OBJECT_FAT_JET); - - /// \brief the object type to use by default - static const ObjectType base = OBJECT_JET; - }; - - template<> struct ObjectTypeInfo::fromXAOD<xAOD::MissingETContainer> - { - /// \brief the mask of supported types - static const unsigned support = (1 << OBJECT_MET) | (1 << OBJECT_MET2); - - /// \brief the object type to use by default - static const ObjectType base = OBJECT_MET; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ObjectsOutputTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ObjectsOutputTool.h deleted file mode 100644 index 2b859368fabf4688d5e50a75a2b4fe1bcaef28cd..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ObjectsOutputTool.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OBJECTS_OUTPUT_TOOL_H -#define QUICK_ANA__OBJECTS_OUTPUT_TOOL_H - -#include <QuickAna/Global.h> - -#include <AsgTools/AsgTool.h> -#include <QuickAna/IOutputTool.h> -#include <AsgTools/AnaToolHandle.h> - -namespace ana -{ - - /// Tool class for writing out all analysis objects - /// - /// THIS TOOL IS DEPRECATED. - /// Please use the OutputToolXAOD and MasterOutputToolXAOD instead. - /// - class ObjectsOutputTool : public IOutputToolOld, - public asg::AsgTool - { - - /// Declare the tool to the framework - ASG_TOOL_CLASS(ObjectsOutputTool, IOutputToolOld) - - public: - - /// Standard constructor - ObjectsOutputTool(const std::string& name); - - /// Initialize the tool - virtual StatusCode initialize() override; - - /// Write all containers and their output aux containers to the provided - /// persistent store. This method loops over the configured objects and - /// configured suffixes, writing each out as basename_suffix. - /// The user must still call TEvent::fill in order to save an event - /// to the output file. - __attribute__ ((deprecated)) - virtual StatusCode execute(xAOD::TEvent* outputStore); - - /// Write each object type and associated aux containers to the provided - /// persistent store with the provided suffix as basename_suffix. This - /// method form allows the client to insert this tool into an existing - /// loop over suffixes (i.e., systematics). - virtual StatusCode write(xAOD::TEvent* outputStore, - const std::string& suffix = "") override; - - /// Add an output which will be copied from the input store - StatusCode addOutputCopyObject(const std::string& name); - - /// Add an output container by type and basename. - StatusCode addOutputObject(ana::ObjectType objType, - const std::string& basename); - - /// Add an already configured output tool. This method allows users to - /// configure the individual output container tools as desired. - /// User must fully initialize the IOutputToolOld before this. - /// This tool will take ownership of the IOutputToolOld. - //StatusCode addOutputTool(std::unique_ptr<IOutputToolOld> tool); - - - /// Set object suffixes via a list of systematics - void setSuffixes(const std::vector<CP::SystematicSet>& sysList); - - private: - - /// List of suffixes (e.g. systematics names) to process - std::vector<std::string> m_suffixes; - - /// Object output tools for each configured type - std::vector< asg::AnaToolHandle<IOutputToolOld> > m_outputTools; - - /// Object output tools for each configured type - //std::vector< std::unique_ptr<IOutputToolOld> > m_outputTools; - - }; // class ObjectsOutputTool - -} // namespace ana - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedObjects.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedObjects.h deleted file mode 100644 index 9a5f98bb2d62604e502fedcbd79eb305cfd85c89..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedObjects.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OPTIMIZER_OBJECTS_H -#define QUICK_ANA__OPTIMIZER_OBJECTS_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/Global.h> - -#include <PATInterfaces/SystematicSet.h> -#include <QuickAna/IEventObjects.h> - -namespace ana -{ - - /// An EventObjects container for specific systematic and object - /// types at a specific point in the processing chain. - /// - /// Used in the optimized tool scheduler. - /// - class OptimizedObjects : public IEventObjects - { - // - // public interface - // - - /// \brief test the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - public: - OptimizedObjects (OptimizedStore *val_master, - const CP::SystematicSet& val_systematics); - - - /// \brief do everything we need to do to prepare for a new event, - /// i.e. make all the shallow copies - /// \par Guarantee - /// basic - /// \par Failures - /// xAOD copy failures - public: - StatusCode prepare () const; - - - /// \brief check whether we currently pass the selection - /// \par Guarantee - /// strong - /// \par Failures - /// xAOD access error - public: - bool passSelection () const; - - - - // - // inherited interface - // - - /// \brief get the object or object container for the given object - /// type or NULL if it hasn't been filled (yet). - /// \par Guarantee - /// no-fail - /// \warn this has to be cast exactly to the type defined by \ref - /// ObjecTypeInfo::asXAOD. it is much easier to go with the - /// \ref get function instead. - public: - virtual void *getVoid (ObjectType type) const override; - - - /// \brief add a shallow copy of the input container with the - /// given name - /// \par Guarantee - /// basic - /// \par Failures - /// object already initialized\n - /// input object not found\n - /// shallow copy failures - public: - virtual StatusCode addCopy (ObjectType type, const std::string& name) override; - - - /// \brief add a new container of the given type - /// \par Guarantee - /// basic - /// \par Failures - /// object already initialized\n - /// object creation failures - public: - virtual StatusCode addNew (ObjectType type) override; - - - /// \brief the event weight - /// - /// \warn this is a dummy for now and the mechanism might change - /// at some point - public: - virtual float eventWeight () const override; - - - /// \brief the systematics for these objects - /// \par Guarantee - /// no-fail - public: - const CP::SystematicSet& systematics () const; - - - /// \brief fill the given \ref EventData structure for the given - /// systematic - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - public: - void fillEventData (const CP::SystematicSet& sys, - EventData& eventData) const; - - - - // - // private interface - // - - /// \brief the master store object - private: - OptimizedStore *m_master; - - /// \brief the index for the given object type - private: - std::size_t m_index [ObjectTypeInfo::numTypes]; - - /// \brief the input index for the given object type - private: - std::size_t m_inputIndex [ObjectTypeInfo::numTypes]; - - /// \brief the value of \ref systematics - private: - CP::SystematicSet m_systematics; - - friend class OptimizedStore; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedScheduler.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedScheduler.h deleted file mode 100644 index 9e619538d6f8a52ec4929073cb04d37a01792b7f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedScheduler.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OPTIMIZER_SCHEDULER_H -#define QUICK_ANA__OPTIMIZER_SCHEDULER_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <AsgTools/AsgTool.h> -#include <QuickAna/IToolScheduler.h> - -namespace ana -{ - - /// The optimized tool scheduler. - /// - /// Holds and manages the OptimizedStore and the OptimizedTools. - /// - class OptimizedScheduler : virtual public IToolScheduler, virtual public asg::AsgTool - { - // - // public interface - // - - ASG_TOOL_CLASS (OptimizedScheduler, ana::IToolScheduler) - - - /// effects: test the invariant of this object - /// guarantee: no-fail - public: - void testInvariant () const; - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - OptimizedScheduler (const std::string& name); - - - /// \brief standard destructor - /// - /// I defined my own destructor to break include file dependencies - /// in Athena - /// \par Guarantee - /// no-fail - public: - ~OptimizedScheduler (); - - - - // - // inherited interface - // - - public: - virtual StatusCode initialize() override; - - public: - virtual StatusCode addTool (std::unique_ptr<IAnaTool> tool) override; - - public: - virtual CP::SystematicSet affectingSystematics () const override; - - public: - virtual CP::SystematicSet recommendedSystematics() const override; - - public: - virtual StatusCode - applySystematicVariation (const CP::SystematicSet& systConfig) override; - - public: - virtual StatusCode - fillEventObjects (IEventObjects*& object) override; - - public: - virtual const std::vector<CP::SystematicSet>& - systematics () const override; - - public: - virtual StatusCode - setSystematics (const std::vector<CP::SystematicSet>& val_systematics) - override; - - public: - virtual EventData getEventData () const override; - - - - // - // private interface - // - - /// description: the list of object definitions we are using - private: - std::vector<std::unique_ptr<OptimizedTool>> m_tools; - - /// description: the master object we are using - private: - std::unique_ptr<OptimizedStore> m_master; - - /// description: the list of nuisance parameter points we are - /// evaluating - private: - std::vector<CP::SystematicSet> m_targetSystematics; - - /// description: the map of event objects - private: - std::map<CP::SystematicSet,std::unique_ptr<OptimizedObjects>> m_objectsMap; - - /// description: the current event objects - private: - OptimizedObjects *m_currentObjects; - - - /// \brief the current run number - /// - /// this is used together with \ref m_eventNumber to determine - /// whether we started on a new event - private: - uint32_t m_runNumber; - - - /// \brief the current event number - /// - /// this is used together with \ref m_runNumber to determine - /// whether we started on a new event - private: - uint32_t m_eventNumber; - - - /// \brief whether we are on a new event - /// \par Guarantee - /// strong - /// \par Failures - /// xAOD failures - private: - bool isNewEvent (); - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedStore.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedStore.h deleted file mode 100644 index 4dfb9a2329a5fe454423490904434568f64aa2fa..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedStore.h +++ /dev/null @@ -1,205 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OPTIMIZER_STORE_H -#define QUICK_ANA__OPTIMIZER_STORE_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <string> -#include <vector> - -namespace ana -{ - - /// A wrapper to the event store for the optimized scheduler. - /// - /// Manages systematics information and holds pointers to all collections - /// at all processing stages and systematics. - /// - class OptimizedStore - { - // - // public interface - // - - /// \brief the index to use when we do not use an object type - public: - static const std::size_t noIndex = std::size_t (-1); - - - // no slicing - OptimizedStore (const OptimizedStore&) = delete; - OptimizedStore& operator = (const OptimizedStore&) = delete; - - - /// \brief test the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - OptimizedStore (const std::vector<CP::SystematicSet>& val_requestedSystematics, - StoreType *val_store); - - - /// \brief standard destructor - /// \par Guarantee - /// no-fail - /// \par Rationale - /// an explicit destructor to reduce includes in the header file - public: - ~OptimizedStore (); - - - /// \brief the list of all requested systematics - /// \par Guarantee - /// no-fail - public: - const std::vector<CP::SystematicSet>& requestedSystematics () const; - - - /// \brief the list of all systematics for the given object type - /// and the currently registered tools - /// \par Guarantee - /// strong - /// \par Failures - /// invalid object type or index - public: - const CP::SystematicSet& objectSystematics (ObjectType type) const; - - - /// \brief make a preparation copy from the original index to the - /// new index - /// - /// This is used whenever we create new systematics for an object - /// type. - /// \par Guarantee - /// basic - /// \par Failures - /// xAOD copy failures\n - /// invalid indices - public: - StatusCode - prepareCopy (ObjectType type, std::size_t index, std::size_t origIndex); - - - /// \brief initialize the indices on the given list of systematics - /// objects - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II\n - /// requesting object type not provided yet\n - /// providing new object type already present - public: - StatusCode - initializeIndices (const std::vector<OptimizedObjects*>& objects, - unsigned inputTypes, unsigned outputTypes, - AnalysisStep step); - - - /// \brief clear out all the data in anticipation of the next event - /// \par Guarantee - /// no-fail - public: - void clearData (); - - - /// \brief do all the final initialization - /// \par Guarantee - /// no-fail - public: - StatusCode finalInit (); - - - /// \brief the defined object types - /// \par Guarantee - /// no-fail - public: - unsigned objectTypes () const; - - - /// \brief fill the given \ref EventData structure for the given - /// systematic - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - public: - void fillEventData (ObjectType type, unsigned index, - const CP::SystematicSet& sys, - EventData& eventData) const; - - - - // - // the IEventObjects interface - // - - /// \copydoc IEventObjects::getVoid - public: - void *getVoid (ObjectType type, std::size_t index) const; - - - /// \copydoc IEventObjects::addCopy - public: - StatusCode - addCopy (ObjectType type, std::size_t index, - const std::string& name); - - - /// \copydoc IEventObjects::addNew - public: - StatusCode - addNew (ObjectType type, std::size_t index); - - - - // - // private interface - // - - /// \brief the truly private implementation - private: - struct Pimpl; - - /// \brief the \ref Pimpl structure - private: - Pimpl *pimpl; - - /// \brief the information per object type - private: - struct InfoType; - - /// \brief the information per object - private: - struct InfoObject; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedTool.h deleted file mode 100644 index e76703b190c986d640784ed261c16e47e372a353..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OptimizedTool.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__TOOL_WRAPPER_H -#define QUICK_ANA__TOOL_WRAPPER_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <AsgTools/AsgMessaging.h> -#include <PATInterfaces/SystematicSet.h> -#include <memory> -#include <set> -#include <unordered_map> - -namespace CP -{ - class SystematicSet; -} - -namespace ana -{ - - /// Holds tool and meta-information for the optimized scheduler. - /// - class OptimizedTool : public asg::AsgMessaging - { - // - // public interface - // - - // no object slicing - OptimizedTool (const OptimizedTool&) = delete; - OptimizedTool& operator = (const OptimizedTool&) = delete; - - - /// \brief test the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief initializing constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - public: - OptimizedTool (std::unique_ptr<IAnaTool> val_tool); - - - /// \brief standard destructor - /// - /// explicit destructor to reduce number of header file includes - /// \par Guarantee - /// no-fail - public: - ~OptimizedTool (); - - - /// \brief the name of this tool - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - std::string name () const; - - - /// \brief the step of this tool - /// \par Guarantee - /// no-fail - public: - AnalysisStep step () const; - - - /// \brief the list of all systematics this tool can be affected by - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - CP::SystematicSet affectingSystematics () const; - - - /// \brief the list of all systematics this tool recommends to use - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - CP::SystematicSet recommendedSystematics () const; - - - /// \brief apply this analysis tool to the objects - /// \param objects the objects to apply this too - /// \par Guarantee - /// basic - /// \par Failures - /// tool dependent - public: - StatusCode execute (); - - - /// \brief call IAnaTool::fillEventDataSource - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - public: - void fillEventDataSource (EventData& event) const; - - - /// \brief whether we use the tool directly, i.e. whether it has - /// an output that is one of our inputs and is executed on an - /// earlier step - /// \par Guarantee - /// no-fail - public: - bool hasDirectInput (const OptimizedTool& input) const noexcept; - - - /// \brief whether the given tool has been registered via \ref - /// addOutput as using the output of his tool directly or - /// indirectly - /// \par Guarantee - /// no-fail - public: - bool hasOutput (const OptimizedTool *that) const noexcept; - - - /// \brief register the given tool as using the output of this - /// tool as an input - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - public: - void addOutput (OptimizedTool *output); - - - /// \brief configure this wrapper for the given target set of - /// systematics - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - public: - StatusCode configureSystematics (OptimizedStore *store); - - - - // - // private interface - // - - /// \brief the tool wrapped - private: - std::unique_ptr<IAnaTool> m_tool; - - /// \brief the list of tools we are using - private: - std::set<OptimizedTool*> m_inputs; - - /// \brief the list of tools that are using us - private: - std::set<OptimizedTool*> m_outputs; - - /// \brief the list of the OptimizedObjects we use - private: - std::unordered_map<CP::SystematicSet,std::unique_ptr<OptimizedObjects>> m_objects; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputTool.h deleted file mode 100644 index 3a370d12dc4a11bf1d5fcdd0378ea0215a7a2edd..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputTool.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OUTPUT_TOOL_H -#define QUICK_ANA__OUTPUT_TOOL_H - -#include <QuickAna/Global.h> - -#include <AsgTools/AsgTool.h> -#include <QuickAna/IOutputTool.h> -#include <QuickAna/xAODInclude.h> -#include <QuickAna/xAODEventSelect.h> -#include <xAODCore/ShallowAuxContainer.h> -#include <xAODCore/ShallowAuxInfo.h> -#include <xAODMissingET/MissingETAuxContainer.h> - -namespace ana -{ - - /// Simple tool for copying an object from the input persistent - /// store to the output persistent store in ROOT. This actually - /// doesn't require any type or aux details because TEvent can - /// do it all with just the string key. - /// - /// The copying of objects to the output will be necessary - /// for the current mode of operation in QuickAna, where shallow - /// copies are made from the input containers. - /// - /// Note: this won't compile in Athena due to the dependence on - /// xAODRootAccess via TEvent. - /// - /// THIS TOOL IS DEPRECATED. - /// Please use the OutputToolXAOD and MasterOutputToolXAOD instead. - /// - class OutputCopyTool : public IOutputToolOld, public asg::AsgTool - { - - ASG_TOOL_CLASS(OutputCopyTool, IOutputToolOld) - - public: - - /// Standard constructor - OutputCopyTool(const std::string& name, const std::string& contName=""); - - /// Initialize the tool - virtual StatusCode initialize() override; - - /// Copy the container(s) from the input store to the output store - /// with eventstore key "basename". Suffix is not applied. - virtual StatusCode write(xAOD::TEvent* outputStore, - const std::string& suffixNotUsed = "") override; - - protected: - - /// Name of the container to write out - std::string m_contName; - - }; // class OutputCopyTool - - - - /// Templated tool class for writing a container and its aux container - /// to the persistent event store in ROOT. The first template parameter - /// specifies the xAOD container type. The second template parameter - /// specifies the auxilliary store type. The default aux type is - /// ShallowAuxContainer. - /// - /// For now, I'll just inherit from AsgTool. I could change this later. - /// - /// Note: this won't compile in Athena due to the dependence on - /// xAODRootAccess via TEvent. - /// - /// THIS TOOL IS DEPRECATED. - /// Please use the OutputToolXAOD and MasterOutputToolXAOD instead. - /// - template<class ContainerType, class AuxType = xAOD::ShallowAuxContainer> - class OutputTool : public IOutputToolOld, - public asg::AsgTool - { - - // Is this allowed? - ASG_TOOL_CLASS(OutputTool, IOutputToolOld) - - public: - - /// Standard constructor - OutputTool(const std::string& name, const std::string& contBaseName=""); - - /// Initialize the tool - virtual StatusCode initialize() override; - - /// Write the container and its aux container to the provided - /// persistent store. The container name is "basename_suffix". - /// Returns FAILURE if the templated types do not match those in the store. - virtual StatusCode write(xAOD::TEvent* outputStore, - const std::string& suffix = "") override; - - protected: - - /// Name of the container to write out - std::string m_contBaseName; - - }; // class OutputTool - - - - /// Convenience typedefs - /// @{ - typedef OutputTool<xAOD::EventInfo, xAOD::ShallowAuxInfo> EventInfoOutputTool; - typedef OutputTool<EventSelectType, xAOD::ShallowAuxInfo> EventSelectOutputTool; - typedef OutputTool<xAOD::ElectronContainer> ElectronOutputTool; - typedef OutputTool<xAOD::MuonContainer> MuonOutputTool; - typedef OutputTool<xAOD::TauJetContainer> TauOutputTool; - typedef OutputTool<xAOD::JetContainer> JetOutputTool; - typedef OutputTool<xAOD::PhotonContainer> PhotonOutputTool; - typedef OutputTool<xAOD::MissingETContainer, xAOD::MissingETAuxContainer> - MetOutputTool; - /// @} - -} // namespace ana - -#include <QuickAna/OutputTool.icc> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputTool.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputTool.icc deleted file mode 100644 index 1fbc034adc7849840c54b24d5b24bed08f9ab76f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputTool.icc +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OUTPUT_TOOL_ICC -#define QUICK_ANA__OUTPUT_TOOL_ICC - -// Local includes -#include <QuickAna/MessageCheck.h> - -namespace ana -{ - - template<class ContainerType, class AuxType> - OutputTool<ContainerType, AuxType>:: - OutputTool(const std::string& name, const std::string& contBaseName) - : asg::AsgTool(name), m_contBaseName(contBaseName) - { - declareProperty("ContainerBaseName", m_contBaseName); - } - - - template<class ContainerType, class AuxType> - StatusCode OutputTool<ContainerType, AuxType>::initialize() - { - ATH_MSG_WARNING("This tool is deprecated. Please move to the new " << - "OutputToolXAOD and MasterOutputToolXAOD."); - return StatusCode::SUCCESS; - } - - - template<class ContainerType, class AuxType> - StatusCode OutputTool<ContainerType, AuxType>:: - write(xAOD::TEvent* outputStore, const std::string& postfix) - { - // Container names - std::string containerName = m_contBaseName + "_" + postfix; - std::string auxContName = containerName + "Aux."; - - // Retrieve the containers from the transient store - ContainerType* container = 0; - AuxType* auxCont = 0; - ATH_CHECK( evtStore()->retrieve(container, containerName) ); - ATH_CHECK( evtStore()->retrieve(auxCont, auxContName) ); - - // Record the containers in the persistent store - ANA_CHECK( outputStore->record(container, containerName) ); - ANA_CHECK( outputStore->record(auxCont, auxContName) ); - - return StatusCode::SUCCESS; - } - -} // namespace ana - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputToolXAOD.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputToolXAOD.h deleted file mode 100644 index dd9ecd1349e51167a5100cc254e73e406e1feaf5..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputToolXAOD.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OUTPUT_TOOL_XAOD_H -#define QUICK_ANA__OUTPUT_TOOL_XAOD_H - -// Shouldn't be used in Athena -#ifdef ROOTCORE - -#include "AsgTools/AsgTool.h" - -#include "QuickAna/Global.h" -#include "QuickAna/IOutputTool.h" - -namespace ana -{ - - /// @class OutputToolXAOD - /// @brief A tool which can write collections of a particular object type - /// to the persistent output store. - /// - /// This tool can handle both a list of container names to copy from input - /// file to output file (like the original container of a shallow copy) as - /// well as a list of containers and their aux containers to take from the - /// transient store and write to the output persistent store. - /// - /// For now, this tool is not really dual-use. It uses the RootCore-specific - /// implementation of the event stores and thus won't compile in Athena. - /// - /// @author Steve Farrell <Steven.Farrell@cern.ch> - /// - template < class ContainerType, class AuxContainerType > - class OutputToolXAOD : public IOutputTool, public asg::AsgTool - { - - /// We don't actually need an Athena constructor currently - ASG_TOOL_CLASS(OutputToolXAOD, IOutputTool) - - public: - - /// Standard constructor - OutputToolXAOD(const std::string& name); - - /// Initialize the tool - virtual StatusCode initialize() override; - - /// Execute the output writing - virtual StatusCode write() override; - - private: - - /// List of containers to retrieve from transient store and write - /// to the persistent output store. - std::vector<std::string> m_writeContNames; - - /// List of container names to copy directly from input to output. - std::vector<std::string> m_copyContNames; - - }; // class OutputToolXAOD - -} // namespace ana - -#endif // ROOTCORE - -#include "QuickAna/OutputToolXAOD.icc" - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputToolXAOD.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputToolXAOD.icc deleted file mode 100644 index b4631daaf8cd5e2d439522e83a8aec84aa884303..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputToolXAOD.icc +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OUTPUT_TOOL_XAOD_ICC -#define QUICK_ANA__OUTPUT_TOOL_XAOD_ICC - -// Shouldn't be used in Athena -#ifdef ROOTCORE - -#include "QuickAna/OutputUtils.h" - -namespace ana -{ - - //--------------------------------------------------------------------------- - // Constructor - //--------------------------------------------------------------------------- - template<class ContainerType, class AuxContainerType> - OutputToolXAOD<ContainerType, AuxContainerType>:: - OutputToolXAOD(const std::string& name) - : asg::AsgTool(name) - { - declareProperty("WriteContainerNames", m_writeContNames); - declareProperty("CopyContainerNames", m_copyContNames); - } - - //--------------------------------------------------------------------------- - // Initialize the tool - //--------------------------------------------------------------------------- - template<class ContainerType, class AuxContainerType> - StatusCode OutputToolXAOD<ContainerType, AuxContainerType>:: - initialize() - { - ATH_MSG_DEBUG("Objects that will be copied from input to output persistent store:"); - for(auto& copyName : m_copyContNames) { - ATH_MSG_DEBUG(" " << copyName); - } - ATH_MSG_DEBUG("Objects that will be written from transient to persistent store:"); - for(auto& writeName : m_writeContNames) { - ATH_MSG_DEBUG(" " << writeName); - } - return StatusCode::SUCCESS; - } - - //--------------------------------------------------------------------------- - // Write containers to persistent store - //--------------------------------------------------------------------------- - template<class ContainerType, class AuxContainerType> - StatusCode OutputToolXAOD<ContainerType, AuxContainerType>:: - write() - { - auto outStore = evtStore()->event(); - - // Copy containers from input to output. - for(auto& copyName : m_copyContNames) { - ANA_CHECK( outStore->copy(copyName) ); - } - - // Write containers from transient to persistent - for(auto& writeName : m_writeContNames) { - - // Retrieve from transient store - ContainerType* cont = nullptr; - ATH_CHECK( evtStore()->retrieve(cont, writeName) ); - - // Retrieve aux container - auto auxCont = dynamic_cast<AuxContainerType*>( cont->getStore() ); - if(!auxCont) { - ATH_MSG_ERROR("Unable to cast aux container to requested type"); - return StatusCode::FAILURE; - } - - // Write to persistent store - ATH_CHECK( OutputUtils::recordContainer(cont, auxCont, *outStore, writeName) ); - } - - return StatusCode::SUCCESS; - } - -} // namespace ana - -#endif // ROOTCORE - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputUtils.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputUtils.h deleted file mode 100644 index a92c174b628ae0fb3b5ce2ee24f9aaffb90f3bfe..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputUtils.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OUTPUT_UTILS_H -#define QUICK_ANA__OUTPUT_UTILS_H - -/// This file contains helper functions for writing xAOD containers - -// Infrastructure includes -#include <AsgTools/StatusCode.h> - -// EDM includes -#include <xAODCore/AuxContainerBase.h> - -namespace ana -{ - - namespace OutputUtils - { - - /// Write a container and the given aux container to the given store. - /// This is the function that actually calls record and applies the - /// naming convention of the aux container as (name + 'Aux.'). - template<class ContainerType, class AuxContainerType, class StoreType> - StatusCode recordContainer(ContainerType* container, - AuxContainerType* auxContainer, - StoreType& store, - const std::string& name); - - } // namespace OutputUtils - -} // namespace ana - -#include <QuickAna/OutputUtils.icc> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputUtils.icc b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputUtils.icc deleted file mode 100644 index b2ca67d6c4e8041563535379879dbf8a12562700..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/OutputUtils.icc +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__OUTPUT_UTILS_ICC -#define QUICK_ANA__OUTPUT_UTILS_ICC - -#include <xAODCore/ShallowCopy.h> -#include <QuickAna/MessageCheck.h> - -namespace ana -{ - - namespace OutputUtils - { - - //------------------------------------------------------------------------- - // Write a container and its aux to the store - //------------------------------------------------------------------------- - template<class ContainerType, class AuxContainerType, class StoreType> - StatusCode recordContainer(ContainerType* container, - AuxContainerType* auxContainer, - StoreType& store, - const std::string& name) - { - using namespace ana::msgObjectDefinition; - - ANA_CHECK( store.record(container, name) ); - ANA_CHECK( store.record(auxContainer, name + "Aux.") ); - return StatusCode::SUCCESS; - } - - } // namespace OutputUtils - -} // namespace ana - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/PhotonTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/PhotonTool.h deleted file mode 100644 index e26bca151c0f5554247ba6377dfb4d363e356f70..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/PhotonTool.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__PHOTON_TOOL_H -#define QUICK_ANA__PHOTON_TOOL_H - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaToolCorrect.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/AnaToolSelect.h> -#include <QuickAna/AnaToolWeight.h> -#include <QuickAna/SelectionCut.h> - -/// Forward declarations -namespace CP{ - class IEgammaCalibrationAndSmearingTool; - class IIsolationSelectionTool; - class IIsolationCorrectionTool; -} -class IAsgPhotonEfficiencyCorrectionTool; -class IAsgPhotonIsEMSelector; -class IElectronPhotonShowerShapeFudgeTool; -class IIsolationSelectionTool; - -namespace ana -{ - - /// @brief Tool for the correction of photons - /// - /// Applies correction-related systematics as well - /// - class PhotonToolCorrect : public AnaToolCorrect<xAOD::PhotonContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS (PhotonToolCorrect, ana::IAnaTool) - - public: - // Public interface methods - - /// @brief Standard constructor - PhotonToolCorrect (const std::string& name); - - /// @brief Initialize this tool - /// Returns failure on configuration error. - StatusCode initialize() override; - - /// @brief Run the calibration on this event. - /// The accept flag tells whether we accepted the object. - virtual StatusCode - correctObject (xAOD::Photon& photon) override; - - private: - - /// Configuration - - /// Is this AF2? - bool m_isAF2; - - /// Is this data? - bool m_isData; - - // CP tools - - /// The CP calibration tool - asg::AnaToolHandle<CP::IEgammaCalibrationAndSmearingTool> m_calibration; - /// The CP shower-shape fudge tool - asg::AnaToolHandle<IElectronPhotonShowerShapeFudgeTool> m_fudgeMCTool; - /// The CP isolation correction tool - asg::AnaToolHandle<CP::IIsolationCorrectionTool> m_isoCorrTool; - - SelectionCut cut_fudge_tool; - SelectionCut cut_calibration_tool; - SelectionCut cut_isoCorr_tool; - - }; // class PhotonToolCorrect - - - - /// @brief Tool for selection of analysis photons - /// - /// Applies common photon selections - /// - class PhotonToolSelect : public AnaToolSelect<xAOD::PhotonContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS (PhotonToolSelect, ana::IAnaTool) - - public: - - // TODO: make this a private property - unsigned int quality; - - // Public interface methods - - /// @brief Standard constructor - PhotonToolSelect (const std::string& name); - - /// @brief Initialize this tool. - /// Returns failure on configuration error. - StatusCode initialize() override; - - /// @brief Apply selection on this object - virtual StatusCode - selectObject (xAOD::Photon& photon) override; - - private: - /// The CP isEM selector. No likelihood for photons yet. - asg::AnaToolHandle<IAsgPhotonIsEMSelector> m_selection; - asg::AnaToolHandle<CP::IIsolationSelectionTool> m_isolationTool; - - SelectionCut cut_OQ; - SelectionCut cut_author; - SelectionCut cut_cleaning; - SelectionCut cut_selection; - SelectionCut cut_isolationTool; - - /// Configuration - - /// Isolation working point - std::string m_isolationWP; - - /// Using isolation - bool m_isolationOn; - - }; // class PhotonToolSelect - - - - /// @brief Tool for calculating weights for analysis photons - /// - /// Applies the photon reco and ID efficiency scale factors - /// - class PhotonToolWeight : public AnaToolWeight<xAOD::PhotonContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS (PhotonToolWeight, ana::IAnaTool) - - public: - // Public interface methods - - /// @brief Standard constructor - PhotonToolWeight (const std::string& name); - - /// @brief Initialize this tool - /// Returns failure on configuration error. - StatusCode initialize() override; - - /// @brief Calculate the weight for this event - virtual StatusCode - objectWeight (const xAOD::Photon& photon, float& weight) override; - - private: - // CP tools - - /// The efficiency correction tool - asg::AnaToolHandle<IAsgPhotonEfficiencyCorrectionTool> m_efficiencyTool; - asg::AnaToolHandle<IAsgPhotonEfficiencyCorrectionTool> m_isoSFTool; - - /// Configuration - - /// Is this AF2? - bool m_isAF2; - - /// Isolation working point - std::string m_isolationWP; - /// Will isolation be used - bool m_doIsolation; - - }; // class PhotonToolWeight - -} // namespace ana - -#endif - diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/PileupTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/PileupTool.h deleted file mode 100644 index 7a0bdfa65c9b00dc96abd6333c7fd9720547f199..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/PileupTool.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__PILEUP_TOOL_H -#define QUICK_ANA__PILEUP_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <AthContainers/AuxElement.h> -#include <QuickAna/AnaTool.h> -#include <AsgTools/AnaToolHandle.h> - -namespace CP {class IPileupReweightingTool;} - -namespace ana -{ - /// @class PileupTool - /// @brief QuickAna tool which wraps and applies the pileup reweighting - /// - /// Official pileup reweighting twiki page: - /// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ExtendedPileupReweighting - /// - class PileupTool : virtual public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (PileupTool, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - PileupTool (const std::string& name); - - /// \copydoc IAnaTool::setObjectType - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - /// returns: the processing step we are working on - /// guarantee: no-fail - virtual AnalysisStep step () const override; - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes () const override; - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes () const override; - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode execute (IEventObjects& objects) override; - - /// \brief the files with the vertex distribution in data - public: - std::vector<std::string> muDataFiles; - - /// \brief the files with the vertex distribution for the current MC - public: - std::vector<std::string> muMcFiles; - - /// \brief the pileup reweighting tool itself - private: - asg::AnaToolHandle<CP::IPileupReweightingTool> m_tool; - - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/QuickAna.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/QuickAna.h deleted file mode 100644 index d2be0aa0befae7304dfc0b5aae5632e5a33868ee..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/QuickAna.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__EVENT_TOOL_H -#define QUICK_ANA__EVENT_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <AsgTools/AsgTool.h> -#include <QuickAna/Configuration.h> -#include <QuickAna/IQuickAna.h> - -namespace ana -{ - /// TODO: needs documentation - class QuickAna : virtual public IQuickAna, - virtual public asg::AsgTool, - public Configuration - { - // - // public interface - // - - ASG_TOOL_CLASS2 (QuickAna, ana::IQuickAna, CP::ISystematicsTool) - - - /// effects: test the invariant of this object - /// guarantee: no-fail - public: - void testInvariant () const; - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - QuickAna (const std::string& name); - - - /// effects: standard destructor - /// guarantee: no-fail - public: - ~QuickAna (); - - - /// rationale: no slicing -#ifndef __CINT__ - QuickAna (const QuickAna& that) = delete; - QuickAna& operator = (const QuickAna& that) = delete; -#endif - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - public: - virtual StatusCode initialize() -#ifndef __CINT__ - override -#endif - ; - - - /// returns: whether this tool is affected by the given systematis - /// guarantee: strong - /// failures: out of memory II - public: - virtual bool - isAffectedBySystematic (const CP::SystematicVariation& systematic) const -#ifndef __CINT__ - override -#endif - ; - - /// returns: the list of all systematics this tool can be affected by - /// guarantee: strong - /// failures: out of memory II - public: - virtual CP::SystematicSet - affectingSystematics () const -#ifndef __CINT__ - override -#endif - ; - - - /// returns: the list of all systematics this tool recommends to use - /// guarantee: strong - /// failures: out of memory II - public: - virtual CP::SystematicSet - recommendedSystematics () const -#ifndef __CINT__ - override -#endif - ; - - - /// effects: configure this tool for the given list of systematic - /// variations. any requested systematics that are not - /// affecting this tool will be silently ignored (unless they - /// cause other errors). - /// guarantee: basic - /// failures: systematic unknown - /// failures: requesting multiple variations on the same - /// systematic (e.g. up & down) - /// failures: requesting an unsupported variation on an otherwise - /// supported systematic (e.g. a 2 sigma variation and the tool - /// only supports 1 sigma variations) - /// failures: unsupported combination of supported systematic - /// failures: other tool specific errors - public: - virtual CP::SystematicCode - applySystematicVariation (const CP::SystematicSet& systConfig) -#ifndef __CINT__ - override -#endif - ; - - /// description: the tool scheduler we use - public: - std::unique_ptr<IToolScheduler> toolScheduler; - - - - // - // inherited interface - // - - /// effects: process the given event - /// guarantee: basic - public: - virtual StatusCode process () -#ifndef __CINT__ - override -#endif - ; - using IQuickAna::process; - - /// effects: calculate the weight for this event - /// returns: the calculated weight - /// guarantee: basic - /// failures: tool dependent - public: - virtual float weight () -#ifndef __CINT__ - override -#endif - ; - - - /// description: the weight for the event (without object weights) - /// guarantee: no-fail - public: - virtual float eventWeight () -#ifndef __CINT__ - override -#endif - ; - - - /// description the overall object structure - /// guarantee: no-fail - public: - virtual const IEventObjects& objects () const -#ifndef __CINT__ - override -#endif - ; - - - /// \copydoc IQuickAna::internalConfiguration - public: - virtual const InternalConfiguration& internalConfiguration () -#ifndef __CINT__ - override -#endif - ; - - - virtual xAOD::EventInfo* eventinfo () const -#ifndef __CINT__ - override -#endif - ; - virtual xAOD::MuonContainer* muons () const -#ifndef __CINT__ - override -#endif - ; - virtual xAOD::ElectronContainer* electrons () const -#ifndef __CINT__ - override -#endif - ; - virtual xAOD::PhotonContainer* photons () const -#ifndef __CINT__ - override -#endif - ; - virtual xAOD::TauJetContainer* taus () const -#ifndef __CINT__ - override -#endif - ; - virtual xAOD::JetContainer* jets () const -#ifndef __CINT__ - override -#endif - ; - virtual xAOD::JetContainer* fat_jets () const -#ifndef __CINT__ - override -#endif - ; - virtual xAOD::MissingET* met () const -#ifndef __CINT__ - override -#endif - ; - virtual xAOD::MissingET* met2 () const -#ifndef __CINT__ - override -#endif - ; - - - /// \brief the list of systematics configured - /// \par Guarantee - /// no-fail - public: - virtual const std::vector<CP::SystematicSet>& systematics () const -#ifndef __CINT__ - override -#endif - ; - - - /// \brief set the value of \ref systematics - /// \par Guarantee - /// basic - /// \par Failures - /// systematics configuration error - public: - virtual StatusCode - setSystematics (const std::vector<CP::SystematicSet>& val_systematics) -#ifndef __CINT__ - override -#endif - ; - - - public: - virtual EventData getEventData () const override; - - - - // - // private interface - // - - /// description: the pimpl - private: - struct Pimpl; - Pimpl *pimpl; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionChoice.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionChoice.h deleted file mode 100644 index d9a443adfc1c97ca6def187a383815db141824d9..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionChoice.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__SELECTION_CHOICE_H -#define QUICK_ANA__SELECTION_CHOICE_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -namespace ana -{ - /// \brief the different values for a cut selection - /// - /// the main purpose of this is to know whether a selection flag has - /// been set or not. but it is also nice to give it names instead - /// of true and false - - enum class SelectionChoice - { - /// \brief the cut has failed - FAIL, - - /// \brief the cut has passed - PASS, - - /// \brief the cut has not been assigned - UNASSIGNED - }; - - template<> struct EnumSize<SelectionChoice> - { - static const unsigned size = unsigned (SelectionChoice::UNASSIGNED) + 1; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionCut.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionCut.h deleted file mode 100644 index 497d54e8bb00e045b71bd9f633b4fa7b55fa187f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionCut.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__SELECTION_CUT_H -#define QUICK_ANA__SELECTION_CUT_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -#include <cstddef> - -namespace ana -{ - /// \brief a class for setting a single selection cut - /// - /// this class is used inside selection (or correction) tools, to - /// represent the different cuts that the tool performs (with one - /// object per cut). to that end the owning tool should call - /// registerCut() inside initialize and then call setPass/setFail in - /// execute. - /// - /// to make things less ambigious (i.e. if we a selection cut is - /// true does it mean it passes or it fails?), the method always - /// include pass or fail in the name. - - class SelectionCut - { - // - // public interface - // - - /// \brief test the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - public: - SelectionCut (); - - - /// \brief get the selection choice for the cut - /// \par Guarantee - /// no-fail - /// \pre cut has been configured - public: - SelectionChoice get () const; - - - /// \brief get whether we passed - /// \par Guarantee - /// no-fail - public: - bool getPass () const; - - - /// \brief get whether we failed - /// \par Guarantee - /// no-fail - public: - bool getFail () const; - - - /// \brief set the selection choice for the cut - /// \par Guarantee - /// no-fail - /// \pre cut has been configured - public: - void set (SelectionChoice choice) const; - - - /// \brief set whether the cut passed - /// \par Guarantee - /// no-fail - /// \pre cut has been configured - public: - void setPassedIf (bool pass) const; - - - /// \brief set whether the cut failed - /// \par Guarantee - /// no-fail - /// \pre cut has been configured - public: - void setFailedIf (bool fail) const; - - - /// \brief configure this cut to point to the given object - /// \par Guarantee - /// no-fail - public: - void configure (SelectionData *val_data, std::size_t val_index); - - - - // - // private interface - // - - /// \brief the selection data object - private: - SelectionData *m_data; - - /// \brief the index of this cut - private: - std::size_t m_index; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionData.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionData.h deleted file mode 100644 index e3717ca9df485a54e29a5c5890beb6b6a1b9df19..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionData.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__SELECTION_DATA_H -#define QUICK_ANA__SELECTION_DATA_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -#include <QuickAna/SelectionStep.h> -#include <QuickAna/xAODInclude.h> - -namespace ana -{ - /// \brief this class manages all the selection data for a single - /// correction or selection tool. - - class SelectionData - { - // - // public interface - // - - /// \brief test the invariant of this object - /// \par Guarantee - /// no-fail - public: - void testInvariant () const; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory I - public: - SelectionData (); - - - /// \brief add a cut with the given name and selection step - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - /// \pre !isInitialized() - public: - void registerCut (SelectionStep step, const std::string& name, - SelectionCut& cut); - - - /// \brief the number of cuts configured - /// \par Guarantee - /// no-fail - public: - std::size_t size () const; - - - /// \brief initialize this object - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - /// \pre !isInitialized() - /// \post isInitialized() - public: - StatusCode initialize (const InternalConfiguration& configuration, - const std::string& workingPoint); - - - /// \brief whether initialize() has been called successfully - /// \par Guarantee - /// no-fail - public: - bool isInitialized () const; - - - /// \brief prepare for the given particle - /// \par Guarantee - /// basic - /// \par Failures - /// xAOD errors - /// \pre isInitialized() - public: - StatusCode prepare (SG::AuxElement *particle); - - - /// \brief whether we can get information by running the - /// associated selection tool - /// - /// this is mostly meant to optimize away selection tools on - /// objects that have already been rejected - /// \par Guarantee - /// no-fail - /// \pre isInitialized() - public: - bool needSelectionTool (); - - - /// \brief get the given variable to the given choice - /// \par Guarantee - /// no-fail - /// \pre isInitialized() - /// \pre cut < size() - public: - SelectionChoice getCut (std::size_t cut); - - - /// \brief set the given variable to the given choice - /// \par Guarantee - /// no-fail - /// \pre isInitialized() - /// \pre cut < size() - public: - void setCut (std::size_t cut, SelectionChoice choice); - - - /// \brief set the decorations on the associated particle - /// \par Guarantee - /// basic - /// \par Failures - /// xAOD errors - /// \pre isInitialized() - public: - void apply (); - - - - // - // private interface - // - - /// \brief the accessor type we use - private: - typedef SG::AuxElement::Accessor<SelectType> AccessorType; - - /// \brief the state of this tool - private: - enum class State - { - /// \brief something happened that BROKE this tool - BROKEN, - - /// \brief we are initializing the tool - INITIAL, - - /// \brief we are fully initialized - RUNNING - }; - - /// \brief the state of this tool - private: - State m_state; - - - /// \brief the information for each cut - private: - struct CutInfo - { - /// \brief the selection step this goes into - public: - SelectionStep step; - - /// \brief the name of the cut - public: - std::string name; - - /// \brief the accessor for this cut - public: - AccessorType accessor; - - /// \brief whether we have been selected - public: - SelectionChoice selection; - - CutInfo (); - }; - - /// \brief the list of cuts - private: - std::vector<CutInfo> m_cuts; - - - /// \brief the information for the different selection steps - struct SelectionInfo - { - /// \brief the accessor for this cut - public: - AccessorType accessor; - - /// \brief whether we have been selected - public: - bool select; - - SelectionInfo (); - }; - - /// \brief the list of selection steps - private: - SelectionInfo m_selections [EnumSize<SelectionStep>::dataSize]; - - - /// \brief the first step we apply this selection to - private: - SelectionStep m_firstStep; - - - /// \brief the particle we are operating on - private: - SG::AuxElement *m_particle; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionStep.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionStep.h deleted file mode 100644 index d99cef37aca12f5a70e2f57cd460ed559b181655..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SelectionStep.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__SELECTION_STEP_H -#define QUICK_ANA__SELECTION_STEP_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#include <QuickAna/Global.h> - -namespace ana -{ - /// \brief the different levels of selection we have - /// - /// if one selection step fails, it implies that the subsequent - /// steps also fail. - - enum class SelectionStep - { - /// \brief selections that go into the MET definition - MET, - - /// \brief selections that go into overlap removal - OR, - - /// \brief selections that go into the final analysis objects - ANALYSIS, - - /// \brief selections that the user can manually include - /// - /// there is no actual decoration for this step (unlike the other - /// ones), but the user can still manually read the individual cut - /// decorations from the object. - /// - /// the purpose of this value is to exclude a cut from the cut - /// flow without removing the cut decoration from the object. - MANUAL - }; - - template<> struct EnumSize<SelectionStep> - { - static const unsigned size = unsigned (SelectionStep::MANUAL) + 1; - - /// \brief the number of selection steps that actually have - /// decorations on the object. - static const unsigned dataSize = unsigned (SelectionStep::MANUAL); - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SusyORTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SusyORTool.h deleted file mode 100644 index 7289ab1036b8c7a58663f4863ef1a75d3779905e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/SusyORTool.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__SUSY_OR_TOOL_H -#define QUICK_ANA__SUSY_OR_TOOL_H - -/// This file provides the SUSY-specific overlap-removal code. -/// Like the default ORTool implementation, this wraps the OverlapRemovalTool -/// from Association Utils. However, the usage of the tool is a little bit -/// different. - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/xAODInclude.h> - -// OverlapRemovalTool doesn't forward declare it! -#include "AssociationUtils/OverlapDecorationHelper.h" - -// Forward declarations -namespace ORUtils -{ - class IOverlapTool; -} - -namespace ana -{ - /// @brief Implementation of the SUSY overlap-removal recommendations. - /// This QuickAna tool wraps the OverlapRemovalTool and applies the custom - /// overlap-removal prescription recommended by the SUSY working group. - /// - class SusyORTool : public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (SusyORTool, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - SusyORTool (const std::string& name); - - - /// \copydoc IAnaTool::setObjectType - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - - /// returns: the processing step we are working on - /// guarantee: no-fail - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes () const override; - - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode execute (IEventObjects& objects) override; - - protected: - - /// \brief print overlap removal debugging information - void printObj (const char* APP_NAME, const char* type, - const xAOD::IParticle* obj) const; - - private: - - // Configuration - - /// Helper used to reset decorations - std::unique_ptr<ORUtils::OverlapDecorationHelper> m_decHelper; - - /// The ele-mu overlap tool - asg::AnaToolHandle<ORUtils::IOverlapTool> m_eleMuTool; - /// The ele-jet overlap tool - asg::AnaToolHandle<ORUtils::IOverlapTool> m_eleJetTool; - /// The mu-jet overlap tool - asg::AnaToolHandle<ORUtils::IOverlapTool> m_muJetTool; - /// The pho-ele overlap tool - asg::AnaToolHandle<ORUtils::IOverlapTool> m_phoEleTool; - /// The pho-jet overlap tool - asg::AnaToolHandle<ORUtils::IOverlapTool> m_phoJetTool; - - /// OR input decoration name - std::string m_orInputLabel; - - /// OR output decoration name - std::string m_orOutputLabel; - - /// B-jet decoration name - std::string m_bJetLabel; - - /// Use a specialized muon OR - bool m_customMuons; - - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TauTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TauTool.h deleted file mode 100644 index 3892e93d8028091eecdd76ddc859f472d4728b4c..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TauTool.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__TAU_TOOL_H -#define QUICK_ANA__TAU_TOOL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -/// -/// The current tau recommendations come from here: -/// https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauRecommendationsSummer2016 -/// - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaToolCorrect.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/AnaToolSelect.h> -#include <QuickAna/AnaToolWeight.h> -#include <QuickAna/SelectionCut.h> - -/// Forward declarations -namespace TauAnalysisTools -{ - class ITauSmearingTool; - class ITauSelectionTool; - class ITauEfficiencyCorrectionsTool; - class ITauTruthMatchingTool; -} - -namespace ana -{ - - /// @brief Tool for the correction of taus. - /// - /// This tool wraps and applies the Tau CP smearing tool. - /// There is a cut affiliated with the validity-range of that smearing tool. - /// The correction-related systematics are applied here as well. - /// - class TauToolCorrect : virtual public AnaToolCorrect<xAOD::TauJetContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS(TauToolCorrect, ana::IAnaTool) - - public: - // Public interface methods - - /// @brief Standard constructor - TauToolCorrect(const std::string& name); - - /// @brief Initialize this tool. - /// Returns failure on configuration error. - StatusCode initialize() override; - - /// @brief Run the calibration on this event. - /// The accept flags tells whether we accept the tau. - virtual StatusCode - correctObject(xAOD::TauJet& tau) override; - - private: - // CP tools - - /// The tau CP smearing tool. - asg::AnaToolHandle<TauAnalysisTools::ITauSmearingTool> m_smearTool; - - /// Smearing tool cut rejects out-of-validity taus - SelectionCut cut_smear_tool; - - }; // class TauToolCorrect - - - - /// @brief Tool for selection of analysis taus - /// - /// Applies the common tau selections - /// - class TauToolSelect : virtual public AnaToolSelect<xAOD::TauJetContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS(TauToolSelect, ana::IAnaTool) - - public: - // Public interface methods - - /// @brief Standard constructor - TauToolSelect(const std::string& name); - - /// @brief Initialize this tool. - /// Returns failure on configuration error. - StatusCode initialize() override; - - /// @brief Apply selection on this tau. - /// The accept flag gives the result. - virtual StatusCode - selectObject(xAOD::TauJet& tau) override; - - private: - - /// @name Configuration properties - /// @{ - - /// Path to the config file to use for setting TauSelectionTool properties - std::string m_configFile; - - /// @} - - /// The tau CP selection tool - asg::AnaToolHandle<TauAnalysisTools::ITauSelectionTool> m_selectionTool; - - /// The tau CP selection tool cut - SelectionCut m_selectionToolCut; - - }; // class TauToolSelect - - - - /// @brief Tool for calculating the weights for analysis taus - /// - /// Applies the tau ID efficiency scale factors - class TauToolWeight : virtual public AnaToolWeight<xAOD::TauJetContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS(TauToolWeight, ana::IAnaTool) - - public: - // Public interface methods - - /// @brief Standard constructor - TauToolWeight(const std::string& name); - - /// @brief Initialize this tool. - /// Returns failure on configuration error. - StatusCode initialize() override; - - /// @brief Calculate the weight for this tau. - /// Assigns result to weight. - virtual StatusCode - objectWeight(const xAOD::TauJet& tau, float& weight) override; - - private: - - /// @name Configuration properties - /// @{ - - /// The config file for the tau selection. Used here to communicate tau ID - /// settings to the TauEfficiencyCorrectionsTool. - //std::string m_configFile; - - /// @} - - /// @name CP tools - /// @{ - - /// Shared handle on the tau selection tool, for passing config to SF tool - asg::AnaToolHandle<TauAnalysisTools::ITauSelectionTool> m_selectionTool; - - /// The tau CP efficiency tool - asg::AnaToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> m_effTool; - - /// @} - - }; // class TauToolWeight - - - - /// @brief Tool which applies the tau-truth matching. - /// Applies the TauTruthMatchingTool from TauAnalysisTools which decorates - /// taus with an ElementLink to their truth particle match. This ElementLink - /// is needed for tau smearing in the TauToolCorrect. It is possible to - /// generate the truth link in your derivations, in which case this tool - /// is not needed. - /// - /// @author Steve Farrell <Steven.Farrell@cern.ch> - /// - class TauToolTruth : virtual public AnaTool, virtual public IAnaTool - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS(TauToolTruth, ana::IAnaTool) - - public: - - /// Standard constructor - TauToolTruth(const std::string& name); - - /// @copydoc IAnaTool::setObjectType - virtual StatusCode - setObjectType(ObjectType type, const std::string& workingPoint) override; - - /// @copydoc IAnaTool::step - virtual AnalysisStep step() const override; - - /// @copydoc IAnaTool::inputTypes - virtual unsigned inputTypes() const override; - /// @copydoc IAnaTool::outputTypes - virtual unsigned outputTypes() const override; - - /// @brief Initialize this tool - virtual StatusCode initialize() override; - - /// @copydoc IAnaTool::execute - virtual StatusCode execute(IEventObjects& objects) override; - - protected: - - /// Applies truth matching to a single tau - //virtual StatusCode matchobject(const xAOD::TauJet& tau) override; - - private: - - /// @brief Cache the last event number. - /// Used to call the CP tool initializeEvent method only once per event. - mutable unsigned long long m_lastEventNumber; - - // Configuration - - /// Toggle writing of tau truth container - bool m_writeTruthTaus; - - // CP tools - - /// The tau truth-match CP tool - asg::AnaToolHandle<TauAnalysisTools::ITauTruthMatchingTool> m_truthTool; - - }; // class TauToolTruth - -} // namespace ana - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ToolScheduler.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ToolScheduler.h deleted file mode 100644 index f0778fb5d26f246520cae03b09113f4404c742e7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ToolScheduler.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__TOOL_SCHEDULER_H -#define QUICK_ANA__TOOL_SCHEDULER_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <AsgTools/AsgTool.h> -#include <QuickAna/EventObjects.h> -#include <QuickAna/IToolScheduler.h> - -namespace CP -{ - class SystematicSet; -} - -namespace ana -{ - /// TODO: needs documentation - class ToolScheduler : virtual public IToolScheduler, virtual public asg::AsgTool - { - // - // public interface - // - - ASG_TOOL_CLASS (ToolScheduler, ana::IToolScheduler) - - - /// effects: test the invariant of this object - /// guarantee: no-fail - public: - void testInvariant () const; - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - ToolScheduler (const std::string& name); - - - /// \brief standard destructor - /// - /// I defined my own destructor to break include file dependencies - /// in Athena - /// \par Guarantee - /// no-fail - public: - ~ToolScheduler (); - - - - // - // inherited interface - // - - public: - virtual StatusCode initialize() override; - - public: - virtual StatusCode addTool (std::unique_ptr<IAnaTool> tool) override; - - public: - virtual CP::SystematicSet affectingSystematics () const override; - - public: - virtual CP::SystematicSet recommendedSystematics() const override; - - public: - virtual StatusCode - applySystematicVariation (const CP::SystematicSet& systConfig) override; - - public: - virtual StatusCode - fillEventObjects (IEventObjects*& object) override; - - /// \copydoc IToolScheduler::systematics - public: - virtual const std::vector<CP::SystematicSet>& systematics () const override; - - public: - virtual StatusCode - setSystematics (const std::vector<CP::SystematicSet>& val_systematics) - override; - - public: - virtual EventData getEventData () const override; - - - - // - // private interface - // - - /// description: the list of object definitions we are using - private: - std::vector<std::unique_ptr<IAnaTool> > m_tools; - - /// description: the event objects - private: - EventObjects m_objects; - - /// \brief the current postfix - private: - std::string m_postfix; - - /// \brief the value of \ref systematics - private: - std::vector<CP::SystematicSet> m_systematics; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TopElectronTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TopElectronTool.h deleted file mode 100644 index 0e7c626ce2f8df6a775170ec35487276c426663c..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TopElectronTool.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__TOP_ELECTRON_TOOL_H -#define QUICK_ANA__TOP_ELECTRON_TOOL_H - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - -// It is flexible enough to provide: -// Defintions corresponding to the default top group object selection(s) -// (as implemented in the AnalysisTop packages) -// Definitions for some other analyses that use slightly modified object selections -// (e.g., Top/Exotics SS+bjets) - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaToolCorrect.h> -#include <QuickAna/AnaToolSelect.h> - -// #include <QuickAna/IsolationTools.h> -#include <QuickAna/SelectionCut.h> - -namespace ana -{ - /// @brief Tool for the correction of electrons - /// - /// Applies correction-related systematics as well - /// - class TopElectronToolPreCorrect : virtual public AnaToolCorrect<xAOD::ElectronContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS (TopElectronToolPreCorrect, ana::IAnaTool) - - public: - // Public interface methods - - /// Standard constructor - TopElectronToolPreCorrect (const std::string& name); - - /// \copydoc IAnaTool::step - public: - virtual AnalysisStep step () const override; - - /// Initialize this tool - StatusCode initialize() override; - - /// Run the correction on this event - virtual StatusCode - correctObject (xAOD::Electron& electron) override; - - private: - bool trackSelector(const xAOD::TrackParticle &trk); - }; - - - /// @brief Tool for selection of analysis electrons - /// - /// Applies top default electron selections - /// - class TopElectronToolSelect : virtual public AnaToolSelect<xAOD::ElectronContainer> - { - - /// This macro generates a proper constructor for Athena - ASG_TOOL_CLASS (TopElectronToolSelect, ana::IAnaTool) - - public: - // Public interface methods - - /// Standard constructor - TopElectronToolSelect (const std::string& name); - - /// Initialize this tool - StatusCode initialize() override; - - /// Apply selection on this object - virtual StatusCode - selectObject (xAOD::Electron& electron) override; - - private: - - // Configuration - - /// quality string - std::string m_idStr; - - /// minimum pT - double m_ptMin; - /// maximum |eta| - double m_etaMax; // Note: this is not configurable in TopObjectSelectionTools - /// veto the crack region? - bool m_vetoCrack; - - /// |z0| cut - double m_z0cut; - - public: - /// isolation tool - std::unique_ptr<IsolationBase> m_isolation; - - SelectionCut cut_author; - SelectionCut cut_pt; - SelectionCut cut_id; - SelectionCut cut_etaMax; - SelectionCut cut_etaCrack; - SelectionCut cut_z0; - SelectionCut cut_isolation; - }; - - - StatusCode makeTopElectronTool (DefinitionArgs& args, - const std::string& quality_str, - IsolationBase* isolation=nullptr, - double z0cut=-1., - bool vetoCrack=true); -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TopMuonTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TopMuonTool.h deleted file mode 100644 index 83d14738db3c89b03c4bda821277882a2958cff3..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TopMuonTool.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__TOPMUON_TOOL_H -#define QUICK_ANA__TOPMUON_TOOL_H - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - -// It is flexible enough to provide: -// Defintions corresponding to the default top group object selection(s) -// (as implemented in the AnalysisTop packages) -// Definitions for some other analyses that use slightly modified object selections -// (e.g., Top/Exotics SS+bjets) - - - -#include <QuickAna/Global.h> - -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/AnaToolCorrect.h> -#include <QuickAna/AnaToolSelect.h> -#include <QuickAna/SelectionCut.h> - -// #include <QuickAna/IsolationTools.h> - -namespace CP -{ - class IMuonSelectionTool; -} - -namespace ana -{ - /// This class is added so we can add additional variables that are common to - class TopMuonToolPreCorrect : public AnaToolCorrect<xAOD::MuonContainer> - { - // - // public interface - // - - ASG_TOOL_CLASS (TopMuonToolPreCorrect, ana::IAnaTool) - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - TopMuonToolPreCorrect (const std::string& name); - - - /// \copydoc IAnaTool::step - public: - virtual AnalysisStep step () const override; - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - public: - StatusCode initialize() override; - - - /// effects: run the calibration on this event - /// returns: whether we accepted the event - /// guarantee: basic - /// failures: tool dependent - public: - virtual StatusCode - correctObject (xAOD::Muon& muon) override; - - - private: - bool trackSelector(const xAOD::TrackParticle &trk); - }; - - - - class TopMuonToolSelect : public AnaToolSelect<xAOD::MuonContainer> - { - // - // public interface - // - - ASG_TOOL_CLASS (TopMuonToolSelect, ana::IAnaTool) - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - public: - TopMuonToolSelect (const std::string& name); - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - public: - StatusCode initialize() override; - - - /// returns: whether the object passes object selection - /// guarantee: basic - /// failures: definition dependent - public: - virtual StatusCode - selectObject (xAOD::Muon& muon) override; - - - /// quality - public: - xAOD::Muon::Quality m_quality; - - /// author - public: - xAOD::Muon::Author m_author; - - /// islation tool - public: - std::unique_ptr<IsolationBase> m_isolation; - - /// |z0| cut - public: - double m_z0cut; - - /// |d0_significance| cut - public: - double m_sd0cut; - - /// the selection tool - public: - asg::AnaToolHandle<CP::IMuonSelectionTool> m_selection; - - private: - SelectionCut cut_selection; - SelectionCut cut_author; - SelectionCut cut_minPt; - SelectionCut cut_maxEta; - SelectionCut cut_z0; - SelectionCut cut_sd0; - SelectionCut cut_isolation; - }; - - StatusCode makeTopMuonTool (DefinitionArgs& args, - xAOD::Muon::Quality quality = xAOD::Muon::Tight, - xAOD::Muon::Author author = xAOD::Muon::MuidCo, - IsolationBase* isolation = nullptr, - double z0cut = -1., - double sd0cut = -1.); -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TopOverlapRemovalTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TopOverlapRemovalTool.h deleted file mode 100644 index 016d069fc27752f92b676ec1a8dcee450ef4a65c..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TopOverlapRemovalTool.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__TOPOVERLAPREMOVALTOOL_H -#define QUICK_ANA__TOPOVERLAPREMOVALTOOL_H - -#include <QuickAna/Global.h> - -#include <AssociationUtils/OverlapRemovalTool.h> - -namespace ana -{ - -// Put the tool in a namespace? - -/// Overlap removal tool that supports the Run 1 top group recommendation + -/// some modified versions -/// -/// The parent class implements the harmonized object overlap removal -/// recommendations from the harmonization study group 5, given in -/// https://cds.cern.ch/record/1700874 -/// -/// @author Xiaowen Lei <Xiaowen.Lei@cern.ch> -/// -class TopOverlapRemovalTool : public OverlapRemovalTool -{ - - /// Create a proper constructor for Athena - ASG_TOOL_CLASS(TopOverlapRemovalTool, IOverlapRemovalTool) - - public: - - /// Constructor for standalone usage - TopOverlapRemovalTool(const std::string& name); - /// Destructor - ~TopOverlapRemovalTool(); - - /// @name Methods implementing the IOverlapRemovalTool interface - /// @{ - - /// Remove overlapping electrons and jets - /// This method will decorate both the electrons and jets according to - /// both the e-jet and jet-e overlap removal prescriptions. - /// -- compared to the method in the parent, eta is used - /// (TODO: this will be studied) - /// -- also, remove **single** closest jet within dR of an electron - /// (TODO: I think this should be the default behavior. Talk to Steve.) - /// A more appropriate function name : removeEleJetOverlapEtaPhi - virtual StatusCode removeEleJetOverlap(const xAOD::ElectronContainer& electrons, - const xAOD::JetContainer& jets); - - /// Remove muons overlapping jets - /// A more appropriate function name : removeMuonsOverlappingJetEtaPhi - virtual StatusCode removeMuonJetOverlap(const xAOD::MuonContainer& muons, - const xAOD::JetContainer& jets); - //bool use_vari_dR = false); - - /// @} - - - private: - - /// Determine if objects overlap by a simple dR comparison - /// -- with dR calculated from dEta and dPhi - bool objectsOverlapEtaPhi(const xAOD::IParticle* p1, const xAOD::IParticle* p2, - double dRMax, double dRMin = 0); - - /// Run 1 calculation of overlap distance parameter, (delta R)^2. - /// dR^2 = (eta1-eta2)^2 + (phi1-phi2)^2 - /// Note this is calculated with the pseudorapidity, same as - /// TLorentzVector::DeltaR (DrEtaPhi). - double dR2EtaPhi(const xAOD::IParticle* p1, const xAOD::IParticle* p2); - /// deltaR = sqrt( deltaR2 ) - double dREtaPhi(const xAOD::IParticle* p1, const xAOD::IParticle* p2); - - /// electron-jet overlap cone (removes electron) - float m_electronJetDREtaPhi; - /// jet-electron overlap cone (removes jet) - float m_jetElectronDREtaPhi; - /// muon-jet overlap cone - float m_muonJetDREtaPhi; - - /// Use variable dR for removing muons overlapping a jet - bool m_muORJetVariDR; - -}; // class TopOverlapRemovalTool - -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TriggerTool.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TriggerTool.h deleted file mode 100644 index 1419b797719b4ca3ee0d2ba867578518ceea4095..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TriggerTool.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__TRIGGER_TOOL_H -#define QUICK_ANA__TRIGGER_TOOL_H - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaTool.h> -#include <AsgTools/AnaToolHandle.h> -#include <QuickAna/xAODInclude.h> -#include <AsgTools/ToolHandle.h> - - - - -namespace Trig{ - class TrigDecisionTool; - class IMatchingTool; -} - -namespace TrigConf {class ITrigConfigTool;} - -// Scale factor clases -namespace CP {class IMuonTriggerScaleFactors;} -class IAsgElectronEfficiencyCorrectionTool; - -namespace ana -{ - /// First-run trigger tool. Gets trigger decision and decorates with it. - class TriggerBasicTool : public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (TriggerBasicTool, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - TriggerBasicTool (const std::string& name); - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - /// returns: the processing step we are working on - /// guarantee: no-fail - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes () const override; - - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode execute (IEventObjects& objects) override; - - private: - std::string m_trigList; - std::string m_groupName; - std::vector<std::string> m_trig_names; - bool m_matchEl; - bool m_matchMu; - - asg::AnaToolHandle<Trig::TrigDecisionTool> m_trigDecTool; - asg::AnaToolHandle<TrigConf::ITrigConfigTool> m_trigconfigTool; - /// Muon Trigger Matching - asg::AnaToolHandle<Trig::IMatchingTool> m_triggerMatching; - - }; - - - - - /// Second-run trigger tool. Decides on 'final' matching (needs a pT cut) and - /// calculates a scale factor for leptons. - class TriggerSFTool : public AnaTool - { - // - // public interface - // - - ASG_TOOL_CLASS (TriggerSFTool, ana::IAnaTool) - - public: - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory II - TriggerSFTool (const std::string& name); - - - /// \copydoc IAnaTool::useInitialConfiguration - virtual StatusCode - useInitialConfiguration (const InternalConfiguration& conf) override; - - - /// effects: initialize this tool - /// guarantee: basic - /// failures: configuration errors - StatusCode initialize() override; - - - virtual StatusCode - setObjectType (ObjectType type, const std::string& workingPoint) override; - - - - /// returns: the processing step we are working on - /// guarantee: no-fail - virtual AnalysisStep step () const override; - - - /// \copydoc IAnaTool::inputTypes - virtual unsigned inputTypes () const override; - - - /// \copydoc IAnaTool::outputTypes - virtual unsigned outputTypes () const override; - - - /// effects: apply this analysis tool to the objects - /// guarantee: basic - /// failures: tool dependent - virtual StatusCode execute (IEventObjects& objects) override; - - /// Enum to describe year configuration - enum TrigYear { - Only2015, - Only2016, - Only2015_2016 - }; - - protected: - - /// \brief print overlap removal debugging information - - private: - std::string m_trigList; - std::string m_groupName; - std::string m_muon_trig_str; - bool m_matchEl; - bool m_matchMu; - /// Is using AF2? - bool m_isAF2; - /// Is using data? - bool m_isData; - /// Which muon working point? - std::string m_muon_wp; - /// Which electron working point? - std::string m_ele_wp; - /// Which muon isolation working point? - std::string m_muon_iso_wp; - /// Which electron isolation working point? - std::string m_ele_iso_wp; - /// Do we have a reasonable electron setup? - bool m_isEleToolSetup; - - /// The pT threshold of the trigger. Muon tools only want - // to be sent muons at least above a certain pT - double m_TriggerPtThreshold; - - // For holding the year configuration - // Note: enum doesn't compile in athena; int doesn't run in RootCore - int m_year; - - // Muon trigger scale factors - asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> m_mu_trig_sf2015; - asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> m_mu_trig_sf2016; - // Electron trigger scale factor - asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> m_el_trig_sf; - asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> m_el_trig_eff; - - asg::AnaToolHandle<CP::IMuonTriggerScaleFactors>& muonSFToolForThisYear(const int runNumber); - - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TruthJetTools.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TruthJetTools.h deleted file mode 100644 index afd021ad3cc834a3c3cef5dd1e87384f913f71b8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/TruthJetTools.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__TRUTH_JET_TOOLS_H -#define QUICK_ANA__TRUTH_JET_TOOLS_H - -#include <QuickAna/Global.h> - -#include <QuickAna/AnaToolCorrect.h> -#include <QuickAna/AnaToolSelect.h> -// #include <xAODJet/JetContainer.h> - -namespace ana -{ - - /// @brief Correction tool for truth jets - /// - /// Doesn't really do anything currently besides set the - /// preselection flag to true, but in the future it may - /// contain some truth-to-reco smearing functionality. - /// - /// @author Steve Farrell <Steven.Farrell@cern.ch> - /// - class TruthJetToolCorrect : public AnaToolCorrect<xAOD::JetContainer> - { - - ASG_TOOL_CLASS (TruthJetToolCorrect, ana::IAnaTool) - - public: - - /// @brief Standard constructor - TruthJetToolCorrect (const std::string& name); - - /// @brief Initialize this tool - StatusCode initialize() override; - - /// @brief Apply selection to a truth jet - /// @param jet the truth jet - /// @param accept boolean selection flag passed by reference - virtual StatusCode correctObject (xAOD::Jet& jet) override; - - private: - - }; // class TruthJetToolCorrect - - - /// @brief Selection tool for truth jets - /// - /// Contains the slimmed down functionality necessary to select truth jets. - /// There is no reco-like cleaning tool. - /// - /// @author Steve Farrell <Steven.Farrell@cern.ch> - /// - class TruthJetToolSelect : public AnaToolSelect<xAOD::JetContainer> - { - - ASG_TOOL_CLASS (TruthJetToolSelect, ana::IAnaTool) - - public: - - /// @brief Standard constructor - TruthJetToolSelect (const std::string& name); - - /// @brief Initialize this tool - StatusCode initialize() override; - - /// @brief Apply selection to a truth jet - /// @param jet the truth jet - /// @param accept boolean selection flag passed by reference - virtual StatusCode selectObject (xAOD::Jet& jet) override; - - private: - - }; // class TruthJetToolSelect - -} // namespace ana - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ValidationEL.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ValidationEL.h deleted file mode 100644 index 7662965c27175558733a460eb2e02f4758022e02..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ValidationEL.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__VALIDATION_EL_H -#define QUICK_ANA__VALIDATION_EL_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#ifdef ROOTCORE - -#include <EventLoop/Algorithm.h> -#include <QuickAna/Configuration.h> -#include <memory> - -class TH1; - -namespace ana -{ - class ValidationEL : public EL::Algorithm, public ana::Configuration - { - /// description: the quickana tool handle - public: - std::unique_ptr<IQuickAna> quickAna; //! - - /// description: the histograms we create and fill - public: - ValidationHists *hists = nullptr; //! - - /// \brief whether to write AthSummary.txt - public: - bool m_writeSummary = false; - - /// \brief the number of files read - public: - unsigned m_filesRead = 0; //! - - /// \brief the number of events read - public: - unsigned m_eventsRead = 0; //! - - - - // this is a standard constructor - ValidationEL (); - - // this is a standard destructor - ~ValidationEL (); - - // these are the functions inherited from Algorithm - virtual EL::StatusCode setupJob (EL::Job& job); - virtual EL::StatusCode fileExecute (); - virtual EL::StatusCode histInitialize (); - virtual EL::StatusCode changeInput (bool firstFile); - virtual EL::StatusCode initialize (); - virtual EL::StatusCode execute (); - virtual EL::StatusCode postExecute (); - virtual EL::StatusCode finalize (); - virtual EL::StatusCode histFinalize (); - - // this is needed to distribute the algorithm to the workers - ClassDef(ValidationEL, 1); - }; -} - -#endif - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ValidationHists.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ValidationHists.h deleted file mode 100644 index a830306921616c0bb6f12d6ad30da99f87c5b374..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/ValidationHists.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__VALIDATION_HISTS_H -#define QUICK_ANA__VALIDATION_HISTS_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// This module still needs to be documented. The interface provided -// in this module is intended for experts only. The module is -// considered to be in the pre-alpha stage. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/xAODInclude.h> -#include <string> - -#ifdef ROOTCORE -#include <EventLoop/Global.h> -#endif - -class TH1; - -namespace ana -{ - class ValidationHists - { - // - // public interface - // - - /// effects: test the invariant of this object - /// guarantee: no-fail - public: - void testInvariant () const; - - - /// effects: standard constructor - /// guarantee: strong - /// failures: out of memory I - public: - ValidationHists (EL::Worker *val_worker, - const InternalConfiguration& configuration); - - - /// effects: fill the histograms for the given objects - /// guarantee: basic - /// failures: histogram creation errors - public: - void fillHists (const std::string& prefix, const IEventObjects& objects, - float weight); - - - /// effects: fill the histograms for the given object type - /// guarantee: basic - /// failures: histogram creation errors - public: - void fillHists (const std::string& prefix, - const xAOD::IParticleContainer& particles, - float weight); - void fillHists (const std::string& prefix, - const xAOD::MissingET& met, - float weight); - - - /// effects: fill a single histogram with the given binning and value - /// guarantee: basic - /// failures: histogram creation errors - public: - void fillHist (const std::string& name, unsigned nbins, float low, - float high, float value, float weight); - - - - // - // private interface - // - - /// description: the worker we are using - private: - EL::Worker *m_worker; - - /// description: the actual histograms we are using - private: - std::unordered_map<std::string,TH1*> m_hists; - - /// \brief the accessor to the selection - private: - SG::AuxElement::Accessor<SelectType> m_selectionAccessor; - }; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODEventSelect.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODEventSelect.h deleted file mode 100644 index b51676cf770cf8c3365acff441d2bb8607135b6c..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODEventSelect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__X_AOD_EVENT_INFO_H -#define QUICK_ANA__X_AOD_EVENT_INFO_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <xAODEventInfo/EventInfo.h> - -namespace ana -{ - typedef xAOD::EventInfo EventSelectType; -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODHelpers.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODHelpers.h deleted file mode 100644 index 22c32e13abd0a146f307598536786ae7d1e968d1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODHelpers.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__X_AOD_HELPERS_H -#define QUICK_ANA__X_AOD_HELPERS_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -#include <QuickAna/xAODInclude.h> -// #include <xAODBase/IParticleContainer.h> -#include <string> - -namespace ana -{ - /// \brief This namespace contains helper functions for dealing with - /// xAOD objects via ObjectType and void* pointers. - - namespace xAODHelpers - { - /// \brief perform a shallow copy and register it under the given - /// name in the store - StatusCode - makeShallow (StoreType& store, const std::string& name, ObjectType type, - void*& pointer, const std::string& inputName); - - /// \brief make a new object and register it under the given name - /// in the store - StatusCode - makeNew (StoreType& store, const std::string& name, ObjectType type, - void*& pointer); - - /// \brief get the given type converted into an IParticleContainer - xAOD::IParticleContainer * - getParticles (void *pointer, ObjectType type); - } -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODInclude.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODInclude.h deleted file mode 100644 index 135386d7c59d59caf7b05f6ada2a8a7a82793e28..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODInclude.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__X_AOD_INCLUDE_H -#define QUICK_ANA__X_AOD_INCLUDE_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -/// This header file contains include statements for all the xAOD -/// classes used in QuickAna. - -#include <QuickAna/Global.h> - -// #include <xAODBase/IParticle.h> -// #include <xAODBase/IParticleContainer.h> -// #include <xAODEgamma/Egamma.h> -// #include <xAODEgamma/EgammaContainer.h> -// #include <xAODEgamma/Electron.h> -#include <xAODEgamma/ElectronContainer.h> -// #include <xAODEgamma/Photon.h> -#include <xAODEgamma/PhotonContainer.h> -#include <xAODEventInfo/EventInfo.h> -// #include <xAODEventInfo/EventInfoContainer.h> -// #include <xAODJet/Jet.h> -#include <xAODJet/JetContainer.h> -// #include <xAODMissingET/MissingET.h> -// #include <xAODMissingET/MissingETAuxContainer.h> -#include <xAODMissingET/MissingETContainer.h> -// #include <xAODMuon/Muon.h> -#include <xAODMuon/MuonContainer.h> -// #include <xAODTau/TauJet.h> -#include <xAODTau/TauJetContainer.h> - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODTruth.h b/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODTruth.h deleted file mode 100644 index 0c93604d30a123bfe9badb744b34c48034832cc0..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/QuickAna/xAODTruth.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICK_ANA__X_AOD_TRUTH_H -#define QUICK_ANA__X_AOD_TRUTH_H - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - - -#include <QuickAna/Global.h> - -// #include <QuickAna/xAODInclude.h> -// // #include <xAODBase/IParticleContainer.h> -// #include <string> - -#include <xAODTruth/TruthParticleContainer.h> - -namespace asg -{ - class AsgTool; -} - -namespace xAOD -{ - class TEvent; -} - -#define NAME "TruthParticles" - -namespace ana -{ - const xAOD::TruthParticleContainer * - getCTruth (StoreType& store, const std::string& name = NAME, bool allowNull = false); -#ifdef ROOTCORE - const xAOD::TruthParticleContainer * - getCTruth (xAOD::TEvent& store, const std::string& name = NAME, bool allowNull = false); -#endif - const xAOD::TruthParticleContainer * - getCTruth (asg::AsgTool& tool, const std::string& name = NAME, bool allowNull = false); -#ifdef ROOTCORE - const xAOD::TruthParticleContainer * - getCTruth (const std::string& name = NAME, bool allowNull = false); -#endif -} - -#undef NAME - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaTool.cxx deleted file mode 100644 index a010208e1e9846da3bc994c899f715409b5c0cbe..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaTool.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/AnaTool.h> -#include <QuickAna/InternalConfiguration.h> - -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - void AnaTool :: - testInvariant () const - { - RCU_INVARIANT (this != 0); - } - - - - AnaTool :: - AnaTool (const std::string& name) - : AsgTool (name) - { - RCU_NEW_INVARIANT (this); - } - - - - void AnaTool :: - registerTool (IAsgTool *tool) - { - RCU_CHANGE_INVARIANT (this); - - CP::ISystematicsTool *systool - = dynamic_cast<CP::ISystematicsTool*> (tool); - if (systool) - { - ATH_MSG_INFO ("recovered missed ISystematicsTool: " << tool->name()); - registerTool (systool); - } else - { - ATH_MSG_WARNING ("tool not ISystematicsTool: " << tool->name()); - } - } - - - - void AnaTool :: - registerTool (CP::ISystematicsTool *tool) - { - RCU_CHANGE_INVARIANT (this); - m_systematicsTools.push_back (tool); - } - - - - bool AnaTool :: - isAffectedBySystematic (const CP::SystematicVariation& systematic) const - { - RCU_READ_INVARIANT (this); - for (auto tool : m_systematicsTools) - { - if (tool->isAffectedBySystematic (systematic)) - return true; - } - return false; - } - - - - CP::SystematicSet AnaTool :: - affectingSystematics () const - { - RCU_READ_INVARIANT (this); - CP::SystematicSet result; - for (auto tool : m_systematicsTools) - { - result.insert (tool->affectingSystematics()); - } - return result; - } - - - - CP::SystematicSet AnaTool :: - recommendedSystematics () const - { - RCU_READ_INVARIANT (this); - CP::SystematicSet result; - for (auto tool : m_systematicsTools) - { - result.insert (tool->recommendedSystematics()); - } - return result; - } - - - - CP::SystematicCode AnaTool :: - applySystematicVariation (const CP::SystematicSet& systConfig) - { - RCU_CHANGE_INVARIANT (this); - for (auto tool : m_systematicsTools) - { - if (tool->applySystematicVariation (systConfig) != - CP::SystematicCode::Ok) - return CP::SystematicCode::Unsupported; - } - return CP::SystematicCode::Ok; - } - - - - void AnaTool :: - fillEventDataSource (EventData& /*event*/) const - {} - - - - StatusCode AnaTool :: - useConfiguration (const InternalConfiguration& /*configuration*/) - { - return StatusCode::SUCCESS; - } - - - - StatusCode AnaTool :: - getInitialConfiguration (InternalConfiguration& /*conf*/) - { - return StatusCode::SUCCESS; - } - - - - StatusCode AnaTool :: - useInitialConfiguration (const InternalConfiguration& conf) - { - msg().setLevel( conf.msgLevel() ); - return StatusCode::SUCCESS; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolRetrieve.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolRetrieve.cxx deleted file mode 100644 index 316a2368feeb309a2f2b830a257dd612804b302b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolRetrieve.cxx +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/AnaToolRetrieve.h> - -#include <QuickAna/EventData.h> -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> - -// -// method implementations -// - -namespace ana -{ - AnaToolRetrieve :: - AnaToolRetrieve (const std::string& name) - : AsgTool (name), AnaTool (name), - m_type (OBJECT_JET) - {} - - - - AnaToolRetrieve :: - AnaToolRetrieve (const std::string& name, const std::string& containerName) - : AsgTool (name), AnaTool (name), m_containerName (containerName) - {} - - - - StatusCode AnaToolRetrieve :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - m_type = type; - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point in retrieve step"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - AnalysisStep AnaToolRetrieve :: - step () const - { - return STEP_RETRIEVE; - } - - - - unsigned AnaToolRetrieve :: - inputTypes () const - { - return 0; - } - - - - unsigned AnaToolRetrieve :: - outputTypes () const - { - return 1 << m_type; - } - - - - void AnaToolRetrieve :: - fillEventDataSource (EventData& event) const - { - for (auto& sys : event.getSystematics()) - { - event.setSourceName (m_type, sys, m_containerName); - } - } - - - - StatusCode AnaToolRetrieve :: - execute (IEventObjects& objects) - { - ATH_CHECK (objects.addCopy (m_type, m_containerName)); - return StatusCode::SUCCESS; - } - - - - StatusCode AnaToolRetrieve :: - getInitialConfiguration (InternalConfiguration& conf) - { - ATH_CHECK (AnaTool::getInitialConfiguration (conf)); - conf.setInputName (m_type, m_containerName); - return StatusCode::SUCCESS; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSelectCombine.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSelectCombine.cxx deleted file mode 100644 index 10d59a405fcb6dd7c959fe014b7e275b8a067c36..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSelectCombine.cxx +++ /dev/null @@ -1,137 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/AnaToolSelectCombine.h> - -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> - -// -// method implementations -// - -namespace ana -{ - AnaToolSelectCombine :: - AnaToolSelectCombine (const std::string& name) - : AsgTool (name), AnaTool (name), - m_type (OBJECT_JET) - {} - - - - AnaToolSelectCombine :: - AnaToolSelectCombine (const std::string& name, const std::vector<std::string>& workingPoints) - : AsgTool (name), AnaTool (name), m_workingPoints (workingPoints), - m_type (OBJECT_JET) - {} - - - - StatusCode AnaToolSelectCombine :: - useConfiguration (const InternalConfiguration& configuration) - { - ATH_CHECK (AnaTool::useConfiguration (configuration)); - for (unsigned iter = 0; iter != EnumSize<SelectionStep>::dataSize; ++ iter) - { - m_data.push_back (Data (configuration, m_workingPoints, - SelectionStep (iter))); - } - return StatusCode::SUCCESS; - } - - - - StatusCode AnaToolSelectCombine :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - m_type = type; - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point when combining working points"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - AnalysisStep AnaToolSelectCombine :: - step () const - { - return STEP_SUPER_SELECT; - } - - - - unsigned AnaToolSelectCombine :: - inputTypes () const - { - return 1 << m_type; - } - - - - unsigned AnaToolSelectCombine :: - outputTypes () const - { - return 1 << m_type; - } - - - - StatusCode AnaToolSelectCombine :: - execute (IEventObjects& objects) - { - for (auto object : *objects.getParticles (m_type)) - { - bool accept = true; - for (auto& data : m_data) - { - if (accept) - { - accept = false; - for (auto& sel : data.inputSelect) - { - if (!sel.isAvailable (*object)) - { - ATH_MSG_ERROR ("input field not available"); - return StatusCode::FAILURE; - } - if (sel (*object)) - accept = true; - } - } - data.select (*object) = accept; - } - } - return StatusCode::SUCCESS; - } - - - - AnaToolSelectCombine::Data :: - Data (const InternalConfiguration& configuration, - const std::vector<std::string>& workingPoints, - SelectionStep step) - : select (configuration.selectionName (step)) - { - for (auto& wp : workingPoints) - inputSelect.push_back (configuration.selectionName (step) + "_" + wp); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSelectInit.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSelectInit.cxx deleted file mode 100644 index 3f5529c5a83663717a25a2aa067e3399ba7b0aea..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSelectInit.cxx +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/AnaToolSelectInit.h> - -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> - -// -// method implementations -// - -namespace ana -{ - AnaToolSelectInit :: - AnaToolSelectInit (const std::string& name) - : AsgTool (name), AnaTool (name), - m_type (OBJECT_JET) - {} - - - - StatusCode AnaToolSelectInit :: - useConfiguration (const InternalConfiguration& configuration) - { - ATH_CHECK (AnaTool::useConfiguration (configuration)); - for (unsigned iter = 0; iter != EnumSize<SelectionStep>::dataSize; ++ iter) - m_select.push_back (configuration.selectionName (SelectionStep (iter))); - return StatusCode::SUCCESS; - } - - - - StatusCode AnaToolSelectInit :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - m_type = type; - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point when initializing objects"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - AnalysisStep AnaToolSelectInit :: - step () const - { - return STEP_SELECT_INIT; - } - - - - unsigned AnaToolSelectInit :: - inputTypes () const - { - return 1 << m_type; - } - - - - unsigned AnaToolSelectInit :: - outputTypes () const - { - return 1 << m_type; - } - - - - StatusCode AnaToolSelectInit :: - execute (IEventObjects& objects) - { - bool first = true; - for (auto object : *objects.getParticles (m_type)) - { - for (auto& sel : m_select) - { - if (first && sel.isAvailable (*object)) - { - ATH_MSG_ERROR ("selection field already available"); - return StatusCode::FAILURE; - } - sel (*object) = true; - } - first = false; - } - return StatusCode::SUCCESS; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSelectSpread.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSelectSpread.cxx deleted file mode 100644 index ffba2ac9bfea18e3502c4a094f829bb0b1c14d42..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSelectSpread.cxx +++ /dev/null @@ -1,134 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/AnaToolSelectSpread.h> - -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> - -// -// method implementations -// - -namespace ana -{ - AnaToolSelectSpread :: - AnaToolSelectSpread (const std::string& name) - : AsgTool (name), AnaTool (name), - m_type (OBJECT_JET), m_first (false) - {} - - - - AnaToolSelectSpread :: - AnaToolSelectSpread (const std::string& name, const std::vector<std::string>& workingPoints, bool first) - : AsgTool (name), AnaTool (name), m_workingPoints (workingPoints), - m_type (OBJECT_JET), m_first (first) - {} - - - - StatusCode AnaToolSelectSpread :: - useConfiguration (const InternalConfiguration& configuration) - { - ATH_CHECK (AnaTool::useConfiguration (configuration)); - for (unsigned iter = 0; iter != EnumSize<SelectionStep>::dataSize; ++ iter) - { - m_data.push_back (Data (configuration, m_workingPoints, - SelectionStep (iter))); - } - return StatusCode::SUCCESS; - } - - - - StatusCode AnaToolSelectSpread :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - m_type = type; - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point when spreading working points"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - AnalysisStep AnaToolSelectSpread :: - step () const - { - return m_first ? STEP_SPLIT_SELECT : STEP_SPREAD_SELECT; - } - - - - unsigned AnaToolSelectSpread :: - inputTypes () const - { - return 1 << m_type; - } - - - - unsigned AnaToolSelectSpread :: - outputTypes () const - { - return 1 << m_type; - } - - - - StatusCode AnaToolSelectSpread :: - execute (IEventObjects& objects) - { - for (auto object : *objects.getParticles (m_type)) - { - for (auto& data : m_data) - { - if (!data.select.isAvailable (*object)) - { - ATH_MSG_ERROR ("input field not available"); - return StatusCode::FAILURE; - } - bool accept = data.select (*object); - if (m_first || !accept) - { - for (auto& sel : data.outputSelect) - { - sel (*object) = accept; - } - } - } - } - return StatusCode::SUCCESS; - } - - - - AnaToolSelectSpread::Data :: - Data (const InternalConfiguration& configuration, - const std::vector<std::string>& workingPoints, - SelectionStep step) - : select (configuration.selectionName (step)) - { - for (auto& wp : workingPoints) - outputSelect.push_back (configuration.selectionName (step) + "_" + wp); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSequence.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSequence.cxx deleted file mode 100644 index 47423db209b10f7df8f592f258fe6c38290bfd3f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/AnaToolSequence.cxx +++ /dev/null @@ -1,242 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/AnaToolSequence.h> - -#include <QuickAna/AnaTool.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionConf.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/ObjectTypeInfo.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - namespace - { - // TODO: needs documentation - StatusCode addDefWP_internal (const DefinitionArgs& masterArgs, - AnaToolSequence& tools, - std::vector<DefinitionConf>& confList) - { - using namespace msgConfiguration; - - for (auto& conf : confList) - { - DefinitionArgs args = masterArgs.cloneConf(); - - // Ask the DefinitionConf to make the tools. - AnaToolSequence list; - ANA_CHECK (conf.makeTools (args, list)); - - // Loop over the tools to fill the output list. - for (auto& tool : list) - { - if (tool.first) - { - tools.addTool (std::move (tool.first)); - } else - { - // If the tool doesn't exist, we just add the label...? - // What's going on here? - tools.addLabel (tool.second); - } - } - } - - return StatusCode::SUCCESS; - } - - - - StatusCode addDefWP (const DefinitionArgs& masterArgs, - AnaToolSequence& tools, - ObjectType type, - std::vector<DefinitionConf>& confList) - { - using namespace msgConfiguration; - - RCU_REQUIRE (masterArgs.type() == type); - - // Loop over the confs to fill the list of names and check for duplicates. - // It seems like this could be simplified. - std::vector<std::string> mynames; - for (auto& conf : confList) - { - std::string wpName = conf.wpName(); - // Under what condition would the name be empty??? - if (!wpName.empty()) - { - // Check to see if this WP name is already in our list of names. - // We should use std::find here instead. - for (auto& other : mynames) - { - if (other == wpName) - { - ANA_MSG_ERROR ("duplicate object definition name: " << wpName << - " for " << ObjectTypeInfo::name[type]); - return StatusCode::FAILURE; - } - } - mynames.push_back (wpName); - } - } - // For some reason, every conf needs to know whether it is first - // and whether it is part of a multi-working point definition. - bool first = true; - for (auto& conf : confList) - { - RCU_ASSERT (conf.defType() == type); - conf.setFirstWP (first); - conf.setMultiWP (mynames.size() > 1); - first = false; - } - - // ??? - if (ObjectTypeInfo::supportsIParticle (type)) - { - DefinitionConf conf - = DefinitionConf::makeIParticleCommonConf (type, mynames); - confList.push_back (conf); - } - - ANA_CHECK (addDefWP_internal (masterArgs, tools, confList)); - - return StatusCode::SUCCESS; - } - } - - - - StatusCode - makeToolSequence (const std::vector<DefinitionConf>& confList, - const DefinitionArgs& masterArgs, - AnaToolSequence& tools) - { - using namespace msgConfiguration; - - // The incoming confList contains all definition info for all object types. - // Now, we organize them by object type in a map. - std::map<ObjectType,std::vector<DefinitionConf>> confMap; - for (auto& conf : confList) - confMap[conf.defType()].push_back (conf); - // Now we can loop over the object types and create the tools needed. - for (auto& iter : confMap) - { - DefinitionArgs args = masterArgs.cloneConf(); - args.setType (iter.first); - ANA_CHECK (addDefWP (args, tools, iter.first, iter.second)); - } - - return StatusCode::SUCCESS; - } - - - - void AnaToolSequence :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - } - - - - AnaToolSequence :: - AnaToolSequence () - { - RCU_NEW_INVARIANT (this); - } - - - - AnaToolSequence :: - AnaToolSequence (AnaToolSequence&& that) - : m_tools (std::move (that.m_tools)) - { - RCU_NEW_INVARIANT (this); - } - - - - AnaToolSequence& AnaToolSequence :: - operator = (AnaToolSequence&& that) - { - // no invariant used - that.swap (*this); - return *this; - } - - - - void AnaToolSequence :: - swap (AnaToolSequence& that) - { - RCU_CHANGE_INVARIANT (this); - RCU_CHANGE_INVARIANT (&that); - m_tools.swap (that.m_tools); - } - - - - void AnaToolSequence :: - addTool (std::unique_ptr<IAnaTool> val_definition) - { - RCU_CHANGE_INVARIANT (this); - m_tools.push_back (std::make_pair(std::move(val_definition),"")); - } - - - - void AnaToolSequence :: - addLabel (const std::string& val_label) - { - RCU_CHANGE_INVARIANT (this); - m_tools.push_back (std::make_pair(std::unique_ptr<IAnaTool>(), val_label)); - } - - - - bool AnaToolSequence :: - empty () const - { - RCU_READ_INVARIANT (this); - return m_tools.empty(); - } - - - - AnaToolSequence::iterator AnaToolSequence :: - begin () - { - RCU_READ_INVARIANT (this); - return m_tools.begin(); - } - - - - AnaToolSequence::iterator AnaToolSequence :: - end () - { - RCU_READ_INVARIANT (this); - return m_tools.end(); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/Configuration.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/Configuration.cxx deleted file mode 100644 index 62bd3eaaec2bdc4a272a60d4c83aa28e77e0db89..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/Configuration.cxx +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/Configuration.h> - -// -// method implementations -// - -namespace ana -{ - Configuration :: - Configuration () - : eventinfoDef ("none"), eventSelectDef ("none"), - electronDef ("none"), photonDef ("none"), muonDef ("none"), - tauDef ("none"), jetDef ("none"), fatJetDef ("none"), - metDef ("none"), met2Def ("none"), orDef ("none"), triggerDef(""), - schedulerDef ("basic") - {} - - - - void Configuration :: - setConfig (const Configuration& conf) - { - *this = conf; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/DefinitionArgs.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/DefinitionArgs.cxx deleted file mode 100644 index 0be34a26b6543a31102aac37c52f7a5f0651d5aa..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/DefinitionArgs.cxx +++ /dev/null @@ -1,167 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/DefinitionArgs.h> - -#include <QuickAna/AnaTool.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - void DefinitionArgs :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - RCU_INVARIANT (!m_prefix.empty()); - RCU_INVARIANT (m_configuration != nullptr); - } - - - - DefinitionArgs :: - DefinitionArgs (const std::string& val_prefix, - InternalConfiguration *val_configuration) - : m_prefix (val_prefix), m_configuration (val_configuration) - { - RCU_NEW_INVARIANT (this); - } - - - - DefinitionArgs DefinitionArgs :: - cloneConf () const - { - DefinitionArgs result (m_prefix, m_configuration); - result.m_type = m_type; - result.m_name = m_name; - result.m_firstWP = m_firstWP; - return result; - } - - - - ObjectType DefinitionArgs :: - type () const - { - RCU_READ_INVARIANT (this); - return m_type; - } - - - - const std::string& DefinitionArgs :: - name () const - { - RCU_READ_INVARIANT (this); - return m_name; - } - - - - const std::string& DefinitionArgs :: - prefix () const - { - RCU_READ_INVARIANT (this); - return m_prefix; - } - - - - void DefinitionArgs :: - addToPrefix (const std::string& extension) - { - RCU_CHANGE_INVARIANT (this); - m_prefix += "_" + extension; - } - - - - InternalConfiguration *DefinitionArgs :: - configuration () const - { - RCU_READ_INVARIANT (this); - return m_configuration; - } - - - - bool DefinitionArgs :: - firstWP () const - { - RCU_READ_INVARIANT (this); - return m_firstWP; - } - - - - void DefinitionArgs :: - setFirstWP (bool val_firstWP) - { - RCU_CHANGE_INVARIANT (this); - m_firstWP = val_firstWP; - } - - - - void DefinitionArgs :: - add (std::unique_ptr<IAnaTool> val_definition) - { - RCU_CHANGE_INVARIANT (this); - m_sequence.addTool (std::move (val_definition)); - } - - - - AnaToolSequence&& DefinitionArgs :: - extractSequence () - { - RCU_CHANGE_INVARIANT (this); - return std::move (m_sequence); - } - - - - bool DefinitionArgs :: - filled () const - { - RCU_READ_INVARIANT (this); - return !m_sequence.empty(); - } - - - - void DefinitionArgs :: - setType (ObjectType val_type) - { - RCU_CHANGE_INVARIANT (this); - m_type = val_type; - } - - - - void DefinitionArgs :: - setName (const std::string& val_name) - { - RCU_CHANGE_INVARIANT (this); - m_name = val_name; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/DefinitionConf.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/DefinitionConf.cxx deleted file mode 100644 index 160bfc96d4a69762d0eca6e13a8bf493ef8ed33c..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/DefinitionConf.cxx +++ /dev/null @@ -1,508 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/DefinitionConf.h> - -// Suppressing unused typedef warning -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#include <boost/algorithm/string.hpp> -#pragma GCC diagnostic pop - -#include <AsgTools/StatusCode.h> -#include <QuickAna/AnaToolSelectCombine.h> -#include <QuickAna/AnaToolSelectInit.h> -#include <QuickAna/AnaToolSelectSpread.h> -#include <QuickAna/AnaToolSequence.h> -#include <QuickAna/Configuration.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/EventInfoIsData.h> -#include <QuickAna/EventSelectBaseTool.h> -#include <QuickAna/IAnaTool.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/KinSelectTool.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/ObjectTypeInfo.h> -#include <QuickAna/PileupTool.h> -#include <RootCoreUtils/Assert.h> -#include <boost/algorithm/string.hpp> -#include <boost/algorithm/string/split.hpp> - -// -// method implementations -// - -namespace ana -{ - namespace - { - /// \brief read the list of default names - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II\n - /// i/o errors - std::map<std::string,std::string> read_default_list () - { - std::map<std::string,std::string> result; - result["jets"] = "antikt04"; - result["fatJets"] = "antikt10"; - result["electrons"] = "medium"; - result["photons"] = "tight"; - result["muons"] = "medium"; - result["trigger"] = "skip"; - return result; - } - - /// \brief resolve the default name (if it is "default") - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II\n - /// i/o errors - std::string resolve_default (ObjectType type, const std::string& name) - { - if (name != "default") - return name; - static const auto list = read_default_list(); - auto iter = list.find (ObjectTypeInfo::name[type]); - if (iter == list.end()) - return name; - return iter->second; - } - - - - /// \brief make the \ref DefinitionConf from a field in the \ref - /// Configuration object - /// \par Guarantee - /// basic - /// \par Failures - /// out of memory II - StatusCode makeObjectConf (std::vector<DefinitionConf>& confList, - ObjectType type, - std::string name, const std::string& kine) - { - using namespace msgConfiguration; - - if (name == "none") - name = ""; - - // Split the name string into working point names and build a - // DefinitionConf for each. - std::vector<std::string> rawnames; - boost::algorithm::split(rawnames, name, boost::is_any_of("\t ")); - for (auto& subname : rawnames) - { - if (!subname.empty()) - { - DefinitionConf conf = - DefinitionConf::makeObjectDefinitionConf (type, resolve_default (type, subname)); - confList.push_back (conf); - } - } - - // Build a DefinitionConf specifically for the kinematic selection string. - if (!kine.empty()) - { - if (confList.empty()) - { - ANA_MSG_ERROR ("can not specify a kinematic selection " << - "without a definition for " + ObjectTypeInfo::name[type]); - return StatusCode::FAILURE; - } - confList.push_back - (DefinitionConf::makeKinSelectConf (type, kine)); - } - - return StatusCode::SUCCESS; - } - } - - - - StatusCode DefinitionConf :: - makeTools (const DefinitionArgs& args, - AnaToolSequence& sequence) - { - using namespace msgConfiguration; - - RCU_REQUIRE (sequence.empty()); - - DefinitionArgs myargs = args.cloneConf(); - myargs.setType (m_defType); - myargs.setName (m_defName); - myargs.setFirstWP (m_firstWP); - myargs.addToPrefix (ObjectTypeInfo::name[m_defType]); - switch (m_mode) - { - case Mode::OBJECT_DEFINITION: - myargs.addToPrefix ("def"); - if (m_multiWP) - myargs.addToPrefix (m_defName); - ANA_CHECK (DefinitionMaker::makeDefinition (myargs)); - break; - case Mode::IPARTICLE_COMMON: - myargs.addToPrefix ("ipart"); - ANA_CHECK (makeIParticleCommonTools (myargs)); - break; - case Mode::KINSELECT: - myargs.addToPrefix ("kine"); - ANA_CHECK (makeKinSelectTool (myargs)); - break; - case Mode::ISDATA: - myargs.addToPrefix ("isdata"); - ANA_CHECK (makeIsDataTool (myargs)); - break; - case Mode::EVENTSELECTBASE: - myargs.addToPrefix ("eventselectbase"); - ANA_CHECK (makeEventSelectBaseTool (myargs)); - break; - case Mode::PILEUP: - myargs.addToPrefix ("pileup"); - ANA_CHECK (makePileupTool (myargs)); - break; - } - AnaToolSequence list = myargs.extractSequence (); - - for (auto& tool : list) - { - if (tool.first) - { - // this drops all the tools from secondary working points - // that should only exist once - const bool multiWP = tool.first->step() >= STEP_SELECT || tool.first->step() == STEP_TRIG_DECISION; - if (m_mode != Mode::OBJECT_DEFINITION || - m_firstWP || multiWP) - { - std::string workingPoint; - if (m_mode == Mode::OBJECT_DEFINITION && m_multiWP && multiWP) - workingPoint = m_defName; - if (m_mode != Mode::KINSELECT) - ANA_CHECK (tool.first->setObjectType (m_defType, workingPoint)); - sequence.addTool (std::move(tool.first)); - } - } else - { - sequence.addLabel (tool.second); - } - } - - RCU_PROVIDE (!sequence.empty()); - return StatusCode::SUCCESS; - } - - - - ObjectType DefinitionConf :: - defType () const - { - return m_defType; - } - - - - void DefinitionConf :: - setDefType (ObjectType val_defType) - { - m_defType = val_defType; - } - - - - const std::string& DefinitionConf :: - defName () const - { - return m_defName; - } - - - - void DefinitionConf :: - setDefName (const std::string& val_defName) - { - m_defName = val_defName; - } - - - - std::string DefinitionConf :: - wpName () const - { - if (m_mode == Mode::OBJECT_DEFINITION) - return m_defName; - else - return ""; - } - - - - bool DefinitionConf :: - firstWP () const - { - return m_firstWP; - } - - - - void DefinitionConf :: - setFirstWP (bool val_firstWP) - { - m_firstWP = val_firstWP; - } - - - - bool DefinitionConf :: - multiWP () const - { - return m_multiWP; - } - - - - void DefinitionConf :: - setMultiWP (bool val_multiWP) - { - m_multiWP = val_multiWP; - } - - - - DefinitionConf DefinitionConf :: - makeObjectDefinitionConf (ObjectType type, const std::string& name) - { - DefinitionConf result; - result.m_mode = Mode::OBJECT_DEFINITION; - result.m_defType = type; - result.m_defName = name; - RCU_PROVIDE (!result.wpName().empty()); - return result; - } - - - - DefinitionConf DefinitionConf :: - makeIParticleCommonConf (ObjectType type, - const std::vector<std::string>& workingPoints) - { - DefinitionConf result; - result.m_mode = Mode::IPARTICLE_COMMON; - result.m_defType = type; - result.m_wpNameList = workingPoints; - RCU_PROVIDE (result.wpName().empty()); - return result; - } - - - - DefinitionConf DefinitionConf :: - makeKinSelectConf (ObjectType type, const std::string& kinSelect) - { - DefinitionConf result; - result.m_mode = Mode::KINSELECT; - result.m_defType = type; - result.m_kinSelect = kinSelect; - RCU_PROVIDE (result.wpName().empty()); - return result; - } - - - - DefinitionConf DefinitionConf :: - makeEventSelectBaseConf () - { - DefinitionConf result; - result.m_mode = Mode::EVENTSELECTBASE; - result.m_defType = OBJECT_EVENT_SELECT; - RCU_PROVIDE (result.wpName().empty()); - return result; - } - - - - DefinitionConf DefinitionConf :: - makeIsDataConf () - { - DefinitionConf result; - result.m_mode = Mode::ISDATA; - result.m_defType = OBJECT_NONE; - RCU_PROVIDE (result.wpName().empty()); - return result; - } - - - - DefinitionConf DefinitionConf :: - makePileupConf (const std::vector<std::string>& muDataFiles, - const std::vector<std::string>& muMcFiles) - { - DefinitionConf result; - result.m_mode = Mode::PILEUP; - result.m_defType = OBJECT_NONE; - result.m_muDataFiles = muDataFiles; - result.m_muMcFiles = muMcFiles; - RCU_PROVIDE (result.wpName().empty()); - return result; - } - - - - StatusCode DefinitionConf :: - makeConfigList (std::vector<DefinitionConf>& confList, - const Configuration& config) - { - using namespace msgConfiguration; - - confList.push_back (DefinitionConf::makeEventSelectBaseConf ()); - ANA_CHECK (makeObjectConf (confList, OBJECT_EVENTINFO, - config.eventinfoDef, "")); - ANA_CHECK (makeObjectConf (confList, OBJECT_EVENT_SELECT, - config.eventSelectDef, "")); - ANA_CHECK (makeObjectConf (confList, OBJECT_JET, - config.jetDef, config.jetKine)); - ANA_CHECK (makeObjectConf (confList, OBJECT_FAT_JET, - config.fatJetDef, config.fatJetKine)); - ANA_CHECK (makeObjectConf (confList, OBJECT_PHOTON, - config.photonDef, config.photonKine)); - ANA_CHECK (makeObjectConf (confList, OBJECT_ELECTRON, - config.electronDef, config.electronKine)); - ANA_CHECK (makeObjectConf (confList, OBJECT_MUON, - config.muonDef, config.muonKine)); - ANA_CHECK (makeObjectConf (confList, OBJECT_TAU, - config.tauDef, config.tauKine)); - ANA_CHECK (makeObjectConf (confList, OBJECT_MET, - config.metDef, "")); - ANA_CHECK (makeObjectConf (confList, OBJECT_MET2, - config.met2Def, "")); - ANA_CHECK (makeObjectConf (confList, OBJECT_OVERLAP_REMOVAL, - config.orDef, "")); - ANA_CHECK (makeObjectConf (confList, OBJECT_TRIGGER, - config.triggerDef, "")); - confList.push_back (DefinitionConf::makeIsDataConf ()); - - // Need to change this condition for now because we only need data files - // for the muon SFs. - //if (config.muDataFiles.empty() != config.muMcFiles.empty()) - //{ - // ANA_MSG_FATAL("need to set either both or neither of muDataFile and muMcFile"); - // return StatusCode::FAILURE; - //} - - // Need both file types configured to trigger pileup tool config. - if (!config.muDataFiles.empty() && !config.muMcFiles.empty()) - { - confList.push_back( - DefinitionConf::makePileupConf(config.muDataFiles, config.muMcFiles) - ); - } - return StatusCode::SUCCESS; - } - - - - StatusCode DefinitionConf :: - makeIParticleCommonTools (DefinitionArgs& args) - { - using namespace msgConfiguration; - - RCU_REQUIRE (m_mode == Mode::IPARTICLE_COMMON); - RCU_REQUIRE (!m_wpNameList.empty()); - RCU_REQUIRE (ObjectTypeInfo::supportsIParticle (defType())); - - { - std::unique_ptr<AnaToolSelectInit> select - (new AnaToolSelectInit (args.prefix() + "_init")); - ANA_CHECK (select->setObjectType (m_defType, "")); - args.add (std::move (select)); - } - - if (m_wpNameList.size() > 1) - { - { - std::unique_ptr<AnaToolSelectSpread> select - (new AnaToolSelectSpread (args.prefix() + "_split", - m_wpNameList, true)); - ANA_CHECK (select->setObjectType (m_defType, "")); - args.add (std::move (select)); - } - { - std::unique_ptr<AnaToolSelectCombine> select - (new AnaToolSelectCombine (args.prefix() + "_combine", - m_wpNameList)); - ANA_CHECK (select->setObjectType (m_defType, "")); - args.add (std::move (select)); - } - { - std::unique_ptr<AnaToolSelectSpread> select - (new AnaToolSelectSpread (args.prefix() + "_spread", - m_wpNameList, false)); - ANA_CHECK (select->setObjectType (m_defType, "")); - args.add (std::move (select)); - } - } - return StatusCode::SUCCESS; - } - - - - StatusCode DefinitionConf :: - makeKinSelectTool (DefinitionArgs& args) - { - RCU_REQUIRE (m_mode == Mode::KINSELECT); - RCU_REQUIRE (!m_kinSelect.empty()); - - std::unique_ptr<KinSelectTool> kinSelect (new KinSelectTool (args.prefix() + "_kine")); - kinSelect->m_objectType = args.type(); - kinSelect->m_selection = m_kinSelect; - args.add (std::move (kinSelect)); - return StatusCode::SUCCESS; - } - - - - StatusCode DefinitionConf :: - makeEventSelectBaseTool (DefinitionArgs& args) - { - args.add (std::unique_ptr<EventSelectBaseTool> (new EventSelectBaseTool (args.prefix() + "_event_select_base"))); - return StatusCode::SUCCESS; - } - - - - StatusCode DefinitionConf :: - makeIsDataTool (DefinitionArgs& args) - { - args.add (std::unique_ptr<EventInfoIsData> (new EventInfoIsData (args.prefix() + "_is_data", args.configuration()->isData()))); - return StatusCode::SUCCESS; - } - - - - StatusCode DefinitionConf :: - makePileupTool (DefinitionArgs& args) - { - std::unique_ptr<PileupTool> pileupTool (new PileupTool (args.prefix() + "_pileup")); - pileupTool->muDataFiles = m_muDataFiles; - pileupTool->muMcFiles = m_muMcFiles; - args.add (std::move (pileupTool)); - return StatusCode::SUCCESS; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/DefinitionMaker.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/DefinitionMaker.cxx deleted file mode 100644 index 50dde089ec7134ef6b92ee0d209b37a5fa000350..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/DefinitionMaker.cxx +++ /dev/null @@ -1,154 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/DefinitionMaker.h> - -// Suppressing unused typedef warning -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#include <boost/algorithm/string.hpp> -#pragma GCC diagnostic pop - -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/IAnaTool.h> -#include <QuickAna/MessageCheck.h> -#include <RootCoreUtils/Assert.h> -#include <mutex> - -// -// method implementations -// - -namespace ana -{ - namespace - { - /// \brief the global database of \ref DefinitionMaker objects - struct Data - { - public: - std::mutex mutex; - public: - std::vector<DefinitionMaker> list; - }; - Data& data () - { - static Data data; - return data; - } - } - - - - void DefinitionMaker :: - addDefinition (DefinitionMaker val_definition) - { - Data& mydata (data()); - std::lock_guard<std::mutex> lock (mydata.mutex); - mydata.list.push_back (val_definition); - } - - - - StatusCode DefinitionMaker :: - makeDefinition (DefinitionArgs& args) - { - using namespace msgConfiguration; - - Data& mydata (data()); - std::lock_guard<std::mutex> lock (mydata.mutex); - AnaToolSequence result; - bool foundName = false; - for (auto& maker : mydata.list) - { - DefinitionArgs myargs = args.cloneConf(); - bool myfoundName = false; - ANA_CHECK (maker.doMakeDefinition (myargs, myfoundName)); - if (myfoundName) - { - if (foundName) - { - ANA_MSG_ERROR ("duplicate object definition: " + args.name()); - return StatusCode::FAILURE; - } - result = myargs.extractSequence (); - foundName = true; - } - } - if (!foundName) - { - ANA_MSG_ERROR ("unknown object definition: " + args.name()); - return StatusCode::FAILURE; - } - for (auto&& def : result) - { - if (def.first) - args.add (std::move (def.first)); - } - return StatusCode::SUCCESS; - } - - - - void DefinitionMaker :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - } - - - - DefinitionMaker :: - DefinitionMaker (ObjectType val_type, const std::string& val_name, - const std::function<StatusCode (DefinitionArgs&)>& val_function) - : m_type (val_type), m_function (val_function) - { - boost::algorithm::split(m_names, val_name, boost::is_any_of("\t ")); - - RCU_NEW_INVARIANT (this); - } - - - - StatusCode DefinitionMaker :: - doMakeDefinition (DefinitionArgs& args, bool& foundName) const - { - using namespace msgConfiguration; - - RCU_READ_INVARIANT (this); - RCU_REQUIRE (!args.filled()); - ObjectType type = args.type(); - if (type == OBJECT_FAT_JET) - type = OBJECT_JET; - if (type == OBJECT_MET2) - type = OBJECT_MET; - if (type == m_type && - std::find (m_names.begin(), m_names.end(), args.name()) != m_names.end()) - { - ANA_CHECK (m_function (args)); - if (!args.filled()) - { - ANA_MSG_ERROR ("definition " + args.name() + " didn't do anything"); - return StatusCode::FAILURE; - } - foundName = true; - } else foundName = false; - return StatusCode::SUCCESS; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/ELExample.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/ELExample.cxx deleted file mode 100644 index 561e83712085a4e52dfe77d04a839a7e60390201..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/ELExample.cxx +++ /dev/null @@ -1,188 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#ifdef ROOTCORE - -// -// includes -// - -#include <QuickAna/ELExample.h> - -#include <EventLoop/Job.h> -#include <EventLoop/Worker.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <TH1.h> - -// -// method implementations -// - -// this is needed to distribute the algorithm to the workers -ClassImp(ana::ELExample) - -namespace ana -{ - ELExample :: ELExample () - : muon_n (0) - { - // Here you put any code for the base initialization of variables, - // e.g. initialize all pointers to 0. Note that you should only put - // the most basic initialization here, since this method will be - // called on both the submission and the worker node. Most of your - // initialization code will go into histInitialize() and - // initialize(). - } - - - - EL::StatusCode ELExample :: setupJob (EL::Job& job) - { - // Here you put code that sets up the job on the submission object - // so that it is ready to work with your algorithm, e.g. you can - // request the D3PDReader service or add output files. Any code you - // put here could instead also go into the submission script. The - // sole advantage of putting it here is that it gets automatically - // activated/deactivated when you add/remove the algorithm from your - // job, which may or may not be of value to you. - job.useXAOD(); - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ELExample :: histInitialize () - { - // Here you do everything that needs to be done at the very - // beginning on each worker node, e.g. create histograms and output - // trees. This method gets called before any input files are - // connected. - - muon_n = new TH1F ("muon_n", "number of muons", 10, -0.5, 9.5); - wk()->addOutput (muon_n); - - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ELExample :: fileExecute () - { - // Here you do everything that needs to be done exactly once for every - // single file, e.g. collect a list of all lumi-blocks processed - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ELExample :: changeInput (bool /*firstFile*/) - { - // Here you do everything you need to do when we change input files, - // e.g. resetting branch addresses on trees. If you are using - // D3PDReader or a similar service this method is not needed. - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ELExample :: initialize () - { - // Here you do everything that you need to do after the first input - // file has been connected and before the first event is processed, - // e.g. create additional histograms based on which variables are - // available in the input files. You can also create all of your - // histograms and trees in here, but be aware that this method - // doesn't get called if no events are processed. So any objects - // you create here won't be available in the output if you have no - // input events. - - ANA_CHECK_SET_TYPE (EL::StatusCode); - - std::unique_ptr<QuickAna> myQuickAna (new QuickAna ("quickana")); - myQuickAna->setConfig (*this); - quickAna = std::move (myQuickAna); - ANA_CHECK (quickAna->initialize()); - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ELExample :: execute () - { - // Here you do everything that needs to be done on every single - // events, e.g. read input variables, apply cuts, and fill - // histograms and trees. This is where most of your actual analysis - // code will go. - - ANA_CHECK_SET_TYPE (EL::StatusCode); - - ANA_CHECK (quickAna->process (*wk()->xaodEvent())); - - unsigned muon_num = 0; - for (auto muon : *quickAna->muons()) - { - if (muon->auxdata<SelectType> ("ana_select")) - { - ++ muon_num; - } - } - muon_n->Fill (muon_num, quickAna->weight()); - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ELExample :: postExecute () - { - // Here you do everything that needs to be done after the main event - // processing. This is typically very rare, particularly in user - // code. It is mainly used in implementing the NTupleSvc. - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ELExample :: finalize () - { - // This method is the mirror image of initialize(), meaning it gets - // called after the last event has been processed on the worker node - // and allows you to finish up any objects you created in - // initialize() before they are written to disk. This is actually - // fairly rare, since this happens separately for each worker node. - // Most of the time you want to do your post-processing on the - // submission node after all your histogram outputs have been - // merged. This is different from histFinalize() in that it only - // gets called on worker nodes that processed input events. - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ELExample :: histFinalize () - { - // This method is the mirror image of histInitialize(), meaning it - // gets called after the last event has been processed on the worker - // node and allows you to finish up any objects you created in - // histInitialize() before they are written to disk. This is - // actually fairly rare, since this happens separately for each - // worker node. Most of the time you want to do your - // post-processing on the submission node after all your histogram - // outputs have been merged. This is different from finalize() in - // that it gets called on all worker nodes regardless of whether - // they processed input events. - return EL::StatusCode::SUCCESS; - } -} -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/ElectronTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/ElectronTool.cxx deleted file mode 100644 index 1daff07db7707d175d0e158801d44d0892827657..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/ElectronTool.cxx +++ /dev/null @@ -1,556 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Includes -// - -#include <QuickAna/ElectronTool.h> - -#include <ElectronEfficiencyCorrection/AsgElectronEfficiencyCorrectionTool.h> -#include <ElectronPhotonFourMomentumCorrection/EgammaCalibrationAndSmearingTool.h> -#include <ElectronPhotonSelectorTools/AsgElectronIsEMSelector.h> -#include <ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h> -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> - -// For recommended d0 and z0 cuts -#include <xAODTracking/TrackParticle.h> - -#include <IsolationSelection/IsolationSelectionTool.h> -#include <IsolationCorrections/IsolationCorrectionTool.h> -#include <xAODTracking/TrackParticlexAODHelpers.h> - -// -// Method implementations -// - -namespace ana -{ - const float GeV = 1000.; - - //-------------------------------------------------------------------------- - // ElectronToolPreCorrect - //-------------------------------------------------------------------------- - - ElectronToolPreCorrect :: - ElectronToolPreCorrect (const std::string& name) - : AsgTool(name), AnaToolCorrect<xAOD::ElectronContainer>(name), - m_likelihoodTool_loose ("AsgElectronLikelihoodTool_loose", this), - m_likelihoodTool_medium ("AsgElectronLikelihoodTool_medium", this), - m_likelihoodTool_tight ("AsgElectronLikelihoodTool_tight", this) - { - } - - - AnalysisStep ElectronToolPreCorrect :: - step () const - { - return STEP_PRECORRECT; - } - - - StatusCode ElectronToolPreCorrect :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - - // Likelihood tool - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_likelihoodTool_loose, AsgElectronLikelihoodTool)); - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_likelihoodTool_medium, AsgElectronLikelihoodTool)); - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_likelihoodTool_tight, AsgElectronLikelihoodTool)); - - ATH_CHECK (m_likelihoodTool_loose.setProperty("primaryVertexContainer", "PrimaryVertices")); - ATH_CHECK (m_likelihoodTool_medium.setProperty("primaryVertexContainer", "PrimaryVertices")); - ATH_CHECK (m_likelihoodTool_tight.setProperty("primaryVertexContainer", "PrimaryVertices")); - - ATH_CHECK (m_likelihoodTool_loose.setProperty("WorkingPoint", "LooseLHElectron")); - ATH_CHECK (m_likelihoodTool_medium.setProperty("WorkingPoint", "MediumLHElectron")); - ATH_CHECK (m_likelihoodTool_tight.setProperty("WorkingPoint", "TightLHElectron")); - - ATH_CHECK( m_likelihoodTool_loose.initialize() ); - ATH_CHECK( m_likelihoodTool_medium.initialize() ); - ATH_CHECK( m_likelihoodTool_tight.initialize() ); - - /* Why are these commented out?? - registerCut (SelectionStep::MET, "likelihoodTool_loose", cut_likelihoodTool_loose); - registerCut (SelectionStep::MET, "likelihoodTool_medium", cut_likelihoodTool_medium); - registerCut (SelectionStep::MET, "likelihoodTool_tight", cut_likelihoodTool_tight); - registerCut (SelectionStep::MET, "isEMTool_loose", cut_isEMTool_loose); - registerCut (SelectionStep::MET, "isEMTool_medium", cut_isEMTool_medium); - registerCut (SelectionStep::MET, "isEMTool_tight", cut_isEMTool_tight);*/ - - return StatusCode::SUCCESS; - } - - - StatusCode ElectronToolPreCorrect :: - correctObject (xAOD::Electron& electron) - { - ATH_MSG_DEBUG("correctObject"); - const Root::TAccept& passLHLoose = m_likelihoodTool_loose->accept( electron ); - const Root::TAccept& passLHMedium = m_likelihoodTool_medium->accept( electron ); - const Root::TAccept& passLHTight = m_likelihoodTool_tight->accept( electron ); - - electron.auxdecor<SelectType>("QuickAna_LooseAndBLayerLLH") = static_cast<bool>(passLHLoose); - electron.auxdecor<SelectType>("QuickAna_MediumLLH") = static_cast<bool>(passLHMedium); - electron.auxdecor<SelectType>("QuickAna_TightLLH") = static_cast<bool>(passLHTight); - - /*// The isEM bits -- maybe useful but comment out for now - electron.auxdecor<unsigned int>("QuickAna_isEMLHLoose") = passLHLoose.getCutResultInverted(); - electron.auxdecor<unsigned int>("QuickAna_isEMLHMedium") = passLHMedium.getCutResultInverted(); - electron.auxdecor<unsigned int>("QuickAna_isEMLHTight") = passLHTight.getCutResultInverted();*/ - - return StatusCode::SUCCESS; - } - - //-------------------------------------------------------------------------- - // ElectronToolCorrect - //-------------------------------------------------------------------------- - - // Constructor - ElectronToolCorrect :: - ElectronToolCorrect (const std::string& name) - : AsgTool(name), AnaToolCorrect<xAOD::ElectronContainer>(name), - m_calibration ("EgammaCalibrationAndSmearingTool", this), - m_isoCorrTool ("IsolationCorrectionTool", this) - { - declareProperty("IsAF2", m_isAF2=false); - declareProperty("IsData", m_isData=false); - } - - - // Initialization - StatusCode ElectronToolCorrect :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - - // MC15 recommendations from: - // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/ElectronPhotonFourMomentumCorrection - - // Initialize the calibration tool - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_calibration, CP::EgammaCalibrationAndSmearingTool)); - ATH_CHECK (m_calibration.setProperty ("ESModel", "es2016data_mc15c")); - ATH_CHECK (m_calibration.setProperty ("decorrelationModel", "1NP_v1")); - ATH_CHECK (m_calibration.setProperty ("useAFII", m_isAF2?1:0)); - ATH_CHECK( m_calibration.initialize() ); - registerTool(&*m_calibration); - - // Initialize isolation correction tool - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_isoCorrTool, CP::IsolationCorrectionTool)); - ATH_CHECK( m_isoCorrTool.setProperty( "IsMC", !m_isData) ); - ATH_CHECK( m_isoCorrTool.setProperty( "AFII_corr", m_isAF2) ); - ATH_CHECK( m_isoCorrTool.initialize() ); - - registerCut (SelectionStep::MET, "correction", cut_correction); - registerCut (SelectionStep::MET, "correctionIso", cut_isoCorr_tool); - return StatusCode::SUCCESS; - } - - - // Object correction - StatusCode ElectronToolCorrect :: - correctObject (xAOD::Electron& electron) - { - ATH_MSG_DEBUG("correctObject"); - // Optimization of low PT electrons. Not sure if this makes a difference. - if (electron.pt() < 4.*GeV) return StatusCode::SUCCESS; - QA_CHECK_CUT (cut_correction, m_calibration->applyCorrection(electron)); - - // Correct the isolation - QA_CHECK_CUT (cut_isoCorr_tool, m_isoCorrTool->applyCorrection(electron)); - - return StatusCode::SUCCESS; - } - - //-------------------------------------------------------------------------- - // ElectronToolSelect - //-------------------------------------------------------------------------- - - // Constructor - ElectronToolSelect :: - ElectronToolSelect (const std::string& name) - : AsgTool(name), AnaToolSelect<xAOD::ElectronContainer>(name), - m_isolationTool ("IsolationSelectionTool", this) - { - declareProperty("IDString", m_idStr); - declareProperty("PtMin", m_ptMin = 4.5*GeV); - declareProperty("EtaMax", m_etaMax = 2.47); - - declareProperty( "IsolationOn", m_isolationOn = true ); - declareProperty( "IsolationWP", m_isolationWP = "Undefined", "Working point to use" ); - // The interface for adding "UserDefined" working points has changed - // -- for now supporting single standard working points only. will add other options when needed - - declareProperty( "IDAna", m_idAna = "" ); - // For applying tighter electron ID at analysis level - SUSY group recommendation - declareProperty( "LooseImpactCut", m_looseImpactCut = false ); - } - - - // Initialization - StatusCode ElectronToolSelect :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - - // Initialize the isolation selection tool - if (m_isolationOn) - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_isolationTool, CP::IsolationSelectionTool)); - ATH_CHECK (m_isolationTool.setProperty("ElectronWP", m_isolationWP)); - ATH_CHECK (m_isolationTool.initialize()); - registerTool(&*m_isolationTool); - } - - // Note: for now, use isolated objects (if isolation is applied) to build MET - - registerCut (SelectionStep::MET, "id", cut_id); - registerCut (SelectionStep::MET, "OQ", cut_OQ); - registerCut (SelectionStep::MET, "ptMin", cut_ptMin); - registerCut (SelectionStep::MET, "clusEta", cut_clusEta); - - if (m_idAna=="") - { // This was a standard setup... - registerCut (SelectionStep::MET, "d0", cut_d0); - registerCut (SelectionStep::MET, "z0", cut_z0); - registerCut (SelectionStep::MET, "isolationTool", cut_isolationTool); - } - else - { /// SUSY group recommends *not* including d0/z0/isolation in MET cuts - registerCut (SelectionStep::ANALYSIS, "d0", cut_d0); - registerCut (SelectionStep::ANALYSIS, "z0", cut_z0); - registerCut (SelectionStep::ANALYSIS, "isolationTool", cut_isolationTool); - registerCut (SelectionStep::ANALYSIS, "finalID", cut_idAna); - } - - return StatusCode::SUCCESS; - } - - - // Object selection - StatusCode ElectronToolSelect :: - selectObject (xAOD::Electron& electron) - { - ATH_MSG_DEBUG("selectObject"); - // Apply selection tool. See comments in ElectronToolPreCorrect. - - // The naming convention in derivation framework is different - std::string idStr_DFCommon = m_idStr.find("LH") != std::string::npos ? - "DFCommonElectrons" + m_idStr : - "DFCommonElectronsIsEM" + m_idStr; - - if (electron.isAvailable<SelectType>("QuickAna_" + m_idStr)) - { - cut_id.setPassedIf (electron.auxdataConst<SelectType>("QuickAna_" + m_idStr)); - } - else if (electron.isAvailable<int>(idStr_DFCommon)) - { - cut_id.setPassedIf (electron.auxdataConst<int>(idStr_DFCommon)); - } - else - { - cut_id.setPassedIf (electron.passSelection(m_idStr)); - } - - // Object quality - cut_OQ.setPassedIf (electron.isGoodOQ(xAOD::EgammaParameters::BADCLUSELECTRON)); - - // Electron pt - cut_ptMin.setPassedIf (electron.pt() >= m_ptMin); - - // Electron eta - double clusEta = electron.caloCluster()->etaBE(2); - cut_clusEta.setPassedIf (std::fabs(clusEta) < m_etaMax); - - // d0/z0 based on the track particle - const xAOD::TrackParticle* tp = electron.trackParticle(); - - // Grab the primary vertex out of the container - // TODO: would be better to do this once per event. - // TODO: we should at least move this into a helper code. - const xAOD::VertexContainer* vertexContainer = nullptr; - ATH_CHECK( evtStore()->retrieve(vertexContainer, "PrimaryVertices" ) ); - const xAOD::Vertex* pv = nullptr; - for (const auto* const vtx : *vertexContainer) { - if (vtx->vertexType() == xAOD::VxType::VertexType::PriVtx) { - pv = vtx; - break; - } - } - - // Grab the event info to get the beam spot setup. - // TODO: would be better to do this once per event. - const xAOD::EventInfo* evt = nullptr; - ATH_CHECK( evtStore()->retrieve( evt, "EventInfo" ) ); - - // Calculate d0sig and z0*sin(theta) - double el_d0Sig = -999; - double el_z0SinTheta = -999; - if(tp && evt) { - // Calculate d0 significance using the tracking CP group's tool. - el_d0Sig = xAOD::TrackingHelpers::d0significance - ( tp, evt->beamPosSigmaX(), evt->beamPosSigmaY(), evt->beamPosSigmaXY() ); - // Calculate z0*sinTheta manually. TODO: ask for similar helper function. - el_z0SinTheta = (tp->z0() + tp->vz() - (pv?pv->z():0.)) * sin(tp->theta()); - } - // Decorate the electron - electron.auxdata<double>("d0Sig") = el_d0Sig; - electron.auxdata<double>("z0sintheta") = el_z0SinTheta; - - // Tracking group's recommendation. E/gamma group will recalculate - // scale factors after pre-recommendations including these cuts in - // their selection. Believed that current uncertainties "probably" - // cover these cuts. - if(m_looseImpactCut) { - cut_d0.setPassedIf(true); - cut_z0.setPassedIf(true); - } else { - cut_d0.setPassedIf( tp && fabs(el_d0Sig)<5 ); - cut_z0.setPassedIf( tp && pv && fabs(el_z0SinTheta)<0.5 ); - } - - // Apply isolation tool - if (m_isolationOn) { - cut_isolationTool.setPassedIf (m_isolationTool->accept(electron)); - } - - if (m_idAna != "") - { - // The naming convention in derivation framework is different - std::string idAna_DFCommon = m_idAna.find("LH") != std::string::npos ? - "DFCommonElectrons" + m_idAna : - "DFCommonElectronsIsEM" + m_idAna; - - // Try our custom ID decoration first. - if (electron.isAvailable<SelectType>("QuickAna_" + m_idAna)) { - cut_idAna.setPassedIf (electron.auxdataConst<SelectType>("QuickAna_" + m_idAna)); - } - // Next, try the derivation framework ID result. - else if (electron.isAvailable<int>(idAna_DFCommon)) { - cut_idAna.setPassedIf (electron.auxdataConst<int>(idAna_DFCommon)); - } - // Last resort: use the xAOD value. Should we allow this at all? - else { - cut_idAna.setPassedIf (electron.passSelection(m_idAna)); - } - } - - return StatusCode::SUCCESS; - } - - //-------------------------------------------------------------------------- - // ElectronToolWeight - //-------------------------------------------------------------------------- - - // Constructor - ElectronToolWeight :: - ElectronToolWeight (const std::string& name) - : AsgTool(name), AnaToolWeight<xAOD::ElectronContainer>(name), - m_efficiencyTool_reco ("AsgElectronEfficiencyCorrectionTool_reco", this), - m_efficiencyTool_id ("AsgElectronEfficiencyCorrectionTool_id", this), - m_efficiencyTool_iso ("AsgElectronEfficiencyCorrectionTool_iso", this) - { - declareProperty("IDString", m_idStr); - declareProperty("IsoString", m_isoStr); - - // For applying tight electron ID at analysis level - SUSY group recommendation - declareProperty("IDAna", m_idAna = ""); - - declareProperty("IsAF2", m_isAF2=false); - } - - - // Initialization - StatusCode ElectronToolWeight :: - initialize() - { - ATH_MSG_DEBUG( "Initializing " << name() ); - - // ICHEP 2016 pre-recommendations come from: - // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/LatestRecommendationsElectronIDRun2#ICHEP_2016_pre_recommendations - - // The efficiency tools use a magic integer flag for the data type - const int effDataType = m_isAF2? 3 : 1; - - // Calib file directory - const std::string egMapFile = "ElectronEfficiencyCorrection/2015_2016/rel20.7/Moriond_February2017_v1/map0.txt"; - - // Initialize the AsgElectronEfficiencyCorrectionTool for reco - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_efficiencyTool_reco, AsgElectronEfficiencyCorrectionTool) ); - // Reco scale factors - currently need to set this file by hand - ATH_CHECK( m_efficiencyTool_reco.setProperty ("MapFilePath", egMapFile) ); - ATH_CHECK( m_efficiencyTool_reco.setProperty ("RecoKey", "Reconstruction") ); - ATH_CHECK( m_efficiencyTool_reco.setProperty ("CorrelationModel", "TOTAL") ); - ATH_CHECK( m_efficiencyTool_reco.setProperty ("ForceDataType", effDataType) ); - ATH_CHECK( m_efficiencyTool_reco.initialize() ); - registerTool(&*m_efficiencyTool_reco); - - // Well, this is irritating - std::string id_ana = TString( (m_idAna!="") ? m_idAna : m_idStr ).ReplaceAll("AndBLayer", "BLayer").ReplaceAll("LLH", "").Data(); - - // Initialize the AsgElectronEfficiencyCorrectionTool. - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_efficiencyTool_id, AsgElectronEfficiencyCorrectionTool) ); - // ID scale factors - currently need to set this file by hand. - ATH_CHECK( m_efficiencyTool_id.setProperty ("MapFilePath", egMapFile) ); - ATH_CHECK( m_efficiencyTool_id.setProperty ("IdKey", id_ana) ); - ATH_CHECK( m_efficiencyTool_id.setProperty ("CorrelationModel", "TOTAL") ); - ATH_CHECK( m_efficiencyTool_id.setProperty ("ForceDataType", effDataType) ); - ATH_CHECK( m_efficiencyTool_id.initialize() ); - registerTool(&*m_efficiencyTool_id); - - // Initialize the AsgElectronEfficiencyCorrectionTool. - if (m_isoStr != "") - { - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_efficiencyTool_iso, AsgElectronEfficiencyCorrectionTool) ); - // Iso scale factor file. As with ID file above - ATH_CHECK( m_efficiencyTool_iso.setProperty ("MapFilePath", egMapFile) ); - ATH_CHECK( m_efficiencyTool_iso.setProperty ("IdKey", id_ana) ); - ATH_CHECK( m_efficiencyTool_iso.setProperty ("IsoKey", m_isoStr) ); - ATH_CHECK( m_efficiencyTool_iso.setProperty ("CorrelationModel", "TOTAL") ); - ATH_CHECK( m_efficiencyTool_iso.setProperty("ForceDataType", effDataType) ); - ATH_CHECK( m_efficiencyTool_iso.initialize() ); - registerTool(&*m_efficiencyTool_iso); - } - return StatusCode::SUCCESS; - } - - - // Object weighting - StatusCode ElectronToolWeight :: - objectWeight (const xAOD::Electron& electron, float& weight) - { - ATH_MSG_DEBUG("objectWeight"); - // Electron efficiency SF - weight = 1.; - // Apply individual scale factors, and only if applicable apply them to the electron - double reco_weight = 1. , id_weight = 1. , iso_weight = 1.; - if (m_efficiencyTool_reco->getEfficiencyScaleFactor(electron, reco_weight) - == CP::CorrectionCode::Ok) weight *= reco_weight; - if (m_efficiencyTool_id->getEfficiencyScaleFactor(electron, id_weight) - == CP::CorrectionCode::Ok) weight *= id_weight; - if (m_efficiencyTool_iso.isInitialized() && - m_efficiencyTool_iso ->getEfficiencyScaleFactor(electron, iso_weight) - == CP::CorrectionCode::Ok) weight *= iso_weight; - return StatusCode::SUCCESS; - } - - //-------------------------------------------------------------------------- - // Maker function for electron tools. - //-------------------------------------------------------------------------- - StatusCode makeElectronTool(DefinitionArgs& args, - const std::string& id, - const bool isolationOn, - const std::string& isolationWP, - const std::string& idAna, - const bool looseImpactCut) - { - using namespace msgObjectDefinition; - using std::make_unique; - - auto config = args.configuration(); - - if (args.firstWP()){ - // Set up the appropriate global config option. - // Have to swap around the LH string. - // What is going on with this logic?? - std::string my_idStr = "LooseAndBLayerLLH"; - if ( (""!=idAna && idAna=="MediumLLH") || - (""==idAna && id=="MediumLLH") ) my_idStr = "MediumLLH"; - if ( (""!=idAna && idAna=="TightLLH") || - (""==idAna && id=="TightLLH") ) my_idStr = "TightLLH"; - config->setElectronWP(my_idStr); - } - - // Do the same for the electron isolation - if (isolationOn) - config->setElectronIsolationWP(isolationWP); - - const std::string inputContainer = "Electrons"; - - // Retrieval tool - auto retrieveTool = - make_unique<AnaToolRetrieve>(args.prefix() + "_retrieve", inputContainer); - args.add( std::move(retrieveTool) ); - - // Pre Correction tool - auto precorrectTool = - make_unique<ElectronToolPreCorrect>(args.prefix() + "_precorrect"); - args.add( std::move(precorrectTool) ); - - // Correction tool - auto correctTool = - make_unique<ElectronToolCorrect>(args.prefix() + "_correct"); - ANA_CHECK( correctTool->setProperty("IsAF2", config->isAFII()) ); - ANA_CHECK( correctTool->setProperty("IsData", config->isData()) ); - args.add( std::move(correctTool) ); - - // Selection tool - auto selectTool = make_unique<ElectronToolSelect>(args.prefix() + "_select"); - ANA_CHECK( selectTool->setProperty("IDString", id) ); - ANA_CHECK( selectTool->setProperty("IsolationOn", isolationOn) ); - ANA_CHECK( selectTool->setProperty("IsolationWP", isolationWP) ); - ANA_CHECK( selectTool->setProperty("IDAna", idAna) ); - ANA_CHECK( selectTool->setProperty("LooseImpactCut", looseImpactCut) ); - args.add( std::move(selectTool) ); - - if (!config->isData()) - { - // Weight tool - auto weightTool = make_unique<ElectronToolWeight>(args.prefix() + "_weight"); - ANA_CHECK( weightTool->setProperty("IDString", id) ); - if (isolationOn) - { - ANA_CHECK( weightTool->setProperty("IsoString", isolationWP) ); - } - else - { - ANA_CHECK( weightTool->setProperty("IsoString", "") ); - } - ANA_CHECK( weightTool->setProperty("IDAna", idAna)); - ANA_CHECK( weightTool->setProperty("IsAF2", config->isAFII()) ); - args.add( std::move(weightTool) ); - } - return StatusCode::SUCCESS; - } - - // Define the wrapper functions with these macros - - QUICK_ANA_ELECTRON_DEFINITION_MAKER - ( "loose", makeElectronTool(args, "LooseAndBLayerLLH") ) - QUICK_ANA_ELECTRON_DEFINITION_MAKER - ( "medium", makeElectronTool(args, "MediumLLH") ) - QUICK_ANA_ELECTRON_DEFINITION_MAKER - ( "tight", makeElectronTool(args, "TightLLH") ) - - QUICK_ANA_ELECTRON_DEFINITION_MAKER - ( "looseIso", makeElectronTool(args, "LooseAndBLayerLLH", true) ) - QUICK_ANA_ELECTRON_DEFINITION_MAKER - ( "mediumIso", makeElectronTool(args, "MediumLLH", true) ) - QUICK_ANA_ELECTRON_DEFINITION_MAKER - ( "tightIso", makeElectronTool(args, "TightLLH", true) ) - - QUICK_ANA_ELECTRON_DEFINITION_MAKER ( - "loose_IsoTrkOnly", - makeElectronTool(args, "LooseAndBLayerLLH", true, "LooseTrackOnly") - ) - - QUICK_ANA_ELECTRON_DEFINITION_MAKER ( - "SUSYIso", - makeElectronTool(args, "LooseAndBLayerLLH", true, "GradientLoose", "TightLLH") - ) - QUICK_ANA_ELECTRON_DEFINITION_MAKER ( - "SUSYMediumIso", - makeElectronTool(args, "LooseAndBLayerLLH", true, "GradientLoose", "MediumLLH") - ) - QUICK_ANA_ELECTRON_DEFINITION_MAKER ( - "SUSYloose", - makeElectronTool(args, "LooseAndBLayerLLH", false, "", "", true) - ) - -} // namespace ana diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventData.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/EventData.cxx deleted file mode 100644 index e3c59c57abe9866c2052a61b22a261dab1c704e4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventData.cxx +++ /dev/null @@ -1,166 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/EventData.h> - -#include <QuickAna/ObjectTypeInfo.h> -#include <RootCoreUtils/Assert.h> -#include <RootCoreUtils/ThrowMsg.h> - -// -// method implementations -// - -namespace ana -{ - void EventData :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - } - - - - EventData :: - EventData () - { - RCU_NEW_INVARIANT (this); - } - - - - const std::set<ObjectType>& EventData :: - getObjectTypes () const - { - RCU_READ_INVARIANT (this); - return m_objectTypes; - } - - - - const std::set<CP::SystematicSet>& EventData :: - getSystematics () const - { - RCU_READ_INVARIANT (this); - return m_systematics; - } - - - - const std::string& EventData :: - getName (ObjectType type, const CP::SystematicSet& sys) const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (unsigned (type) < EnumSize<ObjectType>::dataSize); - const auto iter = m_names[type].find (sys); - if (iter == m_names[type].end()) - { - if (m_names[type].empty()) - { - static std::string empty; - return empty; - } - RCU_THROW_MSG ("unsupported systematic \"" + sys.name() + "\" for type " + ObjectTypeInfo::name[type]); - } - return iter->second; - } - - - - void EventData :: - setName (ObjectType type, const CP::SystematicSet& sys, - const std::string& val_name) - { - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (unsigned (type) < EnumSize<ObjectType>::dataSize); - RCU_REQUIRE (!val_name.empty()); - - m_objectTypes.insert (type); - m_systematics.insert (sys); - m_names[type][sys] = val_name; - } - - - - std::vector<std::string> EventData :: - getNames (ObjectType type) const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (unsigned (type) < EnumSize<ObjectType>::dataSize); - // Fill a set first to identify the unique elements - std::set<std::string> uniqueNames; - for(auto& sys : m_systematics) - uniqueNames.insert( getName(type, sys) ); - // Now convert to a vector - return std::vector<std::string>( uniqueNames.begin(), uniqueNames.end() ); - } - - - - const std::string& EventData :: - getSourceName (ObjectType type, const CP::SystematicSet& sys) const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (unsigned (type) < EnumSize<ObjectType>::dataSize); - const auto iter = m_sourceNames[type].find (sys); - if (iter == m_sourceNames[type].end()) - { - if (m_sourceNames[type].empty()) - { - static std::string empty; - return empty; - } - RCU_THROW_MSG ("unsupported systematic \"" + sys.name() + "\" for type " + ObjectTypeInfo::name[type]); - } - return iter->second; - } - - - - void EventData :: - setSourceName (ObjectType type, const CP::SystematicSet& sys, - const std::string& val_sourceName) - { - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (unsigned (type) < EnumSize<ObjectType>::dataSize); - RCU_REQUIRE (!val_sourceName.empty()); - - m_objectTypes.insert (type); - m_systematics.insert (sys); - m_sourceNames[type][sys] = val_sourceName; - } - - - - std::vector<std::string> EventData :: - getSourceNames (ObjectType type) const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (unsigned (type) < EnumSize<ObjectType>::dataSize); - // Fill a set first to identify the unique elements - std::set<std::string> uniqueNames; - for(auto& sys : m_systematics) { - // There may not be a source container, so we skip if the name is empty. - auto sourceName = getSourceName(type, sys); - if(!sourceName.empty()) - uniqueNames.insert( getSourceName(type, sys) ); - } - // Now convert to a vector - return std::vector<std::string>( uniqueNames.begin(), uniqueNames.end() ); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventInfoIsData.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/EventInfoIsData.cxx deleted file mode 100644 index f2b18fafc7ee3ef94223b72fc7ce06be3525f5ca..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventInfoIsData.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/EventInfoIsData.h> - -#include <RootCoreUtils/Assert.h> -#include <xAODEventInfo/EventInfo.h> - -// -// method implementations -// - -namespace ana -{ - void EventInfoIsData :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - } - - - - EventInfoIsData :: - EventInfoIsData (const std::string& name, bool isData) - : AsgTool (name), AnaTool (name), m_isData (isData) - { - RCU_NEW_INVARIANT (this); - } - - - - StatusCode EventInfoIsData :: - execute (IEventObjects& /*objects*/) - { - RCU_CHANGE_INVARIANT (this); - - if (!m_checkedInput) - { - const xAOD::EventInfo *eventInfo = nullptr; - ATH_CHECK (evtStore()->retrieve (eventInfo, "EventInfo")); - bool isSim = eventInfo->eventType (xAOD::EventInfo::IS_SIMULATION); - if (isSim == m_isData) - { - ATH_MSG_FATAL ("isDataFlag = " << m_isData << " is inconsistent with EventInfo isSim = " << isSim); - return StatusCode::FAILURE; - } - m_checkedInput = true; - } - return StatusCode::SUCCESS; - } - - - - StatusCode EventInfoIsData :: - setObjectType (ObjectType /*type*/, const std::string& /*workingPoint*/) - { - return StatusCode::SUCCESS; - } - - - - AnalysisStep EventInfoIsData :: - step () const - { - return STEP_RETRIEVE; - } - - - - unsigned EventInfoIsData :: - inputTypes () const - { - return 0; - } - - - - unsigned EventInfoIsData :: - outputTypes () const - { - return 0; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventInfoTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/EventInfoTool.cxx deleted file mode 100644 index 57c2b50ab1ddebeae9223b5a56b74107a36a7116..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventInfoTool.cxx +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// includes -// - -#include <QuickAna/EventInfoTool.h> - -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> - -// -// method implementations -// - -namespace ana -{ - EventInfoTool :: - EventInfoTool (const std::string& name) - : AsgTool (name), AnaTool (name) - {} - - - - StatusCode EventInfoTool :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - if (type != OBJECT_EVENTINFO) - { - ATH_MSG_ERROR ("unsupported object type"); - return StatusCode::FAILURE; - } - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point in event info tool"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - StatusCode EventInfoTool :: - initialize() - { - // will add tool later if needed - - return StatusCode::SUCCESS; - } - - - - AnalysisStep EventInfoTool :: - step () const - { - return STEP_CORRECT; - } - - - - unsigned EventInfoTool :: - inputTypes () const - { - return 1 << OBJECT_EVENTINFO; - } - - - - unsigned EventInfoTool :: - outputTypes () const - { - return 1 << OBJECT_EVENTINFO; - } - - - - StatusCode EventInfoTool :: - execute (IEventObjects& /*objects*/) - { - // will add decorations of new variables later - - return StatusCode::SUCCESS; - } -} - -namespace ana -{ - StatusCode makeEventInfoTool (DefinitionArgs& args) - { - args.add (std::unique_ptr<IAnaTool> - (new AnaToolRetrieve (args.prefix() + "_retrieve", "EventInfo"))); - args.add (std::unique_ptr<EventInfoTool> (new EventInfoTool (args.prefix()))); - return StatusCode::SUCCESS; - } - - QUICK_ANA_EVENTINFO_DEFINITION_MAKER ("default", makeEventInfoTool (args)) -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventObjects.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/EventObjects.cxx deleted file mode 100644 index 545f17afe0a939de8ebabc2783432383cd1133ba..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventObjects.cxx +++ /dev/null @@ -1,109 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/EventObjects.h> - -#include <QuickAna/MessageCheck.h> -#include <QuickAna/xAODHelpers.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - EventObjects :: - EventObjects () - { - clear (nullptr, ""); - } - - - void EventObjects :: - clear (StoreType *store, const std::string& postfix) - { - m_postfix = postfix; - m_store = store; - for (unsigned iter = 0; iter < ObjectTypeInfo::numTypes; ++ iter) - { - m_objects[iter] = nullptr; - } - m_eventWeight = 1; - } - - - - StatusCode EventObjects :: - addCopy (ObjectType type, const std::string& name) - { - using namespace msgStore; - - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - if (m_objects[type]) - { - ANA_MSG_ERROR ("trying to initialize " + ObjectTypeInfo::name[type] + " twice"); - return StatusCode::FAILURE; - } - std::string anaName = "ana_" + ObjectTypeInfo::name[type] + "_" + m_postfix; - ANA_CHECK (xAODHelpers::makeShallow (*m_store, anaName, type, m_objects[type], name)); - return StatusCode::SUCCESS; - } - - - - void *EventObjects :: - getVoid (ObjectType type) const - { - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - return m_objects[type]; - } - - - - StatusCode EventObjects :: - addNew (ObjectType type) - { - using namespace msgStore; - - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - if (m_objects[type]) - { - ANA_MSG_ERROR ("trying to initialize " + ObjectTypeInfo::name[type] + " twice"); - return StatusCode::FAILURE; - } - std::string anaName = "ana_" + ObjectTypeInfo::name[type] + "_" + m_postfix; - ANA_CHECK (xAODHelpers::makeNew (*m_store, anaName, type, m_objects[type])); - return StatusCode::SUCCESS; - } - - - - // - // legacy code - // - - - - float EventObjects :: - eventWeight () const - { - return m_eventWeight; - } -} - diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventSelectBaseTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/EventSelectBaseTool.cxx deleted file mode 100644 index 0f680584f1d86ae025b581df7ce18d641ca4c396..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventSelectBaseTool.cxx +++ /dev/null @@ -1,110 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - -// -// includes -// - -#include <QuickAna/EventSelectBaseTool.h> - -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> - -// -// method implementations -// - -namespace ana -{ - EventSelectBaseTool :: - EventSelectBaseTool (const std::string& name) - : AsgTool (name), AnaTool (name) - { - } - - - - StatusCode EventSelectBaseTool :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - if (type != OBJECT_EVENT_SELECT) - { - ATH_MSG_ERROR ("unsupported object type"); - return StatusCode::FAILURE; - } - - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point for event select base tool"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - AnalysisStep EventSelectBaseTool :: - step () const - { - return STEP_RETRIEVE; - } - - - - StatusCode EventSelectBaseTool :: - useConfiguration (const InternalConfiguration& configuration) - { - ATH_CHECK (AnaTool::useConfiguration (configuration)); - for (unsigned iter = 0; iter != EnumSize<SelectionStep>::dataSize; ++ iter) - m_select.push_back (configuration.selectionName (SelectionStep (iter))); - return StatusCode::SUCCESS; - } - - - - unsigned EventSelectBaseTool :: - inputTypes () const - { - return 0; - } - - - - unsigned EventSelectBaseTool :: - outputTypes () const - { - return 1 << OBJECT_EVENT_SELECT; - } - - - - StatusCode EventSelectBaseTool :: - execute (IEventObjects& objects) - { - ATH_CHECK (objects.addNew (OBJECT_EVENT_SELECT)); - - EventSelectType *object = objects.eventSelect(); - for (auto& sel : m_select) - { - if (sel.isAvailable (*object)) - { - ATH_MSG_ERROR ("selection field already available"); - return StatusCode::FAILURE; - } - sel (*object) = true; - } - - return StatusCode::SUCCESS; - } - -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventSelectHasVertex.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/EventSelectHasVertex.cxx deleted file mode 100644 index c731c142f4f0ecebcb5b6442195831b5af887984..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/EventSelectHasVertex.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - -// -// includes -// - -#include <QuickAna/EventSelectHasVertex.h> - -#include <QuickAna/IEventObjects.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/MessageCheck.h> - -// -// method implementations -// - -namespace ana -{ - EventSelectHasVertex :: - EventSelectHasVertex (const std::string& name) - : AsgTool (name), AnaTool (name) - { - } - - - - StatusCode EventSelectHasVertex :: - initialize() - { - m_selection.registerCut (SelectionStep::MET, "vertex", cut_vertex); - return StatusCode::SUCCESS; - } - - - - StatusCode EventSelectHasVertex :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - if (type != OBJECT_EVENT_SELECT) - { - ATH_MSG_ERROR ("unsupported object type"); - return StatusCode::FAILURE; - } - - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point for event select base tool"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - StatusCode EventSelectHasVertex :: - useConfiguration (const InternalConfiguration& configuration) - { - ATH_CHECK (AnaTool::useConfiguration (configuration)); - ATH_CHECK (m_selection.initialize (configuration, "")); - return StatusCode::SUCCESS; - } - - - - AnalysisStep EventSelectHasVertex :: - step () const - { - return STEP_RETRIEVE; - } - - - - unsigned EventSelectHasVertex :: - inputTypes () const - { - return 1 << OBJECT_EVENT_SELECT; - } - - - - unsigned EventSelectHasVertex :: - outputTypes () const - { - return 1 << OBJECT_EVENT_SELECT; - } - - - - StatusCode EventSelectHasVertex :: - execute (IEventObjects& objects) - { - EventSelectType *eventSelect = objects.eventSelect(); - - ATH_CHECK (m_selection.prepare (eventSelect)); - if (m_selection.needSelectionTool()) - { - const char *contName = "PrimaryVertices"; - const xAOD::VertexContainer *vertices = nullptr; - ANA_CHECK (evtStore()->retrieve(vertices, contName)); - bool hasVertex = false; - for (auto vtx : *vertices) - { - if (vtx->vertexType() == xAOD::VxType::PriVtx) - hasVertex = true; - } - cut_vertex.setPassedIf (hasVertex); - } - m_selection.apply (); - return StatusCode::SUCCESS; - } - - - - namespace - { - StatusCode makeVertexTool (DefinitionArgs& args) - { - using namespace msgObjectDefinition; - - std::unique_ptr<EventSelectHasVertex> vertexTool - (new EventSelectHasVertex (args.prefix())); - args.add ( std::move(vertexTool) ); - - return StatusCode::SUCCESS; - } - } - - QUICK_ANA_EVENT_SELECT_DEFINITION_MAKER( "vertex", makeVertexTool(args) ) -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/FatJetTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/FatJetTool.cxx deleted file mode 100644 index df3b4d603356013fdc9d8ba75d4030587c711d30..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/FatJetTool.cxx +++ /dev/null @@ -1,263 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/FatJetTool.h> - -#include <JetCalibTools/IJetCalibrationTool.h> -#include <JetResolution/IJERSmearingTool.h> -#include <JetResolution/IJERTool.h> -#include <JetSelectorTools/JetCleaningTool.h> -#include <JetUncertainties/JetUncertaintiesTool.h> -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/InternalConfiguration.h> - - - -// For calibration tool -#define FAT_JET_JET_COLLECTION "AntiKt10LCTopo" -#define FAT_JET_CALIB_CONFIG_FILE "JES_Full2012dataset_Rscan_June2014.config" -#define FAT_JET_CALIB_SEQUENCE "EtaJES" //? - -//// For uncertainties tool -#define FAT_JET_JET_DEFINITION "AntiKt10LCTopoTrimmedPtFrac5SmallR30" -#define FAT_JET_MC_TYPE "MC12a" // Or b, c also available? -#define FAT_JET_UNCERT_CONFIG_FILE "UJ_2012/JMS2012_Jul242014_Combined.config" - - -//// For resolution tool -// TODO: Will put these in once CP Tools are figured out -#define FAT_JET_PLOT_FILE_NAME "JetResolution/JERProviderPlots_2012.root" -#define FAT_JET_COLLECTION_NAME "AntiKt10LCTopoJets" -#define FAT_JET_BEAM_ENERGY "8TeV" -#define FAT_JET_SIMULATION_TYPE "FullSim" - -//// For selection -#define FAT_JET_MAX_ABS_ETA 2.5 -#define FAT_JET_MIN_PT 50e3 - -//// For b-tagging efficiency tool -//#define FAT_JET_TAGGER_NAME "MV1" -//#define FAT_JET_OPERATING_POINT "0_7892" -//#define FAT_JET_JET_AUTHOR "AntiKt4TopoLCJVF0_5" -//#define FAT_JET_SCALE_FACTOR_FILE_NAME "dev/xAODBTaggingEfficiency/2014-Winter-8TeV-MC12-CDI.root" - - -// -// method implementations -// - -namespace ana -{ - FatJetToolCorrect :: - FatJetToolCorrect (const std::string& name) - : AsgTool (name), AnaToolCorrect<xAOD::JetContainer> (name), - m_calibration_tool ("JetCalibrationTool", this), - m_uncertainties_tool ("JetUncertaintiesTool", this), - m_resolution_tool ("JERTool", this), - m_smearing_tool ("JERSmearingTool", this) - { - } - - - - StatusCode FatJetToolCorrect :: - initialize() - { - /* - // TODO: Utilize default properties where possible! - if (m_calibration_tool.empty()) - { - AsgTool *ptr = nullptr; - QUICK_ANA_MAKE_TOOL2 (m_calibration_tool, ptr, JetCalibrationTool, name() + "calibration"); - - ATH_CHECK (ptr->setProperty( "JetCollection", FAT_JET_JET_COLLECTION)); - - // for DC14 fullsim - ATH_CHECK (ptr->setProperty( "ConfigFile", FAT_JET_CALIB_CONFIG_FILE)); - ATH_CHECK (ptr->setProperty( "CalibSequence", FAT_JET_CALIB_SEQUENCE)); - ATH_CHECK (ptr->setProperty( "IsData", false)); - ATH_CHECK (m_calibration_tool->initialize()); - } - - if (m_uncertainties_tool.empty()) - { - AsgTool *ptr = nullptr; - QUICK_ANA_MAKE_TOOL2 (m_uncertainties_tool, ptr, JetUncertaintiesTool, name() + "_uncertainties"); - ATH_CHECK (ptr->setProperty("JetDefinition", FAT_JET_JET_DEFINITION)); - ATH_CHECK (ptr->setProperty("MCType", FAT_JET_MC_TYPE)); - ATH_CHECK (ptr->setProperty("ConfigFile", FAT_JET_UNCERT_CONFIG_FILE)); - ATH_CHECK (m_uncertainties_tool->initialize()); - } - registerTool (&*m_uncertainties_tool); - - // TODO: CP Tools don't appear to support fat jets yet - if (m_resolution_tool.empty()) - { - JERTool *ptr = - new JERTool (name() + "_resolution"); - m_resolution_tool = ptr; - ATH_CHECK (ptr->setProperty("PlotFileName", FAT_JET_PLOT_FILE_NAME)); - ATH_CHECK (ptr->setProperty("CollectionName", FAT_JET_COLLECTION_NAME)); - ATH_CHECK (ptr->setProperty("BeamEnergy", FAT_JET_BEAM_ENERGY)); - // TODO: need a way to properly identify and deal with fastsim samples. - ATH_CHECK (ptr->setProperty("SimulationType", FAT_JET_SIMULATION_TYPE)); - ATH_CHECK (m_resolution_tool->initialize()); - } - - if (m_smearing_tool.empty()) - { - JERSmearingTool *ptr = - new JERSmearingTool (name() + "_smearing"); - m_smearing_tool = ptr; - ptr->setJERTool(&*m_resolution_tool); - ATH_CHECK (m_smearing_tool->initialize()); - } - registerTool (&*m_smearing_tool); - */ - - return StatusCode::SUCCESS; - } - - - - StatusCode FatJetToolCorrect :: - correctObject (xAOD::Jet& /*jet*/) - { - /* - // jet calibration - QA_CHECK_CUT (cut_calibration_tool, m_calibration_tool->applyCorrection (jet)); - - // jet energy scale uncertainties - QA_CHECK_CUT (cut_uncertainties_tool, m_uncertainties_tool->applyCorrection (jet)); - - // jet resolution smearing - QA_CHECK_CUT (cut_smearing_tool, m_smearing_tool->applyCorrection (jet)); - */ - - return StatusCode::SUCCESS; - } - - - - FatJetToolSelect :: - FatJetToolSelect (const std::string& name) - : AsgTool (name), AnaToolSelect<xAOD::JetContainer> (name) - { - } - - - - StatusCode FatJetToolSelect :: - initialize() - { - registerCut (SelectionStep::MET, "eta", cut_eta); - registerCut (SelectionStep::MET, "pt", cut_pt); - - return StatusCode::SUCCESS; - } - - - StatusCode FatJetToolSelect :: - selectObject (xAOD::Jet& jet) - { - // TODO: implement cuts like pt eta cuts. - // However, it seems that all objects that are not accepted get a weight=0 - // And, there should be CP jet selection tools for this, right? - - cut_eta.setPassedIf (fabs (jet.eta()) < FAT_JET_MAX_ABS_ETA); - cut_pt.setPassedIf (jet.pt() > FAT_JET_MIN_PT); - - return StatusCode::SUCCESS; - } - - - - FatJetToolWeight :: - FatJetToolWeight (const std::string& name) - : AsgTool (name), AnaToolWeight<xAOD::JetContainer> (name) - { - } - - - - StatusCode FatJetToolWeight :: - initialize() - { - /* TODO: The file in xAODBTaggingEfficiency/ has nothing for fat jets - if (m_btagging_eff_tool.empty()) - { - AsgTool *ptr = nullptr; - QUICK_ANA_MAKE_TOOL2 (m_btagging_eff_tool, ptr, BTaggingEfficiencyTool, - name() + "_btagging_eff"); - ATH_CHECK (ptr->setProperty("TaggerName", FAT_JET_TAGGER_NAME)); - ATH_CHECK (ptr->setProperty("OperatingPoint", FAT_JET_OPERATING_POINT)); - ATH_CHECK (ptr->setProperty("JetAuthor", FAT_JET_JET_AUTHOR)); - ATH_CHECK (ptr->setProperty("ScaleFactorFileName", FAT_JET_SCALE_FACTOR_FILE_NAME)); - //ATH_CHECK (ptr->setProperty("EfficiencyFileName", "")); - //ATH_CHECK (ptr->setProperty("SystematicStrategy", "Envelope")); - - ATH_CHECK (ptr->setProperty( "ConeFlavourLabel", true)); - ATH_CHECK (m_btagging_eff_tool->initialize()); - } - */ - - return StatusCode::SUCCESS; - } - - - StatusCode FatJetToolWeight :: - objectWeight (const xAOD::Jet& jet, float& weight) - { - // rationale: this is temporary, until the problems with - // BTaggingEfficiencyTool are worked out - if (std::fabs(jet.eta()) > FAT_JET_MAX_ABS_ETA) { - // OutOfValidityRange - weight = 1; - return StatusCode::SUCCESS; - } - /* - - QA_CHECK_WEIGHT (weight, m_btagging_eff_tool->getScaleFactor (jet, weight)); - */ - - return StatusCode::SUCCESS; - } -} - -namespace -{ - StatusCode makeFatJetTool (ana::DefinitionArgs& args) - { - args.add (std::unique_ptr<ana::IAnaTool> - (new ana::AnaToolRetrieve (args.prefix() + "_retrieve", FAT_JET_COLLECTION_NAME))); - args.add (std::unique_ptr<ana::FatJetToolCorrect> - (new ana::FatJetToolCorrect (args.prefix() + "_correct"))); - args.add (std::unique_ptr<ana::FatJetToolSelect> - (new ana::FatJetToolSelect (args.prefix() + "_select"))); - if (args.configuration()->isData() == false) - { - args.add (std::unique_ptr<ana::FatJetToolWeight> - (new ana::FatJetToolWeight (args.prefix() + "_weight"))); - } - return StatusCode::SUCCESS; - } -} - -QUICK_ANA_JET_DEFINITION_MAKER ("antikt10", makeFatJetTool (args)) diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/HZZElectronTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/HZZElectronTool.cxx deleted file mode 100644 index 7f040143fb1d5e3c52b67bc6c5f4dab29c64d8e8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/HZZElectronTool.cxx +++ /dev/null @@ -1,222 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/HZZElectronTool.h> - -#include <ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h> -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/ElectronTool.h> -#include <QuickAna/MessageCheck.h> - -#include <IsolationSelection/IsolationSelectionTool.h> -#include <xAODTracking/TrackParticlexAODHelpers.h> - -// -// method implementations -// - -namespace ana -{ - HZZElectronTool :: - HZZElectronTool (const std::string& name) - : AsgTool (name), AnaToolSelect<xAOD::ElectronContainer> (name), - m_wp (WPType::_HZZ4l), - m_isoStr ("FixedCutLoose"), - m_selectionTool ("AsgElectronLikelihoodTool", this), - m_isolationTool ("IsolationSelectionTool", this) - { - declareProperty("SelectionString", m_selection); - } - - StatusCode HZZElectronTool :: - initialize() - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_selectionTool, AsgElectronLikelihoodTool)); - ATH_CHECK (m_selectionTool.setProperty("primaryVertexContainer", "PrimaryVertices")); - std::string config = "ElectronPhotonSelectorTools/offline/mc15_20160512/"; - if(m_selection == "VLooseLLH") { - config += "ElectronLikelihoodVeryLooseOfflineConfig2016_Smooth.conf"; - } - else if(m_selection == "LooseLLH") { - config += "ElectronLikelihoodLooseOfflineConfig2016_Smooth.conf"; - } - else if(m_selection == "LooseAndBLayerLLH") { - config += "ElectronLikelihoodLooseOfflineConfig2016_CutBL_Smooth.conf"; - } - else if(m_selection == "MediumLLH") - config += "ElectronLikelihoodMediumOfflineConfig2016_Smooth.conf"; - else if(m_selection == "TightLLH") - config += "ElectronLikelihoodTightOfflineConfig2016_Smooth.conf"; - else ATH_MSG_ERROR( "Unsupported electron ID: " << m_selection ); - ATH_CHECK (m_selectionTool.setProperty ("ConfigFile", config)); - ATH_CHECK( m_selectionTool.initialize() ); - registerTool(&*m_selectionTool); - - if(m_wp != WPType::_HZZ4l) { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_isolationTool, CP::IsolationSelectionTool)); - - if(m_wp == WPType::_ZHinv) ATH_CHECK (m_isolationTool.setProperty("ElectronWP", m_isoStr)); - else ATH_CHECK (m_isolationTool.setProperty("ElectronWP", m_isoStr)); - - ATH_CHECK (m_isolationTool.initialize()); - registerTool(&*m_isolationTool); - } - - registerCut (SelectionStep::MET, "Pt", cut_Pt); - registerCut (SelectionStep::MET, "Eta", cut_Eta); - registerCut (SelectionStep::MET, "OQ", cut_OQ); - registerCut (SelectionStep::MET, "selectionTool", cut_selectionTool); - registerCut (SelectionStep::MET, "Z0", cut_Z0); - - if(m_wp != WPType::_HZZ4l && m_wp != WPType::_SMZZ4l) { - registerCut (SelectionStep::MET, "Iso", cut_Iso); - registerCut (SelectionStep::MET, "D0", cut_D0); - } - - return StatusCode::SUCCESS; - } - - - StatusCode HZZElectronTool :: - selectObject (xAOD::Electron& electron) - { - const xAOD::Vertex *pv(0); - const xAOD::VertexContainer* vertices = 0; - ANA_CHECK (evtStore()->retrieve(vertices, "PrimaryVertices")); - for ( const auto* const vtx_itr : *vertices ) - { - if (vtx_itr->vertexType() != xAOD::VxType::VertexType::PriVtx) continue; - else { - pv = vtx_itr; - break; - } - } - if(!pv) return StatusCode::SUCCESS; - double pz0 = pv->z(); - - cut_Eta.setPassedIf (std::fabs(electron.caloCluster()->etaBE(2)) < 2.47); - - cut_Pt.setPassedIf (electron.pt() > 7.e3); - - cut_selectionTool.setPassedIf (m_selectionTool->accept(&electron)); - - cut_OQ.setPassedIf( (bool) electron.isGoodOQ(xAOD::EgammaParameters::BADCLUSELECTRON) ); - - double z0 = (electron.trackParticle())->z0()+(electron.trackParticle())->vz()-pz0; - double d0 = (electron.trackParticle())->d0(); - double z0sin = z0*sin((electron.trackParticle())->theta()); - cut_Z0.setPassedIf (fabs(z0sin)<0.5); - - //electron.auxdata<char> ("ana_select_isolationTool") = - // (bool) m_isolationTool->accept(electron); - - if(m_wp == WPType::_SMZZ4l) - electron.auxdecor<char>("PassIso") = (bool)m_isolationTool->accept(electron); - - - const xAOD::EventInfo* evt = 0; - ATH_CHECK( evtStore()->retrieve( evt, "EventInfo" ) ); - double d0sig = -999.; - if(electron.trackParticle() && evt) { - d0sig = xAOD::TrackingHelpers::d0significance( electron.trackParticle(), - evt->beamPosSigmaX(), - evt->beamPosSigmaY(), - evt->beamPosSigmaXY() ); - } - electron.auxdata<double>("d0Sig") = d0sig; - electron.auxdata<double>("d0value") = d0; - electron.auxdata<double>("z0value") = z0; - - if(m_wp != WPType::_HZZ4l && m_wp != WPType::_SMZZ4l) { - cut_D0.setPassedIf (fabs(d0sig)<5.); - cut_Iso.setPassedIf (m_isolationTool->accept(electron)); - } - - - - return StatusCode::SUCCESS; - } - - - StatusCode makeHZZElectronTool (ana::DefinitionArgs& args, - const std::string& selection, - int WP, const std::string& input_isoStr) - { - using namespace msgObjectDefinition; - - std::string my_idStr = "LooseAndBLayerLLH"; - if (WP == WPType::_ZHinv) my_idStr = "MediumLLH"; - - std::string my_isoStr = input_isoStr; -// std::string my_isoStr = "FixedCutLoose"; -// if(WP == WPType::_ZHinv) my_isoStr = "Loose"; -// else if(WP == WPType::_SMZZ4l) my_isoStr = "LooseTrackOnly"; - - if (args.firstWP()){ - // Set up the appropriate global config option - // Have to swap around the LH string - args.configuration()->setElectronWP (my_idStr); - - args.configuration()->setElectronIsolationWP (my_isoStr); - } - - - const std::string inputContainer = "Electrons"; - - std::unique_ptr<IAnaTool> retrieveTool - ( new AnaToolRetrieve(args.prefix() + "_retrieve", inputContainer) ); - args.add( std::move(retrieveTool) ); - - std::unique_ptr<ElectronToolCorrect> correctTool - ( new ElectronToolCorrect(args.prefix() + "_correct") ); - ANA_CHECK - ( correctTool->setProperty("IsAF2", args.configuration()->isAFII()) ); - args.add( std::move(correctTool) ); - - - std::unique_ptr<HZZElectronTool> selectTool - ( new HZZElectronTool(args.prefix() + "_select") ); - selectTool->m_wp = WP; - selectTool->m_isoStr = my_isoStr; - ANA_CHECK( selectTool->setProperty("SelectionString", selection) ); - args.add( std::move(selectTool) ); - - if (args.configuration()->isData() == false) - { - std::unique_ptr<ElectronToolWeight> weightTool - ( new ElectronToolWeight(args.prefix() + "_weight") ); - - ANA_CHECK( weightTool->setProperty("IsoString", my_isoStr) ); - ANA_CHECK( weightTool->setProperty("IDString", my_idStr) ); - ANA_CHECK( weightTool->setProperty("IDAna", "")); - ANA_CHECK( weightTool->setProperty("IsAF2",args.configuration()->isAFII()) ); - args.add( std::move(weightTool) ); - } - return StatusCode::SUCCESS; - - } - - QUICK_ANA_ELECTRON_DEFINITION_MAKER ("hzz4l", makeHZZElectronTool (args)) - QUICK_ANA_ELECTRON_DEFINITION_MAKER ("smzz4l", makeHZZElectronTool (args, "LooseAndBLayerLLH", WPType::_SMZZ4l)) - QUICK_ANA_ELECTRON_DEFINITION_MAKER ("smzz4l_veryloose", makeHZZElectronTool (args, "VLooseLLH", WPType::_SMZZ4l)) - QUICK_ANA_ELECTRON_DEFINITION_MAKER ("hzhinv_loose", makeHZZElectronTool (args, "LooseLLH", WPType::_ZHinv, "Loose")) - QUICK_ANA_ELECTRON_DEFINITION_MAKER ("hzhinv_medium", makeHZZElectronTool (args, "MediumLLH", WPType::_ZHinv, "Loose")) -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/HZZMuonTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/HZZMuonTool.cxx deleted file mode 100644 index be588352138d4b49079516acab38374e99782836..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/HZZMuonTool.cxx +++ /dev/null @@ -1,256 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/HZZMuonTool.h> - -#include <IsolationSelection/IsolationSelectionTool.h> -#include <MuonSelectorTools/MuonSelectionTool.h> -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MuonTool.h> -#include <QuickAna/MessageCheck.h> - -#include <xAODTracking/TrackParticle.h> -#include <xAODTracking/TrackParticlexAODHelpers.h> - -// -// method implementations -// - -namespace ana -{ - HZZMuonTool :: - HZZMuonTool (const std::string& name) - : AsgTool (name), AnaToolSelect<xAOD::MuonContainer> (name), - m_quality (xAOD::Muon::Loose), - m_wp (WPType::_HZZ4l), - m_isoStr ("FixedCutLoose"), - m_selection ("selection", this), - m_isolationTool ("IsolationSelectionTool", this) - {} - - StatusCode HZZMuonTool :: - initialize() - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_selection, CP::MuonSelectionTool)); - ATH_CHECK (m_selection.setProperty ("MuQuality", int (m_quality))); - if(m_wp == WPType::_ZHinv || m_wp == WPType::_Hmumu) ATH_CHECK (m_selection.setProperty ("MaxEta", 2.5)); - ATH_CHECK (m_selection.initialize()); - - if(m_wp != WPType::_HZZ4l) { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_isolationTool, CP::IsolationSelectionTool)); - ATH_CHECK (m_isolationTool.setProperty("MuonWP", m_isoStr)); - ATH_CHECK (m_isolationTool.initialize()); - registerTool(&*m_isolationTool); - } - - registerCut (SelectionStep::MET, "ID", cut_ID); - registerCut (SelectionStep::MET, "Pt", cut_Pt); - registerCut (SelectionStep::MET, "D0", cut_D0); - registerCut (SelectionStep::MET, "Z0", cut_Z0); - -// if(m_wp == WPType::_SMZZ4l) { -// registerCut (SelectionStep::MET, "Iso", cut_Iso); -// } - - if(m_wp == WPType::_ZHinv || m_wp == WPType::_Hmumu) { - registerCut (SelectionStep::MET, "CB", cut_CB); - registerCut (SelectionStep::MET, "Eta", cut_Eta); - registerCut (SelectionStep::MET, "Iso", cut_Iso); - } - - return StatusCode::SUCCESS; - } - - - StatusCode HZZMuonTool :: - selectObject (xAOD::Muon& muon) - { - const xAOD::Vertex *pv(0); - const xAOD::VertexContainer* vertices = 0; - ANA_CHECK (evtStore()->retrieve(vertices, "PrimaryVertices")); - for ( const auto* const vtx_itr : *vertices ) - { - if (vtx_itr->vertexType() != xAOD::VxType::VertexType::PriVtx) continue; - else { pv = vtx_itr; break;} - } - if(!pv) return StatusCode::SUCCESS; - - double pz0 = pv->z(); - - int type = muon.muonType(); - double pt = muon.pt(); - double eta= muon.eta(); - - - cut_ID.setPassedIf (m_selection->accept(muon)); - - double d0=-999.0, d0sig=-999.0, z0=-999.0, z0sin=-999.0; - if(muon.primaryTrackParticle()) { - d0 = (muon.primaryTrackParticle())->d0(); - z0 = (muon.primaryTrackParticle())->z0()+(muon.primaryTrackParticle())->vz()-pz0; - z0sin = z0*sin((muon.primaryTrackParticle())->theta()); - } - - if (muon.muonType() != xAOD::Muon::MuonStandAlone) { - const xAOD::EventInfo* evt = 0; - ATH_CHECK( evtStore()->retrieve( evt, "EventInfo" ) ); - d0sig = (muon.primaryTrackParticle() && evt) ? xAOD::TrackingHelpers::d0significance( muon.primaryTrackParticle() , evt->beamPosSigmaX(), evt->beamPosSigmaY(), evt->beamPosSigmaXY() ) : -999.0; - } - muon.auxdata<double>("d0Sig") = d0sig; - - if(m_wp != WPType::_HZZ4l) { - - if (muon.muonType() != xAOD::Muon::MuonStandAlone) { - cut_Z0.setPassedIf (fabs(z0sin)<0.5); - - if(m_wp == WPType::_SMZZ4l) { - cut_D0.setPassedIf (fabs(d0)<1.); - }else { - cut_D0.setPassedIf (fabs(d0sig)<3.); - } - - }else { - cut_D0.setPassedIf ( true ); - cut_Z0.setPassedIf ( true ); - } - - if(m_wp == WPType::_SMZZ4l) { - muon.auxdecor<char>("PassIso") = (bool)m_isolationTool->accept(muon); - - if(type==0 || type==2) { - cut_Pt.setPassedIf (pt>6.e3); - } - - if(type==1) { - cut_Pt.setPassedIf (pt>6.e3); - } - - if(type==3 && muon.author()==xAOD::Muon::CaloTag) { - cut_Pt.setPassedIf (pt>15.e3); - } - } - - if(m_wp == WPType::_ZHinv) { - cut_Iso.setPassedIf (m_isolationTool->accept(muon)); - cut_CB.setPassedIf (type==0); - cut_Eta.setPassedIf (fabs(eta)<2.5); - cut_Pt.setPassedIf (pt>7.e3); - } - - if(m_wp == WPType::_Hmumu) { - cut_Iso.setPassedIf (m_isolationTool->accept(muon)); - cut_CB.setPassedIf (type==0); - cut_Eta.setPassedIf (fabs(eta)<2.5); - cut_Pt.setPassedIf (pt>15.e3); - } - - - return StatusCode::SUCCESS; - } - - if(type==0 || type==2) { - cut_D0.setPassedIf (fabs(d0)<1.); - cut_Z0.setPassedIf (fabs(z0sin)<0.5); - cut_Pt.setPassedIf (pt>5.e3); - } - - if(type==1) { - cut_Pt.setPassedIf (pt>5.e3); - cut_D0.setPassedIf (true); - cut_Z0.setPassedIf (true); - } - - if(type==3 && muon.author()==xAOD::Muon::CaloTag) { - cut_Pt.setPassedIf (pt>15.e3); - cut_D0.setPassedIf (fabs(d0)<1.); - cut_Z0.setPassedIf (fabs(z0sin)<0.5); - } - - - - return StatusCode::SUCCESS; - } - - - StatusCode makeHZZMuonTool (ana::DefinitionArgs& args, - const xAOD::Muon::Quality& quality, - int WP, const std::string& my_isoStr) - { - using namespace msgObjectDefinition; - - std::string my_idStr = "Loose"; - if (quality==xAOD::Muon::Loose) my_idStr = "Loose"; - else if (quality==xAOD::Muon::Medium) my_idStr = "Medium"; - else if (quality==xAOD::Muon::Tight) my_idStr = "Tight"; - - - if (args.firstWP()) - { - args.configuration()->setMuonIsolationWP (my_isoStr); - if(WP == WPType::_ZHinv) { - args.configuration()->setMuonWP ("Medium"); - }else { - args.configuration()->setMuonWP (my_idStr); - } - } - - std::unique_ptr<IAnaTool> retrieveTool - (new AnaToolRetrieve (args.prefix() + "_retrieve", "Muons")); - args.add (std::move (retrieveTool)); - - std::unique_ptr<IAnaTool> correctTool - (new MuonToolCorrect (args.prefix() + "_correct")); - args.add (std::move (correctTool)); - - std::unique_ptr<HZZMuonTool> selectTool - (new HZZMuonTool (args.prefix() + "_select")); - selectTool->m_quality = quality; - selectTool->m_wp = WP; - selectTool->m_isoStr = my_isoStr; - args.add (std::move (selectTool)); - - if (args.configuration()->isData() == false) - { - std::unique_ptr<MuonToolWeight> weightTool // Need concrete base class because of public member set - (new MuonToolWeight (args.prefix() + "_weight")); - weightTool->m_quality = quality; - - //const auto& lumiCalcFiles = args.configuration()->muDataFiles(); - //if(lumiCalcFiles.empty()) { - // ANA_MSG_ERROR("Muon SFs now require ilumicalc files. Please set " << - // "the muDataFiles in your QuickAna configuration"); - // return StatusCode::FAILURE; - //} - //ANA_CHECK( weightTool->setProperty("LumiCalcFiles", lumiCalcFiles) ); - - ANA_CHECK( weightTool->setProperty("IsolationWP", my_isoStr) ); - args.add (std::move (weightTool)); - } - - return StatusCode::SUCCESS; - } - - QUICK_ANA_MUON_DEFINITION_MAKER ("hzz4l", makeHZZMuonTool (args)) - QUICK_ANA_MUON_DEFINITION_MAKER ("smzz4l", makeHZZMuonTool (args, xAOD::Muon::Loose, WPType::_SMZZ4l)) - QUICK_ANA_MUON_DEFINITION_MAKER ("hzhinv_loose", makeHZZMuonTool (args, xAOD::Muon::Loose, WPType::_ZHinv, "Loose")) - QUICK_ANA_MUON_DEFINITION_MAKER ("hzhinv_medium", makeHZZMuonTool (args, xAOD::Muon::Medium, WPType::_ZHinv, "Loose")) - QUICK_ANA_MUON_DEFINITION_MAKER ("hmumu", makeHZZMuonTool (args, xAOD::Muon::Medium, WPType::_Hmumu, "LooseTrackOnly")) -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/IEventObjects.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/IEventObjects.cxx deleted file mode 100644 index dc5da06fd815bf07bdac022f629c54b401ab9a7b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/IEventObjects.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/IEventObjects.h> - -#include <QuickAna/xAODHelpers.h> - -// -// method implementations -// - -namespace ana -{ - xAOD::IParticleContainer *IEventObjects :: - getParticles (ObjectType type) - { - return xAODHelpers::getParticles (getVoid (type), type); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/IToolScheduler.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/IToolScheduler.cxx deleted file mode 100644 index 8c86fa649e58a68893ed309d17f086340e684cbb..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/IToolScheduler.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/IToolScheduler.h> - -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionConf.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/IAnaTool.h> -#include <QuickAna/MessageCheck.h> - -// -// method implementations -// - -namespace ana -{ - StatusCode IToolScheduler :: - addTools (const Configuration& conf, InternalConfiguration& internal, - const std::string& prefix) - { - using namespace msgScheduler; - - AnaToolSequence tools; - { - std::vector<DefinitionConf> confList; - ANA_CHECK (DefinitionConf::makeConfigList (confList, conf)); - - DefinitionArgs masterArgs (prefix, &internal); - ANA_CHECK (makeToolSequence (confList, masterArgs, tools)); - } - for (auto& tool : tools) - { - if (tool.first) - ANA_CHECK (tool.first->getInitialConfiguration(internal)); - } - for (auto& tool : tools) - { - if (tool.first) - ANA_CHECK (tool.first->useInitialConfiguration(internal)); - } - for (auto& tool : tools) - { - if (tool.first) - { - ANA_CHECK (tool.first->initialize()); - ANA_CHECK (tool.first->useConfiguration (internal)); - ANA_CHECK (addTool (std::move (tool.first))); - } - } - return StatusCode::SUCCESS; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/InternalConfiguration.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/InternalConfiguration.cxx deleted file mode 100644 index c21c579a53aaa394ec4080513cc91b8f5d5092c4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/InternalConfiguration.cxx +++ /dev/null @@ -1,159 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/InternalConfiguration.h> - -#include <QuickAna/Configuration.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - void InternalConfiguration :: - fetchConfiguration (const Configuration& conf) - { - m_isData = conf.isDataFlag; - m_isAFII = conf.isAFIIFlag; - m_doingMet = conf.metDef != "none"; - m_muDataFiles = conf.muDataFiles; - m_msgLevel = MSG::Level (conf.msgLevel); - if (!conf.selectionNameMET.empty()) - m_selectionName[unsigned (SelectionStep::MET)] = conf.selectionNameMET; - else - m_selectionName[unsigned (SelectionStep::MET)] = "ana_select_met"; - if (!conf.selectionNameOR.empty()) - m_selectionName[unsigned (SelectionStep::OR)] = conf.selectionNameOR; - else - m_selectionName[unsigned (SelectionStep::OR)] = "ana_select_or"; - if (!conf.selectionName.empty()) - m_selectionName[unsigned (SelectionStep::ANALYSIS)] = conf.selectionName; - else - m_selectionName[unsigned (SelectionStep::ANALYSIS)] = "ana_select"; - } - - - - bool InternalConfiguration :: - isData () const - { - return m_isData; - } - - - bool InternalConfiguration :: - isAFII () const - { - return m_isAFII; - } - - - MSG::Level InternalConfiguration :: - msgLevel () const - { - return m_msgLevel; - } - - - std::string InternalConfiguration :: - muonWP () const - { - return m_muonWP; - } - - - std::string InternalConfiguration :: - muonIsolationWP () const - { - return m_muonIsoWP; - } - - - void InternalConfiguration :: - setMuonWP (std::string WP) - { - m_muonWP = WP; - } - - - void InternalConfiguration :: - setMuonIsolationWP (std::string WP) - { - m_muonIsoWP=WP; - } - - - - std::string InternalConfiguration :: - electronWP () const - { - return m_eleWP; - } - - - std::string InternalConfiguration :: - electronIsolationWP () const - { - return m_eleIsoWP; - } - - - void InternalConfiguration :: - setElectronWP (std::string WP) - { - m_eleWP=WP; - } - - - void InternalConfiguration :: - setElectronIsolationWP (std::string WP) - { - m_eleIsoWP=WP; - } - - - const std::string& InternalConfiguration :: - selectionName (SelectionStep step) const - { - if (unsigned (step) >= EnumSize<SelectionStep>::dataSize) - { - static const std::string empty; - return empty; - } - return m_selectionName[unsigned (step)]; - } - - - - const std::string& InternalConfiguration :: - inputName (ObjectType type) const - { - return m_inputName[unsigned(type)]; - } - - - - void InternalConfiguration :: - setInputName (ObjectType type, const std::string& val_inputName) - { - RCU_ASSERT_SOFT (m_inputName[unsigned(type)].empty()); - m_inputName[unsigned(type)] = val_inputName; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/IsolationTools.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/IsolationTools.cxx deleted file mode 100644 index 254f916d725433454d2c6f86dd82601a05f604d3..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/IsolationTools.cxx +++ /dev/null @@ -1,195 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <QuickAna/IsolationTools.h> - -#include <QuickAna/MessageCheck.h> - -namespace ana { - -IsolationBase::IsolationBase() { -} - -IsolationBase::~IsolationBase() { -} - - -AbsoluteIsolationDC14::AbsoluteIsolationDC14(const xAOD::Iso::IsolationType type, double cutvalue) : - m_type(type), - m_cutvalue(cutvalue) { -} - -bool AbsoluteIsolationDC14::passSelection(const xAOD::IParticle& p) const { - using namespace msgIsolationTools; - - //electrons - if (p.type() == xAOD::Type::Electron) { - float iso = 0.; - const xAOD::Electron* el = dynamic_cast<const xAOD::Electron*>(&p); - bool exists = el->isolationValue(iso, m_type); - return exists && iso > m_cutvalue; - } - - //muons - if (p.type() == xAOD::Type::Muon) { - float iso = 0.; - const xAOD::Muon* mu = dynamic_cast<const xAOD::Muon*>(&p); - bool exists = mu->isolation(iso, m_type); - return exists && iso > m_cutvalue; - } - - ANA_MSG_FATAL ("IsolationDC14::Not an electron or muon"); - exit(1); - - //should never happen (famous last words for a comment, no?) - return false; -} - -///Implement me! -bool AbsoluteIsolationDC14::passSelectionLoose(const xAOD::IParticle& /*p*/) const { - return true; -} - -void AbsoluteIsolationDC14::print(std::ostream& os) const { - os << " * AbsoluteIsolationDC14\n"; - os << " * " << m_type << " > " << m_cutvalue << " MeV\n"; - //missing in xaodprimities-00-00-02 os << " * " << xAOD::Iso::toString(m_type) << " > " << m_cutvalue << " MeV\n"; -} - - - -RelativePTVarCone::RelativePTVarCone(unsigned int size, double fraction, unsigned int sizeLoose, double fractionLoose) : - m_fraction(fraction), - m_fractionLoose(fractionLoose) { - - using namespace msgIsolationTools; - - if (size != 20 && size != 30 && size != 40) { - ANA_MSG_FATAL ("ptvarcone only supports cone sizes of 20, 30, 40"); - ANA_MSG_FATAL ("and you asked for " << size << ". why?"); - exit(1); - } - - std::stringstream ss; - ss << "ptvarcone" << size; - m_size = ss.str(); - - ss.str(""); - ss << "ptvarcone" << sizeLoose; - m_sizeLoose = ss.str(); -} - -bool RelativePTVarCone::passSelection(const xAOD::IParticle& p) const { - return (p.auxdataConst<float>(m_size) / p.pt() < m_fraction); -} - -bool RelativePTVarCone::passSelectionLoose(const xAOD::IParticle& p) const { - if (m_fractionLoose<0) return true; - return (p.auxdataConst<float>(m_sizeLoose) / p.pt() < m_fractionLoose); -} - -void RelativePTVarCone::print(std::ostream& os) const { - os << " * RelativePTVarCone\n"; - os << " * " << m_size << " /pT > " << m_fraction << "\n"; -} - - -ApproxPTVarCone::ApproxPTVarCone(double fraction, double fractionLoose) : - m_fraction(fraction), - m_fractionLoose(fractionLoose) { -} - -bool ApproxPTVarCone::passSelection(const xAOD::IParticle& p) const { - return (p.auxdataConst<float>("miniIso") / p.pt() < m_fraction); -} - -bool ApproxPTVarCone::passSelectionLoose(const xAOD::IParticle& p) const { - if (m_fractionLoose<0) return true; - return (p.auxdataConst<float>("miniIso") / p.pt() < m_fractionLoose); -} - -void ApproxPTVarCone::print(std::ostream& os) const { - os << " * Approximate Mini Isolation\n"; - os << " * iso/pT > " << m_fraction << "\n"; -} - - - -StandardIsolation::StandardIsolation(const std::string& obj_type_str) : - m_isolationTool("CP::IsolationSelectionTool"), - m_isolationToolLoose("CP::IsolationSelectionToolLoose") -{ - using namespace msgIsolationTools; - - if ( ! m_isolationTool.setProperty(obj_type_str+"WP","Gradient") ) - { - ANA_MSG_FATAL ("Failed to set working point of IsolationSelectionTool"); - exit(1); - } - if ( ! m_isolationTool.initialize() ) - { - ANA_MSG_FATAL ("Failed to initialize IsolationSelectionTool"); - exit(1); - } - - // Loose photons, electrons & muons - if ( ! m_isolationToolLoose.setProperty(obj_type_str+"WP","LooseTrackOnly") ) - { - ANA_MSG_ERROR ("Failed to set working point of Loose IsolationSelectionTool"); - } - if ( ! m_isolationToolLoose.initialize() ) - { - ANA_MSG_ERROR ("Failed to initialize Loose IsolationSelectionTool"); - } -} - -bool StandardIsolation::passSelection(const xAOD::IParticle& p) const -{ - if( p.type() == xAOD::Type::Photon ){ - const xAOD::Photon& ph = dynamic_cast<const xAOD::Photon&>(p); - return m_isolationTool.accept(ph); - } - - if( p.type() == xAOD::Type::Electron ){ - const xAOD::Electron& el = dynamic_cast<const xAOD::Electron&>(p); - return m_isolationTool.accept(el); - } - - if( p.type() == xAOD::Type::Muon ){ - const xAOD::Muon& mu = dynamic_cast<const xAOD::Muon&>(p); - return m_isolationTool.accept(mu); - } - - // Not a photon, electron or muon? - return false; -} - -bool StandardIsolation::passSelectionLoose(const xAOD::IParticle& p) const -{ - if( p.type() == xAOD::Type::Photon ){ - const xAOD::Photon& ph = dynamic_cast<const xAOD::Photon&>(p); - return m_isolationToolLoose.accept(ph); - } - - if( p.type() == xAOD::Type::Electron ){ - const xAOD::Electron& el = dynamic_cast<const xAOD::Electron&>(p); - return m_isolationToolLoose.accept(el); - } - - if( p.type() == xAOD::Type::Muon ){ - const xAOD::Muon& mu = dynamic_cast<const xAOD::Muon&>(p); - return m_isolationToolLoose.accept(mu); - } - - // Not a photon, electron or muon? - return false; -} - -void StandardIsolation::print(std::ostream& os) const { - os << " * Standard Isolation\n"; - os << " * Tight: Gradient Isolation\n"; - os << " * Loose: LooseTrackOnly Isolation\n"; -} - -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/JetTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/JetTool.cxx deleted file mode 100644 index ab79e61eb34959f14ed60c43402b2d853a817ed8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/JetTool.cxx +++ /dev/null @@ -1,523 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/JetTool.h> - -#include <JetCalibTools/JetCalibrationTool.h> -#include <JetResolution/JERSmearingTool.h> -#include <JetResolution/JERTool.h> -#include <JetSelectorTools/JetCleaningTool.h> -#include <JetUncertainties/JetUncertaintiesTool.h> -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> -#include <xAODBTaggingEfficiency/BTaggingEfficiencyTool.h> -#include <xAODBTaggingEfficiency/BTaggingSelectionTool.h> -#include <JetMomentTools/JetVertexTaggerTool.h> -#include <JetJvtEfficiency/JetJvtEfficiency.h> -#include <AthContainers/ConstDataVector.h> - -static const float GeV = 1000.; -static const float TeV = 1e6; - -// BTag config options currently depend on release -namespace -{ -#if ROOTCORE_RELEASE_SERIES <= 23 - const char* btagAlgDefault = "MV2c20"; - const std::string bTagCalibFile = - "xAODBTaggingEfficiency/13TeV/2016-Winter-13TeV-MC15-CDI-March10_v1.root"; - const char *jesFile = "JES_data2016_data2015_Recommendation_Dec2016.config"; - const std::string uncertConfigFile = "JES_2015/Moriond2016/JES2015_SR_Scenario1.config"; -#elif ROOTCORE_RELEASE_SERIES == 24 - const char* btagAlgDefault = "MV2c10"; - const std::string bTagCalibFile = - "xAODBTaggingEfficiency/13TeV/2016-20_7-13TeV-MC15-CDI-2017-04-24_v1.root"; - const char *jesFile = "JES_data2016_data2015_Recommendation_Dec2016.config"; - const std::string uncertConfigFile = "JES_2016/Moriond2017/JES2016_SR_Scenario1.config"; -#else - const char* btagAlgDefault = "MV2c10"; - const std::string bTagCalibFile = - "xAODBTaggingEfficiency/13TeV/2016-20_7-13TeV-MC15-CDI-2017-04-24_v1.root"; - const char *jesFile = "JES_MC15cRecommendation_May2016_rel21.config"; - const std::string uncertConfigFile = "JES_2016/Moriond2017/JES2016_SR_Scenario1.config"; -#endif -} - -// -// method implementations -// - -namespace ana -{ - JetToolCorrect :: - JetToolCorrect (const std::string& name) - : AsgTool (name), AnaToolCorrect<xAOD::JetContainer> (name), - m_calibration_tool ("calibration", this), - m_uncertainties_tool ("uncertainties", this), - m_resolution_tool ("resolution", this), - m_smearing_tool ("smearing", this), - m_jvt_tool ("jvt", this), - m_jvtEffTool("jvt_eff", this), - m_bsel_tool ("btag", this), - m_bsel_OR_tool ("btag_OR", this), - m_cleaning_tool ("cleaning", this) - { - declareProperty("EnableBTagging", m_enableBTagging = true); - declareProperty("BTagger", m_btagger = btagAlgDefault); - declareProperty("BTagWP", m_btagWP = "FixedCutBEff_77"); - // Set to a large negative number to disable - // TODO: add a better way to disable - declareProperty("BTagWP_OR", m_btagWP_OR = "FixedCutBEff_85"); - } - - - - StatusCode JetToolCorrect :: - useInitialConfiguration (const InternalConfiguration& conf) - { - ATH_CHECK (AnaTool::useInitialConfiguration (conf)); - - m_isData = conf.isData(); - m_isAFII = conf.isAFII(); - - m_jetContainer = conf.inputName (OBJECT_JET); - if (m_jetContainer.empty()) - { - ATH_MSG_ERROR ("can't apply correction without jet collection name"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - StatusCode JetToolCorrect :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - - // JES MC15 calibration recommendations from: - // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/JetEtmissRecommendationsMC15 - - // Strip off the "Jets" suffix in the jet collection name - // @TODO: update AnaToolHandle tool creation mechanism - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_calibration_tool, JetCalibrationTool)); - const auto jetCollection = m_jetContainer.substr(0, m_jetContainer.size()-4); - const std::string configFile = m_isAFII ? "JES_MC15Prerecommendation_AFII_June2015.config" - : jesFile; -#if ROOTCORE_RELEASE_SERIES == 24 - const std::string calibSeq = m_isData ? "JetArea_Residual_Origin_EtaJES_GSC_Insitu" - : "JetArea_Residual_Origin_EtaJES_GSC"; -#else - const std::string calibSeq = m_isData ? "JetArea_Residual_EtaJES_GSC_Insitu" - : "JetArea_Residual_EtaJES_GSC"; - std::string rhoKey = jetCollection.find("LCTopo")!=std::string::npos ? "Kt4LCTopoOriginEventShape" - : "Kt4EMTopoOriginEventShape"; - ATH_CHECK( m_calibration_tool.setProperty("RhoKey", rhoKey) ); -#endif - ATH_CHECK( m_calibration_tool.setProperty("JetCollection", jetCollection) ); - ATH_CHECK( m_calibration_tool.setProperty("ConfigFile", configFile) ); - ATH_CHECK( m_calibration_tool.setProperty("CalibSequence", calibSeq) ); - ATH_CHECK( m_calibration_tool.setProperty("IsData", m_isData) ); - ATH_CHECK( m_calibration_tool.initialize() ); - - // JES MC15 uncertainty recommendations from: - // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/JetUncertainties2015Moriond2016 - - // NOTE: using the strongly reduced uncertainty breakdown. JetEtMiss says - // that analyses MUST evaluate all four strongly reduced scenarios before - // adopting this one! - // const std::string uncertConfigFile = "JES_2015/ICHEP2016/JES2015_SR_Scenario1.config"; - //const std::string uncertConfigFile = "JES_2015/Moriond2016/JES2015_19NP.config"; - - // @TODO: update AnaToolHandle tool creation mechanism - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_uncertainties_tool, JetUncertaintiesTool) ); - ATH_CHECK( m_uncertainties_tool.setProperty("JetDefinition", jetCollection) ); - ATH_CHECK( m_uncertainties_tool.setProperty("MCType", m_isAFII ? "AFII" : "MC15") ); - ATH_CHECK( m_uncertainties_tool.setProperty("ConfigFile", uncertConfigFile) ); - ATH_CHECK( m_uncertainties_tool.initialize() ); - registerTool( &*m_uncertainties_tool); - - // JER MC15 pre-recommendations - - // Specify the JER file - Don't want behavior to change with the same tag of - // QuickAna just because the package underlying was updated (JER in this case) - const std::string jerFile = - "JetResolution/Prerec2015_xCalib_2012JER_ReducedTo9NP_Plots_v2.root"; - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_resolution_tool, JERTool)); - ATH_CHECK( m_resolution_tool.setProperty("PlotFileName", jerFile) ); - ATH_CHECK( m_resolution_tool.setProperty("CollectionName", m_jetContainer) ); - ATH_CHECK( m_resolution_tool.initialize() ); - - // @TODO: update AnaToolHandle tool creation mechanism - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_smearing_tool, JERSmearingTool) ); - ATH_CHECK( m_smearing_tool.setProperty("isMC", !m_isData) ); - ATH_CHECK( m_smearing_tool.setProperty("ApplyNominalSmearing", false) ); - ATH_CHECK( m_smearing_tool.setProperty("SystematicMode", "Simple") ); - ATH_CHECK( m_smearing_tool.setProperty - ("JERTool", m_resolution_tool) ); - ATH_CHECK( m_smearing_tool.initialize() ); - registerTool( &*m_smearing_tool ); - - // JVT tool - const std::string jvtFile = "JetMomentTools/JVTlikelihood_20140805.root"; - // @TODO: update AnaToolHandle tool creation mechanism - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_jvt_tool, JetVertexTaggerTool) ); - ATH_CHECK( m_jvt_tool.setProperty("JVTFileName", jvtFile) ); - ATH_CHECK( m_jvt_tool.initialize() ); - - // JVT efficiency SF - // From https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JVTCalibration - // @TODO update tool creation mechanism - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_jvtEffTool, CP::JetJvtEfficiency) ); - // The default working point is the recommended one - //ATH_CHECK( m_jvtEffTool.setProperty("WorkingPoint","Default") ); - ATH_CHECK( m_jvtEffTool.initialize() ); - registerTool (&*m_jvtEffTool); - - // b-tagging tools - if(m_enableBTagging) { - //const std::string bTagCalibFile = - // "xAODBTaggingEfficiency/13TeV/2016-20_7-13TeV-MC15-CDI-May31_v1.root"; - // @TODO: update AnaToolHandle tool creation mechanism - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_bsel_tool, BTaggingSelectionTool) ); - ATH_CHECK( m_bsel_tool.setProperty("TaggerName", m_btagger) ); - ATH_CHECK( m_bsel_tool.setProperty("OperatingPoint", m_btagWP) ); - ATH_CHECK( m_bsel_tool.setProperty("JetAuthor", m_jetContainer) ); - ATH_CHECK( m_bsel_tool.setProperty("FlvTagCutDefinitionsFileName", bTagCalibFile) ); - ATH_CHECK( m_bsel_tool.initialize() ); - - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_bsel_OR_tool, BTaggingSelectionTool) ); - ATH_CHECK( m_bsel_OR_tool.setProperty("TaggerName", m_btagger) ); - ATH_CHECK( m_bsel_OR_tool.setProperty("OperatingPoint", m_btagWP_OR) ); - ATH_CHECK( m_bsel_OR_tool.setProperty("JetAuthor", m_jetContainer) ); - ATH_CHECK( m_bsel_OR_tool.setProperty("FlvTagCutDefinitionsFileName", bTagCalibFile) ); - ATH_CHECK( m_bsel_OR_tool.initialize() ); - } - - // Jet cleaning tool for decoration - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_cleaning_tool, JetCleaningTool)); - ATH_CHECK (m_cleaning_tool.setProperty("CutLevel", "LooseBad")); - ATH_CHECK (m_cleaning_tool.setProperty("DoUgly", false)); - ATH_CHECK (m_cleaning_tool.initialize()); - - registerCut (SelectionStep::MET, "calibration_tool", cut_calibration_tool); - registerCut (SelectionStep::MET, "uncertainties_tool", cut_uncertainties_tool); - registerCut (SelectionStep::MET, "smearing_tool", cut_smearing_tool); - - // Only decorate jets with the information, so that event-level - // cleaning can be performed later - registerCut (SelectionStep::MANUAL, "cleaning_tool", cut_cleaning_tool); - - return StatusCode::SUCCESS; - } - - - - StatusCode JetToolCorrect :: - correctObject (xAOD::Jet& jet) - { - ATH_MSG_DEBUG("correctObject"); - // jet calibration - QA_CHECK_CUT( cut_calibration_tool, m_calibration_tool->applyCorrection(jet) ); - - // jet energy scale uncertainties - QA_CHECK_CUT( cut_uncertainties_tool, m_uncertainties_tool->applyCorrection(jet) ); - - // jet resolution smearing - QA_CHECK_CUT( cut_smearing_tool, m_smearing_tool->applyCorrection(jet) ); - - // JVT Recalculation after calibration - float jvt = m_jvt_tool->updateJvt(jet); - // Update "Jvt" of the jet - required by the MET tool - jet.auxdata<float>("Jvt") = jvt; - bool jvt_pass = m_jvtEffTool->passesJvtCut(jet); - jet.auxdata<char>("Jvt_pass") = jvt_pass; - - // B-tagging section - if (m_enableBTagging) - { - // BTagging valid in pt > 20, |eta| < 2.5 - bool inBTagKinRange = jet.pt() > 20.*GeV && std::abs(jet.eta()) < 2.5; - - // B-Jet criteria - bool isbjet = ( inBTagKinRange && jvt_pass && m_bsel_tool->accept(jet) ); - jet.auxdecor<char>("bjet") = isbjet; - - // Apply the dedicated bjet decoration for overlap removal as well. - // Working point can be different from standard one. - bool isbjet_OR = isbjet; - if (m_btagWP_OR != m_btagWP) { - isbjet_OR = ( inBTagKinRange && jvt_pass && m_bsel_OR_tool->accept(jet) ); - } - jet.auxdecor<char>("bjet_OR") = isbjet_OR; - - // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetUncertainties2015Prerec#Tool_requirements_and_assumption - // Explains that this decoration *must* be called IsBjet for the - // nuisance parameter breakdown to work. - // - Why can't we just adopt this as our convention, then?? - jet.auxdecor<char>("IsBjet") = isbjet; - } - - // We only clean, by default, jets that might've passed our JVT selection. - // This is too hard-coded, ugly. - bool is_clean = ( jet.pt() < 20.*GeV || (jet.pt()<60.*GeV && !jvt_pass) || - m_cleaning_tool->keep(jet) ); - cut_cleaning_tool.setPassedIf ( is_clean ); - - // Also decorate the jet with the information, so that - // event-level cleaning can be performed later. - jet.auxdecor<char>("clean_jet") = is_clean; - - return StatusCode::SUCCESS; - } - - - - JetToolSelect :: - JetToolSelect (const std::string& name) - : AsgTool (name), AnaToolSelect<xAOD::JetContainer> (name), - m_jvt_cut_step (SelectionStep::MET) - { - } - - - - StatusCode JetToolSelect :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - - // For SUSY: Make sure to *not* cut jets before they hit the overlap removal! - // Just decorate. - registerCut (m_jvt_cut_step, "jvt", cut_jvt); - - return StatusCode::SUCCESS; - } - - - - StatusCode JetToolSelect :: - selectObject (xAOD::Jet& jet) - { - ATH_MSG_DEBUG("selectObject"); - - // Apply the recommended selection - cut_jvt.setPassedIf ( jet.getAttribute<char>("Jvt_pass") ); - - return StatusCode::SUCCESS; - } - - - - JetToolWeight :: - JetToolWeight (const std::string& name) - : AsgTool (name), AnaToolWeight<xAOD::JetContainer> (name), - m_btagging_eff_tool ("btagging_eff", this), - m_jvtEffTool("jvt_eff", this), - m_anaSelect ("ana_select"), - m_anaWeight ("ana_weight") - { - declareProperty("BTagger", m_btagger = btagAlgDefault); - declareProperty("BTagWP", m_btagWP = "-0_4434"); - } - - - unsigned JetToolWeight :: - inputTypes () const - { - return (1 << OBJECT_EVENTINFO) | (1 << OBJECT_JET); - } - - - unsigned JetToolWeight :: - outputTypes () const - { - return (1 << OBJECT_EVENTINFO) | (1 << OBJECT_JET); - } - - - StatusCode JetToolWeight :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - - // BTag efficiency SF - // Recommendations come from - // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/BTagCalib2015 - - //const std::string btagFile = - // "xAODBTaggingEfficiency/13TeV/2016-20_7-13TeV-MC15-CDI-May31_v1.root"; - - // @TODO update tool creation mechanism - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_btagging_eff_tool, BTaggingEfficiencyTool) ); - ATH_CHECK( m_btagging_eff_tool.setProperty("TaggerName", m_btagger) ); - // really stupid that these have different formats - ATH_CHECK( m_btagging_eff_tool.setProperty("OperatingPoint", m_btagWP) ); - ATH_CHECK( m_btagging_eff_tool.setProperty("JetAuthor", "AntiKt4EMTopoJets") ); - ATH_CHECK( m_btagging_eff_tool.setProperty("ScaleFactorFileName", bTagCalibFile) ); - ATH_CHECK( m_btagging_eff_tool.setProperty("SystematicsStrategy", "Envelope") ); - ATH_CHECK( m_btagging_eff_tool.initialize() ); - // register for systematics - registerTool (&*m_btagging_eff_tool); - - // JVT efficiency SF - // From https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JVTCalibration - // @TODO update tool creation mechanism - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_jvtEffTool, CP::JetJvtEfficiency) ); - // The default working point is the recommended one - //ATH_CHECK( m_jvtEffTool.setProperty("WorkingPoint","Default") ); - ATH_CHECK( m_jvtEffTool.initialize() ); - registerTool (&*m_jvtEffTool); - - return StatusCode::SUCCESS; - } - - - StatusCode JetToolWeight :: - execute (IEventObjects& objects) - { - - ConstDataVector<xAOD::JetContainer> jvtjets(SG::VIEW_ELEMENTS); - for (auto object : *objects.jets()) - { - float weight = 1; - if (m_anaSelect (*object)) - { - ATH_CHECK (this->objectWeight (*object, weight)); - if (!(weight > 0)) - { - ATH_MSG_WARNING ("object weight of " << weight << - " is not allowed: pt=" << object->pt() << - " eta=" << object->eta() << - " phi=" << object->phi()); - //return StatusCode::FAILURE; - } - jvtjets.push_back( object ); - } else - { - weight = 1; - } - m_anaWeight (*object) = weight; - } - - float totalSF=1.; - - CP::CorrectionCode ret = m_jvtEffTool->applyAllEfficiencyScaleFactor( jvtjets.asDataVector() , totalSF ); - - switch (ret) { - case CP::CorrectionCode::Error: - ATH_MSG_ERROR( "Failed to retrieve SF for jet in SUSYTools_xAOD::JVT_SF" ); - case CP::CorrectionCode::OutOfValidityRange: - ATH_MSG_VERBOSE( "No valid SF for jet in SUSYTools_xAOD::JVT_SF" ); - default: - ATH_MSG_VERBOSE( " Retrieve SF for jet container in SUSYTools_xAOD::JVT_SF with value " << totalSF ); - } - objects.eventinfo()->auxdata<float>("JVT_SF") = totalSF; - - - return StatusCode::SUCCESS; - } - - - StatusCode JetToolWeight :: - objectWeight (const xAOD::Jet& jet, float& weight) - { - ATH_MSG_DEBUG("objectWeight"); - - // Apply btag efficiency SF. - // The btag tool only supports pt > 20 and |eta| < 2.5 - if (jet.pt() > 20.*GeV && jet.pt() <= 1.*TeV && std::abs(jet.eta()) < 2.5) - { - // If the jet is b-tagged, use the efficiency weight - if (jet.auxdecor<char>("IsBjet")) { - QA_CHECK_WEIGHT( float, weight, - m_btagging_eff_tool->getScaleFactor(jet, weight) ); - } - // If it is not, then use the *inefficiency* weight - else { - QA_CHECK_WEIGHT( float, weight, - m_btagging_eff_tool->getInefficiencyScaleFactor(jet, weight) ); - } - } - - return StatusCode::SUCCESS; - } - - - - // Maker function for jet tools - StatusCode makeJetTool (DefinitionArgs& args, - const std::string& collection, - const SelectionStep& jvt_step, - const std::string& btagWP) - { - using namespace msgObjectDefinition; - - const bool useBTagging = !btagWP.empty(); - const auto config = args.configuration(); - - args.add (std::unique_ptr<IAnaTool> - (new AnaToolRetrieve (args.prefix() + "_retrieve", collection))); - - std::unique_ptr<JetToolCorrect> correctTool - (new JetToolCorrect (args.prefix() + "_correct")); - ANA_CHECK( correctTool->setProperty("EnableBTagging", useBTagging) ); - ANA_CHECK( correctTool->setProperty("BTagWP", btagWP) ); - args.add (std::move (correctTool)); - - std::unique_ptr<JetToolSelect> selectTool - (new JetToolSelect (args.prefix() + "_select")); - selectTool->m_jvt_cut_step = jvt_step; - args.add (std::move (selectTool)); - - // Only apply jet weights to MC. - // Also, at the moment we're only applying btag-related weights, so - // disable the weight tool if we're not using btagging - if (config->isData() == false && useBTagging) - { - std::unique_ptr<JetToolWeight> weightTool - (new JetToolWeight (args.prefix() + "_weight")); - ANA_CHECK( weightTool->setProperty("BTagWP", btagWP)); - args.add (std::move (weightTool)); - } - return StatusCode::SUCCESS; - } - - QUICK_ANA_JET_DEFINITION_MAKER ("antikt04_noBtag", - makeJetTool (args, "AntiKt4EMTopoJets")) - - QUICK_ANA_JET_DEFINITION_MAKER ("AntiKt4EMTopoJets antikt04", - makeJetTool (args, "AntiKt4EMTopoJets", SelectionStep::MET, - "FixedCutBEff_77")) - - QUICK_ANA_JET_DEFINITION_MAKER ("antikt04_HZZ", - makeJetTool (args, "AntiKt4EMTopoJets", SelectionStep::ANALYSIS, - "FixedCutBEff_85")) - - QUICK_ANA_JET_DEFINITION_MAKER( "AntiKt4EMTopo_SUSY", - makeJetTool (args, "AntiKt4EMTopoJets", SelectionStep::ANALYSIS, - "FixedCutBEff_77")) - - QUICK_ANA_JET_DEFINITION_MAKER( "antikt04_DiMu", - makeJetTool (args, "AntiKt4EMTopoJets", SelectionStep::MET, - "FixedCutBEff_50")) -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/KinObjectSelect.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/KinObjectSelect.cxx deleted file mode 100644 index 5fc0f0b4b17df7fc9166564242f9c11e1a11ceae..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/KinObjectSelect.cxx +++ /dev/null @@ -1,375 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/KinObjectSelect.h> - -#include <QuickAna/MessageCheck.h> -#include <stdexcept> - -// -// method implementations -// - -namespace ana -{ - namespace - { - /// \brief the different types of logic operator a term can result - /// from - enum class LogicOp - { - /// \brief not a logic operator - NONE, - - /// \brief and(&&) operator - AND, - - /// \brief or(||) operator - OR - }; - - /// \brief the summary description of a term in the formula - struct Term - { - /// \brief if this is the a boolean term, this is it - public: - std::function<bool(const xAOD::IParticle& p)> bool_func; - - /// \brief if this is the a numeric term, this is it - public: - std::function<double(const xAOD::IParticle& p)> float_func; - - /// \brief if this term is a logic operation, this is it - /// - /// This is used to make sure that I do not mix and(&&) and - /// or(or) without the use of parenthesis, as it can be - /// confusing to the user. - public: - LogicOp logicOp = LogicOp::NONE; - - public: - operator bool () const {return bool_func || float_func;} - }; - - /// \brief standard output operator for \ref Term - std::ostream& operator << (std::ostream& str, Term obj) - { - if (obj.bool_func) - str << "bool"; - else if (obj.float_func) - str << "float"; - else - str << "null"; - switch (obj.logicOp) - { - case LogicOp::NONE: - break; - case LogicOp::AND: - str << "(and)"; - break; - case LogicOp::OR: - str << "(or)"; - break; - } - return str; - } - - - - /// \todo needs documentation - enum class Precedence - { - CORE, - COMPARE, - AND_OR, - ALL - }; - - /// \brief standard output operator for \ref Precedence - std::ostream& operator << (std::ostream& str, Precedence obj) - { - switch (obj) - { - case Precedence::CORE: - str << "core"; - break; - case Precedence::COMPARE: - str << "compare"; - break; - case Precedence::AND_OR: - str << "and_or"; - break; - case Precedence::ALL: - str << "all"; - break; - } - return str; - } - - - - struct RecurseLevel final - { - RecurseLevel () {++ m_level;} - ~RecurseLevel () {-- m_level;} - - RecurseLevel (const RecurseLevel&) = delete; - RecurseLevel& operator = (const RecurseLevel&) = delete; - - unsigned level () const { - return m_level;} - - private: - static unsigned m_level; - }; - unsigned RecurseLevel::m_level = 0; - - std::ostream& operator << (std::ostream& str, const RecurseLevel& obj) - { - for (unsigned iter = 0, end = obj.level(); iter != end; ++ iter) - str << " "; - return str; - } - - - - /// \brief parse the next/remaining terms in the formula - /// - /// The formula is parsed via recursion, on token at a time, - /// i.e. after one token is parsed this function gets called again - /// to parse the remaining tokens. There isn't any read-ahead, - /// instead how the next token gets handled is dependent on the - /// current parser state (as determined by the arguments). - /// - /// The way binary expressions (e.g. "a>b") are handled is that - /// first the token "a" will be parsed, then the parser gets - /// called recursively with "a" as the already parsed term - /// (preterm). It will then encounter the token ">" realize that - /// it is a binary expression and recurse once more to parse "b". - /// For that second recursion it will not set a preterm and set - /// the precedence to indicate that only stronger expressions than - /// ">" may be evaluated (e.g. it would end when encountering - /// "&&"). Once that second recursion returns that term("b") is - /// combined with the preterm("a") to form a logic term("a>b"). - /// This is then passed as a preterm into the next level of the - /// recursion. - /// - /// \param[in] preterm the last term evaluated. this is to form - /// binary expressions as explained above - /// - /// \param[in,out] formula the remaining formula to evaluate. as - /// we parse tokens they get removed from the beginning of the - /// formula - /// - /// \param[in] precedence the maximum precedence to which to - /// evaluate the next term. this is needed to handle nested binary - /// expressions like "a>b&&c>d" correctly, as explained above - - Term parse (const Term& preterm, std::string& formula, - Precedence precedence) - { - RecurseLevel recurse; - - using namespace msgKinSelect; - ANA_MSG_DEBUG (recurse << "begin,preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - - while (!formula.empty() && isspace (formula[0])) - formula = formula.substr (1); - if (formula.empty()) - { - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return preterm; - } - Term result; - - if (formula[0] == '(') - { - formula = formula.substr (1); - ANA_MSG_DEBUG (recurse << "middle" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - result = parse (Term (), formula, Precedence::ALL); - if (formula.empty() || formula[0] != ')') - throw std::runtime_error ("expected to find token ')'"); - formula = formula.substr (1); - result.logicOp = LogicOp::NONE; - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return parse (result, formula, precedence); - } - { - std::istringstream str (formula); - double number = 0; - if (str >> number) - { - if (preterm) - throw std::runtime_error ("invalid token"); - result.float_func = [number] (const xAOD::IParticle& /*p*/) {return number;}; - formula = formula.substr (formula.size() - str.rdbuf()->in_avail()); - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return parse (result, formula, precedence); - } - } - if (formula.find ("pt") == 0) - { - if (preterm) - throw std::runtime_error ("invalid token"); - result.float_func = [] (const xAOD::IParticle& p) {return p.pt();}; - formula = formula.substr (2); - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return parse (result, formula, precedence); - } - if (formula.find ("eta") == 0) - { - if (preterm) - throw std::runtime_error ("invalid token"); - result.float_func = [] (const xAOD::IParticle& p) {return p.eta();}; - formula = formula.substr (3); - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return parse (result, formula, precedence); - } - if (formula.find ("phi") == 0) - { - if (preterm) - throw std::runtime_error ("invalid token"); - result.float_func = [] (const xAOD::IParticle& p) {return p.phi();}; - formula = formula.substr (3); - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return parse (result, formula, precedence); - } - - if (precedence <= Precedence::COMPARE) - { - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return preterm; - } - if (formula.find (">") == 0) - { - if (!preterm.float_func) - throw std::runtime_error ("need float argument to comparison"); - formula = formula.substr (1); - - ANA_MSG_DEBUG (recurse << "middle" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - Term postterm = parse (Term (), formula, Precedence::COMPARE); - if (!postterm.float_func) - throw std::runtime_error ("need float argument to comparison"); - - auto left = preterm.float_func; - auto right = postterm.float_func; - result.bool_func = [left, right] (const xAOD::IParticle& p) {return left (p) > right (p);}; - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return parse (result, formula, precedence); - } - if (formula.find ("<") == 0) - { - if (!preterm.float_func) - throw std::runtime_error ("need float argument to comparison"); - formula = formula.substr (1); - - ANA_MSG_DEBUG (recurse << "middle" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - Term postterm = parse (Term (), formula, Precedence::COMPARE); - if (!postterm.float_func) - throw std::runtime_error ("need float argument to comparison"); - - auto left = preterm.float_func; - auto right = postterm.float_func; - result.bool_func = [left, right] (const xAOD::IParticle& p) {return left (p) < right (p);}; - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return parse (result, formula, precedence); - } - - if (precedence <= Precedence::AND_OR) - { - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return preterm; - } - if (formula.find ("&&") == 0) - { - if (!preterm.bool_func) - throw std::runtime_error ("need bool argument to logic operator"); - if (preterm.logicOp != LogicOp::NONE && - preterm.logicOp != LogicOp::AND) - throw std::runtime_error ("can't mix different logic operators without paranthesis"); - formula = formula.substr (2); - - ANA_MSG_DEBUG (recurse << "middle" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - Term postterm = parse (Term (), formula, Precedence::AND_OR); - if (!postterm.bool_func) - throw std::runtime_error ("need bool argument to comparison"); - - auto left = preterm.bool_func; - auto right = postterm.bool_func; - result.bool_func = [left, right] (const xAOD::IParticle& p) {return left (p) && right (p);}; - result.logicOp = LogicOp::AND; - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return parse (result, formula, precedence); - } - if (formula.find ("||") == 0) - { - if (!preterm.bool_func) - throw std::runtime_error ("need bool argument to logic operator"); - if (preterm.logicOp != LogicOp::NONE && - preterm.logicOp != LogicOp::OR) - throw std::runtime_error ("can't mix different logic operators without paranthesis"); - formula = formula.substr (2); - - ANA_MSG_DEBUG (recurse << "middle" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - Term postterm = parse (Term (), formula, Precedence::AND_OR); - if (!postterm.bool_func) - throw std::runtime_error ("need bool argument to comparison"); - - auto left = preterm.bool_func; - auto right = postterm.bool_func; - result.bool_func = [left, right] (const xAOD::IParticle& p) {return left (p) || right (p);}; - result.logicOp = LogicOp::OR; - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return parse (result, formula, precedence); - } - - ANA_MSG_DEBUG (recurse << "end" << __LINE__ << ",preterm=" << preterm << ",formula=" << formula << ",precendence=" << precedence); - return preterm; - } - } - - - - KinObjectSelect :: - KinObjectSelect (const std::string& formula) - { - std::string myformula = formula; - try - { - Term term = parse (Term (), myformula, Precedence::ALL); - if (!myformula.empty()) - throw std::runtime_error ("extra text at end of formula"); - if (!term.bool_func) - throw std::runtime_error ("didn't find boolean expression"); - m_function = term.bool_func; - } catch (std::exception& e) - { - throw std::runtime_error ("failed parsing \"" + - formula.substr (0, formula.size() - myformula.size()) + - "\" \"" + myformula + "\": " + e.what()); - } - } - - - - bool KinObjectSelect :: - select (const xAOD::IParticle& particle) const - { - return m_function (particle); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/KinSelectTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/KinSelectTool.cxx deleted file mode 100644 index 64c8be5f8bef411f30639bbb96d2a998c57580de..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/KinSelectTool.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/KinSelectTool.h> - -#include <QuickAna/IEventObjects.h> -#include <QuickAna/KinObjectSelect.h> - -// -// method implementations -// - -namespace ana -{ - KinSelectTool :: - KinSelectTool (const std::string& name) - : AsgTool (name), AnaTool (name) - {} - - - - KinSelectTool :: - ~KinSelectTool () - {} - - - - StatusCode KinSelectTool :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - m_objectType = type; - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point in event info tool"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - StatusCode KinSelectTool :: - initialize() - { - try - { - m_selectObject.reset (new KinObjectSelect (m_selection)); - } catch (std::exception& e) - { - ATH_MSG_ERROR ("failed to parse format \"" << m_selection << "\": " << e.what()); - return StatusCode::FAILURE; - } - m_selectionData.registerCut (SelectionStep::MET, "kin_select", cut_kin_select); - return StatusCode::SUCCESS; - } - - - - StatusCode KinSelectTool :: - useConfiguration (const InternalConfiguration& configuration) - { - ATH_CHECK (AnaTool::useConfiguration (configuration)); - ATH_CHECK (m_selectionData.initialize (configuration, "")); - return StatusCode::SUCCESS; - } - - - - AnalysisStep KinSelectTool :: - step () const - { - return STEP_KINSELECT; - } - - - - unsigned KinSelectTool :: - inputTypes () const - { - return 1 << m_objectType; - } - - - - unsigned KinSelectTool :: - outputTypes () const - { - return 1 << m_objectType; - } - - - - StatusCode KinSelectTool :: - execute (IEventObjects& objects) - { - xAOD::IParticleContainer *container = objects.getParticles (m_objectType); - if (container == 0) - { - ATH_MSG_ERROR ("object type not defined in configuration"); - return StatusCode::FAILURE; - } - - for (auto object : *container) - { - ATH_CHECK (m_selectionData.prepare (object)); - if (m_selectionData.needSelectionTool()) - cut_kin_select.setPassedIf (m_selectObject->select (*object)); - m_selectionData.apply (); - } - return StatusCode::SUCCESS; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/LegacyORTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/LegacyORTool.cxx deleted file mode 100644 index 68d607b8553b1f0c130933b9f58d147ed6a61425..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/LegacyORTool.cxx +++ /dev/null @@ -1,245 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// includes -// - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#include <QuickAna/LegacyORTool.h> - -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/TopOverlapRemovalTool.h> - -// -// method implementations -// - -namespace ana -{ - LegacyORTool :: - LegacyORTool (const std::string& name) - : AsgTool (name), AnaTool (name), - m_ortool ("OverlapRemovalTool", this) - { - declareProperty("ORInputLabel", m_orInputLabel = "dummy"); - declareProperty("OROutputLabel", m_orOutputLabel = "dummy"); - - declareProperty("OR_Type", m_or_type = Default); - } - - - - StatusCode LegacyORTool :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - if (type != OBJECT_OVERLAP_REMOVAL) - { - ATH_MSG_ERROR ("unsupported object type"); - return StatusCode::FAILURE; - } - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point for overlap removal tool"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - StatusCode LegacyORTool :: - initialize() - { - if (m_or_type==run1_SSbjets || m_or_type==run1_top_default) - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_ortool, TopOverlapRemovalTool)); - ATH_CHECK (m_ortool.setProperty("MuORJetVariDR", false)); - - if (m_or_type==run1_SSbjets){ - ATH_CHECK (m_ortool.setProperty("MuORJetVariDR", true)); - ATH_CHECK (m_ortool.setProperty("MuonJetDRConeEtaPhi", 0.04)); - } - } - else - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_ortool, OverlapRemovalTool)); - } - ATH_CHECK (m_ortool.setProperty("InputLabel", m_orInputLabel)); - ATH_CHECK (m_ortool.initialize()); - // Not a systematics tool - //registerTool (&*m_ortool); - - return StatusCode::SUCCESS; - } - - - - AnalysisStep LegacyORTool :: - step () const - { - return STEP_OVERLAP_REMOVAL; - } - - - - unsigned LegacyORTool :: - inputTypes () const - { - return (1 << OBJECT_ELECTRON) | (1 << OBJECT_MUON) | (1 << OBJECT_JET) | - (1 << OBJECT_TAU) | (1 << OBJECT_PHOTON); - } - - - - unsigned LegacyORTool :: - outputTypes () const - { - return (1 << OBJECT_ELECTRON) | (1 << OBJECT_MUON) | (1 << OBJECT_JET) | - (1 << OBJECT_TAU) | (1 << OBJECT_PHOTON); - } - - - - StatusCode LegacyORTool :: - execute (IEventObjects& objects) - { - if (m_or_type==run1_top_default) { - if (objects.muons() && objects.jets()) - { - ATH_CHECK ( m_ortool->removeMuonJetOverlap(*objects.muons(), *objects.jets()) ); - } - if (objects.electrons() && objects.jets()) - { - ATH_CHECK ( m_ortool->removeEleJetOverlap(*objects.electrons(), *objects.jets()) ); - } - } - else if (m_or_type==run1_susy_default){ - // Very specific order... - if (objects.electrons() && objects.jets()) - { - ATH_CHECK( m_ortool->removeEleJetOverlap(*objects.electrons(), *objects.jets()) ); - } - if (objects.muons() && objects.jets()) - { - ATH_CHECK( m_ortool->removeMuonJetOverlap(*objects.muons(), *objects.jets()) ); - } - if (objects.electrons() && objects.muons()) - { - ATH_CHECK( m_ortool->removeEleMuonOverlap(*objects.electrons(), *objects.muons()) ); - } - if (objects.photons()) { - if (objects.electrons()){ - ATH_CHECK( m_ortool->removePhotonEleOverlap(*objects.photons(), *objects.electrons()) ); - } - if (objects.jets()) { - ATH_CHECK( m_ortool->removePhotonJetOverlap(*objects.photons(), *objects.jets()) ); - } - } - } - else { - ATH_CHECK ( m_ortool->removeOverlaps(objects.electrons(), objects.muons(), - objects.jets(), objects.taus(), - objects.photons()) ); - } - - // - // if "overlaps" is 1, set selection flag to 0 - // - - SG::AuxElement::Accessor<SelectType> selectAcc(m_orOutputLabel); - SG::AuxElement::ConstAccessor<SelectType> overlapAcc("overlaps"); - - // electrons - if (objects.electrons()) { - for(auto electron : *(objects.electrons())) { - if (overlapAcc(*electron)) selectAcc(*electron) = false; - } - } - - // muons - if (objects.muons()) { - for(auto muon : *(objects.muons())) { - if (overlapAcc(*muon)) selectAcc(*muon) = false; - } - } - - // jets - if (objects.jets()) { - for(auto jet : *(objects.jets())) { - if (overlapAcc(*jet)) selectAcc(*jet) = false; - } - } - - // taus - if (objects.taus()) { - for(auto tau : *(objects.taus())) { - if (overlapAcc(*tau)) selectAcc(*tau) = false; - } - } - - // photons - if (objects.photons()) { - for(auto photon : *(objects.photons())) { - if (overlapAcc(*photon)) selectAcc(*photon) = false; - } - } - - return StatusCode::SUCCESS; - } - - - // Print object information - // TODO: Either remove this or fix it to use proper tool functionality - // like ATH_MSG logging, StatusCode, etc. - void LegacyORTool :: - printObj (const char* APP_NAME, const char* type, const xAOD::IParticle* obj) const - { - static SG::AuxElement::ConstAccessor<SelectType> selectAcc(m_orOutputLabel); - static SG::AuxElement::ConstAccessor<SelectType> overlapAcc("overlaps"); - - // Safety check - // TODO: should use StatusCode here - if(!overlapAcc.isAvailable(*obj)){ - Error(APP_NAME, "Overlap decoration missing for object"); - abort(); - } - - Info(APP_NAME, " %s pt %6.2f eta %5.2f phi %5.2f selected %i overlaps %i", - type, obj->pt()/1000., obj->eta(), obj->phi(), - selectAcc(*obj), overlapAcc(*obj)); - } - - - - StatusCode makeORTool (DefinitionArgs& args, - LegacyORTool::OR_Type or_type) - { - using namespace ana::msgObjectDefinition; - - std::unique_ptr<LegacyORTool> orTool - ( new LegacyORTool(args.prefix()) ); - ANA_CHECK( orTool->setProperty("OR_Type", int (or_type)) ); - ANA_CHECK( orTool->setProperty - ("ORInputLabel", args.configuration()->selectionName(SelectionStep::OR))); - ANA_CHECK( orTool->setProperty - ("OROutputLabel", args.configuration()->selectionName(SelectionStep::ANALYSIS))); - args.add( std::move(orTool) ); - - return StatusCode::SUCCESS; - } - - QUICK_ANA_OR_DEFINITION_MAKER ("legacy", makeORTool (args, LegacyORTool::Default)) - QUICK_ANA_OR_DEFINITION_MAKER ("run1_top_default", makeORTool (args, LegacyORTool::run1_top_default)) - QUICK_ANA_OR_DEFINITION_MAKER ("run1_SSbjets", makeORTool (args, LegacyORTool::run1_SSbjets)) - QUICK_ANA_OR_DEFINITION_MAKER ("run1_susy_default", makeORTool (args, LegacyORTool::run1_susy_default)) - -} // namespace ana - -#pragma GCC diagnostic pop diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/LinkDef.h b/PhysicsAnalysis/TopPhys/QuickAna/Root/LinkDef.h deleted file mode 100644 index dde8d64731e8515d733ffd485d1476fb9a1355a6..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/LinkDef.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <QuickAna/Global.h> - -#include <QuickAna/Configuration.h> -#include <QuickAna/ELExample.h> -#include <QuickAna/QuickAna.h> -#include <QuickAna/ValidationEL.h> -#include <QuickAna/xAODTruth.h> - -#ifdef __CINT__ - -#pragma link off all globals; -#pragma link off all classes; -#pragma link off all functions; -#pragma link C++ nestedclass; - -#pragma link C++ class ana::Configuration+; -#pragma link C++ class ana::ELExample+; -#pragma link C++ class ana::QuickAna+; -#pragma link C++ class ana::ValidationEL+; - -#pragma link C++ function ana::getCTruth (StoreType&, const std::string&, bool); -#ifdef ROOTCORE -#pragma link C++ function ana::getCTruth (xAOD::TEvent&, const std::string&, bool); -#endif -#pragma link C++ function ana::getCTruth (asg::AsgTool&, const std::string&, bool allowNull); -#ifdef ROOTCORE -#pragma link C++ function ana::getCTruth (const std::string&, bool allowNull); -#endif - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/MasterOutputToolXAOD.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/MasterOutputToolXAOD.cxx deleted file mode 100644 index bbd4fdda682184761225a096cc7128c604609d31..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/MasterOutputToolXAOD.cxx +++ /dev/null @@ -1,121 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// Shouldn't be used in Athena -#ifdef ROOTCORE - -// EDM includes -#include "xAODMissingET/MissingETAuxContainer.h" - -// Local includes -#include "QuickAna/MasterOutputToolXAOD.h" -#include "QuickAna/ObjectTypeInfo.h" -#include "QuickAna/OutputToolXAOD.h" - -namespace ana -{ - - //--------------------------------------------------------------------------- - // Constructor - //--------------------------------------------------------------------------- - MasterOutputToolXAOD::MasterOutputToolXAOD(const std::string& name) - : asg::AsgTool(name) - { - declareProperty("EventData", m_eventData, "Analysis objects metadata"); - declareProperty("OutputTypes", m_outputTypes, - "List of object types to write out. Defaults to all available"); - } - - //--------------------------------------------------------------------------- - // Initialize - //--------------------------------------------------------------------------- - StatusCode MasterOutputToolXAOD::initialize() - { - // Determine the types to write out. If the requested list is empty, - // we take all available types from the EventData. - auto outputTypes = m_outputTypes; - if(outputTypes.empty()) { - auto availTypes = m_eventData.getObjectTypes(); - outputTypes.assign( availTypes.begin(), availTypes.end() ); - } - - // Create and configure an output tool for each object type - for(auto objType : outputTypes) { - auto objName = ObjectTypeInfo::name[objType]; - ATH_MSG_INFO("Setting up output tool for ObjectType " << objName); - - // Create a output tool handle - m_outputTools.emplace_back(name() + "_" + objName, this); - auto& handle = m_outputTools.back(); - - // Create the output tool. For now, use a local mapping - // of ObjectType to actual container types. - if(objType == OBJECT_EVENTINFO) { - using ToolType_t = OutputToolXAOD<xAOD::EventInfo, xAOD::ShallowAuxInfo>; - ATH_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType_t) ); - } - else if(objType == OBJECT_EVENT_SELECT) { - using ToolType_t = OutputToolXAOD<EventSelectType, xAOD::ShallowAuxInfo>; - ATH_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType_t) ); - } - else if(objType == OBJECT_ELECTRON) { - using ToolType_t = OutputToolXAOD<xAOD::ElectronContainer, xAOD::ShallowAuxContainer>; - ATH_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType_t) ); - } - else if(objType == OBJECT_MUON) { - using ToolType_t = OutputToolXAOD<xAOD::MuonContainer, xAOD::ShallowAuxContainer>; - ATH_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType_t) ); - } - else if(objType == OBJECT_TAU) { - using ToolType_t = OutputToolXAOD<xAOD::TauJetContainer, xAOD::ShallowAuxContainer>; - ATH_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType_t) ); - } - else if(objType == OBJECT_JET) { - using ToolType_t = OutputToolXAOD<xAOD::JetContainer, xAOD::ShallowAuxContainer>; - ATH_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType_t) ); - } - else if(objType == OBJECT_PHOTON) { - using ToolType_t = OutputToolXAOD<xAOD::PhotonContainer, xAOD::ShallowAuxContainer>; - ATH_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType_t) ); - } - else if(objType == OBJECT_MET) { - using ToolType_t = OutputToolXAOD<xAOD::MissingETContainer, xAOD::MissingETAuxContainer>; - ATH_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType_t) ); - } - else if(objType == OBJECT_MET2) { - using ToolType_t = OutputToolXAOD<xAOD::MissingETContainer, xAOD::MissingETAuxContainer>; - ATH_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType_t) ); - } - else { - ATH_MSG_ERROR("Unsupported object type: " << objName); - m_outputTools.pop_back(); - return StatusCode::FAILURE; - } - - // Configure the output tool with the EventData - auto copyConts = m_eventData.getSourceNames(objType); - auto writeConts = m_eventData.getNames(objType); - ATH_CHECK( handle.setProperty("CopyContainerNames", copyConts) ); - ATH_CHECK( handle.setProperty("WriteContainerNames", writeConts) ); - ATH_CHECK( handle.initialize() ); - } - - return StatusCode::SUCCESS; - } - - //--------------------------------------------------------------------------- - // Execute the output writing - //--------------------------------------------------------------------------- - StatusCode MasterOutputToolXAOD::write() - { - // Loop over the tools and call them - for(auto& tool : m_outputTools) { - ATH_CHECK( tool->write() ); - } - return StatusCode::SUCCESS; - } - -} // namespace ana - -#endif // ROOTCORE diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/MessageCheck.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/MessageCheck.cxx deleted file mode 100644 index 64d489a6b2fb61b3048e531c1e431dd35eb05654..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/MessageCheck.cxx +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/MessageCheck.h> - -#include <PATInterfaces/CorrectionCode.h> -#include <PATInterfaces/SystematicCode.h> - -// -// method implementations -// - -namespace ana -{ - ANA_MSG_SOURCE (msgToolHandle, "QuickAna_AnaToolHandle") - ANA_MSG_SOURCE (msgConfiguration, "QuickAna_Configuration") - ANA_MSG_SOURCE (msgIsolationTools, "QuickAna_IsolationTools") - ANA_MSG_SOURCE (msgStore, "QuickAna_Store") - ANA_MSG_SOURCE (msgScheduler, "QuickAna_Scheduler") - ANA_MSG_SOURCE (msgSelection, "QuickAna_Selection") - ANA_MSG_SOURCE (msgObjectDefinition, "QuickAna_ObjectDefinition") - ANA_MSG_SOURCE (msgKinSelect, "QuickAna_KinSelect") - ANA_MSG_SOURCE (msgUserCode, "QuickAna_UserCode") - - void enableStatusCodeFailure () - { -#ifdef ROOTCORE - xAOD::TReturnCode::enableFailure(); - StatusCode::enableFailure(); -#endif - CP::SystematicCode::enableFailure(); - CP::CorrectionCode::enableFailure(); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/MetTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/MetTool.cxx deleted file mode 100644 index 7c775f94a508c9974a9553ff43ff1ce2554d28c5..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/MetTool.cxx +++ /dev/null @@ -1,401 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// An overview of MC15 recommendations from the following talk and note: -// https://indico.cern.ch/event/330375/session/5/contribution/25/material/slides/0.pdf -// https://cds.cern.ch/record/2013489/files/ATL-COM-PHYS-2015-347.pdf -// Note the difference between track-based soft term and track-based MET. -// (The latter uses tracks instead of jets for building MET.) -// Technical details and some examples from: -// https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/METUtilities -// -// Current recommendations described on these pages: -// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/JetEtmissRecommendationsMC15 -// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EtmissSubgroup#Current_recommendations -// Moriod 2016 recommendations: -// https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EtmissRecommendationsMoriond2016 - -// -// includes -// - -#include <QuickAna/MetTool.h> - -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> -#include <RootCoreUtils/Assert.h> - -#include <METUtilities/METMaker.h> -#include <METInterface/IMETSystematicsTool.h> -#ifdef ROOTCORE -#include <METUtilities/METSystematicsTool.h> -#endif -#include <METUtilities/METHelpers.h> - -// For the fJVT working point -#include <JetMomentTools/JetForwardJvtTool.h> - -static const float GeV = 1000.; - -// -// method implementations -// - -namespace ana -{ - MetTool :: - MetTool (const std::string& name) - : AsgTool (name), AnaTool (name), - m_doFJVT(false), - m_metutil ("maker", this), - m_metSystTool ("systTool", this), - m_fjvtTool ("fjvtTool", this), - m_accessor ("dummy") - { - // Note: these are only used with METMaker - declareProperty("IncludeTauTerm", m_includeTauTerm=true); - declareProperty("DoTST", m_doTST=true); - declareProperty("DoJVTCut", m_doJVTCut=true); - declareProperty("DoTrackMet", m_doTrackMET=false); - declareProperty("DoSetMuonJetEMScale", m_doMuJetEMScale=false); - declareProperty("JetSelection", m_jetSelection="Default"); - declareProperty("ORCaloTaggedMuons", m_doORCaloTaggedMuons=true); - declareProperty("JetUniqueFrac", m_uniqueFrac=-1.); - declareProperty("JetUniqueCut", m_jetCut=-1.); - } - - - - StatusCode MetTool :: - setObjectType (ObjectType type, const std::string& workingPoint) - { - if (type != OBJECT_MET && type != OBJECT_MET2) - { - ATH_MSG_ERROR ("unsupported object type"); - return StatusCode::FAILURE; - } - m_type = type; - - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point for met tool"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - AnalysisStep MetTool :: - step () const - { - return STEP_MET; - } - - - - unsigned MetTool :: - inputTypes () const - { - return (1 << OBJECT_ELECTRON) | (1 << OBJECT_PHOTON) | (1 << OBJECT_TAU) | - (1 << OBJECT_MUON) | (1 << OBJECT_JET); - } - - - - unsigned MetTool :: - outputTypes () const - { - return 1 << m_type; - } - - - - StatusCode MetTool :: - useInitialConfiguration (const InternalConfiguration& conf) - { - ATH_CHECK (AnaTool::useInitialConfiguration (conf)); - - m_isData = conf.isData(); - m_isAF2 = conf.isAFII(); - m_jetContainer = conf.inputName (OBJECT_JET); - if (m_jetContainer.empty()) - { - ATH_MSG_ERROR ("can't use MET without jets"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - StatusCode MetTool :: - initialize() - { - // Initialize the MET maker. Config from: - // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EtmissRecommendationsMoriond2016 - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_metutil, met::METMaker) ); - ATH_CHECK( m_metutil.setProperty("ORCaloTaggedMuons", m_doORCaloTaggedMuons) ); - ATH_CHECK( m_metutil.setProperty("DoSetMuonJetEMScale", m_doMuJetEMScale) ); - - if (m_jetSelection!="passFJVT"){ - ATH_CHECK( m_metutil.setProperty("JetSelection", m_jetSelection) ); - } else { - // Special forward JVT working point - requires the forward JVT tool to be enabled! - m_doFJVT = true; - ATH_CHECK( m_metutil.setProperty("JetRejectionDec", m_jetSelection) ); - ATH_CHECK( ASG_MAKE_ANA_TOOL( m_fjvtTool, JetForwardJvtTool) ); - ATH_CHECK( m_fjvtTool.setProperty("CentralMaxPt",60e3) ); - } - - if (m_uniqueFrac>=0.) ATH_CHECK( m_metutil.setProperty("JetMinEFrac", m_uniqueFrac) ); - if (m_jetCut>=0.) ATH_CHECK( m_metutil.setProperty("JetMinWeightedPt", m_jetCut) ); - if (!m_doTST) - { - ATH_CHECK( m_metutil.setProperty("DoIsolMuonEloss",true) ); - ATH_CHECK( m_metutil.setProperty("DoMuonEloss",true) ); - if (m_doJVTCut) - { - ATH_MSG_WARNING("Running with CST, but JVT cut was set to true. Will change JVT setting; please check your configuration."); - m_doJVTCut = false; - } - if ("AntiKt4EMTopoJets"==m_jetContainer) - { - // Recommendation from TJ: if we are using EM topo jets, make sure the clusters are considered at LC scale - ATH_CHECK( m_metutil.setProperty("JetConstitScaleMom","JetLCScaleMomentum") ); - } - } - ATH_CHECK( m_metutil.initialize() ); - - if (m_isData == false) - { - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_metSystTool, met::METSystematicsTool) ); - RCU_ASSERT( !m_jetContainer.empty() ); - - // Empty if we are using the calo soft term - if (!m_doTST) ATH_CHECK( m_metSystTool.setProperty("ConfigSoftTrkFile","") ); - // No calo soft term systematics recommendations, so an empty string for now - if (m_doTST) ATH_CHECK( m_metSystTool.setProperty("ConfigSoftCaloFile", "") ); - if (m_doTrackMET) ATH_CHECK( m_metSystTool.setProperty("ConfigJetTrkFile","JetTrackSyst.config") ); - // No other non-default settings - ATH_CHECK( m_metSystTool.initialize() ); - registerTool(&*m_metSystTool); - } - - return StatusCode::SUCCESS; - } - - - - StatusCode MetTool :: - useConfiguration (const InternalConfiguration& configuration) - { - ATH_CHECK (AnaTool::useConfiguration (configuration)); - m_accessor = configuration.selectionName (SelectionStep::MET); - return StatusCode::SUCCESS; - } - - - - StatusCode MetTool :: - execute (IEventObjects& objects) - { - // Create a new, empty MET container to be filled by the METRebuilder - ATH_CHECK (objects.addNew (m_type)); - - auto met = objects.get<xAOD::MissingETContainer> (m_type); - - // Retrieve the container of object weights. These were filled during - // reconstruction and will be used to recalculate the MET with our - // calibrated objects. - const xAOD::MissingETContainer* metcore(0); - std::string coreContainer = "MET_Core_" + m_jetContainer; - if (coreContainer.rfind ("Jets") == coreContainer.size()-4) - coreContainer = coreContainer.substr (0, coreContainer.size()-4); - - ANA_CHECK( evtStore()->retrieve(metcore, coreContainer) ); - - const xAOD::MissingETAssociationMap* metMap = 0; - std::string assocContainer = "METAssoc_" + m_jetContainer; - if (assocContainer.rfind ("Jets") == assocContainer.size()-4) - assocContainer = assocContainer.substr (0, assocContainer.size()-4); - ANA_CHECK (evtStore()->retrieve(metMap, assocContainer)); - - metMap->resetObjSelectionFlags(); - - // Setup ghost association for mu-jet OR - //if(m_doMuJetOR || m_doMuJetEMScale) { - if(m_doORCaloTaggedMuons || m_doMuJetEMScale) { - if(!objects.muons() || !objects.jets()) { - ATH_MSG_ERROR("Configured mu-jet OR for MET but container(s) NULL!"); - return StatusCode::FAILURE; - } - met::addGhostMuonsToJets( *objects.muons(), *objects.jets() ); - } - - // TODO: remove hardcoded options and strings - - std::string softTerm = "SoftClus"; - if (m_doTST) - { - softTerm = "PVSoftTrk"; - } - - // Rebuild electron term - if (objects.electrons()) - { - xAOD::ElectronContainer metelectrons(SG::VIEW_ELEMENTS); - for (auto el : *objects.electrons()) - { - if (m_accessor (*el)) - { - metelectrons.push_back(el); - } - } - - ATH_CHECK (m_metutil->rebuildMET("RefEle", xAOD::Type::Electron, met, - &metelectrons, metMap)); - } - - // Rebuild photon term - if (objects.photons()) - { - xAOD::PhotonContainer metphotons(SG::VIEW_ELEMENTS); - for (auto ph : *objects.photons()) - { - if (m_accessor (*ph)) - { - metphotons.push_back(ph); - } - } - - ATH_CHECK (m_metutil->rebuildMET("RefGamma", xAOD::Type::Photon, met, - &metphotons, metMap)); - } - - // Rebuild tau term - if (m_includeTauTerm && objects.taus()) - { - xAOD::TauJetContainer mettaus(SG::VIEW_ELEMENTS); - for (auto tau : *objects.taus()) - { - if (m_accessor (*tau)) - { - mettaus.push_back(tau); - } - } - - ATH_CHECK (m_metutil->rebuildMET("RefTau", xAOD::Type::Tau, met, - &mettaus, metMap)); - } - - // Rebuild muon term - if (objects.muons()) - { - xAOD::MuonContainer metmuons(SG::VIEW_ELEMENTS); - for (auto mu : *objects.muons()) - { - if (m_accessor (*mu)) - { - metmuons.push_back(mu); - } - } - - ATH_CHECK (m_metutil->rebuildMET("RefMuon", xAOD::Type::Muon, met, - &metmuons, metMap)); - } - - // Rebuild jet and soft term - if (!objects.jets()) - { - ATH_MSG_WARNING("Invalid jet container specified for MET rebuilding!"); - return StatusCode::SUCCESS; - } else if (m_doFJVT) { - // Make sure for forward jet working point we apply the fJVT tool - // This always returns zero, so no need for value checking right now - m_fjvtTool->modify( *objects.jets() ); - } - - if (m_doTrackMET) - { - ATH_CHECK (m_metutil->rebuildTrackMET("RefJet", softTerm, met, objects.jets(), - metcore, metMap, m_doJVTCut)); - } else - { - ATH_CHECK (m_metutil->rebuildJetMET("RefJet", softTerm, met, objects.jets(), - metcore, metMap, m_doJVTCut)); - } - - if (m_isData == false) - { - if ( m_metSystTool->applyCorrection( *(*met)[softTerm] ) != - CP::CorrectionCode::Ok ) - { - ATH_MSG_WARNING("GetMET: Failed to apply MET soft term systematics."); - } - } - - ATH_CHECK( m_metutil->buildMETSum("Final", met, (*met)[softTerm]->source()) ); - - return StatusCode::SUCCESS; - } - - - - // Function for instantiating a MetTool - StatusCode makeMetTool (DefinitionArgs& args, - const bool includeTauTerm=true, - const bool doTST=true, - const bool doJVTCut=true, - const bool doTrackMet=false, - const bool doORCaloTaggedMuons=true, - const bool doMuJetEMScale=false, - const std::string& jetSelection="Default", - const double uniqueFrac=-1., - const double jetCut=-1.) - { - using namespace msgObjectDefinition; - - std::unique_ptr<MetTool> metTool - (new MetTool (args.prefix())); - ANA_CHECK( metTool->setProperty("IncludeTauTerm", includeTauTerm) ); - ANA_CHECK( metTool->setProperty("DoTST", doTST) ); - ANA_CHECK( metTool->setProperty("DoJVTCut", doJVTCut) ); - ANA_CHECK( metTool->setProperty("DoTrackMet", doTrackMet) ); - ANA_CHECK( metTool->setProperty("ORCaloTaggedMuons", doORCaloTaggedMuons) ); - ANA_CHECK( metTool->setProperty("DoSetMuonJetEMScale", doMuJetEMScale) ); - ANA_CHECK( metTool->setProperty("JetSelection", jetSelection) ); - ANA_CHECK( metTool->setProperty("JetUniqueFrac", uniqueFrac) ); - ANA_CHECK( metTool->setProperty("JetUniqueCut", jetCut) ); - args.add ( std::move(metTool) ); - - return StatusCode::SUCCESS; - } - - // Macro for creating a MetTool using the provided function - QUICK_ANA_MET_DEFINITION_MAKER( "default", makeMetTool(args) ) - QUICK_ANA_MET_DEFINITION_MAKER( "noTauTerm", makeMetTool(args,false) ) - QUICK_ANA_MET_DEFINITION_MAKER( "trackmet", makeMetTool(args,true,true,true,true) ) - QUICK_ANA_MET_DEFINITION_MAKER( "susy2L", makeMetTool(args,true,true,true,false,true,true) ) - QUICK_ANA_MET_DEFINITION_MAKER( "metZHinv", makeMetTool(args,true,true,true,false,true,true) ) - QUICK_ANA_MET_DEFINITION_MAKER( "noTauCST", makeMetTool(args,false,false) ) - QUICK_ANA_MET_DEFINITION_MAKER( "CST", makeMetTool(args,true,false,false) ) - - QUICK_ANA_MET_DEFINITION_MAKER( "Tight", makeMetTool(args,true,true,true,false,true,false,"Tight") ) - QUICK_ANA_MET_DEFINITION_MAKER( "passFJVT", makeMetTool(args,true,true,true,false,true,false,"passFJVT") ) - -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/MuonTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/MuonTool.cxx deleted file mode 100644 index 2ab2f4bcfc49cba43bffa1f0ca2d01e39cd001e9..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/MuonTool.cxx +++ /dev/null @@ -1,491 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/MuonTool.h> - -#include <MuonEfficiencyCorrections/MuonEfficiencyScaleFactors.h> -#include <MuonMomentumCorrections/MuonCalibrationAndSmearingTool.h> -#include <MuonSelectorTools/MuonSelectionTool.h> -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> - -#include <xAODTracking/TrackParticle.h> - -#include <xAODTracking/TrackParticlexAODHelpers.h> -#include <EventPrimitives/EventPrimitivesHelpers.h> - -#include <IsolationSelection/IsolationSelectionTool.h> -#include "PileupReweighting/PileupReweightingTool.h" - -// -// method implementations -// - -namespace ana -{ - const float GeV = 1000.; - - MuonToolCorrect :: - MuonToolCorrect (const std::string& name) - : AsgTool (name), AnaToolCorrect<xAOD::MuonContainer> (name), - m_calib_smear ("MuonCalibrationAndSmearingTool", this) - { - } - - - - StatusCode MuonToolCorrect :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_calib_smear, CP::MuonCalibrationAndSmearingTool)); - // Take the default properties - ATH_CHECK (m_calib_smear.initialize()); - registerTool (&*m_calib_smear); - - registerCut (SelectionStep::MET, "calib_tool", cut_calib_tool); - - return StatusCode::SUCCESS; - } - - - - StatusCode MuonToolCorrect :: - correctObject (xAOD::Muon& muon) - { - ATH_MSG_DEBUG("correctObject"); - // Apply the CP calibration - QA_CHECK_CUT (cut_calib_tool, m_calib_smear->applyCorrection (muon)); - - return StatusCode::SUCCESS; - } - - - - MuonToolSelect :: - MuonToolSelect (const std::string& name) - : AsgTool (name), AnaToolSelect<xAOD::MuonContainer> (name), - m_quality (xAOD::Muon::Medium), - m_selection ("MuonSelectionTool", this), - m_isolationTool ("IsolationSelectionTool", this) - { - // declareProperty("Quality", m_quality); - - declareProperty( "IsolationOn", m_isolationOn = true ); - declareProperty( "IsolationWP", m_isolationWP = "Undefined", "Working point to use" ); - // The interface for adding "UserDefined" working points has changed - // -- for now supporting single standard working points only; - // will add other options when needed - declareProperty( "InclusiveMET", m_inclusiveMET = false ); - declareProperty( "LooseImpactCut", m_looseImpactCut = false ); - declareProperty( "HighPt", m_high_pT = -1. ); - declareProperty( "NoTRT" , m_noTRT=false , "Apply the TRT cut in selection?"); - declareProperty( "BadMuVeto", m_doBadMuVeto=false , "Apply the bad muon veto?"); - } - - - - StatusCode MuonToolSelect :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_selection, CP::MuonSelectionTool)); - ATH_CHECK (m_selection.setProperty ("MuQuality", int (m_quality))); - // In case we do not require TRT cuts in the derivation, this helps with PU stability - if (m_noTRT){ - ATH_CHECK (m_selection.setProperty ("TrtCutOff", true) ); - } - ATH_CHECK (m_selection.initialize()); - registerTool(&*m_selection); - - // high-pT working point - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_selectionHPT, CP::MuonSelectionTool)); - ATH_CHECK (m_selectionHPT.setProperty( "MaxEta", 2.5 ) ); - ATH_CHECK (m_selectionHPT.setProperty( "MuQuality", 4 ) ); - if (m_noTRT){ - ATH_CHECK (m_selectionHPT.setProperty ("TrtCutOff", true) ); - } - ATH_CHECK (m_selectionHPT.initialize() ); - // Only add systematics if we are using this thing to pick muons - if (m_high_pT>0.) registerTool(&*m_selectionHPT); - - // Initialize the isolation selection tool - if (m_isolationOn) - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_isolationTool, CP::IsolationSelectionTool)); - ATH_CHECK (m_isolationTool.setProperty("MuonWP", m_isolationWP)); - ATH_CHECK (m_isolationTool.initialize()); - registerTool(&*m_isolationTool); - } - - // Note: for now, use isolated objects (if isolation is applied) to build MET - - registerCut (SelectionStep::MET, "selection", cut_selection); - - if (!m_inclusiveMET) - { - registerCut (SelectionStep::MET, "d0", cut_d0); - registerCut (SelectionStep::MET, "z0", cut_z0); - - registerCut (SelectionStep::MET, "isolationTool", cut_isolationTool); - } - else - { - registerCut (SelectionStep::ANALYSIS, "d0", cut_d0); - registerCut (SelectionStep::ANALYSIS, "z0", cut_z0); - - registerCut (SelectionStep::ANALYSIS, "isolationTool", cut_isolationTool); - } - if (m_high_pT>0.) registerCut (SelectionStep::MET, "HighPt", cut_high_pT); - - return StatusCode::SUCCESS; - } - - - - StatusCode MuonToolSelect :: - selectObject (xAOD::Muon& muon) - { - ATH_MSG_DEBUG("selectObject"); - cut_selection.setPassedIf (m_selection->accept (muon)); - if (m_high_pT>0. && muon.pt()>m_high_pT){ - cut_selection.setPassedIf (m_selectionHPT->accept (muon)); - } else { - // Decorate for analyses to play - muon.auxdata<char>("high_pT") = m_selectionHPT->accept(muon); - } - - if (m_doBadMuVeto){ - cut_selection.setPassedIf (m_selection->accept (muon) && !m_selection->isBadMuon (muon)); - if (m_high_pT>0. && muon.pt()>m_high_pT){ - cut_selection.setPassedIf (m_selectionHPT->accept (muon) && !m_selectionHPT->isBadMuon (muon) && !m_selection->isBadMuon (muon)); - } - } - - if (muon.muonType() != xAOD::Muon::MuonStandAlone) - { - // Z0 and D0 requirements - const xAOD::TrackParticle *mutrk = muon.primaryTrackParticle(); - - // obtain primary vertex - const xAOD::Vertex *pv(0); - const xAOD::VertexContainer *vertexContainer(0); - ATH_CHECK( evtStore()->retrieve(vertexContainer, "PrimaryVertices" ) ); - for ( const auto* const vtx_itr : *vertexContainer ) - { - if (vtx_itr->vertexType() != xAOD::VxType::VertexType::PriVtx) continue; - else { pv = vtx_itr; break;} - } - - const xAOD::EventInfo* evt = 0; - ATH_CHECK( evtStore()->retrieve( evt, "EventInfo" ) ); - double mu_d0sig = -999; - if(mutrk && evt) - mu_d0sig = xAOD::TrackingHelpers::d0significance - ( mutrk, evt->beamPosSigmaX(), evt->beamPosSigmaY(), evt->beamPosSigmaXY() ); - - muon.auxdata<double>("d0Sig") = mutrk && pv ? mu_d0sig : -999; - muon.auxdata<double>("z0sintheta") = mutrk && pv ? (mutrk->z0() + mutrk->vz() - pv->z() ) * sin(mutrk->theta()) : -999; - - if (mutrk && pv) - { - // Cuts recommended by the tracking CP group - if(m_looseImpactCut){ - // looser cuts for fakes est - cut_d0.setPassedIf( 1 ); - cut_z0.setPassedIf( 1 ); - //muon.auxdata<double>("d0Sig") = mu_d0sig; - //muon.auxdata<double>("z0sintheta") = (mutrk->z0() + mutrk->vz() - pv->z() ) * sin(mutrk->theta()); - }else{ - // Cuts recommended by the tracking CP group - cut_d0.setPassedIf( fabs(mu_d0sig) < 3. ); - cut_z0.setPassedIf( fabs((mutrk->z0() + mutrk->vz() - pv->z() ) * sin(mutrk->theta())) < 0.5 ); - } - } - else - { - cut_d0.setPassedIf(false); - cut_z0.setPassedIf(false); - } - - // Extra is bad decoration based on SUSYTools muon isBad function - if (mutrk){ - float Rerr = Amg::error(mutrk->definingParametersCovMatrix(), 4) / fabs(mutrk->qOverP()); - muon.auxdecor<char>("badQoverPErr") = Rerr>0.2; - } - } - else - { - cut_d0.setPassedIf(true); - cut_z0.setPassedIf(true); - } - - // Apply isolation tool - if (m_isolationOn) - { - cut_isolationTool.setPassedIf (m_isolationTool->accept(muon)); - } - - // MCP recommendation to check bad muons - muon.auxdecor<char>("badMuon") = m_selection->isBadMuon(muon); - if (m_high_pT>0. && muon.pt()>m_high_pT){ - muon.auxdecor<char>("badMuon") = m_selectionHPT->isBadMuon(muon); - } - - return StatusCode::SUCCESS; - } - - - - MuonToolWeight :: - MuonToolWeight (const std::string& name) - : AsgTool (name), AnaToolWeight<xAOD::MuonContainer> (name), - m_efficiency_scale("MuonEfficiencyScaleFactors", this), - m_efficiency_scaleHPT("MuonEfficiencyScaleFactorsHPT", this), - m_ttva_efficiency_scale("MuonTTVAEfficiencyScaleFactors", this), - m_isolation_scale("MuonIsolationScaleFactors", this), - m_badmuonveto_scale("BadMuonVetoScaleFactors", this) - { - declareProperty("IsolationWP", m_isolationWP = "", "Working point to use"); - declareProperty("HighPt", m_high_pT = -1. ); - declareProperty("NoTRT" , m_noTRT=false , "Apply the TRT cut in selection?"); - declareProperty("BadMuVeto", m_doBadMuVeto=false , "Apply the bad muon veto?"); - } - - - - StatusCode MuonToolWeight :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_efficiency_scale, CP::MuonEfficiencyScaleFactors) ); - - // Set working point - std::string wpString = ""; - if (m_quality==xAOD::Muon::Loose) wpString = "Loose"; - else if (m_quality==xAOD::Muon::Medium) wpString = "Medium"; - else if (m_quality==xAOD::Muon::Tight) wpString = "Tight"; - ATH_CHECK( m_efficiency_scale.setProperty("WorkingPoint", wpString) ); - // For the case of no TRT cut, we need a different calibration release - if (m_noTRT){ - ATH_CHECK( m_efficiency_scale.setProperty("CalibrationRelease", "170209_Moriond_noTRT") ); - } - ATH_CHECK( m_efficiency_scale.initialize() ); - registerTool( &*m_efficiency_scale ); - - // Set working point for the HPT tool - if (m_high_pT>0.){ - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_efficiency_scaleHPT, CP::MuonEfficiencyScaleFactors) ); - ATH_CHECK( m_efficiency_scaleHPT.setProperty("WorkingPoint", "HighPt") ); - // For the case of no TRT cut, we need a different calibration release - if (m_noTRT){ - ATH_CHECK( m_efficiency_scaleHPT.setProperty("CalibrationRelease", "170209_Moriond_noTRT") ); - } - ATH_CHECK( m_efficiency_scaleHPT.initialize() ); - registerTool( &*m_efficiency_scaleHPT ); - } - - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_ttva_efficiency_scale, CP::MuonEfficiencyScaleFactors) ); - ATH_CHECK( m_ttva_efficiency_scale.setProperty("WorkingPoint", "TTVA") ); - if (m_noTRT) - ATH_CHECK( m_ttva_efficiency_scale.setProperty("CalibrationRelease", "170303_Moriond_noTRT") ); - ATH_CHECK( m_ttva_efficiency_scale.initialize() ); - registerTool( &*m_ttva_efficiency_scale ); - - // Isolation working points - if (m_isolationWP!="") { - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_isolation_scale, CP::MuonEfficiencyScaleFactors) ); - ATH_CHECK( m_isolation_scale.setProperty("WorkingPoint", m_isolationWP+"Iso") ); - ATH_CHECK( m_isolation_scale.initialize() ); - registerTool( &*m_isolation_scale ); - } - - if (m_doBadMuVeto){ - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_badmuonveto_scale, CP::MuonEfficiencyScaleFactors) ); - ATH_CHECK( m_badmuonveto_scale.setProperty("WorkingPoint", "BadMuonVeto_HighPt") ); - ATH_CHECK( m_badmuonveto_scale.initialize() ); - registerTool( &*m_badmuonveto_scale ); - } - - return StatusCode::SUCCESS; - } - - - - StatusCode MuonToolWeight :: - objectWeight (const xAOD::Muon& muon, float& weight) - { - ATH_MSG_DEBUG("objectWeight"); - weight = 1.; - float reco_weight=1., ttva_weight=1., iso_weight = 1.; - - // Reconstruction efficiency scale factor - if (m_high_pT<0. || muon.pt()<=m_high_pT){ - if (m_efficiency_scale->getEfficiencyScaleFactor(muon, reco_weight) == - CP::CorrectionCode::Ok) - weight *= reco_weight; - } else { - if (m_efficiency_scaleHPT->getEfficiencyScaleFactor(muon, reco_weight) == - CP::CorrectionCode::Ok) - weight *= reco_weight; - } - - // These next two do not depend on any high-pT working point issues - // Track to vertex association efficiency scale factor - if (m_ttva_efficiency_scale->getEfficiencyScaleFactor(muon, ttva_weight) == - CP::CorrectionCode::Ok) - weight *= ttva_weight; - - // Isolation efficiency scale factor - if (m_isolation_scale.isInitialized() && - m_isolation_scale->getEfficiencyScaleFactor(muon, iso_weight) == - CP::CorrectionCode::Ok) - weight *= iso_weight; - - // Bad muon veto scale factor - // Buyer beware -- this only applies to the high pT working point - // Right now we can't select the high pT working point on its own - if (m_doBadMuVeto && - (m_high_pT>0. && muon.pt()>m_high_pT) ){ - float badMu_weight = 1.; - if (m_badmuonveto_scale->getEfficiencyScaleFactor(muon, badMu_weight) == - CP::CorrectionCode::Ok) - weight *= badMu_weight; - } - - return StatusCode::SUCCESS; - } - - - - StatusCode makeMuonTool (DefinitionArgs& args, - const xAOD::Muon::Quality& quality, - const bool& isolationOn, - const std::string& isolationWP, - const bool& inclusiveMET, - const bool& looseImpactCut, - const float& high_pT, - const bool noTRT, - const bool badMuVeto) - { - using namespace msgObjectDefinition; - - // Global configuration - if (args.firstWP()) - { - switch (quality) - { - case xAOD::Muon::Tight: - args.configuration()->setMuonWP ("Tight"); - break; - case xAOD::Muon::Medium: - args.configuration()->setMuonWP ("Medium"); - break; - case xAOD::Muon::Loose: - args.configuration()->setMuonWP ("Loose"); - break; - case xAOD::Muon::VeryLoose: - args.configuration()->setMuonWP ("VeryLoose"); - break; - } - } - - if (isolationOn) args.configuration()->setMuonIsolationWP (isolationWP); - - // Retrieval tool - std::unique_ptr<IAnaTool> retrieveTool - (new AnaToolRetrieve (args.prefix() + "_retrieve", "Muons")); - args.add (std::move (retrieveTool)); - - // Correction tool - std::unique_ptr<IAnaTool> correctTool - (new MuonToolCorrect (args.prefix() + "_correct")); - args.add (std::move (correctTool)); - - // Selection tool - std::unique_ptr<MuonToolSelect> selectTool - (new MuonToolSelect (args.prefix() + "_select")); - // TODO: Change back to using properties! - // ANA_CHECK (selectTool->setProperty("Quality", quality)); - selectTool->m_quality = quality; - ANA_CHECK( selectTool->setProperty("IsolationOn", isolationOn) ); - ANA_CHECK( selectTool->setProperty("IsolationWP", isolationWP) ); - ANA_CHECK( selectTool->setProperty("InclusiveMET", inclusiveMET) ); - ANA_CHECK( selectTool->setProperty("LooseImpactCut", looseImpactCut) ); - ANA_CHECK( selectTool->setProperty("HighPt", high_pT) ); - ANA_CHECK( selectTool->setProperty("NoTRT", noTRT) ); - ANA_CHECK( selectTool->setProperty("BadMuVeto", badMuVeto) ); - args.add( std::move(selectTool) ); - - if (args.configuration()->isData() == false) - { - // Weight tool - std::unique_ptr<MuonToolWeight> weightTool - (new MuonToolWeight (args.prefix() + "_weight")); - // TODO: Change back to using properties! - weightTool->m_quality = quality; - - ANA_CHECK( weightTool->setProperty("IsolationWP", isolationWP) ); - ANA_CHECK( weightTool->setProperty("HighPt", high_pT) ); - ANA_CHECK( weightTool->setProperty("NoTRT", noTRT) ); - ANA_CHECK( weightTool->setProperty("BadMuVeto", badMuVeto) ); - args.add( std::move(weightTool) ); - } - - return StatusCode::SUCCESS; - } - - // Macros expand to wrapper functions for making the tools - - QUICK_ANA_MUON_DEFINITION_MAKER - ("tight", makeMuonTool (args, xAOD::Muon::Tight)) - QUICK_ANA_MUON_DEFINITION_MAKER - ("medium", makeMuonTool (args, xAOD::Muon::Medium)) - QUICK_ANA_MUON_DEFINITION_MAKER - ("loose", makeMuonTool (args, xAOD::Muon::Loose)) - QUICK_ANA_MUON_DEFINITION_MAKER - ("very_loose", makeMuonTool (args, xAOD::Muon::VeryLoose)) - - QUICK_ANA_MUON_DEFINITION_MAKER - ("tightIso", makeMuonTool (args, xAOD::Muon::Tight, true)) - QUICK_ANA_MUON_DEFINITION_MAKER - ("mediumIso", makeMuonTool (args, xAOD::Muon::Medium, true)) - QUICK_ANA_MUON_DEFINITION_MAKER - ("looseIso", makeMuonTool (args, xAOD::Muon::Loose, true)) - QUICK_ANA_MUON_DEFINITION_MAKER - ("very_looseIso", makeMuonTool (args, xAOD::Muon::VeryLoose, true)) - - QUICK_ANA_MUON_DEFINITION_MAKER - ("loose_Isoloose", makeMuonTool (args, xAOD::Muon::Loose, true, "Loose")) - - QUICK_ANA_MUON_DEFINITION_MAKER - ("Zprime", makeMuonTool (args, xAOD::Muon::Medium, true, "LooseTrackOnly")) - - QUICK_ANA_MUON_DEFINITION_MAKER - ("SUSYIso", makeMuonTool (args, xAOD::Muon::Medium, true, "GradientLoose", true, false, -1., true)) - QUICK_ANA_MUON_DEFINITION_MAKER - ("SUSYloose", makeMuonTool (args, xAOD::Muon::Medium, false,"",true, true, -1., true)) - QUICK_ANA_MUON_DEFINITION_MAKER - ("MediumGLIso500BMV", makeMuonTool (args, xAOD::Muon::Medium, true, "GradientLoose", true, false, 500.*GeV, true, true)) - - -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/ORTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/ORTool.cxx deleted file mode 100644 index c79b5bc77c65c18eaaba11f3a667de9672c017d2..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/ORTool.cxx +++ /dev/null @@ -1,232 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// My header first -#include <QuickAna/ORTool.h> - -// Local includes -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> - - -namespace ana -{ - - //--------------------------------------------------------------------------- - // Constructor - //--------------------------------------------------------------------------- - ORTool :: - ORTool (const std::string& name) - : AsgTool(name), AnaTool(name), - m_orToolBox("ORTBox", this), - m_orFlags(name + "_ortool"), - m_anaSelectionName("ana_select") - { - declareProperty("ORInputLabel", m_orFlags.inputLabel); - declareProperty("OROutputLabel", m_orFlags.outputLabel); - declareProperty("BJetLabel", m_orFlags.bJetLabel); - declareProperty("AnaSelectionName", m_anaSelectionName); - declareProperty("BoostedLeptons", m_orFlags.boostedLeptons); - declareProperty("SlidingConeType", m_slidingConeType); - declareProperty("JVTPriorities", m_jvtPriorities=false); - declareProperty("ApplyRelPt", m_applyRelPt=false); - } - - //--------------------------------------------------------------------------- - // Set object type - //--------------------------------------------------------------------------- - StatusCode ORTool :: - setObjectType(ObjectType type, const std::string& workingPoint) - { - if(type != OBJECT_OVERLAP_REMOVAL) { - ATH_MSG_ERROR("unsupported object type"); - return StatusCode::FAILURE; - } - if(!workingPoint.empty()) { - ATH_MSG_ERROR("can't have working point for overlap removal tool"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - //--------------------------------------------------------------------------- - // Initialize the tool - //--------------------------------------------------------------------------- - StatusCode ORTool :: - initialize() - { - ATH_MSG_INFO( "Initializing " << name() ); - - using namespace ana::msgObjectDefinition; - - // Trying out the new OR config function - m_orToolBox.msg().setLevel( msg().level() ); - ATH_CHECK( ORUtils::recommendedTools(m_orFlags, m_orToolBox) ); - - // We don't currently have a good way to determine here which object - // definitions are disabled, so we currently just configure all overlap - // tools and disable the pointer safety checks - ATH_CHECK( m_orToolBox.masterTool.setProperty("RequireExpectedPointers", false) ); - ATH_CHECK( m_orToolBox.muJetORT.setProperty("ApplyRelPt", m_applyRelPt) ); - - // Set some global properties - //ATH_CHECK( m_orToolBox.setGlobalProperty("OutputLevel", MSG::DEBUG) ); - - // Deal with JVT priority for the relevant tools - if (m_jvtPriorities){ - ATH_CHECK(m_orToolBox.eleJetORT.setProperty("EnableUserPriority", true)); - ATH_CHECK(m_orToolBox.muJetORT.setProperty("EnableUserPriority", true)); - ATH_CHECK(m_orToolBox.tauJetORT.setProperty("EnableUserPriority", true)); - ATH_CHECK(m_orToolBox.phoJetORT.setProperty("EnableUserPriority", true)); - } - - // Override boosted OR sliding cone options - if(!m_slidingConeType.empty()) { - bool slideEle = false; - bool slideMu = false; - if(m_slidingConeType == "electron") { - slideEle = true; - } else if(m_slidingConeType == "muon") { - slideMu = true; - } else if(m_slidingConeType == "both") { - slideEle = slideMu = true; - } else { - ATH_MSG_ERROR("Unsupported SlidingConeType: " << m_slidingConeType); - return StatusCode::FAILURE; - } - ATH_CHECK( m_orToolBox.eleJetORT.setProperty("UseSlidingDR", slideEle) ); - ATH_CHECK( m_orToolBox.muJetORT.setProperty("UseSlidingDR", slideMu) ); - } - - // Initialzie the toolbox - ATH_CHECK( m_orToolBox.initialize() ); - - return StatusCode::SUCCESS; - } - - //--------------------------------------------------------------------------- - // Scheduling boiler plate methods - //--------------------------------------------------------------------------- - AnalysisStep ORTool :: - step() const { return STEP_OVERLAP_REMOVAL; } - //--------------------------------------------------------------------------- - unsigned ORTool :: - inputTypes() const - { - return (1 << OBJECT_ELECTRON) | (1 << OBJECT_MUON) | (1 << OBJECT_JET) | - (1 << OBJECT_TAU) | (1 << OBJECT_PHOTON); - } - //--------------------------------------------------------------------------- - unsigned ORTool :: - outputTypes() const { return inputTypes(); } // Same as input types - - //--------------------------------------------------------------------------- - // Execute the overlap removal - //--------------------------------------------------------------------------- - StatusCode ORTool :: - execute(IEventObjects& objects) - { - if (m_jvtPriorities){ - // Reset the priorities of all objects so that non-JVT jets cannot remove the others - SG::AuxElement::Accessor<SelectType> inAcc(m_orFlags.inputLabel); - if (objects.electrons()){ - for (auto e : *objects.electrons()) inAcc(*e) = inAcc(*e)*2; - } - if (objects.muons()){ - for (auto m : *objects.muons()) inAcc(*m) = inAcc(*m)*2; - } - if (objects.photons()){ - for (auto p : *objects.photons()) inAcc(*p) = inAcc(*p)*2; - } - if (objects.taus()){ - for (auto t : *objects.taus()) inAcc(*t) = inAcc(*t)*2; - } - if (objects.jets()){ - SG::AuxElement::Accessor<SelectType> jvtAcc("Jvt_pass"); - for (auto j : *objects.jets()){ - if (jvtAcc(*j)) inAcc(*j) = inAcc(*j)*2; - } - } - } - - auto& orTool = m_orToolBox.masterTool; - ATH_CHECK( orTool->removeOverlaps(objects.electrons(), objects.muons(), - objects.jets(), objects.taus(), - objects.photons()) ); - - // - // Post-processing: if "overlaps" is true, set selection flag to false - // - SG::AuxElement::Accessor<SelectType> selectAcc(m_anaSelectionName); - SG::AuxElement::ConstAccessor<SelectType> overlapAcc(m_orFlags.outputLabel); - - // List of containers to process. - std::vector< xAOD::IParticleContainer* > containers { - objects.electrons(), objects.muons(), objects.jets(), - objects.taus(), objects.photons() - }; - - // Process all containers in one go! - for (auto contPtr : containers) { - if (contPtr) { - for (auto par : *contPtr) { - if (overlapAcc(*par)) { - selectAcc(*par) = false; - } - } - } - } - - return StatusCode::SUCCESS; - } - -} // namespace ana - - -// Anonymous namespace to hold the tool factory function -namespace -{ - - //--------------------------------------------------------------------------- - // Tool maker function. - //--------------------------------------------------------------------------- - StatusCode makeORTool(ana::DefinitionArgs& args, - const std::string& bJetLabel = "", - const std::string& boostedLeptons = "", - const bool useJVT = false, - const bool applyRelPt = false) - { - using namespace ana::msgObjectDefinition; - - auto orTool = std::make_unique<ana::ORTool>( args.prefix() ); - auto config = args.configuration(); - auto inLabel = config->selectionName(ana::SelectionStep::OR); - auto anaLabel = config->selectionName(ana::SelectionStep::ANALYSIS); - ANA_CHECK( orTool->setProperty("ORInputLabel", inLabel) ); - ANA_CHECK( orTool->setProperty("BJetLabel", bJetLabel) ); - bool doBoostedLeptons = ! boostedLeptons.empty(); - ANA_CHECK( orTool->setProperty("BoostedLeptons", doBoostedLeptons) ); - ANA_CHECK( orTool->setProperty("SlidingConeType", boostedLeptons) ); - ANA_CHECK( orTool->setProperty("AnaSelectionName", anaLabel) ); - ANA_CHECK( orTool->setProperty("JVTPriorities", useJVT) ); - ANA_CHECK( orTool->setProperty("ApplyRelPt", applyRelPt) ); - args.add( std::move(orTool) ); - - return StatusCode::SUCCESS; - } - - // Register the object definitions - QUICK_ANA_OR_DEFINITION_MAKER( "default", makeORTool(args) ) - QUICK_ANA_OR_DEFINITION_MAKER( "heavyFlavor", makeORTool(args, "bjet_OR") ) - QUICK_ANA_OR_DEFINITION_MAKER( "boosted", makeORTool(args, "", "both") ) - QUICK_ANA_OR_DEFINITION_MAKER( "boostedHF", makeORTool(args, "bjet_OR", "both") ) - - QUICK_ANA_OR_DEFINITION_MAKER( "boostedHF_JVT", makeORTool(args, "bjet_OR", "both", true) ) - QUICK_ANA_OR_DEFINITION_MAKER( "boostedMuHF_JVT", makeORTool(args, "bjet_OR", "muon", true) ) - QUICK_ANA_OR_DEFINITION_MAKER( "zzllvv", makeORTool(args, "", "", true, true) ) - -} // anonymous namespace diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/ObjectTypeInfo.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/ObjectTypeInfo.cxx deleted file mode 100644 index b211ba528bcbfad319b113bdc113e04fe9fdb5f8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/ObjectTypeInfo.cxx +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/ObjectTypeInfo.h> - -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - const unsigned ObjectTypeInfo::numTypes; - const unsigned ObjectTypeInfo::numDefTypes; - - const std::string ObjectTypeInfo::name [numDefTypes] = - { - "eventinfo", - "eventSelect", - "jets", - "fatJets", - "electrons", - "photons", - "muons", - "taus", - "met", - "met2", - "overlapRemoval", - "trigger", - "none", - }; - - bool ObjectTypeInfo :: - supportsIParticle (ObjectType type) - { - switch (type) - { - case OBJECT_JET: - case OBJECT_FAT_JET: - case OBJECT_ELECTRON: - case OBJECT_PHOTON: - case OBJECT_MUON: - case OBJECT_TAU: - return true; - case OBJECT_EVENTINFO: - case OBJECT_EVENT_SELECT: - case OBJECT_MET: - case OBJECT_MET2: - case OBJECT_OVERLAP_REMOVAL: - case OBJECT_TRIGGER: - case OBJECT_NONE: - return false; - } - RCU_ASSERT0 ("unknown object type"); - return false; //compilerDummy - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/ObjectsOutputTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/ObjectsOutputTool.cxx deleted file mode 100644 index eeac13805fb244a75dcb400ca29d8b38480b1132..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/ObjectsOutputTool.cxx +++ /dev/null @@ -1,204 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifdef ROOTCORE - -// Local includes -#include <QuickAna/ObjectsOutputTool.h> - -#include <PATInterfaces/SystematicSet.h> -#include <QuickAna/OutputTool.h> - -namespace -{ - - using ToolHandleList_t = std::vector< asg::AnaToolHandle<ana::IOutputToolOld> >; - - /// Local template helper function to construct and initialize one output tool - template < class OutputToolType > - StatusCode constructTool(ToolHandleList_t& outputTools, - asg::AsgTool* parent, - const std::string& toolName, - const std::string& contPropName, - const std::string& contName) - { - using namespace ana::msgObjectDefinition; - - outputTools.emplace_back(toolName, parent); - auto& handle = outputTools.back(); - ANA_CHECK( ASG_MAKE_ANA_TOOL(handle, OutputToolType) ); - ANA_CHECK( handle.setProperty(contPropName, contName) ); - ANA_CHECK( handle.initialize() ); - return StatusCode::SUCCESS; - } - -} - -namespace ana -{ - - //--------------------------------------------------------------------------- - // Tool constructor - //--------------------------------------------------------------------------- - ObjectsOutputTool::ObjectsOutputTool(const std::string& name) - : asg::AsgTool(name) - { - declareProperty("Suffixes", m_suffixes); - } - - - //--------------------------------------------------------------------------- - // Initialize the tool - //--------------------------------------------------------------------------- - StatusCode ObjectsOutputTool::initialize() - { - ATH_MSG_WARNING("This tool is deprecated. Please move to the new " << - "OutputToolXAOD and MasterOutputToolXAOD."); - return StatusCode::SUCCESS; - } - - - //--------------------------------------------------------------------------- - // Execute the output writing for all systematics - //--------------------------------------------------------------------------- - StatusCode ObjectsOutputTool::execute(xAOD::TEvent* outputStore) - { - // Loop over suffixes - for(const std::string& suffix : m_suffixes){ - ATH_CHECK( write(outputStore, suffix) ); - } - return StatusCode::SUCCESS; - } - - - //--------------------------------------------------------------------------- - // Invoke the output writing tools for one systematic suffix - //--------------------------------------------------------------------------- - StatusCode ObjectsOutputTool::write(xAOD::TEvent* outputStore, - const std::string& suffix) - { - // Loop over all tools - for(auto& tool : m_outputTools){ - ATH_CHECK( tool->write(outputStore, suffix) ); - } - return StatusCode::SUCCESS; - } - - - //--------------------------------------------------------------------------- - // Add an OutputCopyTool to the configuration - //--------------------------------------------------------------------------- - StatusCode ObjectsOutputTool::addOutputCopyObject(const std::string& contName) - { - std::string toolName = name() + "_input_" + contName; - ATH_CHECK ( - constructTool<OutputCopyTool>(m_outputTools, this, toolName, - "ContainerName", contName) - ); - return StatusCode::SUCCESS; - } - - - //--------------------------------------------------------------------------- - // Add an OutputTool to the configuration - //--------------------------------------------------------------------------- - StatusCode ObjectsOutputTool::addOutputObject(ana::ObjectType objType, - const std::string& basename) - { - ATH_MSG_INFO("addOutputObject " << basename); - if(objType == OBJECT_EVENTINFO) { - ATH_CHECK ( - constructTool<EventInfoOutputTool> - (m_outputTools, this, name()+"_eventInfo", "ContainerBaseName", basename) - ); - } - - else if(objType == OBJECT_EVENT_SELECT) { - ATH_CHECK ( - constructTool<EventSelectOutputTool> - (m_outputTools, this, name()+"_eventSelect", "ContainerBaseName", basename) - ); - } - - else if(objType == OBJECT_ELECTRON) { - ATH_CHECK ( - constructTool<ElectronOutputTool> - (m_outputTools, this, name()+"_electrons", "ContainerBaseName", basename) - ); - } - - else if(objType == OBJECT_MUON) { - ATH_CHECK ( - constructTool<MuonOutputTool> - (m_outputTools, this, name()+"_muons", "ContainerBaseName", basename) - ); - } - - else if(objType == OBJECT_TAU) { - ATH_CHECK ( - constructTool<TauOutputTool> - (m_outputTools, this, name()+"_taus", "ContainerBaseName", basename) - ); - } - - else if(objType == OBJECT_JET) { - ATH_CHECK ( - constructTool<JetOutputTool> - (m_outputTools, this, name()+"_jets", "ContainerBaseName", basename) - ); - } - - else if(objType == OBJECT_PHOTON) { - ATH_CHECK ( - constructTool<PhotonOutputTool> - (m_outputTools, this, name()+"_photons", "ContainerBaseName", basename) - ); - } - - else if(objType == OBJECT_MET) { - ATH_CHECK ( - constructTool<MetOutputTool> - (m_outputTools, this, name()+"_met", "ContainerBaseName", basename) - ); - } - - else if(objType == OBJECT_MET2) { - ATH_CHECK ( - constructTool<MetOutputTool> - (m_outputTools, this, name()+"_met2", "ContainerBaseName", basename) - ); - } - - else { - ATH_MSG_ERROR("Unsupported object type: " << objType); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - //--------------------------------------------------------------------------- - // Add an existing OutputTool to the configuration. - // I'd prefer to use handle properties than this method. - //--------------------------------------------------------------------------- - //StatusCode ObjectsOutputTool::addOutputTool(std::unique_ptr<IOutputToolOld> tool) - //{ - // m_outputTools.push_back(std::move(tool)); - // return StatusCode::SUCCESS; - //} - - - //--------------------------------------------------------------------------- - // Configure the systematic suffixes - //--------------------------------------------------------------------------- - void ObjectsOutputTool::setSuffixes - (const std::vector<CP::SystematicSet>& sysList) - { - for(const auto& syst : sysList) - m_suffixes.push_back(syst.name()); - } - -} // namespace ana - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedObjects.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedObjects.cxx deleted file mode 100644 index 147efe9927b07fd47a4530dea2535cf9d1a61778..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedObjects.cxx +++ /dev/null @@ -1,174 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/OptimizedObjects.h> - -#include <AsgTools/StatusCode.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/OptimizedStore.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - void OptimizedObjects :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - RCU_INVARIANT (m_master != nullptr); - } - - - - OptimizedObjects :: - OptimizedObjects (OptimizedStore *val_master, - const CP::SystematicSet& val_systematics) - : m_master (val_master), m_systematics (val_systematics) - { - for (std::size_t type = 0, end = ObjectTypeInfo::numTypes; - type != end; ++ type) - { - m_index[type] = OptimizedStore::noIndex; - m_inputIndex[type] = OptimizedStore::noIndex; - } - - RCU_NEW_INVARIANT (this); - } - - - - StatusCode OptimizedObjects :: - prepare () const - { - using namespace msgStore; - - RCU_READ_INVARIANT (this); - for (unsigned mytype = 0, end = ObjectTypeInfo::numTypes; - mytype != end; ++ mytype) - { - const ObjectType type = ObjectType (mytype); - if (m_inputIndex[type] != OptimizedStore::noIndex && - m_index[type] != m_inputIndex[type]) - { - ANA_CHECK (m_master->prepareCopy (type, m_index[type], m_inputIndex[type])); - } - if (type == OBJECT_EVENT_SELECT && - !passSelection()) - return StatusCode::SUCCESS; - } - return StatusCode::SUCCESS; - } - - - - bool OptimizedObjects :: - passSelection () const - { - using namespace msgStore; - - RCU_READ_INVARIANT (this); - if (m_inputIndex[OBJECT_EVENT_SELECT] != OptimizedStore::noIndex) - { - auto select = eventSelect(); - if (select && select->isAvailable<ana::SelectType> ("ana_select")) - return select->auxdata<ana::SelectType> ("ana_select"); - } - return true; - } - - - - void *OptimizedObjects :: - getVoid (ObjectType type) const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - return m_master->getVoid (type, m_index[type]); - } - - - - StatusCode OptimizedObjects :: - addCopy (ObjectType type, const std::string& name) - { - using namespace msgStore; - - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - if (m_inputIndex[type] != OptimizedStore::noIndex) - { - ANA_MSG_ERROR ("trying to create new object instead of \"decorating\" the existing one"); - return StatusCode::FAILURE; - } - ANA_CHECK (m_master->addCopy (type, m_index[type], name)); - return StatusCode::SUCCESS; - } - - - - StatusCode OptimizedObjects :: - addNew (ObjectType type) - { - using namespace msgStore; - - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - if (m_inputIndex[type] != OptimizedStore::noIndex) - { - ANA_MSG_ERROR ("trying to create new object instead of \"decorating\" the existing one"); - return StatusCode::FAILURE; - } - ANA_CHECK (m_master->addNew (type, m_index[type])); - return StatusCode::SUCCESS; - } - - - - float OptimizedObjects :: - eventWeight () const - { - return 1; - } - - - - const CP::SystematicSet& OptimizedObjects :: - systematics () const - { - RCU_READ_INVARIANT (this); - return m_systematics; - } - - - - void OptimizedObjects :: - fillEventData (const CP::SystematicSet& sys, - EventData& eventData) const - { - RCU_READ_INVARIANT (this); - for (unsigned typeIter = 0; typeIter < EnumSize<ObjectType>::dataSize; ++ typeIter) - { - const ObjectType type = ObjectType (typeIter); - if (m_inputIndex[type] != OptimizedStore::noIndex) - { - m_master->fillEventData (type, m_inputIndex[type], sys, eventData); - } - } - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedScheduler.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedScheduler.cxx deleted file mode 100644 index 4410c591aeceb286b81ab5a44593d2e7a9baf39c..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedScheduler.cxx +++ /dev/null @@ -1,258 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/OptimizedScheduler.h> - -#include <QuickAna/EventData.h> -#include <QuickAna/IAnaTool.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/OptimizedObjects.h> -#include <QuickAna/OptimizedStore.h> -#include <QuickAna/OptimizedTool.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - void OptimizedScheduler :: - testInvariant () const - { - RCU_INVARIANT (this != 0); - } - - - - OptimizedScheduler :: - OptimizedScheduler (const std::string& name) - : AsgTool (name), m_runNumber (0), m_eventNumber (0) - { - RCU_NEW_INVARIANT (this); - } - - - - OptimizedScheduler :: - ~OptimizedScheduler () - { - RCU_DESTROY_INVARIANT (this); - } - - - - StatusCode OptimizedScheduler :: - initialize() - { - RCU_CHANGE_INVARIANT (this); - ATH_MSG_DEBUG("initialize"); - - std::stable_sort (m_tools.begin(), m_tools.end(), - [] (const std::unique_ptr<OptimizedTool>& a, - const std::unique_ptr<OptimizedTool>& b) - {return a->step() < b->step();}); - - ATH_MSG_INFO ("tracing tool dependencies"); - for (auto& tool1 : m_tools) - { - for (auto& tool2 : m_tools) - { - // TODO: This should have comments - bool tool2InputForTool1 = tool1->hasDirectInput (*tool2); - bool tool1InputForTool2 = tool2->hasDirectInput (*tool1); - RCU_ASSERT (!(tool1InputForTool2 && tool2InputForTool1)); - if (tool1InputForTool2) - tool1->addOutput (&*tool2); - else if (tool2InputForTool1) - tool2->addOutput (&*tool1); - } - } - - ATH_MSG_INFO ("sorting tools by dependencies"); - std::stable_sort (m_tools.begin(), m_tools.end(), - [] (const std::unique_ptr<OptimizedTool>& a, - const std::unique_ptr<OptimizedTool>& b) - {return a->hasOutput (&*b);}); - - std::vector<CP::SystematicSet> systematics; - systematics.push_back (CP::SystematicSet ()); - return setSystematics (systematics); - } - - - - StatusCode OptimizedScheduler :: - addTool (std::unique_ptr<IAnaTool> tool) - { - RCU_CHANGE_INVARIANT (this); - std::unique_ptr<OptimizedTool> mytool - (new OptimizedTool (std::move (tool))); - m_tools.push_back (std::move (mytool)); - return StatusCode::SUCCESS; - } - - - - CP::SystematicSet OptimizedScheduler :: - affectingSystematics () const - { - RCU_READ_INVARIANT (this); - - CP::SystematicSet result; - for (auto& tool : m_tools) - { - result.insert (tool->affectingSystematics()); - } - return result; - } - - - - CP::SystematicSet OptimizedScheduler :: - recommendedSystematics () const - { - RCU_READ_INVARIANT (this); - - CP::SystematicSet result; - for (auto& tool : m_tools) - { - result.insert (tool->recommendedSystematics()); - } - return result; - } - - - - StatusCode OptimizedScheduler :: - applySystematicVariation (const CP::SystematicSet& systConfig) - { - RCU_CHANGE_INVARIANT (this); - - auto iter = m_objectsMap.find (systConfig); - if (iter == m_objectsMap.end()) - { - ATH_MSG_ERROR ("unknown systematic configuration: " << systConfig.name()); - return StatusCode::FAILURE; - } - m_currentObjects = iter->second.get(); - return StatusCode::SUCCESS; - } - - - - StatusCode OptimizedScheduler :: - fillEventObjects (IEventObjects*& objects) - { - RCU_CHANGE_INVARIANT (this); - ATH_MSG_DEBUG("fillEventObjects"); - - if (isNewEvent()) - { - m_master->clearData (); - for (auto& tool : m_tools) - { - ATH_CHECK (tool->execute ()); - } - } - objects = m_currentObjects; - return StatusCode::SUCCESS; - } - - - - bool OptimizedScheduler :: - isNewEvent () - { - const xAOD::EventInfo *eventInfo = nullptr; - if (!evtStore()->retrieve (eventInfo, "EventInfo").isSuccess()) - RCU_THROW_MSG ("failed to retrieve EventInfo object"); - if (m_runNumber == eventInfo->runNumber() && - m_eventNumber == eventInfo->eventNumber()) - return false; - m_runNumber = eventInfo->runNumber(); - m_eventNumber = eventInfo->eventNumber(); - return true; - } - - - - const std::vector<CP::SystematicSet>& OptimizedScheduler :: - systematics () const - { - RCU_READ_INVARIANT (this); - return m_targetSystematics; - } - - - - StatusCode OptimizedScheduler :: - setSystematics (const std::vector<CP::SystematicSet>& val_systematics) - { - RCU_CHANGE_INVARIANT (this); - - m_targetSystematics = val_systematics; - m_objectsMap.clear (); - m_master.reset (); - - for (auto& sys : m_targetSystematics) - ATH_MSG_INFO ("using systematic: \"" << sys.name() << "\""); - m_master.reset (new OptimizedStore (m_targetSystematics, &*evtStore())); - - for (auto& tool : m_tools) - { - ATH_MSG_INFO ("using tool: " << tool->name() << " systematics=\"" << - tool->affectingSystematics().name() << "\""); - ATH_CHECK (tool->configureSystematics (&*m_master)); - } - - // TODO: This should have comments - std::vector<OptimizedObjects*> myobjects; - for (auto& sys : m_targetSystematics) - { - std::unique_ptr<OptimizedObjects> objects - (new OptimizedObjects (&*m_master, sys)); - myobjects.push_back (&*objects); - m_objectsMap.insert (std::make_pair (sys, std::move (objects))); - } - ATH_CHECK (m_master->initializeIndices (myobjects, m_master->objectTypes(), - 0, STEP_ANALYSIS)); - if (applySystematicVariation (CP::SystematicSet ()) != CP::SystematicCode::Ok) - { - ATH_MSG_ERROR ("failed to set default systematics"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - EventData OptimizedScheduler :: - getEventData () const - { - RCU_READ_INVARIANT (this); - EventData result; - for (auto& sys : m_objectsMap) - { - sys.second->fillEventData (sys.first, result); - } - for (auto& tool : m_tools) - tool->fillEventDataSource (result); - return result; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedStore.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedStore.cxx deleted file mode 100644 index f452ac5043266ad21369367636ee6efbb6d9738a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedStore.cxx +++ /dev/null @@ -1,429 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/OptimizedStore.h> - -#include <PATInterfaces/SystematicSet.h> -#include <QuickAna/EventData.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/OptimizedObjects.h> -#include <QuickAna/xAODHelpers.h> -#include <RootCoreUtils/Assert.h> -#include <RootCoreUtils/ThrowMsg.h> - -// -// method implementations -// - -namespace ana -{ - // for documentation see header file/doxygen - struct OptimizedStore::InfoObject - { - /// \brief the data pointer - public: - void *data; - - /// \brief the name inside the data store - public: - std::string name; - - /// \brief standard constructor - public: - InfoObject () - : data (nullptr) - {} - }; - - - - // for documentation see header file/doxygen - struct OptimizedStore::InfoType - { - /// \brief the object information - public: - std::vector<InfoObject> objects; - - /// \brief all the systematics affecting this object type (up to - /// this point) - public: - CP::SystematicSet systematics; - - /// \brief a mapping from systematics points to actual systematics - /// used - public: - std::unordered_map<CP::SystematicSet,std::size_t> systematicsIndex; - }; - - - - // for documentation see header file/doxygen - struct OptimizedStore::Pimpl - { - /// \brief the type information - public: - InfoType types [ObjectTypeInfo::numTypes]; - - /// \brief the value of \ref OptimizedStore::requestedSystematics - public: - std::vector<CP::SystematicSet> requestedSystematics; - - /// \brief the store we are operating on - public: - StoreType *store; - - - /// \brief standard constructor - /// \par Guarantee - /// strong - /// \par Failures - /// out of memory II - public: - Pimpl (const std::vector<CP::SystematicSet>& val_requestedSystematics, - StoreType *val_store) - : requestedSystematics (val_requestedSystematics), store (val_store) - {} - }; - - - - // for documentation see header file/doxygen - const std::size_t OptimizedStore::noIndex; - - - - void OptimizedStore :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - RCU_INVARIANT (pimpl != nullptr); - } - - - - OptimizedStore :: - OptimizedStore (const std::vector<CP::SystematicSet>& val_requestedSystematics, - StoreType *val_store) - : pimpl (new Pimpl (val_requestedSystematics, val_store)) - { - RCU_NEW_INVARIANT (this); - } - - - - OptimizedStore :: - ~OptimizedStore () - { - RCU_DESTROY_INVARIANT (this); - delete pimpl; - } - - - - const std::vector<CP::SystematicSet>& OptimizedStore :: - requestedSystematics () const - { - RCU_READ_INVARIANT (this); - return pimpl->requestedSystematics; - } - - - - StatusCode OptimizedStore :: - prepareCopy (ObjectType type, std::size_t index, std::size_t origIndex) - { - using namespace msgStore; - - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - if (index == noIndex) - { - ANA_MSG_ERROR ("trying to use unregistered object"); - return StatusCode::FAILURE; - } - - // TODO: This should have comments - InfoType& infoType = pimpl->types[type]; - RCU_ASSERT (index < infoType.objects.size()); - RCU_ASSERT (origIndex < infoType.objects.size()); - InfoObject& infoObjectFrom = infoType.objects[origIndex]; - InfoObject& infoObjectTo = infoType.objects[index]; - RCU_ASSERT (infoObjectFrom.data != nullptr); - RCU_ASSERT (infoObjectTo.data == nullptr); - - ANA_CHECK (xAODHelpers::makeShallow (*pimpl->store, infoObjectTo.name, - type, infoObjectTo.data, - infoObjectFrom.name)); - return StatusCode::SUCCESS; - } - - - - void *OptimizedStore :: - getVoid (ObjectType type, const std::size_t index) const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - InfoType& infoType = pimpl->types[type]; - - if (index == noIndex) - { - if (infoType.objects.empty()) - return nullptr; - RCU_THROW_MSG ("trying to use unregistered object of type " + ObjectTypeInfo::name[type]); - } - - RCU_ASSERT (index < infoType.objects.size()); - InfoObject& infoObject = infoType.objects[index]; - if (infoObject.data == nullptr) - RCU_THROW_MSG ("trying to read un-initialized object of type " + ObjectTypeInfo::name[type]); - - return infoObject.data; - } - - - - StatusCode OptimizedStore :: - addCopy (ObjectType type, std::size_t index, - const std::string& name) - { - using namespace msgStore; - - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - if (index == noIndex) - { - ANA_MSG_ERROR ("trying to use unregistered object"); - return StatusCode::FAILURE; - } - - // TODO: This should have comments - InfoType& infoType = pimpl->types[type]; - RCU_ASSERT (index < infoType.objects.size()); - InfoObject& infoObject = infoType.objects[index]; - if (infoObject.data) - { - ANA_MSG_ERROR ("trying to initialize object twice"); - return StatusCode::FAILURE; - } - - ANA_CHECK (xAODHelpers::makeShallow (*pimpl->store, infoObject.name, - type, infoObject.data, name)); - return StatusCode::SUCCESS; - } - - - - StatusCode OptimizedStore :: - addNew (ObjectType type, std::size_t index) - { - using namespace msgStore; - - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - if (index == noIndex) - { - ANA_MSG_ERROR ("trying to use unregistered object"); - return StatusCode::FAILURE; - } - - // TODO: This should have comments - InfoType& infoType = pimpl->types[type]; - RCU_ASSERT (index < infoType.objects.size()); - InfoObject& infoObject = infoType.objects[index]; - if (infoObject.data) - { - ANA_MSG_ERROR ("trying to initialize object twice"); - return StatusCode::FAILURE; - } - - ANA_CHECK (xAODHelpers::makeNew (*pimpl->store, infoObject.name, - type, infoObject.data)); - return StatusCode::SUCCESS; - } - - - - // - // legacy code - // - - - - - - - - - - - - - - const CP::SystematicSet& OptimizedStore :: - objectSystematics (ObjectType type) const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - - const InfoType& infoType = pimpl->types[type]; - - return infoType.systematics; - } - - - - StatusCode OptimizedStore :: - initializeIndices (const std::vector<OptimizedObjects*>& objects, - unsigned inputTypes, unsigned outputTypes, - AnalysisStep step) - { - using namespace msgStore; - - RCU_CHANGE_INVARIANT (this); - - for (unsigned iter = 0, end = ObjectTypeInfo::numTypes; - iter != end; ++ iter) - { - const ObjectType objectType = ObjectType (iter); - InfoType& infoType = pimpl->types[objectType]; - const bool isInput = (inputTypes & (1 << objectType)); - const bool isOutput = (outputTypes & (1 << objectType)); - - // input objects are only used if present, and ignored otherwise - if (isInput && !infoType.objects.empty()) - { - for (auto& obj : objects) - { - CP::SystematicSet mySys; - if (CP::SystematicSet::filterForAffectingSystematics (obj->systematics(), infoType.systematics, mySys) != CP::SystematicCode::Ok) - { - ANA_MSG_ERROR ("failed to filter for systematics"); - return StatusCode::FAILURE; - } - auto iter = infoType.systematicsIndex.find (mySys); - if (iter == infoType.systematicsIndex.end()) - { - ANA_MSG_ERROR ("unknown systematics point: \"" << mySys.name() << "\""); - return StatusCode::FAILURE; - } - obj->m_index[objectType] = obj->m_inputIndex[objectType] - = iter->second; - } - } - - // output objects are only used if the input objects are - // present, or if we don't use any input objects (indicating - // that we create the objects) - if (isOutput && - !(isInput && infoType.objects.empty())) - { - if (!isInput && !infoType.objects.empty()) - { - ANA_MSG_ERROR ("trying to fill object type twice: " << ObjectTypeInfo::name[objectType]); - return StatusCode::FAILURE; - } - - std::set<std::size_t> duplicates; - { - std::set<std::size_t> used; - used.insert (noIndex); - for (auto& obj : objects) - { - const std::size_t index = obj->m_index[objectType]; - if (used.find (index) != used.end()) - duplicates.insert (index); - used.insert (index); - } - } - - infoType.systematicsIndex.clear (); - for (auto& obj : objects) - { - const std::size_t index = obj->m_index[objectType]; - if (duplicates.find (index) != duplicates.end()) - { - std::ostringstream name; - name << "ana_" << ObjectTypeInfo::name[objectType] << "_"; - name << step << "_" << obj->systematics().name(); - - InfoObject infoObject; - infoObject.name = name.str(); - infoType.objects.push_back (infoObject); - obj->m_index[objectType] = infoType.objects.size() - 1; - } - infoType.systematics.insert (obj->systematics()); - RCU_ASSERT (infoType.systematicsIndex.find (obj->systematics()) == infoType.systematicsIndex.end()); - infoType.systematicsIndex[obj->systematics()] - = obj->m_index[objectType]; - } - } - } - return StatusCode::SUCCESS; - } - - - - unsigned OptimizedStore :: - objectTypes () const - { - RCU_READ_INVARIANT (this); - - unsigned result = 0; - for (unsigned iter = 0, end = ObjectTypeInfo::numTypes; - iter != end; ++ iter) - { - const ObjectType objectType = ObjectType (iter); - InfoType& infoType = pimpl->types[objectType]; - if (!infoType.objects.empty()) - result |= 1 << objectType; - } - return result; - } - - - - void OptimizedStore :: - clearData () - { - RCU_CHANGE_INVARIANT (this); - for (auto& infoType : pimpl->types) - { - for (auto& infoObject : infoType.objects) - { - infoObject.data = nullptr; - } - } - } - - - - void OptimizedStore :: - fillEventData (ObjectType type, unsigned index, - const CP::SystematicSet& sys, - EventData& eventData) const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - - InfoType& infoType = pimpl->types[type]; - RCU_ASSERT (index < infoType.objects.size()); - InfoObject& infoObject = infoType.objects[index]; - eventData.setName (type, sys, infoObject.name); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedTool.cxx deleted file mode 100644 index 2a1a77dee41781dca0bd4e82f4e89ea177fe6383..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/OptimizedTool.cxx +++ /dev/null @@ -1,303 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/OptimizedTool.h> - -#include <QuickAna/IAnaTool.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/OptimizedObjects.h> -#include <QuickAna/OptimizedStore.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - void OptimizedTool :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - RCU_INVARIANT (m_tool != nullptr); - } - - - - OptimizedTool :: - OptimizedTool (std::unique_ptr<IAnaTool> val_tool) - : asg::AsgMessaging(val_tool->name() + "_optWrapper"), - m_tool (nullptr) - { - RCU_REQUIRE (val_tool != nullptr); - - m_tool = std::move (val_tool); - - RCU_NEW_INVARIANT (this); - } - - - - OptimizedTool :: - ~OptimizedTool () - { - RCU_DESTROY_INVARIANT (this); - } - - - - std::string OptimizedTool :: - name () const - { - RCU_READ_INVARIANT (this); - return m_tool->name(); - } - - - - AnalysisStep OptimizedTool :: - step () const - { - RCU_READ_INVARIANT (this); - return m_tool->step(); - } - - - - CP::SystematicSet OptimizedTool :: - affectingSystematics () const - { - RCU_READ_INVARIANT (this); - return m_tool->affectingSystematics(); - } - - - - CP::SystematicSet OptimizedTool :: - recommendedSystematics () const - { - RCU_READ_INVARIANT (this); - return m_tool->recommendedSystematics(); - } - - - - StatusCode OptimizedTool :: - execute () - { - RCU_CHANGE_INVARIANT (this); - ATH_MSG_DEBUG("execute"); - for (auto& object : m_objects) - { - try - { - ATH_MSG_DEBUG("Executing tool for systematic " << object.first.name()); - ANA_CHECK (object.second->prepare ()); - if (!object.second->passSelection()) - continue; - if (m_tool->applySystematicVariation (object.first) != CP::SystematicCode::Ok) - { - ATH_MSG_ERROR ("failed to set systematic variation"); - return StatusCode::FAILURE; - } - ANA_CHECK (m_tool->execute (*object.second)); - } catch (std::exception& e) - { - ATH_MSG_FATAL ("exception while executing tool " << m_tool->name() << - ": " << e.what()); - return StatusCode::FAILURE; - } catch (std::string& s) - { - ATH_MSG_FATAL ("exception while executing tool " << m_tool->name() << - ": " << s); - return StatusCode::FAILURE; - } catch (...) - { - ATH_MSG_FATAL ("unknown exception while executing tool " << m_tool->name()); - return StatusCode::FAILURE; - } - } - return StatusCode::SUCCESS; - } - - - - void OptimizedTool :: - fillEventDataSource (EventData& event) const - { - RCU_READ_INVARIANT (this); - m_tool->fillEventDataSource (event); - } - - - - bool OptimizedTool :: - hasDirectInput (const OptimizedTool& input) const noexcept - { - RCU_READ_INVARIANT (this); - RCU_READ_INVARIANT (&input); - const OptimizedTool& output = *this; - - AnalysisStep outputStep = output.m_tool->step(); - AnalysisStep inputStep = input.m_tool->step(); - if (inputStep >= outputStep) - return false; - unsigned outputInputs = output.m_tool->inputTypes(); - unsigned inputOutputs = input.m_tool->outputTypes(); - return (inputOutputs & outputInputs) != 0; - } - - - - bool OptimizedTool :: - hasOutput (const OptimizedTool *output) const noexcept - { - RCU_READ_INVARIANT (this); - RCU_READ_INVARIANT (output); - -#ifndef NDEBUG - const OptimizedTool *input = this; -#endif - - bool result1 = m_outputs.find (const_cast<OptimizedTool*>(output)) != m_outputs.end(); -#ifndef NDEBUG - bool result2 = output->m_inputs.find (const_cast<OptimizedTool*>(input)) != output->m_inputs.end(); -#endif - RCU_ASSERT (result1 == result2); - return result1; - } - - - - void OptimizedTool :: - addOutput (OptimizedTool *output) - { - RCU_CHANGE_INVARIANT (this); - RCU_CHANGE_INVARIANT (output); - RCU_ASSERT (step() < output->step()); - - OptimizedTool *input = this; - - RCU_ASSERT (m_inputs.find (output) == m_inputs.end()); - RCU_ASSERT (output->m_outputs.find (input) == output->m_outputs.end()); - - if (m_outputs.find (output) != m_outputs.end()) - { - RCU_ASSERT (output->m_inputs.find (input) != output->m_inputs.end()); - return; - } - - RCU_ASSERT (output->m_inputs.find (input) == output->m_inputs.end()); - m_outputs.insert (output); - output->m_inputs.insert (input); - - RCU_ASSERT (m_outputs.find (output) != m_outputs.end()); - RCU_ASSERT (output->m_inputs.find (input) != output->m_inputs.end()); - - for (auto subinput : m_inputs) - subinput->addOutput (output); - for (auto suboutput : output->m_outputs) - addOutput (suboutput); - } - - - - StatusCode OptimizedTool :: - configureSystematics (OptimizedStore *store) - { - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (store != nullptr); - ATH_MSG_DEBUG("configureSystematics"); - - // TODO: This code needs comments - - CP::SystematicSet affecting = affectingSystematics(); - for (std::size_t objectTypeIter = 0, end = ObjectTypeInfo::numTypes; - objectTypeIter != end; ++ objectTypeIter) - { - const ObjectType objectType = ObjectType (objectTypeIter); - if (m_tool->inputTypes() & (1 << objectType)) - { - affecting.insert (store->objectSystematics(objectType)); - } - } - - std::vector<OptimizedObjects*> vecObjects; - m_objects.clear (); - for (auto& origSys : store->requestedSystematics()) - { - CP::SystematicSet mySys; - if (CP::SystematicSet::filterForAffectingSystematics (origSys, affecting, mySys) - != CP::SystematicCode::Ok) - { - ATH_MSG_ERROR ("failed to filter for affecting systematics"); - return StatusCode::FAILURE; - } - if (m_objects.find (mySys) == m_objects.end()) - { - std::unique_ptr<OptimizedObjects> objects - (new OptimizedObjects (store, mySys)); - vecObjects.push_back (&*objects); - m_objects[mySys] = std::move (objects); - } - } - - return store->initializeIndices (vecObjects, m_tool->inputTypes(), - m_tool->outputTypes(), step()); - - - /* - if (!sys.hasObject (ObjectType (objectType))) - { - ATH_MSG_FATAL ("no source for object type: " << ObjectTypeInfo::name[objectType]); - return StatusCode::FAILURE; - } - affecting.insert (sys.objectSystematics (ObjectType (objectType))); - } else if (m_tool->inputTypes() & (1 << objectType)) - { - if (sys.hasObject (ObjectType (objectType))) - { - ATH_MSG_FATAL ("two sources for object type: " << ObjectTypeInfo::name[objectType]); - return StatusCode::FAILURE; - } - } - } - - std::set<CP::SystematicSet> targetSystematics; - for (auto& target : sys.targetSystematics()) - { - CP::SystematicSet mytarget; - if (CP::SystematicSet::filterForAffectingSystematics (target, affecting, mytarget) != CP::SystematicCode::Ok) - { - ATH_MSG_FATAL ("failed to filter systematics"); - return StatusCode::FAILURE; - } - targetSystematics.insert (mytarget); - } - std::vector<CP::SystematicSet> m_targetSystematics - (targetSystematics.begin(), targetSystematics.end()); - - std::vector<std::vector< - - // for (auto& input : m_inputs) - // mysys.insert (input->affectingSystematcs()); - */ - - return StatusCode::SUCCESS; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/OutputTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/OutputTool.cxx deleted file mode 100644 index 3ec5b1ab05f440ca8066597d4f723919e1bb6a4e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/OutputTool.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifdef ROOTCORE - -// Local includes -#include <QuickAna/OutputTool.h> - -#include <QuickAna/MessageCheck.h> - -namespace ana -{ - - OutputCopyTool::OutputCopyTool(const std::string& name, - const std::string& contName) - : asg::AsgTool(name), m_contName(contName) - { - declareProperty("ContainerName", m_contName); - } - - - StatusCode OutputCopyTool::initialize() - { - ATH_MSG_WARNING("This tool is deprecated. Please move to the new " << - "OutputToolXAOD and MasterOutputToolXAOD."); - return StatusCode::SUCCESS; - } - - - StatusCode OutputCopyTool::write(xAOD::TEvent* outputStore, - const std::string& /*suffix*/) - { - ANA_CHECK( outputStore->copy(m_contName) ); - return StatusCode::SUCCESS; - } - -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/PhotonTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/PhotonTool.cxx deleted file mode 100644 index d8a91e9e931c8cb9ba8ada611be4f85964449bb5..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/PhotonTool.cxx +++ /dev/null @@ -1,309 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Includes -// - -#include <QuickAna/PhotonTool.h> - -#include <ElectronPhotonFourMomentumCorrection/EgammaCalibrationAndSmearingTool.h> -#include <ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h> -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> - -#include <PhotonEfficiencyCorrection/AsgPhotonEfficiencyCorrectionTool.h> -#include <ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h> -#include <IsolationSelection/IsolationSelectionTool.h> -#include <IsolationCorrections/IsolationCorrectionTool.h> -#include <xAODTracking/TrackParticlexAODHelpers.h> - -// Helper for object quality -#include <ElectronPhotonSelectorTools/PhotonSelectorHelpers.h> - -// The photon tools are apparently lazy? -#include <PathResolver/PathResolver.h> - -// -// Method implementations -// -namespace ana -{ - // const float GeV = 1000.; - - // Constructor - PhotonToolCorrect :: - PhotonToolCorrect (const std::string& name) - : AsgTool (name), AnaToolCorrect<xAOD::PhotonContainer> (name), - m_calibration ("EgammaCalibrationAndSmearingTool", this), - m_fudgeMCTool ("ElectronPhotonShowerShapeFudgeTool", this), - m_isoCorrTool ("IsolationCorrectionTool", this) - { - declareProperty("IsAF2", m_isAF2=false); - declareProperty("IsData", m_isData=false); - } - - - // Initialization - StatusCode PhotonToolCorrect :: - initialize() - { - ATH_MSG_INFO("initialize"); - ATH_MSG_WARNING("This tool currently skips calibration on author 128 " << - "photons to avoid errors"); - // Initialize the calibration tool - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_calibration, CP::EgammaCalibrationAndSmearingTool)); - ATH_CHECK (m_calibration.setProperty ("ESModel", "es2016data_mc15c")); - ATH_CHECK (m_calibration.setProperty ("useAFII", m_isAF2?1:0)); - ATH_CHECK (m_calibration.setProperty ("decorrelationModel", "1NP_v1")); - ATH_CHECK (m_calibration.initialize()); - registerTool (&*m_calibration); - - // Initialize Fudge Tool - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_fudgeMCTool, ElectronPhotonShowerShapeFudgeTool)); - ATH_CHECK (m_fudgeMCTool.setProperty ("Preselection", 21)); // 21 == MC15 - ATH_CHECK (m_fudgeMCTool.initialize()); - - // Initialize isolation correction tool - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_isoCorrTool, CP::IsolationCorrectionTool)); - ATH_CHECK( m_isoCorrTool.setProperty( "IsMC", !m_isData) ); - ATH_CHECK( m_isoCorrTool.setProperty( "AFII_corr", m_isAF2) ); - ATH_CHECK( m_isoCorrTool.initialize() ); - - // Set the cut steps - registerCut (SelectionStep::MET, "fudge_tool", cut_fudge_tool); - registerCut (SelectionStep::MET, "calibration_tool", cut_calibration_tool); - registerCut (SelectionStep::MET, "iso_corr_tool", cut_isoCorr_tool); - - return StatusCode::SUCCESS; - } - - - // Object correction - StatusCode PhotonToolCorrect :: - correctObject (xAOD::Photon& photon) - { - if (photon.author() & (xAOD::EgammaParameters::AuthorPhoton + xAOD::EgammaParameters::AuthorAmbiguous)){ - QA_CHECK_CUT (cut_calibration_tool, m_calibration->applyCorrection(photon)); - } else { - // We should not even apply the remainder of the tools! - return StatusCode::SUCCESS; - } - - // Do *not* apply smearing to AF2: - // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EGammaIdentificationRun2 - if (m_isAF2 || m_isData){ - cut_fudge_tool.setPassedIf(true); - } else { - QA_CHECK_CUT (cut_fudge_tool, m_fudgeMCTool->applyCorrection(photon)); - } - - // Correct the isolation - QA_CHECK_CUT (cut_isoCorr_tool, m_isoCorrTool->applyCorrection(photon)); - - return StatusCode::SUCCESS; - } - - - // Constructor - PhotonToolSelect :: - PhotonToolSelect (const std::string& name) - : AsgTool (name), AnaToolSelect<xAOD::PhotonContainer> (name), - quality(egammaPID::PhotonTight), - m_selection ("PhotonIsEMSelector", this), - m_isolationTool ("IsolationSelectionTool", this), - m_isolationOn(false) - - { - declareProperty( "IsolationWP", m_isolationWP = "", "Working point to use" ); - } - - - // Initialization - StatusCode PhotonToolSelect :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - - // Initalize Photon Selector - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_selection, AsgPhotonIsEMSelector)); - ATH_CHECK (m_selection.setProperty("isEMMask",quality)); - ATH_CHECK (m_selection.setProperty("ConfigFile", - "ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMTightSelectorCutDefs.conf")); - ATH_CHECK (m_selection.initialize()); - - registerCut (SelectionStep::MET, "quality", cut_OQ); - registerCut (SelectionStep::MET, "author", cut_author); - registerCut (SelectionStep::MET, "cleaning", cut_cleaning); - registerCut (SelectionStep::MET, "selection", cut_selection); - registerCut (SelectionStep::MET, "isolationTool", cut_isolationTool); - ATH_MSG_INFO("initialize"); - if (!(m_isolationWP=="")) - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_isolationTool, CP::IsolationSelectionTool)); - ATH_CHECK (m_isolationTool.setProperty("PhotonWP", m_isolationWP)); - ATH_CHECK (m_isolationTool.initialize()); - registerTool(&*m_isolationTool); - m_isolationOn = true; - } - - return StatusCode::SUCCESS; - } - - - // Object selection - StatusCode PhotonToolSelect :: - selectObject (xAOD::Photon& photon) - { - // Object quality - cut_OQ.setPassedIf (photon.isGoodOQ(xAOD::EgammaParameters::BADCLUSPHOTON)); - - // Photon author requirement; see: - // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/EGammaIdentificationRun2 - cut_author.setPassedIf( (photon.author() & xAOD::EgammaParameters::AuthorPhoton) || - (photon.author() & xAOD::EgammaParameters::AuthorAmbiguous) ); - - // Photon cleaning from the same TWiki - cut_cleaning.setPassedIf( PhotonSelectorHelpers::passOQquality( &photon ) ); - - // Using MC15/R20 selections - // Explicit check that the photon is not in the crack - cut_selection.setPassedIf (m_selection->accept (&photon) && - (fabs( photon.caloCluster()->etaBE(2) ) <=1.37 || - fabs( photon.caloCluster()->etaBE(2) ) >=1.52) ); - - // Apply isolation tool - if (m_isolationOn) { - cut_isolationTool.setPassedIf (m_isolationTool->accept(photon)); - } - - return StatusCode::SUCCESS; - } - - - - // Constructor - PhotonToolWeight :: - PhotonToolWeight (const std::string& name) - : AsgTool (name), AnaToolWeight<xAOD::PhotonContainer> (name), - m_efficiencyTool ("IAsgPhotonEfficiencyCorrectionTool_eff", this), - m_isoSFTool ("IAsgPhotonEfficiencyCorrectionTool_iso", this), - m_doIsolation (false) - { - declareProperty("IsAF2", m_isAF2=false); - declareProperty( "IsolationWP", m_isolationWP = "", "Working point to use" ); - } - - - // Initialization - StatusCode PhotonToolWeight :: - initialize() - { - ATH_MSG_INFO("initialize"); - - // Initialize the AsgPhotonEfficiencyCorrectionTool. - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_efficiencyTool, AsgPhotonEfficiencyCorrectionTool)); - // Reco scale factors - ATH_CHECK( m_efficiencyTool.setProperty("MapFilePath", "PhotonEfficiencyCorrection/map0.txt")); - ATH_CHECK( m_efficiencyTool.setProperty("ForceDataType", 1 ) ); //+ (m_isAF2?2:0)) ); - ATH_CHECK( m_efficiencyTool.initialize() ); - registerTool(&*m_efficiencyTool); - - if (m_isolationWP == "FixedCutTight" || m_isolationWP == "FixedCutLoose") - { - // Initialize the AsgPhotonEfficiencyCorrectionTool. - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_isoSFTool, AsgPhotonEfficiencyCorrectionTool)); - ATH_CHECK( m_isoSFTool.setProperty("MapFilePath", "PhotonEfficiencyCorrection/map0.txt")); - ATH_CHECK( m_isoSFTool.setProperty("ForceDataType", 1 ) ); //+ (m_isAF2?2:0)) ); - ATH_CHECK( m_isoSFTool.initialize() ); - registerTool(&*m_isoSFTool); - m_doIsolation = true; - } - - return StatusCode::SUCCESS; - } - - - // Object weighting - StatusCode PhotonToolWeight :: - objectWeight (const xAOD::Photon& photon, float& weight) - { - // Photon efficiency SF - weight = 1; - - double eff_weight=1.; - - // Reconstruction efficiency scale factor - if (m_efficiencyTool->getEfficiencyScaleFactor(photon,eff_weight) == - CP::CorrectionCode::Ok) - weight *= eff_weight; - - if (m_doIsolation){ - double iso_weight=1.; - if (m_isoSFTool->getEfficiencyScaleFactor(photon,iso_weight) == - CP::CorrectionCode::Ok) - weight *= iso_weight; - } - - return StatusCode::SUCCESS; - } - - - - StatusCode makePhotonTool (DefinitionArgs& args, unsigned int quality, - std::string isolationWP ) - { - using namespace msgObjectDefinition; - - const std::string inputContainer = "Photons"; - const bool isAFII = args.configuration()->isAFII(); - const bool isData = args.configuration()->isData(); - - // Retrieval tool - args.add (std::unique_ptr<ana::IAnaTool> - (new AnaToolRetrieve (args.prefix() + "_retrieve", inputContainer))); - // Correction tool - std::unique_ptr<PhotonToolCorrect> correctTool - (new PhotonToolCorrect (args.prefix() + "_correct")); - ANA_CHECK - ( correctTool->setProperty("IsAF2", isAFII) ); - ANA_CHECK - ( correctTool->setProperty("IsData", isData) ); - args.add( std::move(correctTool) ); - // Selection tool - { - std::unique_ptr<PhotonToolSelect> tool - (new PhotonToolSelect (args.prefix() + "_select")); - tool->quality = quality; - ANA_CHECK (tool->setProperty("IsolationWP", isolationWP)); - args.add (std::move (tool)); - } - if (!isData) - { - // Weight tool - std::unique_ptr<PhotonToolWeight> weightTool - (new PhotonToolWeight (args.prefix() + "_weight")); - ANA_CHECK - ( weightTool->setProperty("IsAF2", isAFII) ); - ANA_CHECK - ( weightTool->setProperty("IsolationWP", isolationWP)); - args.add ( std::move(weightTool) ); - } - return StatusCode::SUCCESS; - } - - - - QUICK_ANA_PHOTON_DEFINITION_MAKER ("tight", makePhotonTool (args,egammaPID::PhotonTight,"")) - QUICK_ANA_PHOTON_DEFINITION_MAKER ("loose", makePhotonTool (args,egammaPID::PhotonLoose,"")) - - QUICK_ANA_PHOTON_DEFINITION_MAKER ("tight_FixedCutTight", makePhotonTool (args,egammaPID::PhotonTight,"FixedCutTight")) - - - - -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/PileupTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/PileupTool.cxx deleted file mode 100644 index 0e4b9ccc712e004ecc55bcf3db6a05241fc190bf..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/PileupTool.cxx +++ /dev/null @@ -1,129 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/PileupTool.h> - -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> - -#include "PileupReweighting/PileupReweightingTool.h" - -// -// method implementations -// - -namespace ana -{ - PileupTool :: - PileupTool (const std::string& name) - : AsgTool (name), AnaTool (name) - , m_tool ("prw", this) - { - } - - - - StatusCode PileupTool :: - setObjectType (ObjectType /*type*/, const std::string& workingPoint) - { - if (!workingPoint.empty()) - { - ATH_MSG_ERROR ("can't have working point for pileup tool"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - AnalysisStep PileupTool :: - step () const - { - return STEP_PILEUP_REWEIGHT; - } - - - - unsigned PileupTool :: - inputTypes () const - { - return 1 << OBJECT_EVENTINFO; - } - - - - unsigned PileupTool :: - outputTypes () const - { - return 1 << OBJECT_EVENTINFO; - } - - - - StatusCode PileupTool :: - initialize() - { - // Configuration recommendations taken from - // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ExtendedPileupReweighting - - //ATH_CHECK (m_tool.make ("CP::PileupReweightingTool")); - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_tool, CP::PileupReweightingTool) ); - - ATH_CHECK( m_tool.setProperty("ConfigFiles", muMcFiles) ); - ATH_CHECK( m_tool.setProperty("LumiCalcFiles", muDataFiles) ); - - // This is now the official recommendation - ATH_CHECK( m_tool.setProperty("DataScaleFactor", 1./1.09) ); - ATH_CHECK( m_tool.setProperty("DataScaleFactorUP", 1.) ); - ATH_CHECK( m_tool.setProperty("DataScaleFactorDOWN", 1./1.18) ); - - ATH_CHECK( m_tool.initialize() ); - - registerTool(&*m_tool); - - return StatusCode::SUCCESS; - } - - - - StatusCode PileupTool :: - execute (IEventObjects& objects) - { - // First do the pileup reweighting that we need to do - ATH_CHECK( m_tool->apply( *objects.eventinfo() ) ); - - //--- PRWHash to recalculate PU weights using analysis ntuples - //--- https://twiki.cern.ch/twiki/bin/view/AtlasProtected/ExtendedPileupReweighting#Using_PRWHash_to_change_pileup_w - - if((*objects.eventinfo()).eventType(xAOD::EventInfo::IS_SIMULATION)) { - ULong64_t prwhash = m_tool->getPRWHash( *objects.eventinfo() ); - objects.eventinfo()->auxdata<ULong64_t>("PRWHash") = prwhash; - } - - // Must decorate the actual instance in the event store for the electron tool to work - auto eventInfo = evtStore()->retrieve<const xAOD::EventInfo>("EventInfo"); - eventInfo->auxdecor<unsigned int>("RandomRunNumber") = - objects.eventinfo()->auxdecor<unsigned int>( "RandomRunNumber" ); - - return StatusCode::SUCCESS; - } - -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/QuickAna.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/QuickAna.cxx deleted file mode 100644 index b003aaf2248880f125158516d1cf41d0eace2e96..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/QuickAna.cxx +++ /dev/null @@ -1,396 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/QuickAna.h> - -#include <QuickAna/EventData.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/OptimizedScheduler.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/ToolScheduler.h> -#include <RootCoreUtils/Assert.h> - -#ifndef ROOTCORE -#include "AthAnalysisBaseComps/AthAnalysisHelper.h" -#include "boost/algorithm/string.hpp" -#endif - -// -// method implementations -// - -namespace ana -{ - namespace - { - double make_weight (const InternalConfiguration& configuration, - xAOD::IParticleContainer *container) - { - SG::AuxElement::Accessor<SelectType> accessor - (configuration.selectionName (SelectionStep::ANALYSIS)); - - double result = 1; - if (container) - { - for (auto object : *container) - { - if (accessor (*object) && - object->isAvailable<float> ("ana_weight")) - { - result *= object->auxdata<float> ("ana_weight"); - } - } - } - return result; - } - } - - - - struct QuickAna::Pimpl - { - /// description: the objects we use - public: - IEventObjects *objects; - - /// description: the cached weight - public: - float weight; - - /// \brief the internal configuration object - public: - InternalConfiguration internalConfiguration; - - Pimpl () : objects (0), weight (-1) {} - }; - - - - void QuickAna :: - testInvariant () const - { - RCU_INVARIANT (this != 0); - RCU_INVARIANT (pimpl != 0); - } - - - - QuickAna :: - QuickAna (const std::string& name) - : AsgTool (name), pimpl (new Pimpl) - { - declareConfigProperties (*this); - - RCU_NEW_INVARIANT (this); - } - - - - QuickAna :: - ~QuickAna () - { - delete pimpl; - } - - - - StatusCode QuickAna :: - initialize() - { - RCU_CHANGE_INVARIANT (this); - ATH_MSG_DEBUG("initialize"); - -#ifndef ROOTCORE - { - std::string project_name; - ATH_CHECK(AthAnalysisHelper::retrieveMetadata ("/TagInfo", "project_name", project_name)); - isDataFlag = (project_name != "IS_SIMULATION"); - ATH_MSG_INFO ("project_name: \"" << project_name << "\""); - ATH_MSG_INFO ("isDataFlag: " << isDataFlag); - - if(!isDataFlag) { - std::string simulation_flavour; - ATH_CHECK(AthAnalysisHelper::retrieveMetadata ("/Simulation/Parameters", - "SimulationFlavour", - simulation_flavour)); - ATH_MSG_INFO ("simulation_flavour: \"" << simulation_flavour << "\""); - - boost::to_upper(simulation_flavour); - isAFIIFlag = simulation_flavour.find("ATLFASTII") != std::string::npos; - //isAFIIFlag = (!simulation_flavour.empty() && simulation_flavour != "default"); - ATH_MSG_INFO ("isAFIIFlag: " << isAFIIFlag); - } - else isAFIIFlag = false; - } -#endif - pimpl->internalConfiguration.fetchConfiguration (*this); - - if (schedulerDef == "basic") - toolScheduler.reset (new ToolScheduler (name() + "_scheduler")); - else if (schedulerDef == "optimized") - toolScheduler.reset (new OptimizedScheduler (name() + "_scheduler")); - else - { - ATH_MSG_ERROR ("unknown scheduler: " << schedulerDef); - return StatusCode::FAILURE; - } - ATH_CHECK (toolScheduler->addTools (*this, pimpl->internalConfiguration, name())); - ATH_CHECK (toolScheduler->initialize()); - - return StatusCode::SUCCESS; - } - - - - bool QuickAna :: - isAffectedBySystematic (const CP::SystematicVariation& systematic) const - { - RCU_READ_INVARIANT (this); - CP::SystematicSet sysList = affectingSystematics(); - return sysList.find (systematic) != sysList.end(); - } - - - - CP::SystematicSet QuickAna :: - affectingSystematics() const - { - RCU_READ_INVARIANT (this); - return toolScheduler->affectingSystematics(); - } - - - - CP::SystematicSet QuickAna :: - recommendedSystematics() const - { - RCU_READ_INVARIANT (this); - return toolScheduler->recommendedSystematics(); - } - - - - CP::SystematicCode QuickAna :: - applySystematicVariation (const CP::SystematicSet& systConfig) - { - RCU_CHANGE_INVARIANT (this); - ANA_CHECK_SET_TYPE (CP::SystematicCode); - ANA_CHECK (toolScheduler->applySystematicVariation(systConfig)); - return CP::SystematicCode::Ok; - } - - - - StatusCode QuickAna :: - process () - { - RCU_CHANGE_INVARIANT (this); - pimpl->weight = -1; - pimpl->objects = 0; - return toolScheduler->fillEventObjects (pimpl->objects); - } - - - - float QuickAna :: - weight () - { - RCU_CHANGE_INVARIANT (this); - - if (pimpl->weight == -1) - { - // Rely on local function to do most of the heavy lifting - double weight = eventWeight(); - - auto select = pimpl->objects->eventSelect(); - if (select && - select->auxdata<ana::SelectType> ("ana_select") == false) - { - weight = 0; - } else - { - weight *= make_weight (pimpl->internalConfiguration, pimpl->objects->muons()); - weight *= make_weight (pimpl->internalConfiguration, pimpl->objects->taus()); - weight *= make_weight (pimpl->internalConfiguration, pimpl->objects->electrons()); - weight *= make_weight (pimpl->internalConfiguration, pimpl->objects->photons()); - weight *= make_weight (pimpl->internalConfiguration, pimpl->objects->jets()); - } - - pimpl->weight = weight; - } - return pimpl->weight; - } - - - - float QuickAna :: - eventWeight () - { - RCU_CHANGE_INVARIANT (this); - float weight = pimpl->objects->eventWeight(); - // Add the JVT scale factor - if (pimpl->objects->eventinfo()->auxdata<float>("JVT_SF")) - { - weight *= pimpl->objects->eventinfo()->auxdata<float>("JVT_SF"); - } - // Add the pileup weight if we had a random run number (PRW was enabled) - if (pimpl->objects->eventinfo()->auxdata<unsigned int>( "RandomRunNumber" )) - { - weight *= pimpl->objects->eventinfo()->auxdata<float>("PileupWeight"); - } - // In the case of MC, add the MC weight - if(pimpl->objects->eventinfo()->eventType( xAOD::EventInfo::IS_SIMULATION ) ){ - weight *= pimpl->objects->eventinfo()->mcEventWeight(); - } - return weight; - } - - - - const IEventObjects& QuickAna :: - objects () const - { - RCU_READ_INVARIANT (this); - return *pimpl->objects; - } - - - - const InternalConfiguration& QuickAna :: - internalConfiguration () - { - RCU_READ_INVARIANT (this); - return pimpl->internalConfiguration; - } - - - - //xAOD::EventInfoContainer& QuickAna :: - xAOD::EventInfo *QuickAna :: - eventinfo () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (pimpl->objects->eventinfo(), "eventinfo is not defined in this analysis"); - return pimpl->objects->eventinfo(); - } - - - - xAOD::MuonContainer *QuickAna :: - muons () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (pimpl->objects->muons(), "muons are defined in this analysis"); - return pimpl->objects->muons(); - } - - - - xAOD::ElectronContainer *QuickAna :: - electrons () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (pimpl->objects->electrons(), "electrons are defined in this analysis"); - return pimpl->objects->electrons(); - } - - xAOD::PhotonContainer *QuickAna :: - photons () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (pimpl->objects->photons(), "photons are defined in this analysis"); - return pimpl->objects->photons(); - } - - - xAOD::TauJetContainer *QuickAna :: - taus () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (pimpl->objects->taus(), "taus are defined in this analysis"); - return pimpl->objects->taus(); - } - - - - xAOD::JetContainer *QuickAna :: - jets () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (pimpl->objects->jets(), "jets are defined in this analysis"); - return pimpl->objects->jets(); - } - - xAOD::JetContainer *QuickAna :: - fat_jets () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (pimpl->objects->fat_jets(), "fat jets are defined in this analysis"); - return pimpl->objects->fat_jets(); - } - - - xAOD::MissingET *QuickAna :: - met () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (pimpl->objects->met(), "met is not defined in this analysis"); - xAOD::MissingET *result = (*pimpl->objects->met())["Final"]; - RCU_ASSERT (result != 0); - return result; - } - - xAOD::MissingET *QuickAna :: - met2 () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (pimpl->objects->met2(), "met2 is not defined in this analysis"); - xAOD::MissingET *result = (*pimpl->objects->met2())["Final"]; - RCU_ASSERT (result != 0); - return result; - } - - - - const std::vector<CP::SystematicSet>& QuickAna :: - systematics () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (toolScheduler != nullptr, "initialize() has been called"); - return toolScheduler->systematics(); - } - - - - StatusCode QuickAna :: - setSystematics (const std::vector<CP::SystematicSet>& val_systematics) - { - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE2 (toolScheduler != nullptr, "initialize() has been called"); - return toolScheduler->setSystematics (val_systematics); - } - - - - EventData QuickAna :: - getEventData () const - { - RCU_READ_INVARIANT (this); - return toolScheduler->getEventData (); - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionChoice.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionChoice.cxx deleted file mode 100644 index 9a095e93ee61971e94ce126277651efe025fe78d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionChoice.cxx +++ /dev/null @@ -1,27 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/SelectionChoice.h> - -// -// method implementations -// - -namespace ana -{ -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionCut.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionCut.cxx deleted file mode 100644 index ce6e763ebd21513319e88e452a3003c0cae93018..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionCut.cxx +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/SelectionCut.h> - -#include <QuickAna/SelectionChoice.h> -#include <QuickAna/SelectionData.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - void SelectionCut :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - } - - - - SelectionCut :: - SelectionCut () - : m_data (nullptr), m_index (0) - { - RCU_NEW_INVARIANT (this); - } - - - - SelectionChoice SelectionCut :: - get () const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (m_data, "cut has been configured"); - return m_data->getCut (m_index); - } - - - - bool SelectionCut :: - getPass () const - { - // no invariant used - return get() != SelectionChoice::FAIL; - } - - - - bool SelectionCut :: - getFail () const - { - // no invariant used - return get() == SelectionChoice::FAIL; - } - - - - void SelectionCut :: - set (SelectionChoice choice) const - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE2 (m_data, "cut has been configured"); - m_data->setCut (m_index, choice); - } - - - - void SelectionCut :: - setPassedIf (bool pass) const - { - // no invariant used - set (pass ? SelectionChoice::PASS : SelectionChoice::FAIL); - } - - - - void SelectionCut :: - setFailedIf (bool fail) const - { - // no invariant used - set (fail ? SelectionChoice::FAIL : SelectionChoice::PASS); - } - - - - void SelectionCut :: - configure (SelectionData *val_data, std::size_t val_index) - { - RCU_CHANGE_INVARIANT (this); - m_data = val_data; - m_index = val_index; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionData.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionData.cxx deleted file mode 100644 index 67d11d3b03aec8af67e3900174ec85cbf82b91de..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionData.cxx +++ /dev/null @@ -1,226 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/SelectionData.h> - -#include <AsgTools/StatusCode.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/SelectionChoice.h> -#include <QuickAna/SelectionCut.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - void SelectionData :: - testInvariant () const - { - RCU_INVARIANT (this != nullptr); - } - - - - SelectionData :: - SelectionData () - : m_state (State::INITIAL), m_particle (nullptr) - { - RCU_NEW_INVARIANT (this); - } - - - - void SelectionData :: - registerCut (SelectionStep step, const std::string& name, - SelectionCut& cut) - { - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (!isInitialized()); - - CutInfo info; - info.step = step; - info.name = name; - m_cuts.push_back (info); - - cut.configure (this, size()-1); - } - - - - std::size_t SelectionData :: - size () const - { - RCU_READ_INVARIANT (this); - return m_cuts.size(); - } - - - - StatusCode SelectionData :: - initialize (const InternalConfiguration& configuration, - const std::string& workingPoint) - { - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (!isInitialized()); - m_state = State::BROKEN; - - // the postfix for the overall selections - std::string postfix; - if (!workingPoint.empty()) - postfix = "_" + workingPoint; - - for (unsigned iter = 0; iter != EnumSize<SelectionStep>::dataSize; ++ iter) - { - SelectionStep step = SelectionStep (iter); - - m_selections[iter].accessor - = configuration.selectionName (step) + postfix; - } - - // the prefix for individual cuts - std::string prefix - = configuration.selectionName (SelectionStep::ANALYSIS) + "_"; - if (!workingPoint.empty()) - prefix += workingPoint + "_"; - - m_firstStep = SelectionStep::ANALYSIS; - for (auto& cut : m_cuts) - { - cut.accessor = prefix + cut.name; - if (cut.step < m_firstStep) - m_firstStep = cut.step; - } - - m_state = State::RUNNING; - RCU_PROVIDE (isInitialized()); - return StatusCode::SUCCESS; - } - - - - bool SelectionData :: - isInitialized () const - { - RCU_READ_INVARIANT (this); - return m_state >= State::RUNNING; - } - - - - StatusCode SelectionData :: - prepare (SG::AuxElement *particle) - { - using namespace msgSelection; - - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (isInitialized()); - m_particle = particle; - - for (auto& cut : m_cuts) - cut.selection = SelectionChoice::UNASSIGNED; - - for (auto& selection : m_selections) - { - if (!selection.accessor.isAvailable (*m_particle)) - { - ANA_MSG_ERROR ("input decoration unavailable: " << (&selection-m_selections)); - return StatusCode::FAILURE; - } - selection.select = selection.accessor (*m_particle); - } - return StatusCode::SUCCESS; - } - - - - bool SelectionData :: - needSelectionTool () - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (isInitialized()); - return m_selections[unsigned (m_firstStep)].select; - } - - - - SelectionChoice SelectionData :: - getCut (std::size_t cut) - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (isInitialized()); - RCU_REQUIRE (cut < size()); - return m_cuts[cut].selection; - } - - - - void SelectionData :: - setCut (std::size_t cut, SelectionChoice choice) - { - RCU_READ_INVARIANT (this); - RCU_REQUIRE (isInitialized()); - RCU_REQUIRE (cut < size()); - m_cuts[cut].selection = choice; - } - - - - void SelectionData :: - apply () - { - RCU_CHANGE_INVARIANT (this); - RCU_REQUIRE (isInitialized()); - - for (auto& cut : m_cuts) - { - cut.accessor (*m_particle) = (cut.selection == SelectionChoice::PASS); - if (cut.selection == SelectionChoice::FAIL) - { - for (std::size_t iter = std::size_t (cut.step), - end = EnumSize<SelectionStep>::dataSize; - iter != end; ++ iter) - { - m_selections[iter].select = false; - } - } - } - - for (auto& selection : m_selections) - { - selection.accessor (*m_particle) = selection.select; - } - } - - - - SelectionData::CutInfo :: - CutInfo () - : accessor ("dummy") - {} - - - - SelectionData::SelectionInfo :: - SelectionInfo () - : accessor ("dummy"), - select(false) // TODO is this the right default value to use?? - {} -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionStep.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionStep.cxx deleted file mode 100644 index 00a63cde1a07fb634129caf3c35cdb3b604aa7c5..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/SelectionStep.cxx +++ /dev/null @@ -1,27 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/SelectionStep.h> - -// -// method implementations -// - -namespace ana -{ -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/SusyORTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/SusyORTool.cxx deleted file mode 100644 index 90e05e93a2f82428f3516f85de69f18438aa66f7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/SusyORTool.cxx +++ /dev/null @@ -1,253 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// -// includes -// - -#include <QuickAna/SusyORTool.h> - -// CP OR Tools -#include <AssociationUtils/EleMuSharedTrkOverlapTool.h> -#include <AssociationUtils/EleJetOverlapTool.h> -#include <AssociationUtils/MuJetOverlapTool.h> -#include <AssociationUtils/AltMuJetOverlapTool.h> -#include <AssociationUtils/DeltaROverlapTool.h> - -// Local package includes -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> - -// Same helper function as OR tool in an anonymous namespace -namespace -{ - - //--------------------------------------------------------------------------- - // Helper function to create and pre-configure one overlap tool - //--------------------------------------------------------------------------- - template<class ToolType, class HandleType> - StatusCode preConfigTool(HandleType& handle, - const std::string& inLabel) - //const std::string& outLabel) - { - using namespace ana::msgObjectDefinition; - - ANA_CHECK( ASG_MAKE_ANA_TOOL(handle, ToolType) ); - ANA_CHECK( handle.setProperty("InputLabel", inLabel) ); - //ANA_CHECK( handle.setProperty("OutputLabel", outLabel) ); // keep "overlaps" - //ANA_CHECK( handle.setProperty("OutputLevel", MSG::DEBUG) ); - - // The tool will assign 'true' to objects that pass overlap removal. - // Disabling for now, in favor of post-processing. - //static const bool outPassVal = true; - //ANA_CHECK( handle.setProperty("OutputPassValue", outPassVal) ); - - return StatusCode::SUCCESS; - } - -} - - -// -// method implementations -// - -namespace ana -{ - SusyORTool :: - SusyORTool(const std::string& name) - : AsgTool(name), AnaTool(name), - m_eleMuTool ("EleMuORT", this), - m_eleJetTool ("EleJetORT", this), - m_muJetTool ("MuJetORT", this), - m_phoEleTool ("PhoEleORT", this), - m_phoJetTool ("PhoJetORT", this) - { - declareProperty("ORInputLabel", m_orInputLabel = "dummy"); - declareProperty("OROutputLabel", m_orOutputLabel = "dummy"); - declareProperty("BJetLabel", m_bJetLabel = "bjet_OR"); - declareProperty("CustomMuons", m_customMuons = false); - } - - - - StatusCode SusyORTool :: - setObjectType(ObjectType type, const std::string& workingPoint) - { - if (type != OBJECT_OVERLAP_REMOVAL) { - ATH_MSG_ERROR("unsupported object type"); - return StatusCode::FAILURE; - } - if (!workingPoint.empty()) { - ATH_MSG_ERROR("can't have working point for overlap removal tool"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - StatusCode SusyORTool :: - initialize() - { - ATH_MSG_INFO("initialize"); - - // Initialize the decoration helper. - // Might not need this now, but let's try with it in first. - const bool outPassVal = false; /*true;*/ // back to default for now. - m_decHelper = - std::make_unique<ORUtils::OverlapDecorationHelper> - (m_orInputLabel, "overlaps", outPassVal); - // Make sure the output pass value is set to TRUE! - - // Configure the individual overlap tools - - // Electron-muon - ATH_CHECK( preConfigTool<ORUtils::EleMuSharedTrkOverlapTool> - (m_eleMuTool, m_orInputLabel) ); - ATH_CHECK( m_eleMuTool.initialize() ); - - // Electron-jet - ATH_CHECK( preConfigTool<ORUtils::EleJetOverlapTool> - (m_eleJetTool, m_orInputLabel) ); - ANA_CHECK( m_eleJetTool.setProperty("BJetLabel", m_bJetLabel) ); - ATH_CHECK( m_eleJetTool.initialize() ); - - // Muon-jet - if (!m_customMuons) - { - ATH_CHECK( preConfigTool<ORUtils::MuJetOverlapTool> - (m_muJetTool, m_orInputLabel) ); - } else { - ATH_CHECK( preConfigTool<ORUtils::AltMuJetOverlapTool> - (m_muJetTool, m_orInputLabel) ); - ANA_CHECK( m_muJetTool.setProperty("BJetLabel", m_bJetLabel) ); - ANA_CHECK( m_muJetTool.setProperty("SlidingDRMaxCone", 0.4) ); - } - ATH_CHECK( m_muJetTool.initialize() ); - - // Photon-electron - ATH_CHECK( preConfigTool<ORUtils::DeltaROverlapTool> - (m_phoEleTool, m_orInputLabel) ); - ATH_CHECK( m_phoEleTool.initialize() ); - - // Photon-jet - ATH_CHECK( preConfigTool<ORUtils::DeltaROverlapTool> - (m_phoJetTool, m_orInputLabel) ); - ATH_CHECK( m_phoJetTool.initialize() ); - - // No need for a master tool - doing the OR by hand :-) - return StatusCode::SUCCESS; - } - - //--------------------------------------------------------------------------- - // Scheduling boiler plate methods - //--------------------------------------------------------------------------- - AnalysisStep SusyORTool :: - step() const { return STEP_OVERLAP_REMOVAL; } - //--------------------------------------------------------------------------- - unsigned SusyORTool :: - inputTypes() const - { - return (1 << OBJECT_ELECTRON) | (1 << OBJECT_MUON) | (1 << OBJECT_JET) | - (1 << OBJECT_TAU) | (1 << OBJECT_PHOTON); - } - //--------------------------------------------------------------------------- - unsigned SusyORTool :: - outputTypes() const { return inputTypes(); } // Same as input types - - //--------------------------------------------------------------------------- - // Execute the overlap removal - //--------------------------------------------------------------------------- - StatusCode SusyORTool :: - execute(IEventObjects& objects) - { - // Reset all decorations to passing - if(objects.electrons()) m_decHelper->resetDecorations(*objects.electrons()); - if(objects.muons()) m_decHelper->resetDecorations(*objects.muons()); - if(objects.jets()) m_decHelper->resetDecorations(*objects.jets()); - if(objects.photons()) m_decHelper->resetDecorations(*objects.photons()); - - // Very specific order... - if (objects.electrons() && objects.jets()) { - ATH_CHECK( m_eleJetTool->findOverlaps(*objects.electrons(), - *objects.jets()) ); - } - if (objects.muons() && objects.jets()) { - ATH_CHECK( m_muJetTool->findOverlaps(*objects.muons(), - *objects.jets()) ); - } - if (objects.electrons() && objects.muons()) { - ATH_CHECK( m_eleMuTool->findOverlaps(*objects.electrons(), - *objects.muons()) ); - } - if (objects.photons()) { - if (objects.electrons()){ - ATH_CHECK( m_phoEleTool->findOverlaps(*objects.photons(), - *objects.electrons()) ); - } - if (objects.jets()) { - ATH_CHECK( m_phoJetTool->findOverlaps(*objects.jets(), - *objects.photons()) ); - } - } - - // - // Post-processing - // if "overlaps" is 1, set selection flag to 0 - // - - SG::AuxElement::Accessor<SelectType> selectAcc(m_orOutputLabel); - SG::AuxElement::ConstAccessor<SelectType> overlapAcc("overlaps"); - - if (objects.electrons()) { - for(auto electron : *(objects.electrons())) { - if (overlapAcc(*electron)) selectAcc(*electron) = false; - } - } - if (objects.muons()) { - for(auto muon : *(objects.muons())) { - if (overlapAcc(*muon)) selectAcc(*muon) = false; - } - } - if (objects.jets()) { - for(auto jet : *(objects.jets())) { - if (overlapAcc(*jet)) selectAcc(*jet) = false; - } - } - if (objects.photons()) { - for(auto photon : *(objects.photons())) { - if (overlapAcc(*photon)) selectAcc(*photon) = false; - } - } - - return StatusCode::SUCCESS; - } - - - - StatusCode makeORTool(DefinitionArgs& args, - bool customMuons=false) - { - using namespace msgObjectDefinition; - - std::unique_ptr<SusyORTool> orTool - ( new SusyORTool(args.prefix()) ); - ANA_CHECK( orTool->setProperty - ("ORInputLabel", args.configuration()->selectionName(SelectionStep::OR)) ); - ANA_CHECK( orTool->setProperty - ("OROutputLabel", args.configuration()->selectionName(SelectionStep::ANALYSIS)) ); - ANA_CHECK( orTool->setProperty - ("CustomMuons", customMuons) ); - args.add( std::move(orTool) ); - - return StatusCode::SUCCESS; - } - - QUICK_ANA_OR_DEFINITION_MAKER( "susy", makeORTool(args) ) - QUICK_ANA_OR_DEFINITION_MAKER( "susy2L", makeORTool(args,true) ) -} // namespace ana diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/TauTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/TauTool.cxx deleted file mode 100644 index e44ab57b03062979a677948e2b167b9dfa3f6544..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/TauTool.cxx +++ /dev/null @@ -1,331 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/TauTool.h> - -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/MessageCheck.h> -#include <TauAnalysisTools/TauEfficiencyCorrectionsTool.h> -#include <TauAnalysisTools/TauSelectionTool.h> -#include <TauAnalysisTools/TauSmearingTool.h> -#include <TauAnalysisTools/TauTruthMatchingTool.h> -#include <TauAnalysisTools/TauTruthTrackMatchingTool.h> - -namespace -{ - /// Defining hardcoded name for the TauSelectionTool in one place - const std::string tauSelectionToolName = "QA_TauSelectionTool"; -} - -// -// method implementations -// - -namespace ana -{ - - //--------------------------------------------------------------------------- - // TauToolCorrect - //--------------------------------------------------------------------------- - - // Constructor - TauToolCorrect :: - TauToolCorrect (const std::string& name) - : AsgTool(name), AnaToolCorrect<xAOD::TauJetContainer>(name), - m_smearTool ("TauSmearingTool", this) - { - } - - - // Initialization - StatusCode TauToolCorrect :: - initialize() - { - ATH_MSG_DEBUG( "Initializing " << name() ); - - // Initialize the CP smearing tool - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_smearTool, TauAnalysisTools::TauSmearingTool)); - // The twiki is unclear about whether we should be doing this now - //ATH_CHECK( m_smearTool.setProperty("ApplyMVATES", true) ); - ATH_CHECK( m_smearTool.initialize() ); - registerTool(&*m_smearTool); - - registerCut(SelectionStep::MET, "smear_tool", cut_smear_tool); - - return StatusCode::SUCCESS; - } - - - // Object correction - StatusCode TauToolCorrect :: - correctObject (xAOD::TauJet& tau) - { - ATH_MSG_DEBUG("correctObject"); - - // TODO: evaluate if this is still necessary. - // (Maybe temporary) workaround to suppress smearing tool warnings: - // consider only taus with nTracks > 0. I count this in the smear_tool cut - // because in principle it should be handled as an OutOfValidityRange code. - if(tau.nTracks() > 0) { - QA_CHECK_CUT( cut_smear_tool, m_smearTool->applyCorrection(tau) ); - } - else cut_smear_tool.setFailedIf(true); - - return StatusCode::SUCCESS; - } - - - //--------------------------------------------------------------------------- - // TauToolSelect - //--------------------------------------------------------------------------- - - // Constructor - TauToolSelect :: - TauToolSelect (const std::string& name) - : AsgTool(name), AnaToolSelect<xAOD::TauJetContainer>(name), - m_configFile("QuickAna/tau_selection_medium.conf"), - // Using public tool here so I can configure the tau SF tool :( - m_selectionTool(tauSelectionToolName) - //m_selectionTool("TauSelectionTool", this) - { - declareProperty("ConfigFile", m_configFile); - } - - - // Initialization - StatusCode TauToolSelect :: - initialize() - { - ATH_MSG_DEBUG( "Initializing " << name() ); - - // Tau selection recommendations from: - // https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/TauRecommendationsSummer2016#Tau_Selection_unchanged_since_20 - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_selectionTool, TauAnalysisTools::TauSelectionTool)); - ATH_CHECK( m_selectionTool.setProperty("ConfigPath", m_configFile) ); - ATH_CHECK( m_selectionTool.initialize() ); - - registerCut(SelectionStep::MET, "selection_step", m_selectionToolCut); - - return StatusCode::SUCCESS; - } - - - // Object selection - StatusCode TauToolSelect :: - selectObject (xAOD::TauJet& tau) - { - ATH_MSG_DEBUG("selectObject"); - m_selectionToolCut.setPassedIf( m_selectionTool->accept(tau) ); - return StatusCode::SUCCESS; - } - - - //--------------------------------------------------------------------------- - // TauToolWeight - //--------------------------------------------------------------------------- - - // Constructor - TauToolWeight :: - TauToolWeight (const std::string& name) - : AsgTool(name), AnaToolWeight<xAOD::TauJetContainer>(name), - //m_configFile("QuickAna/tau_selection_medium.conf"), - m_selectionTool(tauSelectionToolName), - m_effTool("TauEfficiencyCorrectionsTool", this) - { - //declareProperty("ConfigFile", m_configFile); - } - - - // Initialization - StatusCode TauToolWeight :: - initialize() - { - ATH_MSG_DEBUG( "Initializing " << name() ); - - // Need to retrieve the (hopefully) already created TauSelectionTool. - // There's probably some way to check that I'm retrieving the proper one - // already initialized, but I'm not sure what's the best approach. - ATH_CHECK( m_selectionTool.retrieve() ); - - // The TauEfficiencyCorrectionsTool doesn't make this easy without using - // a public TauSelectionTool, so I'm just going to parse what I need - // from the tau ID config file. - //TEnv confEnv; - //auto confPath = PathResolverFindCalibFile(m_configFile); - //confEnv.ReadFile(confPath.c_str(), kEnvAll); - - // Initialize the CP efficiency tool - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_effTool, TauAnalysisTools::TauEfficiencyCorrectionsTool)); - ATH_CHECK( m_effTool.setProperty("TauSelectionTool", m_selectionTool) ); - ATH_CHECK( m_effTool.initialize() ); - registerTool(&*m_effTool); - - // Temporary bugfix for NULL pointer - //ANA_CHECK( m_effTool->applySystematicVariation(CP::SystematicSet()) ); - - return StatusCode::SUCCESS; - } - - - // Object weighting - StatusCode TauToolWeight :: - objectWeight (const xAOD::TauJet& tau, float& weight) - { - ATH_MSG_DEBUG("objectWeight"); - weight = 1; - QA_CHECK_WEIGHT - ( double, weight, m_effTool->getEfficiencyScaleFactor(tau, weight) ); - return StatusCode::SUCCESS; - } - - - - //--------------------------------------------------------------------------- - // TauToolTruth - //--------------------------------------------------------------------------- - - // Constructor - TauToolTruth :: - TauToolTruth(const std::string& name) - : AsgTool(name), AnaTool(name), - m_lastEventNumber(0), - m_truthTool("TauTruthMatchingTool", this) - { - declareProperty("WriteTruthTaus", m_writeTruthTaus=true); - } - - // Set object type - StatusCode TauToolTruth :: - setObjectType(ObjectType type, const std::string& workingPoint) - { - if(type != OBJECT_TAU) { - ATH_MSG_ERROR("unsupported object type"); - return StatusCode::FAILURE; - } - if(!workingPoint.empty()) { - ATH_MSG_ERROR("working points not supported by TauToolTruth"); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - // Analysis step - AnalysisStep TauToolTruth::step() const - { return STEP_PRECORRECT; } - - // Input and output types. EventInfo just used to get event number. - unsigned TauToolTruth::inputTypes() const - { return (1 << OBJECT_TAU) | (1 << OBJECT_EVENTINFO); } - unsigned TauToolTruth::outputTypes() const - { return 1 << OBJECT_TAU; } - - - // Initialization - StatusCode TauToolTruth :: - initialize() - { - ATH_MSG_DEBUG("initialize"); - ATH_CHECK( ASG_MAKE_ANA_TOOL(m_truthTool, TauAnalysisTools::TauTruthMatchingTool) ); - ATH_CHECK( m_truthTool.setProperty("WriteTruthTaus", m_writeTruthTaus) ); - ATH_CHECK( m_truthTool.initialize() ); - return StatusCode::SUCCESS; - } - - // Execute - StatusCode TauToolTruth::execute(IEventObjects& objects) - { - ATH_MSG_DEBUG("execute"); - - // Prepare the truth tool once for each event. - // To ensure this is only called once per event (default scheduler), - // we look for a change in the event number. If EventInfo definition is - // "none", though, the pointer will be null, in which case we just retrieve - // it directly from the event store. - //const xAOD::EventInfo* evtInfo = objects.eventinfo(); - //if(!evtInfo) { - // ATH_CHECK( evtStore()->retrieve(evtInfo, "EventInfo") ); - //} - //auto currentEventNumber = evtInfo->eventNumber(); - //if(m_lastEventNumber != currentEventNumber) { - // ATH_CHECK( m_truthTool->initializeEvent() ); - // m_lastEventNumber = currentEventNumber; - //} - - // Perform truth matching for every tau. Probably overkill. - for(auto tau : *objects.taus()) { - m_truthTool->applyTruthMatch(*tau); - } - return StatusCode::SUCCESS; - } - - - //--------------------------------------------------------------------------- - // Maker function for tau tools. - //--------------------------------------------------------------------------- - StatusCode makeTauTool(DefinitionArgs& args, const std::string& configFile) - { - using namespace msgObjectDefinition; - using std::make_unique; - - // Input tau container name - const std::string inputContainer = "TauJets"; - bool isData = args.configuration()->isData(); - - // Retrieval tool - auto retrieveTool = - make_unique<AnaToolRetrieve>(args.prefix() + "_retrieve", inputContainer); - args.add( std::move(retrieveTool) ); - - // Truth-matching tool - only for MC - if(!isData) { - auto truthMatchTool = - make_unique<TauToolTruth>(args.prefix() + "_truthMatch"); - args.add( std::move(truthMatchTool) ); - } - - // Correction tool - auto correctTool = make_unique<TauToolCorrect>(args.prefix() + "_correct"); - args.add( std::move(correctTool) ); - - // Selection tool - auto selectTool = make_unique<TauToolSelect>(args.prefix() + "_select"); - ANA_CHECK( selectTool->setProperty("ConfigFile", configFile) ); - args.add( std::move(selectTool) ); - - // Weight tool - only for MC - if(!isData) { - auto weightTool = make_unique<TauToolWeight>(args.prefix() + "_weight"); - //ANA_CHECK( weightTool->setProperty("ConfigFile", configFile) ); - args.add( std::move(weightTool) ); - } - - return StatusCode::SUCCESS; - } - - // Define the maker wrapper functions with these macros - QUICK_ANA_TAU_DEFINITION_MAKER - ( "default", makeTauTool(args, "QuickAna/tau_selection_medium.conf") ) - QUICK_ANA_TAU_DEFINITION_MAKER - ( "loose", makeTauTool(args, "QuickAna/tau_selection_loose.conf") ) - QUICK_ANA_TAU_DEFINITION_MAKER - ( "tight", makeTauTool(args, "QuickAna/tau_selection_tight.conf") ) - -} // namespace ana diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/ToolScheduler.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/ToolScheduler.cxx deleted file mode 100644 index e55592abc8e6b128cb21ea873c41b659f8ffa3ea..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/ToolScheduler.cxx +++ /dev/null @@ -1,224 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/ToolScheduler.h> - -#include <PATInterfaces/SystematicSet.h> -#include <QuickAna/EventData.h> -#include <QuickAna/IAnaTool.h> -#include <RootCoreUtils/Assert.h> - -// -// method implementations -// - -namespace ana -{ - void ToolScheduler :: - testInvariant () const - { - RCU_INVARIANT (this != 0); - } - - - - ToolScheduler :: - ToolScheduler (const std::string& name) - : AsgTool (name) - { - RCU_NEW_INVARIANT (this); - } - - - - ToolScheduler :: - ~ToolScheduler () - { - RCU_DESTROY_INVARIANT (this); - } - - - - StatusCode ToolScheduler :: - initialize() - { - RCU_CHANGE_INVARIANT (this); - ATH_MSG_DEBUG("initialize"); - m_systematics.push_back (CP::SystematicSet ()); - return StatusCode::SUCCESS; - } - - - - StatusCode ToolScheduler :: - addTool (std::unique_ptr<IAnaTool> tool) - { - RCU_CHANGE_INVARIANT (this); - m_tools.push_back (std::move (tool)); - return StatusCode::SUCCESS; - } - - - - CP::SystematicSet ToolScheduler :: - affectingSystematics () const - { - RCU_READ_INVARIANT (this); - - CP::SystematicSet result; - for (auto& tool : m_tools) - { - result.insert (tool->affectingSystematics()); - } - return result; - } - - - - CP::SystematicSet ToolScheduler :: - recommendedSystematics () const - { - RCU_READ_INVARIANT (this); - - CP::SystematicSet result; - for (auto& tool : m_tools) - { - result.insert (tool->recommendedSystematics()); - } - return result; - } - - - - StatusCode ToolScheduler :: - applySystematicVariation (const CP::SystematicSet& systConfig) - { - RCU_CHANGE_INVARIANT (this); - - for (auto& tool : m_tools) - { - if (tool->applySystematicVariation (systConfig) != - CP::SystematicCode::Ok) - return StatusCode::FAILURE; - } - m_postfix = systConfig.name(); - return StatusCode::SUCCESS; - } - - - - StatusCode ToolScheduler :: - fillEventObjects (IEventObjects*& objects) - { - RCU_CHANGE_INVARIANT (this); - ATH_MSG_DEBUG("fillEventObjects"); - - m_objects.clear (&*evtStore(), m_postfix); - for (unsigned iter = 0; iter <= STEP_WEIGHT; ++ iter) - { - ATH_MSG_DEBUG("Executing step: " << iter); - for (auto& tool : m_tools) - { - if (tool->step() == iter) - { - ATH_MSG_DEBUG("Executing tool: " << tool->name()); - try - { - ATH_CHECK (tool->execute (m_objects)); - if (tool->outputTypes() & (1 << OBJECT_EVENT_SELECT)) - { - auto select = m_objects.eventSelect(); - if (select && - select->auxdata<ana::SelectType> ("ana_select") == false) - { - objects = &m_objects; - return StatusCode::SUCCESS; - } - } - } catch (std::exception& e) - { - ATH_MSG_FATAL ("exception while executing tool " << tool->name() << - ": " << e.what()); - return StatusCode::FAILURE; - } catch (std::string& s) - { - ATH_MSG_FATAL ("exception while executing tool " << tool->name() << - ": " << s); - return StatusCode::FAILURE; - } catch (...) - { - ATH_MSG_FATAL ("unknown exception while executing tool " << tool->name()); - return StatusCode::FAILURE; - } - } - } - } - objects = &m_objects; - return StatusCode::SUCCESS; - } - - - - const std::vector<CP::SystematicSet>& ToolScheduler :: - systematics () const - { - RCU_READ_INVARIANT (this); - return m_systematics; - } - - - - StatusCode ToolScheduler :: - setSystematics (const std::vector<CP::SystematicSet>& val_systematics) - { - RCU_CHANGE_INVARIANT (this); - m_systematics = val_systematics; - return StatusCode::SUCCESS; - } - - - - EventData ToolScheduler :: - getEventData () const - { - RCU_READ_INVARIANT (this); - EventData result; - - for (unsigned typeIter = 0; typeIter < EnumSize<ObjectType>::dataSize; ++ typeIter) - { - const ObjectType type = ObjectType (typeIter); - bool hasType = false; - for (auto& tool : m_tools) - { - if (tool->outputTypes() & (1 << type)) - hasType = true; - } - if (hasType) - { - for (auto& sys : m_systematics) - { - std::string anaName = "ana_" + ObjectTypeInfo::name[type] + "_" + sys.name(); - result.setName (type, sys, anaName); - } - } - } - for (auto& tool : m_tools) - tool->fillEventDataSource (result); - return result; - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/TopElectronTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/TopElectronTool.cxx deleted file mode 100644 index 7e2d488782759edfbea07e7ba003c75b56a4ae52..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/TopElectronTool.cxx +++ /dev/null @@ -1,284 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// includes -// - -#include <QuickAna/TopElectronTool.h> - -#include <ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h> -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/ElectronTool.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/IsolationTools.h> -#include <QuickAna/MessageCheck.h> - -// -// method implementations -// - -namespace ana -{ - //-------------------------------------------------------------------------- - // TopElectronToolPreCorrect - //-------------------------------------------------------------------------- - - TopElectronToolPreCorrect :: - TopElectronToolPreCorrect (const std::string& name) - : AsgTool(name), AnaToolCorrect<xAOD::ElectronContainer>(name) - { - } - - - AnalysisStep TopElectronToolPreCorrect :: - step () const - { - return STEP_PRECORRECT; - } - - - StatusCode TopElectronToolPreCorrect :: - initialize() - { - return StatusCode::SUCCESS; - } - - - StatusCode TopElectronToolPreCorrect :: - correctObject (xAOD::Electron& electron) - { - // "miniIso" (approximation) - - const xAOD::TrackParticleContainer* tp(0); - ATH_CHECK(evtStore()->retrieve(tp, "InDetTrackParticles") ); - - double iso(0.); - if( // !m_isPrimaryxAOD && - electron.isAvailable<float>("ptvarcone40") ) - { - iso = electron.auxdataConst<float>("ptvarcone40"); - } - else { - if (tp && electron.pt() > 20e3) { // tracks thinned for pt <= 15 GeV in DxAODs - for (const auto* const trkPtr : *tp) - { - if ( electron.nTrackParticles() >= 1 && - electron.trackParticleLink(0).isValid() && - (*electron.trackParticleLink(0)) != nullptr && - trkPtr->p4().DeltaR((*electron.trackParticleLink(0))->p4()) < 1e-3 ) - { - continue; - } - if ( trackSelector(*trkPtr) && - trkPtr->p4().DeltaR(electron.p4()) < 10e3 / electron.pt() ) - { - iso += trkPtr->pt(); - } - } - } - } - - electron.auxdata<float>("miniIso") = iso; - - // z0 wrt primary vertex calculation - - const xAOD::VertexContainer *vertexContainer(0); - ATH_CHECK( evtStore()->retrieve(vertexContainer, "PrimaryVertices" ) ); - - double z0_wrt_pv(-99.); - const xAOD::TrackParticle* eltrk = electron.trackParticle(); - const xAOD::Vertex *pv(0); - for ( const auto* const vtx_itr : *vertexContainer ) - { - if (vtx_itr->vertexType() != xAOD::VxType::VertexType::PriVtx) continue; - else { pv = vtx_itr; break; } - } - if (pv && eltrk) z0_wrt_pv = ( eltrk->z0() + eltrk->vz() ) - pv->z(); - electron.auxdata<float>("z0_wrt_pv") = z0_wrt_pv; - - return StatusCode::SUCCESS; - } - - - bool TopElectronToolPreCorrect::trackSelector(const xAOD::TrackParticle &trk) { - // for reference: - // http://acode-browser2.usatlas.bnl.gov/lxr-rel19/source/atlas/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx?v=release_19_1_3 - unsigned char nb = 0; - trk.summaryValue(nb,xAOD::numberOfBLayerHits); - unsigned char np = 0; - unsigned char npd = 0; - trk.summaryValue(np,xAOD::numberOfPixelHits); - trk.summaryValue(npd,xAOD::numberOfPixelDeadSensors); - unsigned char ns = 0; - unsigned char nsd = 0; - trk.summaryValue(ns,xAOD::numberOfSCTHits); - trk.summaryValue(nsd,xAOD::numberOfSCTDeadSensors); - unsigned char nss = 0; - trk.summaryValue(nss,xAOD::numberOfSCTSharedHits); - - //ATH_MSG_INFO ("pt, eta, nSi, nSiHoles, nPixHoles = " << trk.pt() << ", " << trk.eta() << ", " << ns+nsd+np+npd << ", " << nsd+npd << ", " << (int) npd); - // for Loose in https://svnweb.cern.ch/trac/atlasoff/browser/InnerDetector/InDetRecTools/InDetTrackSelectionTool/trunk/Root/InDetTrackSelectionTool.cxx - if (trk.pt() > 400 && - std::fabs(trk.eta()) < 2.5 && - ns+nsd+np+npd >= 7 && - nsd+npd <= 2 && - npd <= 1) - return true; - return false; - } - - - //-------------------------------------------------------------------------- - // TopElectronToolSelect - //-------------------------------------------------------------------------- - - TopElectronToolSelect :: - TopElectronToolSelect(const std::string &name) - : AsgTool(name), AnaToolSelect<xAOD::ElectronContainer>(name) - { - declareProperty("IDString", m_idStr = "LHTight" ); - declareProperty("PtMin", m_ptMin = 25.e3 ); - declareProperty("EtaMax", m_etaMax = 2.47 ); - declareProperty("VetoCrack", m_vetoCrack = true ); - declareProperty("Z0Cut", m_z0cut = -1. ); - - // declareProperty("AsgElectronLikelihoodTool", m_likelihood = nullptr); - } - - - StatusCode TopElectronToolSelect :: - initialize() - { - registerCut (SelectionStep::MET, "author", cut_author); - registerCut (SelectionStep::MET, "pt", cut_pt); - registerCut (SelectionStep::MET, "id", cut_id); - registerCut (SelectionStep::MET, "etaMax", cut_etaMax); - registerCut (SelectionStep::MET, "etaCrack", cut_etaCrack); - registerCut (SelectionStep::MET, "z0", cut_z0); - registerCut (SelectionStep::MET, "isolation", cut_isolation); - - return StatusCode::SUCCESS; - } - - - StatusCode TopElectronToolSelect :: - selectObject (xAOD::Electron& electron) - { - /*cut_author.setPassedIf - (electron.author() == xAOD::EgammaParameters::AuthorElectron || - electron.author() == xAOD::EgammaParameters::AuthorSofte);*/ - - cut_pt.setPassedIf (electron.pt() > m_ptMin); - - // Apply selection tool. See comments in ElectronToolPreCorrect. - - // The naming convention in derivation framework is different - std::string idStr_DFCommon = m_idStr.find("LH") != std::string::npos ? - "DFCommonElectrons"+m_idStr : - "DFCommonElectronsIsEM"+m_idStr; - - if (electron.isAvailable<SelectType>("QuickAna_"+m_idStr)) - { - cut_id.setPassedIf (electron.auxdataConst<SelectType>("QuickAna_"+m_idStr)); - } - else if (electron.isAvailable<int>(idStr_DFCommon)) - { - cut_id.setPassedIf (electron.auxdataConst<int>(idStr_DFCommon)); - } - else - { - cut_id.setPassedIf (electron.passSelection(m_idStr)); - } - - // WARNING: Not all electrons keep clusters in the derivation - // But "good" electrons should always have a cluster. Therefore, - // move the calo cluster cut after the likelihood cut - if (electron.caloCluster()) // protect against missing calo clusters in first round DxAODs - { - double cluster_eta = electron.caloCluster()->etaBE(2); - cut_etaMax.setPassedIf (std::fabs(cluster_eta) < m_etaMax); - cut_etaCrack.setFailedIf ( m_vetoCrack && - std::fabs(cluster_eta) > 1.37 && - std::fabs(cluster_eta) < 1.52 ); - } - - // Requirements on longitudinal impact parameter - if (m_z0cut>0) - { - float z0 = electron.auxdataConst<float>("z0_wrt_pv"); - cut_z0.setPassedIf (std::fabs(z0) < m_z0cut); - } - - // isolation, if m_isolation != nullptr - cut_isolation.setFailedIf (m_isolation && !m_isolation->passSelection(electron)); - - return StatusCode::SUCCESS; - } - - - StatusCode makeTopElectronTool (DefinitionArgs& args, - const std::string& idStr, - IsolationBase* isolation, - double z0cut, - bool vetoCrack) - { - using namespace msgObjectDefinition; - - const std::string inputContainer = "Electrons"; - // Retrieval tool - std::unique_ptr<IAnaTool> retrieveTool - ( new AnaToolRetrieve(args.prefix() + "_retrieve", inputContainer) ); - args.add( std::move(retrieveTool) ); - - // Pre Correction tool - std::unique_ptr<IAnaTool> precorrectTool - ( new TopElectronToolPreCorrect(args.prefix() + "_precorrect") ); - args.add( std::move(precorrectTool) ); - - // Correction tool - std::unique_ptr<IAnaTool> correctTool - (new ElectronToolCorrect (args.prefix() + "_correct")); - args.add (std::move (correctTool)); - - // Selection tool - std::unique_ptr<TopElectronToolSelect> selectTool - ( new TopElectronToolSelect(args.prefix() + "_select") ); - ANA_CHECK( selectTool->setProperty("IDString", idStr) ); - selectTool->m_isolation.reset(isolation); - ANA_CHECK( selectTool->setProperty("Z0Cut", z0cut) ); - ANA_CHECK( selectTool->setProperty("VetoCrack", vetoCrack) ); - - args.add( std::move(selectTool) ); - - if (args.configuration()->isData() == false) - { - // Weight tool - std::unique_ptr<IAnaTool> weightTool - ( new ElectronToolWeight(args.prefix() + "_weight") ); - args.add( std::move(weightTool) ); - } - - return StatusCode::SUCCESS; - } - - // Note: cluster_eta cut disabled in top default, as in - // TopObjectSelectionTools-00-00-54 - // -- Reason for that: electron cluster info missing in Round 1 DxAODs - // -- fixed in TopObjectSelectionTools-00-00-56 - - // Define the wrapper functions with these macros - QUICK_ANA_ELECTRON_DEFINITION_MAKER( "top_MMtight", - makeTopElectronTool(args, "LHMedium", new StandardIsolation("Electron")) ) - // loose not exactly the Run 2 top "default". well, doesn't matter for many - // reasons. will remove IsolationTools soon anyway - QUICK_ANA_ELECTRON_DEFINITION_MAKER( "top_MMloose", - makeTopElectronTool(args, "LHLoose") ) - QUICK_ANA_ELECTRON_DEFINITION_MAKER( "SSbjets_MMtight", - makeTopElectronTool(args, "Tight", new ApproxPTVarCone(0.05, -1.), 2) ) - QUICK_ANA_ELECTRON_DEFINITION_MAKER( "SSbjets_MMloose", - makeTopElectronTool(args, "Medium", nullptr, 2) ) -} // namespace ana diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/TopMuonTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/TopMuonTool.cxx deleted file mode 100644 index 7be6da4e5278d043ba5be5c165740dcdce8a9cba..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/TopMuonTool.cxx +++ /dev/null @@ -1,269 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// includes -// - -#include <QuickAna/TopMuonTool.h> - -#include <MuonSelectorTools/MuonSelectionTool.h> -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/InternalConfiguration.h> -#include <QuickAna/IsolationTools.h> -#include <QuickAna/MuonTool.h> - -// -// method implementations -// - -namespace ana -{ - TopMuonToolPreCorrect :: - TopMuonToolPreCorrect (const std::string& name) - : AsgTool (name), AnaToolCorrect<xAOD::MuonContainer> (name) - { - } - - - - AnalysisStep TopMuonToolPreCorrect :: - step () const - { - return STEP_PRECORRECT; - } - - - - StatusCode TopMuonToolPreCorrect :: - initialize() - { - return StatusCode::SUCCESS; - } - - - - StatusCode TopMuonToolPreCorrect :: - correctObject (xAOD::Muon& muon) - { - // "miniIso" (approximation) - - const xAOD::TrackParticleContainer* tp(0); - ATH_CHECK(evtStore()->retrieve(tp, "InDetTrackParticles") ); - - double iso(0.); - if ( // !m_isPrimaryxAOD && - muon.isAvailable<float>("ptvarcone40") ) - { - iso = muon.auxdataConst<float>("ptvarcone40"); - } - else - { - if (tp && muon.pt() > 20e3) { // tracks thinned for pt <= 15 GeV in DxAODs - for (const auto* const trkPtr : *tp) - { - if ( muon.inDetTrackParticleLink().isValid() && - (muon.inDetTrackParticleLink() != nullptr) && - trkPtr->p4().DeltaR((*muon.inDetTrackParticleLink())->p4()) < 1e-3 ) - { - continue; - } - if ( trackSelector(*trkPtr) && - trkPtr->p4().DeltaR(muon.p4()) < 10e3 / muon.pt() ) - { - iso += trkPtr->pt(); - } - } - } - } - - muon.auxdata<float>("miniIso") = iso; - - // z0 wrt primary vertex calculation - - const xAOD::VertexContainer *vertexContainer(0); - ATH_CHECK( evtStore()->retrieve(vertexContainer, "PrimaryVertices" ) ); - - float z0_wrt_pv(-99.); - const xAOD::TrackParticle* mutrk = muon.primaryTrackParticle(); - const xAOD::Vertex *pv(0); - for ( const auto* const vtx_itr : *vertexContainer ) - { - if (vtx_itr->vertexType() != xAOD::VxType::VertexType::PriVtx) continue; - else { pv = vtx_itr; break;} - } - if (pv && mutrk) z0_wrt_pv = ( mutrk->z0() + mutrk->vz() ) - pv->z(); - muon.auxdata<float>("z0_wrt_pv") = z0_wrt_pv; - - return StatusCode::SUCCESS; - } - - - - bool TopMuonToolPreCorrect::trackSelector(const xAOD::TrackParticle &trk) { - // for reference: - // http://acode-browser2.usatlas.bnl.gov/lxr-rel19/source/atlas/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx?v=release_19_1_3 - unsigned char nb = 0; - trk.summaryValue(nb,xAOD::numberOfBLayerHits); - unsigned char np = 0; - unsigned char npd = 0; - trk.summaryValue(np,xAOD::numberOfPixelHits); - trk.summaryValue(npd,xAOD::numberOfPixelDeadSensors); - unsigned char ns = 0; - unsigned char nsd = 0; - trk.summaryValue(ns,xAOD::numberOfSCTHits); - trk.summaryValue(nsd,xAOD::numberOfSCTDeadSensors); - unsigned char nss = 0; - trk.summaryValue(nss,xAOD::numberOfSCTSharedHits); - - //ATH_MSG_DEBUG ("pt, eta, nSi, nSiHoles, nPixHoles = " << trk.pt() << ", " << trk.eta() << ", " << ns+nsd+np+npd << ", " << nsd+npd << ", " << (int) npd); - // for Loose in https://svnweb.cern.ch/trac/atlasoff/browser/InnerDetector/InDetRecTools/InDetTrackSelectionTool/trunk/Root/InDetTrackSelectionTool.cxx - if (trk.pt() > 400 && - std::fabs(trk.eta()) < 2.5 && - ns+nsd+np+npd >= 7 && - nsd+npd <= 2 && - npd <= 1) - return true; - return false; - } - - - - TopMuonToolSelect :: - TopMuonToolSelect (const std::string& name) - : AsgTool (name), AnaToolSelect<xAOD::MuonContainer> (name), - m_quality (xAOD::Muon::Medium), - m_isolation (nullptr), - m_z0cut (-1.), - m_sd0cut (-1.), - m_selection ("selection", this) - {} - - - - StatusCode TopMuonToolSelect :: - initialize() - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_selection, CP::MuonSelectionTool)); - ATH_CHECK (m_selection.setProperty ("MaxEta", 2.5)); - ATH_CHECK (m_selection.setProperty ("MuQuality", int (m_quality))); - - ATH_CHECK (m_selection.initialize()); - - registerCut (SelectionStep::MET, "selection", cut_selection); - registerCut (SelectionStep::MET, "author", cut_author); - registerCut (SelectionStep::MET, "minPt", cut_minPt); - registerCut (SelectionStep::MET, "maxEta", cut_maxEta); - registerCut (SelectionStep::MET, "z0", cut_z0); - registerCut (SelectionStep::MET, "sd0", cut_sd0); - registerCut (SelectionStep::MET, "isolation", cut_isolation); - - return StatusCode::SUCCESS; - } - - - - StatusCode TopMuonToolSelect :: - selectObject (xAOD::Muon& muon) - { - cut_selection.setPassedIf (m_selection->accept (muon)); - - cut_author.setFailedIf (m_author!=xAOD::Muon::unknown && muon.author() != xAOD::Muon::MuidCo); - - cut_minPt.setPassedIf (muon.pt() > 25.e3); - - //cut_maxEta.setPassedIf (std::fabs(muon.eta()) < 2.5); - - // Additional Hit requirements -- included in MuonSelectionTools - - // Requirements on longitudinal impact parameter - if (m_z0cut>0) - { - float z0 = muon.auxdataConst<float>("z0_wrt_pv"); - cut_z0.setFailedIf (std::fabs(z0) > m_z0cut); - } - - // Requirements on transverse impact parameter - const xAOD::TrackParticle* mutrk = muon.primaryTrackParticle(); - float d0 = mutrk->d0(); - float sigma_d0 = sqrt(mutrk->definingParametersCovMatrix()(0,0)); - float sd0 = 0; - if (sigma_d0 != 0) sd0 = d0/sigma_d0; - - cut_sd0.setFailedIf (m_sd0cut>0 && std::fabs(sd0) > m_sd0cut); - - // isolation, if m_isolation != nullptr - cut_isolation.setFailedIf (m_isolation && !m_isolation->passSelection(muon)); - - return StatusCode::SUCCESS; - } - - - - StatusCode makeTopMuonTool (DefinitionArgs& args, - xAOD::Muon::Quality quality, - xAOD::Muon::Author author, - IsolationBase* isolation, - double z0cut, - double sd0cut) - { - // Retrieval tool - std::unique_ptr<IAnaTool> retrieveTool - (new AnaToolRetrieve (args.prefix() + "_retrieve", "Muons")); - args.add (std::move (retrieveTool)); - - // Pre Correction tool - std::unique_ptr<IAnaTool> precorrectTool - (new TopMuonToolPreCorrect (args.prefix() + "_precorrect")); - args.add (std::move (precorrectTool)); - - // Correction tool - std::unique_ptr<IAnaTool> correctTool - (new MuonToolCorrect (args.prefix() + "_correct")); - args.add (std::move (correctTool)); - - // Selection tool - std::unique_ptr<TopMuonToolSelect> selectTool - (new TopMuonToolSelect (args.prefix() + "_select")); - // To-Do: declare these as properties as in TopElectronTool.cxx - selectTool->m_quality = quality; - selectTool->m_author = author; - selectTool->m_isolation.reset (isolation); - selectTool->m_z0cut = z0cut; - selectTool->m_sd0cut = sd0cut; - args.add (std::move (selectTool)); - - if (args.configuration()->isData() == false) - { - // Weight tool - std::unique_ptr<IAnaTool> weightTool - (new MuonToolWeight (args.prefix() + "_weight")); - args.add (std::move (weightTool)); - } - - return StatusCode::SUCCESS; - } - - // Note: Tight quality doesn't exist yet, use Medium for now - // Note: for some reason the top default doesn't require author to be xAOD::Muon::MuidCo yet - // Note: For some reason the top default doesn't apply isolation on muon yet - // -- Update on 04/24/2015: they are now using StandardIsolation() (in trunk) - - // Macros expand to wrapper functions for making the tools - - QUICK_ANA_MUON_DEFINITION_MAKER ("top_MMtight", makeTopMuonTool (args, xAOD::Muon::Medium, xAOD::Muon::unknown, new StandardIsolation("Muon")) ) - QUICK_ANA_MUON_DEFINITION_MAKER ("top_MMloose", makeTopMuonTool (args, xAOD::Muon::Medium, xAOD::Muon::unknown)) - // Note: sd0 not validated in rel19, to avoid cutting away too much signal, either - // drop it or use a looser cut such as 5 - QUICK_ANA_MUON_DEFINITION_MAKER ("SSbjets_MMtight", makeTopMuonTool (args, xAOD::Muon::Medium, xAOD::Muon::unknown, new ApproxPTVarCone(0.05, -1.), 2)) - QUICK_ANA_MUON_DEFINITION_MAKER ("SSbjets_MMloose", makeTopMuonTool (args, xAOD::Muon::Medium, xAOD::Muon::unknown, nullptr, 2)) - - // Run 1 definitions -- for reference - QUICK_ANA_MUON_DEFINITION_MAKER ("run1-top_MMtight", makeTopMuonTool (args, xAOD::Muon::Tight, xAOD::Muon::MuidCo, new ApproxPTVarCone(0.05, -1.), 2)) - QUICK_ANA_MUON_DEFINITION_MAKER ("run1-top_MMloose", makeTopMuonTool (args, xAOD::Muon::Tight, xAOD::Muon::MuidCo, nullptr, 2)) - QUICK_ANA_MUON_DEFINITION_MAKER ("run1-SSbjets_MMtight", makeTopMuonTool (args, xAOD::Muon::Tight, xAOD::Muon::MuidCo, new ApproxPTVarCone(0.05, -1.), 2, 3)) - QUICK_ANA_MUON_DEFINITION_MAKER ("run1-SSbjets_MMloose", makeTopMuonTool (args, xAOD::Muon::Tight, xAOD::Muon::MuidCo, nullptr, 2, 3)) -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/TopOverlapRemovalTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/TopOverlapRemovalTool.cxx deleted file mode 100644 index 25115d071a9e7129089d31a5a815c65bd9b0c46e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/TopOverlapRemovalTool.cxx +++ /dev/null @@ -1,161 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// Local includes -#include "QuickAna/TopOverlapRemovalTool.h" - -namespace ana -{ - -const float invGeV = 0.001; - -//----------------------------------------------------------------------------- -// Standard constructor -//----------------------------------------------------------------------------- -TopOverlapRemovalTool::TopOverlapRemovalTool(const std::string& name) - : OverlapRemovalTool(name) -{ - // dR cones for defining overlap - declareProperty("ElectronJetDRConeEtaPhi", m_electronJetDREtaPhi = 0.2); - declareProperty("JetElectronDRConeEtaPhi", m_jetElectronDREtaPhi = 0.4); - declareProperty("MuonJetDRConeEtaPhi", m_muonJetDREtaPhi = 0.4); - - declareProperty("MuORJetVariDR", m_muORJetVariDR = false); -} - -//----------------------------------------------------------------------------- -// Destructor -//----------------------------------------------------------------------------- -TopOverlapRemovalTool::~TopOverlapRemovalTool() -{ -} - -//----------------------------------------------------------------------------- -// Remove overlapping electrons and jets -// Need two steps so as to avoid using rejected jets in the 2nd step. -//----------------------------------------------------------------------------- -StatusCode TopOverlapRemovalTool::removeEleJetOverlap -(const xAOD::ElectronContainer& electrons, const xAOD::JetContainer& jets) -{ - ATH_MSG_DEBUG("Removing overlapping electrons and jets"); - - // Initialize output decoration if necessary - initializeDecorations(electrons); - initializeDecorations(jets); - - // Remove single closest jet within dR of an electron - for (const auto electron : electrons) - { - // Check that this electron passes the input selection - if ( !isSurvivingObject(electron) ) continue; - double closestdr = 100.; - int closestJetIndex = -1; - for ( auto jetItr = jets.cbegin(); jetItr != jets.cend(); ++jetItr ) - { - // Check that this jet passes the input selection - const xAOD::Jet* jet = *jetItr; - if ( !isSurvivingObject(jet) ) continue; - double dR = dREtaPhi(jet, electron); - if (dR<m_electronJetDREtaPhi && dR<closestdr) - { - ATH_MSG_DEBUG(" Found overlap jet: " << jet->pt()*invGeV); - closestdr = dR; - closestJetIndex = std::distance(jets.begin(), jetItr); - } - } - if (closestJetIndex > -1) setObjectFail(jets[closestJetIndex]); - } - - // Remove electrons that overlap with surviving jets - // Maybe this should get its own method. - for (const auto electron : electrons) - { - // Check that this electron passes the input selection - if ( !isSurvivingObject(electron) ) continue; - // Use the generic OR method - for(const auto jet : jets) - { - // Check that this jet passes the selection (at the current stage) - if ( !isSurvivingObject(jet) ) continue; - if (objectsOverlapEtaPhi(electron, jet, m_jetElectronDREtaPhi)) - { - ATH_MSG_DEBUG(" Found overlap ele: " << electron->pt()*invGeV); - setObjectFail(electron); - } - } - } - - return StatusCode::SUCCESS; -} - -//----------------------------------------------------------------------------- -// Remove muons overlapping jets -//----------------------------------------------------------------------------- -StatusCode TopOverlapRemovalTool::removeMuonJetOverlap -(const xAOD::MuonContainer& muons, const xAOD::JetContainer& jets) -{ - ATH_MSG_DEBUG("Removing muons overlapping jet"); - - // Initialize output decoration if necessary - initializeDecorations(muons); - initializeDecorations(jets); - - // Remove muons that overlap with jets - for(const auto muon : muons){ - if(isSurvivingObject(muon)){ - double muonJetDR = m_muORJetVariDR - ? m_muonJetDREtaPhi+10.e3/muon->pt() - : m_muonJetDREtaPhi; - for(const auto jet : jets){ - // Note: need to make sure no b-tag cut with InputLabel - //if(isSurvivingObject(jet)){ - if(isInputObject(jet)){ - //if(isJetForRemovingMuons(jet)){ // from Run 1: no eta cut; no randomly dropped (mistake?) - if(objectsOverlapEtaPhi(jet, muon, muonJetDR)){ - ATH_MSG_DEBUG(" Found overlap muon: " << muon->pt()*invGeV); - setObjectFail(muon); - } - } - } - } - } - - return StatusCode::SUCCESS; -} - -//----------------------------------------------------------------------------- -// Check if two objects overlap in a dR window -//----------------------------------------------------------------------------- -bool TopOverlapRemovalTool::objectsOverlapEtaPhi(const xAOD::IParticle* p1, - const xAOD::IParticle* p2, - double dRMax, double dRMin) -{ - double dR2 = dR2EtaPhi(p1, p2); - // TODO: use fpcompare utilities - if(dR2 < (dRMax*dRMax) && dR2 > (dRMin*dRMin)){ - /*// Is this the best place for setting the link? - if(m_linkOverlapObjects){ - ATH_CHECK( addOverlapObjectLink(p1, p2) ); - }*/ - return true; - } - return false; -} - -//----------------------------------------------------------------------------- -// Calculate delta R between two particles -//----------------------------------------------------------------------------- -double TopOverlapRemovalTool::dR2EtaPhi(const xAOD::IParticle* p1, - const xAOD::IParticle* p2) -{ - double dEta = p1->eta() - p2->eta(); - double dPhi = TVector2::Phi_mpi_pi(p1->phi() - p2->phi()); - return dEta*dEta + dPhi*dPhi; -} -//----------------------------------------------------------------------------- -double TopOverlapRemovalTool::dREtaPhi(const xAOD::IParticle* p1, - const xAOD::IParticle* p2) -{ return sqrt(dR2EtaPhi(p1, p2)); } - -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/TriggerTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/TriggerTool.cxx deleted file mode 100644 index fb2218d84fdbf0d8d9c7f61de2fb52b2231bc9be..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/TriggerTool.cxx +++ /dev/null @@ -1,702 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// includes -// - -#include <QuickAna/TriggerTool.h> - -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/IEventObjects.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/InternalConfiguration.h> - -// Suppressing unused typedef warning -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#include <boost/multi_index/random_access_index.hpp> -#include <boost/lexical_cast.hpp> -#include <boost/algorithm/string.hpp> -#pragma GCC diagnostic pop -// Suppressing unused parameter warning (ugh..) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#include <TrigDecisionTool/FeatureContainer.h> -#pragma GCC diagnostic pop - -#include <TrigConfxAOD/xAODConfigTool.h> -#include <TriggerMatchingTool/MatchingTool.h> -// Trigger scale factors -#include <MuonEfficiencyCorrections/MuonTriggerScaleFactors.h> -#include <ElectronEfficiencyCorrection/AsgElectronEfficiencyCorrectionTool.h> -// -// method implementations -// - -namespace ana -{ - - TriggerBasicTool :: - TriggerBasicTool (const std::string& name) - : AsgTool (name), AnaTool (name), - m_trigDecTool ("TrigDecisionTool", nullptr), - m_trigconfigTool ("xAODConfigTool", nullptr), - m_triggerMatching ("ana_TriggerMatching", nullptr) - { - declareProperty("TriggerList", m_trigList=""); - declareProperty("GroupName", m_groupName=""); - declareProperty("MatchEl", m_matchEl=true); - declareProperty("MatchMu", m_matchMu=true); - } - - StatusCode TriggerBasicTool :: - initialize() - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_trigconfigTool, TrigConf::xAODConfigTool)); - ATH_CHECK (m_trigconfigTool.initialize()); - - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_trigDecTool, Trig::TrigDecisionTool)); - ATH_CHECK (m_trigDecTool.setProperty ("ConfigTool", m_trigconfigTool)); - ATH_CHECK (m_trigDecTool.setProperty ("TrigDecisionKey", "xTrigDecision")); - ATH_CHECK (m_trigDecTool.initialize ()); - - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_triggerMatching, Trig::MatchingTool)); - ATH_CHECK( m_triggerMatching.setProperty ("TrigDecisionTool", m_trigDecTool) ); - ATH_CHECK( m_triggerMatching.initialize() ); - - // Split into the names - boost::algorithm::split(m_trig_names, m_trigList, boost::is_any_of("\t ")); - - return StatusCode::SUCCESS; - } - - - // Why is this method defined at all? - StatusCode TriggerBasicTool :: - setObjectType (ObjectType /*type*/, const std::string& /*workingPoint*/) - { - return StatusCode::SUCCESS; - } - - - AnalysisStep TriggerBasicTool :: - step () const - { - return STEP_TRIG_DECISION; - } - - - unsigned TriggerBasicTool :: - inputTypes () const - { - return (1 << OBJECT_ELECTRON) | (1 << OBJECT_MUON) | (1 << OBJECT_EVENTINFO); - } - - - unsigned TriggerBasicTool :: - outputTypes () const - { - return (1 << OBJECT_ELECTRON) | (1 << OBJECT_MUON) | (1 << OBJECT_EVENTINFO); - } - - - StatusCode TriggerBasicTool :: - execute (IEventObjects& objects) - { - std::vector<const xAOD::IParticle*> trig_part; - bool these_passed = false; - - for (auto trig : m_trig_names) - { - if (!trig.empty()){ - bool trig_dec = m_trigDecTool->isPassed(trig); - these_passed = these_passed || trig_dec; - } - else continue; - - if (m_matchMu) { - if (objects.muons()) { - for (auto m : *objects.muons()){ - // TODO: comment - trig_part.push_back(m); - m->auxdata<bool>(m_groupName+"_trigMatch") - = m->auxdata<bool>(m_groupName+"_trigMatch") || m_triggerMatching->match(trig_part, trig); - trig_part.clear(); - } - } - } - if(m_matchEl) { - if (objects.electrons()) { - for (auto e : *objects.electrons()){ - trig_part.push_back(e); - - e->auxdata<bool>(m_groupName+"_trigMatch") - = e->auxdata<bool>(m_groupName+"_trigMatch") || m_triggerMatching->match(trig_part,trig); - trig_part.clear(); - } - } - } - } - // Update the group decisions - // OR of all triggers in group - objects.eventinfo()->auxdata<bool>(m_groupName+"_passTrig") = these_passed; - // OR of all triggers - objects.eventinfo()->auxdata<bool>("passAllTrig") - = objects.eventinfo()->auxdata<bool>("passAllTrig") || these_passed; - - return StatusCode::SUCCESS; - } - - - TriggerSFTool :: - TriggerSFTool (const std::string& name) - : AsgTool (name), AnaTool (name), - m_isEleToolSetup (false), - m_mu_trig_sf2015 ("ana_MuonTriggerScaleFactors2015", nullptr), - m_mu_trig_sf2016 ("ana_MuonTriggerScaleFactors2016", nullptr), - m_el_trig_sf ("ana_AsgElectronEfficiencyCorrectionTool", this), - m_el_trig_eff ("ana_AsgElectronEfficiencyTool", this) - { - declareProperty("TriggerList", m_trigList=""); - declareProperty("GroupName", m_groupName=""); - declareProperty("MuonSFstring", m_muon_trig_str=""); - declareProperty("IsData", m_isData=false); - declareProperty("IsAF2", m_isAF2=false); - declareProperty("TriggerPtThreshold", m_TriggerPtThreshold=0); - declareProperty("TriggerYear", m_year=Only2015_2016); - } - - - StatusCode TriggerSFTool :: - useInitialConfiguration (const InternalConfiguration& conf) - { - ATH_CHECK (AnaTool::useInitialConfiguration (conf)); - - // Set to Loose, Medium, or Tight - m_muon_wp = conf.muonWP(); - m_muon_iso_wp = conf.muonIsolationWP(); - // Set to LooseLH, MediumLH, or TightLH - m_ele_wp = conf.electronWP(); - m_ele_iso_wp = conf.electronIsolationWP(); - // From SUSYTools -- GradientLoose not fully supported, but Gradient is close - if ("GradientLoose"==m_ele_iso_wp) m_ele_iso_wp="Gradient"; - return StatusCode::SUCCESS; - } - - - - StatusCode TriggerSFTool :: - initialize() - { - // Set up the muon trigger scale factor tools - separate tools for each year - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_mu_trig_sf2015, CP::MuonTriggerScaleFactors)); - ATH_CHECK (m_mu_trig_sf2015.setProperty("MuonQuality", m_muon_wp)); - ATH_CHECK (m_mu_trig_sf2015.setProperty("Year", "2015")); - ATH_CHECK (m_mu_trig_sf2015.setProperty("AllowZeroSF", true)); - ATH_CHECK (m_mu_trig_sf2015.initialize()); - registerTool(&*m_mu_trig_sf2015); - - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_mu_trig_sf2016, CP::MuonTriggerScaleFactors)); - ATH_CHECK (m_mu_trig_sf2016.setProperty("MuonQuality", m_muon_wp)); - ATH_CHECK (m_mu_trig_sf2016.setProperty("AllowZeroSF", true)); - ATH_CHECK (m_mu_trig_sf2016.initialize()); - registerTool(&*m_mu_trig_sf2016); - - // Thanks to Moritz (SUSY trigger contact): using same SFs for AF2 and full sim for the time being - // Pre-built keys for the trigger tool -- will come in handy later - const std::string egMapFile = "ElectronEfficiencyCorrection/2015_2016/rel20.7/Moriond_February2017_v1/map0.txt"; - const std::string id_key = TString(m_ele_wp).ReplaceAll("AndBLayer", "BLayer").ReplaceAll("LLH", "").Data(); - std::string trig_key = ""; - - // Finally, fill the SF file list - if (m_trigList.find("e24_lhmedium_L1EM20VH") != std::string::npos || - m_trigList.find("e60_lhmedium") != std::string::npos || // already matches e60_lhmedium_nod0; for post-ICHEP this should only be nod0 - m_trigList.find("e120_lhloose") != std::string::npos || - m_trigList.find("e26_lhtight_nod0_ivarloose") != std::string::npos || - m_trigList.find("e140_lhloose_nod0") != std::string::npos ) - trig_key = "SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0"; - else if (m_trigList.find("e12_lhloose_L1EM10VH") != std::string::npos || - m_trigList.find("e17_lhvloose_nod0") != std::string::npos) - trig_key = "DI_E_2015_e12_lhloose_L1EM10VH_2016_e17_lhvloose_nod0"; - else if (m_trigList.find("e15_lhvloose_nod0_L1EM13VH") != std::string::npos) - trig_key = "DI_E_2015_e12_lhloose_L1EM10VH_2016_e15_lhvloose_nod0_L1EM13VH"; - else if (m_trigList.find("e17_lhloose")) - trig_key = "DI_E_2015_e17_lhloose_2016_e17_lhloose"; - // QA only has single- and di-electron trigger tools, so only supporting those for the time being - /* For the very brave, these are also available: - * TRI_E_2015_e17_lhloose_2016_e17_lhloose_nod0 - * TRI_E_2015_e17_lhloose_2016_e17_lhmedium_nod0 - * TRI_E_2015_e9_lhloose_2016_e9_lhloose_nod - * TRI_E_2015_e9_lhloose_2016_e9_lhmedium_nod0 - * MULTI_L_2015_e17_lhloose_2016_e17_lhloose_nod0 - * MULTI_L_2015_e7_lhmedium_2016_e7_lhmedium_nod0 - */ - - if (!trig_key.empty()) - { - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_el_trig_sf, AsgElectronEfficiencyCorrectionTool)); - ATH_CHECK (m_el_trig_sf.setProperty ("MapFilePath", egMapFile) ); - ATH_CHECK (m_el_trig_sf.setProperty ("IdKey", id_key) ); - // For triggers with isolation, include isolation - if (m_trigList.find("_i")!=std::string::npos) - ATH_CHECK (m_el_trig_sf.setProperty ("IsoKey", m_ele_iso_wp) ); - ATH_CHECK (m_el_trig_sf.setProperty ("TriggerKey", trig_key) ); - ATH_CHECK (m_el_trig_sf.setProperty ("ForceDataType",1+(m_isAF2?2:0)) ); - ATH_CHECK (m_el_trig_sf.setProperty ("CorrelationModel", "TOTAL") ); - ATH_CHECK (m_el_trig_sf.initialize() ); - registerTool(&*m_el_trig_sf); - - ATH_CHECK (ASG_MAKE_ANA_TOOL (m_el_trig_eff, AsgElectronEfficiencyCorrectionTool)); - ATH_CHECK (m_el_trig_eff.setProperty("MapFilePath", egMapFile) ); - ATH_CHECK (m_el_trig_eff.setProperty("IdKey", id_key) ); - if (m_trigList.find("_i")!=std::string::npos) - ATH_CHECK( m_el_trig_eff.setProperty ("IsoKey", m_ele_iso_wp) ); - ATH_CHECK (m_el_trig_eff.setProperty ("TriggerKey", "Eff_"+trig_key) ); - ATH_CHECK (m_el_trig_eff.setProperty ("ForceDataType",1+(m_isAF2?2:0)) ); - ATH_CHECK (m_el_trig_eff.setProperty ("CorrelationModel", "TOTAL") ); - ATH_CHECK (m_el_trig_eff.initialize() ); - - m_isEleToolSetup=true; - } - - return StatusCode::SUCCESS; - } - - - // Why is this method defined at all? - StatusCode TriggerSFTool :: - setObjectType (ObjectType /*type*/, const std::string& /*workingPoint*/) - { - // m_type=OBJECT_ELECTRON; - // if (type != OBJECT_TRIGGER) - return StatusCode::SUCCESS; - } - - - AnalysisStep TriggerSFTool :: - step () const - { - return STEP_TRIGGER; - } - - unsigned TriggerSFTool :: - inputTypes () const - { - return (1 << OBJECT_ELECTRON) | (1 << OBJECT_MUON) | (1 << OBJECT_EVENTINFO); - } - - - - unsigned TriggerSFTool :: - outputTypes () const - { - return (1 << OBJECT_ELECTRON) | (1 << OBJECT_MUON) | (1 << OBJECT_EVENTINFO); - } - - - - - StatusCode TriggerSFTool :: - execute (IEventObjects& objects) - { - bool any_passed = objects.eventinfo()->auxdata<bool>("passAllTrig"); - - // Remainder all applies to scale factors - not applicable if this is data - if (m_isData || !any_passed) return StatusCode::SUCCESS; - - //again brute forcing something that will get from configuration - double sf=1; - if (!m_muon_trig_str.empty()){ - - // Configure the tools. - // This is the run number determined by the mu reweighting tool - int my_runNumber = objects.eventinfo()->auxdata<unsigned int>( "RandomRunNumber" ); - - // In the case of small amounts of data, the pileup reweighting tool may - // return a zero run number. This is not really an error, so we don't need - // to throw an exception here, but we do need to make sure that we get - // reasonable muon trigger scale factors. So we patch the run number here. - if (my_runNumber<=0) my_runNumber = 284285; - // Note that this run number used to be 276073 (first good run in 2015), but - // that run has rather atypical scale factors and performance. It has - // therefre been changed to the run in 2015 with the most luminosity. - - // If we are in the wrong year, then stop here - if ( (my_runNumber<290000 && m_year==Only2016) || - (my_runNumber>290000 && m_year==Only2015) ) return StatusCode::SUCCESS; - - if ( muonSFToolForThisYear(my_runNumber)->setRunNumber(my_runNumber)!=CP::CorrectionCode::Ok ){ - ATH_MSG_ERROR ("setRunNumber failed for muon trigger SF tool"); - return StatusCode::FAILURE; - } - - // This is unreadably ugly... - bool isDiMuTrig = (m_muon_trig_str.find("2mu") != std::string::npos || m_muon_trig_str.find("mu", m_muon_trig_str.find("mu")+1 ) != std::string::npos); - // For the time being: if the trigger string has "OR" then it is still a single-lepton trigger, it's just several OR'd together - if(m_muon_trig_str.find("OR") != std::string::npos) isDiMuTrig=false; - - // Should only pass selected muons! See - // https://twiki.cern.ch/twiki/bin/view/AtlasProtected/MCPAnalysisGuidelinesMC15#Muon_trigger_efficiency_scale_fa - xAOD::MuonContainer my_muons(SG::VIEW_ELEMENTS); - if (objects.muons()){ - for (const auto m : *objects.muons()){ - if ( m->auxdata<char>("ana_select_or") && - !m->auxdata<char>("overlaps") && - m->pt() > m_TriggerPtThreshold*1000. ){ - my_muons.push_back( m ); // 1.05*online pt requirement - //// As long as we are here, get the efficiency - double trig_eff = 1.; - QA_CHECK_WEIGHT - ( double , trig_eff, muonSFToolForThisYear(my_runNumber)->getTriggerEfficiency(*m,trig_eff,m_muon_trig_str,m_isData) ); - m->auxdata<double>(m_groupName + "_Mu_TrigEff") = trig_eff; - } - } - } - - auto evtInfo = objects.eventinfo(); - if (!isDiMuTrig && my_muons.size()>=1){ - // Single muon trigger case - simple, scale factor for all the muons - QA_CHECK_WEIGHT - ( double, sf, muonSFToolForThisYear(my_runNumber)->getTriggerScaleFactor(my_muons, sf, m_muon_trig_str) ); - evtInfo->auxdata<double>(m_groupName + "_Mu_TrigSF") = sf; - } else if (isDiMuTrig && my_muons.size() == 2 ) { - // Di-muon case - slightly more complicated - if( TString(m_muon_trig_str).Contains("2mu14") ){ // set SF=1 for 2mu14 since the SFs are bogus - sf = 1; - } - else{ - QA_CHECK_WEIGHT - ( double, sf, muonSFToolForThisYear(my_runNumber)->getTriggerScaleFactor(my_muons, sf, m_muon_trig_str) ); - } - evtInfo->auxdata<double>(m_groupName + "_Mu_TrigSF") = sf; - } else { - // Otherwise - dimuon trigger, but we didn't have two muons - evtInfo->auxdata<double>(m_groupName + "_Mu_TrigSF") = sf; - } - - } // Had a muon trigger match string - - // Electron trigger scale factors as well! - if (objects.electrons() && m_isEleToolSetup) { - for (auto el : *objects.electrons()){ - // Decorate with the three scale factors - double trig_weight = 1.; - // \todo We're not catching errors!!! - if (m_el_trig_sf->getEfficiencyScaleFactor(*el, trig_weight) - == CP::CorrectionCode::Ok) { - el->auxdata<double>(m_groupName+"_TrigSF") = trig_weight; - } - else el->auxdata<double>(m_groupName+"_TrigSF") = 1.; - // Same thing for the efficiency - double trig_eff = 1.; - if (m_el_trig_eff->getEfficiencyScaleFactor(*el, trig_eff) - == CP::CorrectionCode::Ok) { - el->auxdata<double>(m_groupName+"_TrigEff") = trig_eff; - } - else el->auxdata<double>(m_groupName+"_TrigEff") = 1.; - } // Loop over electrons - } // Had electrons in the event - - return StatusCode::SUCCESS; - } - - - - asg::AnaToolHandle<CP::IMuonTriggerScaleFactors>& TriggerSFTool::muonSFToolForThisYear(const int runNumber) - { - // Was it 2016? - if (runNumber>290000) return m_mu_trig_sf2016; - // It was 2015 then - return m_mu_trig_sf2015; - } - - - StatusCode makeTriggerTool (DefinitionArgs& args, - std::string trigList, - std::string groupName, - std::string MuonSFstring , - bool matchEl, - bool matchMu, - double trigPtThresh=0, - TriggerSFTool::TrigYear year = TriggerSFTool::Only2015_2016, - bool decision_only = false) - { - using namespace msgObjectDefinition; - - std::unique_ptr<TriggerBasicTool> TrigBasicTool - ( new TriggerBasicTool(args.prefix()+"_Basic") ); - - ANA_CHECK( TrigBasicTool->setProperty("TriggerList", trigList) ); - ANA_CHECK( TrigBasicTool->setProperty("GroupName", groupName) ); - ANA_CHECK( TrigBasicTool->setProperty("MatchMu", matchMu) ); - ANA_CHECK( TrigBasicTool->setProperty("MatchEl", matchEl) ); - args.add( std::move(TrigBasicTool) ); - - if (decision_only) return StatusCode::SUCCESS; - - std::unique_ptr<TriggerSFTool> TrigSFTool - ( new TriggerSFTool(args.prefix()+"_SF") ); - - ANA_CHECK( TrigSFTool->setProperty("TriggerList", trigList) ); - ANA_CHECK( TrigSFTool->setProperty("GroupName", groupName) ); - ANA_CHECK( TrigSFTool->setProperty("MuonSFstring", MuonSFstring) ); - ANA_CHECK( TrigSFTool->setProperty("IsData",args.configuration()->isData()) ); - ANA_CHECK( TrigSFTool->setProperty("IsAF2",args.configuration()->isAFII()) ); - trigPtThresh *= 1.05;//Muon trigger tool requires offline pt = 1.05 * online - ANA_CHECK( TrigSFTool->setProperty("TriggerPtThreshold", trigPtThresh) ); - ANA_CHECK( TrigSFTool->setProperty("TriggerYear", static_cast<int>(year)) ); - args.add( std::move(TrigSFTool) ); - - return StatusCode::SUCCESS; - } - - // Format - //Definition Name, makeTriggerTool(args, Triggers separated by spaces, group name, match electrons, match muon) - - // Some Combined Trigger groups - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("SingleMu", - makeTriggerTool (args, "HLT_mu20_iloose_L1MU15", "SingleMu", "HLT_mu20_iloose_L1MU15", false, true,20,TriggerSFTool::Only2015)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("SingleE", - makeTriggerTool (args, "HLT_e24_lhmedium_iloose_L1EM20VH HLT_e24_tight_iloose", "SingleE", "", true, false)) - - // Some individual Trigger groups - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu20_iloose_L1MU15", - makeTriggerTool (args, "HLT_mu20_iloose_L1MU15", "HLT_mu20_iloose_L1MU15", "HLT_mu20_iloose_L1MU15", false, true,20,TriggerSFTool::Only2015)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhmedium_iloose_L1EM20VH", - makeTriggerTool (args, "HLT_e24_lhmedium_iloose_L1EM20VH", "HLT_e24_lhmedium_iloose_L1EM20VH", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_tight_iloose", - makeTriggerTool (args, "HLT_e24_tight_iloose", "HLT_e24_tight_iloose", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e26_lhtight_nod0_ivarloose", - makeTriggerTool (args, "HLT_e26_lhtight_nod0_ivarloose", "HLT_e26_lhtight_nod0_ivarloose", "", true, false)) - - // single electron 2016 --> disable the sf for the moment - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhtight_nod0_ivarloose", - makeTriggerTool (args, "HLT_e24_lhtight_nod0_ivarloose", "HLT_e24_lhtight_nod0_ivarloose", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e60_medium", - makeTriggerTool (args, "HLT_e60_medium", "HLT_e60_medium", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e140_lhloose_nod0", - makeTriggerTool (args, "HLT_e140_lhloose_nod0", "HLT_e140_lhloose_nod0", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e300_etcut", - makeTriggerTool (args, "HLT_e300_etcut", "HLT_e300_etcut", "", true, false)) - //for special run -->probably to be removed in future - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhmedium_nod0_ivarloose", - makeTriggerTool (args, "HLT_e24_lhmedium_nod0_ivarloose", "HLT_e24_lhmedium_nod0_ivarloose", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhmedium_nod0_L1EM20VH", - makeTriggerTool (args, "HLT_e24_lhmedium_nod0_L1EM20VH", "HLT_e24_lhmedium_nod0_L1EM20VH", "", true, false)) - - //Combined Single Mu --> due to combined scale factors - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu26_imedium", - makeTriggerTool (args, "HLT_mu26_imedium", "HLT_mu26_imedium", "HLT_mu26_imedium_OR_HLT_mu50", false, true, 26, TriggerSFTool::Only2015_2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu26_ivarmedium", - makeTriggerTool (args, "HLT_mu26_ivarmedium", "HLT_mu26_ivarmedium", "HLT_mu26_imedium_OR_HLT_mu50", false, true, 26, TriggerSFTool::Only2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu50", - makeTriggerTool (args, "HLT_mu50", "HLT_mu50", "HLT_mu50", false, true, 50, TriggerSFTool::Only2015_2016)) - - // single muon 2016 --> disable the sf for the moment - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24_ivarloose", - makeTriggerTool (args, "HLT_mu24_ivarloose", "HLT_mu24_ivarloose", "", false, true, 24, TriggerSFTool::Only2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24_iloose", - makeTriggerTool (args, "HLT_mu24_iloose", "HLT_mu24_iloose", "", false, true, 24, TriggerSFTool::Only2015_2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24_ivarloose_L1MU15", - makeTriggerTool (args, "HLT_mu24_ivarloose_L1MU15", "HLT_mu24_ivarloose_L1MU15", "", false, true, 24, TriggerSFTool::Only2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24_iloose_L1MU15", - makeTriggerTool (args, "HLT_mu24_iloose_L1MU15", "HLT_mu24_iloose_L1MU15", "", false, true, 24, TriggerSFTool::Only2015_2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24_ivarmedium", - makeTriggerTool (args, "HLT_mu24_ivarmedium", "HLT_mu24_ivarmedium", "", false, true, 24, TriggerSFTool::Only2016)) - - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu20_iloose_L1MU15_OR_HLT_mu50", - makeTriggerTool (args, "HLT_mu20_iloose_L1MU15 HLT_mu50", "HLT_mu20_iloose_L1MU15_OR_HLT_mu50", "HLT_mu20_iloose_L1MU15_OR_HLT_mu50", false, true, 20, TriggerSFTool::Only2015)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24_iloose_L1MU15_OR_HLT_mu50", - makeTriggerTool (args, "HLT_mu24_iloose_L1MU15 HLT_mu50", "HLT_mu24_iloose_L1MU15_OR_HLT_mu50", "HLT_mu24_iloose_L1MU15_OR_HLT_mu50", false, true, 24, TriggerSFTool::Only2015)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24_imedium_OR_HLT_mu50", - makeTriggerTool (args, "HLT_mu24_imedium HLT_mu50", "HLT_mu24_imedium_OR_HLT_mu50", "HLT_mu24_imedium_OR_HLT_mu50", false, true, 24, TriggerSFTool::Only2015_2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu26_imedium_OR_HLT_mu50", - makeTriggerTool (args, "HLT_mu26_imedium HLT_mu50", "HLT_mu26_imedium_OR_HLT_mu50", "HLT_mu26_imedium_OR_HLT_mu50", false, true, 26, TriggerSFTool::Only2015_2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24_ivarmedium_OR_HLT_mu50", - makeTriggerTool (args, "HLT_mu24_ivarmedium HLT_mu50", "HLT_mu24_ivarmedium_OR_HLT_mu50", "HLT_mu24_ivarmedium_OR_HLT_mu50", false, true, 24, TriggerSFTool::Only2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu26_ivarmedium_OR_HLT_mu50", - makeTriggerTool (args, "HLT_mu26_ivarmedium HLT_mu50", "HLT_mu26_ivarmedium_OR_HLT_mu50", "HLT_mu26_ivarmedium_OR_HLT_mu50", false, true, 26, TriggerSFTool::Only2016)) - - // Stand alone muon triggers - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2mu14", - makeTriggerTool (args, "HLT_2mu14", "HLT_2mu14", "HLT_2mu14", false, true,14, TriggerSFTool::Only2015_2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu14", - makeTriggerTool (args, "HLT_mu14", "HLT_mu14", "HLT_mu14", false, true,14, TriggerSFTool::Only2015_2016)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2mu10", - makeTriggerTool (args, "HLT_2mu10", "HLT_2mu10", "", false, true,11./1.05, TriggerSFTool::Only2015_2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu10", - makeTriggerTool (args, "HLT_mu10", "HLT_mu10", "", false, true,11./1.05, TriggerSFTool::Only2015_2016)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24_mu8noL1", - makeTriggerTool (args, "HLT_mu24_mu8noL1", "HLT_mu24_mu8noL1", "", false, true,10./1.05, TriggerSFTool::Only2015_2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu24", - makeTriggerTool (args, "HLT_mu24", "HLT_mu24", "", false, true,24)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu22_mu8noL1", - makeTriggerTool (args, "HLT_mu22_mu8noL1", "HLT_mu22_mu8noL1", "", false, true,10./1.05, TriggerSFTool::Only2015_2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu22", - makeTriggerTool (args, "HLT_mu22", "HLT_mu22", "", false, true,22)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu20_mu8noL1", - makeTriggerTool (args, "HLT_mu20_mu8noL1", "HLT_mu20_mu8noL1", "", false, true,10./1.05, TriggerSFTool::Only2016)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu20", - makeTriggerTool (args, "HLT_mu20", "HLT_mu20", "", false, true,20)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu18_mu8noL1", - makeTriggerTool (args, "HLT_mu18_mu8noL1", "HLT_mu18_mu8noL1", "", false, true,10./1.05, TriggerSFTool::Only2015)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu18", - makeTriggerTool (args, "HLT_mu18", "HLT_mu18", "", false, true,18)) - - // 2016 additions - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2mu14_nomucomb", - makeTriggerTool (args, "HLT_2mu14_nomucomb", "HLT_2mu14_nomucomb", "", false, true,15./1.05)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu40", - makeTriggerTool (args, "HLT_mu40", "HLT_mu40", "", false, true,40)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2mu10_nomucomb", - makeTriggerTool (args, "HLT_2mu10_nomucomb", "HLT_2mu10_nomucomb", "", false, true, 11./1.05)) - - // electrons - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhmedium_iloose_L1EM18VH", - makeTriggerTool (args, "HLT_e24_lhmedium_iloose_L1EM18VH", "HLT_e24_lhmedium_iloose_L1EM18VH", "", true, false)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e60_lhmedium", - makeTriggerTool (args, "HLT_e60_lhmedium", "HLT_e60_lhmedium", "", true, false)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2e12_lhloose", - makeTriggerTool (args, "HLT_2e12_lhloose", "HLT_2e12_lhloose", "", true, false)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2e17_lhloose", - makeTriggerTool (args, "HLT_2e17_lhloose", "HLT_2e17_lhloose", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e17_lhloose", - makeTriggerTool (args, "HLT_e17_lhloose", "HLT_e17_lhloose", "", true, false)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2e12_lhloose_L12EM10VH", - makeTriggerTool (args, "HLT_2e12_lhloose_L12EM10VH", "HLT_2e12_lhloose_L12EM10VH", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e12_lhloose_L1EM10VH", - makeTriggerTool (args, "HLT_e12_lhloose_L1EM10VH", "HLT_e12_lhloose_L1EM10VH", "", true, false)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2e15_lhloose_L12EM13VH", - makeTriggerTool (args, "HLT_2e15_lhloose_L12EM13VH", "HLT_2e15_lhloose_L12EM13VH", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e15_lhloose_L1EM13VH", - makeTriggerTool (args, "HLT_e15_lhloose_L1EM13VH", "HLT_e15_lhloose_L1EM13VH", "", true, false)) - - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhmedium_L1EM20VH", - makeTriggerTool (args, "HLT_e24_lhmedium_L1EM20VH", "HLT_e24_lhmedium_L1EM20VH", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhmedium_L1EM20VHI", - makeTriggerTool (args, "HLT_e24_lhmedium_L1EM20VHI", "HLT_e24_lhmedium_L1EM20VHI", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhmedium_L1EM18VH", - makeTriggerTool (args, "HLT_e24_lhmedium_L1EM18VH", "HLT_e24_lhmedium_L1EM18VH", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e120_lhloose", - makeTriggerTool (args, "HLT_e120_lhloose", "HLT_e120_lhloose", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e7_lhmedium", - makeTriggerTool (args, "HLT_e7_lhmedium", "HLT_e7_lhmedium", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e26_lhmedium_L1EM22VHI", - makeTriggerTool (args, "HLT_e26_lhmedium_L1EM22VHI", "HLT_e26_lhmedium_L1EM22VHI", "", true, false)) - - // New for 2016 - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e60_lhmedium_nod0", - makeTriggerTool (args, "HLT_e60_lhmedium_nod0", "HLT_e60_lhmedium_nod0", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2e17_lhvloose_nod0", - makeTriggerTool (args, "HLT_2e17_lhvloose_nod0", "HLT_2e17_lhvloose_nod0", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2e12_lhvloose_nod0_L12EM10VH", - makeTriggerTool (args, "HLT_2e12_lhvloose_nod0_L12EM10VH", "HLT_2e12_lhvloose_nod0_L12EM10VH", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2e15_lhvloose_nod0_L12EM13VH", - makeTriggerTool (args, "HLT_2e15_lhvloose_nod0_L12EM13VH", "HLT_2e15_lhvloose_nod0_L12EM13VH", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e17_lhloose_nod0", - makeTriggerTool (args, "HLT_e17_lhloose_nod0", "HLT_e17_lhloose_nod0", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e26_lhtight_nod0_iloose", - makeTriggerTool (args, "HLT_e26_lhtight_nod0_iloose", "HLT_e26_lhtight_nod0_iloose", "", true, false)) - - // electron-muon - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e17_lhloose_mu14", - makeTriggerTool (args, "HLT_e17_lhloose_mu14", "HLT_e17_lhloose_mu14", "", true, true,14)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e7_lhmedium_mu24", - makeTriggerTool (args, "HLT_e7_lhmedium_mu24", "HLT_e7_lhmedium_mu24", "HLT_mu24", true, true,24)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e26_lhmedium_L1EM22VHI_mu8noL1", - makeTriggerTool (args, "HLT_e26_lhmedium_L1EM22VHI_mu8noL1", "HLT_e26_lhmedium_L1EM22VHI_mu8noL1", "", true, true,8)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhmedium_L1EM20VHI_mu8noL1", - makeTriggerTool (args, "HLT_e24_lhmedium_L1EM20VHI_mu8noL1", "HLT_e24_lhmedium_L1EM20VHI_mu8noL1", "", true, true,8)) - - // New for 2016 - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e26_lhmedium_nod0_L1EM22VHI_mu8noL1", - makeTriggerTool (args, "HLT_e26_lhmedium_nod0_L1EM22VHI_mu8noL1", "HLT_e26_lhmedium_nod0_L1EM22VHI_mu8noL1", "", true, true,8)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e7_lhmedium_nod0_mu24", - makeTriggerTool (args, "HLT_e7_lhmedium_nod0_mu24", "HLT_e7_lhmedium_nod0_mu24", "HLT_mu24", true, true,24)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e17_lhloose_nod0_mu14", - makeTriggerTool (args, "HLT_e17_lhloose_nod0_mu14", "HLT_e17_lhloose_nod0_mu14", "", true, true,14)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_lhmedium_nod0_L1EM20VHI_mu8noL1", - makeTriggerTool (args, "HLT_e24_lhmedium_nod0_L1EM20VHI_mu8noL1", "HLT_e24_lhmedium_nod0_L1EM20VHI_mu8noL1", "", true, true, 8)) - - // MET Triggers - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("L1_XE50", - makeTriggerTool (args, "L1_XE50", "L1_XE50", "", false, false, 0., TriggerSFTool::Only2015_2016, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_xe70", - makeTriggerTool (args, "HLT_xe70", "HLT_xe70", "", false, false, 0., TriggerSFTool::Only2015_2016, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_xe80", - makeTriggerTool (args, "HLT_xe80", "HLT_xe80", "", false, false, 0., TriggerSFTool::Only2015_2016, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_xe80_wEFMu", - makeTriggerTool (args, "HLT_xe80_wEFMu", "HLT_xe80_wEFMu", "", false, false, 0., TriggerSFTool::Only2015_2016, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_xe100", - makeTriggerTool (args, "HLT_xe100", "HLT_xe100", "", false, false, 0., TriggerSFTool::Only2015_2016, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_xe100_mht_L1XE50", - makeTriggerTool (args, "HLT_xe100_mht_L1XE50", "HLT_xe100_mht_L1XE50", "", false, false, 0., TriggerSFTool::Only2015_2016, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_xe110_mht_L1XE50", - makeTriggerTool (args, "HLT_xe110_mht_L1XE50", "HLT_xe110_mht_L1XE50", "", false, false, 0., TriggerSFTool::Only2015_2016, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_xe110_mht_L1XE60", - makeTriggerTool (args, "HLT_xe110_mht_L1XE60", "HLT_xe110_mht_L1XE60", "", false, false, 0., TriggerSFTool::Only2015_2016, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_xe110_mht_L1XE50_AND_xe70_L1XE50", - makeTriggerTool (args, "HLT_xe110_mht_L1XE50_AND_xe70_L1XE50", "HLT_xe110_mht_L1XE50_AND_xe70_L1XE50", "", false, false, 0., TriggerSFTool::Only2015_2016, true)) - - - - //specially for H4l analysis --> they use lots of combinations - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e17_lhloose_2e9_lhloose", - makeTriggerTool (args, "HLT_e17_lhloose_2e9_lhloose", "HLT_e17_lhloose_2e9_lhloose", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e17_lhloose_nod0_2e9_lhloose_nod0", - makeTriggerTool (args, "HLT_e17_lhloose_nod0_2e9_lhloose_nod0", "HLT_e17_lhloose_nod0_2e9_lhloose_nod0", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e17_lhmedium_nod0_2e9_lhmedium_nod0", - makeTriggerTool (args, "HLT_e17_lhmedium_nod0_2e9_lhmedium_nod0", "HLT_e17_lhmedium_nod0_2e9_lhmedium_nod0", "", true, false)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu60_0eta105_msonly", - makeTriggerTool (args, "HLT_mu60_0eta105_msonly", "HLT_mu60_0eta105_msonly", "", false, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu20_ivarloose", - makeTriggerTool (args, "HLT_mu20_ivarloose", "HLT_mu20_ivarloose", "",false, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu20_iloose", - makeTriggerTool (args, "HLT_mu20_iloose", "HLT_mu20_iloose", "", false, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_3mu6", - makeTriggerTool (args, "HLT_3mu6", "HLT_3mu6", "", false, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_3mu6_msonly", - makeTriggerTool (args, "HLT_3mu6_msonly", "HLT_3mu6_msonly", "", false, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu18_2mu4noL1", - makeTriggerTool (args, "HLT_mu18_2mu4noL1", "HLT_mu18_2mu4noL1", "", false, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu20_2mu4noL1", - makeTriggerTool (args, "HLT_mu20_2mu4noL1", "HLT_mu20_2mu4noL1", "", false, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_3mu4", - makeTriggerTool (args, "HLT_3mu4", "HLT_3mu4", "", false, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu6_2mu4", - makeTriggerTool (args, "HLT_mu6_2mu4", "HLT_mu6_2mu4", "", false, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2e12_lhloose_mu10", - makeTriggerTool (args, "HLT_2e12_lhloose_mu10", "HLT_2e12_lhloose_mu10", "", true, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e12_lhloose_2mu10", - makeTriggerTool (args, "HLT_e12_lhloose_2mu10", "HLT_e12_lhloose_2mu10", "", true, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e24_medium_L1EM20VHI_mu8noL1", - makeTriggerTool (args, "HLT_e24_medium_L1EM20VHI_mu8noL1", "HLT_e24_medium_L1EM20VHI_mu8noL1", "", true, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e7_medium_mu24", - makeTriggerTool (args, "HLT_e7_medium_mu24", "HLT_e7_medium_mu24", "", true, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_e12_lhloose_nod0_2mu10", - makeTriggerTool (args, "HLT_e12_lhloose_nod0_2mu10", "HLT_e12_lhloose_nod0_2mu10", "", true, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_2e12_lhloose_nod0_mu10", - makeTriggerTool (args, "HLT_2e12_lhloose_nod0_mu10", "HLT_2e12_lhloose_nod0_mu10", "", true, true)) - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("HLT_mu20_ivarloose_L1MU15", - makeTriggerTool (args, "HLT_mu20_ivarloose_L1MU15", "HLT_mu20_ivarloose_L1MU15", "", false, true)) - - - - // Default do nothing - QUICK_ANA_TRIGGER_DEFINITION_MAKER ("skip", makeTriggerTool (args, "", "", "", false, false)) -} // namespace ana diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/TruthJetTools.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/TruthJetTools.cxx deleted file mode 100644 index 30f85e53c298a97f0ef89c04a2bc140c34960aca..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/TruthJetTools.cxx +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <QuickAna/TruthJetTools.h> - -#include <QuickAna/AnaToolRetrieve.h> -#include <QuickAna/DefinitionArgs.h> -#include <QuickAna/DefinitionMaker.h> -#include <QuickAna/MessageCheck.h> - -namespace ana -{ - - //--------------------------------------------------------------------------- - // TruthJetToolCorrect - //--------------------------------------------------------------------------- - TruthJetToolCorrect::TruthJetToolCorrect (const std::string& name) - : AsgTool(name), AnaToolCorrect<xAOD::JetContainer>(name) - {} - - //--------------------------------------------------------------------------- - StatusCode TruthJetToolCorrect::initialize() - { - ATH_MSG_DEBUG ("initialize"); - return StatusCode::SUCCESS; - } - - //--------------------------------------------------------------------------- - StatusCode TruthJetToolCorrect::correctObject (xAOD::Jet& /*jet*/) - { - ATH_MSG_DEBUG ("correctObject"); - - // Accept all jets for now! - return StatusCode::SUCCESS; - } - - - //--------------------------------------------------------------------------- - // TruthJetToolSelect - //--------------------------------------------------------------------------- - TruthJetToolSelect::TruthJetToolSelect (const std::string& name) - : AsgTool(name), AnaToolSelect<xAOD::JetContainer>(name) - {} - - //--------------------------------------------------------------------------- - StatusCode TruthJetToolSelect::initialize() - { - ATH_MSG_DEBUG ("initialize"); - return StatusCode::SUCCESS; - } - - //--------------------------------------------------------------------------- - StatusCode TruthJetToolSelect::selectObject (xAOD::Jet& /*jet*/) - { - ATH_MSG_DEBUG ("selectObject"); - // Accept all jets for now! - return StatusCode::SUCCESS; - } - - //--------------------------------------------------------------------------- - // Truth jet tool maker function - //--------------------------------------------------------------------------- - StatusCode makeTruthJetTool (DefinitionArgs& args,const std::string &truthCollection) - { - using namespace msgObjectDefinition; - - ANA_MSG_INFO ("ana::makeTruthJetTool"); - - // Retrieval tool - std::unique_ptr<IAnaTool> toolRetrieve - (new AnaToolRetrieve(args.prefix() + "_retrieve", truthCollection)); - args.add(std::move(toolRetrieve)); - - // Correction tool - std::unique_ptr<TruthJetToolCorrect> toolCorrect - (new TruthJetToolCorrect(args.prefix() + "_correct")); - args.add(std::move(toolCorrect)); - - // Selection tool - std::unique_ptr<TruthJetToolSelect> toolSelect - (new TruthJetToolSelect(args.prefix() + "_select")); - args.add(std::move(toolSelect)); - - return StatusCode::SUCCESS; - } - - QUICK_ANA_JET_DEFINITION_MAKER ("truth", makeTruthJetTool(args,"AntiKt4TruthJets")) - QUICK_ANA_JET_DEFINITION_MAKER ("truthWZ", makeTruthJetTool(args,"AntiKt4TruthWZJets")) - -} // namespace ana diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/ValidationEL.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/ValidationEL.cxx deleted file mode 100644 index 24863d32ff082931b2e69885b92a3b4c4c8081d0..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/ValidationEL.cxx +++ /dev/null @@ -1,200 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -#ifdef ROOTCORE - -// -// includes -// - -#include <QuickAna/ValidationEL.h> - -#include <EventLoop/Job.h> -#include <EventLoop/Worker.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <QuickAna/ValidationHists.h> -#include <fstream> - -// -// method implementations -// - -// this is needed to distribute the algorithm to the workers -ClassImp(ana::ValidationEL) - -namespace ana -{ - ValidationEL :: ValidationEL () - { - // Here you put any code for the base initialization of variables, - // e.g. initialize all pointers to 0. Note that you should only put - // the most basic initialization here, since this method will be - // called on both the submission and the worker node. Most of your - // initialization code will go into histInitialize() and - // initialize(). - } - - - - ValidationEL :: ~ValidationEL () - { - delete hists; - } - - - - EL::StatusCode ValidationEL :: setupJob (EL::Job& job) - { - // Here you put code that sets up the job on the submission object - // so that it is ready to work with your algorithm, e.g. you can - // request the D3PDReader service or add output files. Any code you - // put here could instead also go into the submission script. The - // sole advantage of putting it here is that it gets automatically - // activated/deactivated when you add/remove the algorithm from your - // job, which may or may not be of value to you. - job.useXAOD(); - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ValidationEL :: histInitialize () - { - // Here you do everything that needs to be done at the very - // beginning on each worker node, e.g. create histograms and output - // trees. This method gets called before any input files are - // connected. - - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ValidationEL :: fileExecute () - { - // Here you do everything that needs to be done exactly once for every - // single file, e.g. collect a list of all lumi-blocks processed - ++ m_filesRead; - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ValidationEL :: changeInput (bool /*firstFile*/) - { - // Here you do everything you need to do when we change input files, - // e.g. resetting branch addresses on trees. If you are using - // D3PDReader or a similar service this method is not needed. - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ValidationEL :: initialize () - { - // Here you do everything that you need to do after the first input - // file has been connected and before the first event is processed, - // e.g. create additional histograms based on which variables are - // available in the input files. You can also create all of your - // histograms and trees in here, but be aware that this method - // doesn't get called if no events are processed. So any objects - // you create here won't be available in the output if you have no - // input events. - ANA_CHECK_SET_TYPE (EL::StatusCode); - - std::unique_ptr<QuickAna> myQuickAna (new QuickAna ("quickana")); - myQuickAna->setConfig (*this); - quickAna = std::move (myQuickAna); - ANA_CHECK (quickAna->initialize()); - hists = new ValidationHists (wk(), quickAna->internalConfiguration()); - - for (auto sys : quickAna->affectingSystematics()) - ATH_MSG_INFO ("found systematic: \"" << sys.name() << "\""); - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ValidationEL :: execute () - { - // Here you do everything that needs to be done on every single - // events, e.g. read input variables, apply cuts, and fill - // histograms and trees. This is where most of your actual analysis - // code will go. - - ANA_CHECK_SET_TYPE (EL::StatusCode); - - ++ m_eventsRead; - - ANA_CHECK (quickAna->process (*wk()->xaodEvent())); - - hists->fillHists ("val/", quickAna->objects(), quickAna->weight()); - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ValidationEL :: postExecute () - { - // Here you do everything that needs to be done after the main event - // processing. This is typically very rare, particularly in user - // code. It is mainly used in implementing the NTupleSvc. - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ValidationEL :: finalize () - { - // This method is the mirror image of initialize(), meaning it gets - // called after the last event has been processed on the worker node - // and allows you to finish up any objects you created in - // initialize() before they are written to disk. This is actually - // fairly rare, since this happens separately for each worker node. - // Most of the time you want to do your post-processing on the - // submission node after all your histogram outputs have been - // merged. This is different from histFinalize() in that it only - // gets called on worker nodes that processed input events. - return EL::StatusCode::SUCCESS; - } - - - - EL::StatusCode ValidationEL :: histFinalize () - { - // This method is the mirror image of histInitialize(), meaning it - // gets called after the last event has been processed on the worker - // node and allows you to finish up any objects you created in - // histInitialize() before they are written to disk. This is - // actually fairly rare, since this happens separately for each - // worker node. Most of the time you want to do your - // post-processing on the submission node after all your histogram - // outputs have been merged. This is different from finalize() in - // that it gets called on all worker nodes regardless of whether - // they processed input events. - - if (m_writeSummary) - { - std::ofstream stream ("AthSummary.txt"); - stream << "Files read: " << m_filesRead << std::endl; - stream << "Events Read: " << m_eventsRead << std::endl; - stream << "{ \"events\":{\"read\":" << m_eventsRead << "} " << "}" << - std::endl; - } - - return EL::StatusCode::SUCCESS; - } -} -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/ValidationHists.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/ValidationHists.cxx deleted file mode 100644 index e217a004989b8c4a8f4248fde8cd116cffb73f75..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/ValidationHists.cxx +++ /dev/null @@ -1,125 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#ifdef ROOTCORE - -#include <QuickAna/ValidationHists.h> - -#include <EventLoop/Worker.h> -#include <QuickAna/IEventObjects.h> -#include <QuickAna/InternalConfiguration.h> -#include <RootCoreUtils/Assert.h> -#include <TH1.h> - -// -// method implementations -// - -namespace ana -{ - void ValidationHists :: - testInvariant () const - { - RCU_INVARIANT (this != 0); - } - - - - ValidationHists :: - ValidationHists (EL::Worker *val_worker, - const InternalConfiguration& configuration) - : m_worker (val_worker), - m_selectionAccessor (configuration.selectionName (SelectionStep::ANALYSIS)) - { - RCU_NEW_INVARIANT (this); - } - - - - void ValidationHists :: - fillHists (const std::string& prefix, const IEventObjects& objects, - float weight) - { - RCU_CHANGE_INVARIANT (this); - fillHist (prefix + "weightln", 20, -5, 5, log (weight), 1); - if (objects.jets()) fillHists (prefix + "jet", *objects.jets(), weight); - if (objects.fat_jets()) fillHists (prefix + "fat_jet", *objects.fat_jets(), weight); - if (objects.photons()) fillHists (prefix + "photon", *objects.photons(), weight); - if (objects.electrons()) fillHists (prefix + "electron", *objects.electrons(), weight); - if (objects.muons()) fillHists (prefix + "muon", *objects.muons(), weight); - if (objects.taus()) fillHists (prefix + "tau", *objects.taus(), weight); - if (objects.met()) fillHists (prefix + "met", *(*objects.met())["Final"], weight); - if (objects.met2()) fillHists (prefix + "met2", *(*objects.met2())["Final"], weight); - } - - - - void ValidationHists :: - fillHists (const std::string& prefix, - const xAOD::IParticleContainer& particles, - float weight) - { - std::size_t count = 0; - for (auto& particle : particles) - { - if (m_selectionAccessor (*particle)) - { - fillHist (prefix + "_e", 100, 0, 1e6, particle->e(), weight); - fillHist (prefix + "_pt", 100, 0, 1e6, particle->pt(), weight); - fillHist (prefix + "_eta", 100, -5, 5, particle->eta(), weight); - fillHist (prefix + "_phi", 100, -M_PI, M_PI, particle->phi(), weight); - fillHist (prefix + "_weightln", 20, -5, 5, log (particle->auxdata<float> ("ana_weight")), 1); - ++ count; - } - } - fillHist (prefix + "_num", 21, -0.5, 20.5, count, weight); - } - - - - void ValidationHists :: - fillHists (const std::string& prefix, - const xAOD::MissingET& met, float weight) - { - fillHist (prefix + "_pt", 100, 0, 1e6, met.met(), weight); - fillHist (prefix + "_phi", 100, -M_PI, M_PI, met.phi(), weight); - fillHist (prefix + "_px", 100, -1e6, 1e6, met.mpx(), weight); - fillHist (prefix + "_py", 100, -1e6, 1e6, met.mpy(), weight); - } - - - - void ValidationHists :: - fillHist (const std::string& name, unsigned nbins, float low, - float high, float value, float weight) - { - auto iter = m_hists.find (name); - if (iter != m_hists.end()) - { - iter->second->Fill (value, weight); - return; - } - - TH1 *hist = new TH1D (name.c_str(), name.c_str(), nbins, low, high); - hist->Fill (value, weight); - m_hists[name] = hist; - m_worker->addOutput (hist); - } -} - -#endif diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/xAODEventSelect.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/xAODEventSelect.cxx deleted file mode 100644 index 8849f9bc2019700c5e5d7e0ffa2068179d9b85cb..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/xAODEventSelect.cxx +++ /dev/null @@ -1,27 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/xAODEventSelect.h> - -// -// method implementations -// - -namespace ana -{ -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/xAODHelpers.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/xAODHelpers.cxx deleted file mode 100644 index 509636a237e0a5d686c31147f22c71845d0b19e2..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/xAODHelpers.cxx +++ /dev/null @@ -1,332 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/xAODHelpers.h> - -#include <QuickAna/MessageCheck.h> -#include <QuickAna/ObjectTypeInfo.h> -#include <RootCoreUtils/Assert.h> -#include <RootCoreUtils/ThrowMsg.h> -#include <xAODBase/IParticleHelpers.h> -#include <xAODCore/ShallowCopy.h> -#include <xAODEventInfo/EventAuxInfo.h> -#include <xAODMissingET/MissingETAuxContainer.h> - -#ifdef ROOTCORE -#include <AsgTools/SgTEvent.h> -#else -#include <StoreGate/StoreGateSvc.h> -#endif - -// -// method implementations -// - -namespace ana -{ - namespace xAODHelpers - { - namespace - { - template<class T> struct Traits; - - /// \brief perform a shallow copy and register it under the given - /// name in the store - template<class T> StatusCode - makeShallowXAOD (StoreType& store, const std::string& name, - T*& pointer, const std::string& inputName); - - /// \brief perform a shallow copy and register it under the given - /// name in the store. Calls makeShallowXAOD after casting the pointer. - template<unsigned T> StatusCode - makeShallowType (StoreType& store, const std::string& name, - void*& pointer, const std::string& inputName); - - /// \brief make a new object and register it under the given name - /// in the store - template<class T, class A = typename xAODHelpers::Traits<T>::AuxType> StatusCode - makeNewXAOD (StoreType& store, const std::string& name, T*& object); - - /// \brief make a new object and register it under the given name - /// in the store. Calls makeNewXAOD after casting the pointer. - template<unsigned T> StatusCode - makeNewType (StoreType& store, const std::string& name, void*& pointer); - - /// \brief get the given type converted into an IParticleContainer - template<unsigned T> xAOD::IParticleContainer * - getParticlesType (void *pointer); - - template<> struct Traits<xAOD::EventInfo> - { - /// \brief whether this is a container - static const bool isContainer = false; - - /// \brief the auxilliary type - typedef xAOD::EventAuxInfo AuxType; - }; - - template<> struct Traits<xAOD::MuonContainer> - { - /// \brief whether this is a container - static const bool isContainer = true; - }; - - template<> struct Traits<xAOD::TauJetContainer> - { - /// \brief whether this is a container - static const bool isContainer = true; - }; - - template<> struct Traits<xAOD::ElectronContainer> - { - /// \brief whether this is a container - static const bool isContainer = true; - }; - - template<> struct Traits<xAOD::PhotonContainer> - { - /// \brief whether this is a container - static const bool isContainer = true; - }; - - template<> struct Traits<xAOD::JetContainer> - { - /// \brief whether this is a container - static const bool isContainer = true; - }; - - template<> struct Traits<xAOD::MissingETContainer> - { - /// \brief whether this is a container - // static const bool isContainer = true; - - /// \brief the auxilliary type - typedef xAOD::MissingETAuxContainer AuxType; - }; - - - - template<class T,bool container=Traits<T>::isContainer> - struct ShallowCopy; - - template<class XAODContainer> struct ShallowCopy<XAODContainer,true> - { - static StatusCode - copy (StoreType& store, - const XAODContainer *input, XAODContainer*& output, - const std::string& name) - { - using namespace msgStore; - - // Create the shallow copy of the entire container: - auto copy = xAOD::shallowCopyContainer (*input); - - ANA_CHECK (xAOD::setOriginalObjectLink(*input, *copy.first)); - ANA_CHECK (store.record (copy.first, name)); - ANA_CHECK (store.record (copy.second, name + "Aux.")); - output = copy.first; - return StatusCode::SUCCESS; - } - }; - - template<class XAODObject> struct ShallowCopy<XAODObject,false> - { - static StatusCode - copy (StoreType& store, - const XAODObject *input, XAODObject*& output, - const std::string& name) - { - using namespace msgStore; - - // Create the shallow copy of the entire container: - auto copy = xAOD::shallowCopyObject (*input); - - ANA_CHECK (store.record (copy.first, name)); - ANA_CHECK (store.record (copy.second, name + "Aux.")); - output = copy.first; - return StatusCode::SUCCESS; - } - }; - - - - template<class T, class A> StatusCode - makeNewXAOD (StoreType& store, const std::string& name, T*& object) - { - using namespace msgStore; - - T* obj = new T(); - A* aux = new A(); - obj->setStore(aux); - ANA_CHECK (store.record(aux, name+"Aux.")); - ANA_CHECK (store.record(obj, name)); - object = obj; - return StatusCode::SUCCESS; - } - - - - template<class T> StatusCode - makeShallowXAOD (StoreType& store, const std::string& name, - T*& pointer, const std::string& inputName) - { - using namespace msgStore; - - RCU_REQUIRE (pointer == nullptr); - const T *input = nullptr; - ANA_CHECK (store.retrieve (input, inputName)); - T *copy = nullptr; - ANA_CHECK (ShallowCopy<T>::copy (store, input, copy, name)); - pointer = copy; - return StatusCode::SUCCESS; - } - - - - template<unsigned T> StatusCode - makeShallowType (StoreType& store, const std::string& name, - void*& pointer, const std::string& inputName) - { - // TODO: Line is too long. Clean this up - return makeShallowXAOD (store, name, reinterpret_cast<typename ObjectTypeInfo::asXAOD<T>::type*&>(pointer), inputName); - } - - - - template<unsigned T> StatusCode - makeNewType (StoreType& store, const std::string& name, void*& pointer) - { - // TODO: Line is too long. Clean this up - return makeNewXAOD (store, name, reinterpret_cast<typename ObjectTypeInfo::asXAOD<T>::type*&>(pointer)); - } - - - - template<unsigned T> xAOD::IParticleContainer * - getParticlesType (void *pointer) - { - return static_cast<typename ObjectTypeInfo::asXAOD<T>::type*>(pointer); - } - } - - - - StatusCode - makeShallow (StoreType& store, const std::string& name, ObjectType type, - void*& pointer, const std::string& inputName) - { - using namespace msgStore; - - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - - switch (type) - { -#define TMP(TYPE) \ - case TYPE: \ - return makeShallowType<TYPE> (store, name, pointer, inputName); - TMP (OBJECT_EVENTINFO); - TMP (OBJECT_EVENT_SELECT); - TMP (OBJECT_JET); - TMP (OBJECT_FAT_JET); - TMP (OBJECT_ELECTRON); - TMP (OBJECT_PHOTON); - TMP (OBJECT_MUON); - TMP (OBJECT_TAU); -#undef TMP - case OBJECT_NONE: - case OBJECT_MET: - case OBJECT_MET2: - case OBJECT_OVERLAP_REMOVAL: - case OBJECT_TRIGGER: - ANA_MSG_ERROR ("unsupported object type " << type); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - StatusCode - makeNew (StoreType& store, const std::string& name, ObjectType type, - void*& pointer) - { - using namespace msgStore; - - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - - switch (type) - { -#define TMP(TYPE) \ - case TYPE: \ - return makeNewType<TYPE> (store, name, pointer); - TMP (OBJECT_MET); - TMP (OBJECT_MET2); - TMP (OBJECT_EVENT_SELECT); -#undef TMP - case OBJECT_EVENTINFO: - case OBJECT_JET: - case OBJECT_FAT_JET: - case OBJECT_ELECTRON: - case OBJECT_PHOTON: - case OBJECT_MUON: - case OBJECT_TAU: - case OBJECT_OVERLAP_REMOVAL: - case OBJECT_TRIGGER: - case OBJECT_NONE: - ANA_MSG_ERROR ("unsupported object type " << type); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; - } - - - - xAOD::IParticleContainer * - getParticles (void *pointer, ObjectType type) - { - RCU_REQUIRE (type < ObjectTypeInfo::numTypes); - - switch (type) - { -#define TMP(TYPE) \ - case TYPE: \ - return getParticlesType<TYPE> (pointer); - TMP (OBJECT_JET); - TMP (OBJECT_FAT_JET); - TMP (OBJECT_ELECTRON); - TMP (OBJECT_PHOTON); - TMP (OBJECT_MUON); - TMP (OBJECT_TAU); -#undef TMP - case OBJECT_EVENTINFO: - case OBJECT_EVENT_SELECT: - case OBJECT_MET: - case OBJECT_MET2: - case OBJECT_OVERLAP_REMOVAL: - case OBJECT_TRIGGER: - case OBJECT_NONE: - { - std::ostringstream str; - str << "unsupported object type " << type; - RCU_THROW_MSG (str.str()); - } - } - return 0; //compiler dummy - } - } -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/Root/xAODTruth.cxx b/PhysicsAnalysis/TopPhys/QuickAna/Root/xAODTruth.cxx deleted file mode 100644 index e6d568b86ea528679381048992837569f782d923..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/Root/xAODTruth.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/xAODTruth.h> - -#include <AsgTools/AsgTool.h> -#include <RootCoreUtils/ThrowMsg.h> -#include <type_traits> - -#ifdef ROOTCORE -#include <AsgTools/SgTEvent.h> -#include <xAODRootAccessInterfaces/TActiveEvent.h> -#else -#include <StoreGate/StoreGateSvc.h> -#endif - -// -// method implementations -// - -namespace ana -{ - namespace - { - template<typename Container,typename Store> - Container *getXAOD (Store& store, const std::string& name, bool allowNull) - { - Container *result = nullptr; - if ((allowNull == false || store.template contains<typename std::decay<Container>::type> (name)) && - store.retrieve (result, name).isFailure()) - { - std::ostringstream str; - str << "failed to retrieve " << typeid(Container).name() << " collection with name " << name; - RCU_THROW_MSG (str.str()); - } - if (!allowNull && result == nullptr) - { - std::ostringstream str; - str << "failed to retrieve " << typeid(Container).name() << " collection with name " << name; - RCU_THROW_MSG (str.str()); - } - return result; - } - } - - - - const xAOD::TruthParticleContainer * - getCTruth (StoreType& store, const std::string& name, bool allowNull) - { - return getXAOD<const xAOD::TruthParticleContainer>(store, name, allowNull); - } - - - -#ifdef ROOTCORE - const xAOD::TruthParticleContainer * - getCTruth (xAOD::TEvent& store, const std::string& name, bool allowNull) - { - return getXAOD<const xAOD::TruthParticleContainer>(store, name, allowNull); - } -#endif - - - - const xAOD::TruthParticleContainer * - getCTruth (asg::AsgTool& tool, const std::string& name, bool allowNull) - { - return getXAOD<const xAOD::TruthParticleContainer>(*tool.evtStore(), name, allowNull); - } - - - -#ifdef ROOTCORE - const xAOD::TruthParticleContainer * - getCTruth (const std::string& name, bool allowNull) - { - // Check if there's an active event: - xAOD::TVirtualEvent* event = xAOD::TActiveEvent::event(); - if (event == nullptr) - { - std::ostringstream str; - str << "Couldn't find an active event in " - << "the job"; - RCU_THROW_MSG (str.str()); - } - - // This should actually be a TEvent: - xAOD::TEvent *myevent = dynamic_cast<xAOD::TEvent*>(event); - if (myevent == nullptr) - { - std::ostringstream str; - str << "The active event is not of type " - << "xAOD::TEvent?!?"; - RCU_THROW_MSG (str.str()); - } - return getXAOD<const xAOD::TruthParticleContainer>(*myevent, name, allowNull); - } -#endif -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/cmt/precompile.RootCore b/PhysicsAnalysis/TopPhys/QuickAna/cmt/precompile.RootCore deleted file mode 100755 index 7a121abe51ccd1c6493b400d8fb1e5f6364be396..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/cmt/precompile.RootCore +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -OUTFILE=${ROOTCORECMT}/QuickAna_config.h - -test -e $OUTFILE -a $OUTFILE -nt $0 && exit 0 - -rm -f $OUTFILE- -mkdir -p `dirname $OUTFILE` -touch $OUTFILE- - -export ROOTCORETEST_CXXFLAGS=-DXAOD_STANDALONE -export ROOTCORETEST_DEP=QuickAna - -echo scanning local header files - -echo '#ifndef QUICK_ANA_CONFIG_H' >>$OUTFILE- -echo '#define QUICK_ANA_CONFIG_H' >>$OUTFILE- - - - -# echo >>$OUTFILE- -# echo '// whether we use xAOD::TauJet_v1' >>$OUTFILE- -# $ROOTCOREDIR/scripts/test_cc.sh compile <<EOF || /bin/echo -n '// ' >>$OUTFILE- -# #include <xAODTau/TauJet.h> -# namespace xAOD -# { -# class TauJet_v1; -# typedef TauJet_v1 TauJet; -# } -# EOF -# echo '#define QUICK_ANA_TAU_JET_V1' >>$OUTFILE- - - - -# echo >>$OUTFILE- -# echo '// whether we use xAOD::TauJet_v2' >>$OUTFILE- -# $ROOTCOREDIR/scripts/test_cc.sh compile <<EOF || /bin/echo -n '// ' >>$OUTFILE- -# #include <xAODTau/TauJet.h> -# namespace xAOD -# { -# class TauJet_v2; -# typedef TauJet_v2 TauJet; -# } -# EOF -# echo '#define QUICK_ANA_TAU_JET_V2' >>$OUTFILE- - - - -echo >>$OUTFILE- -echo '#endif' >>$OUTFILE- - -mv $OUTFILE- $OUTFILE diff --git a/PhysicsAnalysis/TopPhys/QuickAna/doc/packagedoc.h b/PhysicsAnalysis/TopPhys/QuickAna/doc/packagedoc.h deleted file mode 100644 index 3ae57db2adf051a859aa282a2ffde3eaeb11246e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/doc/packagedoc.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// \page QuickAna The QuickAna Project -/// \brief The QuickAna Project - -/// \namespace ana -/// \brief The namespace for the QuickAna project diff --git a/PhysicsAnalysis/TopPhys/QuickAna/scripts/el_example.C b/PhysicsAnalysis/TopPhys/QuickAna/scripts/el_example.C deleted file mode 100644 index b34d173f427c3f21605e05c0f6925884425877cd..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/scripts/el_example.C +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -void el_example (const std::string& submitDir, const std::string& inputFilePath) -{ - // Set up the job for xAOD access: - xAOD::Init().ignore(); - - // create a new sample handler to describe the data files we use - SH::SampleHandler sh; - - // scan for datasets in the given directory - // this works if you are on lxplus, otherwise you'd want to copy over files - // to your local machine and use a local path. if you do so, make sure - // that you copy all subdirectories and point this to the directory - // containing all the files, not the subdirectories. - - // MC single file: - SH::DiskListLocal list (inputFilePath); - SH::scanSingleDir (sh, "sample", list); - - // set the name of the tree in our files - // in the xAOD the TTree containing the EDM containers is "CollectionTree" - sh.setMetaString ("nc_tree", "CollectionTree"); - - // further sample handler configuration may go here - - // print out the samples we found - sh.print (); - - // this is the basic description of our job - EL::Job job; - job.sampleHandler (sh); - job.options()->setString (EL::Job::optXaodAccessMode, EL::Job::optXaodAccessMode_athena); - job.options()->setDouble (EL::Job::optMaxEvents, 100); - - // add our algorithm to the job - ana::ELExample *alg = new ana::ELExample; - alg->eventinfoDef = "default"; - alg->electronDef = "default"; - alg->muonDef = "default"; - alg->tauDef = "default"; - alg->jetDef = "default"; - - // We just need some files for testing. Do not use these in your analysis - alg->muMcFiles = { - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root", - }; - // Using test file from SUSYTools - alg->muDataFiles = {"dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"}; - - job.algsAdd (alg); - - // make the driver we want to use: - // this one works by running the algorithm directly: - EL::DirectDriver driver; - // we can use other drivers to run things on the Grid, with PROOF, etc. - - // process the job using the driver - driver.submit (job, submitDir); -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/scripts/quickana_hammercloud b/PhysicsAnalysis/TopPhys/QuickAna/scripts/quickana_hammercloud deleted file mode 100755 index 9c843fdfbefceb0c38066c2b2d413939ba716734..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/scripts/quickana_hammercloud +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -e -set -u - -options="" -for file in `echo $1 | sed 's/,/ /g'` -do - options="$options --el-input-file $file" -done - -quickana_validate --write-summary $options output diff --git a/PhysicsAnalysis/TopPhys/QuickAna/scripts/quickana_hammercloud_ganga b/PhysicsAnalysis/TopPhys/QuickAna/scripts/quickana_hammercloud_ganga deleted file mode 100755 index 4dc8a2784a2996a43f8316cb0f89224e69387e78..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/scripts/quickana_hammercloud_ganga +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -e -set -u - -options="" -for file in `cat input.txt` -do - options="$options --el-input-file $file" -done - -quickana_validate --write-summary $options output diff --git a/PhysicsAnalysis/TopPhys/QuickAna/scripts/quickana_testfile b/PhysicsAnalysis/TopPhys/QuickAna/scripts/quickana_testfile deleted file mode 100755 index 671bfa02c71370f2f85dde0c6a65423d6c489dc3..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/scripts/quickana_testfile +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env python - -# Set up ROOT and RootCore: -import sys -import os -import ROOT -from glob import glob -import itertools -import sys -import pdb - - -def run_test(qa,event): - - qa.initialize().ignore() - print( "Number of input events: %s" % event.getEntries() ) - for entry in xrange(event.getEntries()): - event.getEntry( entry ) - qa.process().ignore() - if qa.muonDef != "none": - qa.muons() - if qa.electronDef != "none": - qa.electrons() - if qa.photonDef != "none": - qa.photons() - if qa.tauDef != "none": - qa.taus() - if qa.jetDef != "none": - qa.jets() - if qa.metDef != "none": - qa.met() - store.clear() - -def GetConfiguredQA(branches,name=""): #need a differnt quickana instance for each jet collection run - qa=ROOT.ana.QuickAna("QuickAna"+name) - qa.eventinfoDef = "default" - qa.muonDef = "none" - qa.electronDef = "none" - qa.photonDef = "none" - qa.tauDef = "none" - qa.jetDef = "none" - qa.metDef = "none" - qa.orDef = "default" - if "Muons" in branches: - print "found Muons" - qa.muonDef = "default"; - if "Electrons" in branches: - print "found Electrons" - qa.electronDef="default" - if "Photons" in branches: - print "found Photons" - qa.photonDef="default" - if "TauJets" in branches: - print "found TauJets" - qa.tauDef="default" - - jetDef="" - if "AntiKt4LCTopoJets" in branches: - print "Found instance with AntiKt4LCTopoJets" - jetDef="antikt04" - if "AntiKt4EMTopoJets" in branches: - print "Found instance with AntiKt4EMTopoJets" - if jetDef!="":print "Two jets collections found using,AntiKt4EMTopo" - jetDef+=" AntiKt4EMTopo" - print jetDef - if jetDef != "": - qa.Met="default" - else: - jetDef="none" - qa.Met="none" - qa.jetDef=jetDef - - - return qa - - - -if __name__=="__main__": - if len(sys.argv)!= 2: - print "Usage: quickana_testfile input_file.root (input file string can include wildcards)" - sys.exit() - print "start test" - - ROOT.gROOT.Macro( '$ROOTCOREDIR/scripts/load_packages.C' ) - ROOT.xAOD.Init().ignore() - ROOT.xAOD.AuxContainerBase() - event=ROOT.xAOD.TEvent(); - store=ROOT.xAOD.TStore(); - data_files = glob(sys.argv[1]) - # Initialize the xAOD infrastructure: - if(not ROOT.xAOD.Init().isSuccess()): print "Failed xAOD.Init()" - - - - # Set up the input files: - treeName = "CollectionTree" # default when making transient tree anyway - f=ROOT.TChain(treeName) - - for d in data_files: - print d - f.Add(d) - print f.GetEntries() - event.readFrom(f) - branches=[i.GetName() for i in f.GetListOfBranches()] - qa=GetConfiguredQA(branches) - run_test(qa,event) diff --git a/PhysicsAnalysis/TopPhys/QuickAna/share/AthExample.py b/PhysicsAnalysis/TopPhys/QuickAna/share/AthExample.py deleted file mode 100644 index 6b427f3fc923ad73b608c236ee6ef96dc1e317a1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/share/AthExample.py +++ /dev/null @@ -1,32 +0,0 @@ -import AthenaPoolCnvSvc.ReadAthenaPool - -theApp.EvtMax = 5 -testFile = os.getenv("ASG_TEST_FILE_MC") -svcMgr.EventSelector.InputCollections = [testFile] - -algSeq = CfgMgr.AthSequencer("AthAlgSeq") - -quickAna = CfgMgr.ana__QuickAna() -quickAna.eventinfoDef = "default" -quickAna.electronDef = "default" -quickAna.muonDef = "default" -quickAna.tauDef = "default" -quickAna.photonDef = "default" -quickAna.jetDef = "default" -quickAna.metDef = "default" -quickAna.orDef = "default" - -# We just need some files for testing. Do not use these in your analysis -quickAna.muMcFiles = ["dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root"] -# Using test file from SUSYTools -quickAna.muDataFiles = ["dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"] - -ToolSvc += quickAna - -alg = CfgMgr.ana__AthExample() -alg.quickAna = quickAna -algSeq += alg - -# Some log suppression -include("AthAnalysisBaseComps/SuppressLogging.py") diff --git a/PhysicsAnalysis/TopPhys/QuickAna/share/AthExample_AFII.py b/PhysicsAnalysis/TopPhys/QuickAna/share/AthExample_AFII.py deleted file mode 100644 index de7c0d04f3c6a285ac034cc2497fe28db5ed66bc..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/share/AthExample_AFII.py +++ /dev/null @@ -1,32 +0,0 @@ -import AthenaPoolCnvSvc.ReadAthenaPool - -theApp.EvtMax = 5 -testFile = os.getenv("ASG_TEST_FILE_MC_AFII") -svcMgr.EventSelector.InputCollections = [testFile] - -algSeq = CfgMgr.AthSequencer("AthAlgSeq") - -quickAna = CfgMgr.ana__QuickAna() -quickAna.eventinfoDef = "default" -quickAna.electronDef = "default" -quickAna.muonDef = "default" -quickAna.tauDef = "default" -quickAna.photonDef = "default" -quickAna.jetDef = "default" -quickAna.metDef = "default" -quickAna.orDef = "default" - -# We just need some files for testing. Do not use these in your analysis -quickAna.muMcFiles = ["dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root"] -# Using test file from SUSYTools -quickAna.muDataFiles = ["dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"] - -ToolSvc += quickAna - -alg = CfgMgr.ana__AthExample() -alg.quickAna = quickAna -algSeq += alg - -# Some log suppression -include("AthAnalysisBaseComps/SuppressLogging.py") diff --git a/PhysicsAnalysis/TopPhys/QuickAna/share/AthExample_data.py b/PhysicsAnalysis/TopPhys/QuickAna/share/AthExample_data.py deleted file mode 100644 index a08428c9bb9b699731742409b0874656c61abcae..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/share/AthExample_data.py +++ /dev/null @@ -1,32 +0,0 @@ -import AthenaPoolCnvSvc.ReadAthenaPool - -theApp.EvtMax = 5 -testFile = os.getenv("ASG_TEST_FILE_DATA") -svcMgr.EventSelector.InputCollections = [testFile] - -algSeq = CfgMgr.AthSequencer("AthAlgSeq") - -quickAna = CfgMgr.ana__QuickAna() -quickAna.eventinfoDef = "default" -quickAna.electronDef = "default" -quickAna.muonDef = "default" -quickAna.tauDef = "default" -quickAna.photonDef = "default" -quickAna.jetDef = "default" -quickAna.metDef = "default" -quickAna.orDef = "default" - -# We just need some files for testing. Do not use these in your analysis -#quickAna.muMcFiles = ["dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", -# "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root"] -## Using test file from SUSYTools -#quickAna.muDataFiles = ["dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"] - -ToolSvc += quickAna - -alg = CfgMgr.ana__AthExample() -alg.quickAna = quickAna -algSeq += alg - -# Some log suppression -include("AthAnalysisBaseComps/SuppressLogging.py") diff --git a/PhysicsAnalysis/TopPhys/QuickAna/share/tau_selection_loose.conf b/PhysicsAnalysis/TopPhys/QuickAna/share/tau_selection_loose.conf deleted file mode 100644 index 70cae9623084635b14119f56ef9342d7c2b45e08..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/share/tau_selection_loose.conf +++ /dev/null @@ -1,11 +0,0 @@ -# Cuts to perform, need to be specified below -SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR - -PtMin: 20 -AbsEtaRegion: 0; 1.37; 1.52; 2.5 -AbsCharge: 1 -NTracks: 1; 3 -JetIDWP: JETIDBDTLOOSE -EleOLR: TRUE - -# EOF \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/QuickAna/share/tau_selection_medium.conf b/PhysicsAnalysis/TopPhys/QuickAna/share/tau_selection_medium.conf deleted file mode 100644 index a9c1a6cb91b6202619e725f6c0ded552b7e42798..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/share/tau_selection_medium.conf +++ /dev/null @@ -1,11 +0,0 @@ -# Cuts to perform, need to be specified below -SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR - -PtMin: 20 -AbsEtaRegion: 0; 1.37; 1.52; 2.5 -AbsCharge: 1 -NTracks: 1; 3 -JetIDWP: JETIDBDTMEDIUM -EleOLR: TRUE - -# EOF \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/QuickAna/share/tau_selection_tight.conf b/PhysicsAnalysis/TopPhys/QuickAna/share/tau_selection_tight.conf deleted file mode 100644 index dcaa29fd0c0d6236c6dccde561a4f41cf7018264..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/share/tau_selection_tight.conf +++ /dev/null @@ -1,11 +0,0 @@ -# Cuts to perform, need to be specified below -SelectionCuts: PtMin AbsEtaRegion AbsCharge NTracks JetIDWP EleOLR - -PtMin: 20 -AbsEtaRegion: 0; 1.37; 1.52; 2.5 -AbsCharge: 1 -NTracks: 1; 3 -JetIDWP: JETIDBDTTIGHT -EleOLR: TRUE - -# EOF \ No newline at end of file diff --git a/PhysicsAnalysis/TopPhys/QuickAna/src/AthExample.cxx b/PhysicsAnalysis/TopPhys/QuickAna/src/AthExample.cxx deleted file mode 100644 index 1ecb08751f833955907407027d1a98b7ecfb9c77..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/src/AthExample.cxx +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// QuickAna includes -#include "AthExample.h" - -#include <QuickAna/IQuickAna.h> -#include <xAODEgamma/ElectronContainer.h> - -namespace ana -{ - -AthExample::AthExample( const std::string& name, ISvcLocator* pSvcLocator ) : AthAlgorithm( name, pSvcLocator ){ - - //declareProperty( "Property", m_nProperty ); //example property declaration - - declareProperty ("quickAna", quickAna); -} - - -AthExample::~AthExample() {} - - -StatusCode AthExample::initialize() { - ATH_MSG_INFO ("Initializing " << name() << "..."); - - ATH_CHECK( quickAna.retrieve() ); - return StatusCode::SUCCESS; -} - -StatusCode AthExample::finalize() { - ATH_MSG_INFO ("Finalizing " << name() << "..."); - - return StatusCode::SUCCESS; -} - -StatusCode AthExample::execute() { - ATH_MSG_DEBUG ("Executing " << name() << "..."); - - ATH_CHECK (quickAna->process ()); - - ATH_MSG_INFO ("electron size: " << quickAna->electrons()->size()); - - return StatusCode::SUCCESS; -} - - -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/src/AthExample.h b/PhysicsAnalysis/TopPhys/QuickAna/src/AthExample.h deleted file mode 100644 index 4ea926fb7efb6b39f5ecfbff69eeb4fbeeb690b8..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/src/AthExample.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef QUICKANA_ATHEXAMPLE_H -#define QUICKANA_ATHEXAMPLE_H 1 - -#include "AthenaBaseComps/AthAlgorithm.h" - -#include <GaudiKernel/ToolHandle.h> -#include <QuickAna/Global.h> - -namespace ana -{ - -class AthExample: public ::AthAlgorithm { - public: - AthExample( const std::string& name, ISvcLocator* pSvcLocator ); - virtual ~AthExample(); - - virtual StatusCode initialize(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - ToolHandle<IQuickAna> quickAna; - - private: - -}; -} - -#endif //> !QUICKANA_ATHEXAMPLEQA_H diff --git a/PhysicsAnalysis/TopPhys/QuickAna/src/components/QuickAna_entries.cxx b/PhysicsAnalysis/TopPhys/QuickAna/src/components/QuickAna_entries.cxx deleted file mode 100644 index d59ef766cdcd5095a6c677a17e0fb3af9fbf5a94..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/src/components/QuickAna_entries.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "../AthExample.h" -#include <QuickAna/QuickAna.h> - -DECLARE_COMPONENT( ana::AthExample ) -DECLARE_COMPONENT( ana::QuickAna ) - diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/QuickAna_TestConfiguration.xml b/PhysicsAnalysis/TopPhys/QuickAna/test/QuickAna_TestConfiguration.xml deleted file mode 100755 index 73b97c2ad90ba87823e3108e39d7d466dae6baf7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/QuickAna_TestConfiguration.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0"?> -<!DOCTYPE unifiedTestConfiguration SYSTEM "http://www.hep.ucl.ac.uk/atlas/AtlasTesting/DTD/unifiedTestConfiguration.dtd"> - -<unifiedTestConfiguration> - - <!-- Athena nightly test --> - <atn> - <TEST name="QuickAnaTest" type="script" suite="QuickAnaAthTest"> - <options_atn>skip_if_libraryMissing.sh QuickAnaLib athena.py QuickAna/AthExample.py</options_atn> - <timelimit>5</timelimit> - <author> QuickAna devs </author> - <mailto> atlas-sw-quickana-developers@cern.ch </mailto> - <expectations> - <errorMessage> Athena exited abnormally </errorMessage> - <errorMessage>FAILURE (ERROR)</errorMessage> - <returnValue>0</returnValue> - </expectations> - </TEST> - <TEST name="QuickAnaTest_AFII" type="script" suite="QuickAnaAthTest"> - <options_atn>skip_if_libraryMissing.sh QuickAnaLib athena.py QuickAna/AthExample_AFII.py</options_atn> - <timelimit>5</timelimit> - <author> QuickAna devs </author> - <mailto> atlas-sw-quickana-developers@cern.ch </mailto> - <expectations> - <errorMessage> Athena exited abnormally </errorMessage> - <errorMessage>FAILURE (ERROR)</errorMessage> - <returnValue>0</returnValue> - </expectations> - </TEST> - </atn> - - <!-- RTT legacy --> - <rtt xmlns="http://www.hep.ucl.ac.uk/atlas/AtlasTesting/rtt"> - - <rttContactPerson>Monica Dobre</rttContactPerson> - <mailto>monica.dobre@cern.ch,mehta@hep.ph.liv.ac.uk,dpluth@cern.ch</mailto> - - <jobList> - <classification> - <displayClass>OfflineValidation</displayClass> - <displayProcess>Reco</displayProcess> - <displayComponent>Athena-Core</displayComponent> - </classification> - - <athena userJobId="QuickAnaTest"> - <doc> - Basic QuickAna Test - </doc> - <displayName>QuickAnaTest</displayName> - <options>AthExample.py</options> - <package>PhysicsAnalysis/TopPhys/QuickAna</package> - <group>QuickAnaAthTest</group> - <queue>medium</queue> - <testToRemove> - <jobGroupName>RTT:Top</jobGroupName> - <testidentifier>CheckFileRunner0</testidentifier> - </testToRemove> - </athena> - </jobList> - - <jobGroups> - <jobGroup name="QuickAnaAthTest" parent="Transform"> - </jobGroup> - </jobGroups> - - </rtt> - -</unifiedTestConfiguration> diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/gt_KinSelect.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/gt_KinSelect.cxx deleted file mode 100644 index afa97cb947a236abccd5f1dba0483fb54d631b8d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/gt_KinSelect.cxx +++ /dev/null @@ -1,262 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <AsgTools/MessageCheck.h> -#include <AsgTools/UnitTest.h> -#include <QuickAna/KinObjectSelect.h> -#include <QuickAna/MessageCheck.h> -#include <gtest/gtest.h> -#include <xAODJet/Jet.h> - -#ifdef ROOTCORE -#include <xAODRootAccess/Init.h> -#endif - -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -using namespace ana; - -// -// method implementations -// - -using namespace asg::msgUserCode; - -// helper function to make the momentum structure we need -ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double> > -makeMom (float pt, float eta = 0, float phi = 0) -{ - ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double> > result; - result.SetPt (pt); - result.SetEta (eta); - result.SetPhi (phi); - return result; -} - -// helper function to implement predicate tests -bool testSelect (bool pass, const ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<double> >& mom, const std::string& formula) -{ - std::unique_ptr<xAOD::Jet> jet; - jet.reset (new xAOD::Jet); - jet->makePrivateStore (); - jet->setJetP4 (mom); - KinObjectSelect select (formula); - return select.select (*jet) == pass; -} - - - -TEST (KinSelectTest, pt_pass) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "pt > 40e3"); -} - -TEST (KinSelectTest, pt_fail) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "pt > 60e3"); -} - -TEST (KinSelectTest, pt_float_fail) -{ - EXPECT_THROW_REGEX (KinObjectSelect select ("pt"), "didn't find boolean expression"); -} - -TEST (KinSelectTest, pt_fail_invalidToken) -{ - EXPECT_THROW_REGEX (KinObjectSelect select ("pt > 0 pt"), "invalid token"); -} - -TEST (KinSelectTest, eta_pass) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3, 1.5), "eta < 1.6"); -} - -TEST (KinSelectTest, eta_fail) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3, 1.5), "eta < 1.4"); -} - -TEST (KinSelectTest, phi_pass) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3, 1.5, 0.5), "phi > 0.4"); -} - -TEST (KinSelectTest, phi_fail) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3, 1.5, 0.5), "phi < 0.4"); -} - -TEST (KinSelectTest, and_true_true) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "pt > 1 && pt > 1"); -} - -TEST (KinSelectTest, and_true_false) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "pt > 1 && pt < 1"); -} - -TEST (KinSelectTest, and_false_true) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "pt < 1 && pt > 1"); -} - -TEST (KinSelectTest, and_false_false) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "pt < 1 && pt < 1"); -} - -TEST (KinSelectTest, and_true_true_true) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "pt > 1 && pt > 1 && pt > 1"); -} - -TEST (KinSelectTest, and_true_true_false) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "pt > 1 && pt > 1 && pt < 1"); -} - -TEST (KinSelectTest, and_false_true_true) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "pt < 1 && pt > 1 && pt > 1"); -} - -TEST (KinSelectTest, or_true_true) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "pt > 1 || pt > 1"); -} - -TEST (KinSelectTest, or_true_false) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "pt > 1 || pt < 1"); -} - -TEST (KinSelectTest, or_false_true) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "pt < 1 || pt > 1"); -} - -TEST (KinSelectTest, or_false_false) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "pt < 1 || pt < 1"); -} - -TEST (KinSelectTest, or_false_false_false) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "pt < 1 || pt < 1 || pt < 1"); -} - -TEST (KinSelectTest, or_false_false_true) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "pt < 1 || pt < 1 || pt > 1"); -} - -TEST (KinSelectTest, or_true_false_false) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "pt > 1 || pt < 1 || pt < 1"); -} - -TEST (KinSelectTest, and_or_fail) -{ - EXPECT_THROW_REGEX (KinObjectSelect select ("pt < 1 && pt < 1 || pt < 1"), "can't mix different logic operators without paranthesis"); -} - -TEST (KinSelectTest, or_and_fail) -{ - EXPECT_THROW_REGEX (KinObjectSelect select ("pt < 1 || pt < 1 && pt < 1"), "can't mix different logic operators without paranthesis"); -} - -TEST (KinSelectTest, parenthesis_pass) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "(pt > 1)"); -} - -TEST (KinSelectTest, parenthesis_fail) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "(pt < 1)"); -} - -TEST (KinSelectTest, parenthesis_nested_pass) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "((pt > 1))"); -} - -TEST (KinSelectTest, parenthesis_nested_fail) -{ - EXPECT_PRED3 (testSelect, false, makeMom (50e3), "((pt < 1))"); -} - -TEST (KinSelectTest, parenthesis_andDoubleOr_true_false_false_true) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "(pt > 1 || pt < 1) && (pt < 1 || pt > 1)"); -} - -TEST (KinSelectTest, parenthesis_orDoubleAnd_true_true_false_false) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "(pt > 1 && pt > 1) || (pt < 1 && pt < 1)"); -} - -TEST (KinSelectTest, parenthesis_or_false_true) -{ - EXPECT_PRED3 (testSelect, true, makeMom (50e3), "(pt < 1) || (pt > 1)"); -} - - - -const std::string congFormulaFull = "(pt > 20e3 && eta > -2.4 && eta < 2.4) || (pt > 30e3 && eta > 2.4 && eta < 4.5) || (pt > 30e3 && eta >-4.5 && eta < -2.4)"; - -TEST (CongTest, center_pass) -{ - EXPECT_PRED3 (testSelect, true, makeMom (25e3, 0), congFormulaFull); -} - -TEST (CongTest, center_fail) -{ - EXPECT_PRED3 (testSelect, false, makeMom (15e3, 0), congFormulaFull); -} - -TEST (CongTest, forward_pass) -{ - EXPECT_PRED3 (testSelect, true, makeMom (35e3, 3), congFormulaFull); -} - -TEST (CongTest, forward_fail) -{ - EXPECT_PRED3 (testSelect, false, makeMom (25e3, 3), congFormulaFull); -} - -TEST (CongTest, backward_pass) -{ - EXPECT_PRED3 (testSelect, true, makeMom (35e3, -3), congFormulaFull); -} - -TEST (CongTest, backward_fail) -{ - EXPECT_PRED3 (testSelect, false, makeMom (25e3, -3), congFormulaFull); -} - -int main (int argc, char **argv) -{ -#ifdef ROOTCORE - StatusCode::enableFailure(); - ANA_CHECK (xAOD::Init ()); -#endif - // msgKinSelect::setMsgLevel (MSG::Level::DEBUG); - ::testing::InitGoogleTest (&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_AnaToolCorrect.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/inc_AnaToolCorrect.cxx deleted file mode 100644 index 9980d5cf46ec944c874da45802093d9ed23c1774..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_AnaToolCorrect.cxx +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/AnaToolCorrect.h> - -using namespace ana; - -// -// main program -// - -int main () -{ - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_AnaToolSelect.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/inc_AnaToolSelect.cxx deleted file mode 100644 index 7b7a903a9d5d5480fa120851b8794ec8ab147b79..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_AnaToolSelect.cxx +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/AnaToolSelect.h> - -using namespace ana; - -// -// main program -// - -int main () -{ - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_AnaToolWeight.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/inc_AnaToolWeight.cxx deleted file mode 100644 index 72c46072f38b960203ae6fa77b9de70ed1f9cc9d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_AnaToolWeight.cxx +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/AnaToolWeight.h> - -using namespace ana; - -// -// main program -// - -int main () -{ - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_IAnaTool.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/inc_IAnaTool.cxx deleted file mode 100644 index b7ec32b04dfc188cbd7c04ac6f49c164c1f40cf4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_IAnaTool.cxx +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/IAnaTool.h> - -using namespace ana; - -// -// main program -// - -int main () -{ - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_IEventObjects.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/inc_IEventObjects.cxx deleted file mode 100644 index 0114a9487c9aa64991e30f916fa5e1f0b7a0daa9..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_IEventObjects.cxx +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/IEventObjects.h> - -using namespace ana; - -// -// main program -// - -int main () -{ - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_IQuickAna.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/inc_IQuickAna.cxx deleted file mode 100644 index 70c7124c36516ff1f1ed25cdf14d544611237159..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_IQuickAna.cxx +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/IQuickAna.h> - -using namespace ana; - -// -// main program -// - -int main () -{ - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_MessageCheck.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/inc_MessageCheck.cxx deleted file mode 100644 index dbff717427b99aa820fae38dbb24919da29a9069..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_MessageCheck.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/MessageCheck.h> - -using namespace ana; - -// -// main program -// - -int main () -{ - using namespace msgToolHandle; - - ANA_CHECK (StatusCode ()); - ANA_MSG_ERROR ("message"); - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_OutputToolXAOD.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/inc_OutputToolXAOD.cxx deleted file mode 100644 index aed0ebb894bbc2b0392d46f8282f7deac8be8fb4..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_OutputToolXAOD.cxx +++ /dev/null @@ -1,10 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <QuickAna/OutputToolXAOD.h> - -int main() -{ - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_xAODInclude.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/inc_xAODInclude.cxx deleted file mode 100644 index 6941141522ba1245bf20a967fdc4b2b4084cec9a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/inc_xAODInclude.cxx +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/xAODInclude.h> - -// -// main program -// - -int main () -{ - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/it_BaseTools_test.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/it_BaseTools_test.cxx deleted file mode 100644 index 9315d7481c49ce853097857dccc664e7d6510030..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/it_BaseTools_test.cxx +++ /dev/null @@ -1,810 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#include <boost/algorithm/string.hpp> -#pragma GCC diagnostic pop - -#include <AsgTools/AnaToolHandle.h> -#include <AsgTools/UnitTest.h> -#include <AssociationUtils/AltMuJetOverlapTool.h> -#include <AssociationUtils/DeltaROverlapTool.h> -#include <AssociationUtils/EleJetOverlapTool.h> -#include <AssociationUtils/EleMuSharedTrkOverlapTool.h> -#include <AssociationUtils/MuJetOverlapTool.h> -#include <AssociationUtils/OverlapRemovalTool.h> -#include <AssociationUtils/TauLooseEleOverlapTool.h> -#include <AssociationUtils/TauLooseMuOverlapTool.h> -#include <ElectronEfficiencyCorrection/AsgElectronEfficiencyCorrectionTool.h> -#include <ElectronPhotonFourMomentumCorrection/EgammaCalibrationAndSmearingTool.h> -#include <ElectronPhotonSelectorTools/AsgElectronIsEMSelector.h> -#include <ElectronPhotonSelectorTools/AsgElectronLikelihoodTool.h> -#include <ElectronPhotonSelectorTools/AsgPhotonIsEMSelector.h> -#include <ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h> -#include <IsolationCorrections/IsolationCorrectionTool.h> -#include <IsolationSelection/IsolationSelectionTool.h> -#include <JetCalibTools/JetCalibrationTool.h> -#include <JetJvtEfficiency/JetJvtEfficiency.h> -#include <JetMomentTools/JetVertexTaggerTool.h> -#include <JetResolution/JERSmearingTool.h> -#include <JetResolution/JERTool.h> -#include <JetSelectorTools/JetCleaningTool.h> -#include <JetUncertainties/JetUncertaintiesTool.h> -#include <METUtilities/METMaker.h> -#include <METUtilities/METSystematicsTool.h> -#include <MuonEfficiencyCorrections/MuonEfficiencyScaleFactors.h> -#include <MuonEfficiencyCorrections/MuonTriggerScaleFactors.h> -#include <MuonMomentumCorrections/MuonCalibrationAndSmearingTool.h> -#include <MuonSelectorTools/MuonSelectionTool.h> -#include <PhotonEfficiencyCorrection/AsgPhotonEfficiencyCorrectionTool.h> -#include <PileupReweighting/PileupReweightingTool.h> -#include <TauAnalysisTools/TauEfficiencyCorrectionsTool.h> -#include <TauAnalysisTools/TauSelectionTool.h> -#include <TauAnalysisTools/TauSmearingTool.h> -#include <TauAnalysisTools/TauTruthMatchingTool.h> -#include <TauAnalysisTools/TauTruthTrackMatchingTool.h> -#include <TrigConfxAOD/xAODConfigTool.h> -#include <gtest/gtest.h> -#include <xAODBTaggingEfficiency/BTaggingEfficiencyTool.h> -#include <xAODBTaggingEfficiency/BTaggingSelectionTool.h> - -#ifdef ROOTCORE -#include <xAODRootAccess/Init.h> -#endif - -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -// -// method implementations -// - -using namespace asg::msgUserCode; - -TEST (ToolMakeTest, make_AsgElectronLikelihoodTool) -{ - asg::AnaToolHandle<IAsgElectronLikelihoodTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("AsgElectronLikelihoodTool")); -} - -TEST (ToolMakeTest, makeNew_AsgElectronLikelihoodTool) -{ - asg::AnaToolHandle<IAsgElectronLikelihoodTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, AsgElectronLikelihoodTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_AsgElectronLikelihoodTool) -{ - asg::AnaToolHandle<IAsgElectronLikelihoodTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, AsgElectronLikelihoodTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_EgammaCalibrationAndSmearingTool) -{ - asg::AnaToolHandle<CP::IEgammaCalibrationAndSmearingTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("CP::EgammaCalibrationAndSmearingTool")); -} - -TEST (ToolMakeTest, makeNew_EgammaCalibrationAndSmearingTool) -{ - asg::AnaToolHandle<CP::IEgammaCalibrationAndSmearingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::EgammaCalibrationAndSmearingTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_EgammaCalibrationAndSmearingTool) -{ - asg::AnaToolHandle<CP::IEgammaCalibrationAndSmearingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::EgammaCalibrationAndSmearingTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_IsolationSelectionTool) -{ - asg::AnaToolHandle<CP::IIsolationSelectionTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("CP::IsolationSelectionTool")); -} - -TEST (ToolMakeTest, makeNew_IsolationSelectionTool) -{ - asg::AnaToolHandle<CP::IIsolationSelectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::IsolationSelectionTool)); -} - -TEST (ToolMakeTest, initialize_IsolationSelectionTool) -{ - asg::AnaToolHandle<CP::IIsolationSelectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::IsolationSelectionTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_AsgElectronEfficiencyCorrectionTool) -{ - asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("AsgElectronEfficiencyCorrectionTool")); -} - -TEST (ToolMakeTest, DISABLED_makeNew_AsgElectronEfficiencyCorrectionTool) -{ - asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, AsgElectronEfficiencyCorrectionTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_AsgElectronEfficiencyCorrectionTool) -{ - asg::AnaToolHandle<IAsgElectronEfficiencyCorrectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, AsgElectronEfficiencyCorrectionTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_MuonSelectionTool) -{ - asg::AnaToolHandle<CP::IMuonSelectionTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("CP::MuonSelectionTool")); -} - -TEST (ToolMakeTest, makeNew_MuonSelectionTool) -{ - asg::AnaToolHandle<CP::IMuonSelectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::MuonSelectionTool)); -} - -TEST (ToolMakeTest, initialize_MuonSelectionTool) -{ - asg::AnaToolHandle<CP::IMuonSelectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::MuonSelectionTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_JetCalibrationTool) -{ - asg::AnaToolHandle<IJetCalibrationTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("JetCalibrationTool")); -} - -TEST (ToolMakeTest, makeNew_JetCalibrationTool) -{ - asg::AnaToolHandle<IJetCalibrationTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JetCalibrationTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_JetCalibrationTool) -{ - asg::AnaToolHandle<IJetCalibrationTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JetCalibrationTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_JetUncertaintiesTool) -{ - asg::AnaToolHandle<IJetUncertaintiesTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("JetUncertaintiesTool")); -} - -TEST (ToolMakeTest, makeNew_JetUncertaintiesTool) -{ - asg::AnaToolHandle<IJetUncertaintiesTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JetUncertaintiesTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_JetUncertaintiesTool) -{ - asg::AnaToolHandle<IJetUncertaintiesTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JetUncertaintiesTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_JERTool) -{ - asg::AnaToolHandle<IJERTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("JERTool")); -} - -TEST (ToolMakeTest, makeNew_JERTool) -{ - asg::AnaToolHandle<IJERTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JERTool)); -} - -TEST (ToolMakeTest, initialize_JERTool) -{ - asg::AnaToolHandle<IJERTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JERTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_JERSmearingTool) -{ - asg::AnaToolHandle<IJERSmearingTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("JERSmearingTool")); -} - -TEST (ToolMakeTest, makeNew_JERSmearingTool) -{ - asg::AnaToolHandle<IJERSmearingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JERSmearingTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_JERSmearingTool) -{ - asg::AnaToolHandle<IJERSmearingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JERSmearingTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_JetVertexTaggerTool) -{ - asg::AnaToolHandle<IJetUpdateJvt> handle ("tool"); - ASSERT_SUCCESS (handle.make ("JetVertexTaggerTool")); -} - -TEST (ToolMakeTest, makeNew_JetVertexTaggerTool) -{ - asg::AnaToolHandle<IJetUpdateJvt> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JetVertexTaggerTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_JetVertexTaggerTool) -{ - asg::AnaToolHandle<IJetUpdateJvt> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JetVertexTaggerTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_BTaggingSelectionTool) -{ - asg::AnaToolHandle<IBTaggingSelectionTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("BTaggingSelectionTool")); -} - -TEST (ToolMakeTest, makeNew_BTaggingSelectionTool) -{ - asg::AnaToolHandle<IBTaggingSelectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, BTaggingSelectionTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_BTaggingSelectionTool) -{ - asg::AnaToolHandle<IBTaggingSelectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, BTaggingSelectionTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_JetCleaningTool) -{ - asg::AnaToolHandle<IJetSelector> handle ("tool"); - ASSERT_SUCCESS (handle.make ("JetCleaningTool")); -} - -TEST (ToolMakeTest, makeNew_JetCleaningTool) -{ - asg::AnaToolHandle<IJetSelector> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JetCleaningTool)); -} - -TEST (ToolMakeTest, initialize_JetCleaningTool) -{ - asg::AnaToolHandle<IJetSelector> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, JetCleaningTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_BTaggingEfficiencyTool) -{ - asg::AnaToolHandle<IBTaggingEfficiencyTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("BTaggingEfficiencyTool")); -} - -TEST (ToolMakeTest, DISABLED_makeNew_BTaggingEfficiencyTool) -{ - asg::AnaToolHandle<IBTaggingEfficiencyTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, BTaggingEfficiencyTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_BTaggingEfficiencyTool) -{ - asg::AnaToolHandle<IBTaggingEfficiencyTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, BTaggingEfficiencyTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_JetJvtEfficiency) -{ - asg::AnaToolHandle<CP::IJetJvtEfficiency> handle ("tool"); - ASSERT_SUCCESS (handle.make ("CP::JetJvtEfficiency")); -} - -TEST (ToolMakeTest, makeNew_JetJvtEfficiency) -{ - asg::AnaToolHandle<CP::IJetJvtEfficiency> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::JetJvtEfficiency)); -} - -TEST (ToolMakeTest, initialize_JetJvtEfficiency) -{ - asg::AnaToolHandle<CP::IJetJvtEfficiency> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::JetJvtEfficiency)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_AltMuJetOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("ORUtils::AltMuJetOverlapTool")); -} - -TEST (ToolMakeTest, makeNew_AltMuJetOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::AltMuJetOverlapTool)); -} - -TEST (ToolMakeTest, initialize_AltMuJetOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::AltMuJetOverlapTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_DeltaROverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("ORUtils::DeltaROverlapTool")); -} - -TEST (ToolMakeTest, makeNew_DeltaROverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::DeltaROverlapTool)); -} - -TEST (ToolMakeTest, initialize_DeltaROverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::DeltaROverlapTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_EleJetOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("ORUtils::EleJetOverlapTool")); -} - -TEST (ToolMakeTest, makeNew_EleJetOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::EleJetOverlapTool)); -} - -TEST (ToolMakeTest, initialize_EleJetOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::EleJetOverlapTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_EleMuSharedTrkOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("ORUtils::EleMuSharedTrkOverlapTool")); -} - -TEST (ToolMakeTest, makeNew_EleMuSharedTrkOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::EleMuSharedTrkOverlapTool)); -} - -TEST (ToolMakeTest, initialize_EleMuSharedTrkOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::EleMuSharedTrkOverlapTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_MuJetOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("ORUtils::MuJetOverlapTool")); -} - -TEST (ToolMakeTest, makeNew_MuJetOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::MuJetOverlapTool)); -} - -TEST (ToolMakeTest, initialize_MuJetOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::MuJetOverlapTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_TauLooseEleOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("ORUtils::TauLooseEleOverlapTool")); -} - -TEST (ToolMakeTest, makeNew_TauLooseEleOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::TauLooseEleOverlapTool)); -} - -TEST (ToolMakeTest, initialize_TauLooseEleOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::TauLooseEleOverlapTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_TauLooseMuOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("ORUtils::TauLooseMuOverlapTool")); -} - -TEST (ToolMakeTest, makeNew_TauLooseMuOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::TauLooseMuOverlapTool)); -} - -TEST (ToolMakeTest, initialize_TauLooseMuOverlapTool) -{ - asg::AnaToolHandle<ORUtils::IOverlapTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ORUtils::TauLooseMuOverlapTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_OverlapRemovalTool) -{ - asg::AnaToolHandle<IOverlapRemovalTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("OverlapRemovalTool")); -} - -TEST (ToolMakeTest, makeNew_OverlapRemovalTool) -{ - asg::AnaToolHandle<IOverlapRemovalTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, OverlapRemovalTool)); -} - -TEST (ToolMakeTest, initialize_OverlapRemovalTool) -{ - asg::AnaToolHandle<IOverlapRemovalTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, OverlapRemovalTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_METMaker) -{ - asg::AnaToolHandle<IMETMaker> handle ("tool"); - ASSERT_SUCCESS (handle.make ("met::METMaker")); -} - -TEST (ToolMakeTest, makeNew_METMaker) -{ - asg::AnaToolHandle<IMETMaker> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, met::METMaker)); -} - -TEST (ToolMakeTest, initialize_METMaker) -{ - asg::AnaToolHandle<IMETMaker> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, met::METMaker)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_METSystematicsTool) -{ - asg::AnaToolHandle<IMETSystematicsTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("met::METSystematicsTool")); -} - -TEST (ToolMakeTest, makeNew_METSystematicsTool) -{ - asg::AnaToolHandle<IMETSystematicsTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, met::METSystematicsTool)); -} - -TEST (ToolMakeTest, initialize_METSystematicsTool) -{ - asg::AnaToolHandle<IMETSystematicsTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, met::METSystematicsTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_MuonCalibrationAndSmearingTool) -{ - asg::AnaToolHandle<CP::IMuonCalibrationAndSmearingTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("CP::MuonCalibrationAndSmearingTool")); -} - -TEST (ToolMakeTest, makeNew_MuonCalibrationAndSmearingTool) -{ - asg::AnaToolHandle<CP::IMuonCalibrationAndSmearingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::MuonCalibrationAndSmearingTool)); -} - -TEST (ToolMakeTest, initialize_MuonCalibrationAndSmearingTool) -{ - asg::AnaToolHandle<CP::IMuonCalibrationAndSmearingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::MuonCalibrationAndSmearingTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_MuonEfficiencyScaleFactors) -{ - asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> handle ("tool"); - ASSERT_SUCCESS (handle.make ("CP::MuonEfficiencyScaleFactors")); -} - -TEST (ToolMakeTest, makeNew_MuonEfficiencyScaleFactors) -{ - asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::MuonEfficiencyScaleFactors)); -} - -TEST (ToolMakeTest, DISABLED_initialize_MuonEfficiencyScaleFactors) -{ - asg::AnaToolHandle<CP::IMuonEfficiencyScaleFactors> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::MuonEfficiencyScaleFactors)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_ElectronPhotonShowerShapeFudgeTool) -{ - asg::AnaToolHandle<IElectronPhotonShowerShapeFudgeTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("ElectronPhotonShowerShapeFudgeTool")); -} - -TEST (ToolMakeTest, makeNew_ElectronPhotonShowerShapeFudgeTool) -{ - asg::AnaToolHandle<IElectronPhotonShowerShapeFudgeTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ElectronPhotonShowerShapeFudgeTool)); -} - -TEST (ToolMakeTest, initialize_ElectronPhotonShowerShapeFudgeTool) -{ - asg::AnaToolHandle<IElectronPhotonShowerShapeFudgeTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, ElectronPhotonShowerShapeFudgeTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_IsolationCorrectionTool) -{ - asg::AnaToolHandle<CP::IIsolationCorrectionTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("CP::IsolationCorrectionTool")); -} - -TEST (ToolMakeTest, makeNew_IsolationCorrectionTool) -{ - asg::AnaToolHandle<CP::IIsolationCorrectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::IsolationCorrectionTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_IsolationCorrectionTool) -{ - asg::AnaToolHandle<CP::IIsolationCorrectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::IsolationCorrectionTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_AsgPhotonIsEMSelector) -{ - asg::AnaToolHandle<IAsgPhotonIsEMSelector> handle ("tool"); - ASSERT_SUCCESS (handle.make ("AsgPhotonIsEMSelector")); -} - -TEST (ToolMakeTest, makeNew_AsgPhotonIsEMSelector) -{ - asg::AnaToolHandle<IAsgPhotonIsEMSelector> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, AsgPhotonIsEMSelector)); -} - -TEST (ToolMakeTest, initialize_AsgPhotonIsEMSelector) -{ - asg::AnaToolHandle<IAsgPhotonIsEMSelector> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, AsgPhotonIsEMSelector)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_AsgPhotonEfficiencyCorrectionTool) -{ - asg::AnaToolHandle<IAsgPhotonEfficiencyCorrectionTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("AsgPhotonEfficiencyCorrectionTool")); -} - -TEST (ToolMakeTest, makeNew_AsgPhotonEfficiencyCorrectionTool) -{ - asg::AnaToolHandle<IAsgPhotonEfficiencyCorrectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, AsgPhotonEfficiencyCorrectionTool)); -} - -TEST (ToolMakeTest, DISABLED_initialize_AsgPhotonEfficiencyCorrectionTool) -{ - asg::AnaToolHandle<IAsgPhotonEfficiencyCorrectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, AsgPhotonEfficiencyCorrectionTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_PileupReweightingTool) -{ - asg::AnaToolHandle<CP::IPileupReweightingTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("CP::PileupReweightingTool")); -} - -TEST (ToolMakeTest, makeNew_PileupReweightingTool) -{ - asg::AnaToolHandle<CP::IPileupReweightingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::PileupReweightingTool)); -} - -TEST (ToolMakeTest, initialize_PileupReweightingTool) -{ - asg::AnaToolHandle<CP::IPileupReweightingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::PileupReweightingTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_TauSmearingTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauSmearingTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("TauAnalysisTools::TauSmearingTool")); -} - -TEST (ToolMakeTest, makeNew_TauSmearingTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauSmearingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TauAnalysisTools::TauSmearingTool)); -} - -TEST (ToolMakeTest, initialize_TauSmearingTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauSmearingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TauAnalysisTools::TauSmearingTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_TauSelectionTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauSelectionTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("TauAnalysisTools::TauSelectionTool")); -} - -TEST (ToolMakeTest, makeNew_TauSelectionTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauSelectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TauAnalysisTools::TauSelectionTool)); -} - -TEST (ToolMakeTest, initialize_TauSelectionTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauSelectionTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TauAnalysisTools::TauSelectionTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_TauEfficiencyCorrectionsTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("TauAnalysisTools::TauEfficiencyCorrectionsTool")); -} - -TEST (ToolMakeTest, makeNew_TauEfficiencyCorrectionsTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TauAnalysisTools::TauEfficiencyCorrectionsTool)); -} - -TEST (ToolMakeTest, initialize_TauEfficiencyCorrectionsTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauEfficiencyCorrectionsTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TauAnalysisTools::TauEfficiencyCorrectionsTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, DISABLED_make_TauTruthMatchingTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauTruthMatchingTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("TauAnalysisTools::TauTruthMatchingTool")); -} - -TEST (ToolMakeTest, makeNew_TauTruthMatchingTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauTruthMatchingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TauAnalysisTools::TauTruthMatchingTool)); -} - -TEST (ToolMakeTest, initialize_TauTruthMatchingTool) -{ - asg::AnaToolHandle<TauAnalysisTools::ITauTruthMatchingTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TauAnalysisTools::TauTruthMatchingTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -TEST (ToolMakeTest, make_xAODConfigTool) -{ - asg::AnaToolHandle<TrigConf::ITrigConfigTool> handle ("tool"); - ASSERT_SUCCESS (handle.make ("TrigConf::xAODConfigTool")); -} - -TEST (ToolMakeTest, makeNew_xAODConfigTool) -{ - asg::AnaToolHandle<TrigConf::ITrigConfigTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TrigConf::xAODConfigTool)); -} - -TEST (ToolMakeTest, initialize_xAODConfigTool) -{ - asg::AnaToolHandle<TrigConf::ITrigConfigTool> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, TrigConf::xAODConfigTool)); - ASSERT_SUCCESS (handle.initialize ()); -} - -// TEST (ToolMakeTest, make_TrigDecisionTool) -// { -// asg::AnaToolHandle<Trig::TrigDecisionTool> handle ("tool"); -// ASSERT_SUCCESS (handle.make ("Trig::TrigDecisionTool")); -// } - -// TEST (ToolMakeTest, makeNew_TrigDecisionTool) -// { -// asg::AnaToolHandle<Trig::TrigDecisionTool> handle ("tool"); -// ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, Trig::TrigDecisionTool)); -// } - -// TEST (ToolMakeTest, DISABLED_initialize_TrigDecisionTool) -// { -// asg::AnaToolHandle<Trig::TrigDecisionTool> handle ("tool"); -// ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, Trig::TrigDecisionTool)); -// ASSERT_SUCCESS (handle.initialize ()); -// } - -TEST (ToolMakeTest, DISABLED_make_MuonTriggerScaleFactors) -{ - asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> handle ("tool"); - ASSERT_SUCCESS (handle.make ("CP::MuonTriggerScaleFactors")); -} - -TEST (ToolMakeTest, makeNew_MuonTriggerScaleFactors) -{ - asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::MuonTriggerScaleFactors)); -} - -TEST (ToolMakeTest, initialize_MuonTriggerScaleFactors) -{ - asg::AnaToolHandle<CP::IMuonTriggerScaleFactors> handle ("tool"); - ASSERT_SUCCESS (ASG_MAKE_ANA_TOOL (handle, CP::MuonTriggerScaleFactors)); - ASSERT_SUCCESS (handle.initialize ()); -} - -int main (int argc, char **argv) -{ -#ifdef ROOTCORE - StatusCode::enableFailure(); - ANA_CHECK (xAOD::Init ()); -#endif - ::testing::InitGoogleTest (&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_MessageCheck.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_MessageCheck.cxx deleted file mode 100644 index c8599aca31ac0ece9413f7652e03b9897d34018b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_MessageCheck.cxx +++ /dev/null @@ -1,149 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/MessageCheck.h> -#include <QuickAna/Global.h> - -#include <QuickAna/SelectionChoice.h> -#include <QuickAna/SelectionCut.h> -#include <QuickAna/SelectionData.h> -#include <RootCoreUtils/Assert.h> -#include <PATInterfaces/CorrectionCode.h> -#include <PATInterfaces/SystematicCode.h> -#include <EventLoop/StatusCode.h> - -// -// unit test -// - -template<typename T,typename T1,typename T2> -void checkTypeWeightSingle (const T& scSuccess, const CP::CorrectionCode& scTest, - bool expectedSuccess, bool expectedFinish, - bool expectedSet, - std::function<bool(T)> successTest) -{ - using namespace ana::msgUserCode; - - bool finish = false; - T1 weightVar = -7; - std::function<CP::CorrectionCode (T2& weight)> func - ([&] (T2& weight) -> CP::CorrectionCode { - weight = 42; return scTest;}); - T mySC = [&] () -> T { - ANA_CHECK_SET_TYPE (T); - QA_CHECK_WEIGHT (T2, weightVar, func (weightVar)); - finish = true; - return scSuccess;} (); - RCU_ASSERT (successTest (mySC) == expectedSuccess); - RCU_ASSERT (finish == expectedFinish); - if (expectedSet) - RCU_ASSERT (weightVar == 42); - else - RCU_ASSERT (weightVar == -7); -} - -template<typename T,typename T1,typename T2> -void checkTypeWeight (const T& scSuccess, std::function<bool(T)> successTest) -{ - checkTypeWeightSingle<T,T1,T2> (scSuccess, CP::CorrectionCode::Ok, - true, true, true, successTest); - checkTypeWeightSingle<T,T1,T2> (scSuccess, CP::CorrectionCode::OutOfValidityRange, - true, true, false, successTest); - checkTypeWeightSingle<T,T1,T2> (scSuccess, CP::CorrectionCode::Error, - false, false, false, successTest); -} - -template<typename T> -void checkTypeCutSingle (const T& scSuccess, const CP::CorrectionCode& scTest, - bool expectedSuccess, bool expectedFinish, - ana::SelectionChoice expectedGet, - std::function<bool(T)> successTest) -{ - using namespace ana::msgUserCode; - - // manually made cut - ana::SelectionData selData; - ana::SelectionCut selCut; - selData.registerCut (ana::SelectionStep::MANUAL, "test", selCut); - - bool finish = false; - T mySC = [&] () -> T { - ANA_CHECK_SET_TYPE (T); - QA_CHECK_CUT (selCut, scTest); - finish = true; - return scSuccess;} (); - RCU_ASSERT (successTest (mySC) == expectedSuccess); - RCU_ASSERT (finish == expectedFinish); - RCU_ASSERT (expectedGet == selCut.get()); -} - -template<typename T> -void checkTypeCut (const T& scSuccess, std::function<bool(T)> successTest) -{ - checkTypeCutSingle<T> (scSuccess, CP::CorrectionCode::Ok, - true, true, ana::SelectionChoice::PASS, successTest); - checkTypeCutSingle<T> (scSuccess, CP::CorrectionCode::OutOfValidityRange, - true, false, ana::SelectionChoice::FAIL, successTest); - checkTypeCutSingle<T> (scSuccess, CP::CorrectionCode::Error, - false, false, ana::SelectionChoice::UNASSIGNED, successTest); -} - -template<typename T> -void checkTypeSingle (const T& scSuccess, const T& scTest, bool expectedSuccess, - std::function<bool(T)> successTest) -{ - using namespace ana::msgUserCode; - - bool success = false; - T mySC = [&] () -> T { - ANA_CHECK_SET_TYPE (T); - ANA_CHECK (scTest); - success = true; - return scSuccess; - } (); - RCU_ASSERT (successTest (mySC) == expectedSuccess); - RCU_ASSERT (success == expectedSuccess); -} - -template<typename T> -void checkType (const T& scSuccess, const T& scFailure1, const T& scFailure2, - std::function<bool(T)> successTest) -{ - checkTypeSingle<T> (scSuccess, scSuccess, true, successTest); - checkTypeSingle<T> (scSuccess, scFailure1, false, successTest); - checkTypeSingle<T> (scSuccess, scFailure2, false, successTest); - - checkTypeWeight<T,float,float> (scSuccess, successTest); - checkTypeWeight<T,float,double> (scSuccess, successTest); - checkTypeWeight<T,double,float> (scSuccess, successTest); - checkTypeWeight<T,double,double> (scSuccess, successTest); -} - -int main () -{ - ana::enableStatusCodeFailure (); - - checkType<StatusCode> (StatusCode::SUCCESS, StatusCode::FAILURE, StatusCode::FAILURE, [] (const StatusCode& sc) -> bool {return sc.isSuccess();}); - checkType<xAOD::TReturnCode> (xAOD::TReturnCode::kSuccess, xAOD::TReturnCode::kFailure, xAOD::TReturnCode::kRecoverable, [] (const xAOD::TReturnCode& sc) -> bool {return sc.isSuccess();}); - checkType<EL::StatusCode> (EL::StatusCode::SUCCESS, EL::StatusCode::FAILURE, EL::StatusCode::FAILURE, [] (const EL::StatusCode& sc) -> bool {return sc == EL::StatusCode::SUCCESS;}); - checkType<CP::CorrectionCode> (CP::CorrectionCode::Ok, CP::CorrectionCode::Error, CP::CorrectionCode::OutOfValidityRange, [] (const CP::CorrectionCode& sc) -> bool {return sc == CP::CorrectionCode::Ok;}); - checkType<CP::SystematicCode> (CP::SystematicCode::Ok, CP::SystematicCode::Unsupported, CP::SystematicCode::Unsupported, [] (const CP::SystematicCode& sc) -> bool {return sc == CP::SystematicCode::Ok;}); - checkType<bool> (true, false, false, [] (const bool& sc) -> bool {return sc;}); - - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_OutputToolXAOD.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_OutputToolXAOD.cxx deleted file mode 100644 index 61b1cb610de22b8cd9282ecf813cc3cbb834e0f5..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_OutputToolXAOD.cxx +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// EDM -#include "xAODEventInfo/EventInfo.h" -#include "xAODEgamma/ElectronContainer.h" -#include "xAODMissingET/MissingETContainer.h" -#include "xAODMissingET/MissingETAuxContainer.h" -#include "xAODCore/ShallowAuxInfo.h" -#include "xAODCore/ShallowAuxContainer.h" -#include "QuickAna/OutputToolXAOD.h" -#include <xAODRootAccess/Init.h> - -int main(int, char **argv) -{ - // declare the return type of this function for ANA_CHECK - ANA_CHECK_SET_TYPE (int); - - // needed for messaging macros - using namespace ana::msgUserCode; - - // make unchecked status codes abort the job - ana::enableStatusCodeFailure (); - - // initialize xAOD classes - ANA_CHECK (xAOD::Init (argv[0])); - - // Try instantiating the tools - ana::OutputToolXAOD<xAOD::EventInfo, xAOD::ShallowAuxInfo> - t1("EventInfoOutputTool"); - ana::OutputToolXAOD<xAOD::ElectronContainer, xAOD::ShallowAuxContainer> - t2("ElectronOutputTool"); - ana::OutputToolXAOD<xAOD::MissingETContainer, xAOD::MissingETAuxContainer> - t3("MetOutputTool"); - - ANA_CHECK( t1.initialize() ); - ANA_CHECK( t2.initialize() ); - ANA_CHECK( t3.initialize() ); - - return 0; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_event_data_filler.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_event_data_filler.sh deleted file mode 100755 index 96cb8f7c4657dca3ad255fce83d874bbad9525f5..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_event_data_filler.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ASG_TEST_FILE_MC" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_event_data_filler "$FILE" basic -quickana_event_data_filler "$FILE" optimized diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_eventloop_example.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_eventloop_example.sh deleted file mode 100755 index 91f032a6cf491569f5b78c77c199de3430cce597..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_eventloop_example.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ROOTCORE_TEST_FILE" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -FILE="`dirname $FILE`" - -root -l -b -q "$ROOTCOREDIR/scripts/load_packages.C" $ROOTCOREBIN/user_scripts/QuickAna/el_example.C'("submitDir","'$FILE'")' diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_python.py b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_python.py deleted file mode 100755 index 4dad3f1a04d0ced71212aa469806022eeac7106d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_python.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# Set up ROOT and RootCore: -import ROOT -from glob import glob -import itertools -import os -import sys - -if os.getenv("ROOTCORE_AUTO_UT") == "1" and os.getenv("ROOTCORE_SLOW_UT") != "1": - sys.exit(0) - -ROOT.gROOT.Macro( '$ROOTCOREDIR/scripts/load_packages.C' ) - -# Initialize the xAOD infrastructure: -if not ROOT.xAOD.Init().isSuccess(): - raise Exception('Failed xAOD.Init') - -ROOT.xAOD.AuxContainerBase() -event = ROOT.xAOD.TEvent(); -store = ROOT.xAOD.TStore(); - -data_files = [ os.getenv("ROOTCORE_TEST_FILE") ] - -# Set quickana do this before opening root file to prevent dictionary clash problems - -qa = ROOT.ana.QuickAna("QuickAna") - -qa.eventinfoDef = "default"; -qa.muonDef = "default"; -qa.electronDef = "default"; -qa.photonDef = "default"; -qa.tauDef = "default"; -qa.jetDef = "default"; -qa.jetKine = "pt > 50e3"; -qa.metDef = "default"; -qa.orDef = "default"; - -# We just need some files for testing. Do not use these in your analysis -qa.muMcFiles.push_back(ROOT.string( - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root")) -qa.muMcFiles.push_back(ROOT.string( - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root")) -# Using test file from SUSYTools -qa.muDataFiles.push_back(ROOT.string("dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root")) - -# Set up the input files: - -treeName = "CollectionTree" # default when making transient tree anyway -f = ROOT.TChain(treeName) - -for d in data_files[0:10]: - print d - f.Add(d) -print f.GetEntries() -#t = ROOT.xAOD.MakeTransientTree(f) -t = ROOT.xAOD.MakeTransientTree(f, ROOT.xAOD.TEvent.kAthenaAccess) - -# Initialize QuickAna -if not qa.initialize().isSuccess(): - raise Exception('Failed to initialize QuickAna') - -entries = t.GetEntries() -if entries > 100 : - entries = 100 - pass - -# Print some information: -print( "Number of input events: %s" % entries ) - -# let's only run over the first 100 events for this example -for entry in xrange(entries) : - t.GetEntry( entry ) - qa.process().ignore() - qa.muons() - qa.electrons() - qa.taus() - qa.jets() - qa.photons() - qa.met() - store.clear() - -del qa - -ROOT.xAOD.ClearTransientTrees() diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_python_no_qa.py b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_python_no_qa.py deleted file mode 100755 index dd0bf26782ca91b6eaf8119f6104c498f187d075..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_python_no_qa.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# Set up ROOT and RootCore: -import ROOT -from glob import glob -import itertools -import os -import sys - -if os.getenv("ROOTCORE_AUTO_UT") == "1" and os.getenv("ROOTCORE_SLOW_UT") != "1": - sys.exit(0) - -ROOT.gROOT.Macro( '$ROOTCOREDIR/scripts/load_packages.C' ) - -# Initialize the xAOD infrastructure: -if not ROOT.xAOD.Init().isSuccess(): - raise Exception('Failed xAOD.Init') - -ROOT.xAOD.AuxContainerBase() -event = ROOT.xAOD.TEvent(); -store = ROOT.xAOD.TStore(); - -data_files = [ os.getenv("ROOTCORE_TEST_FILE") ] - -# Set quickana do this before opening root file to prevent dictionary clash problems - -# Set up the input files: - -treeName = "CollectionTree" # default when making transient tree anyway -f = ROOT.TChain(treeName) - -for d in data_files[0:10]: - print d - f.Add(d) -print f.GetEntries() -#t = ROOT.xAOD.MakeTransientTree(f) -t = ROOT.xAOD.MakeTransientTree(f, ROOT.xAOD.TEvent.kAthenaAccess) - -entries = t.GetEntries() -if entries > 100 : - entries = 100 - pass - -# Print some information: -print( "Number of input events: %s" % entries ) - -# let's only run over the first 100 events for this example -for entry in xrange(entries) : - t.GetEntry( entry ) - store.clear() - -ROOT.xAOD.ClearTransientTrees() diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_basic.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_basic.sh deleted file mode 100755 index d4575b34ed31bb5e6f2ce332e62fe12b35dd5ac2..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_basic.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ROOTCORE_TEST_FILE" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_basic "$FILE" output.root diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_hammercloud.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_hammercloud.sh deleted file mode 100755 index 3f9907dea3add969bf3f9a7e56babad67160f7c1..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_hammercloud.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ROOTCORE_TEST_FILE" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -# check that we can run 3 files this way: -quickana_hammercloud "$FILE,$FILE,$FILE" diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_multi_wp.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_multi_wp.sh deleted file mode 100755 index f18f38a61907c205a44e34cad59c889974bf2feb..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_multi_wp.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ROOTCORE_TEST_FILE" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_multi_wp "$FILE" output.root diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_optimized.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_optimized.sh deleted file mode 100755 index 1eef134b01b3fe5a747948e406c030f34053de8b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_optimized.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ROOTCORE_TEST_FILE" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_basic "$FILE" output.root optimized diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_output.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_output.sh deleted file mode 100755 index 5f23c4aa33a2dfc4060af470eba673e7096c4079..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_output.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ASG_TEST_FILE_MC" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_output "$FILE" output.root diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_trigger.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_trigger.sh deleted file mode 100755 index 20bdf4b14745adbcb4c59a0f20443361617c08b5..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_trigger.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ROOTCORE_TEST_FILE" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_trigger "$FILE" output.root diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate.sh deleted file mode 100755 index f12dfd3944b60db8e64c5e5d6f27a1f933e8a809..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ROOTCORE_TEST_FILE" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_validate --el-input-file "$FILE" output -#quickana_validate output diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_eletron.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_eletron.sh deleted file mode 100755 index 8faca05aaf81528b7f1816a482b2699b11ef78ea..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_eletron.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ASG_TEST_FILE_MC" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_validate --qa-no-default-def --qa-electron-def default --el-input-file "$FILE" output diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_fat_jet.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_fat_jet.sh deleted file mode 100755 index 051fa27396c9a401d75e4d6fdb1529f5f91c9bc3..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_fat_jet.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ASG_TEST_FILE_MC" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_validate --qa-no-default-def --qa-fat-jet-def default --el-input-file "$FILE" output diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_jet.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_jet.sh deleted file mode 100755 index 6b091f322ec046f840cd326cc0341624db7d3f2f..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_jet.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ASG_TEST_FILE_MC" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_validate --qa-no-default-def --qa-jet-def default --el-input-file "$FILE" output diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_muon.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_muon.sh deleted file mode 100755 index 3b2f74edfb67794c7d7b99e1eb483be3f814bcea..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_muon.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ASG_TEST_FILE_MC" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_validate --qa-no-default-def --qa-muon-def default --el-input-file "$FILE" output diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_photon.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_photon.sh deleted file mode 100755 index c86fd183ea4288e34de240e4fa95fad5cc48acab..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_photon.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ASG_TEST_FILE_MC" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_validate --qa-no-default-def --qa-photon-def default --el-input-file "$FILE" output diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_tau.sh b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_tau.sh deleted file mode 100755 index 289e8231340974af80d5a2ddf81b31cf94a8baf2..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_quickana_validate_tau.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -if test "$ROOTCORE_AUTO_UT" == "1" -a "$ROOTCORE_SLOW_UT" != "1" -then - exit 0 -fi - -set -e -set -u - -FILE="$ASG_TEST_FILE_MC" -if test "$FILE" == "" -then - echo no test file set - exit 1 -fi -if test \! -f "$FILE" -then - echo file does not exist: $FILE - exit 1 -fi - -quickana_validate --qa-no-default-def --qa-tau-def default --el-input-file "$FILE" output diff --git a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_xaod_truth.cxx b/PhysicsAnalysis/TopPhys/QuickAna/test/ut_xaod_truth.cxx deleted file mode 100644 index 9e47140bb6f36773c854c1b353a898e4dbab163e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/test/ut_xaod_truth.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <QuickAna/Global.h> - -#include <QuickAna/MessageCheck.h> -#include <QuickAna/xAODTruth.h> -#include <RootCoreUtils/Assert.h> -#include <TFile.h> -#include <cstdlib> -#include <iostream> -#include <xAODRootAccess/Init.h> -#include <xAODRootAccess/TEvent.h> -#include <xAODRootAccess/TStore.h> - -using namespace ana; - -// -// unit test -// - -int main () -{ - ANA_CHECK_SET_TYPE (int); - - // needed to make messaging work - using namespace ana::msgUserCode; - - // initialize xAOD classes - ana::enableStatusCodeFailure (); - ANA_CHECK (xAOD::Init ()); - - const char *name = "TruthParticles"; - - const char *fileName = getenv ("ROOTCORE_TEST_FILE"); - if (fileName == nullptr) - { - ATH_MSG_ERROR ("no test file defined, exiting"); - return EXIT_SUCCESS; - } - - std::unique_ptr<TFile> file (TFile::Open (fileName)); - xAOD::TEvent event (xAOD::TEvent::kAthenaAccess); - xAOD::TStore store; - ANA_CHECK (event.readFrom (file.get())); - - event.getEntry (0); - RCU_ASSERT (getCTruth (event, name) != nullptr); - RCU_ASSERT (getCTruth (event) != nullptr); - RCU_ASSERT (getCTruth (name) != nullptr); - RCU_ASSERT (getCTruth () != nullptr); - RCU_ASSERT (getCTruth ("UnknownName", true) == nullptr); - try - { - getCTruth ("TruthParticlesDummy"); - RCU_ASSERT0 ("test did not fail"); - } catch (...) {} - - return EXIT_SUCCESS; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_basic.cxx b/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_basic.cxx deleted file mode 100644 index eafac270242bb106702561a8fb1011ef460f724e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_basic.cxx +++ /dev/null @@ -1,158 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <PATInterfaces/CorrectionCode.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <TFile.h> -#include <TH1.h> -#include <chrono> -#include <xAODRootAccess/Init.h> - -// -// main program -// - -int main (int argc, char **argv) -{ - // declare the return type of this function for ANA_CHECK - ANA_CHECK_SET_TYPE (int); - - // needed for messaging macros - using namespace ana::msgUserCode; - - // make unchecked status codes abort the job - ana::enableStatusCodeFailure (); - - // initialize xAOD classes - ANA_CHECK (xAOD::Init ()); - - - // command line processing - if (argc < 3 || argc > 4) - { - ATH_MSG_ERROR ("usage: " << argv[0] - << " <xAOD.root> <output.root> [<schedulerDef>]"); - return EXIT_FAILURE; - } - const std::string input_file = argv[1]; - const std::string output_file = argv[2]; - - // open and attach input xAOD file - std::unique_ptr<TFile> file (TFile::Open (input_file.c_str())); - xAOD::TEvent event (xAOD::TEvent::kAthenaAccess); - xAOD::TStore store; - ANA_CHECK (event.readFrom (file.get())); - - // create a new QuickAna tool - ana::QuickAna *quickAna = new ana::QuickAna ("quickana"); - - // request the actual object definitions to use - quickAna->eventinfoDef = "default"; - quickAna->muonDef = "default"; - quickAna->electronDef = "default"; - quickAna->photonDef = "none"; - quickAna->tauDef = "default"; - quickAna->jetDef = "default"; - // quickAna->jetDef = "AntiKt4EMTopo"; - quickAna->jetKine = "pt > 50e3"; - quickAna->metDef = "default"; - quickAna->orDef = "default"; - // Shows how to set the message level of quickana's tools - quickAna->msgLevel = MSG::INFO; - - // We just need some files for testing. Do not use these in your analysis - quickAna->muMcFiles = { - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root", - }; - // Using test file from SUSYTools - quickAna->muDataFiles = {"dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"}; - - // use the optimized tool scheduler - if (argc>3) quickAna->schedulerDef = argv[3]; // "optimized"; - - // initialize QuickAna tool - ANA_CHECK (quickAna->initialize()); - - // make an output histogram file and histograms - TFile outputFile (output_file.c_str(), "RECREATE"); - TH1 *muon_n = new TH1F ("muon_n", "number of muons", 10, -0.5, 9.5); - TH1 *muon_pt = new TH1F ("muon_pt", "muon pt", 100, 0, 500e3); - TH1 *met_pt = new TH1F ("met_pt", "MET pt", 100, 0, 500e3); - TH1 *jet_n = new TH1F ("jet_n", "number of jets", 20, -0.5, 19.5); - TH1 *jet_pt = new TH1F ("jet_pt", "jet pt", 100, 0, 500e3); - - Long64_t entries = event.getEntries(); - if (entries > 100) - entries = 100; - ATH_MSG_INFO ("Processing " << entries << " entries"); - - const auto startTime = std::chrono::steady_clock::now(); - auto lastPrintoutTime = startTime; - for (Long64_t entry = 0; entry < entries; ++ entry) - { - const auto currentStartTime = std::chrono::steady_clock::now(); - if (currentStartTime - lastPrintoutTime > std::chrono::seconds (5)) - { - lastPrintoutTime = currentStartTime; - float rate = entry; - rate /= (lastPrintoutTime - startTime) / std::chrono::seconds(1); - ATH_MSG_INFO ("Processing entry " << entry << " " << rate << "evt/s"); - } - - store.clear (); - event.getEntry (entry); - - // run QuickAna on this event - ANA_CHECK (quickAna->process (event)); - - // loop over muons and fill pt - unsigned muon_num = 0; - for (auto muon : *quickAna->muons()) - { - if (muon->auxdata<ana::SelectType> ("ana_select")) - { - ++ muon_num; - muon_pt->Fill (muon->pt(), quickAna->weight()); - } - } - muon_n->Fill (muon_num, quickAna->weight()); - - // loop over jets and fill pt - unsigned jet_num = 0; - for (auto jet : *quickAna->jets()) - { - if (jet->auxdata<ana::SelectType> ("ana_select")) - { - ++ jet_num; - jet_pt->Fill (jet->pt(), quickAna->weight()); - } - } - jet_n->Fill (jet_num, quickAna->weight()); - - // fill MET - met_pt->Fill (quickAna->met()->met(), quickAna->weight()); - - } - - outputFile.Write (); - ATH_MSG_INFO ("finished processing successfully"); - - return EXIT_SUCCESS; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_event_data_filler.cxx b/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_event_data_filler.cxx deleted file mode 100644 index 129a3cdf2d4dc8ddcd091d341d3f102b68c7b60b..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_event_data_filler.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -/** - This executable is used by the ut_event_data_filler test. - It is otherwise likely not useful for users. -*/ - - -// -// includes -// - -#include <PATInterfaces/CorrectionCode.h> -#include <PATInterfaces/SystematicsUtil.h> -#include <QuickAna/EventData.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <TFile.h> -#include <TH1.h> -#include <chrono> -#include <xAODRootAccess/Init.h> - -// -// main program -// - -template<class T,class Store> StatusCode -check (Store& store, const ana::EventData& eventData, - ana::ObjectType type, const CP::SystematicSet& sys, - const T *ref, const std::string& sourceName) -{ - using namespace ana::msgUserCode; - - const T *obj = nullptr; - ANA_CHECK (store.retrieve (obj, eventData.getName (type, sys))); - if (obj != ref) - { - ATH_MSG_ERROR ("retrieved object inconsistent"); - return StatusCode::FAILURE; - } - auto source = eventData.getSourceName (type, sys); - if (sourceName != source) - { - ATH_MSG_ERROR ("source object inconsistent: " << sourceName << " " << source); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; -} - -int main (int argc, char ** argv) -{ - ANA_CHECK_SET_TYPE (int); - - using namespace ana::msgUserCode; - - // initialize xAOD classes - ana::enableStatusCodeFailure (); - ANA_CHECK (xAOD::Init ()); - - // command line processing - if (argc < 2 || argc > 3) - { - ATH_MSG_ERROR ("usage: " << argv[0] - << " <xAOD.root> [<schedulerDef>]"); - return EXIT_FAILURE; - } - const std::string inputFileName = argv[1]; - std::string scheduler = "basic"; - if (argc == 3) { - scheduler = argv[2]; - } - - // open and attach input xAOD file - TFile inputFile( inputFileName.c_str() ); - xAOD::TEvent event(xAOD::TEvent::kAthenaAccess); - xAOD::TStore store; - ANA_CHECK( event.readFrom(&inputFile) ); - - // create a new QuickAna tool - auto quickAna = std::make_unique<ana::QuickAna>("quickana_" + scheduler); - - // request the actual object definitions to use - quickAna->eventinfoDef = "default"; - quickAna->muonDef = "default"; - quickAna->electronDef = "default"; - quickAna->photonDef = "default"; - quickAna->tauDef = "default"; - quickAna->jetDef = "default"; - quickAna->metDef = "default"; - quickAna->orDef = "default"; - - // We just need some files for testing. Do not use these in your analysis - quickAna->muMcFiles = { - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root", - }; - // Using test file from SUSYTools - quickAna->muDataFiles = {"dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"}; - - // select the proper scheduler - quickAna->schedulerDef = scheduler; - - // initialize QuickAns tool - ANA_CHECK (quickAna->initialize()); - - ANA_CHECK (quickAna->setSystematics (CP::make_systematics_vector (quickAna->recommendedSystematics()))); - - store.clear (); - event.getEntry (0); - - ana::EventData eventData = quickAna->getEventData(); - - for (auto sys : quickAna->systematics()) - { - // apply systematic variation - if (quickAna->applySystematicVariation (sys) != CP::SystematicCode::Ok) - return EXIT_FAILURE; - - // run QuickAna on this event - ANA_CHECK (quickAna->process (event)); - - ANA_CHECK (check (event, eventData, ana::OBJECT_MUON, sys, quickAna->muons(), "Muons")); - ANA_CHECK (check (event, eventData, ana::OBJECT_ELECTRON, sys, quickAna->electrons(), "Electrons")); - ANA_CHECK (check (event, eventData, ana::OBJECT_PHOTON, sys, quickAna->photons(), "Photons")); - ANA_CHECK (check (event, eventData, ana::OBJECT_JET, sys, quickAna->jets(), "AntiKt4EMTopoJets")); - } - - return EXIT_SUCCESS; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_multi_wp.cxx b/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_multi_wp.cxx deleted file mode 100644 index ffcd5e3ae7bbf1a70701f88234886008d72388d9..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_multi_wp.cxx +++ /dev/null @@ -1,183 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <PATInterfaces/CorrectionCode.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <RootCoreUtils/Assert.h> -#include <TFile.h> -#include <TH1.h> -#include <chrono> -#include <xAODRootAccess/Init.h> - -// -// main program -// - -int main (int argc, char **argv) -{ - // declare the return type of this function for ANA_CHECK - ANA_CHECK_SET_TYPE (int); - - // needed for messaging macros - using namespace ana::msgUserCode; - - // make unchecked status codes abort the job - ana::enableStatusCodeFailure (); - - // initialize xAOD classes - ANA_CHECK (xAOD::Init ()); - - - // command line processing - if (argc != 3) - { - ATH_MSG_ERROR ("usage: " << argv[0] << " <xAOD.root> <output.root>"); - return EXIT_FAILURE; - } - const std::string input_file = argv[1]; - const std::string output_file = argv[2]; - - // open and attach input xAOD file - std::unique_ptr<TFile> file (TFile::Open (input_file.c_str())); - xAOD::TEvent event (xAOD::TEvent::kAthenaAccess); - xAOD::TStore store; - ANA_CHECK (event.readFrom (file.get())); - - // create a new QuickAna tool - ana::QuickAna *quickAna = new ana::QuickAna ("quickana"); - - // request the actual object definitions to use - quickAna->eventinfoDef = "default"; - quickAna->muonDef = "medium loose"; - - // We just need some files for testing. Do not use these in your analysis - quickAna->muMcFiles = { - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root", - }; - // Using test file from SUSYTools - quickAna->muDataFiles = {"dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"}; - - // use the optimized tool scheduler - // quickAna->schedulerDef = "optimized"; - - // initialize QuickAna tool - ANA_CHECK (quickAna->initialize()); - - // make an output histogram file and histograms - TFile outputFile (output_file.c_str(), "RECREATE"); - TH1 *muon_n_any = new TH1F ("muon_n_any", "number of any muons", 10, -0.5, 9.5); - TH1 *muon_n_medium = new TH1F ("muon_n_medium", "number of medium muons", 10, -0.5, 9.5); - TH1 *muon_n_loose = new TH1F ("muon_n_loose", "number of loose muons", 10, -0.5, 9.5); - TH1 *muon_pt_any = new TH1F ("muon_pt_any", "any muon pt", 100, 0, 500e3); - TH1 *muon_pt_medium = new TH1F ("muon_pt_medium", "medium muon pt", 100, 0, 500e3); - TH1 *muon_pt_loose = new TH1F ("muon_pt_loose", "loose muon pt", 100, 0, 500e3); - - Long64_t entries = event.getEntries(); - if (entries > 100) - entries = 100; - ATH_MSG_INFO ("Processing " << entries << " entries"); - - const auto startTime = std::chrono::steady_clock::now(); - auto lastPrintoutTime = startTime; - for (Long64_t entry = 0; entry < entries; ++ entry) - { - const auto currentStartTime = std::chrono::steady_clock::now(); - if (currentStartTime - lastPrintoutTime > std::chrono::seconds (5)) - { - lastPrintoutTime = currentStartTime; - float rate = entry; - rate /= (lastPrintoutTime - startTime) / std::chrono::seconds(1); - ATH_MSG_INFO ("Processing entry " << entry << " " << rate << "evt/s"); - } - - store.clear (); - event.getEntry (entry); - - // run QuickAna on this event - ANA_CHECK (quickAna->process (event)); - - // loop over muons and fill pt - unsigned muon_num_any = 0; - unsigned muon_num_medium = 0; - unsigned muon_num_loose = 0; - double muon_weight_any = 1; - double muon_weight_medium = 1; - double muon_weight_loose = 1; - for (auto muon : *quickAna->muons()) - { - // first check the muons that are passing the medium working - // point. since we are only looking at one working point here, - // we take both the selection and the weight from the medium - // working point, so this is pretty much the same code as in the - // basic example, but the name of the working point is - // in-grained into the decoration. - if (muon->auxdata<ana::SelectType> ("ana_select_medium")) - { - RCU_ASSERT (muon->isAvailable<float> ("ana_weight_medium")); - float myweight = muon->auxdata<float> ("ana_weight_medium"); - RCU_ASSERT (myweight > 0); - muon_pt_medium->Fill (muon->pt(), quickAna->weight() * myweight); - ++ muon_num_medium; - - // if you use multiple working points, the object weight is - // not included in the event weight, instead you need to track - // it separately, as QuickAna has no way of knowing which - // working point you choose for which object. - muon_weight_medium *= myweight; - } - - // same code for loose working points as for medium - if (muon->auxdata<ana::SelectType> ("ana_select_loose")) - { - float myweight = muon->auxdata<float> ("ana_weight_loose"); - muon_pt_loose->Fill (muon->pt(), quickAna->weight() * myweight); - ++ muon_num_loose; - muon_weight_loose *= myweight; - } - - // now this code works with muons that pass any working point. - // those muons are used with MET calculation and overlap - // removal. for actual analysis usage this is a bit tricky - // though, since you have to figure out which weight to use: is - // it loost weight for all? is it loose weight for loose muons - // and medium for medium? is the loose weight actually - // appropriate for loose-but-not-medium muons? these are - // questions that don't have easy answers, so for this example - // we fudge and just set the weight to 1, which is so clearly - // wrong that hopefully nobody is going to copy that for their - // analysis. - if (muon->auxdata<ana::SelectType> ("ana_select")) - { - float myweight = 1; // <- DON'T DO THIS!!! - muon_pt_any->Fill (muon->pt(), quickAna->weight() * myweight); - ++ muon_num_any; - muon_weight_any *= myweight; - } - } - muon_n_any->Fill (muon_num_any, quickAna->weight() * muon_weight_any); - muon_n_medium->Fill (muon_num_medium, quickAna->weight() * muon_weight_medium); - muon_n_loose->Fill (muon_num_loose, quickAna->weight() * muon_weight_loose); - } - - outputFile.Write (); - ATH_MSG_INFO ("finished processing successfully"); - - return EXIT_SUCCESS; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_output.cxx b/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_output.cxx deleted file mode 100644 index 46732f606f612fc96dc614713a14adb5f0d0cf11..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_output.cxx +++ /dev/null @@ -1,163 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <PATInterfaces/CorrectionCode.h> -#include <PATInterfaces/SystematicsUtil.h> -#include <QuickAna/Global.h> -#include <QuickAna/MasterOutputToolXAOD.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <QuickAna/EventData.h> -#include <TFile.h> -#include <chrono> -#include <xAODRootAccess/Init.h> - -// -// main program -// - -int main (int argc, char **argv) -{ - // declare the return type of this function for ANA_CHECK - ANA_CHECK_SET_TYPE (int); - - // needed for messaging macros - using namespace ana::msgUserCode; - - // make unchecked status codes abort the job - ana::enableStatusCodeFailure (); - - // initialize xAOD classes - ANA_CHECK (xAOD::Init ()); - - - // Command line processing - if (argc != 3) - { - ATH_MSG_FATAL ("usage: " << argv[0] << " <xAOD.root> <output.root>"); - return EXIT_FAILURE; - } - const std::string inputFileName = argv[1]; - const std::string outputFileName = argv[2]; - - // Open and attach input xAOD file - std::unique_ptr<TFile> inputFile (TFile::Open (inputFileName.c_str())); - xAOD::TEvent event (xAOD::TEvent::kAthenaAccess); - xAOD::TStore store; - ANA_CHECK (event.readFrom (inputFile.get())); - - // Open and attach output file - TFile outputFile(outputFileName.c_str(), "RECREATE"); - ANA_CHECK (event.writeTo(&outputFile)); - - // Create a new QuickAna tool - ana::QuickAna *quickAna = new ana::QuickAna ("quickana"); - - // Request the actual object definitions to use - quickAna->eventinfoDef = "default"; - quickAna->muonDef = "default"; - quickAna->electronDef = "default"; - // quickAna->photonDef = "default"; - quickAna->tauDef = "default"; - quickAna->jetDef = "default"; - quickAna->metDef = "default"; - quickAna->orDef = "default"; - quickAna->schedulerDef = "optimized"; - - // We just need some files for testing. Do not use these in your analysis - quickAna->muMcFiles = { - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root", - }; - // Using test file from SUSYTools - quickAna->muDataFiles = {"dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"}; - - // Initialize QuickAna tool - ANA_CHECK (quickAna->initialize()); - - // Configure systematics - auto sysList = CP::make_systematics_vector (quickAna->recommendedSystematics()); - ANA_CHECK (quickAna->setSystematics(sysList)); - - // The master output tool for analysis xAODs - ana::MasterOutputToolXAOD outputTool("OutputTool"); - - // Assign a subset of object types to write out - std::vector<ana::ObjectType> outputTypes = { - ana::OBJECT_EVENTINFO, ana::OBJECT_MUON, - ana::OBJECT_ELECTRON, ana::OBJECT_JET, ana::OBJECT_MET - }; - ANA_CHECK (outputTool.setProperty("OutputTypes", outputTypes)); - - // Configure output tool with the EventData - ANA_CHECK (outputTool.setProperty("EventData", quickAna->getEventData())); - - // Initialize the output tool - ANA_CHECK (outputTool.initialize()); - - // Specify the aux-item list to write out - event.setAuxItemList("EventInfoAux.","mcChannelNumber.mcEventNumber.mcEventWeights"); - event.setAuxItemList("ElectronsAux.", "pt.eta.phi.m"); - event.setAuxItemList("MuonsAux.", "pt.eta.phi.m"); - event.setAuxItemList("AntiKt4LCTopoJetsAux.", "pt.eta.phi.JVF"); - - Long64_t entries = event.getEntries(); - // Small number of entries for testing - if (entries > 100) - entries = 100; - ANA_MSG_INFO ("Processing " << entries << " entries"); - - const auto startTime = std::chrono::steady_clock::now(); - auto lastPrintoutTime = startTime; - for (Long64_t entry = 0; entry < entries; ++ entry) - { - const auto currentStartTime = std::chrono::steady_clock::now(); - if (currentStartTime - lastPrintoutTime > std::chrono::seconds (5)) - { - lastPrintoutTime = currentStartTime; - float rate = entry; - rate /= (lastPrintoutTime - startTime) / std::chrono::seconds(1); - ANA_MSG_INFO ("Processing entry " << entry << " " << rate << "evt/s"); - } - - event.getEntry (entry); - - for (auto sys : quickAna->systematics()) - { - // Apply systematic variation - ANA_CHECK (quickAna->applySystematicVariation (sys)); - - // Run QuickAna on this event - ANA_CHECK (quickAna->process(event)); - } - - // Write analysis objects to output store - ANA_CHECK (outputTool.write()); - - // Save this event - ANA_CHECK (event.fill() > 0); - - store.clear (); - } - - // Finalize output - ANA_CHECK (event.finishWritingTo(&outputFile)); - ANA_MSG_INFO ("processed file: " << inputFileName); - - return EXIT_SUCCESS; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_systematics.cxx b/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_systematics.cxx deleted file mode 100644 index 91af0a144aa7dad4ca0d5f0f2e14a35ca40ecf09..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_systematics.cxx +++ /dev/null @@ -1,161 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -#include <PATInterfaces/CorrectionCode.h> -#include <PATInterfaces/SystematicsUtil.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <TFile.h> -#include <TH1.h> -#include <chrono> -#include <xAODRootAccess/Init.h> - -// -// main program -// - -int main (int argc, char **argv) -{ - // declare the return type of this function for ANA_CHECK - ANA_CHECK_SET_TYPE (int); - - // needed for messaging macros - using namespace ana::msgUserCode; - - // make unchecked status codes abort the job - ana::enableStatusCodeFailure (); - - // initialize xAOD classes - ANA_CHECK (xAOD::Init ()); - - - // command line processing - if (argc < 3 || argc > 4) - { - ATH_MSG_ERROR("usage: " << argv[0] << " <xAOD.root> <output.root> [<schedulerDef>]"); - return EXIT_FAILURE; - } - const std::string inputFileName = argv[1]; - const std::string outputFileName = argv[2]; - - // open and attach input xAOD file - std::unique_ptr<TFile> inputFile (TFile::Open (inputFileName.c_str())); - xAOD::TEvent event (xAOD::TEvent::kAthenaAccess); - xAOD::TStore store; - ANA_CHECK (event.readFrom (inputFile.get())); - - // create a new QuickAna tool - ana::QuickAna *quickAna = new ana::QuickAna ("quickana"); - - // request the actual object definitions to use - quickAna->eventinfoDef = "default"; - quickAna->muonDef = "default"; - quickAna->electronDef = "default"; - quickAna->photonDef = "default"; - quickAna->tauDef = "default"; - quickAna->jetDef = "default"; - quickAna->metDef = "default"; - quickAna->orDef = "default"; - - // We just need some files for testing. Do not use these in your analysis - quickAna->muMcFiles = { - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root", - }; - // Using test file from SUSYTools - quickAna->muDataFiles = {"dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"}; - - // use the optimized tool scheduler - if (argc>3) quickAna->schedulerDef = argv[3]; // "optimized"; - - // initialize QuickAns tool - ANA_CHECK (quickAna->initialize()); - - ANA_CHECK (quickAna->setSystematics (CP::make_systematics_vector (quickAna->recommendedSystematics()))); - - // make an output histogram file and histograms - TFile outputFile (outputFileName.c_str(), "RECREATE"); - std::map<CP::SystematicSet,TH1*> muon_n; - std::map<CP::SystematicSet,TH1*> jet_n; - for (auto sys : quickAna->systematics()) - { - muon_n[sys] = new TH1F (("muon_n_" + sys.name()).c_str(), - "number of muons", 10, -0.5, 9.5); - jet_n[sys] = new TH1F (("jet_n_" + sys.name()).c_str(), - "number of jets", 20, -0.5, 19.5); - } - - Long64_t entries = event.getEntries(); - if (entries > 100) - entries = 100; - ATH_MSG_INFO ("Processing " << entries << " entries"); - - const auto startTime = std::chrono::steady_clock::now(); - auto lastPrintoutTime = startTime; - for (Long64_t entry = 0; entry < entries; ++ entry) - { - const auto currentStartTime = std::chrono::steady_clock::now(); - if (currentStartTime - lastPrintoutTime > std::chrono::seconds (5)) - { - lastPrintoutTime = currentStartTime; - float rate = entry; - rate /= (lastPrintoutTime - startTime) / std::chrono::seconds(1); - ATH_MSG_INFO ("Processing entry " << entry << " " << rate << "evt/s"); - } - - store.clear (); - event.getEntry (entry); - - for (auto sys : quickAna->systematics()) - { - // apply systematic variation - if (quickAna->applySystematicVariation (sys) != CP::SystematicCode::Ok) - return EXIT_FAILURE; - - // run QuickAna on this event - ANA_CHECK (quickAna->process (event)); - - unsigned muon_num = 0; - for (auto muon : *quickAna->muons()) - { - if (muon->auxdata<ana::SelectType> ("ana_select")) - { - ++ muon_num; - } - } - muon_n[sys]->Fill (muon_num, quickAna->weight()); - - unsigned jet_num = 0; - for (auto jet : *quickAna->jets()) - { - if (jet->auxdata<ana::SelectType> ("ana_select")) - { - ++ jet_num; - } - } - jet_n[sys]->Fill (jet_num, quickAna->weight()); - } - } - - outputFile.Write(); - outputFile.Close(); - - ATH_MSG_INFO ("processed file: " << inputFileName); - - return EXIT_SUCCESS; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_test_or.cxx b/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_test_or.cxx deleted file mode 100644 index df53ddede9d80e31487ed6beb1f3c7aed2e1af7d..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_test_or.cxx +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// -/// @brief This file contains testing code for the overlap removal in QuickAna. -/// -/// It is currently being used to test the migration to the new tools design -/// in AssociationUtils. -/// -/// @author Steve Farrell <Steven.Farrell@cern.ch> -/// - -// System includes -#include <chrono> - -// ROOT includes -#include "TFile.h" - -// ASG toolkit includes -#include "xAODRootAccess/Init.h" -#include "xAODRootAccess/TEvent.h" -#include "PATInterfaces/CorrectionCode.h" - -// Local includes -#include "QuickAna/QuickAna.h" -#include "QuickAna/MessageCheck.h" - - -//----------------------------------------------------------------------------- -// Main program -//----------------------------------------------------------------------------- -int main (int argc, char **argv) -{ - // declare the return type of this function for ANA_CHECK - ANA_CHECK_SET_TYPE (int); - - // needed for messaging macros - using namespace ana::msgUserCode; - - // make unchecked status codes abort the job - ana::enableStatusCodeFailure (); - - // initialize xAOD classes - ANA_CHECK (xAOD::Init (argv[0])); - - // The application's name - const char* APP_NAME = argv[0]; - - // Command line processing - if(argc < 2) { - Error(APP_NAME, "No file name received!" ); - Error(APP_NAME, "Usage: %s [xAOD.root]", APP_NAME); - return EXIT_FAILURE; - } - const std::string inputFileName = argv[1]; - - // Open and attach input xAOD file - std::unique_ptr<TFile> file( TFile::Open(inputFileName.c_str()) ); - xAOD::TEvent event (xAOD::TEvent::kAthenaAccess); - xAOD::TStore store; - ANA_CHECK( event.readFrom(file.get()) ); - - // Create QuickAna tool - ana::QuickAna quickAna("quickana"); - - // Configure object definitions - quickAna.eventinfoDef = "default"; - quickAna.muonDef = "default"; - quickAna.electronDef = "default"; - quickAna.photonDef = "default"; - quickAna.tauDef = "default"; - quickAna.jetDef = "default"; - quickAna.jetKine = "pt > 20e3"; - quickAna.metDef = "default"; - quickAna.orDef = "experimental"; - quickAna.schedulerDef = "basic"; // "optimized"; - - // We just need some files for testing. Do not use these in your analysis - quickAna.muMcFiles = { - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root", - }; - // Using test file from SUSYTools - quickAna.muDataFiles = {"dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"}; - - // Initialize QuickAna tool - ANA_CHECK( quickAna.initialize() ); - - // Number of events to process - Long64_t entries = event.getEntries(); - if (entries > 100) - entries = 100; - ANA_MSG_INFO ("Processing " << entries << " entries"); - - // Event loop - const auto startTime = std::chrono::steady_clock::now(); - auto lastPrintoutTime = startTime; - for (Long64_t entry = 0; entry < entries; ++entry) { - const auto currentStartTime = std::chrono::steady_clock::now(); - if (currentStartTime - lastPrintoutTime > std::chrono::seconds (5)) { - lastPrintoutTime = currentStartTime; - float rate = entry; - rate /= (lastPrintoutTime - startTime) / std::chrono::seconds(1); - Info(APP_NAME, "Processing entry %lli, rate %fevts/s", entry, rate); - } - - store.clear(); - event.getEntry(entry); - - // Run QuickAna on this event - ANA_CHECK( quickAna.process(event) ); - - } - - Info(APP_NAME, "finished processing successfully"); - return EXIT_SUCCESS; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_trigger.cxx b/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_trigger.cxx deleted file mode 100644 index 913ed734b0c0e52b35943f3cf63fe39b80b009de..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_trigger.cxx +++ /dev/null @@ -1,196 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -// Suppressing unused typedef warning -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#include <boost/algorithm/string.hpp> -#pragma GCC diagnostic pop - -#include <PATInterfaces/CorrectionCode.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <TFile.h> -#include <TH1.h> -#include <chrono> -#include <xAODRootAccess/Init.h> - -// Suppressing unused typedef warning -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#include <boost/multi_index/random_access_index.hpp> -#pragma GCC diagnostic pop - -#include <AsgTools/AnaToolHandle.h> -#include <TrigConfxAOD/xAODConfigTool.h> -#include <TrigDecisionTool/TrigDecisionTool.h> - -// -// main program -// - -int main (int argc, char **argv) -{ - // declare the return type of this function for ANA_CHECK - ANA_CHECK_SET_TYPE (int); - - // needed for messaging macros - using namespace ana::msgUserCode; - - // make unchecked status codes abort the job - ana::enableStatusCodeFailure (); - - // initialize xAOD classes - ANA_CHECK (xAOD::Init ()); - - - // command line processing - if (argc < 3 || argc > 4) - { - ATH_MSG_ERROR ("usage: " << argv[0] << " <xAOD.root> <output.root> [<schedulerDef>]"); - return EXIT_FAILURE; - } - const std::string input_file = argv[1]; - const std::string output_file = argv[2]; - - // open and attach input xAOD file - std::unique_ptr<TFile> file (TFile::Open (input_file.c_str())); - xAOD::TEvent event (xAOD::TEvent::kAthenaAccess); - xAOD::TStore store; - ANA_CHECK (event.readFrom (file.get())); - - // create a new QuickAna tool - ana::QuickAna *quickAna = new ana::QuickAna ("quickana"); - - // request the actual object definitions to use - quickAna->eventinfoDef = "default"; - quickAna->muonDef = "default"; - quickAna->electronDef = "default"; - quickAna->photonDef = "none"; - quickAna->tauDef = "default"; - quickAna->jetDef = "default"; - // quickAna->jetDef = "AntiKt4EMTopo"; - quickAna->jetKine = "pt > 50e3"; - quickAna->metDef = "default"; - quickAna->orDef = "default"; - quickAna->triggerDef = "SingleE SingleMu"; //Defined in ROOT/TriggerTool.cxx - - // We just need some files for testing. Do not use these in your analysis - quickAna->muMcFiles = { - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root", - }; - // Using test file from SUSYTools - quickAna->muDataFiles = {"dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"}; - - // use the optimized tool scheduler - if (argc>3) quickAna->schedulerDef = argv[3]; // "optimized"; - - // initialize QuickAna tool - ANA_CHECK (quickAna->initialize()); - - // The configuration tool. - asg::AnaToolHandle<TrigConf::xAODConfigTool> configTool - ("xAODConfigTool", nullptr); - ATH_CHECK (ASG_MAKE_ANA_TOOL (configTool, TrigConf::xAODConfigTool)); - ANA_CHECK (configTool.initialize()); - // The decision tool - asg::AnaToolHandle<Trig::TrigDecisionTool> trigDecTool - ("TrigDecisionTool", nullptr); - ATH_CHECK (ASG_MAKE_ANA_TOOL (trigDecTool, Trig::TrigDecisionTool)); - ANA_CHECK (trigDecTool.setProperty("ConfigTool",configTool)); - //trigDecTool.setProperty("OutputLevel", MSG::VERBOSE); - ANA_CHECK (trigDecTool.setProperty("TrigDecisionKey","xTrigDecision")); - ANA_CHECK (trigDecTool.initialize()); - - - - // make an output histogram file and histograms - TFile outputFile (output_file.c_str(), "RECREATE"); - TH1 *muon_loose_sf = new TH1F ("muon_trig_sf_loose", "Loose Muon Trigger SF", 20, 0 ,2); - TH1 *muon_medium_sf = new TH1F ("muon_trig_sf_meiudm", "Medium Muon Trigger SF", 20, 0 ,2); - TH1 *muon_tight_sf = new TH1F ("muon_trig_sf_tight", "Tight Muon Trigger SF", 20, 0 ,2); - - TH1 *muon_tr_match = new TH1F ("muon_trig_match", "Trigger Matched Muons", 4, 0, 2); - TH1 *el_tr_match = new TH1F ("el_trig_match", "Trigger Matched Electrons", 4, 0, 2); - TH1 *tr_pass = new TH1F ("trig_pass", "events passing trigger", 4, 0, 2); - TH1 *tr_e_pass = new TH1F ("trig_e_pass", "events passing electron triggers", 4, 0, 2); - TH1 *tr_m_pass = new TH1F ("trig_mu_pass", "events passing muon triggers", 4, 0, 2); - - Long64_t entries = event.getEntries(); - if (entries > 100) - entries = 100; - ATH_MSG_INFO ("Processing " << entries << " entries"); - bool start=true; - - for (Long64_t entry = 0; entry < entries; ++ entry) - { - store.clear (); - event.getEntry (entry); - - if(start){ - auto chainGroup=trigDecTool->getChainGroup(".*"); - ATH_MSG_INFO ("----------Available Triggers ---------"); - for(auto &trig : chainGroup->getListOfTriggers()) - { - ATH_MSG_INFO (trig); - } - start=false; - } - - // run QuickAna on this event - ANA_CHECK (quickAna->process (event)); - - //Check if event passes any of the triggers - auto evtInfo = quickAna->eventinfo(); - - tr_pass->Fill(evtInfo->auxdata<bool>("passAllTrig")); - //Check if event passes electron group - - tr_e_pass->Fill(evtInfo->auxdata<bool>("SingleE_passTrig")); - - //Check if event passes muon group - tr_m_pass->Fill(evtInfo->auxdata<bool>("SingleMu_passTrig")); - - //Get the Muon Trigger Scale factors for different working points - muon_loose_sf->Fill(evtInfo->auxdata<double>("SingleMu_Mu_LooseTrigSF")); - muon_medium_sf->Fill(evtInfo->auxdata<double>("SingleMu_Mu_MediumTrigSF")); - muon_tight_sf->Fill(evtInfo->auxdata<double>("SingleMu_Mu_TightTrigSF")); - - - // loop over muons and fill pt - for (auto muon : *quickAna->muons()) - { - //Check if Muon matching to a trigger in the SingleMu group - if (muon->auxdata<ana::SelectType> ("ana_select")) - muon_tr_match->Fill(muon->auxdata<bool>("SingleMu_trigMatch")); - } - - for (auto el : *quickAna->electrons()) - { - //Check if electron matchis to a trigger in the SingleE group - if (el->auxdata<ana::SelectType> ("ana_select")) - el_tr_match->Fill(el->auxdata<bool>("SingleE_trigMatch")); - } - } - - outputFile.Write (); - ATH_MSG_INFO ("finished processing successfully"); - - return EXIT_SUCCESS; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_truth.cxx b/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_truth.cxx deleted file mode 100644 index e52efea172ba42b5131d73d6e1eec6257eea0459..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_truth.cxx +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - -// -// includes -// - -#include <PATInterfaces/CorrectionCode.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <TFile.h> -#include <chrono> -#include <xAODRootAccess/Init.h> - -// -// main program -// - -int main (int argc, char **argv) -{ - // declare the return type of this function for ANA_CHECK - ANA_CHECK_SET_TYPE (int); - - // needed for messaging macros - using namespace ana::msgUserCode; - - // make unchecked status codes abort the job - ana::enableStatusCodeFailure (); - - // initialize xAOD classes - ANA_CHECK (xAOD::Init ()); - - - // command line processing - if (argc != 2) - { - ATH_MSG_ERROR ("usage: " << argv[0] << " <xAOD.root>"); - return EXIT_FAILURE; - } - const std::string input_file = argv[1]; - - // open and attach input xAOD file - TFile file(input_file.c_str()); - xAOD::TEvent event (xAOD::TEvent::kAthenaAccess); - xAOD::TStore store; - ANA_CHECK (event.readFrom(&file)); - - // create a new QuickAna tool - ana::QuickAna *quickAna = new ana::QuickAna ("quickana"); - - // request the actual object definitions to use - quickAna->eventinfoDef = "default"; - quickAna->jetDef = "truth"; - quickAna->jetKine = "pt > 50e3 && eta < 2.4 && eta > -2.4"; - - // initialize QuickAna tool - ANA_CHECK (quickAna->initialize()); - - Long64_t entries = std::min(event.getEntries(), 500ll); - if (entries > 100) - entries = 100; - ATH_MSG_INFO ("Processing " << entries << " entries"); - - const auto startTime = std::chrono::steady_clock::now(); - auto lastPrintoutTime = startTime; - for (Long64_t entry = 0; entry < entries; ++ entry) - { - const auto currentStartTime = std::chrono::steady_clock::now(); - if (currentStartTime - lastPrintoutTime > std::chrono::seconds (5)) - { - lastPrintoutTime = currentStartTime; - float rate = entry; - rate /= (lastPrintoutTime - startTime) / std::chrono::seconds(1); - ATH_MSG_INFO ("Processing entry " << entry << " " << rate << "evt/s"); - } - - store.clear (); - event.getEntry (entry); - - // run QuickAna on this event - ANA_CHECK (quickAna->process (event)); - - // loop over jets and print - for (auto jet : *quickAna->jets()) - { - if (jet->auxdata<ana::SelectType> ("ana_select")) - { - ATH_MSG_INFO ("Jet: pt " << jet->pt()*0.001 << " eta " << jet->eta()); - } - } - - } - - ATH_MSG_INFO ("finished processing successfully"); - - return EXIT_SUCCESS; -} diff --git a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_validate.cxx b/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_validate.cxx deleted file mode 100644 index 998e148b487039cff78177baaa7e6bb839498e8a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/TopPhys/QuickAna/util/quickana_validate.cxx +++ /dev/null @@ -1,232 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// Author: Nils Krumnack -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// Please feel free to contact me (nils.erik.krumnack@cern.ch) for bug -// reports, feature suggestions, praise and complaints. - - -// -// includes -// - -// Suppressing unused typedef warning -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunknown-pragmas" -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#include <boost/program_options.hpp> -#pragma GCC diagnostic pop - -#include <EventLoop/DirectDriver.h> -#include <EventLoop/Job.h> -#include <PATInterfaces/CorrectionCode.h> -#include <QuickAna/MessageCheck.h> -#include <QuickAna/QuickAna.h> -#include <QuickAna/ValidationEL.h> -#include <SampleHandler/SampleHandler.h> -#include <SampleHandler/SampleLocal.h> -#include <TCanvas.h> -#include <TFile.h> -#include <TH1.h> -#include <TStyle.h> -#include <TSystem.h> -#include <boost/program_options.hpp> -#include <fstream> -#include <xAODRootAccess/Init.h> - -namespace po = boost::program_options; - -// -// main program -// - -int main (int argc, char **argv) -{ - // declare the return type of this function for ANA_CHECK - ANA_CHECK_SET_TYPE (int); - - // needed for messaging macros - using namespace ana::msgUserCode; - - // make unchecked status codes abort the job - ana::enableStatusCodeFailure (); - - // initialize xAOD classes - ANA_CHECK (xAOD::Init ()); - - - // Declare the supported options. - po::options_description desc("Allowed options"); - desc.add_options() - ("help", "produce help message") - ("write-summary", "whether to write AthSummary.txt") - ("submit-dir", po::value<std::string>(), "output file") - ("el-input-file", po::value<std::vector<std::string>>(), "EventLoop input file") - ("qa-no-default-def", "whether to turn off default object definitions") - ("qa-muon-def", po::value<std::string>(), "value of muonDef") - ("qa-electron-def", po::value<std::string>(), "value of electronDef") - ("qa-photon-def", po::value<std::string>(), "value of photonDef") - ("qa-tau-def", po::value<std::string>(), "value of tauDef") - ("qa-jet-def", po::value<std::string>(), "value of jetDef") - ("qa-fat-jet-def", po::value<std::string>(), "value of fatJetDef") - ("qa-met-def", po::value<std::string>(), "value of metDef") - ("qa-met2-def", po::value<std::string>(), "value of met2Def") - ("qa-or-def", po::value<std::string>(), "value of orDef") - ("qa-scheduler", po::value<std::string>(), "QuickAna scheduler"); - po::positional_options_description p; - p.add("submit-dir", -1); - - po::variables_map vm; - po::store(po::command_line_parser(argc, argv). - options(desc).positional(p).run(), vm); - po::notify(vm); - - if (vm.count("help")) - { - std::cout << desc << std::endl; - return 1; - } - - if (!vm.count("submit-dir")) - { - ATH_MSG_ERROR ("missing submission directory"); - return 1; - } - const std::string submitDir = vm["submit-dir"].as<std::string>(); - - // create a new QuickAna tool - ana::Configuration conf; - - // request the actual object definitions to use - if (!vm.count ("qa-no-default-def")) - { - conf.muonDef = "default"; - conf.electronDef = "default"; - // conf.photonDef = "default"; - conf.tauDef = "default"; - conf.jetDef = "default"; - conf.fatJetDef = "default"; - conf.metDef = "default"; - conf.met2Def = "trackmet"; - conf.orDef = "default"; - } - - // Activate EventInfo def for all because crashes otherwise - conf.eventinfoDef = "default"; - // We just need some files for testing. Do not use these in your analysis - conf.muMcFiles = { - "dev/PileupReweighting/mc15ab_defaults.NotRecommended.prw.root", - "dev/PileupReweighting/mc15c_v2_defaults.NotRecommended.prw.root", - }; - // Using test file from SUSYTools - conf.muDataFiles = {"dev/SUSYTools/ilumicalc_histograms_None_276262-284154.root"}; - - if (vm.count ("qa-muon-def")) - conf.muonDef = vm["qa-muon-def"].as<std::string>(); - if (vm.count ("qa-electron-def")) - conf.electronDef = vm["qa-electron-def"].as<std::string>(); - if (vm.count ("qa-photon-def")) - conf.photonDef = vm["qa-photon-def"].as<std::string>(); - if (vm.count ("qa-tau-def")) - conf.tauDef = vm["qa-tau-def"].as<std::string>(); - if (vm.count ("qa-jet-def")) - conf.jetDef = vm["qa-jet-def"].as<std::string>(); - if (vm.count ("qa-fat-jet-def")) - conf.fatJetDef = vm["qa-fat-jet-def"].as<std::string>(); - if (vm.count ("qa-met-def")) - conf.metDef = vm["qa-met-def"].as<std::string>(); - if (vm.count ("qa-met2-def")) - conf.met2Def = vm["qa-met2-def"].as<std::string>(); - if (vm.count ("qa-or-def")) - conf.orDef = vm["qa-or-def"].as<std::string>(); - - // set the optimized tool scheduler - if (vm.count("qa-scheduler")) - conf.schedulerDef = vm["qa-scheduler"].as<std::string>(); - - // create a new sample handler to describe the data files we use - std::vector<std::string> inputFiles; - if (vm.count("el-input-file")) - inputFiles = vm["el-input-file"].as<std::vector<std::string>>(); - if (inputFiles.empty()) - { - const char *QUICKANA_UT_DATA = getenv ("QUICKANA_UT_DATA"); - if (!QUICKANA_UT_DATA) - QUICKANA_UT_DATA = "/afs/cern.ch/atlas/project/PAT/xAODs"; - inputFiles.push_back (std::string (QUICKANA_UT_DATA) + "/r5591/mc14_8TeV.117050.PowhegPythia_P2011C_ttbar.recon.AOD.e1727_s1933_s1911_r5591/AOD.01494882._111853.pool.root.1"); - } - SH::SampleHandler sh; - std::unique_ptr<SH::SampleLocal> sample (new SH::SampleLocal ("sample")); - for (auto& file : inputFiles) - sample->add (file); - sh.add (sample.release()); - - // set the name of the tree in our files - // in the xAOD the TTree containing the EDM containers is "CollectionTree" - sh.setMetaString ("nc_tree", "CollectionTree"); - - // further sample handler configuration may go here - - // print out the samples we found - sh.print (); - - // this is the basic description of our job - EL::Job job; - job.sampleHandler (sh); - job.options()->setString (EL::Job::optXaodAccessMode, EL::Job::optXaodAccessMode_athena); - job.options()->setDouble (EL::Job::optMaxEvents, 100); - - // add our algorithm to the job - std::unique_ptr<ana::ValidationEL> alg (new ana::ValidationEL); - alg->setConfig (conf); - alg->m_writeSummary = vm.count ("write-summary"); - job.algsAdd (alg.release()); - - // make the driver we want to use: - // this one works by running the algorithm directly: - EL::DirectDriver driver; - // we can use other drivers to run things on the Grid, with PROOF, etc. - - // process the job using the driver - driver.submit (job, submitDir); - - gStyle->SetOptStat (1111111); - - std::set<std::string> histNames; - std::unique_ptr<TFile> file (TFile::Open ((submitDir + "/hist-sample.root").c_str())); - TDirectory *dir = dynamic_cast<TDirectory*>(file->Get ("val")); - RCU_ASSERT (dir != 0); - TObject *object = 0; - for (TIter iter (dir->GetListOfKeys()); (object = iter.Next()); ) - { - histNames.insert (object->GetName()); - } - - std::string webBase = submitDir + "/user/web"; - gSystem->MakeDirectory ((submitDir + "/user").c_str()); - gSystem->MakeDirectory (webBase.c_str()); - { - TCanvas canvas; - std::ofstream file ((webBase + "/index.html").c_str()); - for (auto& name : histNames) - { - TH1 *hist = dynamic_cast<TH1*>(dir->Get (name.c_str())); - RCU_ASSERT (hist != 0); - hist->Draw (); - canvas.SetLogy (false); - canvas.Print ((webBase + "/lin_" + name + ".gif").c_str()); - canvas.SetLogy (); - canvas.Print ((webBase + "/log_" + name + ".gif").c_str()); - file << "<h1>" << name << "</h1>\n<img src=\"lin_" << name - << ".gif\" />\n<img src=\"log_" << name << ".gif\">\n\n"; - } - } - - return EXIT_SUCCESS; -} diff --git a/Projects/Athena/package_filters.txt b/Projects/Athena/package_filters.txt index 1f95e74391ff2ee91370d853308e9c91d3f0c486..2a92586f9ffbd7d3db8a447b2e1c1cd21b0a7588 100644 --- a/Projects/Athena/package_filters.txt +++ b/Projects/Athena/package_filters.txt @@ -37,7 +37,6 @@ - PhysicsAnalysis/SUSYPhys/SUSYTools - PhysicsAnalysis/TauID/DiTauMassTools #- PhysicsAnalysis/TauID/TauCorrUncert #no CMakeLists.txt file -- PhysicsAnalysis/TopPhys/QuickAna - PhysicsAnalysis/TopPhys/TopPhysUtils/.* - PhysicsAnalysis/TopPhys/xAOD/.* - PhysicsAnalysis/TrackingID/InDetTrackSystematicsTools