diff --git a/AtlasTest/CITest/Athena.cmake b/AtlasTest/CITest/Athena.cmake index 7f414072da90cf72ca683a3751dfecac4afa2a42..bab0df63c8f14bd7818e95d7b778991698ac047e 100644 --- a/AtlasTest/CITest/Athena.cmake +++ b/AtlasTest/CITest/Athena.cmake @@ -236,7 +236,7 @@ atlas_add_citest( ACTS_Propagation_ID SCRIPT ActsExtrapolationAlgTest.py ) atlas_add_citest( ACTS_Workflow - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsWorkflow.sh + SCRIPT ActsWorkflow.sh LOG_IGNORE_PATTERN "ActsTrackFindingAlg.*ERROR Propagation reached the step count limit|ActsTrackFindingAlg.*ERROR Propagation failed: PropagatorError:3 Propagation reached the configured maximum number of steps with the initial parameters|ActsTrackFindingAlg.*ERROR CombinatorialKalmanFilter failed: CombinatorialKalmanFilterError:5 Propagation reaches max steps before track finding is finished with the initial parameters" ) atlas_add_citest( Acts_ConversionWorkflow @@ -244,43 +244,46 @@ atlas_add_citest( ACTS_Workflow LOG_IGNORE_PATTERN "ActsTrackFindingAlg.*ERROR Propagation reached the step count limit|ActsTrackFindingAlg.*ERROR Propagation failed: PropagatorError:3 Propagation reached the configured maximum number of steps with the initial parameters|ActsTrackFindingAlg.*ERROR CombinatorialKalmanFilter failed: CombinatorialKalmanFilterError:5 Propagation reaches max steps before track finding is finished with the initial parameters" ) atlas_add_citest( ACTS_ValidateClusters - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateClusters.sh ) + SCRIPT ActsValidateClusters.sh ) atlas_add_citest( ACTS_ValidateActsCoreSpacePoints - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateActsCoreSpacePoints.sh ) + SCRIPT ActsValidateActsCoreSpacePoints.sh ) atlas_add_citest( ACTS_ValidateActsTrkSpacePoints - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateActsSpacePoints.sh ) + SCRIPT ActsValidateActsSpacePoints.sh ) atlas_add_citest( ACTS_ValidateSeeds - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateSeeds.sh ) + SCRIPT ActsValidateSeeds.sh ) atlas_add_citest( ACTS_ValidateOrthogonalSeeds - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateOrthogonalSeeds.sh ) + SCRIPT ActsValidateOrthogonalSeeds.sh ) atlas_add_citest( ACTS_ActsPersistifyEDM - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsPersistifyEDM.sh ) + SCRIPT ActsPersistifyEDM.sh ) atlas_add_citest( ACTS_ValidateTracks - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateTracks.sh ) + SCRIPT ActsValidateTracks.sh ) atlas_add_citest( ACTS_ValidateResolvedTracks - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateResolvedTracks.sh ) + SCRIPT ActsValidateResolvedTracks.sh ) atlas_add_citest( ACTS_ValidateAmbiguityResolution - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateAmbiguityResolution.sh ) + SCRIPT ActsValidateAmbiguityResolution.sh ) atlas_add_citest( ACTS_ActsKfRefitting - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsKfRefitting.sh ) + SCRIPT ActsKfRefitting.sh ) + +atlas_add_citest( ACTS_ActsEFTrackFit + SCRIPT ActsEFTrackFit.sh ) atlas_add_citest( ACTS_ActsGSFRefitting - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsGSFRefitting.sh ) + SCRIPT ActsGSFRefitting.sh ) atlas_add_citest( ACTS_ActsGSFInEgamma - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsGSFInEgamma.sh ) + SCRIPT ActsGSFInEgamma.sh ) atlas_add_citest( ACTS_ActsBenchmarkWithSpot - SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsBenchmarkWithSpot.sh 8 100 + SCRIPT ActsBenchmarkWithSpot.sh 8 100 PROPERTIES PROCESSOR 8 LOG_IGNORE_PATTERN "ActsTrackFindingAlg.*ERROR Propagation reached the step count limit|ActsTrackFindingAlg.*ERROR Propagation failed: PropagatorError:3 Propagation reached the configured maximum number of steps with the initial parameters|ActsTrackFindingAlg.*ERROR CombinatorialKalmanFilter failed: CombinatorialKalmanFilterError:5 Propagation reaches max steps before track finding is finished with the initial parameters|ActsTrackFindingAlg.Acts.*ERROR.*SurfaceError:1" ) diff --git a/Control/AthContainers/AthContainers/AuxVectorBase.h b/Control/AthContainers/AthContainers/AuxVectorBase.h index f78b533ed353f6b12d8ab776cb627d1cb32ec9a9..3a9d01ee158a6b2d467d0e76b240e4c47f168777 100644 --- a/Control/AthContainers/AthContainers/AuxVectorBase.h +++ b/Control/AthContainers/AthContainers/AuxVectorBase.h @@ -1,7 +1,7 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file AthContainers/AuxVectorBase.h @@ -21,6 +21,7 @@ #include "AthContainers/AuxElement.h" #include "AthContainers/AuxTypeRegistry.h" #include "AthContainers/exceptions.h" +#include "AthContainers/tools/AuxDataTraits.h" #include "AthContainers/tools/ATHCONTAINERS_ASSERT.h" #include "AthContainersInterfaces/IAuxStore.h" #include "AthContainersInterfaces/AuxStore_traits.h" @@ -96,6 +97,11 @@ class AuxVectorBase : public AuxVectorData { public: + /// Spans over auxiliary variables. + template <class T> using span = typename AuxDataTraits<T>::span; + template <class T> using const_span = typename AuxDataTraits<T>::const_span; + + /** * @brief Default constructor. * @@ -190,6 +196,113 @@ public: void setNonConstStore (SG::IAuxStore* store); + // Templated versions of isAvailable, etc. + // We put them here rather than in AuxVectorData so that AuxVectorData.h + // doesn't need to include AuxTypeRegistry.h. Otherwise we get a + // a cyclic header dependency: + // AuxTypeRegistry -> AuxTypeVectorFactory -> AuxVectorData -> AuxTypeRegistry + + using AuxVectorData::isAvailable; + using AuxVectorData::isAvailableWritable; + using AuxVectorData::isAvailableWritableAsDecoration; + + + /** + * @brief Test to see if a variable exists in the store. + * @param name Name of the aux variable. + * @param clsname The name of the associated class. May be blank. + */ + template <class T> + bool isAvailable (const std::string& name, + const std::string& clsname = "") const; + + + /** + * @brief Test to see if a variable is available for writing. + * @param name Name of the aux variable. + * @param clsname The name of the associated class. May be blank. + */ + template <class T> + bool isAvailableWritable (const std::string& name, + const std::string& clsname = ""); + + + /** + * @brief Test to see if a variable is available for writing as a decoration. + * @param name Name of the aux variable. + * @param clsname The name of the associated class. May be blank. + */ + template <class T> + bool isAvailableWritableAsDecoration (const std::string& name, + const std::string& clsname = "") const; + + + /** + * @brief Return a span over an aux data item. + * @param auxid The desired aux data item. + * + * This will return a span containing the value of the requested + * auxiliary variable for all elements in the container. + * If the item doesn't exist, it will be created. + * Errors are signaled by raising an exception. + * Note that the @c value_type of the span is not necessarily @c T; + * an example is @c bool for which we return a span of @c char. + */ + template <class T> + span<T> getDataSpan (const std::string& name); + + + /** + * @brief Return a span over an aux data item. + * @param auxid The desired aux data item. + * + * This will return a span containing the value of the requested + * auxiliary variable for all elements in the container. + * If the item doesn't exist, it will be created. + * Errors are signaled by raising an exception. + * Note that the @c value_type of the span is not necessarily @c T; + * an example is @c bool for which we return a span of @c char. + */ + template <class T> + const_span<T> getDataSpan (const std::string& name) const; + + + /** + * @brief Return a span over an aux data item. + * @param auxid The desired aux data item. + * + * This will return a span containing the value of the requested + * auxiliary variable for all elements in the container. + * If the item doesn't exist, it will be created. + * Errors are signaled by raising an exception. + * Note that the @c value_type of the span is not necessarily @c T; + * an example is @c bool for which we return a span of @c char. + */ + template <class T> + const_span<T> getConstDataSpan (const std::string& name) const; + + + /** + * @brief Return a span over an aux data item for a decoration. + * @param auxid The desired aux data item. + * + * This will return a span containing the value of the requested + * auxiliary variable for all elements in the container. + * If the item doesn't exist, it will be created. + * Errors are signaled by raising an exception. + * Note that the @c value_type of the span is not necessarily @c T; + * an example is @c bool for which we return a span of @c char. + * + * The difference between @c getDecorationSpan and @c getDataSpan is that + * @c getDecorationSpan takes a const container as input, but returns + * a span over non-const objects. This will only succeed if either the + * container is not locked or the item was first accessed + * as a decoration. + */ + template <class T> + span<T> getDecorationSpan (const std::string& name) const; + + /// Mark that this type supports thinning operations. /// See AthContainers/supportsThinning.h and /// AthenaPoolCnvSvc/T_AthenaPoolCnv.h. diff --git a/Control/AthContainers/AthContainers/AuxVectorBase.icc b/Control/AthContainers/AthContainers/AuxVectorBase.icc index 5dcccbb52c63354dac81b9cac26df5aca785e20a..2ec691cde01bc23a338c4aad467ea259f193571b 100644 --- a/Control/AthContainers/AthContainers/AuxVectorBase.icc +++ b/Control/AthContainers/AthContainers/AuxVectorBase.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** @@ -45,6 +45,146 @@ void AuxVectorBase::setNonConstStore (SG::IAuxStore* store) } +/** + * @brief Test to see if a variable exists in the store. + * @param name Name of the aux variable. + * @param clsname The name of the associated class. May be blank. + */ +template <class T> +inline +bool AuxVectorBase::isAvailable (const std::string& name, + const std::string& clsname /*= ""*/) const +{ + auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name, clsname); + return AuxVectorData::isAvailable (id); +} + + +/** + * @brief Test to see if a variable is available for writing. + * @param name Name of the aux variable. + * @param clsname The name of the associated class. May be blank. + */ +template <class T> +inline +bool +AuxVectorBase::isAvailableWritable (const std::string& name, + const std::string& clsname /*= ""*/) +{ + auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name, clsname); + return AuxVectorData::isAvailableWritable (id); +} + + +/** + * @brief Test to see if a variable is available for writing as a decoration. + * @param name Name of the aux variable. + * @param clsname The name of the associated class. May be blank. + */ +template <class T> +inline +bool +AuxVectorBase::isAvailableWritableAsDecoration (const std::string& name, + const std::string& clsname /*= ""*/) const +{ + auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name, clsname); + return AuxVectorData::isAvailableWritableAsDecoration (id); +} + + +/** + * @brief Return a span over an aux data item. + * @param auxid The desired aux data item. + * + * This will return a span containing the value of the requested + * auxiliary variable for all elements in the container. + * If the item doesn't exist, it will be created. + * Errors are signaled by raising an exception. + * Note that the @c value_type of the span is not necessarily @c T; + * an example is @c bool for which we return a span of @c char. + */ +template <class T> +AuxVectorBase::span<T> AuxVectorBase::getDataSpan (const std::string& name) +{ + using container_pointer_type = typename AuxDataTraits<T>::container_pointer_type; + auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name); + auto beg = reinterpret_cast<container_pointer_type> (AuxVectorData::getDataArray (id)); + return span<T> (beg, size_v()); +} + + +/** + * @brief Return a span over an aux data item. + * @param auxid The desired aux data item. + * + * This will return a span containing the value of the requested + * auxiliary variable for all elements in the container. + * If the item doesn't exist, it will be created. + * Errors are signaled by raising an exception. + * Note that the @c value_type of the span is not necessarily @c T; + * an example is @c bool for which we return a span of @c char. + */ +template <class T> +AuxVectorBase::const_span<T> +AuxVectorBase::getDataSpan (const std::string& name) const +{ + using const_container_pointer_type = typename AuxDataTraits<T>::const_container_pointer_type; + auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name); + auto beg = reinterpret_cast<const_container_pointer_type> (AuxVectorData::getDataArray (id)); + return const_span<T> (beg, size_v()); +} + + +/** + * @brief Return a span over an aux data item for a decoration. + * @param auxid The desired aux data item. + * + * This will return a span containing the value of the requested + * auxiliary variable for all elements in the container. + * If the item doesn't exist, it will be created. + * Errors are signaled by raising an exception. + * Note that the @c value_type of the span is not necessarily @c T; + * an example is @c bool for which we return a span of @c char. + * + * The difference between @c getDecorationSpan and @c getDataSpan is that + * @c getDecorationSpan takes a const container as input, but returns + * a span over non-const objects. This will only succeed if either the + * container is not locked or the item was first accessed + * as a decoration. + */ +template <class T> +AuxVectorBase::span<T> +AuxVectorBase::getDecorationSpan (const std::string& name) const +{ + using container_pointer_type = typename AuxDataTraits<T>::container_pointer_type; + auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name); + auto beg = reinterpret_cast<container_pointer_type> (AuxVectorData::getDecorationArray (id)); + return span<T> (beg, size_v()); +} + + +/** + * @brief Return a span over an aux data item. + * @param auxid The desired aux data item. + * + * This will return a span containing the value of the requested + * auxiliary variable for all elements in the container. + * If the item doesn't exist, it will be created. + * Errors are signaled by raising an exception. + * Note that the @c value_type of the span is not necessarily @c T; + * an example is @c bool for which we return a span of @c char. + */ +template <class T> +AuxVectorBase::const_span<T> +AuxVectorBase::getConstDataSpan (const std::string& name) const +{ + using const_container_pointer_type = typename AuxDataTraits<T>::const_container_pointer_type; + auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name); + auto beg = reinterpret_cast<const_container_pointer_type> (AuxVectorData::getDataArray (id)); + return const_span<T> (beg, size_v()); +} + + /** * @brief Initialize index tracking mode. * @param ownPolicy The container ownership policy. diff --git a/Control/AthContainers/AthContainers/AuxVectorData.h b/Control/AthContainers/AthContainers/AuxVectorData.h index bcba7963bb9ec0d66a0e2233ae05ccb7d587aa8e..2b3fa605b730b2b56e3be74756934d16f2236e35 100644 --- a/Control/AthContainers/AthContainers/AuxVectorData.h +++ b/Control/AthContainers/AthContainers/AuxVectorData.h @@ -1,7 +1,6 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. - /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file AthContainers/AuxVectorData.h @@ -167,11 +166,6 @@ class AuxVectorData #endif // not XAOD_STANDALONE { public: - /// Spans over auxiliary variables. - template <class T> using span = typename AuxDataTraits<T>::span; - template <class T> using const_span = typename AuxDataTraits<T>::const_span; - - /// Constructor. AuxVectorData(); @@ -444,16 +438,6 @@ public: bool isAvailable (auxid_t id) const; - /** - * @brief Test to see if a variable exists in the store. - * @param name Name of the aux variable. - * @param clsname The name of the associated class. May be blank. - */ - template <class T> - bool isAvailable (const std::string& name, - const std::string& clsname = "") const; - - /** * @brief Test to see if a variable is available for writing. * @param id The variable to test. @@ -461,16 +445,6 @@ public: bool isAvailableWritable (auxid_t id); - /** - * @brief Test to see if a variable is available for writing. - * @param name Name of the aux variable. - * @param clsname The name of the associated class. May be blank. - */ - template <class T> - bool isAvailableWritable (const std::string& name, - const std::string& clsname = ""); - - /** * @brief Test to see if a variable is available for writing as a decoration. * @param id The variable to test. @@ -478,14 +452,8 @@ public: bool isAvailableWritableAsDecoration (auxid_t id) const; - /** - * @brief Test to see if a variable is available for writing as a decoration. - * @param name Name of the aux variable. - * @param clsname The name of the associated class. May be blank. - */ - template <class T> - bool isAvailableWritableAsDecoration (const std::string& name, - const std::string& clsname = "") const; + // Versions of isAvailable* that take a name rather than an ID are + // in the derived class AuxVectorBase. /** @@ -595,70 +563,6 @@ public: void* getDataArray (SG::auxid_t auxid); - /** - * @brief Return a span over an aux data item. - * @param auxid The desired aux data item. - * - * This will return a span containing the value of the requested - * auxiliary variable for all elements in the container. - * If the item doesn't exist, it will be created. - * Errors are signaled by raising an exception. - * Note that the @c value_type of the span is not necessarily @c T; - * an example is @c bool for which we return a span of @c char. - */ - template <class T> - span<T> getDataSpan (const std::string& name); - - - /** - * @brief Return a span over an aux data item. - * @param auxid The desired aux data item. - * - * This will return a span containing the value of the requested - * auxiliary variable for all elements in the container. - * If the item doesn't exist, it will be created. - * Errors are signaled by raising an exception. - * Note that the @c value_type of the span is not necessarily @c T; - * an example is @c bool for which we return a span of @c char. - */ - template <class T> - const_span<T> getDataSpan (const std::string& name) const; - - - /** - * @brief Return a span over an aux data item. - * @param auxid The desired aux data item. - * - * This will return a span containing the value of the requested - * auxiliary variable for all elements in the container. - * If the item doesn't exist, it will be created. - * Errors are signaled by raising an exception. - * Note that the @c value_type of the span is not necessarily @c T; - * an example is @c bool for which we return a span of @c char. - */ - template <class T> - const_span<T> getConstDataSpan (const std::string& name) const; - - - /** - * @brief Return a span over an aux data item for a decoration. - * @param auxid The desired aux data item. - * - * This will return a span containing the value of the requested - * auxiliary variable for all elements in the container. - * If the item doesn't exist, it will be created. - * Errors are signaled by raising an exception. - * Note that the @c value_type of the span is not necessarily @c T; - * an example is @c bool for which we return a span of @c char. - * - * The difference between @c getDecorationSpan and @c getDataSpan is that - * @c getDecorationSpan takes a const container as input, but returns - * a span over non-const objects. This will only succeed if either the - * container is not locked or the item was first accessed - * as a decoration. - */ - template <class T> - span<T> getDecorationSpan (const std::string& name) const; protected: diff --git a/Control/AthContainers/AthContainers/AuxVectorData.icc b/Control/AthContainers/AthContainers/AuxVectorData.icc index b38814113307adf04ef8504f741010135ebafbb8..cd066725d4128cd0c074486be0443bc3e391b666 100644 --- a/Control/AthContainers/AthContainers/AuxVectorData.icc +++ b/Control/AthContainers/AthContainers/AuxVectorData.icc @@ -1,9 +1,7 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ - /** * @file AthContainers/AuxVectorData.icc * @author scott snyder <snyder@bnl.gov> @@ -12,7 +10,6 @@ */ -#include "AthContainers/AuxTypeRegistry.h" #include "AthContainersInterfaces/IAuxStore.h" #include "AthContainersInterfaces/IConstAuxStore.h" #include "AthContainers/tools/likely.h" @@ -129,21 +126,6 @@ bool AuxVectorData::isAvailable (auxid_t id) const } -/** - * @brief Test to see if a variable exists in the store. - * @param name Name of the aux variable. - * @param clsname The name of the associated class. May be blank. - */ -template <class T> -inline -bool AuxVectorData::isAvailable (const std::string& name, - const std::string& clsname /*= ""*/) const -{ - auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name, clsname); - return isAvailable (id); -} - - /** * @brief Test to see if a variable is available for writing. * @param id The variable to test. @@ -157,22 +139,6 @@ bool AuxVectorData::isAvailableWritable (auxid_t id) } -/** - * @brief Test to see if a variable is available for writing. - * @param name Name of the aux variable. - * @param clsname The name of the associated class. May be blank. - */ -template <class T> -inline -bool -AuxVectorData::isAvailableWritable (const std::string& name, - const std::string& clsname /*= ""*/) -{ - auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name, clsname); - return isAvailableWritable (id); -} - - /** * @brief Test to see if a variable is available for writing as a decoration. * @param id The variable to test. @@ -186,22 +152,6 @@ bool AuxVectorData::isAvailableWritableAsDecoration (auxid_t id) const } -/** - * @brief Test to see if a variable is available for writing as a decoration. - * @param name Name of the aux variable. - * @param clsname The name of the associated class. May be blank. - */ -template <class T> -inline -bool -AuxVectorData::isAvailableWritableAsDecoration (const std::string& name, - const std::string& clsname /*= ""*/) const -{ - auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name, clsname); - return isAvailableWritableAsDecoration (id); -} - - /** * @brief Return reference to an aux data item. * @param auxid The desired aux data item. @@ -342,99 +292,6 @@ void* AuxVectorData::getDecorationArray (SG::auxid_t auxid) const } -/** - * @brief Return a span over an aux data item. - * @param auxid The desired aux data item. - * - * This will return a span containing the value of the requested - * auxiliary variable for all elements in the container. - * If the item doesn't exist, it will be created. - * Errors are signaled by raising an exception. - * Note that the @c value_type of the span is not necessarily @c T; - * an example is @c bool for which we return a span of @c char. - */ -template <class T> -AuxVectorData::span<T> AuxVectorData::getDataSpan (const std::string& name) -{ - using container_pointer_type = typename AuxDataTraits<T>::container_pointer_type; - auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name); - auto beg = reinterpret_cast<container_pointer_type> (getDataArray (id)); - return span<T> (beg, size_v()); -} - - -/** - * @brief Return a span over an aux data item. - * @param auxid The desired aux data item. - * - * This will return a span containing the value of the requested - * auxiliary variable for all elements in the container. - * If the item doesn't exist, it will be created. - * Errors are signaled by raising an exception. - * Note that the @c value_type of the span is not necessarily @c T; - * an example is @c bool for which we return a span of @c char. - */ -template <class T> -AuxVectorData::const_span<T> -AuxVectorData::getDataSpan (const std::string& name) const -{ - using const_container_pointer_type = typename AuxDataTraits<T>::const_container_pointer_type; - auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name); - auto beg = reinterpret_cast<const_container_pointer_type> (getDataArray (id)); - return const_span<T> (beg, size_v()); -} - - -/** - * @brief Return a span over an aux data item for a decoration. - * @param auxid The desired aux data item. - * - * This will return a span containing the value of the requested - * auxiliary variable for all elements in the container. - * If the item doesn't exist, it will be created. - * Errors are signaled by raising an exception. - * Note that the @c value_type of the span is not necessarily @c T; - * an example is @c bool for which we return a span of @c char. - * - * The difference between @c getDecorationSpan and @c getDataSpan is that - * @c getDecorationSpan takes a const container as input, but returns - * a span over non-const objects. This will only succeed if either the - * container is not locked or the item was first accessed - * as a decoration. - */ -template <class T> -AuxVectorData::span<T> -AuxVectorData::getDecorationSpan (const std::string& name) const -{ - using container_pointer_type = typename AuxDataTraits<T>::container_pointer_type; - auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name); - auto beg = reinterpret_cast<container_pointer_type> (getDecorationArray (id)); - return span<T> (beg, size_v()); -} - - -/** - * @brief Return a span over an aux data item. - * @param auxid The desired aux data item. - * - * This will return a span containing the value of the requested - * auxiliary variable for all elements in the container. - * If the item doesn't exist, it will be created. - * Errors are signaled by raising an exception. - * Note that the @c value_type of the span is not necessarily @c T; - * an example is @c bool for which we return a span of @c char. - */ -template <class T> -AuxVectorData::const_span<T> -AuxVectorData::getConstDataSpan (const std::string& name) const -{ - using const_container_pointer_type = typename AuxDataTraits<T>::const_container_pointer_type; - auxid_t id = SG::AuxTypeRegistry::instance().getAuxID<T> (name); - auto beg = reinterpret_cast<const_container_pointer_type> (getDataArray (id)); - return const_span<T> (beg, size_v()); -} - - /** * @brief Swap this instance with another. * @param other The other instance with which to swap. diff --git a/Control/AthContainers/share/AuxVectorBase_test.ref b/Control/AthContainers/share/AuxVectorBase_test.ref index 28c342a29e7e8631bd8aa110ad4417efd98a461a..3e74b2484721b9f3110108b4e4904d2a25d2e5cd 100644 --- a/Control/AthContainers/share/AuxVectorBase_test.ref +++ b/Control/AthContainers/share/AuxVectorBase_test.ref @@ -1,6 +1,8 @@ test_set_store test_set_store2 test_get_data +test_isAvailable +test_get_span test_reserve_resize test_shift test_get_types diff --git a/Control/AthContainers/test/AuxVectorBase_test.cxx b/Control/AthContainers/test/AuxVectorBase_test.cxx index b57cf2071849dfcfeb3efca172e1f13c187d1061..023c948a39625476ae1d5f60285c1da267964f0a 100644 --- a/Control/AthContainers/test/AuxVectorBase_test.cxx +++ b/Control/AthContainers/test/AuxVectorBase_test.cxx @@ -1,8 +1,6 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ - -// $Id$ /** * @file AthContainers/test/AuxVectorBase_test.cxx * @author scott snyder <snyder@bnl.gov> @@ -522,6 +520,73 @@ void test_get_data() } +void test_isAvailable() +{ + std::cout << "test_isAvailable\n"; + SG::AuxVectorBase_test b1; + b1.initAuxVectorBase<B> (SG::OWN_ELEMENTS, SG::DEFAULT_TRACK_INDICES); + + // No store. + assert (!b1.isAvailable<int> ("anInt")); + assert (!b1.isAvailableWritable<int> ("anInt")); + assert (!b1.isAvailableWritableAsDecoration<int> ("anInt")); + + // Empty const store. + SG::AuxStoreInternal store; + SG::IConstAuxStore* cstore = &store; + b1.setStore (cstore); + assert (!b1.isAvailable<int> ("anInt")); + assert (!b1.isAvailableWritable<int> ("anInt")); + assert (!b1.isAvailableWritableAsDecoration<int> ("anInt")); + + // Mutable store with variable. + SG::auxid_t ityp = SG::AuxTypeRegistry::instance().getAuxID<int> ("anInt"); + b1.setStore (&store); + b1.getData<int> (ityp, 0) = 1; + assert (b1.isAvailable<int> ("anInt")); + assert (b1.isAvailableWritable<int> ("anInt")); + assert (b1.isAvailableWritableAsDecoration<int> ("anInt")); + + // Make store const. + b1.setStore (cstore); + assert (b1.isAvailable<int> ("anInt")); + assert (!b1.isAvailableWritable<int> ("anInt")); + assert (b1.isAvailableWritableAsDecoration<int> ("anInt")); +} + + +template <class T> +std::vector<typename T::value_type> make_vector (const T& c) +{ + return std::vector<typename T::value_type> (c.begin(), c.end()); +} + + +void test_get_span() +{ + std::cout << "test_get_span\n"; + SG::AuxVectorBase_test b1; + b1.initAuxVectorBase<B> (SG::OWN_ELEMENTS, SG::DEFAULT_TRACK_INDICES); + SG::AuxStoreInternal store; + b1.setStore (&store); + + SG::auxid_t ityp = SG::AuxTypeRegistry::instance().getAuxID<int> ("anInt"); + b1.getData<int> (ityp, 0) = 1; + b1.getData<int> (ityp, 1) = 2; + + std::vector<int> vexp {1, 2, 0, 0, 0, 0, 0, 0, 0, 0}; + assert (make_vector (b1.getDataSpan<int> ("anInt")) == vexp); + + SG::IConstAuxStore* cstore = &store; + b1.setStore (cstore); + const SG::AuxVectorBase& cb1 = b1; + assert (b1.getConstDataSpan<int> ("anInt")[0] == 1); + assert (make_vector (b1.getConstDataSpan<int> ("anInt")) == vexp); + assert (make_vector (cb1.getDataSpan<int> ("anInt")) == vexp); + assert (make_vector (cb1.getDecorationSpan<int> ("anInt")) == vexp); +} + + void test_reserve_resize() { std::cout << "test_reserve_resize\n"; @@ -993,6 +1058,8 @@ int main() test_clear_index(); test_clear_indices(); test_get_data(); + test_isAvailable(); + test_get_span(); test_reserve_resize(); test_shift(); test_get_types(); diff --git a/Control/AthContainers/test/AuxVectorData_test.cxx b/Control/AthContainers/test/AuxVectorData_test.cxx index 934a2aa2a5759927b58a8b68b434c2beea6f09b4..0302613d8e453230cb3b46a2be16a96e90452647 100644 --- a/Control/AthContainers/test/AuxVectorData_test.cxx +++ b/Control/AthContainers/test/AuxVectorData_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file AthContainers/test/AuxVectorData_test.cxx @@ -50,13 +50,6 @@ using SG::AuxVectorData; using SG::AuxVectorData_test; -template <class T> -std::vector<typename T::value_type> make_vector (const T& c) -{ - return std::vector<typename T::value_type> (c.begin(), c.end()); -} - - void test_get_data() { std::cout << "test_get_data\n"; @@ -75,9 +68,6 @@ void test_get_data() assert (!b1.isAvailable (ityp)); assert (!b1.isAvailableWritable (ityp)); assert (!b1.isAvailableWritableAsDecoration (ityp)); - assert (!b1.isAvailable<int> ("anInt")); - assert (!b1.isAvailableWritable<int> ("anInt")); - assert (!b1.isAvailableWritableAsDecoration<int> ("anInt")); assert (b1.getConstStore() == 0); assert (b1.getStore() == 0); b1.setStore (cstore); @@ -88,9 +78,6 @@ void test_get_data() assert (!b1.isAvailable (ityp)); assert (!b1.isAvailableWritable (ityp)); assert (!b1.isAvailableWritableAsDecoration (ityp)); - assert (!b1.isAvailable<int> ("anInt")); - assert (!b1.isAvailableWritable<int> ("anInt")); - assert (!b1.isAvailableWritableAsDecoration<int> ("anInt")); EXPECT_EXCEPTION (SG::ExcConstAuxData, b1.getData<int> (ityp, 0)); EXPECT_EXCEPTION (SG::ExcBadAuxVar, cb1.getData<int> (ityp, 0)); EXPECT_EXCEPTION (SG::ExcBadAuxVar, cb1.getDataArray (ityp)); @@ -110,15 +97,9 @@ void test_get_data() assert (b1.isAvailable (ityp)); assert (b1.isAvailableWritable (ityp)); assert (b1.isAvailableWritableAsDecoration (ityp)); - assert (b1.isAvailable<int> ("anInt")); - assert (b1.isAvailableWritable<int> ("anInt")); - assert (b1.isAvailableWritableAsDecoration<int> ("anInt")); assert (reinterpret_cast<const int*>(cb1.getDataArray (ityp))[1] == 2); assert (reinterpret_cast<const int*>(cb1.getDataArrayAllowMissing (ityp))[1] == 2); - std::vector<int> vexp {1, 2, 0, 0, 0, 0, 0, 0, 0, 0}; - assert (make_vector (b1.getDataSpan<int> ("anInt")) == vexp); - b1.setStore (cstore); assert (!b1.hasNonConstStore()); assert (cb1.getData<int> (ityp, 0) == 1); @@ -126,9 +107,6 @@ void test_get_data() assert (b1.isAvailable (ityp)); assert (!b1.isAvailableWritable (ityp)); assert (b1.isAvailableWritableAsDecoration (ityp)); - assert (b1.isAvailable<int> ("anInt")); - assert (!b1.isAvailableWritable<int> ("anInt")); - assert (b1.isAvailableWritableAsDecoration<int> ("anInt")); SG::auxid_t ftyp = SG::AuxTypeRegistry::instance().getAuxID<float> ("aFloat"); float* ff = reinterpret_cast<float*> (store.getData (ftyp, 10, 20)); @@ -136,11 +114,6 @@ void test_get_data() ff[1] = 2.5; assert (cb1.getData<float> (ftyp, 0) == 1.5); assert (cb1.getData<float> (ftyp, 1) == 2.5); - - assert (b1.getConstDataSpan<int> ("anInt")[0] == 1); - assert (make_vector (b1.getConstDataSpan<int> ("anInt")) == vexp); - assert (make_vector (cb1.getDataSpan<int> ("anInt")) == vexp); - assert (make_vector (cb1.getDecorationSpan<int> ("anInt")) == vexp); } diff --git a/Control/AthenaConfiguration/CMakeLists.txt b/Control/AthenaConfiguration/CMakeLists.txt index 0f25f538d0f5a12feed98eba5924fe5901e2451c..65493f70f083c9b45bea213b433bc61c5bdde0cd 100644 --- a/Control/AthenaConfiguration/CMakeLists.txt +++ b/Control/AthenaConfiguration/CMakeLists.txt @@ -81,6 +81,10 @@ endif() # tests that should run only in Athena if( NOT SIMULATIONBASE AND NOT GENERATIONBASE AND NOT XAOD_ANALYSIS ) + atlas_add_test( AllConfigFlagsTest_BS + SCRIPT test/testAllConfigFlags_BS.py + POST_EXEC_SCRIPT nopost.sh ) + atlas_add_test( AllConfigFlagsTest_RDO SCRIPT test/testAllConfigFlags_RDO.py POST_EXEC_SCRIPT nopost.sh ) diff --git a/Control/AthenaConfiguration/python/AnalysisApp.py b/Control/AthenaConfiguration/python/AnalysisApp.py index b20859b54671b7f9d95289117e8a456483f403b9..4aa1e36bccdea05e752c6981b16429eb54de6331 100644 --- a/Control/AthenaConfiguration/python/AnalysisApp.py +++ b/Control/AthenaConfiguration/python/AnalysisApp.py @@ -50,7 +50,7 @@ def initFlags(): acf.addFlag('Common.MsgSuppression',True) # Enable suppression of printout in MessageSvc acf.addFlag('Common.MsgSourceLength',50) #Length of the source-field in the format str of MessageSvc - acf.addFlag('Common.ProductionStep', ProductionStep.Default, enum=ProductionStep, help=argparse.SUPPRESS) + acf.addFlag('Common.ProductionStep', ProductionStep.Default, type=ProductionStep, help=argparse.SUPPRESS) acf.addFlag('Common.isOverlay', False, help=argparse.SUPPRESS) #Flags describing the input data @@ -59,7 +59,7 @@ def initFlags(): acf.addFlag('Input.SecondaryFiles', [], help=argparse.SUPPRESS) # secondary input files for DoubleEventSelector acf.addFlag('Input.ProcessingTags', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("processingTags", []), help="expert flag, do not override" ) # list of names of streams written to this file acf.addFlag('Input.ProjectName', lambda prevFlags : GetFileMD(prevFlags.Input.Files).get("project_name", "data17_13TeV"), help="expert flag, do not override") # former global.ProjectName - acf.addFlag('Input.MCCampaign', lambda prevFlags : Campaign(GetFileMD(prevFlags.Input.Files).get("mc_campaign", "")), enum=Campaign, help="expert flag, do not override") + acf.addFlag('Input.MCCampaign', lambda prevFlags : Campaign(GetFileMD(prevFlags.Input.Files).get("mc_campaign", "")), type=Campaign, help="expert flag, do not override") acf.addFlag('Concurrency.NumProcs', 0, help="0 = disables MP, otherwise is # of processes to use in MP mode") diff --git a/Control/AthenaConfiguration/python/TestDefaults.py b/Control/AthenaConfiguration/python/TestDefaults.py index 0e484cf617a8093ef1db46f649cb16242d375627..5a88ad5f037416c623ad7a039a182feeded00d56 100644 --- a/Control/AthenaConfiguration/python/TestDefaults.py +++ b/Control/AthenaConfiguration/python/TestDefaults.py @@ -46,3 +46,18 @@ class defaultGeometryTags: RUN2_BEST_KNOWLEDGE = "ATLAS-R2-2016-01-02-01" RUN3 = "ATLAS-R3S-2021-03-02-00" RUN4 = "ATLAS-P2-RUN4-03-00-00" + + @staticmethod + def autoconfigure(flags): + if flags.GeoModel.AtlasVersion: + return flags.GeoModel.AtlasVersion + + from AthenaConfiguration.Enums import LHCPeriod + if flags.GeoModel.Run is LHCPeriod.Run1: + return defaultGeometryTags.RUN1_2012 + if flags.GeoModel.Run is LHCPeriod.Run2: + return defaultGeometryTags.RUN2 + if flags.GeoModel.Run is LHCPeriod.Run3: + return defaultGeometryTags.RUN3 + if flags.GeoModel.Run is LHCPeriod.Run4: + return defaultGeometryTags.RUN4 diff --git a/Control/AthenaConfiguration/test/testAllConfigFlags_EVNT.py b/Control/AthenaConfiguration/test/testAllConfigFlags_EVNT.py index 48236eebbe0cbf8e5fc4f5f4085906366972f5dc..1095aaa4c0a27ee74eece9b53d206c82802b20d9 100755 --- a/Control/AthenaConfiguration/test/testAllConfigFlags_EVNT.py +++ b/Control/AthenaConfiguration/test/testAllConfigFlags_EVNT.py @@ -1,19 +1,10 @@ #!/usr/bin/env python # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.AllConfigFlags import initConfigFlags -from AthenaConfiguration.TestDefaults import defaultTestFiles +from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags flags = initConfigFlags() flags.Input.Files = defaultTestFiles.EVNT -# Load Detector flags if available -flagsAvailableDetector = True -try: - import DetDescrCnvSvc # noqa: F401 -except ImportError: - flagsAvailableDetector = False -if flagsAvailableDetector: - flags._loadDynaFlags("Detector") - # Load Sim flags if available flagsAvailableSim = True try: @@ -21,6 +12,7 @@ try: except ImportError: flagsAvailableSim = False if flagsAvailableSim: + flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags._loadDynaFlags("Sim") # Init and print diff --git a/Control/AthenaMonitoring/python/DQConfigFlags.py b/Control/AthenaMonitoring/python/DQConfigFlags.py index d6ffc83dc85cf391bac4bf5d3429ee1c4b868731..f75753e366c374837a04f020458649eb1ff9f4ad 100644 --- a/Control/AthenaMonitoring/python/DQConfigFlags.py +++ b/Control/AthenaMonitoring/python/DQConfigFlags.py @@ -48,7 +48,7 @@ def createDQConfigFlags(): # computed acf.addFlag('DQ.Environment', getEnvironment ) - acf.addFlag('DQ.DataType', getDataType, enum=DQDataType ) + acf.addFlag('DQ.DataType', getDataType, type=DQDataType ) # for in-Athena histogram postprocessing acf.addFlag('DQ.doPostProcessing', False) diff --git a/Control/AthenaServices/src/AthenaOutputStreamTool.cxx b/Control/AthenaServices/src/AthenaOutputStreamTool.cxx index 635f69055af73a6b409c95f78c384999272931a3..8ed1e1fbec1043b84bffed36f14022bfc026c25b 100644 --- a/Control/AthenaServices/src/AthenaOutputStreamTool.cxx +++ b/Control/AthenaServices/src/AthenaOutputStreamTool.cxx @@ -475,12 +475,11 @@ StatusCode AthenaOutputStreamTool::streamObjects(const DataObjectVec& dataObject if (dobj->clID() != 1 || addr->par()[0] != "\n") { if (dobj->clID() != ClassID_traits<DataHeader>::ID()) { m_dataHeader->insert(proxy, addr); + if (m_store->storeID() != StoreID::EVENT_STORE) proxy->setAddress(addr); } else { m_dataHeader->insert(proxy, addr, m_processTag); } - if (proxy->address() == nullptr) { - proxy->setAddress(addr); - } else { + if (m_store->storeID() == StoreID::EVENT_STORE) { addr->release(); } } diff --git a/Control/AthenaServices/src/MetaDataSvc.cxx b/Control/AthenaServices/src/MetaDataSvc.cxx index d192b6794daaaf717bd13bd48f7c465514aae1f5..e663cb410c77d4b49b623cba1525fbcf8eb2fa3d 100644 --- a/Control/AthenaServices/src/MetaDataSvc.cxx +++ b/Control/AthenaServices/src/MetaDataSvc.cxx @@ -265,9 +265,9 @@ StatusCode MetaDataSvc::newMetadataSource(const Incident& inc) } StatusCode rc(StatusCode::SUCCESS); for (auto it = m_metaDataTools.begin(); it != m_metaDataTools.end(); ++it) { - ATH_MSG_DEBUG(" calling beginInputFile for " << (*it)->name()); + ATH_MSG_DEBUG(" calling beginInputFile on " << (*it)->name() << " for GUID \"" << guid << "\""); if ( (*it)->beginInputFile(guid).isFailure() ) { - ATH_MSG_ERROR("Unable to call beginInputFile for " << it->name()); + ATH_MSG_ERROR("Unable to call beginInputFile for " << (*it)->name()); rc = StatusCode::FAILURE; } } @@ -284,8 +284,9 @@ StatusCode MetaDataSvc::retireMetadataSource(const Incident& inc) const std::string guid = fileInc->fileGuid(); ATH_MSG_DEBUG("retireMetadataSource: " << fileInc->fileName()); for (auto it = m_metaDataTools.begin(); it != m_metaDataTools.end(); ++it) { + ATH_MSG_DEBUG(" calling endInputFile on " << (*it)->name() << " for GUID \"" << guid << "\""); if ( (*it)->endInputFile(guid).isFailure() ) { - ATH_MSG_ERROR("Unable to call endInputFile for " << it->name()); + ATH_MSG_ERROR("Unable to call endInputFile for " << (*it)->name()); return StatusCode::FAILURE; } } @@ -301,7 +302,7 @@ StatusCode MetaDataSvc::prepareOutput() for (auto it = m_metaDataTools.begin(); it != m_metaDataTools.end(); ++it) { ATH_MSG_DEBUG(" calling metaDataStop for " << (*it)->name()); if ( (*it)->metaDataStop().isFailure() ) { - ATH_MSG_ERROR("Unable to call metaDataStop for " << it->name()); + ATH_MSG_ERROR("Unable to call metaDataStop for " << (*it)->name()); rc = StatusCode::FAILURE; } } @@ -325,7 +326,7 @@ StatusCode MetaDataSvc::prepareOutput(const std::string& outputName) ATH_MSG_DEBUG(" calling metaDataStop for " << (*it)->name()); // planning to replace the call below with (*it)->prepareOutput(outputName) if ( (*it)->metaDataStop().isFailure() ) { - ATH_MSG_ERROR("Unable to call metaDataStop for " << it->name()); + ATH_MSG_ERROR("Unable to call metaDataStop for " << (*it)->name()); rc = StatusCode::FAILURE; } } diff --git a/Control/CxxUtils/CxxUtils/vec.h b/Control/CxxUtils/CxxUtils/vec.h index 3a7455ff4f54156093fb049c631877d4021e0539..3f3684b6c60be4ad665856415a91151377d7accc 100644 --- a/Control/CxxUtils/CxxUtils/vec.h +++ b/Control/CxxUtils/CxxUtils/vec.h @@ -1,6 +1,6 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration. + * Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration. */ /** * @file CxxUtils/vec.h @@ -45,18 +45,21 @@ * - @c CxxUtils::vec_size<VEC>() is the number of elements in @c VEC. * - @c CxxUtils::vec_size(const VEC&) is the number of elements in @c VEC. * - * Additional Helpers for common SIMD operations: + * Initializing with a value : * * - @c CxxUtils::vbroadcast (VEC& v, T x) initializes each element of * @c v with @c x. + * + * Load from/store to array: + * * - @c CxxUtils::vload (VEC& dst, const vec_type_t<VEC>* src) * loads elements from @c src * to @c dst * - @c CxxUtils::vstore (vec_type_t<VEC>* dst, const VEC& src) * stores elements from @c src * to @c dst - * - @c CxxUtils::vany(const VEC& mask) check if any of the elements - * of a mask is true (not 0) + * Basic Algorithms : + * * - @c CxxUtils::vselect (VEC& dst, const VEC& a, const VEC& b, const * vec_mask_type_t<VEC>& mask) copies elements * from @c a or @c b, depending @@ -66,15 +69,28 @@ * copies to @c dst[i] the min(a[i],b[i]) * - @c CxxUtils::vmax (VEC& dst, const VEC& a, const VEC& b) * copies to @c dst[i] the max(a[i],b[i]) + * + * Bool reductions : + * + * - @c CxxUtils::vany(const VEC& mask) Returns true if at least + * one value in mask is true. + * - @c CxxUtils::vnone(const VEC& mask) Returns true if + * all values in k are false + * - @c CxxUtils::vall(const VEC& mask) Returns true if + * all values in k are true + * + * Conversions/Casting : + * * - @c CxxUtils::vconvert (VEC1& dst, const VEC2& src) * Fills @c dst with the result of a * static_cast of every element of @c src * to the element type of dst. * dst[i] = static_cast<vec_type_t<VEC1>>(src[i]) * - * Functions that construct a permutation of elements from one or two vectors - * and return a vector of the same type as the input vector(s). - * The mask has the same element count as the vectors. + * Permutations : + * + * The mask has the same element count as the input vectors. + * The functions return a vector of the same type as the input vector(s). * Intentionally kept compatible with gcc's _builtin_shuffle. * If we move to gcc>=12 we could unify with clang's _builtin_shuffle_vector * and relax some of these requirements @@ -100,12 +116,13 @@ * from the second input vector should be placed * in the corresponding position in the result vector. * - * In terms of expected performance it might be advantageous to + * For good performance the user should * use vector types that fit the size of the ISA. - * e.g 128 bit wide for SSE, 256 wide for AVX. + * e.g 128 bit wide for SSE, 256 wide for AVX etc. * * Specifying a combination that is not valid for the current architecture * causes the compiler to synthesize the instructions using a narrower mode. + * But this might not always produce optimal code for all operations. * * Consider using Function Multiversioning (CxxUtils/features.h) * if you really need to target efficiently multiple ISAs. @@ -135,70 +152,75 @@ namespace CxxUtils { - +namespace vecDetail { /** * @brief check the type and the size of the vector. * Choose between the built-in (if available or * fallback type. */ template <typename T, size_t N> -struct vec_typedef{ - static_assert((N & (N-1)) == 0, "N must be a power of 2."); - static_assert(std::is_arithmetic_v<T>, "T not an arithmetic type"); +struct vec_typedef { + static_assert((N & (N - 1)) == 0, "N must be a power of 2."); + static_assert(std::is_arithmetic_v<T>, "T not an arithmetic type"); #if HAVE_VECTOR_SIZE_ATTRIBUTE - - using type __attribute__ ((vector_size(N*sizeof(T)))) = T; - + using type __attribute__((vector_size(N * sizeof(T)))) = T; #else - - using type vec_fb<T, N>; - + using type vec_fb<T, N>; #endif }; -/** - * @brief Define a nice alias for the vectorized type - */ -template <typename T, size_t N> -using vec = typename vec_typedef<T,N>::type; - /** * @brief Deduce the element type from a vectorized type. */ template <class VEC> -struct vec_type -{ +struct vec_type { // Works in c++17. - static auto elt (const VEC& v) -> decltype( v[0] ); - typedef typename std::invoke_result< decltype(elt), const VEC& >::type type1; - typedef std::remove_cv_t<std::remove_reference_t<type1> > type; + static auto elt(const VEC& v) -> decltype(v[0]); + typedef typename std::invoke_result<decltype(elt), const VEC&>::type type1; + typedef std::remove_cv_t<std::remove_reference_t<type1>> type; }; -/** - * @brief Define a nice alias for the element type of a vectorized type - */ -template<class VEC> -using vec_type_t = typename vec_type<VEC>::type; - /** * @brief Deduce the type of the mask returned by relational operations, * for a vectorized type. */ -template<class VEC> -struct vec_mask_type -{ +template <class VEC> +struct vec_mask_type { static auto maskt(const VEC& v1, const VEC& v2) -> decltype(v1 < v2); - typedef - typename std::invoke_result<decltype(maskt), const VEC&, const VEC&>::type type1; + typedef typename std::invoke_result<decltype(maskt), const VEC&, const VEC&>::type type1; typedef std::remove_cv_t<std::remove_reference_t<type1>> type; }; +/** + * @brief Helper for static asserts for argument packs + */ +namespace bool_pack_helper { +template <bool...> +struct bool_pack; +template <bool... bs> +using all_true = std::is_same<bool_pack<bs..., true>, bool_pack<true, bs...>>; +} // namespace bool_pack_helper + +} // namespace vecDetail + +/** + * @brief Define a nice alias for the vectorized type + */ +template <typename T, size_t N> +using vec = typename vecDetail::vec_typedef<T,N>::type; + +/** + * @brief Define a nice alias for the element type of a vectorized type + */ +template<class VEC> +using vec_type_t = typename vecDetail::vec_type<VEC>::type; + /** * @brief Define a nice alias for the mask type for a vectorized type. */ template<class VEC> -using vec_mask_type_t = typename vec_mask_type<VEC>::type; +using vec_mask_type_t = typename vecDetail::vec_mask_type<VEC>::type; /** * @brief Return the number of elements in a vectorized type. @@ -269,30 +291,14 @@ vstore(vec_type_t<VEC>* dst, const VEC& src) std::memcpy(dst, &src, sizeof(VEC)); } -/* - * @brief return if any of the - * elements of a mask is true (not 0) - */ -template<typename VEC> -ATH_ALWAYS_INLINE -bool vany(const VEC& mask){ - static_assert(std::is_integral<vec_type_t<VEC>>::value, - "vec must be integral (aka a mask)"); - VEC zero; - vbroadcast(zero,vec_type_t<VEC>{0}); - return std::memcmp(&mask, &zero, sizeof(VEC)) != 0; -} - /* * @brief select elements based on a mask * Fill dst according to * dst[i] = mask[i] ? a[i] : b[i] */ -template<typename VEC> +template <typename VEC> ATH_ALWAYS_INLINE -void -vselect(VEC& dst, const VEC& a, const VEC& b, const vec_mask_type_t<VEC>& mask) -{ +void vselect(VEC& dst, const VEC& a, const VEC& b, const vec_mask_type_t<VEC>& mask) { #if !HAVE_VECTOR_SIZE_ATTRIBUTE || WANT_VECTOR_FALLBACK constexpr size_t N = vec_size<VEC>(); for (size_t i = 0; i < N; ++i) { @@ -305,7 +311,7 @@ vselect(VEC& dst, const VEC& a, const VEC& b, const vec_mask_type_t<VEC>& mask) /* * @brief vectorized min. - * copies to @c dst[i] the min(a[i],b[i]) + * copies to @c dst[i] the min(a[i],b[i]) */ template<typename VEC> ATH_ALWAYS_INLINE @@ -341,6 +347,61 @@ vmax(VEC& dst, const VEC& a, const VEC& b) #endif } +/* + * @brief Returns true if at least + * one value in mask is true. + */ +template<typename VEC> +ATH_ALWAYS_INLINE +bool vany(const VEC& mask){ + static_assert(std::is_integral<vec_type_t<VEC>>::value, + "vec elements must be of integral type. Aka vec must be " + "compatible with a mask"); + VEC zero; + vbroadcast(zero,vec_type_t<VEC>{0}); + return std::memcmp(&mask, &zero, sizeof(VEC)) != 0; +} + +/* + * @brief Returns true if + * all values in k are false + */ +template<typename VEC> +ATH_ALWAYS_INLINE +bool vnone(const VEC& mask){ + static_assert(std::is_integral<vec_type_t<VEC>>::value, + "vec elements must be of integral type. Aka vec must be " + "compatible with a mask"); + VEC zero; + vbroadcast(zero,vec_type_t<VEC>{0}); + return std::memcmp(&mask, &zero, sizeof(VEC)) == 0; +} + +/* + * @brief Returns true if + * all values in k are false + */ +template<typename VEC> +ATH_ALWAYS_INLINE +bool vall(const VEC& mask){ + static_assert(std::is_integral<vec_type_t<VEC>>::value, + "vec elements must be of integral type. Aka vec must be " + "compatible with a mask"); + VEC alltrue; +#if !HAVE_VECTOR_SIZE_ATTRIBUTE || WANT_VECTOR_FALLBACK + // fallback compares to 0 when false + // and 1 when is true + vbroadcast(alltrue, vec_type_t<VEC>{1}); +#else + // For the gnu vector extensions + // Vectors are compared element-wise producing 0 when comparison is false + // and -1 (constant of the appropriate type where all bits are set) otherwise. + vbroadcast(alltrue, vec_type_t<VEC>{-1}); +#endif + return std::memcmp(&mask, &alltrue, sizeof(VEC)) == 0; +} + + template<typename VEC1, typename VEC2> ATH_ALWAYS_INLINE void @@ -360,15 +421,6 @@ vconvert(VEC1& dst, const VEC2& src) #endif } -/** - * @brief Helper for static asserts for argument packs - */ -namespace bool_pack_helper { -template<bool...> -struct bool_pack; -template<bool... bs> -using all_true = std::is_same<bool_pack<bs..., true>, bool_pack<true, bs...>>; -} /** * @brief vpermute function. * move any element of a vector src @@ -383,7 +435,7 @@ vpermute(VEC& dst, const VEC& src) static_assert((sizeof...(Indices) == N), "vpermute number of indices different than vector size"); static_assert( - bool_pack_helper::all_true<(Indices >= 0 && Indices < N)...>::value, + vecDetail::bool_pack_helper::all_true<(Indices >= 0 && Indices < N)...>::value, "vpermute value of a mask index is outside the allowed range"); #if !HAVE_VECTOR_SIZE_ATTRIBUTE || WANT_VECTOR_FALLBACK @@ -409,7 +461,7 @@ vpermute2(VEC& dst, const VEC& src1, const VEC& src2) (sizeof...(Indices) == N), "vpermute2 number of indices different than vector size"); static_assert( - bool_pack_helper::all_true<(Indices >= 0 && Indices < 2 * N)...>::value, + vecDetail::bool_pack_helper::all_true<(Indices >= 0 && Indices < 2 * N)...>::value, "vpermute2 value of a mask index is outside the allowed range"); #if !HAVE_VECTOR_SIZE_ATTRIBUTE || WANT_VECTOR_FALLBACK @@ -431,7 +483,6 @@ vpermute2(VEC& dst, const VEC& src1, const VEC& src2) #endif } - } // namespace CxxUtils #endif // not CXXUTILS_VEC_H diff --git a/Control/CxxUtils/test/vec_test_common.h b/Control/CxxUtils/test/vec_test_common.h index de9ccff4f231289ced9f354d9ea53da7d14902d5..998c5673a5ee2cac31a778aee656e7b97d62251e 100644 --- a/Control/CxxUtils/test/vec_test_common.h +++ b/Control/CxxUtils/test/vec_test_common.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file CxxUtils/test/vec_test_common.h @@ -430,21 +430,38 @@ test_convert_to_int(const VEC& v1) template<class VEC> void -test_any(const VEC& v1, const VEC& v2) +test_any(const VEC& v1) { - CxxUtils::vec_mask_type_t<VEC> lt = v1<v2; - constexpr size_t N = CxxUtils::vec_size<VEC>(); + VEC v2 = v1; + v2[0] += 1; //So v2 will be larger + CxxUtils::vec_mask_type_t<VEC> lt = v1 < v2; bool result = CxxUtils::vany(lt); - bool loopResult = false; - for (size_t i = 0; i < N; ++i) { - if (lt[i] != 0) { - loopResult = true; - break; - } - } - assert(result == loopResult); + assert(result == true); +} + +template<class VEC> +void +test_none(const VEC& v1) +{ + VEC v2 = v1; + CxxUtils::vec_mask_type_t<VEC> neq = v1 != v2; + bool result = CxxUtils::vnone(neq); + assert(result == true); } + +template<class VEC> +void +test_all(const VEC& v1) +{ + VEC v2 = v1; + CxxUtils::vec_mask_type_t<VEC> eq = v1==v2; + bool result = CxxUtils::vall(eq); + assert(result == true); +} + + + /** * Helper to fill a vector with N * elements. Where N the size of the vec @@ -528,7 +545,9 @@ testInt1() test_permute(testVec1); \ test_blend(testVec1); \ test_convert_to_double(testVec1); \ - test_any(testVec2, testVec3); \ + test_any(testVec3); \ + test_none(testVec3); \ + test_all(testVec3); \ test_int(testVec1); \ test_logops(testVec3); \ } while (0) diff --git a/Control/RootUtils/src/WithRootErrorHandler.cxx b/Control/RootUtils/src/WithRootErrorHandler.cxx index 4988e6f9a82fbf246acb4edfb5de53ba150fad94..6a8875215f45b7853c7d470e6bfa8fd3fe4f6145 100644 --- a/Control/RootUtils/src/WithRootErrorHandler.cxx +++ b/Control/RootUtils/src/WithRootErrorHandler.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration. + * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration. */ /** * @file RootUtils/src/WithRootErrorHandler.cxx @@ -11,6 +11,7 @@ #include "RootUtils/WithRootErrorHandler.h" #include <vector> +#include <cstdlib> namespace { diff --git a/Control/xAODRootAccess/Root/TAuxVector.cxx b/Control/xAODRootAccess/Root/TAuxVector.cxx index e1dba9b0d05257303a3bef0ccb9dcd5736980a34..3d77dca76b19a56554978271e52558b005b453ca 100644 --- a/Control/xAODRootAccess/Root/TAuxVector.cxx +++ b/Control/xAODRootAccess/Root/TAuxVector.cxx @@ -30,7 +30,9 @@ namespace xAOD { XAOD_MESSAGE( "No collection proxy found for type %s" ), cl->GetName() ); } - m_proxy->PushProxy( m_vec ); + else { + m_proxy->PushProxy( m_vec ); + } // Make sure the object is of the right size: this->resize( size ); diff --git a/Control/xAODRootAccess/Root/Utils.cxx b/Control/xAODRootAccess/Root/Utils.cxx index a675037f3553402abc0edf87e45008d373077363..dd1f6205d133d066391f86e5a991b1367100c924 100644 --- a/Control/xAODRootAccess/Root/Utils.cxx +++ b/Control/xAODRootAccess/Root/Utils.cxx @@ -320,7 +320,7 @@ namespace xAOD { const TObjArray * pBranches = tree->GetListOfBranches(); const std::regex pattern( ".*" + pre + ".*" ); - for( int i = 0; i < pBranches->GetLast() ; ++i ) { + for( int i = 0, nLast = pBranches->GetLast(); i <= nLast; ++i ) { const std::string name = pBranches->At(i)->GetName(); if( std::regex_match( name, pattern ) ) diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref index d4a7d211151640637faa840f6a90f8cefe9cce90..ef3751273e202677730448b9cf0f2c40d078ebfa 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RCond.ref @@ -181,7 +181,7 @@ RootDatabase.se... DEBUG Using Tree cache. Size: -1 Nevents to learn with: -1 MetaDataSvc DEBUG handle() BeginInputFile for SimplePoolFile1.root MetaDataSvc DEBUG initInputMetaDataStore: file name SimplePoolFile1.root MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" EventSelector DEBUG Get AttributeList from the collection EventSelector DEBUG AttributeList size 12 EventSelector DEBUG record AthenaAttribute, name = Token = [DB=F2313678-C96A-964F-89E8-08BAB39F2DA7][CNT=POOLContainer(DataHeader)][CLID=4DDBD295-EFCE-472A-9EC8-15CD35A9EB8D][TECH=00000203][OID=00000005-00000000]. @@ -974,6 +974,7 @@ ReadData INFO Hit x = 2030.12 y = 46.5439 z = -1956.17 detector = Du AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 20 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 MetaDataSvc DEBUG retireMetadataSource: FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" StorageSvc DEBUG Disconnect request for database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 PFN=SimplePoolFile1.root StorageSvc DEBUG Closing database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 RootDatabase.close DEBUG Closing DB SimplePoolFile1.root diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref index 811ed7dfb812ae206f344edfd37195f9a5f4e19f..e660ef7d8aab22e1b35e3ee539c9833f91d4e2b7 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_RMeta.ref @@ -147,8 +147,8 @@ RootDatabase.se... DEBUG Using Tree cache. Size: -1 Nevents to learn with: -1 MetaDataSvc DEBUG handle() BeginInputFile for SimplePoolFile5.root MetaDataSvc DEBUG initInputMetaDataStore: file name SimplePoolFile5.root MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.AthPoolEx::ReadMeta +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "C949FD2E-3B8E-9343-AAE0-0C43" +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.AthPoolEx::ReadMeta for GUID "C949FD2E-3B8E-9343-AAE0-0C43" SimplePoolFile5... DEBUG --> Access DbContainer READ [ROOT_Tree] MetaData(ExampleHitContainer_p1/PedestalWriteData) MetaData(Exampl... DEBUG Opening MetaData(Exampl... DEBUG attributes# = 1 @@ -858,6 +858,8 @@ ReadData INFO Hit x = 2030.12 y = -53.4561 z = -1956.17 detector = D AthenaEventLoopMgr INFO ===>>> done processing event #20, run #0 20 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:C949FD2E-3B8E-9343-AAE0-0C43 MetaDataSvc DEBUG retireMetadataSource: FID:C949FD2E-3B8E-9343-AAE0-0C43 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "C949FD2E-3B8E-9343-AAE0-0C43" +MetaDataSvc DEBUG calling endInputFile on ToolSvc.AthPoolEx::ReadMeta for GUID "C949FD2E-3B8E-9343-AAE0-0C43" StorageSvc DEBUG Disconnect request for database: FID=C949FD2E-3B8E-9343-AAE0-0C43 PFN=SimplePoolFile5.root StorageSvc DEBUG Closing database: FID=C949FD2E-3B8E-9343-AAE0-0C43 RootDatabase.close DEBUG Closing DB SimplePoolFile5.root diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref index 3ab8ae8ca254c6ce32f0f8a57a2ef954ded1396f..91d9070e18ad8ec16d6c04deb33f9a2d7fed39e4 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWrite.ref @@ -152,7 +152,7 @@ RootDatabase.se... DEBUG Using Tree cache. Size: -1 Nevents to learn with: -1 MetaDataSvc DEBUG handle() BeginInputFile for SimplePoolFile1.root MetaDataSvc DEBUG initInputMetaDataStore: file name SimplePoolFile1.root MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" EventSelector DEBUG Get AttributeList from the collection EventSelector DEBUG AttributeList size 3 EventSelector DEBUG record AthenaAttribute, name = Token = [DB=F2313678-C96A-964F-89E8-08BAB39F2DA7][CNT=POOLContainer(DataHeader)][CLID=4DDBD295-EFCE-472A-9EC8-15CD35A9EB8D][TECH=00000203][OID=00000005-00000000]. @@ -1957,6 +1957,7 @@ Stream1.FileMet... DEBUG retrieved existing list of lumiBlocks AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 20 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 MetaDataSvc DEBUG retireMetadataSource: FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" StorageSvc DEBUG Disconnect request for database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 PFN=SimplePoolFile1.root StorageSvc DEBUG Closing database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 RootDatabase.close DEBUG Closing DB SimplePoolFile1.root diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref index 4e8ff910b36a8ebd1fa552a80fb20ed17bcc00c6..1b946346d0ab66e726a639da574f67d0b78c4f6d 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteAgain.ref @@ -176,7 +176,7 @@ RootDatabase.se... DEBUG Using Tree cache. Size: -1 Nevents to learn with: -1 MetaDataSvc DEBUG handle() BeginInputFile for SimplePoolReplica1.root MetaDataSvc DEBUG initInputMetaDataStore: file name SimplePoolReplica1.root MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "095498FF-E805-B142-9948-BD2D4AC79975" EventSelector DEBUG Get AttributeList from the collection EventSelector DEBUG AttributeList size 12 EventSelector DEBUG record AthenaAttribute, name = Token = [DB=095498FF-E805-B142-9948-BD2D4AC79975][CNT=POOLContainer(DataHeader)][CLID=4DDBD295-EFCE-472A-9EC8-15CD35A9EB8D][TECH=00000203][OID=00000005-00000000]. @@ -1981,6 +1981,7 @@ Stream1.FileMet... DEBUG retrieved existing list of lumiBlocks AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 20 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:095498FF-E805-B142-9948-BD2D4AC79975 MetaDataSvc DEBUG retireMetadataSource: FID:095498FF-E805-B142-9948-BD2D4AC79975 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "095498FF-E805-B142-9948-BD2D4AC79975" StorageSvc DEBUG Disconnect request for database: FID=095498FF-E805-B142-9948-BD2D4AC79975 PFN=SimplePoolReplica1.root StorageSvc DEBUG Closing database: FID=095498FF-E805-B142-9948-BD2D4AC79975 RootDatabase.close DEBUG Closing DB SimplePoolReplica1.root diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref index 55bcaf0f0cf81e491e8fb1841047ce10b179e70b..4527c7358fe541483333191706937bc56860e0bf 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReWriteNext.ref @@ -152,7 +152,7 @@ RootDatabase.se... DEBUG Using Tree cache. Size: -1 Nevents to learn with: -1 MetaDataSvc DEBUG handle() BeginInputFile for SimplePoolFile3.root MetaDataSvc DEBUG initInputMetaDataStore: file name SimplePoolFile3.root MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "A811B014-0297-AD47-AF4C-B75EF418982D" EventSelector DEBUG Get AttributeList from the collection EventSelector DEBUG AttributeList size 3 EventSelector DEBUG record AthenaAttribute, name = Token = [DB=A811B014-0297-AD47-AF4C-B75EF418982D][CNT=POOLContainer(DataHeader)][CLID=4DDBD295-EFCE-472A-9EC8-15CD35A9EB8D][TECH=00000203][OID=00000005-00000000]. @@ -1335,6 +1335,7 @@ Stream1.FileMet... DEBUG retrieved existing list of lumiBlocks AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 20 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:A811B014-0297-AD47-AF4C-B75EF418982D MetaDataSvc DEBUG retireMetadataSource: FID:A811B014-0297-AD47-AF4C-B75EF418982D +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "A811B014-0297-AD47-AF4C-B75EF418982D" StorageSvc DEBUG Disconnect request for database: FID=A811B014-0297-AD47-AF4C-B75EF418982D PFN=SimplePoolFile3.root StorageSvc DEBUG Closing database: FID=A811B014-0297-AD47-AF4C-B75EF418982D RootDatabase.close DEBUG Closing DB SimplePoolFile3.root diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref index eb18e862a1a9d2745bcd15a5da90bec950416773..b363125722d251860157fe8012eb7f1d1bf249df 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref @@ -230,9 +230,10 @@ MetaDataHdrForm... DEBUG attributes# = 1 MetaDataHdrForm... DEBUG Branch container 'DataHeaderForm' MetaDataHdrForm... DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" MetaDataSvc DEBUG handle() EndInputFile for eventless EmptyPoolFile.root MetaDataSvc DEBUG retireMetadataSource: eventless EmptyPoolFile.root +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" StorageSvc DEBUG Disconnect request for database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 PFN=EmptyPoolFile.root StorageSvc DEBUG Closing database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 RootDatabase.close DEBUG Closing DB EmptyPoolFile.root @@ -251,7 +252,7 @@ RootDatabase.se... DEBUG Using Tree cache. Size: 100000 Nevents to learn with: MetaDataSvc DEBUG handle() BeginInputFile for SimplePoolFile1.root MetaDataSvc DEBUG initInputMetaDataStore: file name SimplePoolFile1.root MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" EventSelector INFO skipping event 1 EventSelector INFO skipping event 2 EventSelector INFO skipping event 3 @@ -630,6 +631,7 @@ ReadData INFO Hit x = 2030.12 y = 46.5439 z = -1956.17 detector = Du AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 10 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 MetaDataSvc DEBUG retireMetadataSource: FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" StorageSvc DEBUG Disconnect request for database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 PFN=SimplePoolFile1.root StorageSvc DEBUG Closing database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 RootDatabase.close DEBUG Closing DB SimplePoolFile1.root @@ -693,7 +695,7 @@ MetaDataHdr(Dat... DEBUG attributes# = 1 MetaDataHdr(Dat... DEBUG Branch container 'DataHeader' MetaDataHdr(Dat... DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -701,6 +703,7 @@ MetaData(IOVMet... DEBUG Branch container 'IOVMetaDataContainer_p1__TagInfo' MetaData(IOVMet... DEBUG Opened container MetaData(IOVMetaDataContainer_p1//TagInfo) of type ROOT_Tree MetaDataSvc DEBUG handle() EndInputFile for eventless EmptyPoolFile.root MetaDataSvc DEBUG retireMetadataSource: eventless EmptyPoolFile.root +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" StorageSvc DEBUG Disconnect request for database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 PFN=EmptyPoolFile.root StorageSvc DEBUG Closing database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 RootDatabase.close DEBUG Closing DB EmptyPoolFile.root @@ -795,7 +798,7 @@ MetaDataHdrForm... DEBUG attributes# = 1 MetaDataHdrForm... DEBUG Branch container 'DataHeaderForm' MetaDataHdrForm... DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "73F77177-D136-9344-B64D-29693F68D6C2" SimplePoolFile2... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1263,6 +1266,7 @@ ReadData INFO Could not find ExampleHitContainer/MyHits AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 30 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:73F77177-D136-9344-B64D-29693F68D6C2 MetaDataSvc DEBUG retireMetadataSource: FID:73F77177-D136-9344-B64D-29693F68D6C2 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "73F77177-D136-9344-B64D-29693F68D6C2" StorageSvc DEBUG Disconnect request for database: FID=73F77177-D136-9344-B64D-29693F68D6C2 PFN=SimplePoolFile2.root StorageSvc DEBUG Closing database: FID=73F77177-D136-9344-B64D-29693F68D6C2 RootDatabase.close DEBUG Closing DB SimplePoolFile2.root @@ -1361,7 +1365,7 @@ MetaDataHdrForm... DEBUG attributes# = 1 MetaDataHdrForm... DEBUG Branch container 'DataHeaderForm' MetaDataHdrForm... DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "A811B014-0297-AD47-AF4C-B75EF418982D" SimplePoolFile3... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1954,6 +1958,7 @@ ReadData INFO Could not find ExampleHitContainer/MyHits AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 50 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:A811B014-0297-AD47-AF4C-B75EF418982D MetaDataSvc DEBUG retireMetadataSource: FID:A811B014-0297-AD47-AF4C-B75EF418982D +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "A811B014-0297-AD47-AF4C-B75EF418982D" StorageSvc DEBUG Disconnect request for database: FID=A811B014-0297-AD47-AF4C-B75EF418982D PFN=SimplePoolFile3.root StorageSvc DEBUG Closing database: FID=A811B014-0297-AD47-AF4C-B75EF418982D RootDatabase.close DEBUG Closing DB SimplePoolFile3.root diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref index 7eed833ee71e84bccaac48eac014e3e8c7d2aa17..1525756c4a7539dd95b3d498d912ecc6730d28d2 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref @@ -258,9 +258,10 @@ MetaDataHdrForm... DEBUG attributes# = 1 MetaDataHdrForm... DEBUG Branch container 'DataHeaderForm' MetaDataHdrForm... DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" MetaDataSvc DEBUG handle() EndInputFile for eventless EmptyPoolFile.root MetaDataSvc DEBUG retireMetadataSource: eventless EmptyPoolFile.root +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" StorageSvc DEBUG Disconnect request for database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 PFN=EmptyPoolFile.root StorageSvc DEBUG Closing database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 RootDatabase.close DEBUG Closing DB EmptyPoolFile.root @@ -279,7 +280,7 @@ RootDatabase.se... DEBUG Using Tree cache. Size: 100000 Nevents to learn with: MetaDataSvc DEBUG handle() BeginInputFile for SimplePoolReplica1.root MetaDataSvc DEBUG initInputMetaDataStore: file name SimplePoolReplica1.root MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "095498FF-E805-B142-9948-BD2D4AC79975" EventSelector INFO skipping event 1 EventSelector INFO skipping event 2 EventSelector INFO skipping event 3 @@ -658,6 +659,7 @@ ReadData INFO Hit x = 2030.12 y = 46.5439 z = -1956.17 detector = Du AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 10 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:095498FF-E805-B142-9948-BD2D4AC79975 MetaDataSvc DEBUG retireMetadataSource: FID:095498FF-E805-B142-9948-BD2D4AC79975 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "095498FF-E805-B142-9948-BD2D4AC79975" StorageSvc DEBUG Disconnect request for database: FID=095498FF-E805-B142-9948-BD2D4AC79975 PFN=SimplePoolReplica1.root StorageSvc DEBUG Closing database: FID=095498FF-E805-B142-9948-BD2D4AC79975 RootDatabase.close DEBUG Closing DB SimplePoolReplica1.root @@ -721,7 +723,7 @@ MetaDataHdr(Dat... DEBUG attributes# = 1 MetaDataHdr(Dat... DEBUG Branch container 'DataHeader' MetaDataHdr(Dat... DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -729,6 +731,7 @@ MetaData(IOVMet... DEBUG Branch container 'IOVMetaDataContainer_p1__TagInfo' MetaData(IOVMet... DEBUG Opened container MetaData(IOVMetaDataContainer_p1//TagInfo) of type ROOT_Tree MetaDataSvc DEBUG handle() EndInputFile for eventless EmptyPoolFile.root MetaDataSvc DEBUG retireMetadataSource: eventless EmptyPoolFile.root +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" StorageSvc DEBUG Disconnect request for database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 PFN=EmptyPoolFile.root StorageSvc DEBUG Closing database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 RootDatabase.close DEBUG Closing DB EmptyPoolFile.root @@ -823,7 +826,7 @@ MetaDataHdrForm... DEBUG attributes# = 1 MetaDataHdrForm... DEBUG Branch container 'DataHeaderForm' MetaDataHdrForm... DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "73F77177-D136-9344-B64D-29693F68D6C2" SimplePoolFile2... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1291,6 +1294,7 @@ ReadData INFO Could not find ExampleHitContainer/MyHits AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 30 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:73F77177-D136-9344-B64D-29693F68D6C2 MetaDataSvc DEBUG retireMetadataSource: FID:73F77177-D136-9344-B64D-29693F68D6C2 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "73F77177-D136-9344-B64D-29693F68D6C2" StorageSvc DEBUG Disconnect request for database: FID=73F77177-D136-9344-B64D-29693F68D6C2 PFN=SimplePoolFile2.root StorageSvc DEBUG Closing database: FID=73F77177-D136-9344-B64D-29693F68D6C2 RootDatabase.close DEBUG Closing DB SimplePoolFile2.root @@ -1389,7 +1393,7 @@ MetaDataHdrForm... DEBUG attributes# = 1 MetaDataHdrForm... DEBUG Branch container 'DataHeaderForm' MetaDataHdrForm... DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "298DE14D-49CF-674A-9171-CEBBD9BEC6F8" SimplePoolFile4... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -2002,6 +2006,7 @@ ReadData INFO Could not find ExampleHitContainer/MyHits AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 50 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:298DE14D-49CF-674A-9171-CEBBD9BEC6F8 MetaDataSvc DEBUG retireMetadataSource: FID:298DE14D-49CF-674A-9171-CEBBD9BEC6F8 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "298DE14D-49CF-674A-9171-CEBBD9BEC6F8" StorageSvc DEBUG Disconnect request for database: FID=298DE14D-49CF-674A-9171-CEBBD9BEC6F8 PFN=SimplePoolFile4.root StorageSvc DEBUG Closing database: FID=298DE14D-49CF-674A-9171-CEBBD9BEC6F8 RootDatabase.close DEBUG Closing DB SimplePoolFile4.root diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref index 21c53a1b27ca7944dadd14073e7d81f59e537854..a19e4ef7901ee6ce834a3d35f78351171cd9b22f 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref @@ -254,9 +254,10 @@ MetaDataHdrForm... DEBUG attributes# = 1 MetaDataHdrForm... DEBUG Branch container 'DataHeaderForm' MetaDataHdrForm... DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" MetaDataSvc DEBUG handle() EndInputFile for eventless EmptyPoolFile.root MetaDataSvc DEBUG retireMetadataSource: eventless EmptyPoolFile.root +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" StorageSvc DEBUG Disconnect request for database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 PFN=EmptyPoolFile.root StorageSvc DEBUG Closing database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 RootDatabase.close DEBUG Closing DB EmptyPoolFile.root @@ -275,7 +276,7 @@ RootDatabase.se... DEBUG Using Tree cache. Size: 100000 Nevents to learn with: MetaDataSvc DEBUG handle() BeginInputFile for SimplePoolFile1.root MetaDataSvc DEBUG initInputMetaDataStore: file name SimplePoolFile1.root MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" EventSelector INFO skipping event 1 EventSelector INFO skipping event 2 EventSelector INFO skipping event 3 @@ -649,6 +650,7 @@ ReadData INFO Hit x = 2030.12 y = 46.5439 z = -1956.17 detector = Du AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 10 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 MetaDataSvc DEBUG retireMetadataSource: FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" StorageSvc DEBUG Disconnect request for database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 PFN=SimplePoolFile1.root StorageSvc DEBUG Closing database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 RootDatabase.close DEBUG Closing DB SimplePoolFile1.root @@ -712,7 +714,7 @@ MetaDataHdr(Dat... DEBUG attributes# = 1 MetaDataHdr(Dat... DEBUG Branch container 'DataHeader' MetaDataHdr(Dat... DEBUG Opened container MetaDataHdr(DataHeader) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -720,6 +722,7 @@ MetaData(IOVMet... DEBUG Branch container 'IOVMetaDataContainer_p1__TagInfo' MetaData(IOVMet... DEBUG Opened container MetaData(IOVMetaDataContainer_p1//TagInfo) of type ROOT_Tree MetaDataSvc DEBUG handle() EndInputFile for eventless EmptyPoolFile.root MetaDataSvc DEBUG retireMetadataSource: eventless EmptyPoolFile.root +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "" StorageSvc DEBUG Disconnect request for database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 PFN=EmptyPoolFile.root StorageSvc DEBUG Closing database: FID=C7040C30-3363-7D42-B1B7-E3F3B1881030 RootDatabase.close DEBUG Closing DB EmptyPoolFile.root @@ -814,7 +817,7 @@ MetaDataHdrForm... DEBUG attributes# = 1 MetaDataHdrForm... DEBUG Branch container 'DataHeaderForm' MetaDataHdrForm... DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "73F77177-D136-9344-B64D-29693F68D6C2" SimplePoolFile2... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1282,6 +1285,7 @@ ReadData INFO Could not find ExampleHitContainer/MyHits AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 30 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:73F77177-D136-9344-B64D-29693F68D6C2 MetaDataSvc DEBUG retireMetadataSource: FID:73F77177-D136-9344-B64D-29693F68D6C2 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "73F77177-D136-9344-B64D-29693F68D6C2" StorageSvc DEBUG Disconnect request for database: FID=73F77177-D136-9344-B64D-29693F68D6C2 PFN=SimplePoolFile2.root StorageSvc DEBUG Closing database: FID=73F77177-D136-9344-B64D-29693F68D6C2 RootDatabase.close DEBUG Closing DB SimplePoolFile2.root @@ -1404,7 +1408,7 @@ MetaDataHdrForm... DEBUG attributes# = 1 MetaDataHdrForm... DEBUG Branch container 'DataHeaderForm' MetaDataHdrForm... DEBUG Opened container MetaDataHdrForm(DataHeaderForm) of type ROOT_Tree MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "A811B014-0297-AD47-AF4C-B75EF418982D" SimplePoolFile3... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1992,6 +1996,7 @@ ReadData INFO Could not find ExampleHitContainer/MyHits AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 50 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:A811B014-0297-AD47-AF4C-B75EF418982D MetaDataSvc DEBUG retireMetadataSource: FID:A811B014-0297-AD47-AF4C-B75EF418982D +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "A811B014-0297-AD47-AF4C-B75EF418982D" StorageSvc DEBUG Disconnect request for database: FID=A811B014-0297-AD47-AF4C-B75EF418982D PFN=SimplePoolFile3.root StorageSvc DEBUG Closing database: FID=A811B014-0297-AD47-AF4C-B75EF418982D RootDatabase.close DEBUG Closing DB SimplePoolFile3.root diff --git a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref index f8089c27e1f5c934f254f11e7901999448d2dbb1..597064312f425a47ca0f5564c937e82501c83ac2 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_WCond.ref @@ -148,7 +148,7 @@ RootDatabase.se... DEBUG Using Tree cache. Size: -1 Nevents to learn with: -1 MetaDataSvc DEBUG handle() BeginInputFile for SimplePoolFile1.root MetaDataSvc DEBUG initInputMetaDataStore: file name SimplePoolFile1.root MetaDataSvc DEBUG Loaded input meta data store proxies -MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" EventSelector DEBUG Get AttributeList from the collection EventSelector DEBUG AttributeList size 12 EventSelector DEBUG record AthenaAttribute, name = Token = [DB=F2313678-C96A-964F-89E8-08BAB39F2DA7][CNT=POOLContainer(DataHeader)][CLID=4DDBD295-EFCE-472A-9EC8-15CD35A9EB8D][TECH=00000203][OID=00000005-00000000]. @@ -1092,6 +1092,7 @@ WriteCond INFO registered all data AthenaEventLoopMgr INFO ===>>> done processing event #20, run #1 20 events processed so far <<<=== MetaDataSvc DEBUG handle() EndInputFile for FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 MetaDataSvc DEBUG retireMetadataSource: FID:F2313678-C96A-964F-89E8-08BAB39F2DA7 +MetaDataSvc DEBUG calling endInputFile on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" StorageSvc DEBUG Disconnect request for database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 PFN=SimplePoolFile1.root StorageSvc DEBUG Closing database: FID=F2313678-C96A-964F-89E8-08BAB39F2DA7 RootDatabase.close DEBUG Closing DB SimplePoolFile1.root diff --git a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx index ec5a332c2aa88b97d144ac2a6ace8ff328b81385..b73ffc6409e2813484d061c6ee921dedc66c9554 100644 --- a/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx +++ b/Database/AthenaPOOL/EventSelectorAthenaPool/src/EventSelectorAthenaPool.cxx @@ -360,7 +360,7 @@ StatusCode EventSelectorAthenaPool::reinit() const { // Check if File is BS, for which Incident is thrown by SingleEventInputSvc if (tech != 0x00001000 && m_processMetadata.value() && !m_firedIncident) { - FileIncident firstInputFileIncident(name(), "FirstInputFile", "FID:" + fid, "FID:" + fid); + FileIncident firstInputFileIncident(name(), "FirstInputFile", "FID:" + fid, fid); m_incidentSvc->fireIncident(firstInputFileIncident); m_firedIncident = true; } @@ -704,13 +704,13 @@ StatusCode EventSelectorAthenaPool::nextHandleFileTransition(IEvtSelector::Conte return(StatusCode::FAILURE); } if (m_processMetadata.value()) { - FileIncident beginInputFileIncident(name(), "BeginInputFile", *m_inputCollectionsIterator, "FID:" + m_guid.toString()); + FileIncident beginInputFileIncident(name(), "BeginInputFile", *m_inputCollectionsIterator, m_guid.toString()); m_incidentSvc->fireIncident(beginInputFileIncident); } } else { // Check if File is BS if (tech != 0x00001000 && m_processMetadata.value()) { - FileIncident beginInputFileIncident(name(), "BeginInputFile", "FID:" + m_guid.toString()); + FileIncident beginInputFileIncident(name(), "BeginInputFile", "FID:" + m_guid.toString(), m_guid.toString()); m_incidentSvc->fireIncident(beginInputFileIncident); } } diff --git a/Database/EventIndex/EventIndexProducer/CMakeLists.txt b/Database/EventIndex/EventIndexProducer/CMakeLists.txt index 23fd4afbea1b6cb4e205c83df32d2824a7d44c3b..74283a13c90791508cc0c149ed6e5bd1670ed526 100644 --- a/Database/EventIndex/EventIndexProducer/CMakeLists.txt +++ b/Database/EventIndex/EventIndexProducer/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( EventIndexProducer ) @@ -52,19 +52,19 @@ atlas_install_runtime( scripts/*.py ) atlas_add_test( AODEventPicking_run2_data SCRIPT test/AODEventPicking_run2_data.sh "${CMAKE_CURRENT_SOURCE_DIR}" LOG_SELECT_PATTERN "^[0-9]+ [0-9]+$" - PROPERTIES TIMEOUT 600 ) + PROPERTIES TIMEOUT 900 ) atlas_add_test( AODEventPicking_run2_mc SCRIPT test/AODEventPicking_run2_mc.sh "${CMAKE_CURRENT_SOURCE_DIR}" LOG_SELECT_PATTERN "^[0-9]+ [0-9]+$" - PROPERTIES TIMEOUT 600 ) + PROPERTIES TIMEOUT 900 ) atlas_add_test( AODEventPicking_run3_data SCRIPT test/AODEventPicking_run3_data.sh "${CMAKE_CURRENT_SOURCE_DIR}" LOG_SELECT_PATTERN "^[0-9]+ [0-9]+$" - PROPERTIES TIMEOUT 600 ) + PROPERTIES TIMEOUT 900 ) atlas_add_test( AODEventPicking_run3_mc SCRIPT test/AODEventPicking_run3_mc.sh "${CMAKE_CURRENT_SOURCE_DIR}" LOG_SELECT_PATTERN "^[0-9]+ [0-9]+$" - PROPERTIES TIMEOUT 600 ) + PROPERTIES TIMEOUT 900 ) diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py index c79d96c594464e6f4c4dced2e0a9c0a2f663369e..89e655bab7adf9e8c56fdcbe531aecba58e0629e 100644 --- a/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py +++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py @@ -7,6 +7,9 @@ from AthenaCommon import Logging def GeoModelCfg(flags): + if not flags.GeoModel.AtlasVersion: + raise ValueError('No geometry tag specified') + from PyUtils.Helpers import release_metadata rel_metadata = release_metadata() relversion = rel_metadata['release'].split('.') diff --git a/DetectorDescription/GeoPrimitives/GeoPrimitives/GeoPrimitivesToStringConverter.h b/DetectorDescription/GeoPrimitives/GeoPrimitives/GeoPrimitivesToStringConverter.h index 0edd643fa9f70bcb58940d39f545295ad92dd199..e751aa126ae7a801de6d55a4e809332effd1b289 100644 --- a/DetectorDescription/GeoPrimitives/GeoPrimitives/GeoPrimitivesToStringConverter.h +++ b/DetectorDescription/GeoPrimitives/GeoPrimitives/GeoPrimitivesToStringConverter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -43,7 +43,7 @@ namespace Amg { } - inline std::string toString( const Transform3D& transform, int precision = 4, const std::string rotOffSet = "") { + inline std::string toString( const Transform3D& transform, int precision = 4, const std::string& rotOffSet = "") { std::stringstream sstr{}; bool printed{false}; if (transform.translation().mag() > std::numeric_limits<float>::epsilon()) { diff --git a/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.cxx b/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.cxx index 442978ac3603d2af45cc0cfbce4c5640cace3a1e..cc7492c71bca2193f842213d37ea58cf5ca63402 100644 --- a/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.cxx +++ b/Event/DumpEventDataToJSON/src/DumpEventDataToJsonAlg.cxx @@ -73,7 +73,7 @@ StatusCode DumpEventDataToJsonAlg::initialize() { // Specialisation for TrackProxy // TODO understand why this is not matching: ActsTrk::TrackContainer::TrackProxy template <> -nlohmann::json DumpEventDataToJsonAlg::getData(const Acts::TrackProxy<ActsTrk::TrackStorageContainer, ActsTrk::MultiTrajectory, ActsTrk::DataLinkHolder, true> &track) { +nlohmann::json DumpEventDataToJsonAlg::getData(const Acts::TrackProxy<ActsTrk::TrackSummaryContainer, ActsTrk::MultiTrajectory, ActsTrk::DataLinkHolder, true> &track) { nlohmann::json data; Acts::GeometryContext gctx = m_trackingGeometryTool->getGeometryContext(getContext()).context(); diff --git a/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx b/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx index 09bcb380ac18ecfd0a01dec26e0f1e3fddf586f7..b0b699ee626e0225143d024421581d026fb53e3c 100644 --- a/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx +++ b/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx @@ -234,6 +234,13 @@ StatusCode BookkeeperTool::copyInputContainersToOutput(CutBookkeepersLocalCache { CutBookkeepersLocalCache::prepareContainers(target, m_numberOfWeightVariations); + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG("Available sources:"); + for (const auto &[sourceID, list] : m_inputContainers) { + ATH_MSG_DEBUG(" " << sourceID); + } + } + if (!source.empty()) { auto it = m_inputContainers.find(source); if (it == m_inputContainers.end()) { diff --git a/Event/xAOD/xAODTrigger/Root/TrigDecision_v1.cxx b/Event/xAOD/xAODTrigger/Root/TrigDecision_v1.cxx index 597f240b61cacabebb708ee5502534854a48c02c..69425e6759beb066a74a764d8641050d9c10731a 100644 --- a/Event/xAOD/xAODTrigger/Root/TrigDecision_v1.cxx +++ b/Event/xAOD/xAODTrigger/Root/TrigDecision_v1.cxx @@ -99,7 +99,7 @@ void writeBits(std::ostream& s, const std::vector< uint32_t >& input) { const size_t bits = CHAR_BIT * sizeof( entry ); // This is expected to be 32 bits per entry in the vector for (size_t bit = 0; bit < bits; ++bit) { // Examine a single bit and, if 1, print its numeric position within the vector of uint32's. - if (entry & (1 << bit)) s << ((bits * i) + bit) << " "; + if (entry & (1ul << bit)) s << ((bits * i) + bit) << " "; } } s << std::endl; diff --git a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_VertexReco/src/AFP_VertexRecoBasic.cxx b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_VertexReco/src/AFP_VertexRecoBasic.cxx index 877429a490d3002ad2416b0ed13e4efcde1430bb..ca9c9d3b60a36c38f2607aa4656046a02d564e00 100644 --- a/ForwardDetectors/AFP/AFP_Reconstruction/AFP_VertexReco/src/AFP_VertexRecoBasic.cxx +++ b/ForwardDetectors/AFP/AFP_Reconstruction/AFP_VertexReco/src/AFP_VertexRecoBasic.cxx @@ -213,7 +213,7 @@ xAOD::AFPVertex * AFP_VertexRecoBasic::reco(const double distA, const double dis double timeC = tofTrackSideC->trainTime() - (TVP_C.timeOffset(trainID)+TVP_C.timeSlope(trainID)*protonYPositionFar); - double position = (timeC-timeA)/2.*0.299792458 - (TVP_C.timeGlobalOffset()-TVP_A.timeGlobalOffset()); + double position = ( (timeC*1000.-TVP_C.timeGlobalOffset()) - (timeA*1000.-TVP_A.timeGlobalOffset()))/2.*0.299792458 ; return createVertex(position, distA, distC, outputContainer); } diff --git a/Generators/Pythia8_i/README.md b/Generators/Pythia8_i/README.md index b507fa36a7a325a343b0e7a16cb55b825225b99f..c1a9671b0c7fd96d4d2f0e51d84d5024d7afecff 100644 --- a/Generators/Pythia8_i/README.md +++ b/Generators/Pythia8_i/README.md @@ -163,3 +163,86 @@ In addition to the Athena interface, James Monk has written a standalone package that steers Pythia 8 without needing Athena, and provides Photos++, LHAPDF, LHEF and HepMC interfaces and can be more easily steered from the command line. The package is available from the AGILe project on HepForge: https://agile.hepforge.org/ + +# Getting Differential Distribution Rates ( DJRs ) from CKKWL + +In this tutorial, we will outline the procedures for extracting the internally computed DJRs from Pythia8, employing the mergingDJRs.cxx UserHook. We will focus on a straightforward scenario and utilize the Madgraph generator, although any other matrix element generator can be employed. Specifically, we will examine the production of a Z boson with 1-jet multiplicity. + +This tutorial is the result of the following Qualification Task: + +https://its.cern.ch/jira/browse/AGENE-2069 + +# Introduction + +Parton showers (PS) are suitable in soft/collinear parton emissions regions, while they fail with hard and well-separated regions. +The latter are well modeled only by matrix elements (ME). We will have the hard jet of the process from the Matrix element generator whil the soft jets should be modelled by emissions generated by Pythia8. +Consistently merging processes helps eliminate duplicate counts and overlaps between hard and soft partons by introducing a merging scale. One way to validate this approach is by directly extracting the N+1 → N jet clustering scales, also known as the Differential Jet Rates (DJRs), from Pythia8. + +For more information about the CKKWL merging scheme, please check the following link: +https://pythia.org/latest-manual/CKKWLMerging.html + +# The steps to use the UserHook and activate the merging procedure: + +1) Create multiple JOs depending on the jet multiplicity of your hard process. +2) Start generating jet multiplicity and the merged sample such as: + + a) Generate Seperated JOs for each jet multiplicity: + +``` + p p > z @0 + + p p > z j @1 + + p p > z j j @2 +``` + + b) generate a sample for the merged process such as: + +``` + generate p p > z + add process p p > z j + add process p p > z j j +``` + +2) Add to your JO the fragment code which activates the merging procedure and configures all the essential settings for the merging process, such as: + +``` +PYTHIA8_nJetMax=2 +PYTHIA8_Process='pp>e-e+' +PYTHIA8_Dparameter=0.4 +PYTHIA8_TMS=30.0 +PYTHIA8_nQuarksMerge=4 + +include("Pythia8_i/Pythia8_CKKWL_kTMerge.py") +``` + +3) Include the fragment code responsible for computing the DJRs: + +``` +include("Pythia8_i/Pythia8_mergingDJRs.py") +``` + +4) You run the JO with Gen_tf.py. + +5) The output will be a ROOT file called `hist-DJR.root` that contains histograms fro the first and second DJR. The user then should stack the plots for the different jet multiplicity and the merged sample manually. + +# How to know the merging is working ? + +**1) Make sure that the merging is activate:** + + If all the parameters are properly configured, especially with `Merging:doKTMerging = on ` the merging process should be operational. Consequently, you can verify this by examining your log file, where you should find `MEPS Merging Initialization ` printout that contains the configurations you have specified. + +**2) The merging scale choice:** + + One crucial configuration in the CKKWL merging scheme is known as `the merging scale`, which can be specified through the `Merging:TMS` setting. This parameter serves as a threshold for the jet multiplicities included in our process. + Its selection should be linked to the process's hard scale, such as the mass of the produced particles, HT cut etc. The threshold is ideally chosen within a range of `~ 1/6 to 1/3 of the hard scale`. We systematically vary the scale within this range and assess the results based on the DJRs plot to determine the optimal setting. + For the SUSY process, it is advisable to utilize the mass of the final particles as the preferred hard scale. + +**3) Analyzing the DJRs Plots:** + + The interpretation of DJRs plots is pivotal in determining the effectiveness of the chosen merging scale. Several key observations can guide the user in assessing the suitability of the merging scale: + - The DJRs histograms should be continuous. + - The combined jet-multiplicity samples' sum should align with the merged sample. + - In the initial DJR, there should be a clear distinction between the 0-jet sample and the 1-jet sample. Similarly, in the second DJR, the separation between the 1-jet sample and the 2-jet sample should be evident. A more distinct separation indicates a better choice of the merging scale. + - The point where the 1-jet sample becomes dominant and the 0-jet multiplicity reaches zero signifies the initiation of the merging scale. The higher the value for our merging scale is, the greater the corresponding value of DJR at this juncture should be. + - In the case of the first DJR, when dealing with small DJR values, the 0-jet multiplicity should closely resemble the merged sample. As DJR values increase, the 1-jet multiplicity should approximately match the merged sample. diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt index 7a465d0ba9e12c9f05fa569528239d150a7d4c25..9336481fc566e6483cbb9554de48aedb63acc983 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/CMakeLists.txt @@ -12,7 +12,7 @@ atlas_add_component( InDetAlignGenAlgs src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers AthenaBaseComps GeoPrimitives Identifier EventPrimitives xAODEventInfo GaudiKernel StoreGateLib TRT_ConditionsServicesLib TrkParameters TrkFitterUtils AthenaKernel AtlasDetDescr DetDescrConditions IdDictDetDescr InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces InDetAlignGenToolsLib RegistrationServicesLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthContainers AthenaBaseComps GeoPrimitives Identifier EventPrimitives xAODEventInfo GaudiKernel StoreGateLib TRT_ConditionsServicesLib TrkParameters TrkFitterUtils AthenaKernel AtlasDetDescr DetDescrConditions IdDictDetDescr SCT_ReadoutGeometry InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetPrepRawData InDetRIO_OnTrack TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces InDetAlignGenToolsLib RegistrationServicesLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx index f983ab53710b446c3f0f413792ce49fc8f4ae4db..be6683de1fa30c7bbdadb822c08afde2d1fcf029 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx @@ -44,6 +44,10 @@ + +#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" + + namespace{ std::string commonAlignmentOutput(const HepGeom::Transform3D & initialAlignment){ std::ostringstream os; @@ -180,9 +184,12 @@ namespace InDetAlignment ATH_CHECK( nt->addItem("LayerDisc" ,m_AlignResults_Identifier_LayerDisc) ); ATH_CHECK( nt->addItem("Phi" ,m_AlignResults_Identifier_Phi) ); ATH_CHECK( nt->addItem("Eta" ,m_AlignResults_Identifier_Eta) ); - ATH_CHECK( nt->addItem("center_x" ,m_AlignResults_center_x) ); - ATH_CHECK( nt->addItem("center_y" ,m_AlignResults_center_y) ); - ATH_CHECK( nt->addItem("center_z" ,m_AlignResults_center_z) ); + ATH_CHECK( nt->addItem("center_x" ,m_Initial_center_x ) ); + ATH_CHECK( nt->addItem("center_y" ,m_Initial_center_y ) ); + ATH_CHECK( nt->addItem("center_z" ,m_Initial_center_z ) ); + ATH_CHECK( nt->addItem("misaligned_global_x" ,m_Global_center_x ) ); + ATH_CHECK( nt->addItem("misaligned_global_y" ,m_Global_center_y ) ); + ATH_CHECK( nt->addItem("misaligned_global_z" ,m_Global_center_z ) ); } else { // did not manage to book the N tuple.... msg(MSG::ERROR) << "Failed to book InitialAlignment ntuple." << endmsg; } @@ -622,7 +629,8 @@ namespace InDetAlignment } else if (m_MisalignmentMode == 2) { - // randomly misalign modules at L3 + + // randomly misalign modules at L3 Rndm::Numbers RandMisX(randsvc, Rndm::Gauss(m_Misalign_x,m_RndmMisalignWidth_x*ScaleFactor)); Rndm::Numbers RandMisY(randsvc, Rndm::Gauss(m_Misalign_y,m_RndmMisalignWidth_y*ScaleFactor)); Rndm::Numbers RandMisZ(randsvc, Rndm::Gauss(m_Misalign_z,m_RndmMisalignWidth_z*ScaleFactor)); @@ -889,7 +897,7 @@ namespace InDetAlignment double alpha, beta, gamma; m_IDAlignDBTool->extractAlphaBetaGamma(alignmentTrafoAmg, alpha, beta, gamma); - + m_AlignResults_x = alignmentTrafo.getTranslation().x(); m_AlignResults_y = alignmentTrafo.getTranslation().y(); m_AlignResults_z = alignmentTrafo.getTranslation().z(); @@ -897,11 +905,53 @@ namespace InDetAlignment m_AlignResults_beta = beta; m_AlignResults_gamma = gamma; - m_AlignResults_center_x = center.x(); - m_AlignResults_center_y = center.y(); - m_AlignResults_center_z = center.z(); - - if (m_idHelper->is_sct(ModuleID)) { + + HepGeom::Transform3D LocalaGlobal = HepGeom::Transform3D(); + LocalaGlobal = Amg::EigenTransformToCLHEP(SiModule->moduleTransform()); + HepGeom::Point3D<double> alignedPosLocal(m_AlignResults_x,m_AlignResults_y,m_AlignResults_z); + + + + + m_Initial_center_x = center.x() ; + m_Initial_center_y = center.y() ; + m_Initial_center_z = center.z() ; + + HepGeom::Point3D<double> alignedPosGlobal = LocalaGlobal * alignedPosLocal; + + // Global Misalignment HERE + if (m_idHelper->is_sct(ModuleID)) { + // non-zero local center position gives additional radial shift of SCT endcap + const InDetDD::StripStereoAnnulusDesign *p_design_check = dynamic_cast<const InDetDD::StripStereoAnnulusDesign*>(&(SiModule->design())); + if (p_design_check){ + Amg::Vector3D SCT_Center = p_design_check->sensorCenter(); + double radialShift_x = SCT_Center[0]; // in sensor frame, x direction + double radialShift_y = SCT_Center[1]; // in sensor frame, y direction + HepGeom::Transform3D radial_shift = HepGeom::Translate3D(radialShift_x,radialShift_y,0); // the additional radial shift applied as translation + HepGeom::Transform3D LocalaaGlobal = LocalaGlobal * radial_shift; // apply additional radial shift + HepGeom::Point3D<double> SCT_endcap_alignedPosGlobal = LocalaaGlobal * alignedPosLocal; // corrected global transformation + m_Global_center_x = SCT_endcap_alignedPosGlobal.x(); + m_Global_center_z = SCT_endcap_alignedPosGlobal.z(); + m_Global_center_y = SCT_endcap_alignedPosGlobal.y(); + } + + else { // no additional radial shift for SCT barrel + m_Global_center_x = alignedPosGlobal.x(); + m_Global_center_y = alignedPosGlobal.y(); + m_Global_center_z = alignedPosGlobal.z(); + + } + + } + + else { // no additional radial shift for non-SCT elements + m_Global_center_x = alignedPosGlobal.x(); + m_Global_center_y = alignedPosGlobal.y(); + m_Global_center_z = alignedPosGlobal.z(); + } + + + if (m_idHelper->is_sct(ModuleID)) { m_AlignResults_Identifier_ID = 2; m_AlignResults_Identifier_PixelSCT = 2; m_AlignResults_Identifier_BarrelEC = m_sctIdHelper->barrel_ec(ModuleID); diff --git a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h index dd6735c084320b8cbe06baeaeeaa1579974fb330..3ba6ae92dd4d29ecf46eeb6b72bf0dc00e767931 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h @@ -125,9 +125,14 @@ private: NTuple::Item<long> m_AlignResults_Identifier_Phi; //!< ID information for this module NTuple::Item<long> m_AlignResults_Identifier_Eta; //!< ID information for this module - NTuple::Item<double> m_AlignResults_center_x; //!< Initial global center of module - NTuple::Item<double> m_AlignResults_center_y; //!< Initial global center of module - NTuple::Item<double> m_AlignResults_center_z; //!< Initial global center of module + NTuple::Item<double> m_Initial_center_x; //!< Initial global center of module + NTuple::Item<double> m_Initial_center_y; //!< Initial global center of module + NTuple::Item<double> m_Initial_center_z; //!< Initial global center of module + + + NTuple::Item<double> m_Global_center_x; //!< Misaligned global center of module + NTuple::Item<double> m_Global_center_y; //!< Misaligned global center of module + NTuple::Item<double> m_Global_center_z; //!< Misaligned global center of module // Member Functions diff --git a/InnerDetector/InDetDetDescr/PixelReadoutGeometry/src/PixelDetectorManager.cxx b/InnerDetector/InDetDetDescr/PixelReadoutGeometry/src/PixelDetectorManager.cxx index 514bd6c0031fd75ac884ced8cae74335558733f9..1a6bca84688bb1871790d12a8cfcad6ea1e55061 100755 --- a/InnerDetector/InDetDetDescr/PixelReadoutGeometry/src/PixelDetectorManager.cxx +++ b/InnerDetector/InDetDetDescr/PixelReadoutGeometry/src/PixelDetectorManager.cxx @@ -586,6 +586,10 @@ namespace InDetDD { return alignmentChange; } } + // Avoid cppcheck warning. + if (!atrlistcol) { + return alignmentChange; + } { // loop over objects in collection //cppcheck-suppress nullPointerRedundantCheck diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h index f08eb6efbc08fe24b41cc286aa4fbe7e9c4da2e2..d29c37ee6cafc207ab40ab42b5bda1aae15008e7 100755 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h @@ -208,7 +208,6 @@ private: const SCT_ModuleSideDesign * m_motherDesign{nullptr}; //if this design *is* a mother design, these are its children std::map<int, const SCT_ModuleSideDesign *> m_childDesigns; - }; /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripBoxDesign.h b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripBoxDesign.h index 2b3f034cc80ae6a818787b0adf1d4ecf0869980f..c30b4e978b960ab423fbeb7dced99263f74a6166 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripBoxDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripBoxDesign.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETREADOUTGEOMETRY_STRIPBOXDESIGN_H @@ -41,7 +41,8 @@ public: const int nStrips, const double pitch, const double length, - const double zShift=0.0); + InDetDD::DetectorType detectorType = InDetDD::Undefined, + const double zShift=0.0); ~StripBoxDesign() = default; @@ -54,90 +55,92 @@ public: // the more natural 2D (strip, row) identifier. The following methods convert 1D to 2D and v.v. // std::pair<int,int> getStripRow(SiCellId id) const final; - int strip1Dim(int strip, int row) const; + virtual int strip1Dim(int strip, int row) const override; int diodes() const; - int diodesInRow(const int row) const; + virtual int diodesInRow(const int row) const override; // // Pure virtual methods in base class: // // Distance to nearest detector active edge (+ve = inside, -ve = outside) - void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, - double &phiDist) const; + virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, + double &phiDist) const override; // check if the position is in active area - bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap = true) const; + virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap = true) const override; // Element boundary - const Trk::SurfaceBounds &bounds() const; + virtual const Trk::SurfaceBounds &bounds() const override; // Retrieve the two ends of a "strip" - std::pair<SiLocalPosition, SiLocalPosition> endsOfStrip( - const SiLocalPosition &position) const; + virtual std::pair<SiLocalPosition, SiLocalPosition> endsOfStrip( + const SiLocalPosition &position) const override; // Phi-pitch (strip-width). Two names for same thing - double stripPitch(const SiLocalPosition &localPosition) const; + virtual double stripPitch(const SiLocalPosition &localPosition) const override; double stripPitch(const SiCellId &cellId) const; - double stripPitch() const; - double phiPitch(const SiLocalPosition &localPosition) const; + virtual double stripPitch() const override; + virtual double phiPitch(const SiLocalPosition &localPosition) const override; double phiPitch(const SiCellId &cellId) const; - double phiPitch() const; + virtual double phiPitch() const override; // distance to the nearest diode in units of pitch, from 0.0 to 0.5, // this method should be fast as it is called for every surface charge // in the SCT_SurfaceChargesGenerator // an active area check, done in the Generator anyway, is removed here - double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const; + virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const override; // readout or diode id -> position, size - SiDiodesParameters parameters(const SiCellId &cellId) const; - SiLocalPosition localPositionOfCell(const SiCellId &cellId) const; - SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const; + virtual SiDiodesParameters parameters(const SiCellId &cellId) const override; + virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const override; + virtual SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const override; // position -> id - SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const; + virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const override; // id to position SiLocalPosition positionFromStrip(const SiCellId &cellId) const; - SiLocalPosition positionFromStrip(const int stripNumber) const; + virtual SiLocalPosition positionFromStrip(const int stripNumber) const override; // row and strip from 1-dim strip number - int row(int stripId1Dim) const; - int strip(int stripId1Dim) const; + virtual int row(int stripId1Dim) const override; + virtual int strip(int stripId1Dim) const override; // Find and fill a vector with all neighbour strips of a given cell - void neighboursOfCell(const SiCellId &cellId, - std::vector<SiCellId> &neighbours) const; - SiCellId cellIdInRange(const SiCellId &) const; + virtual void neighboursOfCell(const SiCellId &cellId, + std::vector<SiCellId> &neighbours) const override; + virtual SiCellId cellIdInRange(const SiCellId &) const override; // For Strip sensors, readout cell == diode cell. Overload the SCT_ModuleSideDesign // member - SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const; + virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const override; - const Amg::Transform3D moduleShift() const final; + virtual const Amg::Transform3D moduleShift() const override final; + + virtual InDetDD::DetectorType type() const override final; // --------------------------------------------------------------------------------------- // DEPRECATED at least for Strips - HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const; + virtual HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const override; // Method to calculate length of a strip. Which strip?? - double length() const; + virtual double length() const override; // Method to calculate average width of a module. What is it used for?? - double width() const; + virtual double width() const override; // Method to calculate minimum width of a module - double minWidth() const; + virtual double minWidth() const override; // Method to calculate maximum width of a module - double maxWidth() const; + virtual double maxWidth() const override; // Pitch in eta direction Deprecated for strips: it varies in endcap - double etaPitch() const; + virtual double etaPitch() const override; // Return true if hit local direction is the same as readout direction. - bool swapHitPhiReadoutDirection() const; - bool swapHitEtaReadoutDirection() const; + virtual bool swapHitPhiReadoutDirection() const override; + virtual bool swapHitEtaReadoutDirection() const override; - bool nearBondGap(const SiLocalPosition &, double) const; + virtual bool nearBondGap(const SiLocalPosition &, double) const override; // ------------------------------------------------------------------------------------------ @@ -148,9 +151,9 @@ public: double stripLength(const SiCellId &cellId) const; // Give upper and lower boundaries, and length, of dead area - double deadAreaUpperBoundary() const; - double deadAreaLowerBoundary() const; - double deadAreaLength() const; + virtual double deadAreaUpperBoundary() const override; + virtual double deadAreaLowerBoundary() const override; + virtual double deadAreaLength() const override; private: int m_nRows; int m_nStrips; @@ -218,6 +221,10 @@ inline int StripBoxDesign::strip(int stripId1Dim) const { return stripId1Dim % m_nStrips; } +inline InDetDD::DetectorType StripBoxDesign::type() const{ + return m_detectorType; +} + /// DEPRECATED for StripBoxDesign; no dead area double StripBoxDesign::deadAreaUpperBoundary() const { return 0.; diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripStereoAnnulusDesign.h b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripStereoAnnulusDesign.h index ff5554e4158adfe845a9171789f10c0c56cd1832..01c7322114bd0b7b8dd39b6457c1ccc97b3a657f 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripStereoAnnulusDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/StripStereoAnnulusDesign.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETREADOUTGEOMETRY_STRIPSTEREOANNULUSDESIGN_H @@ -61,7 +61,8 @@ public: const std::vector<double> &stripEnd, const double &stereoAngle, const double ¢reR, - const bool &usePC); + const bool &usePC, + InDetDD::DetectorType detectorType = InDetDD::Undefined); StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, const SiDetectorDesign::Axis &thicknessDirection, @@ -76,7 +77,8 @@ StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, const double &stereoAngle, const double ¢reR,//this is the centre radius for e.g. the local/global position const double &waferCentreR,//this is the centre radius needed for calculating the bounds, It is common to all elements on the same wafer/module/sensor (i.e. with a common MotherDesign) - const bool &usePC); + const bool &usePC, + InDetDD::DetectorType detectorType = InDetDD::Undefined); ~StripStereoAnnulusDesign() = default; @@ -88,39 +90,39 @@ StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, SiLocalPosition stripToBeamPC(const SiLocalPosition &pos) const; SiLocalPosition stripToBeamPCpolar(const SiLocalPosition &pos) const; - Amg::Vector3D sensorCenter() const; + virtual Amg::Vector3D sensorCenter() const override; // Copy constructor and assignment: StripStereoAnnulusDesign(const StripStereoAnnulusDesign &design); StripStereoAnnulusDesign &operator = (const StripStereoAnnulusDesign &design); std::pair<int,int> getStripRow(SiCellId cellId) const final; - int strip1Dim(int strip, int row) const; + virtual int strip1Dim(int strip, int row) const override; SiLocalPosition stripPosAtR(int strip, int row, double r) const; - int diodesInRow(const int row) const; + virtual int diodesInRow(const int row) const override; // // Pure virtual methods in base class: // // Distance to nearest detector active edge (+ve = inside, -ve = outside) - void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, - double &phiDist) const; + virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, + double &phiDist) const override; // check if the position is in active area - bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap = true) const; + virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap = true) const override; // Element boundary - const Trk::SurfaceBounds &bounds() const; + virtual const Trk::SurfaceBounds &bounds() const override; // Retrieve the two ends of a "strip" - std::pair<SiLocalPosition, SiLocalPosition> endsOfStrip( - const SiLocalPosition &position) const; + virtual std::pair<SiLocalPosition, SiLocalPosition> endsOfStrip( + const SiLocalPosition &position) const override; // Phi-pitch (strip-width). Two names for same thing - double stripPitch(const SiLocalPosition &localPosition) const; + virtual double stripPitch(const SiLocalPosition &localPosition) const override; double stripPitch(const SiCellId &cellId) const; - double stripPitch() const; - double phiPitch(const SiLocalPosition &localPosition) const; + virtual double stripPitch() const override; + virtual double phiPitch(const SiLocalPosition &localPosition) const override; double phiPitch(const SiCellId &cellId) const; - double phiPitch() const; + virtual double phiPitch() const override; // above methods return mm @@ -134,12 +136,12 @@ StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, // this method should be fast as it is called for every surface charge // in the SCT_SurfaceChargesGenerator // an active area check, done in the Generator anyway, is removed here - double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const; + virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const override; // readout or diode id -> position, size - SiDiodesParameters parameters(const SiCellId &cellId) const; - SiLocalPosition localPositionOfCell(const SiCellId &cellId) const; - SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const; + virtual SiDiodesParameters parameters(const SiCellId &cellId) const override; + virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const override; + virtual SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const override; // these return local position in STRIP PC // Use only if you work with the polar coordinates, in all other @@ -148,23 +150,23 @@ StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, SiLocalPosition localPositionOfClusterPC(const SiCellId &cellId, int clusterSize) const; // position -> id - SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const; + virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const override; // id to position SiLocalPosition positionFromStrip(const SiCellId &cellId) const; - SiLocalPosition positionFromStrip(const int stripNumber) const; + virtual SiLocalPosition positionFromStrip(const int stripNumber) const override; // row and strip from 1-dim strip number - int row(int stripId1Dim) const; - int strip(int stripId1Dim) const; + virtual int row(int stripId1Dim) const override; + virtual int strip(int stripId1Dim) const override; // Find and fill a vector with all neighbour strips of a given cell - void neighboursOfCell(const SiCellId &cellId, - std::vector<SiCellId> &neighbours) const; - SiCellId cellIdInRange(const SiCellId &) const; + virtual void neighboursOfCell(const SiCellId &cellId, + std::vector<SiCellId> &neighbours) const override; + virtual SiCellId cellIdInRange(const SiCellId &) const override; // For Strip sensors, readout cell == diode cell. Overload the SCT_ModuleSideDesign // member - SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const; + virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const override; //Returns the wafer centre Radius (needed for annulus shape) double waferCentreR() const; @@ -174,35 +176,37 @@ StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, //different for elements where each row is its own element double centreR() const; + InDetDD::DetectorType type() const override final; + // --------------------------------------------------------------------------------------- // DEPRECATED at least for Strips - HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const; + virtual HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const override; // Method to calculate length of a strip. Which strip?? - double length() const; + virtual double length() const override; // Method to calculate average width of a module. What is it used for?? - double width() const; + virtual double width() const override; // Method to calculate minimum width of a module - double minWidth() const; + virtual double minWidth() const override; // Method to calculate maximum width of a module - double maxWidth() const; + virtual double maxWidth() const override; // Pitch in eta direction Deprecated for strips: it varies in endcap - double etaPitch() const; + virtual double etaPitch() const override; // Return true if hit local direction is the same as readout direction. - bool swapHitPhiReadoutDirection() const; - bool swapHitEtaReadoutDirection() const; + virtual bool swapHitPhiReadoutDirection() const override; + virtual bool swapHitEtaReadoutDirection() const override; - bool nearBondGap(const SiLocalPosition &, double) const; + virtual bool nearBondGap(const SiLocalPosition &, double) const override; /** Shape of element */ - virtual DetectorShape shape() const; + virtual DetectorShape shape() const override; - double sinStripAngleReco(double phiCoord, double etaCoord) const; + virtual double sinStripAngleReco(double phiCoord, double etaCoord) const override; // ------------------------------------------------------------------------------------------ @@ -218,9 +222,9 @@ StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, double stereo() const; // Give upper and lower boundaries, and length, of dead area - double deadAreaUpperBoundary() const; - double deadAreaLowerBoundary() const; - double deadAreaLength() const; + virtual double deadAreaUpperBoundary() const override; + virtual double deadAreaLowerBoundary() const override; + virtual double deadAreaLength() const override; private: const int m_nRows; const std::vector<int> m_nStrips; @@ -363,6 +367,10 @@ inline double StripStereoAnnulusDesign::centreR() const { return m_R; } +inline InDetDD::DetectorType StripStereoAnnulusDesign::type() const{ + return m_detectorType; +} + /// DEPRECATED for StripStereoAnnulusDesign; no dead area inline double StripStereoAnnulusDesign::deadAreaUpperBoundary() const { return 0.; diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx index e89e793328753fd53ee2bf9fc2796b117efcaa01..412416a033464de6ead0e17d6b92e599dda79ba5 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx @@ -20,7 +20,8 @@ StripBoxDesign::StripBoxDesign(const SiDetectorDesign::Axis stripDirection, const int nStrips, const double pitch, const double length, - const double zShift) : + InDetDD::DetectorType detectorType, + const double zShift) : SCT_ModuleSideDesign(thickness, true, true, true, 1, nRows * nStrips, nRows * nStrips, 0, false, carrier,readoutSide, stripDirection, thicknessDirection) { if (nRows <= 0) { throw std::runtime_error( @@ -32,6 +33,7 @@ StripBoxDesign::StripBoxDesign(const SiDetectorDesign::Axis stripDirection, m_pitch = pitch; m_length = length; m_zShift = zShift; + m_detectorType = detectorType; double width = m_nStrips * m_pitch; double fullLength = m_nRows * m_length; diff --git a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx index 00b01b0fc39695b139515d2f1d9468d7b5099826..adce76d9580f7012353559eb5853d38743538cf2 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx @@ -25,7 +25,8 @@ StripStereoAnnulusDesign::StripStereoAnnulusDesign(const SiDetectorDesign::Axis const double &stereoAngle, const double ¢reR, const double &waferCentreR, - const bool &usePC) : + const bool &usePC, + InDetDD::DetectorType detectorType) : SCT_ModuleSideDesign(thickness, false, false, true, 1, 0, 0, 0, false, carrier, readoutSide, stripDirection, thicknessDirection), m_nRows(nRows), @@ -43,6 +44,9 @@ StripStereoAnnulusDesign::StripStereoAnnulusDesign(const SiDetectorDesign::Axis m_cosNegStereo(m_cosStereo), m_usePC(usePC) { + + m_detectorType = detectorType; + if (nRows < 0) { throw std::runtime_error( "ERROR: StripStereoAnnulusDesign called with negative number of rows"); @@ -114,9 +118,10 @@ StripStereoAnnulusDesign::StripStereoAnnulusDesign(const SiDetectorDesign::Axis const std::vector<double> &stripEndRadius, const double &stereoAngle, const double ¢reR, - const bool &usePC): + const bool &usePC, + InDetDD::DetectorType detectorType): StripStereoAnnulusDesign(stripDirection,thicknessDirection,thickness,readoutSide,carrier,nRows,nStrips, - pitch,stripStartRadius,stripEndRadius,stereoAngle,centreR,centreR,usePC){ + pitch,stripStartRadius,stripEndRadius,stereoAngle,centreR,centreR,usePC,detectorType){ //assuming here that centreR==waferCentreR } diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx index 41f505233a04cc3bb4bd6601ef577196f1697a72..51ac6d55fdc4866e5620ec9a59537fca057baeef 100644 --- a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx @@ -192,6 +192,16 @@ void StripGmxInterface::makeSiStripBox(const std::string &typeName, getParameter(typeName, parameters, "pitch", pitch); getParameter(typeName, parameters, "stripLength", length); + //At the moment, we'd only ever want StripBarrel for this detector type, so throw a WARNING if it differs + //However, in future this may be different, so implementing the functionality to set this anyway + InDetDD::DetectorType detectorType{InDetDD::StripBarrel}; + int detectorTypeEnum = 0; + if (checkParameter(typeName, parameters, "detectorType", detectorTypeEnum)) { + if (detectorTypeEnum == 4) detectorType = InDetDD::StripBarrel; + else ATH_MSG_WARNING("Non-strip barrel type set for strip box DetectorElement - is this intended?"); + } + + // // Make Sensor Design and add to DetectorManager // @@ -212,7 +222,8 @@ void StripGmxInterface::makeSiStripBox(const std::string &typeName, nRows, nStrips, pitch, - length); + length, + detectorType); for (int i = 0; i< splitLevel; i++) { for (int side : {0,1}) { //need different additional shift transform per side... @@ -228,6 +239,7 @@ void StripGmxInterface::makeSiStripBox(const std::string &typeName, nStrips, pitch, length, + detectorType, zShift); design->setMother(motherDesign.get()); @@ -250,7 +262,8 @@ void StripGmxInterface::makeSiStripBox(const std::string &typeName, nRows, nStrips, pitch, - length); + length, + detectorType); // Add to map for addSensor routine m_geometryMap[typeName] = design.get(); @@ -358,6 +371,16 @@ void StripGmxInterface::makeStereoAnnulus(const std::string &typeName, if (checkParameter(typeName, parameters, "usePC", usePC)) ATH_MSG_INFO("Using polar co-ordinates for strip stereo annulus modules"); + + //At the moment, we'd only ever want StripEndcap for this detector type, so throw a WARNING if it differs + //However, in future this may be different, so implementing the functionality to set this anyway + InDetDD::DetectorType detectorType{InDetDD::StripEndcap}; + int detectorTypeEnum = 0; + if (checkParameter(typeName, parameters, "detectorType", detectorTypeEnum)) { + if (detectorTypeEnum == 5) detectorType = InDetDD::StripEndcap; + else ATH_MSG_WARNING("Non-strip endcap type set for strip annulus DetectorElement - is this intended?"); + } + // // Make Sensor Design and add it to the DetectorManager // @@ -381,7 +404,8 @@ void StripGmxInterface::makeStereoAnnulus(const std::string &typeName, endR, stereoAngle, centreR, - usePC); + usePC, + detectorType); for (int i = 0; i < splitLevel; i++) { singleRowStrips.clear(); @@ -411,7 +435,8 @@ void StripGmxInterface::makeStereoAnnulus(const std::string &typeName, stereoAngle, thisCentreR, centreR, - usePC); + usePC, + detectorType); // Add to map for addSensor routine std::string splitName = typeName + "_" + std::to_string(i); @@ -440,7 +465,8 @@ void StripGmxInterface::makeStereoAnnulus(const std::string &typeName, endR, stereoAngle, centreR, - usePC); + usePC, + detectorType); m_geometryMap[typeName] = design.get(); m_detectorManager->addDesign(std::move(design)); diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_DetectorManager.cxx b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_DetectorManager.cxx index 99618162d9f1f0ab1071566a0c7b2c9c4bae7e22..2f65cd9bdd0e397c086e253bc612b77bfd5c6857 100755 --- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_DetectorManager.cxx +++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_DetectorManager.cxx @@ -541,6 +541,10 @@ namespace InDetDD { return alignmentChange; } } + // Avoid cppcheck warning. + if (!atrlistcol) { + return alignmentChange; + } { // loop over objects in collection //cppcheck-suppress nullPointerRedundantCheck diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.cxx index afe3db27962b4613548c06b2475b64bfa57c01d8..356cec3604b51662d409fc8049df8ffe203bed2f 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // PixelDigitization includes @@ -53,10 +53,10 @@ TVectorD CastStdVec(const std::vector<double>& vin) { } //Returns index at of std::vectorv where val is contained -int isContainedAt(std::vector<double> v, double val) { +int isContainedAt(const std::vector<double> & v, double val) { for (uint i = 0; i < v.size(); i++) { //Equality for decimals - if (v.at(i) - 0.00001 < val && val < v.at(i) + 0.00001) return i; + if (v[i] - 0.00001 < val && val < v[i] + 0.00001) return i; } return -1; } @@ -484,13 +484,13 @@ const std::string EfieldInterpolator::createInterpolationFromTCADtree(const std: } // Retrieve fluence values corresponding to a fixed voltage or viceversa if regular order == false -int EfieldInterpolator::fillXYvectors(std::vector<double> vLoop, int ifix, std::vector<std::vector<double> > v2vsv1, std::vector<double>& xx, std::vector<double>& yy, bool regularOrder) { +int EfieldInterpolator::fillXYvectors(std::vector<double> vLoop, int ifix, const std::vector<std::vector<double> > & v2vsv1, std::vector<double>& xx, std::vector<double>& yy, bool regularOrder) { yy.clear(); xx.clear(); int nfills = 0; if (regularOrder) { for (uint ie = 0; ie < v2vsv1.size(); ie++) { - double ef = v2vsv1.at(ie).at(ifix); // different fluences for volatge ifix + double ef = v2vsv1.at(ie).at(ifix); // different fluences for voltage ifix if (ef > 0) { yy.push_back(ef); xx.push_back(vLoop.at(ie)); @@ -523,7 +523,7 @@ double EfieldInterpolator::estimateEfieldLinear(double aimVoltage) { } //Interpolate following inverse distance weighted Interpolation -double EfieldInterpolator::estimateEfieldInvDistance(std::vector<double> vvol, std::vector<double> vflu, std::vector<std::vector<double> > vfluvvol, double aimFlu, double aimVol, double measure) { +double EfieldInterpolator::estimateEfieldInvDistance(const std::vector<double> & vvol, const std::vector<double> & vflu, const std::vector<std::vector<double> > & vfluvvol, double aimFlu, double aimVol, double measure) { ATH_MSG_WARNING("Use interpolation method _Inverse distance weighted_ - guarantees positive E field but no reliable interpolation"); double weight = 0.; double meanEf = 0.; diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.h b/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.h index b749ab41a8b511fee11a48cf260c911712663508..fbb711e3496a44240f5fda400c9c56263734860a 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file EfieldInterpolator.h @@ -51,8 +51,8 @@ public: bool initializeFromDirectory(const std::string& fpath); double estimateEfield(std::vector<double> vvol, const std::vector<double>& vflu, const std::vector<std::vector<double> >& vfluvvol, double aimFlu, double aimVol, const std::string& prepend = "", bool debug = false); - double estimateEfieldInvDistance(std::vector<double> vvol, std::vector<double> vflu, - std::vector<std::vector<double> > vfluvvol, double aimFlu, double aimVol, + double estimateEfieldInvDistance(const std::vector<double> & vvol, const std::vector<double> & vflu, + const std::vector<std::vector<double> > & vfluvvol, double aimFlu, double aimVol, double measure = 1.); TH1D* createEfieldProfile(double aimFluence, double aimVoltage); @@ -83,7 +83,7 @@ private: std::string m_fInter; //path to .root file for saving interpolation TTree, i.e. ordered by pixeldepth z std::vector<std::vector<TString> > list_files(const TString& fileList_TCADsamples); static double extrapolateLinear(double x1, double y1, double x2, double y2, double xaim); - int fillXYvectors(std::vector<double> vLoop, int ifix, std::vector<std::vector<double> > v2vsv1, + int fillXYvectors(std::vector<double> vLoop, int ifix, const std::vector<std::vector<double> > & v2vsv1, std::vector<double>& xx, std::vector<double>& yy, bool regularOrder = true); void fillEdgeValues(TH1D* hin); bool isInterpolation(const std::vector<double>& vval, double aimval) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx index 76610bf9a5e4b1d19c400b54a1cc5085623d03be..6957236fcb9bb3b941206cdeaffc132eac4462b0 100755 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ //================================================================================== @@ -182,31 +182,32 @@ StatusCode IDPerfMonZmumu::initialize() } } - // Retrieve fitter - if (m_TrackRefitter1.retrieve().isSuccess()) { - ATH_MSG_INFO("Retrieved tool m_TrackRefitter1: " << m_TrackRefitter1 << " SUCCESS "); - } - else { - ATH_MSG_FATAL("Unable to retrieve m_TrackRefitter1 " << m_TrackRefitter1 << " FAILURE "); - return StatusCode::FAILURE; - } - - // Retrieve the second fitter - if (m_TrackRefitter2.retrieve().isSuccess()) { - ATH_MSG_INFO("Retrieved tool m_TrackRefitter2: " << m_TrackRefitter2 << " SUCCESS "); - } - else { - ATH_MSG_FATAL("Unable to retrieve m_TrackRefitter2 " << m_TrackRefitter2 << " FAILURE "); - return StatusCode::FAILURE; - } + // Retrieve Track fitter and track to vertex + if (m_doRefit) { // only if track refit is requested + if (m_TrackRefitter1.retrieve().isSuccess()) { + ATH_MSG_INFO("Retrieved tool m_TrackRefitter1: " << m_TrackRefitter1 << " SUCCESS "); + } + else { + ATH_MSG_FATAL("Unable to retrieve m_TrackRefitter1 " << m_TrackRefitter1 << " FAILURE "); + return StatusCode::FAILURE; + } + // Retrieve the second fitter + if (m_TrackRefitter2.retrieve().isSuccess()) { + ATH_MSG_INFO("Retrieved tool m_TrackRefitter2: " << m_TrackRefitter2 << " SUCCESS "); + } + else { + ATH_MSG_FATAL("Unable to retrieve m_TrackRefitter2 " << m_TrackRefitter2 << " FAILURE "); + return StatusCode::FAILURE; + } - if (m_trackToVertexTool.retrieve().isSuccess()) { - ATH_MSG_INFO("Retrieved tool m_trackToVertexTool " << m_trackToVertexTool << " SUCCESS "); - } - else { - ATH_MSG_FATAL("Unable to retrieve m_trackToVertexTool " << m_trackToVertexTool << " FAILURE "); - return StatusCode::FAILURE; + if (m_trackToVertexTool.retrieve().isSuccess()) { + ATH_MSG_INFO("Retrieved tool m_trackToVertexTool " << m_trackToVertexTool << " SUCCESS "); + } + else { + ATH_MSG_FATAL("Unable to retrieve m_trackToVertexTool " << m_trackToVertexTool << " FAILURE "); + return StatusCode::FAILURE; + } } if(m_useTrackSelectionTool){ @@ -231,7 +232,7 @@ StatusCode IDPerfMonZmumu::initialize() ATH_CHECK (m_EventInfoKey.initialize()); // initializing the eventInfo "accessor" - ATH_CHECK (m_extrapolator.retrieve()); + if (m_isMC) ATH_CHECK (m_extrapolator.retrieve()); // this is only used for the truth particles ATH_CHECK (m_vertexKey.initialize()); diff --git a/InnerDetector/InDetRecAlgs/InDetSecVtxFinder/share/runInDetSecVtxFinder.py b/InnerDetector/InDetRecAlgs/InDetSecVtxFinder/share/runInDetSecVtxFinder.py index 029e09609107f5ce4f3f77ac307dfdc07b720a16..b69a523ae19bf24905058e9a3921dac618bd9be8 100644 --- a/InnerDetector/InDetRecAlgs/InDetSecVtxFinder/share/runInDetSecVtxFinder.py +++ b/InnerDetector/InDetRecAlgs/InDetSecVtxFinder/share/runInDetSecVtxFinder.py @@ -1,11 +1,8 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # Define method to construct configures Sec Vtx Finder alg # attempted by N Ribaric (@LancasterUNI) neza.ribaric@cern.ch if __name__ == "__main__": - - from AthenaCommon.Configurable import Configurable - Configurable.configurableRun3Behavior = 1 import AthenaCommon.Constants as Lvl # import the flags and set them diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h index 4f627ffcef1f2144371a315fd76e9af09316bd9a..51012d5cdf855f58e3d1c43f52b31617ba29cfb1 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h @@ -183,6 +183,7 @@ private: BooleanProperty m_useGRL {this, "useGRL", false, "Apply GRL selection or not when running on data"}; BooleanProperty m_doIDTIDEPlots{this, "doIDTIDEPlots", false, "do ID TIDE derivation plots"}; BooleanProperty m_fillTechnicalEfficiency{this, "fillTechnicalEfficiency", false, "Fill the technical efficiency plot. Requires additional sihit information in input file"}; + BooleanProperty m_doPRW{this,"doPRW",false,"apply pileup reweight"}; FloatProperty m_maxTrkJetDR{this,"maxTrkJetDR",0.4,"the maximum dR to jets to allow for track-in-jet plots"}; StringProperty m_dirName {this, "DirName", "SquirrelPlots/", "Top level directory to write histograms into"}; @@ -214,6 +215,8 @@ private: ToolHandle<InDet::IInDetHardScatterSelectionTool> m_hardScatterSelectionTool{this, "hardScatterSelectionTool", "InDet::InDetHardScatterSelectionTool","tool to select the hard scatter reco vertex"}; ToolHandle<IGoodRunsListSelectionTool> m_grlTool{this, "GoodRunsListSelectionTool", "GoodRunsListSelectionTool/GoodRunsListSelectionTool", "GRL selection tool"}; + SG::ReadDecorHandleKey<xAOD::EventInfo> m_weight_pileup_key{this, "PileupWeight_NOSYS", "EventInfo.PileupWeight_NOSYS"}; + mutable std::mutex m_mutex; mutable CutFlow m_truthCutFlow ATLAS_THREAD_SAFE; // Guarded by m_mutex std::vector<int> m_prospectsMatched; diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValFlags.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValFlags.py index d2b81d14f2e8e1c20f997603c9c8b27db42e487f..a14c7296bb1c618bbb40947f606fff8f852627db 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValFlags.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValFlags.py @@ -37,6 +37,7 @@ def createIDPVMConfigFlags(): icf.addFlag("GRL", []) icf.addFlag("doIDTIDE", False ) # for IDTIDE derivation icf.addFlag("doTechnicalEfficiency", False) # for enabling the filling of technical efficiency + icf.addFlag("doPRW", False) return icf diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringConfig.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringConfig.py index db3a4acb6b7e9a7bdfe289be085c7100d7eff160..fc547bf23c8154c6aa7cf215ac16228cc2a313d5 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringConfig.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringConfig.py @@ -240,6 +240,8 @@ def InDetPhysValMonitoringToolCfg(flags, **kwargs): kwargs.setdefault('JetPtMin', 100) kwargs.setdefault('JetPtMax', 5000) + kwargs.setdefault("doPRW", flags.PhysVal.IDPVM.doPRW) + acc.setPrivateTools(CompFactory.InDetPhysValMonitoringTool(**kwargs)) return acc diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/runIDPVM.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/runIDPVM.py index f09a8135796ca852c0b4a6d02de7cfb16c9b199a..9d524628b9238500725e9291b5324fcb49f1b99f 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/runIDPVM.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/runIDPVM.py @@ -2,6 +2,8 @@ # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from glob import glob +from AthenaConfiguration.ComponentFactory import CompFactory + def GetCustomAthArgs(): from argparse import ArgumentParser @@ -40,6 +42,7 @@ def GetCustomAthArgs(): IDPVMparser.add_argument("--validateExtraTrackCollections", help='List of extra track collection names to be validated in addition to Tracks.', nargs='+', default=[]) IDPVMparser.add_argument("--doIDTIDE", help='run the output from IDTIDE derivation', action='store_true', default=False) IDPVMparser.add_argument("--doTechnicalEfficiency", help='fill the technical efficiency plot (requires additional si hit information in the input file)', action='store_true', default=False) + IDPVMparser.add_argument("--doPRW", help='apply pileup reweight', action='store_true', default=False) return IDPVMparser.parse_args() # Parse the arguments @@ -58,7 +61,7 @@ flags.PhysVal.OutputFileName = MyArgs.outputFile if MyArgs.truthMinPt is None: MyArgs.truthMinPt = 1000 if flags.GeoModel.Run >= LHCPeriod.Run4 \ else 500 - + flags.PhysVal.IDPVM.setTruthStrategy = MyArgs.HSFlag flags.PhysVal.IDPVM.doExpertOutput = MyArgs.doExpertPlots flags.PhysVal.IDPVM.doPhysValOutput = not MyArgs.doExpertPlots @@ -89,6 +92,7 @@ flags.PhysVal.IDPVM.truthMinPt = MyArgs.truthMinPt flags.PhysVal.IDPVM.GRL = MyArgs.GRL flags.PhysVal.IDPVM.validateExtraTrackCollections = MyArgs.validateExtraTrackCollections flags.PhysVal.IDPVM.doTechnicalEfficiency = MyArgs.doTechnicalEfficiency +flags.PhysVal.IDPVM.doPRW = MyArgs.doPRW flags.PhysVal.doActs = MyArgs.doActs flags.Exec.SkipEvents = MyArgs.skipEvents @@ -101,6 +105,11 @@ acc = MainServicesCfg(flags) from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg acc.merge(PoolReadCfg(flags)) +if flags.PhysVal.IDPVM.doPRW: + acc.addService(CompFactory.CP.SystematicsSvc("SystematicsSvc")) + from AsgAnalysisAlgorithms.PileupReweightingAlgConfig import PileupReweightingAlgCfg + acc.merge(PileupReweightingAlgCfg(flags)) + from InDetPhysValMonitoring.InDetPhysValMonitoringConfig import InDetPhysValMonitoringCfg acc.merge(InDetPhysValMonitoringCfg(flags)) diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx index 03c49c1177950bea6468514f611030bd4e4acb52..71f6dd4961aa70ea2471a9dfdf78503c4252e5c6 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx @@ -159,6 +159,8 @@ InDetPhysValMonitoringTool::initialize() { IDPVM::addReadDecoratorHandleKeys(*this, m_jetContainerName, empty_prefix, required_int_jet_decorations, m_intJetDecor); } + ATH_CHECK(m_weight_pileup_key.initialize(m_doPRW)); + m_usingSpecialPileupSwitch = (m_pileupSwitch != "All"); return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data15_13TeV_1000evt.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data15_13TeV_1000evt.sh index 56240e925281afb0b560af7e94ce389c3c5764f0..6b476dd853e64b77e65c5d76c10510d5629af767 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data15_13TeV_1000evt.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data15_13TeV_1000evt.sh @@ -7,7 +7,7 @@ # art-output: physval*.root # art-output: *.xml # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data16_13TeV_1000evt.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data16_13TeV_1000evt.sh index 94084602c4aae7fcb1083c0e7b8cddd51706109e..00e553939703d0ac083f5134a3499dd25564aeb5 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data16_13TeV_1000evt.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data16_13TeV_1000evt.sh @@ -7,7 +7,7 @@ # art-output: physval*.root # art-output: *.xml # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data17_13TeV_1000evt.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data17_13TeV_1000evt.sh index 9c1dd456f65ff38a10b80ccf0959e97143f6b34c..5726a4f9d7a3496f682613bd2b7e1d5e1213987d 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data17_13TeV_1000evt.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data17_13TeV_1000evt.sh @@ -7,7 +7,7 @@ # art-output: physval*.root # art-output: *.xml # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data18_13TeV_1000evt.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data18_13TeV_1000evt.sh index d7972608632d68225169bad8debf0deb8aeb9aa9..c7a40e2d3759e5f3f5cc984da78d0e01b58e9114 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data18_13TeV_1000evt.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_data18_13TeV_1000evt.sh @@ -7,7 +7,7 @@ # art-output: physval*.root # art-output: *.xml # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele10GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele10GeV_reco.sh index 61cc321d7bac24eb38b75b288dc5077408e59b18..af177e0c519d269deafbfecbf1089f13e8e52ea4 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele10GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele10GeV_reco.sh @@ -12,7 +12,7 @@ # art-output: *.xml # art-output: art_core_0 # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele5GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele5GeV_reco.sh index 9bbf10a262bc533db5e9bb69f22831ade8467f4a..ba0abee167d72df147b4b7f7861c9da6e6d8499c 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele5GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ele5GeV_reco.sh @@ -12,7 +12,7 @@ # art-output: *.xml # art-output: art_core_0 # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_reco.sh index bc0db1d3fb89806ac83e210f3a726a50d05d7e7b..8da6a158a780e070abe0729b8bb71d292fb96c45 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_reco.sh @@ -12,7 +12,7 @@ # art-output: *.xml # art-output: art_core_0 # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_simreco.sh index 05946767577697887240f1a4e316d1349ff97b4b..9e942a8121cade6c86ad94f0c8a4c95fd90bef6f 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_simreco.sh @@ -11,6 +11,7 @@ # art-output: *Analysis*.root # art-output: *.xml # art-output: dcube* +# art-html: dcube_shifter_last # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu10GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu10GeV_reco.sh index 67d3cc0b1aade8e776460640852265368e3497ad..bd6539766c37198c7615097e903fba32882accc2 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu10GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu10GeV_reco.sh @@ -12,7 +12,7 @@ # art-output: *.xml # art-output: art_core_0 # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 @@ -48,7 +48,7 @@ case $ArtProcess in fi echo "compare with R23.0.23 or 24.0.1" $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ - -p -x dcube \ + -p -x dcube_shifter \ -c ${dcubeShifterXml} \ -r ${dcubeRef} \ physval.root @@ -56,7 +56,7 @@ case $ArtProcess in echo "compare with last build" $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ - -p -x dcube_last \ + -p -x dcube_shifter_last \ -c ${dcubeShifterXml} \ -r last_results/physval.root \ physval.root diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_reco.sh index 67efcbbf79a83dd1bce2ab8e4245664dc5fb753b..1667f2f2758f3e062e9c790510d2867ce5c3b281 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_reco.sh @@ -12,7 +12,7 @@ # art-output: *.xml # art-output: art_core_0 # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 @@ -48,7 +48,7 @@ case $ArtProcess in fi echo "compare with R23.0.23 or 24.0.1" $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ - -p -x dcube \ + -p -x dcube_shifter \ -c ${dcubeShifterXml} \ -r ${dcubeRef} \ physval.root @@ -56,7 +56,7 @@ case $ArtProcess in echo "compare with last build" $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ - -p -x dcube_last \ + -p -x dcube_shifter_last \ -c ${dcubeShifterXml} \ -r last_results/physval.root \ physval.root diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_simreco.sh index 6c7cdabcde10a56c90cae46b70f82b935dd8ff28..20b159d75958425655903ca73ef7a7d2c917e8cf 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_simreco.sh @@ -11,6 +11,7 @@ # art-output: *Analysis*.root # art-output: *.xml # art-output: dcube* +# art-html: dcube_shifter_last # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_reco.sh index a3d506fb2af69aeb2edded2290830b5055ac7f49..cad7a4c22f536e4e037abc4202d6dfb02f1c1fdd 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_reco.sh @@ -12,7 +12,7 @@ # art-output: *.xml # art-output: art_core_0 # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_simreco.sh index 3acaf16d9e61c09c74c4ee5c52d325091d693db4..98f4647a4fb756dbfa7ea088277de31ff45e6572 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_simreco.sh @@ -11,6 +11,7 @@ # art-output: *Analysis*.root # art-output: *.xml # art-output: dcube* +# art-html: dcube_shifter_last # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu5GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu5GeV_simreco.sh index 9bd85142181c239113ac3e4c3f526a73b632da7f..cc55aa1237130c448aebbac99c1a2979e5cf6015 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu5GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu5GeV_simreco.sh @@ -11,6 +11,7 @@ # art-output: *Analysis*.root # art-output: *.xml # art-output: dcube* +# art-html: dcube_shifter_last # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_reco.sh index 15202516b6f00b2bd558d2781fd7b1a7b02a3ebc..2ad5b5e9b4540e18bf85abd892c1080dba4520df 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_reco.sh @@ -12,7 +12,7 @@ # art-output: *.xml # art-output: art_core_0 # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 @@ -48,7 +48,7 @@ case $ArtProcess in fi echo "compare with R23.0.23 or 24.0.1" $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ - -p -x dcube \ + -p -x dcube_shifter \ -c ${dcubeShifterXml} \ -r ${dcubeRef} \ physval.root @@ -56,7 +56,7 @@ case $ArtProcess in echo "compare with last build" $ATLAS_LOCAL_ROOT/dcube/current/DCubeClient/python/dcube.py \ - -p -x dcube_last \ + -p -x dcube_shifter_last \ -c ${dcubeShifterXml} \ -r last_results/physval.root \ physval.root diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_simreco.sh index ef880ebaa9a01cc88141d66b4d5fbf771a62d84f..9ca9fc3a3365c50c1576b0827b12d3a10a5bc540 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_simreco.sh @@ -11,6 +11,7 @@ # art-output: *Analysis*.root # art-output: *.xml # art-output: dcube* +# art-html: dcube_shifter_last # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_reco.sh index 4bc8aace9588eef909b418add4a984765dc6fc89..daf9163b2def0cf816653b01c091191936c5a929 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_reco.sh @@ -12,7 +12,7 @@ # art-output: *.xml # art-output: art_core_0 # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_shifter_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_simreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_simreco.sh index 8ca1f45a6cb9b8698fd9c08065356688deab8418..62e916d1715a65857b1156658d1df371a040e271 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_simreco.sh @@ -11,6 +11,8 @@ # art-output: *Analysis*.root # art-output: *.xml # art-output: dcube* +# art-html: dcube_shifter_last + # Fix ordering of output in logfile exec 2>&1 diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh index aca9a60ebd0574d53da18d4d7eaf58b9261fa06e..1bed5a906a550c0da18d534aa97aa9c853b70afd 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarPU40_reco.sh @@ -9,7 +9,7 @@ # art-output: physval*.root # art-output: *.xml # art-output: dcube* -# art-html: dcube_idtide_last +# art-html: dcube_lrt_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 @@ -26,10 +26,8 @@ dcubeRef_lrt="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMoni if [[ "$ATLAS_RELEASE_BASE" == *"23.0"* ]]; then dcubeRef_lrt="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_lrt_r23.root" fi -dcubeRef_idtide="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_idtide_r24.root" dcubeRef_lrt="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_lrt_r24.root" if [[ "$ATLAS_RELEASE_BASE" == *"23.0"* ]]; then - dcubeRef_idtide="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_idtide_r23.root" dcubeRef_lrt="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/InDetPhysValMonitoring/ReferenceHistograms/physval_ttbarPU40_lrt_r23.root" fi diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_zprime_tide.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_zprime_tide.sh index 9e2b118cb25cee1b3f2fcb228fa99d9bd9e7bb39..03ae26c664ddb27ffad6fa7d6dd178640d46c545 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_zprime_tide.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_zprime_tide.sh @@ -9,7 +9,7 @@ # art-output: physval*.root # art-output: *.xml # art-output: dcube* -# art-html: dcube_last +# art-html: dcube_idtide_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 diff --git a/LArCalorimeter/LArCabling/LArCabling/LArLATOMEMapping.h b/LArCalorimeter/LArCabling/LArCabling/LArLATOMEMapping.h index 75c3b2fe6a79a4b276d07de45492a2c5aa39c7c1..496d58cf44368467f1bb06a41009917c78bf06f3 100644 --- a/LArCalorimeter/LArCabling/LArCabling/LArLATOMEMapping.h +++ b/LArCalorimeter/LArCabling/LArCabling/LArLATOMEMapping.h @@ -1,7 +1,7 @@ //Dear emacs, this is -*-c++-*- /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef LARLATOMEMAPPING_H @@ -12,6 +12,7 @@ #include "Identifier/IdentifierHash.h" #include <vector> +#include <algorithm> /** * fixed number of channels on one LATOME board<br> diff --git a/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx b/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx index 692b8d90a887de7cd63bb4317cd9bdb1d013a3f3..6c19d97cdae8e694d254b04b0c20c992dd17f741 100644 --- a/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx +++ b/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "LArRawDataReadingAlg.h" @@ -18,7 +18,7 @@ #include "LArByteStream/LArRodBlockPhysicsV6.h" #include "LArFebHeaderReader.h" - +#include "LArElecCalib/LArProvenance.h" LArRawDataReadingAlg::LArRawDataReadingAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator) {} @@ -211,9 +211,9 @@ StatusCode LArRawDataReadingAlg::execute(const EventContext& ctx) const { HWIdentifier cId = m_onlineId->channel_Id(fId,fcNb); uint16_t iquality = 0; - uint16_t iprovenance = 0x1000; + uint16_t iprovenance = LArProv::DSPCALC; //0x1000 if (quality>0) { - iprovenance |= 0x2000; + iprovenance |= LArProv::QTPRESENT; //0x2000 iquality = (quality & 0xFFFF); } rawChannels->emplace_back(cId, energy, time, iquality, iprovenance, (CaloGain::CaloGain)gain); diff --git a/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py b/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py index 270250d7e596c25141eff2f13c33dac769d3cf0d..1c515500d4b5c9fdbe3ed5af1751dfd640d1ccbc 100644 --- a/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py +++ b/LArCalorimeter/LArConfiguration/python/LArConfigFlags.py @@ -17,7 +17,7 @@ def createLArConfigFlags(): lcf.addFlag("LAr.doHVCorr",lambda prevFlags : not prevFlags.Input.isMC) lcf.addFlag("LAr.doCellEmMisCalib",lambda prevFlags : prevFlags.Input.isMC) - lcf.addFlag("LAr.RawChannelSource",_determineRawChannelSource,enum=RawChannelSource) + lcf.addFlag("LAr.RawChannelSource", _determineRawChannelSource, type=RawChannelSource) lcf.addFlag("LAr.doCellNoiseMasking",True) lcf.addFlag("LAr.doCellSporadicNoiseMasking",True) diff --git a/LArCalorimeter/LArElecCalib/CMakeLists.txt b/LArCalorimeter/LArElecCalib/CMakeLists.txt index 5b740888982c7b20d7fe9ccbd107bcb26c080fcd..6a9dc9c8ef5ef3d6d1624da7c616569930a21e6c 100644 --- a/LArCalorimeter/LArElecCalib/CMakeLists.txt +++ b/LArCalorimeter/LArElecCalib/CMakeLists.txt @@ -18,3 +18,8 @@ atlas_add_dictionary( LArElecCalibDict LArElecCalib/LArElecCalibDict.h LArElecCalib/selection.xml LINK_LIBRARIES LArElecCalib ) + +atlas_add_test( LArProvenance_test + SOURCES test/testLArProvenance.cxx + POST_EXEC_SCRIPT nopost.sh + ) diff --git a/LArCalorimeter/LArElecCalib/LArElecCalib/LArElecCalibDict.h b/LArCalorimeter/LArElecCalib/LArElecCalib/LArElecCalibDict.h index bac126f79a4243f848e92cb8af03f11c080bb6ea..b61926fd5566408d6d31344bfff0c2e111ada871 100755 --- a/LArCalorimeter/LArElecCalib/LArElecCalib/LArElecCalibDict.h +++ b/LArCalorimeter/LArElecCalib/LArElecCalib/LArElecCalibDict.h @@ -47,5 +47,7 @@ #include "LArElecCalib/ILArHVScaleCorr.h" #include "LArElecCalib/ILArFEBTempTool.h" #include "LArElecCalib/ILArOFCBin.h" +#include "LArElecCalib/LArProvenance.h" + #endif // LARELECCALIB_LARELECCALIBDICT_H diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/python/exampleDriverScript.py b/LArCalorimeter/LArExample/LArCalibProcessing/python/exampleDriverScript.py index ac56f87a834c7b7b1751c378b7a23976c297bd69..8a734f55dcaeacffa437200658f4ab561bdd3f1e 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/python/exampleDriverScript.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/python/exampleDriverScript.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration #Import the configution-method we want to use (here: Delay and Cali-OFCs) from LArCalibProcessing.LArCalib_Delay_OFCCaliConfig import LArDelay_OFCCaliCfg @@ -7,33 +7,34 @@ from LArCalibProcessing.LArCalib_Delay_OFCCaliConfig import LArDelay_OFCCaliCfg from AthenaConfiguration.MainServicesConfig import MainServicesCfg #Import the flag-container that is the arguemnt to the configuration methods -from AthenaConfiguration.AllConfigFlags import ConfigFlags +from AthenaConfiguration.AllConfigFlags import initConfigFlags +flags = initConfigFlags() from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags -addLArCalibFlags(ConfigFlags) +addLArCalibFlags(flags) #This allows set flags from the command-line (not strictly required for the AP) -ConfigFlags.fillFromArgs() +flags.fillFromArgs() #Now we set the flags as required for this particular job: #The following flags help finding the input bytestream files: -ConfigFlags.LArCalib.Input.Dir = "/scratch/wlampl/calib21/HECFCAL_Oct20" -ConfigFlags.LArCalib.Input.Type="calibration_LArElec-Delay" -ConfigFlags.LArCalib.Input.RunNumbers=[404512,] -ConfigFlags.Input.Files=ConfigFlags.LArCalib.Input.Files +flags.LArCalib.Input.Dir = "/scratch/wlampl/calib21/HECFCAL_Oct20" +flags.LArCalib.Input.Type="calibration_LArElec-Delay" +flags.LArCalib.Input.RunNumbers=[404512,] +flags.Input.Files=flags.LArCalib.Input.Files #Set the database (sqlite-file) containing the input conditions that #come typcially from the same calibration campaign #(in this case, Pedestal and AutoCorr) -ConfigFlags.LArCalib.Input.Database="db.sqlite" +flags.LArCalib.Input.Database="db.sqlite" #Some configs depend on the sub-calo in question, here HEC #(sets also the preselection of LArRawCalibDataReadingAlg) -ConfigFlags.LArCalib.Input.SubDet="HEC" +flags.LArCalib.Input.SubDet="HEC" #Configure the Bad-Channel database we are reading #(the AP typically uses a snapshot in an sqlite file -ConfigFlags.LArCalib.BadChannelDB="BadChannelSnapshot.db" -ConfigFlags.LArCalib.BadChannelTag="-RUN2-UPD3-00" +flags.LArCalib.BadChannelDB="BadChannelSnapshot.db" +flags.LArCalib.BadChannelTag="-RUN2-UPD3-00" #Set a Geometry version (not really needed, but the job complains otherwise) from AthenaConfiguration.TestDefaults import defaultGeometryTags @@ -41,42 +42,42 @@ flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3 #Output of this job: #ROOT file: -ConfigFlags.LArCalib.Output.ROOTFile="ofccali.root" +flags.LArCalib.Output.ROOTFile="ofccali.root" #POOL file: -ConfigFlags.LArCalib.Output.POOLFile="ofccali.pool.root" +flags.LArCalib.Output.POOLFile="ofccali.pool.root" #sqlite file (can be the same as the input-sqlite, but slightly different syntax -ConfigFlags.IOVDb.DBConnection="sqlite://;schema=db.sqlite;dbname=CONDBR2" +flags.IOVDb.DBConnection="sqlite://;schema=db.sqlite;dbname=CONDBR2" #The global tag we are working with -ConfigFlags.IOVDb.GlobalTag="LARCALIB-RUN2-00" +flags.IOVDb.GlobalTag="LARCALIB-RUN2-00" #Other potentially useful flags-settings: #Define the global output Level: #from AthenaCommon.Constants import * -#ConfigFlags.Exec.OutputLevel=VERBOSE +#flags.Exec.OutputLevel=VERBOSE #Feed-though preselection for bytestream input: -#ConfigFlags.LArCalib.Preselection.BEC=[1] -#ConfigFlags.LArCalib.Preselection.Side=[0] +#flags.LArCalib.Preselection.BEC=[1] +#flags.LArCalib.Preselection.Side=[0] #Print the input files we found print ("Input files to be processed:") -for f in ConfigFlags.Input.Files: +for f in flags.Input.Files: print (f) #Lock the flag-container (required) -ConfigFlags.lock() +flags.lock() #Get the Main services (EventLoopMgr, StoreGate, ... ) -cfg=MainServicesCfg(ConfigFlags) +cfg=MainServicesCfg(flags) #Merge our own config into it -cfg.merge(LArDelay_OFCCaliCfg(ConfigFlags)) +cfg.merge(LArDelay_OFCCaliCfg(flags)) #At this point we can alter the configuration diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArDigits2NtupleDumper.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArDigits2NtupleDumper.py index d7bbfeef38a4c4f224f8f39a6fe44570d82ea312..9d8723ad8682d70c0f746e30e471a66e6b22a051 100755 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArDigits2NtupleDumper.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArDigits2NtupleDumper.py @@ -1,15 +1,13 @@ #!/usr/bin/env python # -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentFactory import CompFactory -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator if __name__=='__main__': import os,sys import argparse - import subprocess from AthenaCommon import Logging log = Logging.logging.getLogger( 'LArDigits2Ntuple' ) @@ -41,82 +39,84 @@ if __name__=='__main__': log.debug(value) #Import the flag-container that is the arguemnt to the configuration methods - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + # add SCDump flags, here re-used for digitsdump from LArCafJobs.LArSCDumperFlags import addSCDumpFlags - addSCDumpFlags(ConfigFlags) + addSCDumpFlags(flags) if len(args.infile) > 0: - ConfigFlags.Input.Files = [args.infile] + flags.Input.Files = [args.infile] elif len(args.inppatt) > 0: from LArCalibProcessing.GetInputFiles import GetInputFilesFromPattern - ConfigFlags.Input.Files = GetInputFilesFromPattern(args.indir,args.inppatt) + flags.Input.Files = GetInputFilesFromPattern(args.indir,args.inppatt) else: from LArCalibProcessing.GetInputFiles import GetInputFilesFromPrefix - ConfigFlags.Input.Files = GetInputFilesFromPrefix(args.indir,args.inpref) + flags.Input.Files = GetInputFilesFromPrefix(args.indir,args.inpref) if args.run != 0: - ConfigFlags.Input.RunNumbers = [args.run] + flags.Input.RunNumbers = [args.run] # first autoconfig from LArConditionsCommon.LArRunFormat import getLArFormatForRun try: - runinfo=getLArFormatForRun(ConfigFlags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2") + runinfo=getLArFormatForRun(flags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2") except Exception: log.warning("Could not get run info, using defaults !") if args.nsamp > 0: - ConfigFlags.LArSCDump.nSamples=args.nsamp + flags.LArSCDump.nSamples=args.nsamp else: - ConfigFlags.LArSCDump.nSamples=4 + flags.LArSCDump.nSamples=4 else: - ConfigFlags.LArSCDump.nSamples=runinfo.nSamples() + flags.LArSCDump.nSamples=runinfo.nSamples() - ConfigFlags.LArSCDump.digitsKey="FREE" - if args.nsamp > 0 and args.nsamp < ConfigFlags.LArSCDump.nSamples: - ConfigFlags.LArSCDump.nSamples=args.nsamp + flags.LArSCDump.digitsKey="FREE" + if args.nsamp > 0 and args.nsamp < flags.LArSCDump.nSamples: + flags.LArSCDump.nSamples=args.nsamp log.info("Autoconfigured: ") - log.info("nSamples: %d digitsKey %s",ConfigFlags.LArSCDump.nSamples, ConfigFlags.LArSCDump.digitsKey) + log.info("nSamples: %d digitsKey %s",flags.LArSCDump.nSamples, flags.LArSCDump.digitsKey) # now construct the job - ConfigFlags.LAr.doAlign=False + flags.LAr.doAlign=False if args.evtree: # should include trigger info - ConfigFlags.Trigger.triggerConfig = 'DB' - ConfigFlags.Trigger.L1.doCTP = True - ConfigFlags.Trigger.L1.doMuon = False - ConfigFlags.Trigger.L1.doCalo = False - ConfigFlags.Trigger.L1.doTopo = False + flags.Trigger.triggerConfig = 'DB' + flags.Trigger.L1.doCTP = True + flags.Trigger.L1.doMuon = False + flags.Trigger.L1.doCalo = False + flags.Trigger.L1.doTopo = False - ConfigFlags.Trigger.enableL1CaloLegacy = True - ConfigFlags.Trigger.enableL1CaloPhase1 = True + flags.Trigger.enableL1CaloLegacy = True + flags.Trigger.enableL1CaloPhase1 = True - ConfigFlags.lock() + flags.lock() #Import the MainServices (boilerplate) from AthenaConfiguration.MainServicesConfig import MainServicesCfg from LArGeoAlgsNV.LArGMConfig import LArGMCfg - acc = MainServicesCfg(ConfigFlags) - acc.merge(LArGMCfg(ConfigFlags)) + acc = MainServicesCfg(flags) + acc.merge(LArGMCfg(flags)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg - acc.merge(LArOnOffIdMappingCfg(ConfigFlags)) + acc.merge(LArOnOffIdMappingCfg(flags)) if args.evtree: # should include trigger info from LArCafJobs.LArSCDumperSkeleton import L1CaloMenuCfg - acc.merge(L1CaloMenuCfg(ConfigFlags)) + acc.merge(L1CaloMenuCfg(flags)) from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg - tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(ConfigFlags)) + tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags)) else: tdt = None if args.bc: from LArBadChannelTool.LArBadChannelConfig import LArBadFebCfg, LArBadChannelCfg - acc.merge(LArBadChannelCfg(ConfigFlags)) - acc.merge(LArBadFebCfg(ConfigFlags)) + acc.merge(LArBadChannelCfg(flags)) + acc.merge(LArBadFebCfg(flags)) if args.geom: log.warning("Adding real geometry is not working yet") @@ -127,9 +127,9 @@ if __name__=='__main__': #AthReadAlg_ExtraInputs.append(('CaloSuperCellDetDescrManager', 'ConditionStore+CaloSuperCellDetDescrManager')) from LArCalibTools.LArDigits2NtupleConfig import LArDigits2NtupleCfg - acc.merge(LArDigits2NtupleCfg(ConfigFlags, AddBadChannelInfo=args.bc, AddFEBTempInfo=False, isSC=False, isFlat=True, + acc.merge(LArDigits2NtupleCfg(flags, AddBadChannelInfo=args.bc, AddFEBTempInfo=False, isSC=False, isFlat=True, OffId=args.offline, AddHash=args.ahash, AddCalib=args.calib, RealGeometry=args.geom, # from LArCond2NtupleBase - NSamples=ConfigFlags.LArSCDump.nSamples, FTlist={}, ContainerKey=ConfigFlags.LArSCDump.digitsKey, # from LArDigits2Ntuple + NSamples=flags.LArSCDump.nSamples, FTlist={}, ContainerKey=flags.LArSCDump.digitsKey, # from LArDigits2Ntuple FillLB=args.evtree, OutputLevel=args.olevel )) @@ -141,7 +141,7 @@ if __name__=='__main__': # some logging log.info("Input files to be processed:") - for f in ConfigFlags.Input.Files: + for f in flags.Input.Files: log.info(f) log.info("Output file: ") log.info(args.outfile) diff --git a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py index bfbcaff9b1a57bfa446c0a6794941f3f47f8d6ff..94772afd84b205b3290da0445b79a79897f2aed4 100644 --- a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py +++ b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py @@ -5,30 +5,28 @@ from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.Enums import LHCPeriod, ProductionStep, Project from IOVDbSvc.IOVDbSvcConfig import addFolders -def LArGMCfg(configFlags): - - result=GeoModelCfg(configFlags) +def LArGMCfg(flags): + result=GeoModelCfg(flags) - doAlignment=configFlags.LAr.doAlign - activateCondAlgs = configFlags.Common.Project is not Project.AthSimulation - tool = CompFactory.LArDetectorToolNV(ApplyAlignments=doAlignment, EnableMBTS=configFlags.Detector.GeometryMBTS) - if configFlags.Common.ProductionStep != ProductionStep.Simulation and configFlags.Common.ProductionStep != ProductionStep.FastChain: + activateCondAlgs = flags.Common.Project is not Project.AthSimulation + tool = CompFactory.LArDetectorToolNV(ApplyAlignments=flags.LAr.doAlign, EnableMBTS=flags.Detector.GeometryMBTS) + if flags.Common.ProductionStep != ProductionStep.Simulation and flags.Common.ProductionStep != ProductionStep.FastChain: tool.GeometryConfig = "RECO" result.getPrimary().DetectorTools += [ tool ] - if doAlignment: - if configFlags.Input.isMC: + if flags.LAr.doAlign: + if flags.Input.isMC: #Monte Carlo case: if activateCondAlgs: - result.merge(addFolders(configFlags,"/LAR/Align","LAR_OFL",className="DetCondKeyTrans")) - result.merge(addFolders(configFlags,"/LAR/LArCellPositionShift","LAR_OFL",className="CaloRec::CaloCellPositionShift")) + result.merge(addFolders(flags,"/LAR/Align","LAR_OFL",className="DetCondKeyTrans")) + result.merge(addFolders(flags,"/LAR/LArCellPositionShift","LAR_OFL",className="CaloRec::CaloCellPositionShift")) else: - result.merge(addFolders(configFlags,"/LAR/Align","LAR_OFL")) - result.merge(addFolders(configFlags,"/LAR/LArCellPositionShift","LAR_OFL")) + result.merge(addFolders(flags,"/LAR/Align","LAR_OFL")) + result.merge(addFolders(flags,"/LAR/LArCellPositionShift","LAR_OFL")) else: - result.merge(addFolders(configFlags,"/LAR/Align","LAR_ONL",className="DetCondKeyTrans")) - result.merge(addFolders(configFlags,"/LAR/LArCellPositionShift","LAR_ONL",className="CaloRec::CaloCellPositionShift")) + result.merge(addFolders(flags,"/LAR/Align","LAR_ONL",className="DetCondKeyTrans")) + result.merge(addFolders(flags,"/LAR/LArCellPositionShift","LAR_ONL",className="CaloRec::CaloCellPositionShift")) if activateCondAlgs: result.addCondAlgo(CompFactory.LArAlignCondAlg()) @@ -41,7 +39,7 @@ def LArGMCfg(configFlags): from SGComps.AddressRemappingConfig import AddressRemappingCfg result.merge(AddressRemappingCfg()) - caloCellKeys = [i.split('#')[1] for i in configFlags.Input.TypedCollections if "CaloCellContainer"==i.split('#')[0] ] + caloCellKeys = [i.split('#')[1] for i in flags.Input.TypedCollections if "CaloCellContainer"==i.split('#')[0] ] for key in caloCellKeys: if key != 'AllCalo': sCellsInInput = True @@ -50,7 +48,7 @@ def LArGMCfg(configFlags): if (flags.GeoModel.Run >= LHCPeriod.Run3 and flags.Detector.GeometryTile) or sCellsInInput: # TODO: avoid depending on Tile in SuperCell alignment from TileGeoModel.TileGMConfig import TileGMCfg - result.merge(TileGMCfg(configFlags)) + result.merge(TileGMCfg(flags)) result.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg()) AthReadAlg_ExtraInputs.add(('CaloSuperCellDetDescrManager', 'ConditionStore+CaloSuperCellDetDescrManager')) @@ -70,19 +68,21 @@ def LArGMCfg(configFlags): if flags.GeoModel.Run >= LHCPeriod.Run3 and flags.Detector.GeometryTile and flags.Common.ProductionStep != ProductionStep.Overlay: # TODO: avoid depending on Tile in SuperCell alignment from TileGeoModel.TileGMConfig import TileGMCfg - result.merge(TileGMCfg(configFlags)) + result.merge(TileGMCfg(flags)) result.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg()) return result if __name__ == "__main__": - from AthenaConfiguration.AllConfigFlags import ConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles + from AthenaConfiguration.AllConfigFlags import initConfigFlags + from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.lock() + flags = initConfigFlags() + flags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 + flags.lock() - acc = LArGMCfg(ConfigFlags) + acc = LArGMCfg(flags) f=open('LArGMCfg.pkl','wb') acc.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py b/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py index 67d834893312e9e5d237ae6276edef1cdadcfe44..d6855a53084e1c251463393411fcb5f98c75c282 100644 --- a/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py @@ -1,30 +1,20 @@ # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # -def LArAffectedRegionsConfigOld(inputFlags): - - from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArAffectedRegionsAlg - - helper = AthMonitorCfgHelperOld(inputFlags,'LArAffectedRegionsAlgOldCfg') - LArAffectedRegionsConfigCore(helper, LArAffectedRegionsAlg, inputFlags) - - return helper.result() - -def LArAffectedRegionsConfig(inputFlags): +def LArAffectedRegionsConfig(flags): '''Function to configures some algorithms in the monitoring system.''' from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArAffectedRegionsAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArAffectedRegionsAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArAffectedRegionsConfigCore(helper, CompFactory.LArAffectedRegionsAlg, inputFlags) + LArAffectedRegionsConfigCore(helper, CompFactory.LArAffectedRegionsAlg, flags) return helper.result() -def LArAffectedRegionsConfigCore(helper, algoinstance, inputFlags): +def LArAffectedRegionsConfigCore(helper, algoinstance, flags): larAffectedRegAlg = helper.addAlgorithm(algoinstance,'larAffectedRegAlg') @@ -37,7 +27,7 @@ def LArAffectedRegionsConfigCore(helper, algoinstance, inputFlags): isOnline=False from AthenaConfiguration.ComponentFactory import isComponentAccumulatorCfg if isComponentAccumulatorCfg(): - if inputFlags.DQ.Environment == 'online': + if flags.DQ.Environment == 'online': isOnline=True else: from AthenaCommon.AthenaCommonFlags import athenaCommonFlags @@ -379,27 +369,29 @@ def LArAffectedRegionsConfigCore(helper, algoinstance, inputFlags): if __name__=='__main__': # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import ConfigFlags - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.Output.HISTFileName = 'LArAffectedRegionsOutput.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.DQ.useTrigger = False - ConfigFlags.lock() + flags.Output.HISTFileName = 'LArAffectedRegionsOutput.root' + flags.DQ.enableLumiAccess = False + flags.DQ.useTrigger = False + flags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(ConfigFlags) + cfg=CaloRecoCfg(flags) #add affected regions - affregmon = LArAffectedRegionsConfig(ConfigFlags) + affregmon = LArAffectedRegionsConfig(flags) cfg.merge(affregmon) - ConfigFlags.dump() + flags.dump() f=open("AffectedRegionsMonMaker.pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArCalibDelayMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArCalibDelayMonAlg.py index aafee2872192f8dfd7a55f9d46da620c6694d63c..314b8cca69004eab12bfc6a0f6b1ec06bc1a2245 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCalibDelayMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCalibDelayMonAlg.py @@ -1,28 +1,28 @@ # -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # -def LArCalibDelayMonConfig(inputFlags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): +def LArCalibDelayMonConfig(flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArCalibDelayMonCfg') + helper = AthMonitorCfgHelper(flags,'LArCalibDelayMonCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArCalibDelayMonConfigCore(helper,CompFactory.LArCalibDelayMonAlg,inputFlags,gain,doAccDigit,doCalibDigit,doAccCalibDigit) + LArCalibDelayMonConfigCore(helper,CompFactory.LArCalibDelayMonAlg,flags,gain,doAccDigit,doCalibDigit,doAccCalibDigit) rv = ComponentAccumulator() # adding LAr*Mapping algos from LArCabling.LArCablingConfig import LArFebRodMappingCfg, LArCalibIdMappingCfg - rv.merge(LArFebRodMappingCfg(inputFlags)) - rv.merge(LArCalibIdMappingCfg(inputFlags)) + rv.merge(LArFebRodMappingCfg(flags)) + rv.merge(LArCalibIdMappingCfg(flags)) rv.merge(helper.result()) return rv -def LArCalibDelayMonConfigCore(helper,algoinstance,inputFlags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): +def LArCalibDelayMonConfigCore(helper,algoinstance,flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -135,19 +135,23 @@ def LArCalibDelayMonConfigCore(helper,algoinstance,inputFlags,gain="",doAccDigit if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) from AthenaMonitoring.DQConfigFlags import DQDataType - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) type_run="Delay" run="00404654" part="HecFcal" - ConfigFlags.Input.Files = [ + + flags.Input.Files = [ "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Delay-32s-High-HecFcal/00404654/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW._lb0000._SFO-1._0001.data", "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Delay-32s-High-HecFcal/00404654/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW._lb0000._SFO-2._0001.data", @@ -155,34 +159,34 @@ if __name__=='__main__': "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Delay-32s-High-HecFcal/00404654/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW._lb0000._SFO-3._0001.data", "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Delay-32s-High-HecFcal/00404654/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW/data21_calib.00404654.calibration_LArElec-Delay-32s-High-HecFcal.daq.RAW._lb0000._SFO-4._0001.data"] - ConfigFlags.Output.HISTFileName = 'LArCalib'+type_run+'MonOutput_'+run+'-'+part+'.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.Input.isMC = False - ConfigFlags.DQ.useTrigger = False - ConfigFlags.LAr.doAlign=False + flags.Output.HISTFileName = 'LArCalib'+type_run+'MonOutput_'+run+'-'+part+'.root' + flags.DQ.enableLumiAccess = False + flags.Input.isMC = False + flags.DQ.useTrigger = False + flags.LAr.doAlign=False from AthenaConfiguration.Enums import BeamType - ConfigFlags.Beam.Type = BeamType.Collisions - ConfigFlags.DQ.DataType = DQDataType.Collisions + flags.Beam.Type = BeamType.Collisions + flags.DQ.DataType = DQDataType.Collisions from AthenaConfiguration.TestDefaults import defaultGeometryTags - ConfigFlags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2 - ConfigFlags.Detector.GeometryCSC=False - ConfigFlags.Detector.GeometrysTGC=False - ConfigFlags.Detector.GeometryMM=False - ConfigFlags.Exec.OutputLevel=DEBUG - ConfigFlags.lock() + flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2 + flags.Detector.GeometryCSC=False + flags.Detector.GeometrysTGC=False + flags.Detector.GeometryMM=False + flags.Exec.OutputLevel=DEBUG + flags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg - cfg = MainServicesCfg(ConfigFlags) + cfg = MainServicesCfg(flags) from LArByteStream.LArRawCalibDataReadingConfig import LArRawCalibDataReadingCfg - cfg.merge(LArRawCalibDataReadingCfg(ConfigFlags,gain="HIGH",doAccCalibDigit=True)) + cfg.merge(LArRawCalibDataReadingCfg(flags,gain="HIGH",doAccCalibDigit=True)) - cfg.merge(LArCalibDelayMonConfig(ConfigFlags, gain="HIGH",doAccCalibDigit=True)) + cfg.merge(LArCalibDelayMonConfig(flags, gain="HIGH",doAccCalibDigit=True)) cfg.printConfig(withDetails=False) #set True for exhaustive info - ConfigFlags.dump() + flags.dump() f=open("LArCalibDelayMon_"+run+".pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArCalibPedMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArCalibPedMonAlg.py index 26113e1526357b58ca91e5e86a35646834a0434c..5f6cd77db78353f1328cb4156981f8a669ab26a2 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCalibPedMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCalibPedMonAlg.py @@ -1,32 +1,32 @@ # -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # -def LArCalibPedMonConfig(inputFlags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): +def LArCalibPedMonConfig(flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArCalibPedMonCfg') + helper = AthMonitorCfgHelper(flags,'LArCalibPedMonCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArCalibPedMonConfigCore(helper,CompFactory.LArCalibPedMonAlg,inputFlags,gain,doAccDigit,doCalibDigit,doAccCalibDigit) + LArCalibPedMonConfigCore(helper,CompFactory.LArCalibPedMonAlg,flags,gain,doAccDigit,doCalibDigit,doAccCalibDigit) rv = ComponentAccumulator() # adding LAr*Mapping algos from LArCabling.LArCablingConfig import LArFebRodMappingCfg, LArCalibIdMappingCfg - rv.merge(LArFebRodMappingCfg(inputFlags)) - rv.merge(LArCalibIdMappingCfg(inputFlags)) + rv.merge(LArFebRodMappingCfg(flags)) + rv.merge(LArCalibIdMappingCfg(flags)) # adding LArFebErrorSummary algo from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg - rv.merge(LArFebErrorSummaryMakerCfg(inputFlags)) + rv.merge(LArFebErrorSummaryMakerCfg(flags)) rv.merge(helper.result()) return rv -def LArCalibPedMonConfigCore(helper,algoinstance,inputFlags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): +def LArCalibPedMonConfigCore(helper,algoinstance,flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -129,50 +129,55 @@ def LArCalibPedMonConfigCore(helper,algoinstance,inputFlags,gain="",doAccDigit=F if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + + flags = initConfigFlags() + from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) from AthenaMonitoring.DQConfigFlags import DQDataType - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + + flags.addFlagsCategory("LArMon", addLArMonFlags) run="00404637" - ConfigFlags.Input.Files = [ + + flags.Input.Files = [ "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-32s-High-All/00404637/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW._lb0000._SFO-1._0001.data", "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-32s-High-All/00404637/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW._lb0000._SFO-2._0001.data", "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-32s-High-All/00404637/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW._lb0000._SFO-3._0001.data", "/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-32s-High-All/00404637/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW/data21_calib.00404637.calibration_LArElec-Pedestal-32s-High-All.daq.RAW._lb0000._SFO-4._0001.data"] - ConfigFlags.Output.HISTFileName = 'LArCalibPedMonOutput_'+run+'.root' + flags.Output.HISTFileName = 'LArCalibPedMonOutput_'+run+'.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.Input.isMC = False - ConfigFlags.DQ.useTrigger = False - ConfigFlags.LAr.doAlign=False + flags.DQ.enableLumiAccess = False + flags.Input.isMC = False + flags.DQ.useTrigger = False + flags.LAr.doAlign=False from AthenaConfiguration.Enums import BeamType - ConfigFlags.Beam.Type = BeamType.Collisions - ConfigFlags.DQ.DataType = DQDataType.Collisions + flags.Beam.Type = BeamType.Collisions + flags.DQ.DataType = DQDataType.Collisions from AthenaConfiguration.TestDefaults import defaultGeometryTags - ConfigFlags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2 - ConfigFlags.Detector.GeometryCSC=False - ConfigFlags.Detector.GeometrysTGC=False - ConfigFlags.Detector.GeometryMM=False - ConfigFlags.Exec.OutputLevel=DEBUG - ConfigFlags.lock() + flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2 + flags.Detector.GeometryCSC=False + flags.Detector.GeometrysTGC=False + flags.Detector.GeometryMM=False + flags.Exec.OutputLevel=DEBUG + flags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg - cfg = MainServicesCfg(ConfigFlags) + cfg = MainServicesCfg(flags) from LArByteStream.LArRawCalibDataReadingConfig import LArRawCalibDataReadingCfg - cfg.merge(LArRawCalibDataReadingCfg(ConfigFlags,gain="HIGH",doAccDigit=True)) + cfg.merge(LArRawCalibDataReadingCfg(flags,gain="HIGH",doAccDigit=True)) - cfg.merge(LArCalibPedMonConfig(ConfigFlags, gain="HIGH",doAccDigit=True)) + cfg.merge(LArCalibPedMonConfig(flags, gain="HIGH",doAccDigit=True)) cfg.printConfig(withDetails=False) #set True for exhaustive info - ConfigFlags.dump() + flags.dump() f=open("LArCalibPedMon_"+run+".pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArCoherentNoisefractionAlg.py b/LArCalorimeter/LArMonitoring/python/LArCoherentNoisefractionAlg.py index 69e7f6b130e556240ed46dabb11dc6e7cab1d295..332de3bf9bf62638be2a60f2021d7de65bb2d538 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCoherentNoisefractionAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCoherentNoisefractionAlg.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # '''@file LArCoherentNoisefractionAlg @author P. Strizenec @@ -7,27 +7,15 @@ @brief Adapted from LArNoiseCorrelationMonAlg by M. Spalla ''' - -def LArCoherentNoisefractionConfigOld(inputFlags, febsToMonitor=[], groupsToMonitor=[], isCalib=True): - - from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArCoherentNoisefractionMonAlg - - helper = AthMonitorCfgHelperOld(inputFlags, 'LArCoherentNoisefractionMonAlgCfg') - LArCoherentNoisefractionConfigCore(helper, LArCoherentNoisefractionMonAlg,inputFlags,febsToMonitor,groupsToMonitor,isCalib) - return helper.result() - -def LArCoherentNoisefractionConfig(inputFlags,febsToMonitor=[], groupsToMonitor=[], isCalib=True): +def LArCoherentNoisefractionConfig(inputFlags, groupsToMonitor=[]): from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArCoherentNoisefractionMonAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArCoherentNoisefractionMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - return LArCoherentNoisefractionConfigCore(helper, CompFactory.LArCoherentNoisefractionMonAlg,inputFlags,febsToMonitor,groupsToMonitor,isCalib) - -def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, febsToMonitor, groupsToMonitor, isCalib): - + return LArCoherentNoisefractionConfigCore(helper, CompFactory.LArCoherentNoisefractionMonAlg,inputFlags,groupsToMonitor) +def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, groupsToMonitor): from LArMonitoring.GlobalVariables import lArDQGlobals larCoherentNoisefractionMonAlg = helper.addAlgorithm(algoinstance,'larCoherentNoisefractionMonAlg') @@ -39,8 +27,14 @@ def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, febsToM #from AthenaCommon.Constants import DEBUG #larCoherentNoisefractionMonAlg.OutputLevel = DEBUG - larCoherentNoisefractionMonAlg.IsCalibrationRun = isCalib - larCoherentNoisefractionMonAlg.LArDigitContainerKey = "HIGH" + try: + larCoherentNoisefractionMonAlg.IsCalibrationRun = inputFlags.LArMon.calibRun + except AttributeError: + larCoherentNoisefractionMonAlg.IsCalibrationRun = False + try: + larCoherentNoisefractionMonAlg.LArDigitContainerKey = inputFlags.LArMon.LArDigitKey + except AttributeError: + larCoherentNoisefractionMonAlg.LArDigitContainerKey = 'FREE' larCoherentNoisefractionMonAlg.ListOfGroupNames = allGroups larCoherentNoisefractionMonAlg.GroupNchan = groupsNChan if len(groupsToMonitor) == 0: @@ -54,14 +48,10 @@ def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, febsToM customGroupstoMonitor = groupsToMonitor larCoherentNoisefractionMonAlg.GroupsToMonitor = customGroupstoMonitor - # if empty list passed, - #set custom list of FEBs to be monitored (if you want one): each FEB should be passed as a string of the form "BarrelAft01slot10" - FEBs_from_DQ_run_350440 = ["endcapAft19slot12","endcapAft19slot09","endcapAft20slot09"] - - if len(febsToMonitor) == 0: - customFEBStoMonitor=FEBs_from_DQ_run_350440 - else: - customFEBStoMonitor=febsToMonitor + try: + customFEBStoMonitor = inputFlags.LArMon.customFEBsToMonitor + except AttributeError: + customFEBStoMonitor = ["endcapAft19slot12","endcapAft19slot09","endcapAft20slot09"] #correct custom FEBs for upper-lower cases or single-digit ft and slot numbers (e.g. 3 instead of 03) from ROOT import LArStrHelper @@ -179,36 +169,41 @@ def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, febsToM if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + flags = initConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) + from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags + addLArCalibFlags(flags) #from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = ['/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-5s-High-Emec-A-RawData/00393063/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW._lb0000._SFO-1._0001.data','/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-5s-High-Emec-A-RawData/00393063/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW._lb0000._SFO-2._0001.data','/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-5s-High-Emec-A-RawData/00393063/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW._lb0000._SFO-3._0001.data','/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-5s-High-Emec-A-RawData/00393063/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW._lb0000._SFO-4._0001.data'] - ConfigFlags.Output.HISTFileName = 'LArCNFMonOutput.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.DQ.useTrigger = False + flags.Input.Files = ['/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-5s-High-Emec-A-RawData/00393063/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW._lb0000._SFO-1._0001.data','/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-5s-High-Emec-A-RawData/00393063/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW._lb0000._SFO-2._0001.data','/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-5s-High-Emec-A-RawData/00393063/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW._lb0000._SFO-3._0001.data','/eos/atlas/atlastier0/rucio/data21_calib/calibration_LArElec-Pedestal-5s-High-Emec-A-RawData/00393063/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW/data21_calib.00393063.calibration_LArElec-Pedestal-5s-High-Emec-A-RawData.daq.RAW._lb0000._SFO-4._0001.data'] + + flags.LArMon.calibRun = True + flags.Output.HISTFileName = 'LArCNFMonOutput.root' + flags.DQ.enableLumiAccess = False + flags.DQ.useTrigger = False + from AthenaConfiguration.Enums import BeamType - ConfigFlags.Beam.Type = BeamType.Collisions - ConfigFlags.lock() + flags.Beam.Type = BeamType.Collisions + flags.lock() from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg=ComponentAccumulator() from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg - cfg.merge(LArRawDataReadingCfg(ConfigFlags,LArDigitKey="HIGH",LArRawChannelKey="")) + cfg.merge(LArRawDataReadingCfg(flags,LArDigitKey="HIGH",LArRawChannelKey="")) # for calib digits: #from LArByteStream.LArRawCalibDataReadingConfig import LArRawCalibDataReadingCfg - #cfg.merge(LArRawCalibDataReadingCfg(ConfigFlags,gain="HIGH",doCalibDigit=True)) + #cfg.merge(LArRawCalibDataReadingCfg(flags,gain="HIGH",doCalibDigit=True)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg - cfg.merge(LArOnOffIdMappingCfg(ConfigFlags)) + cfg.merge(LArOnOffIdMappingCfg(flags)) from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg - cfg.merge(LArElecCalibDBCfg(ConfigFlags,["Pedestal"])) + cfg.merge(LArElecCalibDBCfg(flags,["Pedestal"])) feblist=[] for ft in [11,12,23,24]: @@ -217,13 +212,13 @@ if __name__=='__main__': feblist += ['EndcapAft'+str(ft)+'slot0'+str(slot)] else: feblist += ['EndcapAft'+str(ft)+'slot'+str(slot)] - aff_acc = LArCoherentNoisefractionConfig(ConfigFlags,feblist) + aff_acc = LArCoherentNoisefractionConfig(flags,feblist) cfg.merge(aff_acc) cfg.printConfig() log.setLevel(DEBUG) - ConfigFlags.dump() + flags.dump() f=open("LArCNFMon.pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArCosmicsMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArCosmicsMonAlg.py index 24779aac18aa6cded58381a3b4d39123e9a24313..e3d1124e1bd4d0c3b37920adb2c1a59285d3b220 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCosmicsMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCosmicsMonAlg.py @@ -1,33 +1,24 @@ # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # - -def LArCosmicsMonConfigOld(inputFlags): - from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArCosmicsMonAlg - - helper = AthMonitorCfgHelperOld(inputFlags, 'LArCosmicsMonAlgOldCfg') - LArCosmicsMonConfigCore(helper, LArCosmicsMonAlg,inputFlags) - return helper.result() - -def LArCosmicsMonConfig(inputFlags): +def LArCosmicsMonConfig(flags): '''Function to configures some algorithms in the monitoring system.''' # The following class will make a sequence, configure algorithms, and link # them to GenericMonitoringTools from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArCosmicsMonAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArCosmicsMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArCosmicsMonConfigCore(helper, CompFactory.LArCosmicsMonAlg,inputFlags) + LArCosmicsMonConfigCore(helper, CompFactory.LArCosmicsMonAlg,flags) return helper.result() -def LArCosmicsMonConfigCore(helper, algoinstance,inputFlags): +def LArCosmicsMonConfigCore(helper, algoinstance,flags): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -81,33 +72,34 @@ def LArCosmicsMonConfigCore(helper, algoinstance,inputFlags): if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from AthenaCommon.Logging import log from AthenaCommon.Constants import WARNING log.setLevel(WARNING) - - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.Output.HISTFileName = 'LArCosmicsMonOutput.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.DQ.useTrigger = False - ConfigFlags.lock() + flags.Output.HISTFileName = 'LArCosmicsMonOutput.root' + flags.DQ.enableLumiAccess = False + flags.DQ.useTrigger = False + flags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(ConfigFlags) + cfg=CaloRecoCfg(flags) from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - cfg.merge(LArNoisyROSummaryCfg(ConfigFlags)) + cfg.merge(LArNoisyROSummaryCfg(flags)) - cosm_acc = LArCosmicsMonConfig(ConfigFlags) + cosm_acc = LArCosmicsMonConfig(flags) cfg.merge(cosm_acc) - ConfigFlags.dump() + flags.dump() f=open("LArCosmicsMon.pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py b/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py index 6b8fff0eea3dbb1c0219e5f42cea57e09128069d..e772c233d9d07288d1d0add0d5811f0910706c17 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # '''@file LArCoverageAlg @@ -7,14 +7,6 @@ @date 2019-07-24 @brief Adapted from ExampleLArMonitorAlgorithm.py by C. D. Burton and P. Onyisi ''' -def LArCoverageConfigOld(flags): - from AthenaMonitoring import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArCoverageAlg - - helper = AthMonitorCfgHelperOld(flags, 'LArCoverageAlgOldCfg') - LArCoverageConfigCore(helper,LArCoverageAlg,flags) - - return helper.result() def LArCoverageConfig(flags): '''Function to configures some algorithms in the monitoring system.''' @@ -513,25 +505,26 @@ def LArCoverageConfigCore(helper, algoinstance,flags): if __name__=='__main__': # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import ConfigFlags - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.DQ.useTrigger = False + flags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.DQ.useTrigger = False - ConfigFlags.Output.HISTFileName = 'LArCoverageOutput.root' - ConfigFlags.lock() + flags.Output.HISTFileName = 'LArCoverageOutput.root' + flags.lock() # Cell building from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(ConfigFlags) + cfg=CaloRecoCfg(flags) - larCoverageAcc = LArCoverageConfig(ConfigFlags) + larCoverageAcc = LArCoverageConfig(flags) cfg.merge(larCoverageAcc) - ConfigFlags.dump() + flags.dump() f=open("CoverageMaker.pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py index 3208ae9b4734353cf109bc1a76a94cf899d0a2aa..25caf5be2b721a64aba8875b65953061c664e7e8 100644 --- a/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py @@ -1,28 +1,20 @@ # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # -def LArDigitMonConfigOld(inputFlags): - from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArDigitMonAlg - - helper = AthMonitorCfgHelperOld(inputFlags, 'LArDigitMonAlgCfg') - LArDigitMonConfigCore(helper, LArDigitMonAlg,inputFlags) - return helper.result() - -def LArDigitMonConfig(inputFlags): +def LArDigitMonConfig(flags): '''Function to configures some algorithms in the monitoring system.''' # The following class will make a sequence, configure algorithms, and link # them to GenericMonitoringTools from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArDigitMonAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArDigitMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - return LArDigitMonConfigCore(helper, CompFactory.LArDigitMonAlg,inputFlags) + return LArDigitMonConfigCore(helper, CompFactory.LArDigitMonAlg,flags) -def LArDigitMonConfigCore(helper, algoinstance,inputFlags): +def LArDigitMonConfigCore(helper, algoinstance,flags): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -192,34 +184,35 @@ def LArDigitMonConfigCore(helper, algoinstance,inputFlags): if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.Output.HISTFileName = 'LArDigitsMonOutput.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.DQ.useTrigger = False - ConfigFlags.lock() + flags.Output.HISTFileName = 'LArDigitsMonOutput.root' + flags.DQ.enableLumiAccess = False + flags.DQ.useTrigger = False + flags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(ConfigFlags) + cfg=CaloRecoCfg(flags) from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - cfg.merge(LArNoisyROSummaryCfg(ConfigFlags)) + cfg.merge(LArNoisyROSummaryCfg(flags)) # from LArMonitoring.LArDigitMonAlg import LArDigitMonConfig - aff_acc = LArDigitMonConfig(ConfigFlags) + aff_acc = LArDigitMonConfig(flags) cfg.merge(aff_acc) - ConfigFlags.dump() + flags.dump() f=open("LArDigitMon.pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py index f9e8d1cad31a1487477f2b952a19318903dc230d..6da525fac4f5c2f29b99d9c6e7d0c60c6ffd68ab 100644 --- a/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py @@ -1,34 +1,25 @@ # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # -def LArFEBMonConfigOld(inputFlags, cellDebug=False, dspDebug=False): - from AthenaMonitoring import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArFEBMonAlg - helper = AthMonitorCfgHelperOld(inputFlags, 'LArFEBMonAlgOldCfg') - LArFEBMonConfigCore(helper, LArFEBMonAlg,inputFlags,cellDebug, dspDebug) - - return helper.result() - - -def LArFEBMonConfig(inputFlags, cellDebug=False, dspDebug=False): +def LArFEBMonConfig(flags, cellDebug=False, dspDebug=False): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArFEBMonAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArFEBMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArFEBMonConfigCore(helper, CompFactory.LArFEBMonAlg,inputFlags,cellDebug, dspDebug) + LArFEBMonConfigCore(helper, CompFactory.LArFEBMonAlg,flags,cellDebug, dspDebug) rv = ComponentAccumulator() # adding LArFebErrorSummary algo from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg - rv.merge(LArFebErrorSummaryMakerCfg(inputFlags)) + rv.merge(LArFebErrorSummaryMakerCfg(flags)) rv.merge(helper.result()) return rv -def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebug=False): +def LArFEBMonConfigCore(helper,algoinstance,flags, cellDebug=False, dspDebug=False): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -47,7 +38,7 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu isCOMP200=False from AthenaConfiguration.ComponentFactory import isComponentAccumulatorCfg if isComponentAccumulatorCfg(): - if "COMP200" in inputFlags.IOVDb.DatabaseInstance: + if "COMP200" in flags.IOVDb.DatabaseInstance: isCOMP200=True else: from IOVDbSvc.CondDB import conddb @@ -69,7 +60,7 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu pass if not havethem: from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg - helper.resobj.merge(IOVDbSvcCfg(inputFlags)) + helper.resobj.merge(IOVDbSvcCfg(flags)) condLoader=helper.resobj.getCondAlgo("CondInputLoader") iovDbSvc=helper.resobj.getService("IOVDbSvc") else: @@ -88,7 +79,7 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu obj='LArDSPThresholdsComplete' if isComponentAccumulatorCfg(): from IOVDbSvc.IOVDbSvcConfig import addFolders - helper.resobj.merge(addFolders(inputFlags,fld,db,obj)) + helper.resobj.merge(addFolders(flags,fld,db,obj)) else: conddb.addFolder (db, fld, className=obj) larFEBMonAlg.Run1DSPThresholdsKey = 'LArDSPThresholds' @@ -210,7 +201,7 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu isOnline=False if isComponentAccumulatorCfg() : - if inputFlags.DQ.Environment == 'online': + if flags.DQ.Environment == 'online': isOnline=True else: from AthenaCommon.AthenaCommonFlags import athenaCommonFlags @@ -419,36 +410,37 @@ def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebu if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.Output.HISTFileName = 'LArFEBMonOutput.root' - ConfigFlags.DQ.enableLumiAccess = True - ConfigFlags.DQ.useTrigger = False - ConfigFlags.lock() + flags.Output.HISTFileName = 'LArFEBMonOutput.root' + flags.DQ.enableLumiAccess = True + flags.DQ.useTrigger = False + flags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(ConfigFlags) + cfg=CaloRecoCfg(flags) #from CaloD3PDMaker.CaloD3PDConfig import CaloD3PDCfg,CaloD3PDAlg - #cfg.merge(CaloD3PDCfg(ConfigFlags, filename=ConfigFlags.Output.HISTFileName, streamname='CombinedMonitoring')) + #cfg.merge(CaloD3PDCfg(flags, filename=flags.Output.HISTFileName, streamname='CombinedMonitoring')) - aff_acc = LArFEBMonConfig(ConfigFlags) + aff_acc = LArFEBMonConfig(flags) cfg.merge(aff_acc) cfg.printConfig() - ConfigFlags.dump() + flags.dump() f=open("LArFEBMon.pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArHVCorrMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArHVCorrMonAlg.py index 44136873c34dd04b010024bcad7f5d9dbc73e098..c4f1a68ee9df38b06359f6c788da1714d74bff55 100644 --- a/LArCalorimeter/LArMonitoring/python/LArHVCorrMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArHVCorrMonAlg.py @@ -1,38 +1,25 @@ # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # -def LArHVCorrMonConfigOld(inputFlags): - - from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArHVCorrectionMonAlg - - helper = AthMonitorCfgHelperOld(inputFlags, 'LArHVCorrMonAlgOldCfg') - LArHVCorrMonConfigCore(helper, LArHVCorrectionMonAlg, inputFlags) - - from LArConditionsCommon import LArHVDB # noqa: F401 - - return helper.result() - -def LArHVCorrMonConfig(inputFlags): - +def LArHVCorrMonConfig(flags): from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArHVCorrMonAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArHVCorrMonAlgCfg') from LArGeoAlgsNV.LArGMConfig import LArGMCfg - acc = LArGMCfg(inputFlags) + acc = LArGMCfg(flags) from TileGeoModel.TileGMConfig import TileGMCfg - acc.merge(TileGMCfg(inputFlags)) + acc.merge(TileGMCfg(flags)) from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg - acc.merge(LArHVScaleCfg(inputFlags)) + acc.merge(LArHVScaleCfg(flags)) from AthenaConfiguration.ComponentFactory import CompFactory - LArHVCorrMonConfigCore(helper, CompFactory.LArHVCorrectionMonAlg, inputFlags) + LArHVCorrMonConfigCore(helper, CompFactory.LArHVCorrectionMonAlg, flags) acc.merge(helper.result()) return acc -def LArHVCorrMonConfigCore(helper, algoinstance,inputFlags): +def LArHVCorrMonConfigCore(helper, algoinstance,flags): larHVCorrAlg = helper.addAlgorithm(algoinstance,'larHVCorrMonAlg') @@ -204,21 +191,23 @@ def LArHVCorrMonConfigCore(helper, algoinstance,inputFlags): if __name__=='__main__': # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/' file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1' - ConfigFlags.Input.Files = [nightly+file] - ConfigFlags.Input.isMC = False - ConfigFlags.Output.HISTFileName = 'LArHVCorrMonOutput.root' - ConfigFlags.lock() + flags.Input.Files = [nightly+file] + flags.Input.isMC = False + flags.Output.HISTFileName = 'LArHVCorrMonOutput.root' + flags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - cfg = MainServicesCfg(ConfigFlags) - cfg.merge(PoolReadCfg(ConfigFlags)) + cfg = MainServicesCfg(flags) + cfg.merge(PoolReadCfg(flags)) - cfg.merge(LArHVCorrMonConfig(ConfigFlags)) + cfg.merge(LArHVCorrMonConfig(flags)) Nevents=10 cfg.run(Nevents) #use cfg.run() to run on all events diff --git a/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py index dc163ab042c961f0a469a3c5f9cf0e8f18bbdce9..bfca2c7d067bfe84d67f0d74166c7c89907303a0 100644 --- a/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py @@ -1,30 +1,19 @@ - # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # - - -def LArNoiseCorrelationMonConfigOld(inputFlags): - from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArNoiseCorrelationMonAlg - - helper = AthMonitorCfgHelperOld(inputFlags, 'LArNoiseCorrelationMonAlgCfg') - LArNoiseCorrelationMonConfigCore(helper, LArNoiseCorrelationMonAlg,inputFlags) - return helper.result() - -def LArNoiseCorrelationMonConfig(inputFlags): +def LArNoiseCorrelationMonConfig(flags): '''Function to configures some algorithms in the monitoring system.''' # The following class will make a sequence, configure algorithms, and link # them to GenericMonitoringTools from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArNoiseCorrelationMonAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArNoiseCorrelationMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - return LArNoiseCorrelationMonConfigCore(helper, CompFactory.LArNoiseCorrelationMonAlg,inputFlags) + return LArNoiseCorrelationMonConfigCore(helper, CompFactory.LArNoiseCorrelationMonAlg,flags) -def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): +def LArNoiseCorrelationMonConfigCore(helper, algoinstance,flags): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -32,9 +21,11 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): larNoiseCorrelMonAlg = helper.addAlgorithm(algoinstance,'larNoiseCorrelMonAlg') #set custom list of FEBs to be monitored (if you want one): each FEB should be passed as a string of the form "BarrelAft01slot10" - FEBs_from_DQ_run_350440 = ["endcapAft19slot12","endcapAft19slot09","endcapAft20slot09"] - customFEBStoMonitor=FEBs_from_DQ_run_350440 + try: + customFEBStoMonitor = flags.LArMon.customFEBsToMonitor + except AttributeError: + customFEBStoMonitor = ["endcapAft19slot12","endcapAft19slot09","endcapAft20slot09"] #correct custom FEBs for upper-lower cases or single-digit ft and slot numbers (e.g. 3 instead of 03) @@ -48,7 +39,7 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): if isComponentAccumulatorCfg(): - if inputFlags.DQ.Environment == 'online': + if flags.DQ.Environment == 'online': isOnline=True else: from AthenaCommon.AthenaCommonFlags import athenaCommonFlags @@ -57,7 +48,7 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): isOnline=False #needed later if isComponentAccumulatorCfg() : - if inputFlags.DQ.Environment == 'online': + if flags.DQ.Environment == 'online': isOnline=True else : from AthenaCommon.AthenaCommonFlags import athenaCommonFlags @@ -67,7 +58,14 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): larNoiseCorrelMonAlg.ProblemsToMask=["deadReadout","deadPhys","short","almostDead","highNoiseHG","highNoiseMG","highNoiseLG","sporadicBurstNoise"] larNoiseCorrelMonAlg.IgnoreBadChannels=True larNoiseCorrelMonAlg.TriggerChain = "HLT_noalg_zb_L1ZB, HLT_noalg_cosmiccalo_L1RD1_EMPTY" #turn off for calibration run - larNoiseCorrelMonAlg.IsCalibrationRun = False + try: + larNoiseCorrelMonAlg.IsCalibrationRun = flags.LArMon.calibRun + except AttributeError: + larNoiseCorrelMonAlg.IsCalibrationRun = False + try: + larNoiseCorrelMonAlg.LArDigitContainerKey = flags.LArMon.LArDigitKey + except AttributeError: + larNoiseCorrelMonAlg.LArDigitContainerKey = 'FREE' #deal with custom febs to monitor (if any) if len(customFEBStoMonitor)==0: @@ -194,36 +192,37 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.Output.HISTFileName = 'LArNoiseCorrMonOutput.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.DQ.useTrigger = False - ConfigFlags.lock() + flags.Output.HISTFileName = 'LArNoiseCorrMonOutput.root' + flags.DQ.enableLumiAccess = False + flags.DQ.useTrigger = False + flags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(ConfigFlags) + cfg=CaloRecoCfg(flags) from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - cfg.merge(LArNoisyROSummaryCfg(ConfigFlags)) + cfg.merge(LArNoisyROSummaryCfg(flags)) # from LArMonitoring.LArNoiseCorrelationMonAlg import LArNoiseCorrelationMonConfig - aff_acc = LArNoiseCorrelationMonConfig(ConfigFlags) + aff_acc = LArNoiseCorrelationMonConfig(flags) cfg.merge(aff_acc) log.setLevel(DEBUG) - ConfigFlags.dump() + flags.dump() f=open("LArNoiseCorrelationMon.pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py index 7269edd6c84976e64a6a6d0bfa6f6fea08c717ab..2c70b55641c9ec4d4e58330b3d0cca52ea2e28bb 100644 --- a/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py @@ -1,47 +1,26 @@ # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # -def LArNoisyROMonConfig(inputFlags, inKey="", +def LArNoisyROMonConfig(flags, inKey="", NoisyFEBDefStr="(>30 chan with Q>4000)", MNBTightFEBDefStr="", MNBTight_PsVetoFEBDefStr="", MNBLooseFEBDefStr=""): from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArNoisyROMonAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArNoisyROMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - NoisyFEBDefStr="(>"+str(inputFlags.LAr.NoisyRO.BadChanPerFEB)+" chan with Q>"+str(inputFlags.LAr.NoisyRO.CellQuality)+")" - MNBTightFEBDefStr="(>"+str(inputFlags.LAr.NoisyRO.MNBTightCut)+" chan with Q>"+str(inputFlags.LAr.NoisyRO.CellQuality)+")" - MNBTight_PsVetoFEBDefStr="(>"+str(inputFlags.LAr.NoisyRO.MNBTight_PsVetoCut[0])+" chan with Q>"+str(inputFlags.LAr.NoisyRO.CellQuality)+") + PS veto (<"+str(inputFlags.LAr.NoisyRO.MNBTight_PsVetoCut[1])+" channels)" - MNBLooseFEBDefStr="(>"+str(inputFlags.LAr.NoisyRO.MNBLooseCut)+" chan with Q>"+str(inputFlags.LAr.NoisyRO.CellQuality)+")" + NoisyFEBDefStr="(>"+str(flags.LAr.NoisyRO.BadChanPerFEB)+" chan with Q>"+str(flags.LAr.NoisyRO.CellQuality)+")" + MNBTightFEBDefStr="(>"+str(flags.LAr.NoisyRO.MNBTightCut)+" chan with Q>"+str(flags.LAr.NoisyRO.CellQuality)+")" + MNBTight_PsVetoFEBDefStr="(>"+str(flags.LAr.NoisyRO.MNBTight_PsVetoCut[0])+" chan with Q>"+str(flags.LAr.NoisyRO.CellQuality)+") + PS veto (<"+str(flags.LAr.NoisyRO.MNBTight_PsVetoCut[1])+" channels)" + MNBLooseFEBDefStr="(>"+str(flags.LAr.NoisyRO.MNBLooseCut)+" chan with Q>"+str(flags.LAr.NoisyRO.CellQuality)+")" - return LArNoisyROMonConfigCore(helper,CompFactory.LArNoisyROMonAlg, inputFlags, inKey, NoisyFEBDefStr, MNBTightFEBDefStr, MNBTight_PsVetoFEBDefStr, MNBLooseFEBDefStr) + return LArNoisyROMonConfigCore(helper,CompFactory.LArNoisyROMonAlg, flags, inKey, NoisyFEBDefStr, MNBTightFEBDefStr, MNBTight_PsVetoFEBDefStr, MNBLooseFEBDefStr) -def LArNoisyROMonConfigOld(inputFlags, inKey="", - NoisyFEBDefStr="", - MNBTightFEBDefStr="", - MNBTight_PsVetoFEBDefStr="", - MNBLooseFEBDefStr=""): - - from LArCellRec.LArNoisyROFlags import larNoisyROFlags - NoisyFEBDefStr = '(>'+str(larNoisyROFlags.BadChanPerFEB())+' chan with Q>'+str(larNoisyROFlags.CellQualityCut())+')' - MNBTightFEBDefStr = '(>'+str(larNoisyROFlags.MNBTightCut())+' chan with Q>'+str(larNoisyROFlags.CellQualityCut())+')' - MNBTight_PsVetoFEBDefStr = '(>'+str(larNoisyROFlags.MNBTight_PsVetoCut()[0])+' chan with Q>'+str(larNoisyROFlags.CellQualityCut())+') + PS veto (<'+str(larNoisyROFlags.MNBTight_PsVetoCut()[1])+' channels)' - MNBLooseFEBDefStr = '(>'+str(larNoisyROFlags.MNBLooseCut())+' chan with Q>'+str(larNoisyROFlags.CellQualityCut())+')' - from AthenaMonitoring import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArNoisyROMonAlg - helper = AthMonitorCfgHelperOld(inputFlags,'LArNoisyROMonAlgOldCfg') - - LArNoisyROMonConfigCore(helper,LArNoisyROMonAlg, inputFlags, inKey, NoisyFEBDefStr, MNBTightFEBDefStr, MNBTight_PsVetoFEBDefStr, MNBLooseFEBDefStr) - - return helper.result() - - - -def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, +def LArNoisyROMonConfigCore(helper,algoinstance,flags, inKey="", NoisyFEBDefStr="(>30 chan with Q>4000)", MNBTightFEBDefStr="", @@ -54,8 +33,8 @@ def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg=ComponentAccumulator() from LArBadChannelTool.LArBadFebsConfig import LArKnownBadFebCfg, LArKnownMNBFebCfg - cfg.merge(LArKnownBadFebCfg(inputFlags)) - cfg.merge(LArKnownMNBFebCfg(inputFlags)) + cfg.merge(LArKnownBadFebCfg(flags)) + cfg.merge(LArKnownMNBFebCfg(flags)) larNoisyROMonAlg = helper.addAlgorithm(algoinstance,'larNoisyROMonAlg') @@ -67,8 +46,7 @@ def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, larNoisyROMonAlg.SubDetNames=lArDQGlobals.SubDet[0:2] larNoisyROMonAlg.PartitionNames=lArDQGlobals.Partitions[0:4] - #FIXME: True only for testing - larNoisyROMonAlg.storeLooseMNBFEBs=False + larNoisyROMonAlg.storeLooseMNBFEBs=True if inKey != "": larNoisyROMonAlg.inputKey=inKey @@ -105,10 +83,10 @@ def LArNoisyROMonConfigCore(helper,algoinstance,inputFlags, ] doTrigger=False if isComponentAccumulatorCfg(): - if inputFlags.DQ.useTrigger or LArNoisyROMonForceTrigger: + if flags.DQ.useTrigger or LArNoisyROMonForceTrigger: doTrigger=True else: - if inputFlags.doHLTMon or LArNoisyROMonForceTrigger: + if flags.doHLTMon or LArNoisyROMonForceTrigger: doTrigger=True if doTrigger: @@ -277,47 +255,48 @@ if __name__=='__main__': from AthenaCommon.Logging import log log.setLevel(DEBUG) - # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import ConfigFlags - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q431/21.0/v1/' file = 'myESD.pool.root' - ConfigFlags.Input.Files = [nightly+file] - ConfigFlags.Input.isMC = False - ConfigFlags.DQ.useTrigger = True + + flags.Input.Files = [nightly+file] + flags.Input.isMC = False + flags.DQ.useTrigger = True - ConfigFlags.Output.HISTFileName = 'LArNoisyROMonitoringOutput.root' + flags.Output.HISTFileName = 'LArNoisyROMonitoringOutput.root' - ConfigFlags.Exec.OutputLevel=DEBUG - ConfigFlags.lock() + flags.Exec.OutputLevel=DEBUG + flags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - cfg = MainServicesCfg(ConfigFlags) - cfg.merge(PoolReadCfg(ConfigFlags)) + cfg = MainServicesCfg(flags) + cfg.merge(PoolReadCfg(flags)) # try NoisyRO algo #first geometry from LArGeoAlgsNV.LArGMConfig import LArGMCfg from TileGeoModel.TileGMConfig import TileGMCfg - cfg.merge(LArGMCfg(ConfigFlags)) - cfg.merge(TileGMCfg(ConfigFlags)) + cfg.merge(LArGMCfg(flags)) + cfg.merge(TileGMCfg(flags)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg - cfg.merge(LArOnOffIdMappingCfg(ConfigFlags)) + cfg.merge(LArOnOffIdMappingCfg(flags)) # then NoisyROSummary creator from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - noisyROSumm = LArNoisyROSummaryCfg(ConfigFlags) + noisyROSumm = LArNoisyROSummaryCfg(flags) noisyROSumm.getEventAlgo("LArNoisyROAlg").OutputKey="LArNoisyROSummary_recomputed" cfg.merge(noisyROSumm) # then monitoring algo - noisemon=LArNoisyROMonConfig(ConfigFlags, inKey="LArNoisyROSummary_recomputed") + noisemon=LArNoisyROMonConfig(flags, inKey="LArNoisyROSummary_recomputed") cfg.merge(noisemon) - ConfigFlags.dump() + flags.dump() f=open("NoisyROMonMaker.pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py index ce9a2d2f67c95e321bff8aa9a32015dac7232d7c..038500dbe109c19e18c6697f4829eca7be68ac3e 100644 --- a/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py @@ -1,30 +1,20 @@ # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # -def LArRODMonConfigOld(inputFlags,cellDebug=False, dspDebug=False): - from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArRODMonAlg - - helper = AthMonitorCfgHelperOld(inputFlags, 'LArRODMonALgOldCfg') - LArRODMonConfigCore(helper, LArRODMonAlg,inputFlags,cellDebug, dspDebug) - - return helper.result() - -def LArRODMonConfig(inputFlags,cellDebug=False, dspDebug=False): - +def LArRODMonConfig(flags,cellDebug=False, dspDebug=False): from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArRODMonAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArRODMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArRODMonConfigCore(helper, CompFactory.LArRODMonAlg,inputFlags,cellDebug, dspDebug) + LArRODMonConfigCore(helper, CompFactory.LArRODMonAlg,flags,cellDebug, dspDebug) return helper.result() -def LArRODMonConfigCore(helper, algoinstance,inputFlags, cellDebug=False, dspDebug=False): +def LArRODMonConfigCore(helper, algoinstance,flags, cellDebug=False, dspDebug=False): larRODMonAlg = helper.addAlgorithm(algoinstance,'larRODMonAlg') @@ -52,7 +42,7 @@ def LArRODMonConfigCore(helper, algoinstance,inputFlags, cellDebug=False, dspDeb if dspDebug: larRODMonAlg.DoDspTestDump=True - if inputFlags.Common.isOnline: + if flags.Common.isOnline: larRODMonAlg.MaxEvDump=100 #from AthenaCommon.Constants import VERBOSE @@ -216,36 +206,37 @@ def LArRODMonConfigCore(helper, algoinstance,inputFlags, cellDebug=False, dspDeb if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.Output.HISTFileName = 'LArRODMonOutput.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.DQ.useTrigger = False - ConfigFlags.lock() + flags.Output.HISTFileName = 'LArRODMonOutput.root' + flags.DQ.enableLumiAccess = False + flags.DQ.useTrigger = False + flags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(ConfigFlags) + cfg=CaloRecoCfg(flags) #from CaloD3PDMaker.CaloD3PDConfig import CaloD3PDCfg,CaloD3PDAlg - #cfg.merge(CaloD3PDCfg(ConfigFlags, filename=ConfigFlags.Output.HISTFileName, streamname='CombinedMonitoring')) + #cfg.merge(CaloD3PDCfg(flags, filename=flags.Output.HISTFileName, streamname='CombinedMonitoring')) - aff_acc = LArRODMonConfig(ConfigFlags) + aff_acc = LArRODMonConfig(flags) cfg.merge(aff_acc) cfg.printConfig() - ConfigFlags.dump() + flags.dump() f=open("LArRODMon.pkl","wb") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArRawChannelMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArRawChannelMonAlg.py index d867f6df632c1ba702424efff0964cae74820d78..b77ea8198d3c893836ce87e832f8917ec99480b2 100644 --- a/LArCalorimeter/LArMonitoring/python/LArRawChannelMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArRawChannelMonAlg.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # """!@file LArRawChannelMonAlg.py @@ -15,55 +15,33 @@ from GaudiKernel.SystemOfUnits import MeV, GeV _USE_LEGACY_BINNING_IN_ENDCAPS = True -def LArRawChannelMonConfigOld(inputFlags): - from AthenaMonitoring import AthMonitorCfgHelperOld - from AthenaMonitoring.DQMonFlags import DQMonFlags - from AthenaCommon.BeamFlags import jobproperties - from LArMonitoring.LArMonitoringConf import LArRawChannelMonAlg - cosmics = jobproperties.Beam.beamType() == 'cosmics' - stream = _get_stream(DQMonFlags) - from LArMonTools.LArMonFlags import LArMonFlags - signal = LArMonFlags.doLArRawMonitorSignal() - helper = AthMonitorCfgHelperOld(inputFlags, 'LArRawChannelMonAlgOldCfg') - alg = LArRawChannelMonConfigCore( - helper, instance=LArRawChannelMonAlg, inputFlags=inputFlags, - cosmics=cosmics, stream=stream, doSignal=signal) - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - if not athenaCommonFlags.isOnline(): - from AthenaCommon.AlgSequence import AthSequencer - #if not hasattr (condSeq,"Calo_"+alg.NoiseKey+"Alg"): - if len([_ for _ in AthSequencer("AthCondSeq") if _.getName()=="Calo_"+str(alg.NoiseKey)+"Alg"]) == 0: - from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg - CaloNoiseCondAlg(noisetype=alg.NoiseKey.Path) - from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool - alg.AtlasReadyFilterTool = [GetAtlasReadyFilterTool()] - return helper.result() - - -def LArRawChannelMonConfig(inputFlags): +def LArRawChannelMonConfig(flags): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from AthenaMonitoring import AthMonitorCfgHelper from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg from AthenaMonitoring.AtlasReadyFilterConfig import AtlasReadyFilterCfg from AthenaConfiguration.Enums import BeamType - cosmics = (inputFlags.Beam.Type is BeamType.Cosmics) - stream = _get_stream(inputFlags.DQ) - signal = inputFlags.LArMon.doLArRawMonitorSignal - helper = AthMonitorCfgHelper(inputFlags, 'LArRawChannelMonAlgCfg') + cosmics = (flags.Beam.Type is BeamType.Cosmics) + stream = _get_stream(flags.DQ) + try: + signal = flags.LArMon.doLArRawMonitorSignal + except AttributeError: + signal = False + helper = AthMonitorCfgHelper(flags, 'LArRawChannelMonAlgCfg') alg = LArRawChannelMonConfigCore( helper, instance=CompFactory.LArRawChannelMonAlg, - inputFlags=inputFlags, cosmics=cosmics, stream=stream, doSignal=signal) - noise_alg = CaloNoiseCondAlgCfg(inputFlags, noisetype=alg.NoiseKey.Path) + flags=flags, cosmics=cosmics, stream=stream, doSignal=signal) + noise_alg = CaloNoiseCondAlgCfg(flags, noisetype=alg.NoiseKey.Path) accumulator = ComponentAccumulator() accumulator.merge(noise_alg) alg.AtlasReadyFilterTool.append( - accumulator.popToolsAndMerge(AtlasReadyFilterCfg(inputFlags))) + accumulator.popToolsAndMerge(AtlasReadyFilterCfg(flags))) accumulator.merge(helper.result()) return accumulator -def LArRawChannelMonConfigCore(helper, instance, inputFlags, cosmics, stream, doSignal): +def LArRawChannelMonConfigCore(helper, instance, flags, cosmics, stream, doSignal): alg = helper.addAlgorithm(instance, 'LArRawChannelMonAlg') alg.occupancy_thresholds = [ 100 * MeV, # EMBA @@ -126,7 +104,7 @@ def LArRawChannelMonConfigCore(helper, instance, inputFlags, cosmics, stream, do alg.db_and_ofc_only = True from LArConfiguration.LArConfigFlags import RawChannelSource - if inputFlags.LAr.RawChannelSource is RawChannelSource.Calculated: + if flags.LAr.RawChannelSource is RawChannelSource.Calculated: alg.LArRawChannelContainerKey="LArRawChannels_FromDigits" # Histograms for different partitions are handled together via a @@ -328,26 +306,28 @@ def _superslot_channel_axis_ranges(partition): if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from AthenaCommon.Logging import log from AthenaCommon.Constants import WARNING log.setLevel(WARNING) - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.Enums import BeamType - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.Output.HISTFileName = 'LArRawChannelMonOutput.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.DQ.useTrigger = False - ConfigFlags.Beam.Type = BeamType.Collisions - ConfigFlags.lock() + flags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.Output.HISTFileName = 'LArRawChannelMonOutput.root' + flags.DQ.enableLumiAccess = False + flags.DQ.useTrigger = False + flags.Beam.Type = BeamType.Collisions + flags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg = CaloRecoCfg(ConfigFlags) - acc = LArRawChannelMonConfig(ConfigFlags) + cfg = CaloRecoCfg(flags) + acc = LArRawChannelMonConfig(flags) cfg.merge(acc) f = open("LArRawChannelMon.pkl", "wb") cfg.store(f) diff --git a/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py b/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py index 93075ee91eb3a2aab18dfd0efff539fd5bb538a9..9a231fd46cc3e5067f028d7e5cc21a012391bd64 100644 --- a/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py +++ b/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py @@ -1,63 +1,64 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration if __name__=="__main__": - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - - from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags - createLArMonConfigFlags() + from LArMonitoring.LArMonConfigFlags import addLArMonFlags + flags.addFlagsCategory("LArMon", addLArMonFlags) from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.Output.HISTFileName = 'LArMonitoringOutput.root' - ConfigFlags.DQ.enableLumiAccess = False - ConfigFlags.DQ.useTrigger = False - ConfigFlags.lock() + flags.Output.HISTFileName = 'LArMonitoringOutput.root' + flags.DQ.enableLumiAccess = False + flags.DQ.useTrigger = False + flags.lock() ## Cell building from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(ConfigFlags) + cfg=CaloRecoCfg(flags) #larCoverage monitoring from LArMonitoring.LArCoverageAlg import LArCoverageConfig - cov_acc = LArCoverageConfig(ConfigFlags) + cov_acc = LArCoverageConfig(flags) cfg.merge(cov_acc) #affectedRegions monitoring from LArMonitoring.LArAffectedRegionsAlg import LArAffectedRegionsConfig - aff_acc = LArAffectedRegionsConfig(ConfigFlags) + aff_acc = LArAffectedRegionsConfig(flags) cfg.merge(aff_acc) #collision time algo from LArCellRec.LArCollisionTimeConfig import LArCollisionTimeCfg - cfg.merge(LArCollisionTimeCfg(ConfigFlags, cutIteration=False)) + cfg.merge(LArCollisionTimeCfg(flags, cutIteration=False)) # and collision time monitoring algo from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfig - collmon=LArCollisionTimeMonConfig(ConfigFlags) + collmon=LArCollisionTimeMonConfig(flags) cfg.merge(collmon) #ROD monitoring from LArMonitoring.LArRODMonAlg import LArRODMonConfig - rodmon = LArRODMonConfig(ConfigFlags) + rodmon = LArRODMonConfig(flags) cfg.merge(rodmon) #Digit monitoring from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - cfg.merge(LArNoisyROSummaryCfg(ConfigFlags)) + cfg.merge(LArNoisyROSummaryCfg(flags)) from LArMonitoring.LArDigitMonAlg import LArDigitMonConfig - digimon = LArDigitMonConfig(ConfigFlags) + digimon = LArDigitMonConfig(flags) cfg.merge(digimon) - ConfigFlags.dump() + flags.dump() f=open("LArMonMaker.pkl","w") cfg.store(f) f.close() diff --git a/LArCalorimeter/LArMonitoring/python/LArSuperCellMonAlg.py b/LArCalorimeter/LArMonitoring/python/LArSuperCellMonAlg.py index 98f7e971284e2c9942b884be3eabb82f957deee5..5d821c6a47aa7846e8a78a2533df87510ef61161 100644 --- a/LArCalorimeter/LArMonitoring/python/LArSuperCellMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArSuperCellMonAlg.py @@ -1,46 +1,8 @@ # -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # -def LArSuperCellMonConfigOld(inputFlags): - from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelperOld - from LArMonitoring.LArMonitoringConf import LArSuperCellMonAlg - - helper = AthMonitorCfgHelperOld(inputFlags, 'LArSuperCellMonAlgOldCfg') - from AthenaCommon.BeamFlags import jobproperties - if jobproperties.Beam.beamType() == 'cosmics': - isCosmics=True - else: - isCosmics=False - - from AthenaCommon.GlobalFlags import globalflags - if globalflags.DataSource() == 'data': - isMC=False - else: - isMC=True - - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - if not isMC and not athenaCommonFlags.isOnline: - from LumiBlockComps.LBDurationCondAlgDefault import LBDurationCondAlgDefault - LBDurationCondAlgDefault() - from LumiBlockComps.TrigLiveFractionCondAlgDefault import TrigLiveFractionCondAlgDefault - TrigLiveFractionCondAlgDefault() - from LumiBlockComps.LuminosityCondAlgDefault import LuminosityCondAlgDefault - LuminosityCondAlgDefault() - - from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg - CaloNoiseCondAlg() - - algo = LArSuperCellMonConfigCore(helper, LArSuperCellMonAlg,inputFlags,isCosmics, isMC, RemoveMasked=True) - - from AthenaMonitoring.AtlasReadyFilterTool import GetAtlasReadyFilterTool - algo.ReadyFilterTool = [GetAtlasReadyFilterTool()] - from AthenaMonitoring.BadLBFilterTool import GetLArBadLBFilterTool - algo.BadLBTool = GetLArBadLBFilterTool() - - return helper.result() - -def LArSuperCellMonConfig(inputFlags, **kwargs): +def LArSuperCellMonConfig(flags, **kwargs): from AthenaCommon.Logging import logging from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg from AthenaConfiguration.ComponentFactory import CompFactory @@ -48,47 +10,47 @@ def LArSuperCellMonConfig(inputFlags, **kwargs): mask=True from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(inputFlags,'LArSuperCellMonAlgCfg') + helper = AthMonitorCfgHelper(flags,'LArSuperCellMonAlgCfg') from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg=ComponentAccumulator() - if not inputFlags.DQ.enableLumiAccess and not inputFlags.DQ.Environment == 'online': + if not flags.DQ.enableLumiAccess and not flags.DQ.Environment == 'online': mlog.warning('This algo needs Lumi access, returning empty config') return cfg from LArGeoAlgsNV.LArGMConfig import LArGMCfg - cfg.merge(LArGMCfg(inputFlags)) + cfg.merge(LArGMCfg(flags)) from TileGeoModel.TileGMConfig import TileGMCfg - cfg.merge(TileGMCfg(inputFlags)) + cfg.merge(TileGMCfg(flags)) from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg - cfg.merge(DetDescrCnvSvcCfg(inputFlags)) + cfg.merge(DetDescrCnvSvcCfg(flags)) - if inputFlags.Common.isOnline: + if flags.Common.isOnline: cfg.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg('CaloSuperCellAlignCondAlg')) from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg - cfg.merge(BunchCrossingCondAlgCfg(inputFlags)) + cfg.merge(BunchCrossingCondAlgCfg(flags)) from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg - cfg.merge(CaloNoiseCondAlgCfg(inputFlags)) - cfg.merge(CaloNoiseCondAlgCfg(inputFlags,noisetype="electronicNoise")) + cfg.merge(CaloNoiseCondAlgCfg(flags)) + cfg.merge(CaloNoiseCondAlgCfg(flags,noisetype="electronicNoise")) - cfg.merge(ByteStreamReadCfg(inputFlags)) + cfg.merge(ByteStreamReadCfg(flags)) from LArByteStream.LArRawSCDataReadingConfig import LArRawSCDataReadingCfg - cfg.merge(LArRawSCDataReadingCfg(inputFlags)) + cfg.merge(LArRawSCDataReadingCfg(flags)) from TrigT1CaloFexPerf.EmulationConfig import emulateSC_Cfg - cfg.merge(emulateSC_Cfg(inputFlags)) + cfg.merge(emulateSC_Cfg(flags)) from LArCellRec.LArRAWtoSuperCellConfig import LArRAWtoSuperCellCfg - cfg.merge(LArRAWtoSuperCellCfg(inputFlags,mask=mask) ) + cfg.merge(LArRAWtoSuperCellCfg(flags,mask=mask) ) # Reco SC: #get SC onl-offl mapping from DB from LArCabling.LArCablingConfig import LArOnOffIdMappingSCCfg - cfg.merge(LArOnOffIdMappingSCCfg(inputFlags)) + cfg.merge(LArOnOffIdMappingSCCfg(flags)) # and elec. calib. coeffs from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBSCCfg @@ -96,7 +58,7 @@ def LArSuperCellMonConfig(inputFlags, **kwargs): larLATOMEBuilderAlg=CompFactory.LArLATOMEBuilderAlg("LArLATOMEBuilderAlg") from LArConditionsCommon.LArRunFormat import getLArDTInfoForRun try: - runinfo=getLArDTInfoForRun(inputFlags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2") + runinfo=getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2") streamTypes=runinfo.streamTypes() except Exception as e: mlog.warning("Could not get DT run info, using defaults !") @@ -113,10 +75,10 @@ def LArSuperCellMonConfig(inputFlags, **kwargs): larLATOMEBuilderAlg.LArDigitKey = "SC_ADC_BAS" cfg.addEventAlgo(larLATOMEBuilderAlg) - cfg.merge(LArRAWtoSuperCellCfg(inputFlags,name="LArRAWRecotoSuperCell",mask=mask,doReco=True,SCIn="SC_ET_RECO",SCellContainerOut="SCell_ET_RECO") ) + cfg.merge(LArRAWtoSuperCellCfg(flags,name="LArRAWRecotoSuperCell",mask=mask,doReco=True,SCIn="SC_ET_RECO",SCellContainerOut="SCell_ET_RECO") ) - cfg.merge(LArElecCalibDBSCCfg(inputFlags, condObjs=["Ramp","DAC2uA", "Pedestal", "uA2MeV", "MphysOverMcal", "OFC", "Shape", "HVScaleCorr"])) + cfg.merge(LArElecCalibDBSCCfg(flags, condObjs=["Ramp","DAC2uA", "Pedestal", "uA2MeV", "MphysOverMcal", "OFC", "Shape", "HVScaleCorr"])) #return cfg @@ -124,27 +86,27 @@ def LArSuperCellMonConfig(inputFlags, **kwargs): lArCellMonAlg=CompFactory.LArSuperCellMonAlg(algname,CaloCellContainerReco="SCell_ET_RECO",doSCReco=True) - if inputFlags.Input.isMC is False and not inputFlags.Common.isOnline: + if flags.Input.isMC is False and not flags.Common.isOnline: from LumiBlockComps.LuminosityCondAlgConfig import LuminosityCondAlgCfg - cfg.merge(LuminosityCondAlgCfg(inputFlags)) + cfg.merge(LuminosityCondAlgCfg(flags)) from LumiBlockComps.LBDurationCondAlgConfig import LBDurationCondAlgCfg - cfg.merge(LBDurationCondAlgCfg(inputFlags)) + cfg.merge(LBDurationCondAlgCfg(flags)) from AthenaConfiguration.Enums import BeamType - if inputFlags.Beam.Type is BeamType.Cosmics: + if flags.Beam.Type is BeamType.Cosmics: algname=algname+'Cosmics' - LArSuperCellMonConfigCore(helper, lArCellMonAlg, inputFlags, - inputFlags.Beam.Type is BeamType.Cosmics, - inputFlags.Input.isMC, algname, RemoveMasked=mask) + LArSuperCellMonConfigCore(helper, lArCellMonAlg, flags, + flags.Beam.Type is BeamType.Cosmics, + flags.Input.isMC, algname, RemoveMasked=mask) cfg.merge(helper.result()) return cfg -def LArSuperCellMonConfigCore(helper, algclass, inputFlags, isCosmics=False, isMC=False, algname='LArSuperCellMonAlg', RemoveMasked=True): +def LArSuperCellMonConfigCore(helper, algclass, flags, isCosmics=False, isMC=False, algname='LArSuperCellMonAlg', RemoveMasked=True): LArSuperCellMonAlg = helper.addAlgorithm(algclass, algname) @@ -154,8 +116,8 @@ def LArSuperCellMonConfigCore(helper, algclass, inputFlags, isCosmics=False, isM LArSuperCellMonAlg.MonGroupName = GroupName LArSuperCellMonAlg.EnableLumi = False - LArSuperCellMonAlg.CaloCellContainer = inputFlags.LAr.DT.ET_IDKey - LArSuperCellMonAlg.CaloCellContainerRef = inputFlags.Trigger.L1.L1CaloSuperCellContainerName + LArSuperCellMonAlg.CaloCellContainer = flags.LAr.DT.ET_IDKey + LArSuperCellMonAlg.CaloCellContainerRef = flags.Trigger.L1.L1CaloSuperCellContainerName LArSuperCellMonAlg.RemoveMasked = RemoveMasked @@ -373,50 +335,50 @@ if __name__=='__main__': # Set the Athena configuration flags from AthenaConfiguration.AllConfigFlags import initConfigFlags - ConfigFlags = initConfigFlags() + flags = initConfigFlags() #from AthenaConfiguration.TestDefaults import defaultTestFiles - #ConfigFlags.Input.Files = defaultTestFiles.ESD + #flags.Input.Files = defaultTestFiles.ESD # to test tier0 workflow: - #ConfigFlags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayTests/data15_13TeV.00278748.physics_ZeroBias.merge.RAW._lb0384._SFO-ALL._0001.1'] - #ConfigFlags.Input.Files = ['../data22_13p6TeV/data22_13p6TeV.00432180.physics_Main.daq.RAW._lb0335._SFO-16._0001.data'] - #ConfigFlags.Input.Files = ['/eos/atlas/atlastier0/daq/data22_13p6TeV/express_express/00432180/data22_13p6TeV.00432180.express_express.daq.RAW/data22_13p6TeV.00432180.express_express.daq.RAW._lb0374._SFO-12._0001.data'] - ConfigFlags.Input.Files = ['/eos/atlas/atlastier0/daq/data22_13p6TeV/express_express/00439798/data22_13p6TeV.00439798.express_express.daq.RAW/data22_13p6TeV.00439798.express_express.daq.RAW._lb1085._SFO-16._0001.data'] - - #ConfigFlags.Calo.Cell.doPileupOffsetBCIDCorr=True - ConfigFlags.Output.HISTFileName = 'LArSuperCellMonOutput.root' - ConfigFlags.DQ.enableLumiAccess = True - ConfigFlags.DQ.useTrigger = False - ConfigFlags.DQ.Environment = 'tier0' - #ConfigFlags.DQ.Environment = 'online' - ConfigFlags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07" - ConfigFlags.Common.isOnline = True - ConfigFlags.GeoModel.Run=LHCPeriod.Run3 - ConfigFlags.Exec.OutputLevel=WARNING - ConfigFlags.Beam.BunchStructureSource=BunchStructureSource.FILLPARAMS - #ConfigFlags.Beam.BunchStructureSource=BunchStructureSource.Lumi + #flags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayTests/data15_13TeV.00278748.physics_ZeroBias.merge.RAW._lb0384._SFO-ALL._0001.1'] + #flags.Input.Files = ['../data22_13p6TeV/data22_13p6TeV.00432180.physics_Main.daq.RAW._lb0335._SFO-16._0001.data'] + #flags.Input.Files = ['/eos/atlas/atlastier0/daq/data22_13p6TeV/express_express/00432180/data22_13p6TeV.00432180.express_express.daq.RAW/data22_13p6TeV.00432180.express_express.daq.RAW._lb0374._SFO-12._0001.data'] + flags.Input.Files = ['/eos/atlas/atlastier0/daq/data22_13p6TeV/express_express/00439798/data22_13p6TeV.00439798.express_express.daq.RAW/data22_13p6TeV.00439798.express_express.daq.RAW._lb1085._SFO-16._0001.data'] + + #flags.Calo.Cell.doPileupOffsetBCIDCorr=True + flags.Output.HISTFileName = 'LArSuperCellMonOutput.root' + flags.DQ.enableLumiAccess = True + flags.DQ.useTrigger = False + flags.DQ.Environment = 'tier0' + #flags.DQ.Environment = 'online' + flags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07" + flags.Common.isOnline = True + flags.GeoModel.Run=LHCPeriod.Run3 + flags.Exec.OutputLevel=WARNING + flags.Beam.BunchStructureSource=BunchStructureSource.FILLPARAMS + #flags.Beam.BunchStructureSource=BunchStructureSource.Lumi import sys - ConfigFlags.fillFromArgs(sys.argv[1:]) - ConfigFlags.lock() + flags.fillFromArgs(sys.argv[1:]) + flags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg - cfg = MainServicesCfg(ConfigFlags) + cfg = MainServicesCfg(flags) storeGateSvc = cfg.getService("StoreGateSvc") storeGateSvc.Dump=True # in case of tier0 workflow: #from CaloRec.CaloRecoConfig import CaloRecoCfg - #cfg.merge(CaloRecoCfg(ConfigFlags)) + #cfg.merge(CaloRecoCfg(flags)) #from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - #cfg.merge(PoolReadCfg(ConfigFlags)) + #cfg.merge(PoolReadCfg(flags)) - if not ConfigFlags.DQ.Environment == 'online': + if not flags.DQ.Environment == 'online': from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg # FillParamsFolderKey = /TDAQ/OLC/LHC/FILLPARAMS - cfg.merge(BunchCrossingCondAlgCfg(ConfigFlags)) + cfg.merge(BunchCrossingCondAlgCfg(flags)) - cfg.merge(LArSuperCellMonConfig(ConfigFlags)) + cfg.merge(LArSuperCellMonConfig(flags)) f=open("LArSuperCellMon.pkl","wb") cfg.store(f) diff --git a/LArCalorimeter/LArROD/python/LArFebErrorSummaryMakerConfig.py b/LArCalorimeter/LArROD/python/LArFebErrorSummaryMakerConfig.py index 67377e7c1030021df37e590ba5d1567b55e2c429..7403c404bdb525388d205940a9eb032639401b38 100644 --- a/LArCalorimeter/LArROD/python/LArFebErrorSummaryMakerConfig.py +++ b/LArCalorimeter/LArROD/python/LArFebErrorSummaryMakerConfig.py @@ -1,16 +1,16 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentFactory import CompFactory from LArBadChannelTool.LArBadChannelConfig import LArBadFebCfg from AthenaCommon.Logging import logging from OutputStreamAthenaPool.OutputStreamConfig import addToESD -def LArFebErrorSummaryMakerCfg(configFlags): +def LArFebErrorSummaryMakerCfg(flags): log = logging.getLogger('LArFebErrorSummaryMakerConfig') - projectName=configFlags.Input.ProjectName + projectName=flags.Input.ProjectName bCheckAllFEB=True - streamName=configFlags.Input.ProcessingTags + streamName=flags.Input.ProcessingTags if len(streamName) > 0 and len(streamName[0])>4 and streamName[0].endswith("PEB"): log.info("StreamName %s suggests partial event building. Do not check for FEB completeness",str(streamName)) bCheckAllFEB=False @@ -37,11 +37,11 @@ def LArFebErrorSummaryMakerCfg(configFlags): # needed only if it is not in DB. #lMaskFebZeroSample = [0x39618000,0x39930000,0x3b1b0000,0x38db0000,0x38f60000,0x39ae8000,0x3bb90000] - acc = LArBadFebCfg(configFlags) + acc = LArBadFebCfg(flags) minErrFeb=1 # In online or express processing, EventInfo::LArError is triggered if >=4 FEB with data corrupted - if configFlags.Common.isOnline or configFlags.Common.doExpressProcessing: + if flags.Common.isOnline or flags.Common.doExpressProcessing: minErrFeb=4 acc.addEventAlgo(CompFactory.LArFebErrorSummaryMaker("LArFebErrorSummaryMaker",CheckAllFEB=bCheckAllFEB, @@ -52,28 +52,29 @@ def LArFebErrorSummaryMakerCfg(configFlags): ) ) - acc.merge(addToESD(configFlags,["LArFebErrorSummary#LArFebErrorSummary",])) + acc.merge(addToESD(flags,["LArFebErrorSummary#LArFebErrorSummary",])) return acc if __name__=="__main__": - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - ConfigFlags.lock() + flags = initConfigFlags() + flags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.lock() from AthenaConfiguration.MainServicesConfig import MainServicesCfg from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg - acc=MainServicesCfg(ConfigFlags) - acc.merge(LArRawDataReadingCfg(ConfigFlags)) - acc.merge(LArFebErrorSummaryMakerCfg(ConfigFlags)) + acc=MainServicesCfg(flags) + acc.merge(LArRawDataReadingCfg(flags)) + acc.merge(LArFebErrorSummaryMakerCfg(flags)) acc.run(3) diff --git a/LArCalorimeter/LArROD/python/LArRawChannelBuilderAlgConfig.py b/LArCalorimeter/LArROD/python/LArRawChannelBuilderAlgConfig.py index cd43f47a796801a663bbd0d4a57a2df865c402b6..5f00491ffd936d032548f6dc0bde0d04454fdcd6 100644 --- a/LArCalorimeter/LArROD/python/LArRawChannelBuilderAlgConfig.py +++ b/LArCalorimeter/LArROD/python/LArRawChannelBuilderAlgConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.Enums import LHCPeriod, ProductionStep from LArRecUtils.LArADC2MeVCondAlgConfig import LArADC2MeVCondAlgCfg @@ -6,21 +6,21 @@ from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg from LArRecUtils.LArRecUtilsConfig import LArOFCCondAlgCfg from LArConfiguration.LArConfigFlags import RawChannelSource -def LArRawChannelBuilderAlgCfg(configFlags, **kwargs): +def LArRawChannelBuilderAlgCfg(flags, **kwargs): - acc = LArADC2MeVCondAlgCfg(configFlags) + acc = LArADC2MeVCondAlgCfg(flags) kwargs.setdefault("name", "LArRawChannelBuilder") - kwargs.setdefault("firstSample", configFlags.LAr.ROD.nPreceedingSamples if configFlags.LAr.ROD.nPreceedingSamples!=0 else configFlags.LAr.ROD.FirstSample) + kwargs.setdefault("firstSample", flags.LAr.ROD.nPreceedingSamples if flags.LAr.ROD.nPreceedingSamples!=0 else flags.LAr.ROD.FirstSample) obj = "AthenaAttributeList" dspkey = 'Run2DSPThresholdsKey' from IOVDbSvc.IOVDbSvcConfig import addFolders - if configFlags.Input.isMC: + if flags.Input.isMC: # need OFC configuration, which includes appropriate ElecCalibDb - acc.merge(LArOFCCondAlgCfg(configFlags)) + acc.merge(LArOFCCondAlgCfg(flags)) kwargs.setdefault("LArRawChannelKey", "LArRawChannels") kwargs.setdefault("ShapeKey", "LArShapeSym") - if configFlags.GeoModel.Run is LHCPeriod.Run1: # back to flat threshold + if flags.GeoModel.Run is LHCPeriod.Run1: # back to flat threshold kwargs.setdefault("useDB", False) dspkey = '' else: @@ -28,20 +28,20 @@ def LArRawChannelBuilderAlgCfg(configFlags, **kwargs): sgkey=fld dbString="OFLP200" dbInstance="LAR_OFL" - acc.merge(addFolders(configFlags,fld, dbInstance, className=obj, db=dbString)) + acc.merge(addFolders(flags,fld, dbInstance, className=obj, db=dbString)) - if configFlags.Common.ProductionStep is ProductionStep.PileUpPresampling: - kwargs.setdefault("LArDigitKey", configFlags.Overlay.BkgPrefix + "LArDigitContainer_MC") + if flags.Common.ProductionStep is ProductionStep.PileUpPresampling: + kwargs.setdefault("LArDigitKey", flags.Overlay.BkgPrefix + "LArDigitContainer_MC") else: kwargs.setdefault("LArDigitKey", "LArDigitContainer_MC") else: - acc.merge(LArElecCalibDBCfg(configFlags,("OFC","Shape","Pedestal"))) - if configFlags.Overlay.DataOverlay: + acc.merge(LArElecCalibDBCfg(flags,("OFC","Shape","Pedestal"))) + if flags.Overlay.DataOverlay: kwargs.setdefault("LArDigitKey", "LArDigitContainer_MC") kwargs.setdefault("LArRawChannelKey", "LArRawChannels") else: kwargs.setdefault("LArRawChannelKey", "LArRawChannels_FromDigits") - if 'COMP200' in configFlags.IOVDb.DatabaseInstance: + if 'COMP200' in flags.IOVDb.DatabaseInstance: fld='/LAR/Configuration/DSPThreshold/Thresholds' obj='LArDSPThresholdsComplete' dspkey = 'Run1DSPThresholdsKey' @@ -52,12 +52,12 @@ def LArRawChannelBuilderAlgCfg(configFlags, **kwargs): sgkey=fld dbString="CONDBR2" dbInstance="LAR_ONL" - acc.merge(addFolders(configFlags,fld, dbInstance, className=obj, db=dbString)) + acc.merge(addFolders(flags,fld, dbInstance, className=obj, db=dbString)) if len (dspkey) > 0: kwargs.setdefault(dspkey, sgkey) - if configFlags.LAr.ROD.forceIter or configFlags.LAr.RawChannelSource is RawChannelSource.Calculated: + if flags.LAr.ROD.forceIter or flags.LAr.RawChannelSource is RawChannelSource.Calculated: # iterative OFC procedure kwargs.setdefault('minSample',2) kwargs.setdefault('maxSample',12) @@ -66,7 +66,7 @@ def LArRawChannelBuilderAlgCfg(configFlags, **kwargs): kwargs.setdefault('defaultPhase',12) nominalPeakSample=2 from LArConditionsCommon.LArRunFormat import getLArFormatForRun - larformat=getLArFormatForRun(configFlags.Input.RunNumbers[0],connstring="COOLONL_LAR/"+configFlags.IOVDb.DatabaseInstance) + larformat=getLArFormatForRun(flags.Input.RunNumbers[0],connstring="COOLONL_LAR/"+flags.IOVDb.DatabaseInstance) if larformat is not None: nominalPeakSample = larformat.firstSample() else: @@ -87,26 +87,28 @@ def LArRawChannelBuilderAlgCfg(configFlags, **kwargs): if __name__=="__main__": - from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.AllConfigFlags import initConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - from AthenaConfiguration.TestDefaults import defaultTestFiles - ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + flags = initConfigFlags() + flags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 # in case of testing iterative OFC: - #ConfigFlags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/data15_1beam/data15_1beam.00260466.physics_L1Calo.merge.RAW._lb1380._SFO-ALL._0001.1'] - ConfigFlags.Input.isMC = False - ConfigFlags.Detector.GeometryTile = False - ConfigFlags.lock() + #flags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/data15_1beam/data15_1beam.00260466.physics_L1Calo.merge.RAW._lb1380._SFO-ALL._0001.1'] + flags.Input.isMC = False + flags.Detector.GeometryTile = False + flags.lock() from AthenaConfiguration.MainServicesConfig import MainServicesCfg from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg - acc=MainServicesCfg(ConfigFlags) - acc.merge(LArRawDataReadingCfg(ConfigFlags)) - acc.merge(LArRawChannelBuilderAlgCfg(ConfigFlags)) + acc=MainServicesCfg(flags) + acc.merge(LArRawDataReadingCfg(flags)) + acc.merge(LArRawChannelBuilderAlgCfg(flags)) DumpLArRawChannels=CompFactory.DumpLArRawChannels acc.addEventAlgo(DumpLArRawChannels(LArRawChannelContainerName="LArRawChannels_FromDigits",),sequenceName="AthAlgSeq") diff --git a/LArCalorimeter/LArROD/src/LArNNRawChannelBuilder.cxx b/LArCalorimeter/LArROD/src/LArNNRawChannelBuilder.cxx index 3b9aeedc2e0ccd694371be82ff9144d8344b4bb3..31342ecd7cbeae829f49f730ee9abcba8c321a56 100644 --- a/LArCalorimeter/LArROD/src/LArNNRawChannelBuilder.cxx +++ b/LArCalorimeter/LArROD/src/LArNNRawChannelBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2024 CERN for the benefit of the ATLAS collaboration */ #include "LArNNRawChannelBuilder.h" @@ -11,6 +11,7 @@ #include "LArRawEvent/LArDigitContainer.h" #include "LArIdentifier/LArOnlineID.h" #include "LArCOOLConditions/LArDSPThresholdsFlat.h" +#include "LArElecCalib/LArProvenance.h" #include <cmath> #include "lwtnn/LightweightGraph.hh" @@ -164,8 +165,8 @@ StatusCode LArNNRawChannelBuilder::execute(const EventContext& ctx) const { float tau = 0; - uint16_t prov = 0xa5; //Means all constants from DB - if (saturated) prov |= 0x0400; + uint16_t prov = LArProv::PEAKNN | LArProv::RAMPDB | LArProv::PEDDB; + if (saturated) prov |= LArProv::SATURATED; outputContainerLRPtr->emplace_back(id, static_cast<int>(std::floor(E+0.5)), diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx index f74e8b77555989a42138c4e641ab89b482d27d34..12df8aa563b285bea0019ef320473e08075c947f 100644 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "LArRawChannelBuilderAlg.h" @@ -8,6 +8,7 @@ #include "LArIdentifier/LArOnlineID.h" #include "LArRawEvent/LArDigitContainer.h" #include "LArRawEvent/LArRawChannelContainer.h" +#include "LArElecCalib/LArProvenance.h" #include <cmath> #include <memory> @@ -160,8 +161,8 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const { float tau=0; - uint16_t prov=0xa5; //Means all constants from DB - if (saturated) prov|=0x0400; + uint16_t prov=LArProv::DEFAULTRECO; //Means all constants from DB + OFC + if (saturated) prov|=LArProv::SATURATED; const float E1=m_absECutFortQ.value() ? std::fabs(E) : E; float ecut(0.); @@ -182,7 +183,7 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const { } if (E1 > ecut) { ATH_MSG_VERBOSE("Channel " << m_onlineId->channel_name(id) << " gain " << gain << " above threshold for tQ computation"); - prov|=0x2000; // fill bit in provenance that time+quality information are available + prov|=LArProv::QTPRESENT; // fill bit in provenance that time+quality information are available //Get time by applying OFC-b coefficients: const auto& ofcb=ofcs->OFC_b(id,gain); diff --git a/LArCalorimeter/LArRecEvent/src/LArCell.cxx b/LArCalorimeter/LArRecEvent/src/LArCell.cxx index 6a9205ebe9788afd2f2c9c68855d22534656948c..3849416d00c219fa8a1a436cec27b50d22fb6dc7 100755 --- a/LArCalorimeter/LArRecEvent/src/LArCell.cxx +++ b/LArCalorimeter/LArRecEvent/src/LArCell.cxx @@ -8,7 +8,7 @@ #include "FourMomUtils/P4Helpers.h" #include <iostream> - +#include "LArElecCalib/LArProvenance.h" LArCell::~LArCell () { } @@ -44,6 +44,5 @@ std::unique_ptr<CaloCell> LArCell::clone() const bool LArCell::badcell() const { - if (this->provenance() & 0x0800) return true; - return false; + return LArProv::test(this->provenance(),LArProv::MASKED); } diff --git a/LArCalorimeter/LArRecUtils/python/LArADC2MeVCondAlgConfig.py b/LArCalorimeter/LArRecUtils/python/LArADC2MeVCondAlgConfig.py index fc880a0057d4367d72902aaa9b64d21f3a63e879..cedb7f25042d6f3ae0c204290020e634432d4040 100644 --- a/LArCalorimeter/LArRecUtils/python/LArADC2MeVCondAlgConfig.py +++ b/LArCalorimeter/LArRecUtils/python/LArADC2MeVCondAlgConfig.py @@ -1,24 +1,20 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -def LArADC2MeVCondAlgCfg(configFlags): +def LArADC2MeVCondAlgCfg(flags): from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg from LArGeoAlgsNV.LArGMConfig import LArGMCfg result=ComponentAccumulator() - result.merge(LArOnOffIdMappingCfg(configFlags)) - result.merge(LArGMCfg(configFlags)) #Needed for identifier helpers + result.merge(LArOnOffIdMappingCfg(flags)) + result.merge(LArGMCfg(flags)) #Needed for identifier helpers theADC2MeVCondAlg=CompFactory.LArADC2MeVCondAlg(LArADC2MeVKey = 'LArADC2MeV') - - isMC=configFlags.Input.isMC - if isMC: + if flags.Input.isMC: requiredConditions=["Ramp","DAC2uA","uA2MeV","MphysOverMcal","HVScaleCorr"] theADC2MeVCondAlg.LAruA2MeVKey="LAruA2MeVSym" theADC2MeVCondAlg.LArDAC2uAKey="LArDAC2uASym" @@ -29,23 +25,24 @@ def LArADC2MeVCondAlgCfg(configFlags): else: # not MC: requiredConditions=["Ramp","DAC2uA","uA2MeV","MphysOverMcal","HVScaleCorr"] from LArRecUtils.LArFebConfigCondAlgConfig import LArFebConfigCondAlgCfg - if 'COMP200' in configFlags.IOVDb.DatabaseInstance: # Run1 case + if 'COMP200' in flags.IOVDb.DatabaseInstance: # Run1 case theADC2MeVCondAlg.LAruA2MeVKey="LAruA2MeVSym" theADC2MeVCondAlg.LArDAC2uAKey="LArDAC2uASym" - result.merge(LArFebConfigCondAlgCfg(configFlags)) + result.merge(LArFebConfigCondAlgCfg(flags)) - result.merge(LArElecCalibDBCfg(configFlags,requiredConditions)) + result.merge(LArElecCalibDBCfg(flags,requiredConditions)) result.addCondAlgo(theADC2MeVCondAlg,primary=True) return result if __name__ == "__main__": from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles + from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags print ('--- data') flags1 = initConfigFlags() flags1.Input.Files = defaultTestFiles.RAW_RUN2 + flags1.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags1.lock() acc1 = LArADC2MeVCondAlgCfg (flags1) acc1.printCondAlgs(summariseProps=True) @@ -55,6 +52,7 @@ if __name__ == "__main__": print ('--- mc') flags2 = initConfigFlags() flags2.Input.Files = defaultTestFiles.ESD + flags2.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags2.lock() acc2 = LArADC2MeVCondAlgCfg (flags2) acc2.printCondAlgs(summariseProps=True) diff --git a/LArCalorimeter/LArRecUtils/python/LArADC2MeVSCCondAlgConfig.py b/LArCalorimeter/LArRecUtils/python/LArADC2MeVSCCondAlgConfig.py index 89657f0c45534dabebe0b9690e6d33abed2a85fe..5307ed2c1ca1f8066523c195cd735c442f0b7c10 100644 --- a/LArCalorimeter/LArRecUtils/python/LArADC2MeVSCCondAlgConfig.py +++ b/LArCalorimeter/LArRecUtils/python/LArADC2MeVSCCondAlgConfig.py @@ -1,22 +1,20 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -def LArADC2MeVSCCondAlgCfg(configFlags): +def LArADC2MeVSCCondAlgCfg(flags): from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg, LArElecCalibDBMCSCCfg from LArGeoAlgsNV.LArGMConfig import LArGMCfg result=ComponentAccumulator() from LArCabling.LArCablingConfig import LArOnOffIdMappingSCCfg - result.merge(LArOnOffIdMappingSCCfg(configFlags)) - result.merge(LArGMCfg(configFlags)) #Needed for identifier helpers + result.merge(LArOnOffIdMappingSCCfg(flags)) + result.merge(LArGMCfg(flags)) #Needed for identifier helpers theADC2MeVCondAlg=CompFactory.LArADC2MeVCondAlg(name = "LArADC2MeVSCCondAlg", LArADC2MeVKey = 'LArADC2MeVSC') - isMC=configFlags.Input.isMC - - if isMC: + if flags.Input.isMC: requiredConditions=["RampSC","DAC2uASC","uA2MeVSC"] theADC2MeVCondAlg.LAruA2MeVKey="LAruA2MeVSC" theADC2MeVCondAlg.LArDAC2uAKey="LArDAC2uASC" @@ -26,26 +24,27 @@ def LArADC2MeVSCCondAlgCfg(configFlags): theADC2MeVCondAlg.UseFEBGainTresholds=False theADC2MeVCondAlg.LArOnOffIdMappingKey="LArOnOffIdMapSC" theADC2MeVCondAlg.isSuperCell=True - result.merge(LArElecCalibDBMCSCCfg(configFlags,requiredConditions)) + result.merge(LArElecCalibDBMCSCCfg(flags,requiredConditions)) else: # not MC: requiredConditions=["Ramp","DAC2uA","uA2MeV","MphysOverMcal","HVScaleCorr"] from LArRecUtils.LArFebConfigCondAlgConfig import LArFebConfigCondAlgCfg - if 'COMP200' in configFlags.IOVDb.DatabaseInstance: # Run1 case + if 'COMP200' in flags.IOVDb.DatabaseInstance: # Run1 case theADC2MeVCondAlg.LAruA2MeVKey="LAruA2MeVSC" theADC2MeVCondAlg.LArDAC2uAKey="LArDAC2uASC" - result.merge(LArFebConfigCondAlgCfg(configFlags)) - result.merge(LArElecCalibDBCfg(configFlags,requiredConditions)) + result.merge(LArFebConfigCondAlgCfg(flags)) + result.merge(LArElecCalibDBCfg(flags,requiredConditions)) result.addCondAlgo(theADC2MeVCondAlg,primary=True) return result if __name__ == "__main__": from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles + from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags print ('--- data') flags1 = initConfigFlags() flags1.Input.Files = defaultTestFiles.RAW_RUN2 + flags1.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags1.lock() acc1 = LArADC2MeVSCCondAlgCfg (flags1) acc1.printCondAlgs(summariseProps=True) @@ -55,6 +54,7 @@ if __name__ == "__main__": print ('--- mc') flags2 = initConfigFlags() flags2.Input.Files = defaultTestFiles.ESD + flags2.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags2.lock() acc2 = LArADC2MeVSCCondAlgCfg (flags2) diff --git a/LArCalorimeter/LArTest/LArEventTest/python/LArRawChannelDump.py b/LArCalorimeter/LArTest/LArEventTest/python/LArRawChannelDump.py index a4b075b92dbacc83a42f2329011c6912999b80e1..0c619d6b6834edd5bea4a4ec0cbd64b4a74ab98b 100644 --- a/LArCalorimeter/LArTest/LArEventTest/python/LArRawChannelDump.py +++ b/LArCalorimeter/LArTest/LArEventTest/python/LArRawChannelDump.py @@ -3,21 +3,21 @@ from AthenaConfiguration.ComponentFactory import CompFactory if __name__ == "__main__": - from AthenaConfiguration.AllConfigFlags import ConfigFlags - - ConfigFlags.Input.Files = ["myRDO.pool.root",] - ConfigFlags.lock() + from AthenaConfiguration.AllConfigFlags import initConfigFlags + flags = initConfigFlags() + flags.Input.Files = ["myRDO.pool.root",] + flags.lock() from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - cfg=MainServicesCfg(ConfigFlags) - cfg.merge(PoolReadCfg(ConfigFlags)) + cfg=MainServicesCfg(flags) + cfg.merge(PoolReadCfg(flags)) from LArGeoAlgsNV.LArGMConfig import LArGMCfg - cfg.merge(LArGMCfg(ConfigFlags)) + cfg.merge(LArGMCfg(flags)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg - cfg.merge(LArOnOffIdMappingCfg(ConfigFlags)) + cfg.merge(LArOnOffIdMappingCfg(flags)) cfg.addEventAlgo(CompFactory.DumpLArRawChannels(NtupStream="LARRC",OutputFileName="",ToLog=False)) cfg.addService(CompFactory.THistSvc(Output = ["LARRC DATAFILE='LARRC.root', OPT='RECREATE'"])) diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx index 12880d988a907334f822ef4aff3c732d2a6af003..189552ac27ba4e09d1e6d449e3e8a5ba7707d67e 100644 --- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx +++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/src/MuonMDT_CablingAlg.cxx @@ -214,7 +214,7 @@ bool MuonMDT_CablingAlg::extractStationInfo(const coral::AttributeList& atr, Cab map_data.stationIndex = m_idHelperSvc->mdtIdHelper().stationNameIndex(stationNameString); ATH_MSG_VERBOSE("station name: " << stationNameString << " index: " << static_cast<int>(map_data.stationIndex)); // convert the subdetector id to integer - map_data.subdetectorId = CxxUtils::atoi(subdetector_id.c_str()); + map_data.subdetectorId = CxxUtils::atoi(subdetector_id); ATH_MSG_VERBOSE("Data load is chamber_Name = " << chamber_name <<" translated to "<<map_data<<" FINISHED HERE "); diff --git a/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/MuonCalibSegmentCreator/MuonSegmentReader.h b/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/MuonCalibSegmentCreator/MuonSegmentReader.h index fc868d8870e3ed6efc62c13ee7512a1483ae92f7..09f37a8bffbb1362e2f7f555d441eb7bdeda7a5f 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/MuonCalibSegmentCreator/MuonSegmentReader.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/MuonCalibSegmentCreator/MuonSegmentReader.h @@ -120,6 +120,7 @@ class MuonSegmentReader : public AthHistogramAlgorithm VectorBranch<int>& m_trk_nMdtHoles{m_tree.newVector<int>("trk_nMdtHoles")}; VectorBranch<int>& m_trk_nOutliersHits{m_tree.newVector<int>("trk_nOutliersHis")}; VectorBranch<int>& m_trk_nRpcPhiHits{m_tree.newVector<int>("trk_nRpcPhiHits")}; + VectorBranch<int>& m_trk_nRpcEtaHits{m_tree.newVector<int>("trk_nRpcEtaHits")}; VectorBranch<int>& m_trk_nTgcPhiHits{m_tree.newVector<int>("trk_nTgcPhiHits")}; VectorBranch<int>& m_trk_nTgcEtaHits{m_tree.newVector<int>("trk_nTgcEtaHits")}; diff --git a/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/src/MuonSegmentReader.cxx b/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/src/MuonSegmentReader.cxx index d4ccce4fc20b1c4a6cb2d994fa3bf74fe8985e9c..e9a61eef5d6a52491414539ccf6d5393aac3c35a 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/src/MuonSegmentReader.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/src/MuonSegmentReader.cxx @@ -132,7 +132,7 @@ StatusCode MuonSegmentReader::execute() m_trk_nOutliersHits.push_back(trkSummary->get(Trk::numberOfOutliersOnTrack)); m_trk_nRpcPhiHits.push_back(trkSummary->get(Trk::numberOfRpcPhiHits)); m_trk_nTgcPhiHits.push_back(trkSummary->get(Trk::numberOfTgcPhiHits)); - m_trk_nRpcPhiHits.push_back(trkSummary->get(Trk::numberOfRpcPhiHits)); + m_trk_nRpcEtaHits.push_back(trkSummary->get(Trk::numberOfRpcEtaHits)); m_trk_nTgcEtaHits.push_back(trkSummary->get(Trk::numberOfTgcEtaHits)); m_trk_nMdtHoles.push_back(trkSummary->get(Trk::numberOfMdtHoles)); ATH_MSG_DEBUG("Mdt Hits " << trkSummary->get(Trk::numberOfMdtHits) << " Mdt Good Hits " << trkSummary->get(Trk::numberOfGoodMdtHits) diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx index ee2283274c7ee25375216ee373f620beed81baa3..92d12ad8d84a06596f09f95ea19eaf3c407f9a35 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/CscPrepDataRetriever.cxx @@ -38,11 +38,7 @@ namespace JiveXML { ATH_MSG_VERBOSE("Retrieving " << dataTypeName()); SG::ReadHandle<Muon::CscPrepDataContainer> cscContainer(m_sgKey); - - if (!cscContainer.isValid()) { - ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey); - return(StatusCode::SUCCESS); - } + int ndata = 0; Muon::CscPrepDataContainer::const_iterator containerIt; diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MMPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MMPrepDataRetriever.cxx index 42cded98c1942397b5bb3d6e49bb39f7c820a10b..859ba5b11557aa2e82ef2e2ed38efdc029b7fcb4 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MMPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MMPrepDataRetriever.cxx @@ -46,11 +46,6 @@ namespace JiveXML { SG::ReadHandle<Muon::MMPrepDataContainer> mmContainer(m_sgKey); - if (!mmContainer.isValid()) { - ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey); - return(StatusCode::SUCCESS); - } - int ndata = 0; for (const auto mmCollection : *mmContainer){ ndata += mmCollection->size(); diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx index f9f1fade1240e53d0cab0fb8c38657483e479a60..767d3e6fb9daf48f79e38e44e2e13ce9c22d6b87 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/MdtPrepDataRetriever.cxx @@ -40,10 +40,7 @@ namespace JiveXML { ATH_MSG_VERBOSE("Retrieving " << dataTypeName()); SG::ReadHandle<Muon::MdtPrepDataContainer> mdtContainer(m_sgKey); - if (!mdtContainer.isValid()) { - ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey); - return(StatusCode::SUCCESS); - } + int ndata = 0; Muon::MdtPrepDataContainer::const_iterator containerIt; diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx index e07dc10a5ecad8a54e5c96a6946b827f725639ef..0d6247a68199dbf4144dcd4879f1c98b648a2c8a 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/RpcPrepDataRetriever.cxx @@ -40,11 +40,6 @@ namespace JiveXML { SG::ReadHandle<Muon::RpcPrepDataContainer> rpcContainer(m_sgKey); - if (!rpcContainer.isValid()) { - ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey); - return(StatusCode::SUCCESS); - } - int ndata = 0; Muon::RpcPrepDataContainer::const_iterator containerIt; for (containerIt=rpcContainer->begin(); containerIt!=rpcContainer->end(); ++containerIt) { diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx index ed3cb6279c87456dfb5495f55ebbba74ecf29fef..eeba935c39fa9647f64f01304550418ea0dee695 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TgcPrepDataRetriever.cxx @@ -38,11 +38,6 @@ namespace JiveXML { SG::ReadHandle<Muon::TgcPrepDataContainer> tgcContainer(m_sgKey); - if (!tgcContainer.isValid()) { - ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey); - return(StatusCode::SUCCESS); - } - int ndata = 0; Muon::TgcPrepDataContainer::const_iterator containerIt; for (containerIt=tgcContainer->begin(); containerIt!=tgcContainer->end(); ++containerIt) { diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigMuonROIRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigMuonROIRetriever.cxx index 798d0bff9870a435cc776deeb89f34ae86257735..75038032d627d8e5fc5042fec448ecc375e47637 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigMuonROIRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigMuonROIRetriever.cxx @@ -28,11 +28,7 @@ namespace JiveXML { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Retrieving " << dataTypeName() << endmsg; SG::ReadHandle<LVL1_ROI> roi(m_sgKey); - - if (!roi.isValid()) { - ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey); - return(StatusCode::SUCCESS); - } + int nRoIs = roi->getMuonROIs().size(); DataVect phi; phi.reserve(nRoIs); diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx index 2afc916114c8519811c9997d1db2199fca16e16f..0d13e22735b7c7717cf1354476f59169666e81a1 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/TrigRpcDataRetriever.cxx @@ -42,11 +42,6 @@ namespace JiveXML { // retrieve the collection of RDO SG::ReadHandle<RpcPadContainer> rdoContainer(m_sgKey); - if (!rdoContainer.isValid()) { - ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey); - return(StatusCode::SUCCESS); - } - int ndata=0; for (auto containerIt=rdoContainer->begin(); containerIt!=rdoContainer->end(); ++containerIt) { ndata += (*containerIt)->size(); diff --git a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/sTgcPrepDataRetriever.cxx b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/sTgcPrepDataRetriever.cxx index 89a2efe02d8ea329c84047d70b8e62c53245aeaa..6aae6cca1dace1c566b54737423587357b6c0c93 100644 --- a/MuonSpectrometer/MuonCnv/MuonJiveXML/src/sTgcPrepDataRetriever.cxx +++ b/MuonSpectrometer/MuonCnv/MuonJiveXML/src/sTgcPrepDataRetriever.cxx @@ -45,11 +45,6 @@ namespace JiveXML { SG::ReadHandle<Muon::sTgcPrepDataContainer> stgcContainer(m_sgKey); - if (!stgcContainer.isValid()) { - ATH_MSG_WARNING("Unable to retrieve: " << m_sgKey); - return(StatusCode::SUCCESS); - } - int ndata = 0; for (const auto stgcCollection : *stgcContainer){ ndata += stgcCollection->size(); diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondDump/python/MdtMezzExtraction.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondDump/python/MdtMezzExtraction.py index c279b1b8ed5fc5ce5bc1894b650db250a8c4662e..1dc691cb71d2cc17ee77bf6ad8d42ee2ee8b53ac 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondDump/python/MdtMezzExtraction.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondDump/python/MdtMezzExtraction.py @@ -24,6 +24,7 @@ if __name__ == "__main__": flags.Concurrency.NumConcurrentEvents = args.threads # Might change this later, but good enough for the moment. flags.Output.ESDFileName = args.output flags.Input.Files = args.inputFile + flags.GeoModel.AtlasVersion = args.geometry flags.lock() cfg = MdtCablMezzAlgCfg(flags, diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/python/MdtCablingTester.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/python/MdtCablingTester.py index 8d0a5dbdaa2ec643690fcd87a85d0e6cd2b18f83..5c1f4955adab8ee0f4830da83faad50a2ef46a0d 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/python/MdtCablingTester.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/python/MdtCablingTester.py @@ -8,6 +8,7 @@ def SetupArgParser(): parser.add_argument("-o", "--output", dest="output", default='', help="Text file containing each cabling channel", metavar="FILE") parser.add_argument("--inputFile", "-i", default=["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/data17_13TeV.00330470.physics_Main.daq.RAW._lb0310._SFO-1._0001.data"], help="Input file to run on ", nargs="+") + parser.add_argument("--geometry", default="ATLAS-R2-2016-01-00-01", help="Geometry tag") parser.add_argument("--mezzMap", default="", help="External JSON file containing the internal mapping of the mezzanine cards") parser.add_argument("--cablingMap", default="", help="External JSON file containing the cabling map of each channel") return parser @@ -54,7 +55,8 @@ if __name__ == "__main__": flags.Concurrency.NumThreads = args.threads flags.Concurrency.NumConcurrentEvents = args.threads # Might change this later, but good enough for the moment. flags.Output.ESDFileName = args.output - flags.Input.Files = args.inputFile + flags.Input.Files = args.inputFile + flags.GeoModel.AtlasVersion = args.geometry flags.lock() cfg = MdtCablingTestAlgCfg(flags, diff --git a/MuonSpectrometer/MuonConfig/python/MuonCablingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonCablingConfig.py index 274b0cc0a65f22a3b933db10b2ea36ddf5708594..df20bd423e8bd69d30fe6260fc8b4640ae32aeb1 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonCablingConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonCablingConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -183,9 +183,10 @@ def MuonCablingConfigCfg(flags): if __name__ == '__main__': from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles + from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN2 + flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.lock() acc = ComponentAccumulator() @@ -196,6 +197,3 @@ if __name__ == '__main__': f=open('MuonCabling.pkl','wb') acc.store(f) f.close() - - - diff --git a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py index 58f7820b6a3df1884abdf41a0e073cb3b1d7c983..9033d031d6facbfd68cc8dc106a6c04950fa62a8 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py +++ b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py @@ -151,7 +151,7 @@ def createMuonConfigFlags(): mcf.addFlag("Muon.writeSDOs", lambda prevFlags : prevFlags.Output.doWriteESD and prevFlags.Input.isMC) # configure the MM cluster reco method that is used in the cluster calibration step - mcf.addFlag("Muon.MMClusterCalibRecoTool", lambda prevFlags : MMClusterBuilderEnum.ClusterTimeProjection if prevFlags.Input.isMC else MMClusterBuilderEnum.Centroid, enum = MMClusterBuilderEnum) + mcf.addFlag("Muon.MMClusterCalibRecoTool", lambda prevFlags : MMClusterBuilderEnum.ClusterTimeProjection if prevFlags.Input.isMC else MMClusterBuilderEnum.Centroid, type=MMClusterBuilderEnum) diff --git a/MuonSpectrometer/MuonConfig/test/MdtRdoToPrepDataTool_test.py b/MuonSpectrometer/MuonConfig/test/MdtRdoToPrepDataTool_test.py index bf49f253a4a240c2821a280b2ac50760be480659..293330d4c33e2488462bfaeef8a3bf319c5f79c9 100644 --- a/MuonSpectrometer/MuonConfig/test/MdtRdoToPrepDataTool_test.py +++ b/MuonSpectrometer/MuonConfig/test/MdtRdoToPrepDataTool_test.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration. +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration. # # File: MuonMDT_CnvTools/share/MdtRdoToPrepDataTool_test.py # Author: scott snyder @@ -52,11 +52,13 @@ def testCfg (flags): from AthenaConfiguration.AllConfigFlags import initConfigFlags -from AthenaConfiguration.TestDefaults import defaultTestFiles +from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN2 +flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.lock() + from AthenaConfiguration.MainServicesConfig import MainServicesCfg acc=MainServicesCfg(flags) diff --git a/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/MuonNSWAsBuilt/ElementModelSTGC.h b/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/MuonNSWAsBuilt/ElementModelSTGC.h index d14e92b27b3655dd13cd94d80094e970908bf849..1b36fdbf215bb718dbc80dbf2ca797f352d1a47b 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/MuonNSWAsBuilt/ElementModelSTGC.h +++ b/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/MuonNSWAsBuilt/ElementModelSTGC.h @@ -79,6 +79,7 @@ namespace NswAsBuilt { // Properties and scales needed for the calculation double m_lenY{0.}; + double m_lenX{0.}; Amg::Vector3D m_defo0 {Amg::Vector3D::Zero()}; }; diff --git a/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/src/ElementModelSTGC.cxx b/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/src/ElementModelSTGC.cxx index 96dfa1b10bc0e9812bf8fb4efda7343131c4fb4e..2992a415c87a2b4c2075910c18d0d8a562ee1961 100755 --- a/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/src/ElementModelSTGC.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/src/ElementModelSTGC.cxx @@ -8,8 +8,8 @@ using namespace NswAsBuilt; -ElementModelSTGC::ElementModelSTGC(double /*lenX*/, double lenY, Amg::Vector3D defo0) - : m_lenY(lenY), +ElementModelSTGC::ElementModelSTGC(double lenX, double lenY, Amg::Vector3D defo0) + : m_lenY(lenY),m_lenX(lenX), m_defo0(std::move(defo0)) { } @@ -103,7 +103,7 @@ Amg::Vector3D ElementModelSTGC::stgcScale(double scl, const Amg::Vector3D& d0) c Amg::Vector3D ElementModelSTGC::stgcNonPar(double npar, const Amg::Vector3D& d0) const { // Non-parallelism measured by CMM/Faro at construction sites - double delta = npar*d0[0]*d0[1]/(m_lenY*m_lenY); + double delta = npar*d0[0]*d0[1]/(m_lenX*m_lenY); return Amg::Vector3D(0., delta, 0.); } @@ -130,7 +130,7 @@ void ElementModelSTGC::applyDeformation2(const ParameterVector& parvec, VectorSe double off = parvec[OFF]; double rot = parvec[ROT]; double scl = parvec[SCL]/m_lenY; - double npar = parvec[NPAR]/(m_lenY*m_lenY); + double npar = parvec[NPAR]/(m_lenX*m_lenY); // OFF: local.array().colwise() += Eigen::Array3d{0. ,off, 0.}; diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h index 433ff4427713cff38964a6070e5d1ad2d0e21bf9..c9d30fd3f4d93519c3231c976c4b36f5d31df6ef 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h @@ -18,5 +18,6 @@ #include <EgammaAnalysisAlgorithms/ElectronLRTMergingAlg.h> #include <EgammaAnalysisAlgorithms/PhotonOriginCorrectionAlg.h> #include <EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h> +#include <EgammaAnalysisAlgorithms/ElectronSiHitDecAlg.h> #endif diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h index 1af94ac2b25c4c855b0fa1f19dd414f35f2b3d9b..0b03af25676431bfaf15ac9c6c194311bb11de67 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h @@ -43,12 +43,14 @@ namespace CP /// \brief the systematics list we run SysListHandle m_systematicsList {this}; - SysReadHandle<xAOD::IParticleContainer> m_egammaContH{this, "ElectronOrPhotonContKey", "", "Electrons or photons for dR comparison"}; + SysReadHandle<xAOD::IParticleContainer> m_egammaContKey{this, "ElectronOrPhotonContKey", "", "Electrons or photons for dR comparison"}; - SysReadHandle<xAOD::MuonContainer> m_muonContH{this, "MuonContKey", "AnalysisMuons", "Muons to compare with for selecting FSR"}; + SysReadHandle<xAOD::MuonContainer> m_muonContKey{this, "MuonContKey", "AnalysisMuons", "Muons to compare with for selecting FSR"}; Gaudi::Property<std::string> m_selectionName {this, "selectionDecoration", "", "the decoration for the combined WP and FSR selection"}; + Gaudi::Property<bool> m_vetoFSR {this, "vetoFSR", false, "boolean to revert FSR logic to rather veto FSR electrons or photons"}; + /// Decorator for electron or photon working point - used to add additional el/ph std::unique_ptr<SG::AuxElement::Decorator<uint32_t> > m_wpDec; diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/selection.xml index a792d44ce1a205a57487dc62cd85ea725f05b352..03fcf69cc1d4d62ae8dbc4972d82a157714cc153 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/selection.xml +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/selection.xml @@ -10,5 +10,6 @@ <class name="CP::ElectronLRTMergingAlg" /> <class name="CP::PhotonOriginCorrectionAlg" /> <class name="CP::EgammaFSRForMuonsCollectorAlg" /> + <class name="CP::ElectronSiHitDecAlg" /> </lcgdict> diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaFSRForMuonsCollectorAlg.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaFSRForMuonsCollectorAlg.cxx index 01e7fcc8ce7c7d193c08640cdad7491c3ce9acbb..0361d4cbc084580a58a15c03d0de0af890955b81 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaFSRForMuonsCollectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaFSRForMuonsCollectorAlg.cxx @@ -12,6 +12,9 @@ #include "EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h" #include <FourMomUtils/xAODP4Helpers.h> #include <xAODEgamma/Electron.h> + +#include "xAODEgamma/ElectronxAODHelpers.h" + #include <SelectionHelpers/SelectionHelpers.h> namespace CP @@ -32,13 +35,18 @@ namespace CP return StatusCode::FAILURE; } - ATH_CHECK(m_egammaContH.initialize(m_systematicsList)); - ATH_CHECK(m_muonContH.initialize(m_systematicsList)); + ATH_CHECK(m_egammaContKey.initialize(m_systematicsList)); + ATH_CHECK(m_muonContKey.initialize(m_systematicsList)); ANA_CHECK (m_systematicsList.initialize()); m_wpDec = std::make_unique<SG::AuxElement::Decorator<uint32_t> > (m_selectionName.value()); + if (!m_vetoFSR) { + ATH_MSG_INFO("Reading container " << m_egammaContKey.getNamePattern() << " for FSR search for muons from " << m_muonContKey.getNamePattern() << ". Those passing " << m_selectionName.value() << " are also accepted."); + } + else { + ATH_MSG_INFO("Reading container " << m_egammaContKey.getNamePattern() << " for FSR search for muons from " << m_muonContKey.getNamePattern() << ". The electrons or photons matching FSR requirements with muons will be vetoed with " << m_selectionName.value()); - ATH_MSG_INFO("Reading container " << m_egammaContH.getNamePattern() << " for FSR search for muons from " << m_muonContH.getNamePattern() << ". Those passing " << m_selectionName.value() << " are also accepted."); + } // Return gracefully: return StatusCode::SUCCESS; @@ -50,26 +58,45 @@ namespace CP // const EventContext &ctx = Gaudi::Hive::currentContext(); + auto selDec = std::make_unique<SG::AuxElement::Decorator<uint32_t> > ("selectEta"); + auto oqDec = std::make_unique<SG::AuxElement::Decorator<uint32_t> > ("goodOQ"); + auto cleanDec = std::make_unique<SG::AuxElement::Decorator<uint32_t> > ("isClean"); + // Loop over systematics for (const auto& sys : m_systematicsList.systematicsVector()) { // Retrieve electrons or photons const xAOD::IParticleContainer* egammaCont = nullptr; - ANA_CHECK (m_egammaContH.retrieve (egammaCont, sys)); + ANA_CHECK (m_egammaContKey.retrieve (egammaCont, sys)); // Retrieve muons const xAOD::MuonContainer* muonCont = nullptr; - ANA_CHECK (m_muonContH.retrieve (muonCont, sys)); + ANA_CHECK (m_muonContKey.retrieve (muonCont, sys)); // Loop over each electron or photon. If already passing WP selection, decorate passWPorFSR as true + // If m_vetoFSR is set, then reverse logic is used - require electron or photon to pass WP selection, + // and then veto is if if passes the FSR selection for ( auto eg : *egammaCont ) { - // If passes std WP, accept - if ((*m_wpDec)(*eg) == selectionAccept()) { - ATH_MSG_DEBUG("Eg passed WP - pt, eta: " << eg->type() << ", " << eg->pt()/1000. << ", " << eg->eta() << ", " << (*m_wpDec)(*eg) ); - continue; // ok, skip to next el/ph + if (!m_vetoFSR) { + // Standard logic - If passes std WP, accept + if ((*m_wpDec)(*eg) == selectionAccept()) { + ATH_MSG_DEBUG("Eg passed WP - pt, eta: " << eg->type() << ", " << eg->pt()/1000. << ", " << eg->eta() << ", " << (*m_wpDec)(*eg) ); + continue; // ok, skip to next el/ph + } + else ATH_MSG_DEBUG("Eg failed WP: " << m_selectionName.value() << ", " << (*m_wpDec)(*eg) ); + } + else { + // Inverted logic - If passes std WP, continue with the FSR search + if ((*m_wpDec)(*eg) == selectionAccept()) { + ATH_MSG_DEBUG("Veto FSR: Eg passed WP - pt, eta: " << eg->type() << ", " << eg->pt()/1000. << ", " << eg->eta() << ", " << (*m_wpDec)(*eg) ); + + } + else { + ATH_MSG_DEBUG("Veto FSR: Eg failed WP: " << m_selectionName.value() << ", " << (*m_wpDec)(*eg) << " skipping." ); + continue; // ok, skip to next el/ph + } } - else ATH_MSG_DEBUG("Eg failed WP: " << m_selectionName.value() << ", " << (*m_wpDec)(*eg) ); const xAOD::Electron* el = (eg->type() == xAODType::Electron) ? dynamic_cast<const xAOD::Electron*>(eg) : 0; @@ -88,17 +115,27 @@ namespace CP bool elmutrackmatchOK = true; // default true for photons if (el) { const xAOD::TrackParticle* electron_track = el->trackParticle(); + const xAOD::TrackParticle* elOrig_track = xAOD::EgammaHelpers::getOriginalTrackParticle(el); const xAOD::TrackParticle* muon_track = mu->primaryTrackParticle(); elmutrackmatchOK = - ( (fabs(electron_track->theta()- muon_track->theta()) < 0.01) && + ( (std::abs(electron_track->theta()- muon_track->theta()) < 0.01) && (xAOD::P4Helpers::deltaPhi(electron_track->phi(), muon_track->phi()) < 0.01) ); + ATH_MSG_DEBUG( "dtheta trk " << std::abs(electron_track->theta()- muon_track->theta()) << ", dphi trk " + << xAOD::P4Helpers::deltaPhi(electron_track->phi(), muon_track->phi())); + if (elOrig_track) ATH_MSG_DEBUG( "origTrk: dtheta trk " << std::abs(elOrig_track->theta()- muon_track->theta()) << ", dphi trk " + << xAOD::P4Helpers::deltaPhi(elOrig_track->phi(), muon_track->phi())); if (elmutrackmatchOK) ATH_MSG_DEBUG( "track match OK"); else ATH_MSG_DEBUG( "track match NOT OK"); } if (elmutrackmatchOK) { - (*m_wpDec)(*eg) = selectionAccept(); + (*m_wpDec)(*eg) = (m_vetoFSR) ? selectionReject() : selectionAccept(); ATH_MSG_DEBUG( "dR OK - wp " << (*m_wpDec)(*eg) ); + + if (selDec->isAvailable(*eg)) ATH_MSG_DEBUG( "selectEta: " << (*selDec)(*eg) ); + if (oqDec->isAvailable(*eg)) ATH_MSG_DEBUG( "goodOQ: " << (*oqDec)(*eg) ); + if (cleanDec->isAvailable(*eg)) ATH_MSG_DEBUG( "isClean: " << (*cleanDec)(*eg) ); + break; } } diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py index 5d8fee1f1e8fc16d9e85a661d0c695f3b1b04080..8b61712b945ae00a1b2b45f1195903f52de9e631 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py @@ -169,30 +169,52 @@ class ElectronWorkingPointConfig (ConfigBlock) : # It is safe to do this before calibration, as the cluster E is used alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronLikelihoodAlg' + postfix ) alg.selectionDecoration = 'selectLikelihood' + selectionPostfix + ',as_bits' - if 'SiHits' in self.likelihoodWP: - # Select from Derivation Framework IsEM bits - config.addPrivateTool( 'selectionTool', 'CP::AsgMaskSelectionTool' ) - dfVar = "DFCommonElectronsLHLooseBLIsEMValue" - alg.selectionTool.selectionVars = [dfVar] - mask = int( 0 | 0x1 << 1 | 0x1 << 2) - alg.selectionTool.selectionMasks = [mask] + if self.recomputeLikelihood: + # Rerun the likelihood ID + config.addPrivateTool( 'selectionTool', 'AsgElectronLikelihoodTool' ) + alg.selectionTool.primaryVertexContainer = 'PrimaryVertices' + # Here we have to match the naming convention of EGSelectorConfigurationMapping.h + if config.geometry() >= LHCPeriod.Run3: + alg.selectionTool.WorkingPoint = self.likelihoodWP + 'Electron' + elif config.geometry() == LHCPeriod.Run2: + alg.selectionTool.WorkingPoint = self.likelihoodWP + 'Electron_Run2' else: - if self.recomputeLikelihood: - # Rerun the likelihood ID - config.addPrivateTool( 'selectionTool', 'AsgElectronLikelihoodTool' ) - alg.selectionTool.primaryVertexContainer = 'PrimaryVertices' - # Here we have to match the naming convention of EGSelectorConfigurationMapping.h - if config.geometry() >= LHCPeriod.Run3: - alg.selectionTool.WorkingPoint = self.likelihoodWP + 'Electron' - elif config.geometry() == LHCPeriod.Run2: - alg.selectionTool.WorkingPoint = self.likelihoodWP + 'Electron_Run2' - else: - # Select from Derivation Framework flags - config.addPrivateTool( 'selectionTool', 'CP::AsgFlagSelectionTool' ) - dfFlag = "DFCommonElectronsLH" + self.likelihoodWP.split('LH')[0] - dfFlag = dfFlag.replace("BLayer","BL") - alg.selectionTool.selectionFlags = [dfFlag] - else: + # Select from Derivation Framework flags + config.addPrivateTool( 'selectionTool', 'CP::AsgFlagSelectionTool' ) + dfFlag = "DFCommonElectronsLH" + self.likelihoodWP.split('LH')[0] + dfFlag = dfFlag.replace("BLayer","BL") + alg.selectionTool.selectionFlags = [dfFlag] + elif 'SiHit' in self.likelihoodWP: + # Only want SiHit electrons, so veto loose LH electrons + algVeto = config.createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronLikelihoodAlgVeto' + postfix + 'Veto') + algVeto.selectionDecoration = 'selectLikelihoodVeto' + postfix + ',as_bits' + config.addPrivateTool( 'selectionTool', 'CP::AsgFlagSelectionTool' ) + algVeto.selectionTool.selectionFlags = ["DFCommonElectronsLHLoose"] + algVeto.selectionTool.invertFlags = [True] + algVeto.particles = config.readName (self.containerName) + algVeto.preselection = config.getPreselection (self.containerName, self.selectionName) + # add in as preselection a veto + config.addSelection (self.containerName, self.selectionName, algVeto.selectionDecoration) + + # Select SiHit electrons using IsEM bits + alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronLikelihoodAlg' + postfix ) + alg.selectionDecoration = 'selectSiHit' + selectionPostfix + ',as_bits' + # Select from Derivation Framework IsEM bits + config.addPrivateTool( 'selectionTool', 'CP::AsgMaskSelectionTool' ) + dfVar = "DFCommonElectronsLHLooseBLIsEMValue" + alg.selectionTool.selectionVars = [dfVar] + mask = int( 0 | 0x1 << 1 | 0x1 << 2) + alg.selectionTool.selectionMasks = [mask] + + # Set up the ElectronSiHitDecAlg algorithm to decorate SiHit electrons with a minimal amount of information: + algDec = config.createAlgorithm( 'CP::ElectronSiHitDecAlg', 'ElectronSiHitDecAlg' + postfix ) + selDec = 'siHitEvtHasLeptonPair' + selectionPostfix + ',as_bits' + algDec.selectionName = selDec.split(",")[0] + algDec.ElectronContainer = config.readName (self.containerName) + # Set flag to only collect SiHit electrons for events with an electron or muon pair to minimize size increase from SiHit electrons + algDec.RequireTwoLeptons = True + config.addSelection (self.containerName, self.selectionName, selDec) + elif 'DNN' in self.likelihoodWP: # Set up the DNN ID selection algorithm alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronDNNAlg' + postfix ) alg.selectionDecoration = 'selectDNN' + selectionPostfix + ',as_bits' @@ -207,6 +229,7 @@ class ElectronWorkingPointConfig (ConfigBlock) : else: # Select from Derivation Framework flags raise ValueError ( "DNN working points are not available in derivations yet.") + alg.particles = config.readName (self.containerName) alg.preselection = config.getPreselection (self.containerName, self.selectionName) config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration) @@ -218,6 +241,11 @@ class ElectronWorkingPointConfig (ConfigBlock) : alg = config.createAlgorithm( 'CP::EgammaFSRForMuonsCollectorAlg', 'EgammaFSRForMuonsCollectorAlg' + postfix ) alg.selectionDecoration = wpFlag alg.ElectronOrPhotonContKey = config.readName (self.containerName) + # For SiHit electrons, set flag to remove FSR electrons. + # For standard electrons, FSR electrons need to be added as they may be missed by the standard selection. + # For SiHit electrons FSR electrons are generally always selected, so they should be removed since they will be in the standard electron container. + if 'SiHit' in self.likelihoodWP: + alg.vetoFSR = True # Set up the isolation selection algorithm: if self.isolationWP != 'NonIso' : diff --git a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_entries.cxx index 4836be8f96404d65d3b303acfbed40068a140558..6f78d9d05c974f6459115d6cec63c182869e5d10 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_entries.cxx +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/src/components/EgammaAnalysisAlgorithms_entries.cxx @@ -10,7 +10,7 @@ #include <EgammaAnalysisAlgorithms/ElectronLRTMergingAlg.h> #include <EgammaAnalysisAlgorithms/PhotonOriginCorrectionAlg.h> #include <EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h> - +#include <EgammaAnalysisAlgorithms/ElectronSiHitDecAlg.h> DECLARE_COMPONENT (CP::EgammaCalibrationAndSmearingAlg) DECLARE_COMPONENT (CP::EgammaIsGoodOQSelectionTool) @@ -22,4 +22,5 @@ DECLARE_COMPONENT (CP::PhotonShowerShapeFudgeAlg) DECLARE_COMPONENT (CP::ElectronLRTMergingAlg) DECLARE_COMPONENT (CP::PhotonOriginCorrectionAlg) DECLARE_COMPONENT (CP::EgammaFSRForMuonsCollectorAlg) +DECLARE_COMPONENT (CP::ElectronSiHitDecAlg) diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/CMakeLists.txt b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/CMakeLists.txt index 994ebc145471f8562fee7fc8212365aa0d5d51fd..bd6e2d3b4a8d746accbc0ca14df7425440c673f1 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/CMakeLists.txt +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # # @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/ChargeSelectorAlg.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/ChargeSelectorAlg.h index 700cbb72c753509f8c758d22151a5f188d6c8625..bf262ccbc111f997eb395d0fa257039ceb5f7c66 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/ChargeSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/ChargeSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassSelectorAlg.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassSelectorAlg.h index 017d5ea29e2cbc1b00146706a78d1fd71c5225c8..14c7d8e33e6e775da773079a10aaa3160ce77613 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassWindowSelectorAlg.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassWindowSelectorAlg.h index 23dd2d07338b3b529194655fbd769a415362aaa9..7a64df02a01f1dfdbc52d8345a228e85f2bd5129 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassWindowSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassWindowSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/EventSelectionAlgorithmsDict.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/EventSelectionAlgorithmsDict.h index 0dc1fec471677c02c2af22b058bbad6a2737fae6..5c604a48edaaf9e866d75f0224d39e36db5ad4b5 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/EventSelectionAlgorithmsDict.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/EventSelectionAlgorithmsDict.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina @@ -16,5 +16,9 @@ #include <EventSelectionAlgorithms/SaveFilterAlg.h> #include <EventSelectionAlgorithms/SignEnums.h> #include <EventSelectionAlgorithms/NObjectPtSelectorAlg.h> +#include <EventSelectionAlgorithms/NObjectMassSelectorAlg.h> +#include <EventSelectionAlgorithms/NLargeRJetMassWindowSelectorAlg.h> +#include <EventSelectionAlgorithms/DileptonOSSFInvariantMassWindowSelectorAlg.h> +#include <EventSelectionAlgorithms/SumNElNMuPtSelectorAlg.h> #endif diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETPlusTransverseMassSelectorAlg.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETPlusTransverseMassSelectorAlg.h index 2261fc005ff7319aab1927ef49baf941a89c8261..edb76c7939443d42a08a4b5fa5e96048c8d9b5c8 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETPlusTransverseMassSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETPlusTransverseMassSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETSelectorAlg.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETSelectorAlg.h index 9f85bf164c251f9a8cd6c731376d53a22fd41c59..155b60c1c5aad444ba6616f357984dd429ffcda5 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/NObjectPtSelectorAlg.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/NObjectPtSelectorAlg.h index 40553137d0aa334c2fa371cd337a46c605a92341..dda4c143ab7d5716267e7ddc4f6fd2ff6264d8e9 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/NObjectPtSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/NObjectPtSelectorAlg.h @@ -1,11 +1,11 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina -#ifndef EVENT_SELECTOR_NOBJECTPTELECTORALG_H -#define EVENT_SELECTOR_NOBJECTPTELECTORALG_H +#ifndef EVENT_SELECTOR_NOBJECTPTSELECTORALG_H +#define EVENT_SELECTOR_NOBJECTPTSELECTORALG_H // Algorithm includes #include <AnaAlgorithm/AnaAlgorithm.h> @@ -81,4 +81,4 @@ namespace CP { }; // class } // namespace CP -#endif // EVENT_SELECTOR_NOBJECTPTELECTORALG_H +#endif // EVENT_SELECTOR_NOBJECTPTSELECTORALG_H diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SaveFilterAlg.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SaveFilterAlg.h index 37aec0fa777523e939bd4cb69a4cb0f7119dd9d0..bbef3a0a2404df9b75183d1ded5de6c36b47690f 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SaveFilterAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SaveFilterAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SignEnums.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SignEnums.h index 73116256a3129a3bc90fe6ce7bfe5bc954617d46..d94227d7ce5f4a846045d742cf5e51e855f4bf43 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SignEnums.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SignEnums.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/TransverseMassSelectorAlg.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/TransverseMassSelectorAlg.h index 6e48ca4b094f176198121a3d10f690802756ddda..00a5d726b50bec81e483c3d1ea5168b092b427f4 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/TransverseMassSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/TransverseMassSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/selection.xml b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/selection.xml index 7332cc65810de6b30575f36456ff3cdbb988fc93..d7109666271b2d8bed5907befde2e4c5df8719cb 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/selection.xml +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/selection.xml @@ -9,6 +9,10 @@ <class name="CP::SaveFilterAlg" /> <class name="CP::SignEnums" /> <class name="CP::NObjectPtSelectorAlg" /> + <class name="CP::NObjectMassSelectorAlg" /> + <class name="CP::NLargeRJetMassWindowSelectorAlg" /> + <class name="CP::DileptonOSSFInvariantMassWindowSelectorAlg" /> + <class name="CP::SumNElNMuPtSelectorAlg" /> </lcgdict> diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/ChargeSelectorAlg.cxx b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/ChargeSelectorAlg.cxx index 24d4227bb88277c4afaeec6a653ae02a509cab4e..e470c2a2168998d6c35a5d41345ee903cbe83795 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/ChargeSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/ChargeSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassSelectorAlg.cxx b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassSelectorAlg.cxx index 426eb129a5d034c92c4f4a524425c3a90d54a681..3887669a99c46316f826d61f480b3ae6c71abff5 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassWindowSelectorAlg.cxx b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassWindowSelectorAlg.cxx index ec4fe2030211bad48d08d4adf5b4855a2dce6218..7c9b0bec6ccb2c339f1151313e2f52b4f97a1d56 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassWindowSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassWindowSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETPlusTransverseMassSelectorAlg.cxx b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETPlusTransverseMassSelectorAlg.cxx index e0db4405edc8678ff9fcb500c856db6b50464231..ea7c6f3401dd55d2c3b2034a3a281c595014ba7a 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETPlusTransverseMassSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETPlusTransverseMassSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETSelectorAlg.cxx b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETSelectorAlg.cxx index 5d8fcb5c19c95eec34181c15394e0347b2b5cfcb..7039c8107cc04b5fa32fbded03f7b99d5dead22c 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/NObjectPtSelectorAlg.cxx b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/NObjectPtSelectorAlg.cxx index f4150db19bd05ca49cfd950879e7656df9ece0ce..49198d2aa9ae5a554b44c0cfc92a9cf100eeb8ae 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/NObjectPtSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/NObjectPtSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/SaveFilterAlg.cxx b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/SaveFilterAlg.cxx index a06b0a26b2e0ad75970930b6e06d49c7246cc135..4ee73f2db7d64edf8e87a1521830775fc9a4d1ec 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/SaveFilterAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/SaveFilterAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/TransverseMassSelectorAlg.cxx b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/TransverseMassSelectorAlg.cxx index 1a11c1cde5fc39b661030b0788f546aa83c4906c..18b5666561703f1150dcfcef03c122358ad12c32 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/TransverseMassSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/TransverseMassSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/EventSelectionConfig.py b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/EventSelectionConfig.py index 4e2f94726cd3776b7bf8b5a0c9a38782f675d13e..1182d01857a2e6f0ef4ae5cc66916a259d835cce 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/EventSelectionConfig.py +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/EventSelectionConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock from AsgAnalysisAlgorithms.AsgAnalysisConfig import makeEventCutFlowConfig @@ -28,6 +28,7 @@ class EventSelectionConfig(ConfigBlock): self.addOption('electrons', "", type=str) self.addOption('muons', "", type=str) self.addOption('jets', "", type=str) + self.addOption('largeRjets', "", type=str) self.addOption('photons', "", type=str) self.addOption('taus', "", type=str) self.addOption('met', "", type=str) @@ -67,6 +68,8 @@ class EventSelectionConfig(ConfigBlock): self.add_NEL_selector(text, cfg) elif "MU_N" in text.split(): self.add_NMU_selector(text, cfg) + elif "SUM_EL_N_MU_N" in text.split(): + self.add_SUMNELNMU_selector(text, cfg) elif "JET_N" in text.split(): self.add_NJET_selector(text, cfg) elif "JET_N_BTAG" in text.split(): @@ -75,6 +78,8 @@ class EventSelectionConfig(ConfigBlock): self.add_NPH_selector(text, cfg) elif "TAU_N" in text.split(): self.add_NTAU_selector(text, cfg) + elif "LJET_N" in text.split(): + self.add_NLJET_selector(text, cfg) elif "MET" in text.split(): self.add_MET_selector(text, cfg) elif "MWT" in text.split(): @@ -89,6 +94,12 @@ class EventSelectionConfig(ConfigBlock): self.add_OS_selector(text, cfg) elif "SS" in text.split(): self.add_SS_selector(text, cfg) + elif "MLL_OSSF" in text.split(): + self.add_MLL_OSSF_selector(text, cfg) + elif "LJETMASS_N" in text.split(): + self.add_NLJETMASS_selector(text, cfg) + elif "LJETMASSWINDOW_N" in text.split(): + self.add_NLJETMASSWINDOW_selector(text, cfg) elif "SAVE" in text.split(): self.add_SAVE(text, cfg) elif "IMPORT" in text.split(): @@ -201,7 +212,7 @@ class EventSelectionConfig(ConfigBlock): if alg.objectSelection: alg.objectSelection += "&&" + config.getFullSelection(self.electrons.split(".")[0], extraSel) else: - alg.objectSElection = config.getFullSelection(self.electrons.split(".")[0], extraSel) + alg.objectSelection = config.getFullSelection(self.electrons.split(".")[0], extraSel) alg.minPt = self.check_float(items[2]) alg.sign = self.check_sign(items[3]) alg.count = self.check_int(items[4]) @@ -229,13 +240,39 @@ class EventSelectionConfig(ConfigBlock): if alg.objectSelection: alg.objectSelection += "&&" + config.getFullSelection(self.muons.split(".")[0], extraSel) else: - alg.objectSElection = config.getFullSelection(self.muons.split(".")[0], extraSel) + alg.objectSelection = config.getFullSelection(self.muons.split(".")[0], extraSel) alg.minPt = self.check_float(items[2]) alg.sign = self.check_sign(items[3]) alg.count = self.check_int(items[4]) self.setDecorationName(alg, config, f'{thisalg}_%SYS%') return + def add_SUMNELNMU_selector(self, text, config): + items = text.split() + if items[0] != "SUM_EL_N_MU_N": + self.raise_misconfig(text, "SUM_EL_N_MU_N") + if len(items) != 4 and len(items) != 5: + self.raise_misconfig(text, "number of arguments") + if not self.electrons and not self.muons: + self.raise_missinginput("electrons or muons") + thisalg = f'{self.name}_SUMNELNMU_{self.step}' + alg = config.createAlgorithm('CP::SumNElNMuPtSelectorAlg', thisalg) + alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons) + alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons) + alg.eventPreselection = f'{self.currentDecoration}' + if len(items) == 4: + alg.minPtEl = self.check_float(items[1]) + alg.minPtMu = self.check_float(items[1]) + alg.sign = self.check_sign(items[2]) + alg.count = self.check_int(items[3]) + elif len(items) == 5: + alg.minPtEl = self.check_float(items[1]) + alg.minPtMu = self.check_float(items[2]) + alg.sign = self.check_sign(items[3]) + alg.count = self.check_int(items[4]) + self.setDecorationName(alg, config, f'{thisalg}_%SYS%') + return + def add_NJET_selector(self, text, config): items = text.split() if items[0] != "JET_N": @@ -257,7 +294,7 @@ class EventSelectionConfig(ConfigBlock): if alg.objectSelection: alg.objectSelection += "&&" + config.getFullSelection(self.jets.split(".")[0], extraSel) else: - alg.objectSElection = config.getFullSelection(self.jets.split(".")[0], extraSel) + alg.objectSelection = config.getFullSelection(self.jets.split(".")[0], extraSel) alg.minPt = self.check_float(items[2]) alg.sign = self.check_sign(items[3]) alg.count = self.check_int(items[4]) @@ -312,7 +349,7 @@ class EventSelectionConfig(ConfigBlock): if alg.objectSelection: alg.objectSelection += "&&" + config.getFullSelection(self.photons.split(".")[0], extraSel) else: - alg.objectSElection = config.getFullSelection(self.photons.split(".")[0], extraSel) + alg.objectSelection = config.getFullSelection(self.photons.split(".")[0], extraSel) alg.minPt = self.check_float(items[2]) alg.sign = self.check_sign(items[3]) alg.count = self.check_int(items[4]) @@ -340,13 +377,95 @@ class EventSelectionConfig(ConfigBlock): if alg.objectSelection: alg.objectSelection += "&&" + config.getFullSelection(self.taus.split(".")[0], extraSel) else: - alg.objectSElection = config.getFullSelection(self.taus.split(".")[0], extraSel) + alg.objectSelection = config.getFullSelection(self.taus.split(".")[0], extraSel) alg.minPt = self.check_float(items[2]) alg.sign = self.check_sign(items[3]) alg.count = self.check_int(items[4]) self.setDecorationName(alg, config, f'{thisalg}_%SYS%') return + def add_NLJET_selector(self, text, config): + items = text.split() + if items[0] != "LJET_N": + self.raise_misconfig(text, "LJET_N") + if len(items) != 4 and len(items) != 5: + self.raise_misconfig(text, "number of arguments") + thisalg = f'{self.name}_NLJET_{self.step}' + alg = config.createAlgorithm('CP::NObjectPtSelectorAlg', thisalg) + alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets) + alg.eventPreselection = f'{self.currentDecoration}' + if len(items) == 4: + alg.minPt = self.check_float(items[1]) + alg.sign = self.check_sign(items[2]) + alg.count = self.check_int(items[3]) + elif len(items) == 5: + extraSel = self.check_string(items[1]) + if alg.objectSelection: + alg.objectSelection += "&&" + config.getFullSelection(self.largeRjets.split(".")[0], extraSel) + else: + alg.objectSelection = config.getFullSelection(self.largeRjets.split(".")[0], extraSel) + alg.minPt = self.check_float(items[2]) + alg.sign = self.check_sign(items[3]) + alg.count = self.check_int(items[4]) + self.setDecorationName(alg, config, f'{thisalg}_%SYS%') + return + + def add_NLJETMASS_selector(self, text, config): + items = text.split() + if items[0] != "LJETMASS_N": + self.raise_misconfig(text, "LJETMASS_N") + if len(items) != 4 and len(items) != 5: + self.raise_misconfig(text, "number of arguments") + thisalg = f'{self.name}_NLJETMASS_{self.step}' + alg = config.createAlgorithm('CP::NObjectMassSelectorAlg', thisalg) + alg.particles, alg.objectSelection = config.readNameAndSelection(self.largeRjets) + alg.eventPreselection = f'{self.currentDecoration}' + if len(items) == 4: + alg.minMass = self.check_float(items[1]) + alg.sign = self.check_sign(items[2]) + alg.count = self.check_int(items[3]) + elif len(items) == 5: + extraSel = self.check_string(items[1]) + if alg.objectSelection: + alg.objectSelection += "&&" + config.getFullSelection(self.largeRjets.split(".")[0], extraSel) + else: + alg.objectSelection = config.getFullSelection(self.largeRjets.split(".")[0], extraSel) + alg.minMass = self.check_float(items[2]) + alg.sign = self.check_sign(items[3]) + alg.count = self.check_int(items[4]) + self.setDecorationName(alg, config, f'{thisalg}_%SYS%') + return + + def add_NLJETMASSWINDOW_selector(self, text, config): + items = text.split() + if items[0] != "LJETMASSWINDOW_N": + self.raise_misconfig(text, "LJETMASSWINDOW_N") + if len(items) != 5 and len(items) != 6 and len(items) != 7: + self.raise_misconfig(text, "number of arguments") + thisalg = f'{self.name}_NLJETMASSWINDOW_{self.step}' + alg = config.createAlgorithm('CP::NLargeRJetMassWindowSelectorAlg', thisalg) + alg.ljets, alg.ljetSelection = config.readNameAndSelection(self.largeRjets) + if len(items) == 5 or (len(items) == 6 and "veto" in items): + alg.lowMass = self.check_float(items[1]) + alg.highMass = self.check_float(items[2]) + alg.sign = self.check_sign(items[3]) + alg.count = self.check_int(items[4]) + alg.vetoMode = (len(items) == 6 and self.check_string(items[5]) == "veto") + elif (len(items) == 6 and "veto" not in items) or len(items) == 7: + extraSel = self.check_string(items[1]) + if alg.ljetSelection: + alg.ljetSelection += "&&" + config.getFullSelection(self.largeRjets.split(".")[0], extraSel) + else: + alg.ljetSelection = config.getFullSelection(self.largeRjets.split(".")[0], extraSel) + alg.lowMass = self.check_float(items[2]) + alg.highMass = self.check_float(items[3]) + alg.sign = self.check_sign(items[4]) + alg.count = self.check_int(items[5]) + alg.vetoMode = (len(items) ==7 and self.check_string(items[6]) == "veto") + alg.eventPreselection = f'{self.currentDecoration}' + self.setDecorationName(alg, config, f'{thisalg}_%SYS%') + return + def add_MET_selector(self, text, config): items = text.split() if items[0] != "MET": @@ -428,7 +547,7 @@ class EventSelectionConfig(ConfigBlock): items = text.split() if items[0] != "MLLWINDOW": self.raise_misconfig(text, "MLLWINDOW") - if len(items) != 3: + if len(items) != 3 and len(items) != 4: self.raise_misconfig(text, "number of arguments") if not self.electrons and not self.muons: self.raise_missinginput("electrons or muons") @@ -440,8 +559,7 @@ class EventSelectionConfig(ConfigBlock): alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons) alg.lowMLL = self.check_float(items[1]) alg.highMLL = self.check_float(items[2]) - # if high<low we are trying to veto events in that window; otherwise we select them - alg.vetoMode = alg.highMLL < alg.lowMLL + alg.vetoMode = (len(items) == 4 and self.check_string(items[3]) == "veto") alg.eventPreselection = f'{self.currentDecoration}' self.setDecorationName(alg, config, f'{thisalg}_%SYS%') return @@ -480,6 +598,27 @@ class EventSelectionConfig(ConfigBlock): self.setDecorationName(alg, config, f'{thisalg}_%SYS%') return + def add_MLL_OSSF_selector(self, text, config): + items = text.split() + if items[0] != "MLL_OSSF": + self.raise_misconfig(text, "MLL_OSSF") + if len(items) != 3 and len(items) != 4: + self.raise_misconfig(text, "number of arguments") + if not self.electrons and not self.muons: + self.raise_missinginput("electrons or muons") + thisalg = f'{self.name}_MLL_OSSF_{self.step}' + alg = config.createAlgorithm('CP::DileptonOSSFInvariantMassWindowSelectorAlg', thisalg) + if self.electrons: + alg.electrons, alg.electronSelection = config.readNameAndSelection(self.electrons) + if self.muons: + alg.muons, alg.muonSelection = config.readNameAndSelection(self.muons) + alg.lowMll = self.check_float(items[1]) + alg.highMll = self.check_float(items[2]) + alg.vetoMode = (len(items) == 4 and self.check_string(items[3]) == "veto") + alg.eventPreselection = f'{self.currentDecoration}' + self.setDecorationName(alg, config, f'{thisalg}_%SYS%') + return + def add_SAVE(self, text, config): items = text.split() if items[0] != "SAVE": @@ -500,6 +639,7 @@ class EventSelectionConfig(ConfigBlock): def makeEventSelectionConfig(seq, name, electrons=None, muons=None, jets=None, + largeRjets=None, photons=None, taus=None, met=None, btagDecoration=None, preselection=None, selectionCuts=None, noFilter=None, @@ -511,6 +651,7 @@ def makeEventSelectionConfig(seq, electrons -- the electron container and selection muons -- the muon container and selection jets -- the jet container and selection + largeRjets -- the large-R jet container and selection photons -- the photon container and selection taus -- the tau-jet container and selection met -- the MET container @@ -526,6 +667,7 @@ def makeEventSelectionConfig(seq, config.setOptionValue ('electrons', electrons, noneAction='ignore') config.setOptionValue ('muons', muons, noneAction='ignore') config.setOptionValue ('jets', jets, noneAction='ignore') + config.setOptionValue ('largeRjets', largeRjets, noneAction='ignore') config.setOptionValue ('photons', photons, noneAction='ignore') config.setOptionValue ('taus', taus, noneAction='ignore') config.setOptionValue ('met', met, noneAction='ignore') @@ -543,6 +685,7 @@ def makeEventSelectionConfig(seq, def makeMultipleEventSelectionConfigs(seq, electrons=None, muons=None, jets=None, + largeRjets=None, photons=None, taus=None, met=None, btagDecoration=None, preselection=None, selectionCutsDict=None, noFilter=None, @@ -553,6 +696,7 @@ def makeMultipleEventSelectionConfigs(seq, electrons -- the electron container and selection muons -- the muon container and selection jets -- the jet container and selection + largeRjets -- the large-R jet container and selection photons -- the photon container and selection taus -- the tau-jet container and selection met -- the MET container @@ -567,13 +711,13 @@ def makeMultipleEventSelectionConfigs(seq, # handle the case where a user is only providing one selection if len(list(selectionCutsDict.keys())) == 1: name, selectionCuts = list(selectionCutsDict.items())[0] - makeEventSelectionConfig(seq, name, electrons, muons, jets, photons, taus, met, btagDecoration, preselection, selectionCuts, noFilter=noFilter, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms) + makeEventSelectionConfig(seq, name, electrons, muons, jets, largeRjets, photons, taus, met, btagDecoration, preselection, selectionCuts, noFilter=noFilter, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms) return # first, we generate all the individual event selections # !!! it's important to pass noFilter=True, to avoid applying the individual filters in series for name, selectionCuts in selectionCutsDict.items(): - makeEventSelectionConfig(seq, name, electrons, muons, jets, photons, taus, met, btagDecoration, preselection, selectionCuts, noFilter=True, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms) + makeEventSelectionConfig(seq, name, electrons, muons, jets, largeRjets, photons, taus, met, btagDecoration, preselection, selectionCuts, noFilter=True, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms) # now we are ready to collect all the filters and apply their logical OR # !!! subregions (name starts with "SUB") are not used in the final filtering diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/__init__.py b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/__init__.py index de5fa7402d66bc45603a69407775aaf463363f7f..2bce7f19313916c34fa2f1ffb71c0d1b5213f006 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/__init__.py +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/__init__.py @@ -1,3 +1,3 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration __version__ = '1.0.0' diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/src/components/EventSelectionAlgorithms_entries.cxx b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/src/components/EventSelectionAlgorithms_entries.cxx index 855b0d0407410d2c819099c9ff48ed2dc36c6931..6a459a7a5878f640c6a28064eead7c101a123637 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/src/components/EventSelectionAlgorithms_entries.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/src/components/EventSelectionAlgorithms_entries.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina @@ -12,6 +12,10 @@ #include <EventSelectionAlgorithms/TransverseMassSelectorAlg.h> #include <EventSelectionAlgorithms/SaveFilterAlg.h> #include <EventSelectionAlgorithms/NObjectPtSelectorAlg.h> +#include <EventSelectionAlgorithms/NObjectMassSelectorAlg.h> +#include <EventSelectionAlgorithms/NLargeRJetMassWindowSelectorAlg.h> +#include <EventSelectionAlgorithms/DileptonOSSFInvariantMassWindowSelectorAlg.h> +#include <EventSelectionAlgorithms/SumNElNMuPtSelectorAlg.h> DECLARE_COMPONENT (CP::ChargeSelectorAlg) DECLARE_COMPONENT (CP::MissingETPlusTransverseMassSelectorAlg) @@ -21,3 +25,7 @@ DECLARE_COMPONENT (CP::DileptonInvariantMassWindowSelectorAlg) DECLARE_COMPONENT (CP::TransverseMassSelectorAlg) DECLARE_COMPONENT (CP::SaveFilterAlg) DECLARE_COMPONENT (CP::NObjectPtSelectorAlg) +DECLARE_COMPONENT (CP::NObjectMassSelectorAlg) +DECLARE_COMPONENT (CP::NLargeRJetMassWindowSelectorAlg) +DECLARE_COMPONENT (CP::DileptonOSSFInvariantMassWindowSelectorAlg) +DECLARE_COMPONENT (CP::SumNElNMuPtSelectorAlg) diff --git a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py index 0e17600a9ea61ac335ec4ff3ec6392ca9265dc8d..73b9726e34896e5e14216202c292b886602e0cff 100644 --- a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py @@ -11,6 +11,7 @@ def makeMuonAnalysisSequence( dataType, workingPoint, postfix = '', ptSelectionOutput = False, trackSelection = True, + maxEta = 2.7, qualitySelectionOutput = True, enableCutflow = False, enableKinematicHistograms = False, @@ -54,7 +55,8 @@ def makeMuonAnalysisSequence( dataType, workingPoint, makeMuonCalibrationSequence (seq, dataType, postfix=postfix, ptSelectionOutput = ptSelectionOutput, - trackSelection = trackSelection) + trackSelection = trackSelection, + maxEta = maxEta) makeMuonWorkingPointSequence (seq, dataType, workingPoint, postfix=postfix, qualitySelectionOutput = qualitySelectionOutput, isRun3Geo = isRun3Geo) makeSharedObjectSequence (seq, deepCopyOutput = deepCopyOutput, @@ -72,7 +74,7 @@ def makeMuonAnalysisSequence( dataType, workingPoint, def makeMuonCalibrationSequence( seq, dataType, - postfix = '', ptSelectionOutput = False, trackSelection = False): + postfix = '', ptSelectionOutput = False, trackSelection = False, maxEta = 2.7): """Create muon calibration analysis algorithms This makes all the algorithms that need to be run first befor @@ -102,7 +104,7 @@ def makeMuonCalibrationSequence( seq, dataType, alg = createAlgorithm( 'CP::AsgSelectionAlg', 'MuonEtaCutAlg' + postfix ) addPrivateTool( alg, 'selectionTool', 'CP::AsgPtEtaSelectionTool' ) - alg.selectionTool.maxEta = 2.7 + alg.selectionTool.maxEta = maxEta alg.selectionDecoration = 'selectEta' + postfix + ',as_bits' seq.append( alg, inputPropName = 'particles', stageName = 'selection', diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauTruthMatchingAlg.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauTruthMatchingAlg.cxx index ba2f8643f4f2f8c55d72c5ee792c16ad40a9c709..b0042e081548a070e391ea8e216790acb844b438 100644 --- a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauTruthMatchingAlg.cxx +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/DiTauTruthMatchingAlg.cxx @@ -52,7 +52,7 @@ namespace CP { if (m_preselection.getBool (*tau, sys)) { - m_matchingTool->applyTruthMatch (*tau); + m_matchingTool->getTruth (*tau); } } } diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauTruthMatchingAlg.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauTruthMatchingAlg.cxx index 3525b8d565c2b4a7fb37a141bddbc38d6337bba8..18bcffd3ed0fda7327da959356a38ca68cf1e0d9 100644 --- a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauTruthMatchingAlg.cxx +++ b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauTruthMatchingAlg.cxx @@ -52,7 +52,7 @@ namespace CP { if (m_preselection.getBool (*tau, sys)) { - m_matchingTool->applyTruthMatch (*tau); + m_matchingTool->getTruth (*tau); } } } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY18.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY18.py index c1236ba45262f8b089bdbc63190476239f099de1..f99511340fb8859daa5a709d8b0b0f31eedadfb1 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY18.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY18.py @@ -234,7 +234,7 @@ def BPHY18Cfg(ConfigFlags): InDetTrackParticlesKey = "InDetTrackParticles") BPHY18TruthThinTool = CompFactory.DerivationFramework.GenericTruthThinning(name = "BPHY18TruthThinTool", - ParticleSelectionString = "abs(TruthParticles.pdgId) == 11 || abs(TruthParticles.pdgId) == 13 || abs(TruthParticles.pdgId) == 10311 || abs(TruthParticles.pdgId) == 521 || abs(TruthParticles.pdgId) == 523 || TruthParticles.pdgId == 511 || TruthParticles.pdgId == 513", + ParticleSelectionString = "abs(TruthParticles.pdgId) == 11 || abs(TruthParticles.pdgId) == 13 || abs(TruthParticles.pdgId) == 10311 || abs(TruthParticles.pdgId) == 521 || abs(TruthParticles.pdgId) == 523 || abs(TruthParticles.pdgId) == 511 || abs(TruthParticles.pdgId) == 513", PreserveDescendants = True, StreamName = streamName, PreserveAncestors = True) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/TriggerContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/TriggerContent.py index 44acf3daa25626fd51e1dcbdfc49ce04357eb02c..ad01a9404369a4e10bd5c6c0f9f3517b25191d08 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/TriggerContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/TriggerContent.py @@ -1,9 +1,9 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # ******************************************************************** # TriggerContent.py -# -# Configures content on EGAM derivations needed for trigger usage and +# +# Configures content on EGAM derivations needed for trigger usage and # trigger studies # author: fernando.monticelli@cern.ch # ******************************************************************** @@ -11,830 +11,811 @@ # List of single photon triggers. Including those used for Bootstrap studies singlePhotonTriggers = {} -singlePhotonTriggers['Run3'] = [ - 'HLT_g10_loose_L1EM7', - 'HLT_g10_loose_L1eEM9', - 'HLT_g15_loose_L1EM10VH', - 'HLT_g15_loose_L1eEM12L', - 'HLT_g15_tight_L1EM10VH', - 'HLT_g15_tight_L1eEM12L', - 'HLT_g20_loose_L1EM15VH', - 'HLT_g20_loose_L1eEM18L', - 'HLT_g20_tight_L1EM15VHI', - 'HLT_g20_tight_L1eEM18M', - 'HLT_g20_tight_icaloloose_L1EM15VHI', - 'HLT_g20_tight_icaloloose_L1eEM18M', - 'HLT_g22_tight_L1EM15VHI', - 'HLT_g22_tight_L1eEM18M', - 'HLT_g25_loose_L1EM20VH', - 'HLT_g25_loose_L1eEM24L', - 'HLT_g25_medium_L1EM20VH', - 'HLT_g25_medium_L1eEM24L', - 'HLT_g25_tight_icaloloose_L1EM20VH', - 'HLT_g25_tight_icalomedium_L1EM20VH', - 'HLT_g25_tight_icalotight_L1EM20VH', - 'HLT_g300_etcut_L1eEM26M', - 'HLT_g30_loose_L1EM20VH', - 'HLT_g30_loose_L1eEM24L', - 'HLT_g35_medium_L1EM20VH', - 'HLT_g35_medium_L1eEM24L', - 'HLT_g40_loose_L1EM20VH', - 'HLT_g40_loose_L1eEM24L', - 'HLT_g50_loose_L1EM20VH', - 'HLT_g50_loose_L1eEM24L', - 'HLT_g60_loose_L1EM22VHI', - 'HLT_g60_loose_L1eEM26M', - 'HLT_g80_loose_L1EM22VHI', - 'HLT_g80_loose_L1eEM26M', - 'HLT_g100_loose_L1EM22VHI', - 'HLT_g100_loose_L1eEM26M', - 'HLT_g120_loose_L1EM22VHI', - 'HLT_g120_loose_L1eEM26M', - 'HLT_g140_loose_L1EM22VHI', - 'HLT_g140_loose_L1eEM26M', - 'HLT_g250_etcut_L1EM22VHI', - 'HLT_g250_etcut_L1eEM26M', - 'HLT_g300_etcut_L1EM22VHI', - ] - -singlePhotonTriggers['Run2'] = [ - 'HLT_g6_loose', - 'HLT_g6_tight_icalotight', - 'HLT_g10_etcut', - 'HLT_g10_loose', - 'HLT_g10_loose_L1EM3', - 'HLT_g10_medium', - 'HLT_g10_medium_L1EM3', - 'HLT_g12_loose', - 'HLT_g12_medium', - 'HLT_g15_etcut_L1EM7', - 'HLT_g15_loose', - 'HLT_g15_loose_L1EM3', - 'HLT_g15_loose_L1EM7', - 'HLT_g15_loose_L1EM8VH', - 'HLT_g20_etcut', - 'HLT_g20_etcut_L1EM12', - 'HLT_g20_etcut_L1EM15', - 'HLT_g20_loose', - 'HLT_g20_loose_L1EM12', - 'HLT_g20_loose_L1EM15', - 'HLT_g20_loose_L1EM18VH', - 'HLT_g20_medium', - 'HLT_g20_medium_L1EM15', - 'HLT_g20_tight', - 'HLT_g20_tight_L1EM15', - 'HLT_g20_tight_L1EM15VHI', - 'HLT_g20_tight_icalotight_L1EM15VHI', - 'HLT_g20_tight_icalovloose_L1EM15VHI', - 'HLT_g22_tight', - 'HLT_g22_tight_L1EM15VHI', - 'HLT_g22_tight_icalotight', - 'HLT_g22_tight_icalotight_L1EM15VHI', - 'HLT_g22_tight_icalovloose', - 'HLT_g22_tight_icalovloose_L1EM15VHI', - 'HLT_g24_loose', - 'HLT_g25_etcut_L1EM15', - 'HLT_g25_loose', - 'HLT_g25_loose_L1EM15 ', - 'HLT_g25_loose_L1EM20VH', - 'HLT_g25_medium', - 'HLT_g25_medium_L1EM15', - 'HLT_g25_medium_L1EM20VH', - 'HLT_g25_medium_L1EM22VHI', - 'HLT_g25_tight_L1EM15', - 'HLT_g25_tight_L1EM20VH', - 'HLT_g30_etcut_L1EM15' - 'HLT_g30_loose_L1EM15', - 'HLT_g35_loose', - 'HLT_g35_loose_L1EM15', - 'HLT_g35_loose_L1EM20VH', - 'HLT_g35_loose_L1EM22VHI', - 'HLT_g35_loose_L1EM24VHI', - 'HLT_g35_loose_L1EM24VHIM', - 'HLT_g35_loose_L1EM26VHI', - 'HLT_g35_medium', - 'HLT_g35_medium_L1EM20VH', - 'HLT_g35_medium_L1EM22VHI', - 'HLT_g35_medium_L1EM24VHI', - 'HLT_g35_medium_icalotight', - 'HLT_g35_medium_icalovloose', - 'HLT_g35_tight_icalotight_L1EM24VHI', - 'HLT_g35_tight_icalotight_L1EM24VHIM', - 'HLT_g40_loose_L1EM15', - 'HLT_g40_tight', - 'HLT_g40_tight_icalotight_L1EM24VHI', - 'HLT_g40_tight_icalotight_L1EM24VHIM', - 'HLT_g45_loose_L1EM15', - 'HLT_g45_tight', - 'HLT_g45_tight_L1EM22VHI', - 'HLT_g45_tight_L1EM24VHI', - 'HLT_g50_loose', - 'HLT_g50_loose_L1EM15', - 'HLT_g50_loose_L1EM20VH', - 'HLT_g60_loose', - 'HLT_g60_loose_L1EM15VH ', - 'HLT_g60_loose_L1EM20VH', - 'HLT_g60_loose_L1EM24VHI', - 'HLT_g60_loose_L1EM24VHIM', - 'HLT_g60_loose_L1EM26VHI', - 'HLT_g70_loose', - 'HLT_g70_loose_L1EM24VHI', - 'HLT_g70_loose_L1EM24VHIM', - 'HLT_g70_loose_L1EM26VHI', - 'HLT_g70_loose_L1EN24VHIM', - 'HLT_g80_loose', - 'HLT_g80_loose_L1EM24VHI', - 'HLT_g80_loose_L1EM24VHIM', - 'HLT_g80_loose_L1EM26VHI', - 'HLT_g80_loose_icalovloose_L1EM24VHIM', - 'HLT_g85_tight', - 'HLT_g85_tight_L1EM24VHI', - 'HLT_g85_tight_L1EM24VHIM', - 'HLT_g85_tight_icalovloose_L1EM24VHI', - 'HLT_g85_tight_icalovloose_L1EM24VHIM', - 'HLT_g100_loose', - 'HLT_g100_loose_L1EM24VHI', - 'HLT_g100_loose_L1EM24VHIM', - 'HLT_g100_loose_L1EM26VHI', - 'HLT_g100_tight', - 'HLT_g100_tight_L1EM24VHI', - 'HLT_g100_tight_L1EM24VHIM', - 'HLT_g100_tight_icalovloose_L1EM24', - 'HLT_g100_tight_icalovloose_L1EM24VHI', - 'HLT_g100_tight_icalovloose_L1EM24VHIM', - 'HLT_g120_loose', - 'HLT_g120_loose_L1EM24VHI', - 'HLT_g120_loose_L1EM24VHIM', - 'HLT_g120_loose_L1EM26VHI', - 'HLT_g140_loose', - 'HLT_g140_loose_HLTCalo', - 'HLT_g140_loose_L1EM24VHIM', - 'HLT_g140_loose_L1EM26VHI', - 'HLT_g140_tight', - 'HLT_g140_tight_L1EM24VHIM', - 'HLT_g160_loose', - 'HLT_g160_loose_L1EM24VHIM', - 'HLT_g160_loose_L1EM26VHI', - 'HLT_g180_loose', - 'HLT_g180_loose_L1EM24VHIM', - 'HLT_g180_loose_L1EM26VHI', - 'HLT_g200_etcut', - 'HLT_g200_loose', - 'HLT_g200_loose_L1EM24VHIM', - 'HLT_g200_loose_L1EM26VHI', - 'HLT_g250_etcut', - 'HLT_g300_etcut' - 'HLT_g300_etcut_L1EM24VHI', - 'HLT_g300_etcut_L1EM24VHIM', - ] +singlePhotonTriggers["Run3"] = [ + "HLT_g10_loose_L1EM7", + "HLT_g10_loose_L1eEM9", + "HLT_g15_loose_L1EM10VH", + "HLT_g15_loose_L1eEM12L", + "HLT_g15_tight_L1EM10VH", + "HLT_g15_tight_L1eEM12L", + "HLT_g20_loose_L1EM15VH", + "HLT_g20_loose_L1eEM18L", + "HLT_g20_tight_L1EM15VHI", + "HLT_g20_tight_L1eEM18M", + "HLT_g20_tight_icaloloose_L1EM15VHI", + "HLT_g20_tight_icaloloose_L1eEM18M", + "HLT_g22_tight_L1EM15VHI", + "HLT_g22_tight_L1eEM18M", + "HLT_g25_loose_L1EM20VH", + "HLT_g25_loose_L1eEM24L", + "HLT_g25_medium_L1EM20VH", + "HLT_g25_medium_L1eEM24L", + "HLT_g25_tight_icaloloose_L1EM20VH", + "HLT_g25_tight_icalomedium_L1EM20VH", + "HLT_g25_tight_icalotight_L1EM20VH", + "HLT_g300_etcut_L1eEM26M", + "HLT_g30_loose_L1EM20VH", + "HLT_g30_loose_L1eEM24L", + "HLT_g35_medium_L1EM20VH", + "HLT_g35_medium_L1eEM24L", + "HLT_g40_loose_L1EM20VH", + "HLT_g40_loose_L1eEM24L", + "HLT_g50_loose_L1EM20VH", + "HLT_g50_loose_L1eEM24L", + "HLT_g60_loose_L1EM22VHI", + "HLT_g60_loose_L1eEM26M", + "HLT_g80_loose_L1EM22VHI", + "HLT_g80_loose_L1eEM26M", + "HLT_g100_loose_L1EM22VHI", + "HLT_g100_loose_L1eEM26M", + "HLT_g120_loose_L1EM22VHI", + "HLT_g120_loose_L1eEM26M", + "HLT_g140_loose_L1EM22VHI", + "HLT_g140_loose_L1eEM26M", + "HLT_g250_etcut_L1EM22VHI", + "HLT_g250_etcut_L1eEM26M", + "HLT_g300_etcut_L1EM22VHI", +] + +singlePhotonTriggers["Run2"] = [ + "HLT_g6_loose", + "HLT_g6_tight_icalotight", + "HLT_g10_etcut", + "HLT_g10_loose", + "HLT_g10_loose_L1EM3", + "HLT_g10_medium", + "HLT_g10_medium_L1EM3", + "HLT_g12_loose", + "HLT_g12_medium", + "HLT_g15_etcut_L1EM7", + "HLT_g15_loose", + "HLT_g15_loose_L1EM3", + "HLT_g15_loose_L1EM7", + "HLT_g15_loose_L1EM8VH", + "HLT_g20_etcut", + "HLT_g20_etcut_L1EM12", + "HLT_g20_etcut_L1EM15", + "HLT_g20_loose", + "HLT_g20_loose_L1EM12", + "HLT_g20_loose_L1EM15", + "HLT_g20_loose_L1EM18VH", + "HLT_g20_medium", + "HLT_g20_medium_L1EM15", + "HLT_g20_tight", + "HLT_g20_tight_L1EM15", + "HLT_g20_tight_L1EM15VHI", + "HLT_g20_tight_icalotight_L1EM15VHI", + "HLT_g20_tight_icalovloose_L1EM15VHI", + "HLT_g22_tight", + "HLT_g22_tight_L1EM15VHI", + "HLT_g22_tight_icalotight", + "HLT_g22_tight_icalotight_L1EM15VHI", + "HLT_g22_tight_icalovloose", + "HLT_g22_tight_icalovloose_L1EM15VHI", + "HLT_g24_loose", + "HLT_g25_etcut_L1EM15", + "HLT_g25_loose", + "HLT_g25_loose_L1EM15 ", + "HLT_g25_loose_L1EM20VH", + "HLT_g25_medium", + "HLT_g25_medium_L1EM15", + "HLT_g25_medium_L1EM20VH", + "HLT_g25_medium_L1EM22VHI", + "HLT_g25_tight_L1EM15", + "HLT_g25_tight_L1EM20VH", + "HLT_g30_etcut_L1EM15" "HLT_g30_loose_L1EM15", + "HLT_g35_loose", + "HLT_g35_loose_L1EM15", + "HLT_g35_loose_L1EM20VH", + "HLT_g35_loose_L1EM22VHI", + "HLT_g35_loose_L1EM24VHI", + "HLT_g35_loose_L1EM24VHIM", + "HLT_g35_loose_L1EM26VHI", + "HLT_g35_medium", + "HLT_g35_medium_L1EM20VH", + "HLT_g35_medium_L1EM22VHI", + "HLT_g35_medium_L1EM24VHI", + "HLT_g35_medium_icalotight", + "HLT_g35_medium_icalovloose", + "HLT_g35_tight_icalotight_L1EM24VHI", + "HLT_g35_tight_icalotight_L1EM24VHIM", + "HLT_g40_loose_L1EM15", + "HLT_g40_tight", + "HLT_g40_tight_icalotight_L1EM24VHI", + "HLT_g40_tight_icalotight_L1EM24VHIM", + "HLT_g45_loose_L1EM15", + "HLT_g45_tight", + "HLT_g45_tight_L1EM22VHI", + "HLT_g45_tight_L1EM24VHI", + "HLT_g50_loose", + "HLT_g50_loose_L1EM15", + "HLT_g50_loose_L1EM20VH", + "HLT_g60_loose", + "HLT_g60_loose_L1EM15VH ", + "HLT_g60_loose_L1EM20VH", + "HLT_g60_loose_L1EM24VHI", + "HLT_g60_loose_L1EM24VHIM", + "HLT_g60_loose_L1EM26VHI", + "HLT_g70_loose", + "HLT_g70_loose_L1EM24VHI", + "HLT_g70_loose_L1EM24VHIM", + "HLT_g70_loose_L1EM26VHI", + "HLT_g70_loose_L1EN24VHIM", + "HLT_g80_loose", + "HLT_g80_loose_L1EM24VHI", + "HLT_g80_loose_L1EM24VHIM", + "HLT_g80_loose_L1EM26VHI", + "HLT_g80_loose_icalovloose_L1EM24VHIM", + "HLT_g85_tight", + "HLT_g85_tight_L1EM24VHI", + "HLT_g85_tight_L1EM24VHIM", + "HLT_g85_tight_icalovloose_L1EM24VHI", + "HLT_g85_tight_icalovloose_L1EM24VHIM", + "HLT_g100_loose", + "HLT_g100_loose_L1EM24VHI", + "HLT_g100_loose_L1EM24VHIM", + "HLT_g100_loose_L1EM26VHI", + "HLT_g100_tight", + "HLT_g100_tight_L1EM24VHI", + "HLT_g100_tight_L1EM24VHIM", + "HLT_g100_tight_icalovloose_L1EM24", + "HLT_g100_tight_icalovloose_L1EM24VHI", + "HLT_g100_tight_icalovloose_L1EM24VHIM", + "HLT_g120_loose", + "HLT_g120_loose_L1EM24VHI", + "HLT_g120_loose_L1EM24VHIM", + "HLT_g120_loose_L1EM26VHI", + "HLT_g140_loose", + "HLT_g140_loose_HLTCalo", + "HLT_g140_loose_L1EM24VHIM", + "HLT_g140_loose_L1EM26VHI", + "HLT_g140_tight", + "HLT_g140_tight_L1EM24VHIM", + "HLT_g160_loose", + "HLT_g160_loose_L1EM24VHIM", + "HLT_g160_loose_L1EM26VHI", + "HLT_g180_loose", + "HLT_g180_loose_L1EM24VHIM", + "HLT_g180_loose_L1EM26VHI", + "HLT_g200_etcut", + "HLT_g200_loose", + "HLT_g200_loose_L1EM24VHIM", + "HLT_g200_loose_L1EM26VHI", + "HLT_g250_etcut", + "HLT_g300_etcut" "HLT_g300_etcut_L1EM24VHI", + "HLT_g300_etcut_L1EM24VHIM", +] diPhotonTriggers = {} -diPhotonTriggers['Run3'] = [ - 'HLT_2g15_loose_25dphiAA_invmAA80_L12EM7', - 'HLT_2g15_loose_25dphiAA_invmAA80_L1DPHI-M70-2eEM15M', - 'HLT_2g15_tight_25dphiAA_invmAA80_L12EM7', - 'HLT_2g15_tight_25dphiAA_invmAA80_L1DPHI-M70-2eEM15M', - 'HLT_2g15_tight_25dphiAA_L12EM7', - 'HLT_2g15_tight_25dphiAA_L1DPHI-M70-2eEM15M', - 'HLT_2g20_loose_L12eEM18L', - 'HLT_2g20_loose_L12EM15VH', - 'HLT_2g20_tight_icaloloose_L12eEM18M', - 'HLT_2g20_tight_icaloloose_L12EM15VHI', - 'HLT_2g20_tight_L12EM15VHI', - 'HLT_2g22_tight_L12eEM18M', - 'HLT_2g22_tight_L12EM15VHI', - 'HLT_2g22_tight_L1eEM9_EMPTY', - 'HLT_2g22_tight_L1eEM9_UNPAIRED_ISO', - 'HLT_2g22_tight_L1EM7_EMPTY', - 'HLT_2g22_tight_L1EM7_UNPAIRED_ISO', - 'HLT_2g25_loose_g15_loose_L12eEM24L', - 'HLT_2g25_loose_g15_loose_L12EM20VH', - 'HLT_2g50_loose_L12eEM24L', - 'HLT_2g50_loose_L12EM20VH', - 'HLT_2g50_tight_L1eEM9_EMPTY', - 'HLT_2g50_tight_L1eEM9_UNPAIRED_ISO', - 'HLT_2g50_tight_L1EM7_EMPTY', - 'HLT_2g50_tight_L1EM7_UNPAIRED_ISO', - 'HLT_2g9_loose_25dphiAA_invmAA80_L12EM7', - 'HLT_2g9_loose_25dphiAA_invmAA80_L1DPHI-M70-2eEM9', - 'HLT_2g9_loose_25dphiAA_invmAA80_L1DPHI-M70-2eEM9L', - 'HLT_g35_medium_g25_medium_L12eEM24L', - 'HLT_g35_medium_g25_medium_L12EM20VH', - 'HLT_g35_medium_g25_medium_L1eEM9_EMPTY', - 'HLT_g35_medium_g25_medium_L1eEM9_UNPAIRED_ISO', - 'HLT_g35_medium_g25_medium_L1EM7_EMPTY', - 'HLT_g35_medium_g25_medium_L1EM7_UNPAIRED_ISO', - ] - - -diPhotonTriggers['Run2'] = [ - 'HLT_2g20_loose_L12EM15', - 'HLT_2g20_loose', - 'HLT_2g20_tight', - 'HLT_2g22_tight', - 'HLT_2g25_tight', - 'HLT_g35_loose_g25_loose', - 'HLT_g35_medium_HLTCalo_g25_medium_HLTCalo', - 'HLT_g35_loose_L1EM15_g25_loose_L1EM15', - 'HLT_g35_loose_L1EM15VH_g25_loose_L1EM15VH', - 'HLT_g35_medium_g25_medium', - 'HLT_2g50_loose', - 'HLT_2g60_loose_L12EM15VH ', - 'HLT_2g10_loose', - 'HLT_2g50_loose_L12EM18VH', - 'HLT_2g60_loose_L12EM18VH', - 'HLT_2g50_loose_L12EM20VH', - 'HLT_g50_loose_L12EM18VH', - 'HLT_g60_loose_L12EM18VH', - 'HLT_g50_loose_L12EM20VH', - 'HLT_g60_loose_L12EM20VH', - 'HLT_2g25_tight_L12EM20VH', - 'HLT_g35_loose_g25_loose_L12EM18VH', - 'HLT_g35_loose_g25_loose_L12EM20VH ', - 'HLT_g35_medium_g25_medium_L12EM18VH', - 'HLT_g35_medium_g25_medium_L12EM20VH', - 'HLT_2g20_tight_L12EM15VHI', - 'HLT_2g20_tight_icalovloose_L12EM15VHI', - 'HLT_2g20_tight_icalotight_L12EM15VHI', - 'HLT_2g22_tight_L12EM15VHI', - 'HLT_2g22_tight_icalovloose_L12EM15VHI', - 'HLT_2g22_tight_icalotight_L12EM15VHI', - 'HLT_2g60_loose_L12EM20VH', - 'HLT_2g3_loose_dPhi15_L12EM3_VTE50', - 'HLT_2g3_loose_L12EM3_VTE50', - 'HLT_2g3_medium_dPhi15_L12EM3_VTE50', - 'HLT_2g22_tight_icalovloose', - 'HLT_2g22_tight_icalotight', - 'HLT_2g10_loose_L12EM7', - 'HLT_2g15_loose_L12EM7'] +diPhotonTriggers["Run3"] = [ + "HLT_2g15_loose_25dphiAA_invmAA80_L12EM7", + "HLT_2g15_loose_25dphiAA_invmAA80_L1DPHI-M70-2eEM15M", + "HLT_2g15_tight_25dphiAA_invmAA80_L12EM7", + "HLT_2g15_tight_25dphiAA_invmAA80_L1DPHI-M70-2eEM15M", + "HLT_2g15_tight_25dphiAA_L12EM7", + "HLT_2g15_tight_25dphiAA_L1DPHI-M70-2eEM15M", + "HLT_2g20_loose_L12eEM18L", + "HLT_2g20_loose_L12EM15VH", + "HLT_2g20_tight_icaloloose_L12eEM18M", + "HLT_2g20_tight_icaloloose_L12EM15VHI", + "HLT_2g20_tight_L12EM15VHI", + "HLT_2g22_tight_L12eEM18M", + "HLT_2g22_tight_L12EM15VHI", + "HLT_2g22_tight_L1eEM9_EMPTY", + "HLT_2g22_tight_L1eEM9_UNPAIRED_ISO", + "HLT_2g22_tight_L1EM7_EMPTY", + "HLT_2g22_tight_L1EM7_UNPAIRED_ISO", + "HLT_2g25_loose_g15_loose_L12eEM24L", + "HLT_2g25_loose_g15_loose_L12EM20VH", + "HLT_2g50_loose_L12eEM24L", + "HLT_2g50_loose_L12EM20VH", + "HLT_2g50_tight_L1eEM9_EMPTY", + "HLT_2g50_tight_L1eEM9_UNPAIRED_ISO", + "HLT_2g50_tight_L1EM7_EMPTY", + "HLT_2g50_tight_L1EM7_UNPAIRED_ISO", + "HLT_2g9_loose_25dphiAA_invmAA80_L12EM7", + "HLT_2g9_loose_25dphiAA_invmAA80_L1DPHI-M70-2eEM9", + "HLT_2g9_loose_25dphiAA_invmAA80_L1DPHI-M70-2eEM9L", + "HLT_g35_medium_g25_medium_L12eEM24L", + "HLT_g35_medium_g25_medium_L12EM20VH", + "HLT_g35_medium_g25_medium_L1eEM9_EMPTY", + "HLT_g35_medium_g25_medium_L1eEM9_UNPAIRED_ISO", + "HLT_g35_medium_g25_medium_L1EM7_EMPTY", + "HLT_g35_medium_g25_medium_L1EM7_UNPAIRED_ISO", +] + + +diPhotonTriggers["Run2"] = [ + "HLT_2g20_loose_L12EM15", + "HLT_2g20_loose", + "HLT_2g20_tight", + "HLT_2g22_tight", + "HLT_2g25_tight", + "HLT_g35_loose_g25_loose", + "HLT_g35_medium_HLTCalo_g25_medium_HLTCalo", + "HLT_g35_loose_L1EM15_g25_loose_L1EM15", + "HLT_g35_loose_L1EM15VH_g25_loose_L1EM15VH", + "HLT_g35_medium_g25_medium", + "HLT_2g50_loose", + "HLT_2g60_loose_L12EM15VH ", + "HLT_2g10_loose", + "HLT_2g50_loose_L12EM18VH", + "HLT_2g60_loose_L12EM18VH", + "HLT_2g50_loose_L12EM20VH", + "HLT_g50_loose_L12EM18VH", + "HLT_g60_loose_L12EM18VH", + "HLT_g50_loose_L12EM20VH", + "HLT_g60_loose_L12EM20VH", + "HLT_2g25_tight_L12EM20VH", + "HLT_g35_loose_g25_loose_L12EM18VH", + "HLT_g35_loose_g25_loose_L12EM20VH ", + "HLT_g35_medium_g25_medium_L12EM18VH", + "HLT_g35_medium_g25_medium_L12EM20VH", + "HLT_2g20_tight_L12EM15VHI", + "HLT_2g20_tight_icalovloose_L12EM15VHI", + "HLT_2g20_tight_icalotight_L12EM15VHI", + "HLT_2g22_tight_L12EM15VHI", + "HLT_2g22_tight_icalovloose_L12EM15VHI", + "HLT_2g22_tight_icalotight_L12EM15VHI", + "HLT_2g60_loose_L12EM20VH", + "HLT_2g3_loose_dPhi15_L12EM3_VTE50", + "HLT_2g3_loose_L12EM3_VTE50", + "HLT_2g3_medium_dPhi15_L12EM3_VTE50", + "HLT_2g22_tight_icalovloose", + "HLT_2g22_tight_icalotight", + "HLT_2g10_loose_L12EM7", + "HLT_2g15_loose_L12EM7", +] triPhotonTriggers = {} -triPhotonTriggers['Run3'] = [ - 'HLT_2g25_loose_g15_loose_L12EM20VH', - 'HLT_2g25_loose_g15_loose_L12eEM24L' - ] -triPhotonTriggers['Run2'] = [ - 'HLT_3g15_loose', - 'HLT_g20_loose_2g15_loose_L12EM13VH', - 'HLT_2g20_loose_g15_loose', - 'HLT_3g20_loose', - 'HLT_3g20_loose_L12EM18VH', - 'HLT_2g24_loose_g15_loose', - 'HLT_2g24_g20_loose', - 'HLT_3g24_loose_L12EM20VH', - 'HLT_2g25_loose_g15_loose', - 'HLT_2g25_loose_g20_loose', - 'HLT_3g25_loose'] +triPhotonTriggers["Run3"] = [ + "HLT_2g25_loose_g15_loose_L12EM20VH", + "HLT_2g25_loose_g15_loose_L12eEM24L", +] +triPhotonTriggers["Run2"] = [ + "HLT_3g15_loose", + "HLT_g20_loose_2g15_loose_L12EM13VH", + "HLT_2g20_loose_g15_loose", + "HLT_3g20_loose", + "HLT_3g20_loose_L12EM18VH", + "HLT_2g24_loose_g15_loose", + "HLT_2g24_g20_loose", + "HLT_3g24_loose_L12EM20VH", + "HLT_2g25_loose_g15_loose", + "HLT_2g25_loose_g20_loose", + "HLT_3g25_loose", +] JPsiTriggers = {} -JPsiTriggers['Run3'] = [ - 'HLT_e9_lhtight_e4_idperf_tight_probe_1invmAB5_L1JPSI-1M5-EM7', - 'HLT_e9_lhtight_e4_idperf_tight_nogsf_probe_1invmAB5_L1JPSI-1M5-EM7', - 'HLT_e14_lhtight_e4_idperf_tight_probe_1invmAB5_L1JPSI-1M5-EM12', - 'HLT_e14_lhtight_e4_idperf_tight_nogsf_probe_1invmAB5_L1JPSI-1M5-EM12', - 'HLT_e9_lhtight_e4_idperf_tight_probe_1invmAB5_L1JPSI-1M5-eEM9', - 'HLT_e9_lhtight_e4_idperf_tight_nogsf_probe_1invmAB5_L1JPSI-1M5-eEM9', - 'HLT_e14_lhtight_e4_idperf_tight_probe_1invmAB5_L1JPSI-1M5-eEM15', - 'HLT_e14_lhtight_e4_idperf_tight_nogsf_probe_1invmAB5_L1JPSI-1M5-eEM15', - 'HLT_e9_lhtight_e4_etcut_1invmAB5_L1JPSI-1M5-EM7', - 'HLT_e5_lhtight_e9_etcut_1invmAB5_L1JPSI-1M5-EM7', - 'HLT_e5_lhtight_e14_etcut_1invmAB5_L1JPSI-1M5-EM12', - 'HLT_e14_lhtight_e4_etcut_1invmAB5_L1JPSI-1M5-EM12', - 'HLT_e9_lhtight_e4_etcut_1invmAB5_L1JPSI-1M5-eEM9', - 'HLT_e5_lhtight_e9_etcut_1invmAB5_L1JPSI-1M5-eEM9', - 'HLT_e5_lhtight_e14_etcut_1invmAB5_L1JPSI-1M5-eEM15', - 'HLT_e14_lhtight_e4_etcut_1invmAB5_L1JPSI-1M5-eEM15', - ] -JPsiTriggers['Run2'] = [ - 'HLT_e5_lhtight_e4_etcut_Jpsiee', - 'HLT_e5_lhtight_nod0_e4_etcut_Jpsiee', - 'HLT_e5_lhtight_e4_etcut', - 'HLT_e5_lhtight_nod0_e4_etcut', - - 'HLT_e9_lhtight_e4_etcut_Jpsiee', - 'HLT_e9_lhtight_nod0_e4_etcut_Jpsiee', - 'HLT_e9_etcut_e5_lhtight_nod0_Jpsiee', - 'HLT_e9_etcut_e5_lhtight_Jpsiee', - - 'HLT_e14_etcut_e5_lhtight_Jpsiee', - 'HLT_e14_etcut_e5_lhtight_nod0_Jpsiee', - 'HLT_e14_lhtight_e4_etcut_Jpsiee', - 'HLT_e14_lhtight_nod0_e4_etcut_Jpsiee', - - 'HLT_e5_lhtight_nod0_e4_etcut_Jpsiee_L1RD0_FILLED', - 'HLT_e5_lhtight_nod0_e9_etcut_Jpsiee', - 'HLT_e5_lhtight_nod0_e14_etcut_Jpsiee', - 'HLT_e5_lhtight_nod0_e9_etcut_Jpsiee_L1JPSI-1M5-EM7', - 'HLT_e9_lhtight_nod0_e4_etcut_Jpsiee_L1JPSI-1M5-EM7', - 'HLT_e5_lhtight_nod0_e14_etcut_Jpsiee_L1JPSI-1M5-EM12', - 'HLT_e14_lhtight_nod0_e4_etcut_Jpsiee_L1JPSI-1M5-EM12', - ] +JPsiTriggers["Run3"] = [ + "HLT_e9_lhtight_e4_idperf_tight_probe_1invmAB5_L1JPSI-1M5-EM7", + "HLT_e9_lhtight_e4_idperf_tight_nogsf_probe_1invmAB5_L1JPSI-1M5-EM7", + "HLT_e14_lhtight_e4_idperf_tight_probe_1invmAB5_L1JPSI-1M5-EM12", + "HLT_e14_lhtight_e4_idperf_tight_nogsf_probe_1invmAB5_L1JPSI-1M5-EM12", + "HLT_e9_lhtight_e4_idperf_tight_probe_1invmAB5_L1JPSI-1M5-eEM9", + "HLT_e9_lhtight_e4_idperf_tight_nogsf_probe_1invmAB5_L1JPSI-1M5-eEM9", + "HLT_e14_lhtight_e4_idperf_tight_probe_1invmAB5_L1JPSI-1M5-eEM15", + "HLT_e14_lhtight_e4_idperf_tight_nogsf_probe_1invmAB5_L1JPSI-1M5-eEM15", + "HLT_e9_lhtight_e4_etcut_1invmAB5_L1JPSI-1M5-EM7", + "HLT_e5_lhtight_e9_etcut_1invmAB5_L1JPSI-1M5-EM7", + "HLT_e5_lhtight_e14_etcut_1invmAB5_L1JPSI-1M5-EM12", + "HLT_e14_lhtight_e4_etcut_1invmAB5_L1JPSI-1M5-EM12", + "HLT_e9_lhtight_e4_etcut_1invmAB5_L1JPSI-1M5-eEM9", + "HLT_e5_lhtight_e9_etcut_1invmAB5_L1JPSI-1M5-eEM9", + "HLT_e5_lhtight_e14_etcut_1invmAB5_L1JPSI-1M5-eEM15", + "HLT_e14_lhtight_e4_etcut_1invmAB5_L1JPSI-1M5-eEM15", +] +JPsiTriggers["Run2"] = [ + "HLT_e5_lhtight_e4_etcut_Jpsiee", + "HLT_e5_lhtight_nod0_e4_etcut_Jpsiee", + "HLT_e5_lhtight_e4_etcut", + "HLT_e5_lhtight_nod0_e4_etcut", + "HLT_e9_lhtight_e4_etcut_Jpsiee", + "HLT_e9_lhtight_nod0_e4_etcut_Jpsiee", + "HLT_e9_etcut_e5_lhtight_nod0_Jpsiee", + "HLT_e9_etcut_e5_lhtight_Jpsiee", + "HLT_e14_etcut_e5_lhtight_Jpsiee", + "HLT_e14_etcut_e5_lhtight_nod0_Jpsiee", + "HLT_e14_lhtight_e4_etcut_Jpsiee", + "HLT_e14_lhtight_nod0_e4_etcut_Jpsiee", + "HLT_e5_lhtight_nod0_e4_etcut_Jpsiee_L1RD0_FILLED", + "HLT_e5_lhtight_nod0_e9_etcut_Jpsiee", + "HLT_e5_lhtight_nod0_e14_etcut_Jpsiee", + "HLT_e5_lhtight_nod0_e9_etcut_Jpsiee_L1JPSI-1M5-EM7", + "HLT_e9_lhtight_nod0_e4_etcut_Jpsiee_L1JPSI-1M5-EM7", + "HLT_e5_lhtight_nod0_e14_etcut_Jpsiee_L1JPSI-1M5-EM12", + "HLT_e14_lhtight_nod0_e4_etcut_Jpsiee_L1JPSI-1M5-EM12", +] WTnPTriggers = {} -WTnPTriggers['Run3'] = [ - # No W TnP triggers in the menu? - ] - -WTnPTriggers['Run2'] = [ - # L1Topo W T&P - 'HLT_e13_etcut_trkcut' , - 'HLT_e18_etcut_trkcut' , - ## # Non-L1Topo W TP commissioning triggers ==> in MC, in 50 ns data - 'HLT_e13_etcut_trkcut_xs15' , - 'HLT_e18_etcut_trkcut_xs20' , - ## W T&P triggers ==> not in MC, in 50 ns data - 'HLT_e13_etcut_trkcut_xs15_mt25' , - 'HLT_e18_etcut_trkcut_xs20_mt35' , - ###W T&P triggers ==> not in MC, not in 50 ns data, will be in 25 ns data - 'HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_2dphi05' , - 'HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_2dphi05_mt25' , - 'HLT_e13_etcut_trkcut_j20_perf_xe15_2dphi05_mt25' , - 'HLT_e13_etcut_trkcut_j20_perf_xe15_2dphi05' , - 'HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_6dphi05' , - 'HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_6dphi05_mt25' , - 'HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi05_mt25' , - 'HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi05' , - 'HLT_e18_etcut_trkcut_xs20_j20_perf_xe20_6dphi15' , - 'HLT_e18_etcut_trkcut_xs20_j20_perf_xe20_6dphi15_mt35' , - 'HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15_mt35' , - 'HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15' , - - # others - 'HLT_e5_etcut_L1W-05DPHI-JXE-0', - 'HLT_e5_etcut_L1W-10DPHI-JXE-0', - 'HLT_e5_etcut_L1W-15DPHI-JXE-0', - 'HLT_e5_etcut_L1W-10DPHI-EMXE-0', - 'HLT_e5_etcut_L1W-15DPHI-EMXE-0', - 'HLT_e5_etcut_L1W-05DPHI-EMXE-1', - 'HLT_e5_etcut_L1W-05RO-XEHT-0', - 'HLT_e5_etcut_L1W-90RO2-XEHT-0', - 'HLT_e5_etcut_L1W-250RO2-XEHT-0', - 'HLT_e5_etcut_L1W-HT20-JJ15.ETA49', - - 'HLT_e13_etcut_L1W-NOMATCH', - 'HLT_e13_etcut_L1W-NOMATCH_W-05RO-XEEMHT', - 'HLT_e13_etcut_L1EM10_W-MT25', - 'HLT_e13_etcut_L1EM10_W-MT30', - 'HLT_e13_etcut_trkcut_L1EM12', - 'HLT_e13_etcut_trkcut_L1EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE', - 'HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi15_mt25', - 'HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi15_mt25_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20', - 'HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi15_mt25_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0', - 'HLT_e13_etcut_trkcut_xs30_xe30_mt35', - 'HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35', - 'HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35', - 'HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_2dphi05_mt35', - 'HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35', - 'HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20', - 'HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0', - - 'HLT_e18_etcut_L1EM15_W-MT35', - 'HLT_e18_etcut_trkcut_L1EM15', - 'HLT_e18_etcut_trkcut_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE', - 'HLT_e18_etcut_trkcut_xs30_xe30_mt35', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi05_mt35', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi05_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE', - 'HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EM15XE', - 'HLT_e18_etcut_trkcut_xs30_xe30_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30', - 'HLT_e18_etcut_trkcut_xs30_xe30_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE', - 'HLT_e18_etcut_trkcut_xs30_xe30_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EM15XE', - 'HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30', - 'HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE', - - # added for 2017 - 'HLT_e60_etcut', - 'HLT_e60_etcut_L1EM24VHIM', - 'HLT_e60_etcut_trkcut_L1EM24VHIM_j15_perf_xe60_6dphi15_mt35', - 'HLT_e60_etcut_trkcut_L1EM24VHIM_xe60_mt35', - 'HLT_e60_etcut_trkcut_L1EM24VHIM_xs30_j15_perf_xe30_6dphi15_mt35', - 'HLT_e60_etcut_trkcut_L1EM24VHIM_xs30_xe30_mt35', - 'HLT_e60_lhmedium_nod0', - 'HLT_e60_lhmedium_nod0_L1EM24VHI', - 'HLT_e60_lhmedium_nod0_L1EM24VHIM', - 'HLT_e60_lhvloose_nod0', - 'HLT_e60_etcut_trkcut_j15_perf_xe60_6dphi05_mt35', - 'HLT_e60_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35', - 'HLT_e70_etcut', - 'HLT_e70_etcut_L1EM24VHIM', - 'HLT_e70_lhloose_nod0_L1EM24VHIM_xe70noL1', - 'HLT_e70_lhloose_nod0_xe70noL1', - 'HLT_noalg_l1topo_L1EM15', - 'HLT_noalg_l1topo_L1EM7', - 'HLT_j80_xe80', - 'HLT_xe80_tc_lcw_L1XE50', - 'HLT_xe90_mht_L1XE50', - 'HLT_xe90_tc_lcw_wEFMu_L1XE50', - 'HLT_xe90_mht_wEFMu_L1XE50', - 'HLT_xe110_mht_L1XE50', - 'HLT_xe110_pufit_L1XE50', - - #added for low-mu data analysis, 2017 and 2018 data - 'HLT_e15_lhloose_nod0_L1EM12', - #added for low-mu data analysis, 2018 data - 'HLT_xe35', - 'HLT_e15_etcut_trkcut_xe30noL1', +WTnPTriggers["Run3"] = [ + # No W TnP triggers in the menu? +] + +WTnPTriggers["Run2"] = [ + # L1Topo W T&P + "HLT_e13_etcut_trkcut", + "HLT_e18_etcut_trkcut", + ## # Non-L1Topo W TP commissioning triggers ==> in MC, in 50 ns data + "HLT_e13_etcut_trkcut_xs15", + "HLT_e18_etcut_trkcut_xs20", + ## W T&P triggers ==> not in MC, in 50 ns data + "HLT_e13_etcut_trkcut_xs15_mt25", + "HLT_e18_etcut_trkcut_xs20_mt35", + ###W T&P triggers ==> not in MC, not in 50 ns data, will be in 25 ns data + "HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_2dphi05", + "HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_2dphi05_mt25", + "HLT_e13_etcut_trkcut_j20_perf_xe15_2dphi05_mt25", + "HLT_e13_etcut_trkcut_j20_perf_xe15_2dphi05", + "HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_6dphi05", + "HLT_e13_etcut_trkcut_xs15_j20_perf_xe15_6dphi05_mt25", + "HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi05_mt25", + "HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi05", + "HLT_e18_etcut_trkcut_xs20_j20_perf_xe20_6dphi15", + "HLT_e18_etcut_trkcut_xs20_j20_perf_xe20_6dphi15_mt35", + "HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15_mt35", + "HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15", + # others + "HLT_e5_etcut_L1W-05DPHI-JXE-0", + "HLT_e5_etcut_L1W-10DPHI-JXE-0", + "HLT_e5_etcut_L1W-15DPHI-JXE-0", + "HLT_e5_etcut_L1W-10DPHI-EMXE-0", + "HLT_e5_etcut_L1W-15DPHI-EMXE-0", + "HLT_e5_etcut_L1W-05DPHI-EMXE-1", + "HLT_e5_etcut_L1W-05RO-XEHT-0", + "HLT_e5_etcut_L1W-90RO2-XEHT-0", + "HLT_e5_etcut_L1W-250RO2-XEHT-0", + "HLT_e5_etcut_L1W-HT20-JJ15.ETA49", + "HLT_e13_etcut_L1W-NOMATCH", + "HLT_e13_etcut_L1W-NOMATCH_W-05RO-XEEMHT", + "HLT_e13_etcut_L1EM10_W-MT25", + "HLT_e13_etcut_L1EM10_W-MT30", + "HLT_e13_etcut_trkcut_L1EM12", + "HLT_e13_etcut_trkcut_L1EM10_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE", + "HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi15_mt25", + "HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi15_mt25_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20", + "HLT_e13_etcut_trkcut_j20_perf_xe15_6dphi15_mt25_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0", + "HLT_e13_etcut_trkcut_xs30_xe30_mt35", + "HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35", + "HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35", + "HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_2dphi05_mt35", + "HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35", + "HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20", + "HLT_e13_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0", + "HLT_e18_etcut_L1EM15_W-MT35", + "HLT_e18_etcut_trkcut_L1EM15", + "HLT_e18_etcut_trkcut_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EMXE", + "HLT_e18_etcut_trkcut_xs30_xe30_mt35", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi05_mt35", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi05_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_2dphi15_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE", + "HLT_e18_etcut_trkcut_xs30_j15_perf_xe30_6dphi15_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EM15XE", + "HLT_e18_etcut_trkcut_xs30_xe30_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30", + "HLT_e18_etcut_trkcut_xs30_xe30_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE", + "HLT_e18_etcut_trkcut_xs30_xe30_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EM15XE", + "HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15_mt35_L1EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30", + "HLT_e18_etcut_trkcut_j20_perf_xe20_6dphi15_mt35_L1EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE", + # added for 2017 + "HLT_e60_etcut", + "HLT_e60_etcut_L1EM24VHIM", + "HLT_e60_etcut_trkcut_L1EM24VHIM_j15_perf_xe60_6dphi15_mt35", + "HLT_e60_etcut_trkcut_L1EM24VHIM_xe60_mt35", + "HLT_e60_etcut_trkcut_L1EM24VHIM_xs30_j15_perf_xe30_6dphi15_mt35", + "HLT_e60_etcut_trkcut_L1EM24VHIM_xs30_xe30_mt35", + "HLT_e60_lhmedium_nod0", + "HLT_e60_lhmedium_nod0_L1EM24VHI", + "HLT_e60_lhmedium_nod0_L1EM24VHIM", + "HLT_e60_lhvloose_nod0", + "HLT_e60_etcut_trkcut_j15_perf_xe60_6dphi05_mt35", + "HLT_e60_etcut_trkcut_xs30_j15_perf_xe30_6dphi05_mt35", + "HLT_e70_etcut", + "HLT_e70_etcut_L1EM24VHIM", + "HLT_e70_lhloose_nod0_L1EM24VHIM_xe70noL1", + "HLT_e70_lhloose_nod0_xe70noL1", + "HLT_noalg_l1topo_L1EM15", + "HLT_noalg_l1topo_L1EM7", + "HLT_j80_xe80", + "HLT_xe80_tc_lcw_L1XE50", + "HLT_xe90_mht_L1XE50", + "HLT_xe90_tc_lcw_wEFMu_L1XE50", + "HLT_xe90_mht_wEFMu_L1XE50", + "HLT_xe110_mht_L1XE50", + "HLT_xe110_pufit_L1XE50", + # added for low-mu data analysis, 2017 and 2018 data + "HLT_e15_lhloose_nod0_L1EM12", + # added for low-mu data analysis, 2018 data + "HLT_xe35", + "HLT_e15_etcut_trkcut_xe30noL1", +] + + +noalgTriggers = {} +noalgTriggers["Run2"] = [ + "HLT_noalg_L1EM15VH", + "HLT_noalg_L1EM12", + "HLT_noalg_L1EM15", + "HLT_noalg_L1EM18VH", + "HLT_noalg_L1EM20VH", + "HLT_noalg_L1EM10", + "HLT_noalg_L1EM10VH", + "HLT_noalg_L1EM13VH", + "HLT_noalg_L1EM20VHI", + "HLT_noalg_L1EM22VHI", + "HLT_noalg_L1EM8VH", +] +noalgTriggers["Run3"] = [ + "HLT_noalg_L1EM22VHI", + "HLT_noalg_L1EM3", + "HLT_noalg_L1EM7", + "HLT_noalg_L1EM12", + "HLT_noalg_L1EM15", + "HLT_noalg_L1EM8VH", + "HLT_noalg_L1EM10VH", + "HLT_noalg_L1EM15VH", + "HLT_noalg_L1EM20VH", + "HLT_noalg_L1eEM5", + "HLT_noalg_L1eEM7", + "HLT_noalg_L1eEM9", + "HLT_noalg_L1eEM10L", + "HLT_noalg_L1eEM12L", + "HLT_noalg_L1eEM15", + "HLT_noalg_L1eEM18", + "HLT_noalg_L1eEM18L", + "HLT_noalg_L1eEM18M", + "HLT_noalg_L1eEM22M", + "HLT_noalg_L1eEM24L", + "HLT_noalg_L1eEM24VM", + "HLT_noalg_L1eEM26", + "HLT_noalg_L1eEM26L", + "HLT_noalg_L1eEM26M", + "HLT_noalg_L1eEM26T", ] -noalgTriggers={} -noalgTriggers['Run2'] = [ - 'HLT_noalg_L1EM15VH', - 'HLT_noalg_L1EM12', - 'HLT_noalg_L1EM15', - 'HLT_noalg_L1EM18VH', - 'HLT_noalg_L1EM20VH', - 'HLT_noalg_L1EM10', - 'HLT_noalg_L1EM10VH', - 'HLT_noalg_L1EM13VH', - 'HLT_noalg_L1EM20VHI', - 'HLT_noalg_L1EM22VHI', - 'HLT_noalg_L1EM8VH', - ] -noalgTriggers['Run3'] = [ - 'HLT_noalg_L1EM22VHI', - 'HLT_noalg_L1EM3', - 'HLT_noalg_L1EM7', - 'HLT_noalg_L1EM12', - 'HLT_noalg_L1EM15', - 'HLT_noalg_L1EM8VH', - 'HLT_noalg_L1EM10VH', - 'HLT_noalg_L1EM15VH', - 'HLT_noalg_L1EM20VH', - 'HLT_noalg_L1eEM5', - 'HLT_noalg_L1eEM7', - 'HLT_noalg_L1eEM9', - 'HLT_noalg_L1eEM10L', - 'HLT_noalg_L1eEM12L', - 'HLT_noalg_L1eEM15', - 'HLT_noalg_L1eEM18', - 'HLT_noalg_L1eEM18L', - 'HLT_noalg_L1eEM18M', - 'HLT_noalg_L1eEM22M', - 'HLT_noalg_L1eEM24L', - 'HLT_noalg_L1eEM24VM', - 'HLT_noalg_L1eEM26', - 'HLT_noalg_L1eEM26L', - 'HLT_noalg_L1eEM26M', - 'HLT_noalg_L1eEM26T', - ] - - - -#==================================================================== +# ==================================================================== # trigger-based selection # prescaled _etcut triggers # prescaled _loose triggers # prescaled _lhloose triggers -#==================================================================== +# ==================================================================== BkgElectronTriggers = {} -BkgElectronTriggers['Run3'] = [ - 'HLT_e5_nopid_L1EM3', - 'HLT_e5_etcut_L1EM3', - 'HLT_e50_etcut_L1EM22VHI', - 'HLT_e50_etcut_L1eEM26M', - 'HLT_e120_etcut_L1EM22VHI', - 'HLT_e120_etcut_L1eEM26M', - 'HLT_e250_etcut_L1EM22VHI', - 'HLT_e250_etcut_L1eEM26M', - 'HLT_e300_etcut_L1eEM26M', - 'HLT_e300_etcut_L1EM22VHI', - 'HLT_g250_etcut_L1EM22VHI', - 'HLT_g250_etcut_L1eEM26M', - 'HLT_g300_etcut_L1EM22VHI', - 'HLT_g300_etcut_L1eEM26M', - ] - -BkgElectronTriggers['Run2'] = [ - 'HLT_e4_etcut' , - 'HLT_e5_etcut' , - 'HLT_e9_etcut' , - 'HLT_e10_etcut_L1EM7' , - 'HLT_e14_etcut' , - 'HLT_e15_etcut_L1EM7' , - 'HLT_e17_etcut_L1EM15', - 'HLT_e20_etcut_L1EM12', - 'HLT_e25_etcut_L1EM15', - 'HLT_e30_etcut_L1EM15', - 'HLT_e40_etcut_L1EM15', - 'HLT_e50_etcut_L1EM15', - 'HLT_e60_etcut' , - 'HLT_e80_etcut' , - 'HLT_e100_etcut' , - 'HLT_e120_etcut' , - 'HLT_g10_etcut' , - 'HLT_g20_etcut_L1EM12', - 'HLT_g200_etcut' , - 'HLT_e5_lhloose' , - 'HLT_e5_lhvloose' , - 'HLT_e5_loose' , - 'HLT_e5_vloose' , - 'HLT_e10_lhvloose_L1EM7' , - 'HLT_e10_vloose_L1EM7' , - 'HLT_e12_lhloose' , - 'HLT_e12_lhloose_L1EM10VH' , - 'HLT_e12_lhvloose_L1EM10VH' , - 'HLT_e12_loose' , - 'HLT_e12_loose_L1EM10VH' , - 'HLT_e12_vloose_L1EM10VH' , - 'HLT_e15_lhloose_L1EM13VH' , - 'HLT_e15_lhvloose_L1EM13VH' , - 'HLT_e15_lhvloose_L1EM7' , - 'HLT_e15_loose_L1EM13VH' , - 'HLT_e15_vloose_L1EM13VH' , - 'HLT_e15_vloose_L1EM7' , - 'HLT_e17_lhloose' , - 'HLT_e17_lhloose_L1EM15' , - 'HLT_e17_lhloose_cutd0dphideta_L1EM15', - 'HLT_e17_lhloose_nod0_L1EM15' , - 'HLT_e17_lhloose_nodeta_L1EM15' , - 'HLT_e17_lhloose_nodphires_L1EM15' , - 'HLT_e17_lhloose_L1EM15VHJJ1523ETA49' , - 'HLT_e17_lhvloose' , - 'HLT_e17_loose' , - 'HLT_e17_loose_L1EM15' , - 'HLT_e17_loose_L1EM15VHJJ1523ETA49' , - 'HLT_e17_vloose' , - 'HLT_e20_lhvloose' , - 'HLT_e20_lhvloose_L1EM12' , - 'HLT_e20_vloose' , - 'HLT_e20_vloose_L1EM12' , - 'HLT_e25_lhvloose_L1EM15' , - 'HLT_e25_vloose_L1EM15' , - 'HLT_e30_lhvloose_L1EM15' , - 'HLT_e30_vloose_L1EM15' , - 'HLT_e40_lhvloose' , - 'HLT_e40_lhvloose_L1EM15' , - 'HLT_e40_vloose_L1EM15' , - 'HLT_e50_lhvloose_L1EM15' , - 'HLT_e50_vloose_L1EM15' , - 'HLT_e60_loose' , - 'HLT_e60_vloose' , - 'HLT_e60_lhvloose' , - 'HLT_e70_etcut' , - 'HLT_e70_lhloose' , - 'HLT_e70_lhvloose' , - 'HLT_e70_loose' , - 'HLT_e70_vloose' , - 'HLT_e80_lhvloose' , - 'HLT_e80_vloose' , - 'HLT_e100_lhvloose' , - 'HLT_e100_vloose' , - 'HLT_e120_lhvloose' , - 'HLT_e120_lhloose' , - 'HLT_e120_loose' , - 'HLT_e120_vloose' , - 'HLT_e140_etcut' , - 'HLT_e160_etcut' , - 'HLT_e180_etcut' , - 'HLT_e200_etcut' , - 'HLT_e250_etcut' , - 'HLT_e300_etcut' , - 'HLT_g250_etcut' , - 'HLT_g300_etcut' , - ] +BkgElectronTriggers["Run3"] = [ + "HLT_e5_nopid_L1EM3", + "HLT_e5_etcut_L1EM3", + "HLT_e50_etcut_L1EM22VHI", + "HLT_e50_etcut_L1eEM26M", + "HLT_e120_etcut_L1EM22VHI", + "HLT_e120_etcut_L1eEM26M", + "HLT_e250_etcut_L1EM22VHI", + "HLT_e250_etcut_L1eEM26M", + "HLT_e300_etcut_L1eEM26M", + "HLT_e300_etcut_L1EM22VHI", + "HLT_g250_etcut_L1EM22VHI", + "HLT_g250_etcut_L1eEM26M", + "HLT_g300_etcut_L1EM22VHI", + "HLT_g300_etcut_L1eEM26M", +] + +BkgElectronTriggers["Run2"] = [ + "HLT_e4_etcut", + "HLT_e5_etcut", + "HLT_e9_etcut", + "HLT_e10_etcut_L1EM7", + "HLT_e14_etcut", + "HLT_e15_etcut_L1EM7", + "HLT_e17_etcut_L1EM15", + "HLT_e20_etcut_L1EM12", + "HLT_e25_etcut_L1EM15", + "HLT_e30_etcut_L1EM15", + "HLT_e40_etcut_L1EM15", + "HLT_e50_etcut_L1EM15", + "HLT_e60_etcut", + "HLT_e80_etcut", + "HLT_e100_etcut", + "HLT_e120_etcut", + "HLT_g10_etcut", + "HLT_g20_etcut_L1EM12", + "HLT_g200_etcut", + "HLT_e5_lhloose", + "HLT_e5_lhvloose", + "HLT_e5_loose", + "HLT_e5_vloose", + "HLT_e10_lhvloose_L1EM7", + "HLT_e10_vloose_L1EM7", + "HLT_e12_lhloose", + "HLT_e12_lhloose_L1EM10VH", + "HLT_e12_lhvloose_L1EM10VH", + "HLT_e12_loose", + "HLT_e12_loose_L1EM10VH", + "HLT_e12_vloose_L1EM10VH", + "HLT_e15_lhloose_L1EM13VH", + "HLT_e15_lhvloose_L1EM13VH", + "HLT_e15_lhvloose_L1EM7", + "HLT_e15_loose_L1EM13VH", + "HLT_e15_vloose_L1EM13VH", + "HLT_e15_vloose_L1EM7", + "HLT_e17_lhloose", + "HLT_e17_lhloose_L1EM15", + "HLT_e17_lhloose_cutd0dphideta_L1EM15", + "HLT_e17_lhloose_nod0_L1EM15", + "HLT_e17_lhloose_nodeta_L1EM15", + "HLT_e17_lhloose_nodphires_L1EM15", + "HLT_e17_lhloose_L1EM15VHJJ1523ETA49", + "HLT_e17_lhvloose", + "HLT_e17_loose", + "HLT_e17_loose_L1EM15", + "HLT_e17_loose_L1EM15VHJJ1523ETA49", + "HLT_e17_vloose", + "HLT_e20_lhvloose", + "HLT_e20_lhvloose_L1EM12", + "HLT_e20_vloose", + "HLT_e20_vloose_L1EM12", + "HLT_e25_lhvloose_L1EM15", + "HLT_e25_vloose_L1EM15", + "HLT_e30_lhvloose_L1EM15", + "HLT_e30_vloose_L1EM15", + "HLT_e40_lhvloose", + "HLT_e40_lhvloose_L1EM15", + "HLT_e40_vloose_L1EM15", + "HLT_e50_lhvloose_L1EM15", + "HLT_e50_vloose_L1EM15", + "HLT_e60_loose", + "HLT_e60_vloose", + "HLT_e60_lhvloose", + "HLT_e70_etcut", + "HLT_e70_lhloose", + "HLT_e70_lhvloose", + "HLT_e70_loose", + "HLT_e70_vloose", + "HLT_e80_lhvloose", + "HLT_e80_vloose", + "HLT_e100_lhvloose", + "HLT_e100_vloose", + "HLT_e120_lhvloose", + "HLT_e120_lhloose", + "HLT_e120_loose", + "HLT_e120_vloose", + "HLT_e140_etcut", + "HLT_e160_etcut", + "HLT_e180_etcut", + "HLT_e200_etcut", + "HLT_e250_etcut", + "HLT_e300_etcut", + "HLT_g250_etcut", + "HLT_g300_etcut", +] BootstrapPhotonTriggers = {} -BootstrapPhotonTriggers['Run3'] = [ - 'HLT_g25_medium_L1EM20VH', - 'HLT_g35_medium_L1EM20VH', - 'HLT_g20_tight_icaloloose_L1EM15VHI', - 'HLT_g15_tight_L1EM10VH', - 'HLT_g20_tight_L1EM15VHI', - 'HLT_g22_tight_L1EM15VHI', - 'HLT_g25_medium_L1eEM24L', - 'HLT_g35_medium_L1eEM24L', - 'HLT_g20_tight_icaloloose_L1eEM18M', - 'HLT_g15_tight_L1eEM12L', - 'HLT_g20_tight_L1eEM18M', - 'HLT_g22_tight_L1eEM18M', - 'HLT_g250_etcut_L1EM22VHI', - 'HLT_g10_loose_L1EM7', - 'HLT_g15_loose_L1EM10VH', - 'HLT_g20_loose_L1EM15VH', - 'HLT_g25_loose_L1EM20VH', - 'HLT_g30_loose_L1EM20VH', - 'HLT_g40_loose_L1EM20VH', - 'HLT_g50_loose_L1EM20VH', - 'HLT_g60_loose_L1EM22VHI', - 'HLT_g80_loose_L1EM22VHI', - 'HLT_g100_loose_L1EM22VHI', - 'HLT_g120_loose_L1EM22VHI', - 'HLT_g250_etcut_L1eEM26M', - 'HLT_g10_loose_L1eEM9', - 'HLT_g15_loose_L1eEM12L', - 'HLT_g20_loose_L1eEM18L', - 'HLT_g25_loose_L1eEM24L', - 'HLT_g30_loose_L1eEM24L', - 'HLT_g40_loose_L1eEM24L', - 'HLT_g50_loose_L1eEM24L', - 'HLT_g60_loose_L1eEM26M', - 'HLT_g80_loose_L1eEM26M', - 'HLT_g100_loose_L1eEM26M', - 'HLT_g120_loose_L1eEM26M', - 'HLT_g25_tight_icaloloose_L1EM20VH', - 'HLT_g25_tight_icalomedium_L1EM20VH', - 'HLT_g25_tight_icalotight_L1EM20VH', - ] - -BootstrapPhotonTriggers['Run2'] = [ - # pt_cut triggers - 'HLT_g20_etcut_L1EM12' - # Passed through triggers for bootstrapping - 'HLT_g10_loose', - 'HLT_g15_loose_L1EM7', - 'HLT_g20_loose_L1EM12', - 'HLT_g20_loose', - 'HLT_g25_loose_L1EM15', - 'HLT_g60_loose', - 'HLT_g100_loose', - 'HLT_g120_loose', - 'HLT_g160_loose', - 'HLT_g160_loose_L1EM24VHIM', - 'HLT_g180_loose', - 'HLT_g180_loose_L1EM24VHIM', - 'HLT_g35_loose_L1EM15', - 'HLT_g40_loose_L1EM15', - 'HLT_g45_loose_L1EM15', - 'HLT_g50_loose_L1EM15', - 'HLT_g70_loose', - 'HLT_g80_loose', - 'HLT_g140_loose', - 'HLT_g200_loose', - ] - - - -noalgTriggers['Run2'] = [ - 'HLT_noalg_L1EM12', - 'HLT_noalg_L1EM15', - 'HLT_noalg_L1EM18VH', - 'HLT_noalg_L1EM20VH', - 'HLT_noalg_L1EM10', - 'HLT_noalg_L1EM10VH', - 'HLT_noalg_L1EM13VH', - 'HLT_noalg_L1EM20VHI', - 'HLT_noalg_L1EM22VHI', - 'HLT_noalg_L1EM8VH', - 'HLT_noalg_L1EM15VH', - 'HLT_noalg_L12EM7', - 'HLT_noalg_L12EM15'] +BootstrapPhotonTriggers["Run3"] = [ + "HLT_g25_medium_L1EM20VH", + "HLT_g35_medium_L1EM20VH", + "HLT_g20_tight_icaloloose_L1EM15VHI", + "HLT_g15_tight_L1EM10VH", + "HLT_g20_tight_L1EM15VHI", + "HLT_g22_tight_L1EM15VHI", + "HLT_g25_medium_L1eEM24L", + "HLT_g35_medium_L1eEM24L", + "HLT_g20_tight_icaloloose_L1eEM18M", + "HLT_g15_tight_L1eEM12L", + "HLT_g20_tight_L1eEM18M", + "HLT_g22_tight_L1eEM18M", + "HLT_g250_etcut_L1EM22VHI", + "HLT_g10_loose_L1EM7", + "HLT_g15_loose_L1EM10VH", + "HLT_g20_loose_L1EM15VH", + "HLT_g25_loose_L1EM20VH", + "HLT_g30_loose_L1EM20VH", + "HLT_g40_loose_L1EM20VH", + "HLT_g50_loose_L1EM20VH", + "HLT_g60_loose_L1EM22VHI", + "HLT_g80_loose_L1EM22VHI", + "HLT_g100_loose_L1EM22VHI", + "HLT_g120_loose_L1EM22VHI", + "HLT_g250_etcut_L1eEM26M", + "HLT_g10_loose_L1eEM9", + "HLT_g15_loose_L1eEM12L", + "HLT_g20_loose_L1eEM18L", + "HLT_g25_loose_L1eEM24L", + "HLT_g30_loose_L1eEM24L", + "HLT_g40_loose_L1eEM24L", + "HLT_g50_loose_L1eEM24L", + "HLT_g60_loose_L1eEM26M", + "HLT_g80_loose_L1eEM26M", + "HLT_g100_loose_L1eEM26M", + "HLT_g120_loose_L1eEM26M", + "HLT_g25_tight_icaloloose_L1EM20VH", + "HLT_g25_tight_icalomedium_L1EM20VH", + "HLT_g25_tight_icalotight_L1EM20VH", +] + +BootstrapPhotonTriggers["Run2"] = [ + # pt_cut triggers + "HLT_g20_etcut_L1EM12" + # Passed through triggers for bootstrapping + "HLT_g10_loose", + "HLT_g15_loose_L1EM7", + "HLT_g20_loose_L1EM12", + "HLT_g20_loose", + "HLT_g25_loose_L1EM15", + "HLT_g60_loose", + "HLT_g100_loose", + "HLT_g120_loose", + "HLT_g160_loose", + "HLT_g160_loose_L1EM24VHIM", + "HLT_g180_loose", + "HLT_g180_loose_L1EM24VHIM", + "HLT_g35_loose_L1EM15", + "HLT_g40_loose_L1EM15", + "HLT_g45_loose_L1EM15", + "HLT_g50_loose_L1EM15", + "HLT_g70_loose", + "HLT_g80_loose", + "HLT_g140_loose", + "HLT_g200_loose", +] + + +noalgTriggers["Run2"] = [ + "HLT_noalg_L1EM12", + "HLT_noalg_L1EM15", + "HLT_noalg_L1EM18VH", + "HLT_noalg_L1EM20VH", + "HLT_noalg_L1EM10", + "HLT_noalg_L1EM10VH", + "HLT_noalg_L1EM13VH", + "HLT_noalg_L1EM20VHI", + "HLT_noalg_L1EM22VHI", + "HLT_noalg_L1EM8VH", + "HLT_noalg_L1EM15VH", + "HLT_noalg_L12EM7", + "HLT_noalg_L12EM15", +] # Additional contaienrs for photon trigger studies ExtraContainersPhotonTrigger = {} -ExtraContainersPhotonTrigger['Run3']=[ - "HLT_egamma_Photons", - "HLT_egamma_PhotonsAux.", - "HLT_egamma_IsoPhotons", - "HLT_egamma_IsoPhotonsAux.", - "HLT_FastCaloRinger", - "HLT_FastCaloRingerAux.", - "HLT_FastCaloEMClusters", - "HLT_FastCaloEMClustersAux.", - "HLT_CaloEMClusters_Photon", - "HLT_CaloEMClusters_PhotonAux.", - "HLT_FastPhotons", - "HLT_FastPhotonsAux.", - ] - -ExtraContainersPhotonTrigger['Run2'] = [ - "HLT_xAOD__PhotonContainer_egamma_Photons", - "HLT_xAOD__PhotonContainer_egamma_PhotonsAux.", - "HLT_xAOD__PhotonContainer_egamma_Iso_Photons", - "HLT_xAOD__PhotonContainer_egamma_Iso_PhotonsAux.", - "HLT_xAOD__TrigPhotonContainer_L2PhotonFex", - "HLT_xAOD__TrigPhotonContainer_L2PhotonFexAux.", - ] +ExtraContainersPhotonTrigger["Run3"] = [ + "HLT_egamma_Photons", + "HLT_egamma_PhotonsAux.", + "HLT_egamma_IsoPhotons", + "HLT_egamma_IsoPhotonsAux.", + "HLT_FastCaloEMClusters", + "HLT_FastCaloEMClustersAux.", + "HLT_CaloEMClusters_Photon", + "HLT_CaloEMClusters_PhotonAux.", +] + +ExtraContainersPhotonTrigger["Run2"] = [ + "HLT_xAOD__PhotonContainer_egamma_Photons", + "HLT_xAOD__PhotonContainer_egamma_PhotonsAux.", + "HLT_xAOD__PhotonContainer_egamma_Iso_Photons", + "HLT_xAOD__PhotonContainer_egamma_Iso_PhotonsAux.", + "HLT_xAOD__TrigPhotonContainer_L2PhotonFex", + "HLT_xAOD__TrigPhotonContainer_L2PhotonFexAux.", +] # Additional contaienrs for electron trigger studies ExtraContainersElectronTrigger = {} -ExtraContainersElectronTrigger['Run3'] = [ - "HLT_egamma_Electrons", - "HLT_egamma_ElectronsAux.", - "HLT_FastCaloRinger", - "HLT_FastCaloRingerAux.", - "HLT_FastCaloEMClusters", - "HLT_FastCaloEMClustersAux.", - "HLT_IDTrack_Electron_FTF", - "HLT_IDTrack_Electron_FTFAux.", - "HLT_IDTrack_ElecLRT_FTF", - "HLT_IDTrack_ElecLRT_FTFAux.", - "HLT_FastElectrons", - "HLT_FastElectronsAux.", - "HLT_FastElectrons_LRT", - "HLT_FastElectrons_LRTAux.", - "HLT_CaloEMClusters_Electron", - "HLT_CaloEMClusters_ElectronAux.", - "HLT_TrigEMClusters_Electrons", - "HLT_TrigEMClusters_ElectronsAux.", - "HLT_TrigEMClusters_Electrons_GSF", - "HLT_TrigEMClusters_Electrons_GSFAux.", - "HLT_IDTrack_Electron_IDTrig", - "HLT_IDTrack_Electron_IDTrigAux.", - "HLT_IDTrack_Electron_GSF", - "HLT_IDTrack_Electron_GSFAux.", - ] - -ExtraContainersElectronTrigger['Run2'] = [ - "HLT_xAOD__ElectronContainer_egamma_Electrons", - "HLT_xAOD__ElectronContainer_egamma_ElectronsAux.", - "HLT_xAOD__TrigElectronContainer_L2ElectronFex", - "HLT_xAOD__TrigElectronContainer_L2ElectronFexAux.", - "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", - "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFexAux.", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrigAux.", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFID", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFIDAux.", - ] +ExtraContainersElectronTrigger["Run3"] = [ + "HLT_egamma_Electrons", + "HLT_egamma_ElectronsAux.", + "HLT_FastCaloEMClusters", + "HLT_FastCaloEMClustersAux.", + "HLT_IDTrack_Electron_FTF", + "HLT_IDTrack_Electron_FTFAux.", + "HLT_IDTrack_ElecLRT_FTF", + "HLT_IDTrack_ElecLRT_FTFAux.", + "HLT_FastElectrons_LRT", + "HLT_FastElectrons_LRTAux.", + "HLT_CaloEMClusters_Electron", + "HLT_CaloEMClusters_ElectronAux.", + "HLT_TrigEMClusters_Electrons", + "HLT_TrigEMClusters_ElectronsAux.", + "HLT_TrigEMClusters_Electrons_GSF", + "HLT_TrigEMClusters_Electrons_GSFAux.", + "HLT_IDTrack_Electron_IDTrig", + "HLT_IDTrack_Electron_IDTrigAux.", + "HLT_IDTrack_Electron_GSF", + "HLT_IDTrack_Electron_GSFAux.", +] + +ExtraContainersElectronTrigger["Run2"] = [ + "HLT_xAOD__ElectronContainer_egamma_Electrons", + "HLT_xAOD__ElectronContainer_egamma_ElectronsAux.", + "HLT_xAOD__TrigElectronContainer_L2ElectronFex", + "HLT_xAOD__TrigElectronContainer_L2ElectronFexAux.", + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex", + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFexAux.", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrig", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_IDTrigAux.", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFID", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_EFIDAux.", +] # Containers aimed for Navigation, Trigger Matching and L1 RoIs ExtraContainersTrigger = {} -ExtraContainersTrigger['Run3'] = [ - #And these are Run3 containers - "HLT_eEMRoI", - "HLT_eEMRoIAux.", - "HLTNav_Summary_AODSlimmed", - "HLTNav_Summary_AODSlimmedAux.", - ] - - -ExtraContainersTrigger['Run2'] = [ - #These are Run2 Containers - "LVL1EmTauRoIs", - "LVL1EmTauRoIsAux.", - "HLT_EMRoIs", - "HLT_EMRoIsAux.", - "HLT_TrigPassBitsCollection_passbits", - "HLT_TrigPassBitsCollection_passbitsAux.", - "HLT_TrigPassFlagsCollection_passflags", - "HLT_TrigPassFlagsCollection_passflagsAux.", - "HLT_TrigRoiDescriptorCollection_initialRoI", - "HLT_TrigRoiDescriptorCollection_initialRoIAux.", - ] +ExtraContainersTrigger["Run3"] = [ + # And these are Run3 containers + "HLT_eEMRoI", + "HLT_eEMRoIAux.", + "HLTNav_Summary_AODSlimmed", + "HLTNav_Summary_AODSlimmedAux.", +] -ExtraContainersMuonTrigger = {} -ExtraContainersMuonTrigger['Run3'] = [ - 'HLT_Muons_RoI', - 'HLT_Muons_RoIAux.', - 'HLT_Muons_FS', - 'HLT_Muons_FSAux.', - 'HLT_MuonsCB_RoI', - 'HLT_MuonsCB_RoIAux.', - 'HLT_MuonsCB_LRT', - 'HLT_MuonsCB_LRTAux.', - 'HLT_MuonsCB_FS', - 'HLT_MuonsCB_FSAux.', - ] -ExtraContainersMuonTrigger['Run2'] = [ - "HLT_xAOD__MuonContainer_MuonEFInfo", - "HLT_xAOD__MuonContainer_MuonEFInfoAux.", - "HLT_xAOD__MuonContainer_MuonEFInfo_FullScan", - "HLT_xAOD__MuonContainer_MuonEFInfo_FullScanAux.", - ] +ExtraContainersTrigger["Run2"] = [ + # These are Run2 Containers + "LVL1EmTauRoIs", + "LVL1EmTauRoIsAux.", + "HLT_EMRoIs", + "HLT_EMRoIsAux.", + "HLT_TrigPassBitsCollection_passbits", + "HLT_TrigPassBitsCollection_passbitsAux.", + "HLT_TrigPassFlagsCollection_passflags", + "HLT_TrigPassFlagsCollection_passflagsAux.", + "HLT_TrigRoiDescriptorCollection_initialRoI", + "HLT_TrigRoiDescriptorCollection_initialRoIAux.", +] +ExtraContainersMuonTrigger = {} +ExtraContainersMuonTrigger["Run3"] = [ + "HLT_Muons_RoI", + "HLT_Muons_RoIAux.", + "HLT_Muons_FS", + "HLT_Muons_FSAux.", + "HLT_MuonsCB_RoI", + "HLT_MuonsCB_RoIAux.", + "HLT_MuonsCB_LRT", + "HLT_MuonsCB_LRTAux.", + "HLT_MuonsCB_FS", + "HLT_MuonsCB_FSAux.", +] +ExtraContainersMuonTrigger["Run2"] = [ + "HLT_xAOD__MuonContainer_MuonEFInfo", + "HLT_xAOD__MuonContainer_MuonEFInfoAux.", + "HLT_xAOD__MuonContainer_MuonEFInfo_FullScan", + "HLT_xAOD__MuonContainer_MuonEFInfo_FullScanAux.", +] + ExtraVariablesHLTPhotons = {} -ExtraVariablesHLTPhotons['Run3'] = [ - "HLT_egamma_Photons.e.pt.m.author.Rhad.Rhad1.e277.Reta.Rphi.weta2.f1.fracs1.wtots1.weta1.DeltaE.Eratio.caloClusterLinks", - "HLT_CaloEMClusters_Photon.calE.calEta.calPhi.calM.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME" +ExtraVariablesHLTPhotons["Run3"] = [ + "HLT_egamma_Photons.e.pt.m.author.Rhad.Rhad1.e277.Reta.Rphi.weta2.f1.fracs1.wtots1.weta1.DeltaE.Eratio.caloClusterLinks", + "HLT_CaloEMClusters_Photon.calE.calEta.calPhi.calM.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME", ] -ExtraVariablesHLTPhotons['Run2'] = [ - "HLT_xAOD__PhotonContainer_egamma_Photons.e.pt.m.author.Rhad.Rhad1.e277.Reta.Rphi.weta2.f1.fracs1.wtots1.weta1.DeltaE.Eratio.caloClusterLinks", - "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex.calE.calEta.calPhi.calM.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME" +ExtraVariablesHLTPhotons["Run2"] = [ + "HLT_xAOD__PhotonContainer_egamma_Photons.e.pt.m.author.Rhad.Rhad1.e277.Reta.Rphi.weta2.f1.fracs1.wtots1.weta1.DeltaE.Eratio.caloClusterLinks", + "HLT_xAOD__CaloClusterContainer_TrigEFCaloCalibFex.calE.calEta.calPhi.calM.e_sampl.eta_sampl.etaCalo.phiCalo.ETACALOFRAME.PHICALOFRAME", ] ExtraContainersTriggerDataOnly = {} -ExtraContainersTriggerDataOnly['Run3'] = [ - ] - -ExtraContainersTriggerDataOnly['Run2'] = [ - "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", - "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgammaAux.", - "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMaker", - "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMakerAux.", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTF", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTFAux.", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2ID", - "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2IDAux.", - ] +ExtraContainersTriggerDataOnly["Run3"] = [] + +ExtraContainersTriggerDataOnly["Run2"] = [ + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgamma", + "HLT_xAOD__TrigEMClusterContainer_TrigT2CaloEgammaAux.", + "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMaker", + "HLT_xAOD__CaloClusterContainer_TrigCaloClusterMakerAux.", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTF", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_FTFAux.", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2ID", + "HLT_xAOD__TrackParticleContainer_InDetTrigTrackingxAODCnv_Electron_L2IDAux.", +] diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonExtraContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonExtraContent.py index f6cee020dcedf51b1b20d29c325692b660471407..4d7069b5bdad8883251f8524f3937523bbf1e38f 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonExtraContent.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration #==================================================================== # Common file used by TOPQCommonSlimming.py @@ -190,7 +190,6 @@ TOPQExtraVariablesBTagging_AntiKt4EMPFlow = ["BTagging_AntiKt4EMPFlow." TOPQExtraVariablesBTagging_AntiKt4EMTopo = ["BTagging_AntiKt4EMTopo." + "SV1_TrackParticleLinks." + "MV2cl100_discriminant." - + "JetVertexCharge_discriminant." + "MultiSVbb1_discriminant." + "MultiSVbb2_discriminant." + "MSV_N2Tpair." diff --git a/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/python/HICaloGeoExtract.py b/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/python/HICaloGeoExtract.py index b627425c8cfed0dd612acc97f3deae5241f60763..02f5d6d13f0a8691421ba9f64a02e67382b4b30f 100644 --- a/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/python/HICaloGeoExtract.py +++ b/PhysicsAnalysis/HeavyIonPhys/HIEventUtils/python/HICaloGeoExtract.py @@ -47,12 +47,12 @@ if __name__ == "__main__": ### input for Run2: # flags.Input.Files = [defaultTestFiles.d + "/RecJobTransformTests/data18_hi.00367384.physics_HardProbes.daq.RAW._lb0145._SFO-8._0001.data"] # flags.IOVDb.GlobalTag = "CONDBR2-BLKPA-RUN2-09" - # flags.GeoModel.AtlasVersion = "ATLAS-R2-2016-01-00-01" + # flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 ### input for Run3: flags.Input.Files = [defaultTestFiles.d + "/RecJobTransformTests/data22_hi/RAWFiles/data22_hi.00440101.physics_MinBias.daq.RAW/data22_hi.00440101.physics_MinBias.daq.RAW._lb0214._SFO-11._0001.data"] flags.IOVDb.GlobalTag = "CONDBR2-BLKPA-2022-09" - flags.GeoModel.AtlasVersion = "ATLAS-R3S-2021-03-01-00" + flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3 ### ### ### diff --git a/PhysicsAnalysis/JetTagging/FlavourTaggingTests/test/test_FTAG_grid.sh b/PhysicsAnalysis/JetTagging/FlavourTaggingTests/test/test_FTAG_grid.sh index 6454088b615053b24b45f1c4fbd74929de867101..186272377e79bb94a1bf34db2216fe76ca43c31e 100755 --- a/PhysicsAnalysis/JetTagging/FlavourTaggingTests/test/test_FTAG_grid.sh +++ b/PhysicsAnalysis/JetTagging/FlavourTaggingTests/test/test_FTAG_grid.sh @@ -29,7 +29,7 @@ checkstep () { fi } -file=test_full_chain_mu0.sh +file=test_FTAG_PHYSVAL.sh script="`basename \"$0\"`" number_of_events=4000 diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagLightSecVertexing.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagLightSecVertexing.h index b4e1a1a337a9a96d95cda0d7447084e1483f29e2..27979e8d350f5340ce0b28257287bf9bf8c543d4 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagLightSecVertexing.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagLightSecVertexing.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_BTAGLIGHTSECVERTEXING_H @@ -17,9 +17,8 @@ #include "xAODBTagging/BTagging.h" #include "xAODBTagging/BTaggingContainer.h" #include "xAODTracking/VertexContainer.h" -#include "xAODTracking/Vertex.h" -#include "xAODBTagging/BTagVertexContainer.h" #include "xAODTracking/TrackParticleContainer.h" +#include "JetTagTools/IJetFitterVariablesFactory.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/ReadHandleKeyArray.h" @@ -35,15 +34,12 @@ namespace Trk{ /** The namespace of all packages in PhysicsAnalysis/JetTagging */ namespace Analysis { - class IJetFitterVariablesFactory; - class IMSVVariablesFactory; - class BTagLightSecVertexing : public AthAlgTool, virtual public IBTagLightSecVertexing { public: /** Constructors and destructors */ BTagLightSecVertexing(const std::string&,const std::string&,const IInterface*); - virtual ~BTagLightSecVertexing(); + virtual ~BTagLightSecVertexing() = default; virtual StatusCode initialize() override; virtual StatusCode BTagSecVertexing_exec(const xAOD::JetContainer * jetContainer, xAOD::BTaggingContainer * btaggingContainer) const override; @@ -54,12 +50,10 @@ namespace Analysis StatusCode fillJFVariables(const xAOD::Jet&, xAOD::BTagging*, const Trk::VxJetFitterVertexInfo*, const xAOD::TrackParticleContainer*, const std::string&) const; ToolHandle<IJetFitterVariablesFactory> m_JFvarFactory; - //ToolHandle<IMSVVariablesFactory> m_MSVvarFactory; std::vector<std::string> m_secVertexFinderTrackNameList; std::vector<std::string> m_secVertexFinderBaseNameList; - std::string m_vxPrimaryName; //Input ReadHandle SG::ReadHandleKey<xAOD::VertexContainer> m_VertexCollectionName {this, "vxPrimaryCollectionName", "", "Input primary vertex container"}; SG::ReadDecorHandleKey<xAOD::JetContainer> m_jetSVLinkName{ this, "JetSecVtxLinkName", "", "Element Link vector form jet to SV container"}; SG::ReadDecorHandleKey<xAOD::JetContainer> m_jetSVFlipLinkName{ this, "JetSecVtxFlipLinkName", "", "Element Link vector form jet to SVFlip container"}; diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTool.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTool.h index 78b7c4a4a551308c6707976486b2aa59af9ffc2f..30e07a5bf289c624d33aef2a2bc45ef2f3819f50 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /* ************************************************************************** @@ -17,8 +17,8 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" #include "BTagging/IBTagTool.h" +#include "JetTagTools/ITagTool.h" #include "StoreGate/ReadHandleKey.h" -#include "CxxUtils/checker_macros.h" #include <string> #include <vector> @@ -29,7 +29,6 @@ /** The namespace of all packages in PhysicsAnalysis/JetTagging */ namespace Analysis { - class ITagTool; /** \class BTagTool The BTagTool class is a prototype implementation of a general jet tag strategy @@ -69,7 +68,7 @@ namespace Analysis /** Constructors and destructors */ BTagTool(const std::string&,const std::string&,const IInterface*); - virtual ~BTagTool(); + virtual ~BTagTool() = default; /** Main routines specific to an ATHENA algorithm */ virtual StatusCode initialize() override; @@ -89,14 +88,8 @@ namespace Analysis ToolHandleArray< ITagTool > m_bTagToolHandleArray; std::map<std::string, ITagTool*> m_bTagTool; //!< map to the btag tools - std::string m_BaselineTagger; //!< whose result is stored in the combinedlikelihhod datamember of the jet - - std::string m_vxPrimaryName; //!< Name of primary vertex container SG::ReadHandleKey<xAOD::VertexContainer> m_VertexCollectionName {this, "vxPrimaryCollectionName", "", "Input primary vertex container"}; - - std::string m_runModus; //!< the run modus of the btagger (reference or analysis) - }; // End class } // End namespace #endif diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTrackAugmenterAlg.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTrackAugmenterAlg.h index 0f9a593168f0b4dab386dce9cb8cb9c487eb589c..e334500babd846e66bbbcb62b3fe0fc8d0970dd9 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTrackAugmenterAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTrackAugmenterAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_TRACK_AUGMENTER_ALG_HH @@ -7,12 +7,8 @@ #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" -#include "AthContainers/AuxElement.h" -#include "GeoPrimitives/GeoPrimitives.h" #include "xAODTracking/TrackParticleContainer.h" -#include "xAODTracking/TrackParticleAuxContainer.h" #include "xAODTracking/VertexContainer.h" -#include "xAODTracking/VertexAuxContainer.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkVertexFitterInterfaces/ITrackToVertexIPEstimator.h" #include "StoreGate/WriteDecorHandle.h" diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/IBTagLightSecVertexing.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/IBTagLightSecVertexing.h index 7a791247289efd5cee3245c412cd840387d385c9..8ff82a3dd9044ef0c07bdba5a8e765e023711307 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/IBTagLightSecVertexing.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/IBTagLightSecVertexing.h @@ -1,18 +1,12 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_IBTAGLIGHTSECVERTEXING_H #define BTAGGING_IBTAGLIGHTSECVERTEXING_H #include "GaudiKernel/IAlgTool.h" -#include "VxVertex/RecVertex.h" // Reconstructed vertex RecVertex -#include "xAODJet/Jet.h" #include "xAODJet/JetContainer.h" -#include "xAODTracking/VertexFwd.h" -#include "xAODTracking/VertexContainerFwd.h" -#include "xAODBTagging/BTagging.h" -#include "xAODBTagging/BTagVertexContainer.h" #include "xAODBTagging/BTaggingContainer.h" namespace Analysis diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h index aae1fb80a6060e66a33291f01817bac8e41b2a6f..5ce68396d0f5e21004dcb4431af15e82113fa362 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_JETBTAGGINGALG_HH @@ -35,7 +35,7 @@ class JetBTaggingAlg: /** Constructors and destructors */ JetBTaggingAlg(const std::string& name, ISvcLocator *pSvcLocator); - virtual ~JetBTaggingAlg(); + virtual ~JetBTaggingAlg() = default; /** Main routines specific to an ATHENA algorithm */ virtual StatusCode initialize() override; diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVertexingAlg.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVertexingAlg.h index 305d7159d73dfccd55f61c9fca8d90ee2cf9b60b..5978d330bae8ebbf9bb47362b8e27c1b5b764732 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVertexingAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVertexingAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_JETSECVERTEXINGALG_H @@ -14,16 +14,15 @@ namespace InDet { #include <string> -#include "xAODJet/Jet.h" #include "xAODJet/JetContainer.h" #include "VxSecVertex/VxSecVertexInfo.h" -#include "xAODBTagging/BTagging.h" #include "xAODBTagging/BTaggingContainer.h" #include "xAODTracking/VertexContainer.h" -#include "xAODTracking/Vertex.h" #include "xAODBTagging/BTagVertexContainer.h" #include "xAODTracking/TrackParticleContainer.h" +#include "JetTagTools/IMSVVariablesFactory.h" + #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" #include "StoreGate/WriteDecorHandleKey.h" @@ -38,14 +37,13 @@ namespace Trk{ /** The namespace of all packages in PhysicsAnalysis/JetTagging */ namespace Analysis { - class IMSVVariablesFactory; class JetSecVertexingAlg : public AthReentrantAlgorithm { public: /** Constructors and destructors */ JetSecVertexingAlg(const std::string& name, ISvcLocator *pSvcLocator); - virtual ~JetSecVertexingAlg(); + virtual ~JetSecVertexingAlg() = default; /** Main routines specific to an ATHENA algorithm */ virtual StatusCode initialize() override; @@ -59,7 +57,6 @@ namespace Analysis ToolHandle<IMSVVariablesFactory> m_MSVvarFactory; std::string m_secVertexFinderBaseName; - std::string m_vxPrimaryName; //Input ReadHandle SG::ReadHandleKey<xAOD::JetContainer > m_JetCollectionName {this, "JetCollectionName", "", "Input jet container"}; SG::ReadHandleKey<xAOD::TrackParticleContainer > m_TrackCollectionName {this, "TrackCollectionName", "", "Input track container"}; diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVtxFindingAlg.h b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVtxFindingAlg.h index efa7948607c5ab79225ab66e09a39bbf79978e5f..26003b3cc7203f1110ade50d030670d0a243254c 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVtxFindingAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVtxFindingAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_JETSECVTXFINDINGALG_H @@ -10,18 +10,16 @@ #include <string> +//general interface for secondary vertex finders +#include "InDetRecToolInterfaces/ISecVertexInJetFinder.h" + #include "xAODJet/JetContainer.h" +#include "xAODTracking/VertexContainer.h" #include "VxSecVertex/VxSecVertexInfo.h" #include "StoreGate/ReadHandleKey.h" #include "StoreGate/WriteHandleKey.h" -#include "xAODTracking/VertexContainer.h" - -namespace InDet { - class ISecVertexInJetFinder; -} - /** The namespace of all packages in PhysicsAnalysis/JetTagging */ namespace Analysis { @@ -31,7 +29,7 @@ namespace Analysis public: /** Constructors and destructors */ JetSecVtxFindingAlg(const std::string& name, ISvcLocator *pSvcLocator); - virtual ~JetSecVtxFindingAlg(); + virtual ~JetSecVtxFindingAlg() = default; /** Main routines specific to an ATHENA algorithm */ virtual StatusCode initialize() override final; @@ -41,8 +39,6 @@ namespace Analysis ToolHandle< InDet::ISecVertexInJetFinder > m_secVertexFinderToolHandle; - std::string m_vxPrimaryName; //Input ReadHandle - SG::ReadHandleKey<xAOD::JetContainer > m_JetCollectionName {this, "JetCollectionName", "", "Input jet container"}; SG::ReadDecorHandleKey<xAOD::JetContainer> m_TracksToTag { this, "TracksToTag", "", "Element Link vector from jet to IParticleContainer"}; SG::ReadHandleKey<xAOD::VertexContainer> m_VertexCollectionName {this, "vxPrimaryCollectionName", "", "Input primary vertex container"}; diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/CMakeLists.txt b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/CMakeLists.txt index c7ec30f9c209754b70e442c272ad4cec0d58fb45..6ffe683cee772d9a703259a5c7dea1e6d6a57d4c 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/CMakeLists.txt +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/CMakeLists.txt @@ -12,8 +12,8 @@ atlas_add_library( BTaggingLib src/JetSecVtxFindingAlg.cxx src/BTagTrackAugmenterAlg.cxx PUBLIC_HEADERS BTagging - LINK_LIBRARIES AsgTools AthContainers AthenaBaseComps CxxUtils FlavorTagDiscriminants GaudiKernel GeoPrimitives JetInterface JetRecLib MagFieldConditions ParticleJetToolsLib StoreGateLib TrkExInterfaces TrkVertexFitterInterfaces VxSecVertex VxVertex xAODBTagging xAODEventInfo xAODJet xAODMuon xAODTracking - PRIVATE_LINK_LIBRARIES InDetRecToolInterfaces JetTagEvent JetTagToolsLib Particle TrkLinks TrkSurfaces VxJetVertex xAODBase xAODCore ) + LINK_LIBRARIES AsgTools AthContainers AthenaBaseComps CxxUtils FlavorTagDiscriminants GaudiKernel GeoPrimitives JetInterface JetRecLib JetTagToolsLib MagFieldConditions ParticleJetToolsLib StoreGateLib TrkExInterfaces TrkVertexFitterInterfaces VxSecVertex VxVertex xAODBTagging xAODEventInfo xAODJet xAODMuon xAODTracking + PRIVATE_LINK_LIBRARIES InDetRecToolInterfaces JetTagEvent Particle TrkLinks TrkSurfaces VxJetVertex xAODBase xAODCore ) atlas_add_component( BTagging src/components/*.cxx diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py index 4e6b79e4b0591c0c0dd0bdcd17ba3597d7622254..966121057a9c21b514dc422ab1e2234c87a3fb50 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -74,11 +74,6 @@ def BTagToolCfg(flags, TaggerList, PrimaryVertexCollectionName="", scheme = '', multisvbb2tool = acc.popToolsAndMerge(MultiSVTagCfg(flags, 'MultiSVbb2Tag','MultiSVbb2', scheme)) tagToolList.append(multisvbb2tool) - if 'JetVertexCharge' in TaggerList: - from JetTagTools.JetVertexChargeConfig import JetVertexChargeCfg - jvc = acc.popToolsAndMerge(JetVertexChargeCfg(flags, 'JetVertexCharge', scheme)) - tagToolList.append(jvc) - # list of taggers that use MultivariateTagManager mvtm_taggers = ['MV2c00','MV2c10','MV2c20','MV2c10mu','MV2m','DL1','DL1mu'] mvtm_active_taggers = list(set(mvtm_taggers) & set(TaggerList)) @@ -89,8 +84,7 @@ def BTagToolCfg(flags, TaggerList, PrimaryVertexCollectionName="", scheme = '', options = {} if useBTagFlagsDefaults: - defaults = { 'Runmodus' : flags.BTagging.RunModus, - 'vxPrimaryCollectionName' : PrimaryVertexCollectionName, + defaults = { 'vxPrimaryCollectionName' : PrimaryVertexCollectionName, 'TagToolList' : tagToolList, } for option in defaults: diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/share/btaggingAlgs.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/share/btaggingAlgs.py deleted file mode 100644 index d1bcf74c3c7f3250c25301af45c1f464ad2856ff..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/share/btaggingAlgs.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -#Run btagging on AntiKt4EMTopoJets - -from BTagging.BTaggingConfiguration import getConfiguration -BTagConf = getConfiguration() -BTagConf.PrefixxAODBaseName(False) -BTagConf.PrefixVertexFinderxAODBaseName(False) - -BTagConf.doNotCheckForTaggerObstacles() - -#Rename the existing btaggingLink from Jet container to BTagging container -from SGComps.SGCompsConf import AddressRemappingSvc -AddressRemappingSvc = AddressRemappingSvc("AddressRemappingSvc") -AddressRemappingSvc.TypeKeyRenameMaps += ['xAOD::JetAuxContainer#AntiKt4EMTopoJets.btaggingLink->AntiKt4EMTopoJets.oldbtaggingLink'] -svcMgr+= AddressRemappingSvc - -taggerList = ['IP2D', 'IP3D', 'SV1', 'JetFitterNN', 'MV2c10'] -#JetVertexCharge disable ATLASRECTS-4506 -btagalg = BTagConf.setupJetBTaggerAlg(JetCollection="AntiKt4EMTopoJets", TaggerList=taggerList) - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() -topSequence += btagalg diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagLightSecVertexing.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagLightSecVertexing.cxx index 9472b7551c77164cec964c220c5b2732e0653fc8..dcbffc3c393388506dd100a888567d444c641dd3 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagLightSecVertexing.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagLightSecVertexing.cxx @@ -1,49 +1,27 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#include "BTagging/IBTagLightSecVertexing.h" #include "BTagging/BTagLightSecVertexing.h" #include "xAODCore/ShallowCopy.h" -#include "VxVertex/VxContainer.h" -#include "VxVertex/RecVertex.h" -#include "VxVertex/PrimaryVertexSelector.h" //general interface for secondary vertex finders #include "VxSecVertex/VxSecVKalVertexInfo.h" #include "VxSecVertex/VxJetFitterVertexInfo.h" - -#include "Particle/TrackParticle.h" -#include "JetTagEvent/ISvxAssociation.h" -#include "JetTagEvent/TrackAssociation.h" #include "VxJetVertex/VxJetCandidate.h" #include "VxJetVertex/VxVertexOnJetAxis.h" -#include "VxJetVertex/SelectedTracksInJet.h" #include "VxJetVertex/TwoTrackVerticesInJet.h" -#include "VxJetVertex/VxClusteringTable.h" -#include "VxJetVertex/PairOfVxVertexOnJetAxis.h" -#include "VxJetVertex/VxClusteringTable.h" +#include "VxJetVertex/RecVertexPositions.h" #include "VxVertex/VxTrackAtVertex.h" -#include "GeoPrimitives/GeoPrimitives.h" #include "TrkLinks/LinkToXAODTrackParticle.h" -#include "JetTagTools/JetFitterVariablesFactory.h" -//#include "JetTagTools/MSVVariablesFactory.h" - -#include "xAODBTagging/BTagging.h" - -#include "xAODBTagging/BTagVertex.h" #include "xAODBTagging/BTagVertexContainer.h" -#include "xAODBTagging/BTagVertexAuxContainer.h" -#include "xAODTracking/VertexContainer.h" -#include "xAODTracking/VertexAuxContainer.h" #include "xAODTracking/Vertex.h" -#include "xAODTracking/TrackParticleContainer.h" #include "xAODBase/IParticle.h" #include "StoreGate/ReadDecorHandle.h" @@ -52,22 +30,16 @@ namespace Analysis { BTagLightSecVertexing::BTagLightSecVertexing(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), - m_JFvarFactory("Analysis::JetFitterVariablesFactory",this), - //m_MSVvarFactory("Analysis::MSVVariablesFactory",this), - m_vxPrimaryName("PrimaryVertices") + m_JFvarFactory("Analysis::JetFitterVariablesFactory",this) { declareInterface<IBTagLightSecVertexing>(this); - declareProperty("PrimaryVertexName", m_vxPrimaryName); //List of the secondary vertex finders in jet to be used declareProperty("SecVtxFinderTrackNameList", m_secVertexFinderTrackNameList); declareProperty("SecVtxFinderxAODBaseNameList", m_secVertexFinderBaseNameList); - declareProperty("JetFitterVariableFactory", m_JFvarFactory); - //declareProperty("MSVVariableFactory", m_MSVvarFactory); + declareProperty("JetFitterVariableFactory", m_JFvarFactory); } - BTagLightSecVertexing::~BTagLightSecVertexing() = default; - StatusCode BTagLightSecVertexing::initialize() { // This will check that the properties were initialized properly @@ -98,20 +70,15 @@ namespace Analysis { } else { ATH_MSG_DEBUG("#BTAG# Retrieved " << m_JFvarFactory); } - /*if ( m_MSVvarFactory.retrieve().isFailure() ) { - ATH_MSG_ERROR("#BTAG# Failed to retrieve " << m_MSVvarFactory); - } else { - ATH_MSG_DEBUG("#BTAG# Retrieved " << m_MSVvarFactory); - }*/ return StatusCode::SUCCESS; } StatusCode BTagLightSecVertexing::fillVkalVariables(const xAOD::Jet& myJet, - xAOD::BTagging* newBTag, - const Trk::VxSecVKalVertexInfo* myVertexInfoVKal, - const xAOD::TrackParticleContainer* theTrackParticleContainer, - const std::string& basename) const { + xAOD::BTagging* newBTag, + const Trk::VxSecVKalVertexInfo* myVertexInfoVKal, + const xAOD::TrackParticleContainer* theTrackParticleContainer, + const std::string& basename) const { const auto& key = basename.find("Flip")!=std::string::npos ? m_jetSVFlipLinkName : m_jetSVLinkName; SG::ReadDecorHandle<xAOD::JetContainer, std::vector<ElementLink< xAOD::VertexContainer> > > h_jetSVLinkName (key); @@ -204,10 +171,10 @@ namespace Analysis { } StatusCode BTagLightSecVertexing::fillJFVariables(const xAOD::Jet& myJet, - xAOD::BTagging* newBTag, - const Trk::VxJetFitterVertexInfo* myVertexInfoJetFitter, - const xAOD::TrackParticleContainer* theTrackParticleContainer, - const std::string& basename) const { + xAOD::BTagging* newBTag, + const Trk::VxJetFitterVertexInfo* myVertexInfoJetFitter, + const xAOD::TrackParticleContainer* theTrackParticleContainer, + const std::string& basename) const { //THIS is a nasty hack from VD but by it's more likely we get GNN to work than someone to re-organise JetFitter const auto& key = basename.find("Flip")!=std::string::npos ? m_jetJFFlipVtxLinkName : m_jetJFVtxLinkName; @@ -352,8 +319,8 @@ namespace Analysis { } for (const auto *fz : *h_VertexCollectionName) { if (fz->vertexType() == xAOD::VxType::PriVtx) { - primaryVertex = fz; - break; + primaryVertex = fz; + break; } } @@ -363,7 +330,7 @@ namespace Analysis { xAOD::VertexContainer::const_iterator fz = h_VertexCollectionName->begin(); primaryVertex = *fz; if (primaryVertex->nTrackParticles() == 0) { - ATH_MSG_DEBUG("#BTAG# PV==BeamSpot: probably poor tagging"); + ATH_MSG_DEBUG("#BTAG# PV==BeamSpot: probably poor tagging"); } } @@ -406,15 +373,15 @@ namespace Analysis { (*btagIter)->setVariable<std::vector<ElementLink<xAOD::VertexContainer> > >(basename, "vertices", SVertexLinks); (*btagIter)->setDynVxELName(basename, "vertices"); } - else if("MSV" == basename){ + else if("MSV" == basename){ std::vector<ElementLink<xAOD::TrackParticleContainer> > badtrackEL; (*btagIter)->setVariable<std::vector<ElementLink<xAOD::TrackParticleContainer> > >(basename, "badTracksIP", badtrackEL); (*btagIter)->setDynTPELName(basename, "badTracksIP"); std::vector< ElementLink< xAOD::VertexContainer > > SVertexLinks; (*btagIter)->setVariable<std::vector<ElementLink<xAOD::VertexContainer> > >(basename, "vertices", SVertexLinks); (*btagIter)->setDynVxELName(basename, "vertices"); - } - else if("JetFitter" == basename || "JetFitterFlip" == basename) { + } + else if("JetFitter" == basename || "JetFitterFlip" == basename) { std::vector< ElementLink< xAOD::TrackParticleContainer > > tracksAtPVlinks; (*btagIter)->setVariable<std::vector< ElementLink< xAOD::TrackParticleContainer > > >(basename, "tracksAtPVlinks", tracksAtPVlinks); (*btagIter)->setDynTPELName(basename, "tracksAtPVlinks"); @@ -429,12 +396,12 @@ namespace Analysis { if (basename == "SV1" || basename == "SV1Flip") { const Trk::VxSecVKalVertexInfo* myVertexInfoVKal = dynamic_cast<const Trk::VxSecVKalVertexInfo*>(myVertexInfo); - ATH_MSG_DEBUG("#BTAG# Found valid VKalVertexInfo information: " << infoCont.key()); - StatusCode sc = fillVkalVariables(**jetIter, *btagIter, myVertexInfoVKal, theTrackParticleContainer, basename); - if(sc.isFailure()){ - ATH_MSG_ERROR("#BTAG# error filling variables from VxSecVKalVertexInfo for " << basename); - return sc; - } + ATH_MSG_DEBUG("#BTAG# Found valid VKalVertexInfo information: " << infoCont.key()); + StatusCode sc = fillVkalVariables(**jetIter, *btagIter, myVertexInfoVKal, theTrackParticleContainer, basename); + if(sc.isFailure()){ + ATH_MSG_ERROR("#BTAG# error filling variables from VxSecVKalVertexInfo for " << basename); + return sc; + } } else if (basename == "JetFitter" || basename == "JetFitterFlip") { const Trk::VxJetFitterVertexInfo* myVertexInfoJetFitter = dynamic_cast<const Trk::VxJetFitterVertexInfo*>(myVertexInfo); ATH_MSG_DEBUG("#BTAG# Found valid VxJetFitterVertexInfo information: " << infoCont.key()); diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTool.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTool.cxx index 1e0d545c9d6874bc1acefa6994670c290e731819..08194d6c27c9bc1a36424f49fc6312bb2cb52fc1 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -17,33 +17,18 @@ #include "xAODTracking/Vertex.h" #include "xAODTracking/VertexContainer.h" -#include "VxVertex/VxTrackAtVertex.h" - -#include "JetTagTools/ITagTool.h" namespace Analysis { BTagTool::BTagTool(const std::string& t, const std::string& n, const IInterface* p) : base_class(t,n,p), m_bTagToolHandleArray(this), - m_bTagTool(std::map<std::string, ITagTool*>()), - m_BaselineTagger("IP3D+SV1"), - m_vxPrimaryName("PrimaryVertices"), - m_runModus("analysis") + m_bTagTool(std::map<std::string, ITagTool*>()) { - // Name of StoreGate collections - declareProperty("PrimaryVertexName", m_vxPrimaryName); - // List of the tagging tools to be used, HAS TO BE given by jobOptions declareProperty("TagToolList", m_bTagToolHandleArray); - - declareProperty("BaselineTagger", m_BaselineTagger); - - declareProperty("Runmodus" , m_runModus); // The run modus (reference/analysis) } - BTagTool::~BTagTool() = default; - StatusCode BTagTool::initialize() { // This will check that the properties were initialized properly @@ -92,40 +77,36 @@ namespace Analysis { /* RETRIEVE PRIMARY VERTEX CONTAINER FROM STOREGATE */ /* ----------------------------------------------------------------------------------- */ const xAOD::Vertex* primaryVertex(nullptr); - StatusCode sc = StatusCode::SUCCESS; + SG::ReadHandle<xAOD::VertexContainer> h_VertexCollectionName (m_VertexCollectionName); if (vtx) { primaryVertex = vtx; } else { - const xAOD::VertexContainer* vxContainer(nullptr); - - sc = evtStore()->retrieve(vxContainer, m_vxPrimaryName); - - if (sc.isFailure()) { - ATH_MSG_WARNING("#BTAG# Primary vertex coll " << m_vxPrimaryName << " not found"); - return StatusCode::SUCCESS; + if (!h_VertexCollectionName.isValid()) { + ATH_MSG_ERROR( " cannot retrieve primary vertex container with key " << m_VertexCollectionName.key() ); + return StatusCode::FAILURE; } - - if (vxContainer->empty()) { + unsigned int nVertexes = h_VertexCollectionName->size(); + if (nVertexes == 0) { ATH_MSG_DEBUG("#BTAG# Vertex container is empty"); return StatusCode::SUCCESS; } - for (const auto *fz : *vxContainer) { + for (const auto *fz : *h_VertexCollectionName) { if (fz->vertexType() == xAOD::VxType::PriVtx) { primaryVertex = fz; break; } } - + if (! primaryVertex) { ATH_MSG_DEBUG("#BTAG# No vertex labeled as VxType::PriVtx!"); - xAOD::VertexContainer::const_iterator fz = vxContainer->begin(); - primaryVertex = *fz; + xAOD::VertexContainer::const_iterator fz = h_VertexCollectionName->begin(); + primaryVertex = *fz; if (primaryVertex->nTrackParticles() == 0) { ATH_MSG_DEBUG("#BTAG# PV==BeamSpot: probably poor tagging"); m_nBeamSpotPvx++; - } + } } } @@ -134,22 +115,12 @@ namespace Analysis { /* ----------------------------------------------------------------------------------- */ for (const ToolHandle<ITagTool>& tool : m_bTagToolHandleArray) { - sc = tool->tagJet(*primaryVertex, *jetToTag, *BTag, jetName); + StatusCode sc = tool->tagJet(*primaryVertex, *jetToTag, *BTag, jetName); if (sc.isFailure()) { ATH_MSG_WARNING("#BTAG# failed tagger: " << tool.typeAndName() ); } } -/* if (m_runModus == "analysis") { - double weight = -100.; - if (m_BaselineTagger == "IP3D+SV1") - weight = jetToTag.getFlavourTagWeight(); - else - weight = jetToTag.getFlavourTagWeight(m_BaselineTagger); - std::vector<double> w; w.reserve(1); w.push_back(weight); - jetToTag.setCombinedLikelihood(w); - } -*/ // ---------------------------------------------------------------------------------- @@ -164,8 +135,8 @@ namespace Analysis { /* ----------------------------------------------------------------------------------- */ SG::ReadHandle<xAOD::VertexContainer> h_VertexCollectionName (m_VertexCollectionName); if (!h_VertexCollectionName.isValid()) { - ATH_MSG_ERROR( " cannot retrieve primary vertex container with key " << m_VertexCollectionName.key() ); - return StatusCode::FAILURE; + ATH_MSG_ERROR( " cannot retrieve primary vertex container with key " << m_VertexCollectionName.key() ); + return StatusCode::FAILURE; } unsigned int nVertexes = h_VertexCollectionName->size(); if (nVertexes == 0) { diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx index 5fa5ec91e1032f16bd7036fe05394943418dbeb4..7f93432537d1508f2dddc801995811c79975bf6b 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx @@ -1,19 +1,8 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ - #include "BTagging/BTagTrackAugmenterAlg.h" -#include "GaudiKernel/ServiceHandle.h" - -#include "xAODTracking/Vertex.h" -#include "xAODTracking/VertexContainer.h" -#include "xAODTracking/TrackParticleContainer.h" - -// slightly ugly that we include both of these: ideally we'd just -// add the methods we need to the extrapolator -#include "TrkVertexFitterInterfaces/ITrackToVertexIPEstimator.h" -#include "TrkExInterfaces/IExtrapolator.h" #include "TrkSurfaces/PerigeeSurface.h" diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx index cd206ed5f9744bf8955cffeb8eb939e979d59650..91df01bf76bfa60d9a653c9afb4debe1f905863f 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx @@ -1,21 +1,13 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "BTagging/JetBTaggingAlg.h" -#include "xAODJet/Jet.h" -#include "xAODJet/JetContainer.h" -#include "xAODJet/JetAuxContainer.h" #include "xAODMuon/MuonContainer.h" -#include "xAODBTagging/BTagging.h" -#include "xAODBTagging/BTaggingContainer.h" #include "xAODBTagging/BTaggingAuxContainer.h" #include "StoreGate/WriteDecorHandle.h" #include "StoreGate/ReadDecorHandle.h" -#include "AthContainers/AuxElement.h" - -#include "JetTagTools/JetFitterVariablesFactory.h" #include <string> #include <optional> @@ -34,12 +26,6 @@ namespace Analysis { declareProperty("BTagSecVertexing", m_bTagSecVtxTool); } - JetBTaggingAlg::~JetBTaggingAlg() - { - /////.... - } - - StatusCode JetBTaggingAlg::initialize() { m_IncomingTracks = m_JetCollectionName.key() + "." + m_IncomingTracks.key(); diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVertexingAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVertexingAlg.cxx index b3fa6e4d814de6dc43e07e10a9267d74c6db0b68..fb50219bc16e2c134132ea9e17d0be36c4b73019 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVertexingAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVertexingAlg.cxx @@ -1,68 +1,41 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "BTagging/JetSecVertexingAlg.h" -#include "xAODCore/ShallowCopy.h" -#include "VxVertex/VxContainer.h" -#include "VxVertex/RecVertex.h" -#include "VxVertex/PrimaryVertexSelector.h" // new since rel 17.2 +#include "VxJetVertex/RecVertexPositions.h" //general interface for secondary vertex finders -#include "VxSecVertex/VxSecVertexInfo.h" #include "VxSecVertex/VxSecVKalVertexInfo.h" #include "VxSecVertex/VxJetFitterVertexInfo.h" - -#include "Particle/TrackParticle.h" -#include "JetTagEvent/ISvxAssociation.h" -#include "JetTagEvent/TrackAssociation.h" #include "VxJetVertex/VxJetCandidate.h" #include "VxJetVertex/VxVertexOnJetAxis.h" -#include "VxJetVertex/SelectedTracksInJet.h" -#include "VxJetVertex/TwoTrackVerticesInJet.h" #include "VxJetVertex/VxClusteringTable.h" #include "VxJetVertex/PairOfVxVertexOnJetAxis.h" -#include "VxJetVertex/VxClusteringTable.h" #include "VxVertex/VxTrackAtVertex.h" -#include "GeoPrimitives/GeoPrimitives.h" #include "TrkLinks/LinkToXAODTrackParticle.h" -#include "JetTagTools/MSVVariablesFactory.h" - -#include "xAODBTagging/BTagging.h" - -#include "xAODBTagging/BTagVertex.h" -#include "xAODBTagging/BTagVertexContainer.h" #include "xAODBTagging/BTagVertexAuxContainer.h" - -#include "xAODTracking/VertexContainer.h" #include "xAODTracking/VertexAuxContainer.h" -#include "xAODTracking/Vertex.h" -#include "xAODTracking/TrackParticleContainer.h" + #include "xAODBase/IParticle.h" -#include "StoreGate/ReadDecorHandle.h" -#include "StoreGate/ReadHandle.h" #include "StoreGate/WriteDecorHandle.h" namespace Analysis { JetSecVertexingAlg::JetSecVertexingAlg(const std::string& name, ISvcLocator* pSvcLocator): AthReentrantAlgorithm(name,pSvcLocator), - m_MSVvarFactory("Analysis::MSVVariablesFactory",this), - m_vxPrimaryName("PrimaryVertices") + m_MSVvarFactory("Analysis::MSVVariablesFactory",this) { - declareProperty("PrimaryVertexName", m_vxPrimaryName); declareProperty("SecVtxFinderxAODBaseName", m_secVertexFinderBaseName); declareProperty("MSVVariableFactory", m_MSVvarFactory); } - JetSecVertexingAlg::~JetSecVertexingAlg() = default; - StatusCode JetSecVertexingAlg::initialize() { // This will check that the properties were initialized properly diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVtxFindingAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVtxFindingAlg.cxx index 3ced256342151b884662a9f92aa407ea60d85e47..79f6dd780060c9301d6e174c9f26d4cbec1d2b80 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVtxFindingAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVtxFindingAlg.cxx @@ -1,13 +1,7 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -//general interface for secondary vertex finders -#include "InDetRecToolInterfaces/ISecVertexInJetFinder.h" -#include "VxSecVertex/VxSecVKalVertexInfo.h" -#include "VxSecVertex/VxJetFitterVertexInfo.h" -#include "xAODTracking/TrackParticleContainer.h" - #include "BTagging/JetSecVtxFindingAlg.h" #include "StoreGate/ReadDecorHandle.h" @@ -17,16 +11,12 @@ namespace Analysis { JetSecVtxFindingAlg::JetSecVtxFindingAlg(const std::string& name, ISvcLocator* pSvcLocator): AthReentrantAlgorithm(name,pSvcLocator), - m_secVertexFinderToolHandle(this), - m_vxPrimaryName("PrimaryVertices") + m_secVertexFinderToolHandle(this) { - declareProperty("PrimaryVertexName", m_vxPrimaryName); //List of the secondary vertex finders in jet to be run declareProperty("SecVtxFinder", m_secVertexFinderToolHandle); } - JetSecVtxFindingAlg::~JetSecVtxFindingAlg() = default; - StatusCode JetSecVtxFindingAlg::initialize() { // This will check that the properties were initialized properly diff --git a/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondAlg.h b/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondAlg.h index bcd431acb629ffcd76ab93054dfa76531928eb06..7104776949270845bf6d5b361ceac9b78a917864 100755 --- a/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGCALIBRATION_JETTAGCALIBCONDALG_H @@ -75,7 +75,6 @@ class JetTagCalibCondAlg : public AthAlgorithm { void initializeSoftMu(); void initializeMV2(const std::string&); void initializeRNNIP(); - void initializeJetVertexCharge(); void initializeMultiSV(const std::string&); void initializeDL1(const std::string&); diff --git a/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.cxx index 28163240e7cb55652ec86eba68d28b54b7fff744..578c8d83f85f43c99f98a063a8319aa992325b84 100644 --- a/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.cxx @@ -1,12 +1,11 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /* * */ #include "JetTagCalibration/JetTagCalibCondAlg.h" -//#include "JetTagTools/HistoHelperRoot.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" #include "PoolSvc/IPoolSvc.h" #include "FileCatalog/IFileCatalog.h" @@ -181,11 +180,6 @@ namespace Analysis { initializeRNNIP(); } - //JetVertexCharge tagger - if (std::find(m_taggers.begin(), m_taggers.end(), "JetVertexCharge") != m_taggers.end()) { - initializeJetVertexCharge(); - } - //MultiSV tagger if (std::find(m_taggers.begin(), m_taggers.end(), "MultiSVbb1") != m_taggers.end()) { initializeMultiSV("MultiSVbb1"); @@ -379,36 +373,6 @@ namespace Analysis { } } - - void JetTagCalibCondAlg::initializeJetVertexCharge() - { - std::string taggerNameBase = "JetVertexCharge"; - //MVA xml files - this->registerHistogram(taggerNameBase, taggerNameBase+"Calib_cat_JC_SVC_noMu"); - this->registerHistogram(taggerNameBase, taggerNameBase+"Calib_cat_JC_SVC_incMu"); - this->registerHistogram(taggerNameBase, taggerNameBase+"Calib_cat_JC_SVC_TVC_noMu"); - this->registerHistogram(taggerNameBase, taggerNameBase+"Calib_cat_JC_SVC_TVC_incMu"); - this->registerHistogram(taggerNameBase, taggerNameBase+"Calib_cat_JC_incMu"); - - //reference histos - this->registerHistogram(taggerNameBase, "jvc_JC_SVC_noMu_b"); - this->registerHistogram(taggerNameBase, "jvc_JC_SVC_noMu_bbar"); - this->registerHistogram(taggerNameBase, "jvc_JC_SVC_incMu_b"); - this->registerHistogram(taggerNameBase, "jvc_JC_SVC_incMu_bbar"); - this->registerHistogram(taggerNameBase, "jvc_JC_SVC_TVC_noMu_b"); - this->registerHistogram(taggerNameBase, "jvc_JC_SVC_TVC_noMu_bbar"); - this->registerHistogram(taggerNameBase, "jvc_JC_SVC_TVC_incMu_b"); - this->registerHistogram(taggerNameBase, "jvc_JC_SVC_TVC_incMu_bbar"); - this->registerHistogram(taggerNameBase, "jvc_JC_incMu_b"); - this->registerHistogram(taggerNameBase, "jvc_JC_incMu_bbar"); - this->registerHistogram(taggerNameBase, "jvc_JC_noMu_b"); - this->registerHistogram(taggerNameBase, "jvc_JC_noMu_bbar"); - this->registerHistogram(taggerNameBase, "jvc_SVC_b"); - this->registerHistogram(taggerNameBase, "jvc_SVC_bbar"); - this->registerHistogram(taggerNameBase, "jvc_JC_all_b"); - this->registerHistogram(taggerNameBase, "jvc_JC_all_bbar"); - } - void JetTagCalibCondAlg::initializeMultiSV(const std::string& taggerNameBase) { ATH_MSG_DEBUG("#BTAG# taggerNameBase " << taggerNameBase); diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CTTDecorCheckInTool.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CTTDecorCheckInTool.h index 4ba32a41f095365974a3a1622ae0b05c44fc4999..6b47153a8e903c71419f6a89de761561796987c1 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CTTDecorCheckInTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CTTDecorCheckInTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // // CTTDecorCheck.h - Description @@ -16,37 +16,26 @@ #include <vector> #include "AthenaBaseComps/AthAlgorithm.h" -//#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" -#include "StoreGate/DataHandle.h" #include "StoreGate/ReadDecorHandle.h" #include "StoreGate/ReadHandle.h" - #include "xAODJet/JetContainer.h" #include "xAODTracking/VertexContainer.h" #include "xAODTracking/TrackParticleContainer.h" #include "JetTagTools/ClassifiedTrackTaggerTool.h" - - -class TLorentzVector; - - - - class CTTDecorCheckInTool : public AthAlgorithm +class CTTDecorCheckInTool : public AthAlgorithm { public: /* Constructor */ CTTDecorCheckInTool(const std::string& type, ISvcLocator* pSvcLocator); /* Destructor */ - virtual ~CTTDecorCheckInTool(); - + virtual ~CTTDecorCheckInTool() = default; virtual StatusCode initialize() override; virtual StatusCode execute() override; - virtual StatusCode finalize() override; //------------------------------------------------------------------------------------------------------------------ // Private data and functions @@ -64,11 +53,7 @@ class TLorentzVector; SG::ReadHandleKey<xAOD::VertexContainer> m_verticesKey { this, "VertexContainer", "PrimaryVertices"}; SG::ReadDecorHandleKey<xAOD::JetContainer> m_jetReadDecorKey{this,"JetDecorKey","AntiKt4EMPFlowJets.CTTScore","ReadDecorHandleKey for adding CTT score to Jets"}; - - - }; - - +}; #endif diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/ClassifiedTrackTaggerTool.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/ClassifiedTrackTaggerTool.h index c7c8207ad4db08f7499650c8c338ae151aaba1eb..baa61c943047e941a069247584cb97e04f3c905c 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/ClassifiedTrackTaggerTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/ClassifiedTrackTaggerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // // ClassifiedTrackTaggerTool.h - Description @@ -22,7 +22,6 @@ #include <vector> #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" -#include "xAODTracking/TrackParticleContainer.h" #include "xAODJet/JetContainer.h" //Interface of InDetTrkInJetType (inside .h file of InDetTrkInJetType class) #include "InDetVKalVxInJetTool/InDetTrkInJetType.h" @@ -58,8 +57,7 @@ namespace Analysis { /* Constructor */ ClassifiedTrackTaggerTool(const std::string& type, const std::string& name, const IInterface* parent); /* Destructor */ - virtual ~ClassifiedTrackTaggerTool(); - + virtual ~ClassifiedTrackTaggerTool() = default; virtual StatusCode initialize() override; virtual StatusCode finalize() override; @@ -75,9 +73,7 @@ namespace Analysis { private: //debugging - IChronoStatSvc* m_timingProfile{}; - //variable to check: before public method bJetWgts can be executed, check that initialize() has been run! - int m_initialised{}; + IChronoStatSvc* m_timingProfile{}; //variables for retrieving the CTT classification score given the TCT weights std::unique_ptr<MVAUtils::BDT> m_CTTBDT; diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CombinerToolTag.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CombinerToolTag.h index d9cc2ff7ea451863735fccc1d88c907edb0b444f..1c7b32498bca5dd21245a0e95c32a5da371fd9ac 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CombinerToolTag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CombinerToolTag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /****************************************************** @@ -44,19 +44,14 @@ namespace Analysis { /** Implementations of the methods defined in the abstract base class */ - virtual ~CombinerToolTag(); - StatusCode initialize(); - StatusCode finalize(); - virtual void finalizeHistos(); - virtual void tagJet(xAOD::Jet& jetToTag); - - void setOrigin(const Trk::VxCandidate*) { } + virtual ~CombinerToolTag() = default; + virtual StatusCode initialize() override; + virtual void tagJet(xAOD::Jet& jetToTag); private: /** List of the variables to be used in the likelihood */ std::vector<std::string> m_listTaggers; - // std::vector<bool> m_useCharm; std::string m_combinedTagString; ToolHandle<ICombinerTool> m_combinerTool; diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/DetailedTrackGradeFactory.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/DetailedTrackGradeFactory.h index b4b0bcfa68ae721dbfcc2e476353c71659803844..d87e4ca146baaa161cc52e61a523e3502f7984d5 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/DetailedTrackGradeFactory.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/DetailedTrackGradeFactory.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGTOOLS_DetailedTrackGradeFactory_H @@ -27,9 +27,6 @@ #include "JetTagInfo/TrackGradesDefinition.h" -//namespace xAOD { class TrackParticle; } - - namespace Analysis { @@ -40,17 +37,15 @@ class DetailedTrackGradeFactory : public AthAlgTool, virtual public ITrackGradeF public: DetailedTrackGradeFactory(const std::string&,const std::string&,const IInterface*); - virtual ~DetailedTrackGradeFactory(); + virtual ~DetailedTrackGradeFactory() = default; - /** AlgTool initailize method */ - StatusCode initialize(); - /** AlgTool finalize method */ - StatusCode finalize(); + /** AlgTool initialize method */ + virtual StatusCode initialize() override; - TrackGrade* getGrade(const xAOD::TrackParticle & track, - const xAOD::IParticle::FourMom_t & jetMomentum) const; + virtual TrackGrade* getGrade(const xAOD::TrackParticle & track, + const xAOD::IParticle::FourMom_t & jetMomentum) const override; - virtual const TrackGradesDefinition & getTrackGradesDefinition() const; + virtual const TrackGradesDefinition & getTrackGradesDefinition() const override; private: diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/IPTag.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/IPTag.h index 1bdd2928e78e0e23aee23932935bfba08d57fed5..8f70a27b2f2d9893162ede609249a8a815363e40 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/IPTag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/IPTag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGTOOLS_IPTAG_H @@ -15,22 +15,17 @@ #include "GaudiKernel/ToolHandle.h" #include "JetTagTools/ITagTool.h" -#include "xAODTracking/TrackParticleContainerFwd.h" - #include <vector> #include <atomic> -namespace Reco { class ITrackToVertex; } namespace Trk { class ITrackToVertexIPEstimator; } namespace Analysis { - class IPInfo; class NewLikelihoodTool; class HistoHelperRoot; class TrackSelector; class TrackGrade; - class GradedTrack; class TrackGradePartition; class SVForIPTool; class ITrackGradeFactory; @@ -86,8 +81,6 @@ namespace Analysis { bool m_sortZ0D0sig; // sorting input tracks by z0d0sig bool m_RejectBadTracks; bool m_SignWithSvx; - //bool m_writeInfoBase; // writes a basic info for each tagger with Pb, Pu (IPInfoBase) - //bool m_writeInfoPlus; // writes a detailed info bool m_checkOverflows; // if true put the overflows in the first/last bins bool m_doForcedCalib; bool m_useCHypo; @@ -101,25 +94,19 @@ namespace Analysis { //// VD: other (non-bool) configurables /** Name of the track-to-jet association in the BTagging object */ std::string m_trackAssociationName; - - /** List of the variables to be used in the likelihood */ - std::vector<std::string> m_useVariables; /** specify the tag type (1D or 2D) */ std::string m_impactParameterView; /** forcing the calibration folder of a given collection */ - std::string m_ForcedCalibName; + std::string m_forcedCalibName; /** for reference mode: */ std::string m_referenceType; // label to use for reference mode - std::string m_truthMatchingName; // name of truthMatchingTool instance to get TruthInfo double m_purificationDeltaR; // skip light jets with heavy flavor in this cone double m_jetPtMinRef; // min cut on jet pT for reference /** names of fools for getting the secondary vertex information */ - std::string m_secVxFinderNameForV0Removal; - std::string m_secVxFinderNameForIPSign; std::string m_secVxFinderName; /** additional switch for smart track selection */ @@ -131,13 +118,10 @@ namespace Analysis { //// VD: auxiliary information to be stored std::vector<std::string> m_hypotheses; // hypotheses: b | u - /** information to persistify: */ - std::string m_originalTPCollectionName; - //const xAOD::TrackParticleContainer* m_originalTPCollection; /** track classification. */ std::vector<std::string> m_trackGradePartitionsDefinition; std::vector<TrackGradePartition*> m_trackGradePartitions; - std::vector<std::string> m_jetCollectionList, m_jetWithInfoPlus; // + std::vector<std::string> m_jetCollectionList; //// VD: list of tools below diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterInputWriter.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterInputWriter.h index c218be25412f2edac5d2a40bfccffea60e9cb0dc..0132b25efbf4dc3b438fcb8f925eb7b46ef37d94 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterInputWriter.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterInputWriter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGTOOL_JETFITTERINPUTWRITER_H @@ -53,8 +53,6 @@ namespace Analysis { float IP3dlike=-5000) const override; private: - Gaudi::Property<bool> m_useCombinedIPNN - { this, "useCombinedIPNN", true, "" }; Gaudi::Property<bool> m_usePtCorrectedMass { this, "usePtCorrectedMass", false, "" }; diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterVariablesFactory.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterVariablesFactory.h index 7db44c0445bf32fa7269fa184b2c68c3d152b7cc..37a6ba1b3abb5ea3b88bb27a2228602ddab4405d 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterVariablesFactory.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterVariablesFactory.h @@ -1,7 +1,7 @@ // -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGTOOL_JETFITTERVARIABLESFACTORY_C @@ -25,10 +25,6 @@ namespace Analysis { - - //static const InterfaceID IID_JetFitterVariablesFactory("Analysis::JetFitterVariablesFactory", 1, 0); - - class JetFitterVariablesFactory : public AthAlgTool , virtual public IJetFitterVariablesFactory { public: @@ -42,15 +38,9 @@ namespace Analysis { virtual StatusCode finalize(); virtual StatusCode fillJetFitterVariables(const xAOD::Jet &, xAOD::BTagging* BTag, const Trk::VxJetFitterVertexInfo* myJetFitterInfo, std::string basename) const; - - - // static const InterfaceID& interfaceID() { return IID_JetFitterVariablesFactory; }; - private: - std::string m_secVxFinderName; - std::string m_jetFitterInstance; bool m_addNegativeTracksToPrimaryVertex; bool m_usePtCorrectedEnergy; bool m_useSingleTracksAlsoForMass; diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetVertexCharge.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetVertexCharge.h deleted file mode 100644 index 8d7f8752d01d3289f474d6241431b51fa8175a9e..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetVertexCharge.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/*************************************************************************** - JetVertexCharge.h - Description - ------------------- - - created : August 2015 - authors: Luca Colasurdo (Radboud Universiteit van Nijmegen/Nikhef) - email : luca.colasurdo@cern.ch - - This class implements the tool to tag the charge of a b-jet as b-/bbar-jet. - - ***************************************************************************/ - -#ifndef JETTAGTOOLS_JETVERTEXCHARGE_H -#define JETTAGTOOLS_JETVERTEXCHARGE_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" - -#include "JetTagTools/ITagTool.h" -#include "JetTagCalibration/JetTagCalibCondData.h" - -#include "xAODTracking/TrackParticle.h" - -#include <map> - -#include "TMVA/IMethod.h" -#include "TMVA/MethodBase.h" -namespace TMVA { class Reader; } -namespace Analysis { class CalibrationBroker; } - -namespace CP { class IMuonSelectionTool; } -namespace CP { class IMuonCalibrationAndSmearingTool; } - -class TList; - -namespace Analysis { - -// class ParticleToJetAssociator; - - class JetVertexCharge : public extends<AthAlgTool, ITagTool> - { - - public: - - - JetVertexCharge(const std::string& t, const std::string& n, const IInterface* p); - - virtual ~JetVertexCharge(); - - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - - virtual void finalizeHistos() override; - - - virtual StatusCode tagJet(const xAOD::Vertex& priVtx, - const xAOD::Jet& jetToTag, - xAOD::BTagging& BTag, - const std::string &jetName) const override; - - - private: - - -// data members -//------------------------------------------------------------------------ - - /** Key of calibration data: */ - SG::ReadCondHandleKey<JetTagCalibCondData> m_readKey{this, "HistosKey", "JetTagCalibHistosKey", "Key of input (derived) JetTag calibration data"}; - ToolHandle<CP::IMuonSelectionTool> m_muonSelectorTool; - ToolHandle<CP::IMuonCalibrationAndSmearingTool> m_muonCorrectionTool; - - - enum MVAcat { - JC_SVC_noMu = 1, - JC_SVC_incMu, - JC_SVC_TVC_noMu, - JC_SVC_TVC_incMu, - JC_incMu, - JC_noMu, - SVC, - JC_all, - }; - - - -// configurable data members -//------------------------------------------------------------------------ - - std::string m_secVxFinderName; - std::string m_runModus; - std::string m_trackAssociationName; - std::string m_muonAssociationName; - - std::string m_taggerNameBase; - bool m_doForcedCalib; - std::string m_ForcedCalibName; - - int m_muonQualityCut; - - double m_kappa; - double m_kappa_SV; - double m_kappa_TV; - - double m_Trkd0Cut; - double m_Trkz0Cut; - double m_TrkPtCut; - double m_TrkChi2Cut; - int m_CutPrecisionHits; - int m_CutPixelHits; - int m_CutTRTHits; - int m_CutIBLHits; - int m_CutSCTHits; - int m_CutSharedHits; - - std::map<int, std::string> m_catNames; - - struct Vars - { - enum Var { - MU_PTREL, - MU_PTLONG, - MU_CHARGE, - MU_JET_DR, - MU_ISO_PTVAR40, - TVC, - DISTTV, - ERRTV, - MASSTV_KAONS, - NTRK1_USED, - SVC, - DISTSV, - ERRSV, - MASSSV_PIONS, - NTRK0, - TRACK_SV_PT, - JC, - TRACK_GOOD_PT, - NGOODTRK, - JET_UNCALIBRATED_PT, - JC_JETPT, - JC_ALL_JETPT, - SVC_JETPT, - TVC_JETPT, - JC_ALL, - MU_VTX, - NVARS - }; - - float m_v[NVARS]; - - Vars(); - float& operator[] (Var v) { return m_v[v]; } - float& operator[] (const std::string& name); - float operator[] (Var v) const { return m_v[v]; } - void clip (Var v, float max) { m_v[v] = std::min (m_v[v], max); } - void print(MsgStream& msg) const; - int category() const; - - static const std::unordered_map<std::string, Var> s_namemap; - }; - - -// methods -//------------------------------------------------------------------------ - - bool passTrackCuts( const xAOD::Vertex& priVtx, - const xAOD::TrackParticle &track ) const; - - float logLikelihoodRatio( int cat , float w, std::string author) const; - - std::unique_ptr<TMVA::MethodBase> - SetupReaders( Vars& vars, - TMVA::Reader& reader, - const std::string& author, - const std::string& alias , int mvaCat, TList* list) const; - std::string categoryToString(int cat) const; - - struct myVtxInfo{ - float pos; - float err; - std::vector< const xAOD::TrackParticle*> tracks; - }; - - - static bool distOrdering(const myVtxInfo& vtx1 , const myVtxInfo& vtx2) { - return vtx1.pos < vtx2.pos; - } - - static bool ptOrdering( const xAOD::TrackParticle* trk1, const xAOD::TrackParticle *trk2) { - return trk1->pt() > trk2->pt(); - } - -};//end class declaration - - inline void JetVertexCharge::finalizeHistos( ) { return; } - - - - -} //End namespace - -#endif diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MSVVariablesFactory.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MSVVariablesFactory.h index 72f34061cef2cc704aa1f8c36335b99e8c0ffa1c..419986f708a8e850b4444fc440b161ff89597107 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MSVVariablesFactory.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MSVVariablesFactory.h @@ -1,7 +1,7 @@ // -*- c++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGTOOL_MSVVARIABLESFACTORY_C @@ -20,38 +20,33 @@ class StoreGateSvc; namespace Analysis { - - //static const InterfaceID IID_JetFitterVariablesFactory("Analysis::JetFitterVariablesFactory", 1, 0); - - class MSVVariablesFactory : public AthAlgTool , virtual public IMSVVariablesFactory { public: - MSVVariablesFactory(const std::string& name, const std::string& n, const IInterface* p); - virtual ~MSVVariablesFactory(); - + virtual ~MSVVariablesFactory() = default; + virtual StatusCode initialize() override; virtual StatusCode finalize() override; - virtual StatusCode fillMSVVariables(const xAOD::Jet &, xAOD::BTagging* BTag, const Trk::VxSecVKalVertexInfo* myInfoVKal, xAOD::VertexContainer* btagVertex, const xAOD::Vertex& PV, std::string basename) const override ; - virtual StatusCode createMSVContainer(const xAOD::Jet &, const Trk::VxSecVKalVertexInfo* myInfoVKal, xAOD::VertexContainer* btagVertex, const xAOD::Vertex& PV) const override; - - void setOrigin(const xAOD::Vertex* priVtx); - // static const InterfaceID& interfaceID() { return IID_JetFitterVariablesFactory; }; - + virtual StatusCode fillMSVVariables + (const xAOD::Jet &, xAOD::BTagging* BTag, + const Trk::VxSecVKalVertexInfo* myInfoVKal, + xAOD::VertexContainer* btagVertex, const xAOD::Vertex& PV, + std::string basename) const override ; + virtual StatusCode createMSVContainer + (const xAOD::Jet &, const Trk::VxSecVKalVertexInfo* myInfoVKal, + xAOD::VertexContainer* btagVertex, const xAOD::Vertex& PV) const override; private: double get3DSignificance(const xAOD::Vertex* priVertex, std::vector<const xAOD::Vertex*>& secVertex, const Amg::Vector3D jetDirection) const; - //const xAOD::Vertex* m_priVtx; }; - //inline void MSVVariablesFactory::setOrigin(const xAOD::Vertex* priVtx) { m_priVtx = priVtx; } }//end Analysis namespace diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MV2Tag.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MV2Tag.h index d9f904e498b6d7781b0d4e40df0017c041564632..7932c8c8d85ac0e0ff8b9668f0d6b74e9d0ef6e5 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MV2Tag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MV2Tag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGTOOLS_MV2TAG_H @@ -19,6 +19,7 @@ #include <list> #include "MVAUtils/BDT.h" #include "JetTagCalibration/JetTagCalibCondData.h" +#include "TLorentzVector.h" namespace Analysis { @@ -32,9 +33,8 @@ namespace Analysis { /** Implementations of the methods defined in the abstract base class */ - virtual ~MV2Tag(); + virtual ~MV2Tag() = default; virtual StatusCode initialize()override ; - virtual StatusCode finalize() override; virtual void assignProbability(xAOD::BTagging* BTag, @@ -44,17 +44,13 @@ namespace Analysis { private: - std::string m_taggerName; std::string m_taggerNameBase; // unique name for regular and flip versions - std::string m_treeName; std::string m_varStrName; /** Key of calibration data: */ SG::ReadCondHandleKey<JetTagCalibCondData> m_readKey{this, "HistosKey", "JetTagCalibHistosKey", "Key of input (derived) JetTag calibration data"}; bool m_forceMV2CalibrationAlias; - std::string m_decTagName; std::string m_MV2CalibAlias; - std::string m_MV2cXX; std::string m_xAODBaseName; std::map<std::string, double > m_defaultvals; @@ -74,29 +70,9 @@ namespace Analysis { (m_runModus=1) where already made reference histograms are read.*/ std::string m_runModus; //!< 0=Do not read histos, 1=Read referece histos (analysis mode) - /** Storage for the primary vertex. Can be removed when JetTag provides origin(). */ - // this pointer does not need to be deleted in the destructor (because it - // points to something in storegate) - //const xAOD::Vertex* m_priVtx; - - /** reader to define the MVA algorithms */ - std::list<std::string> m_undefinedReaders; // keep track of undefined readers to prevent too many warnings. - - - std::string m_ip2d_infosource; - std::string m_ip3d_infosource; - std::string m_sv1_infosource; - std::string m_sv0_infosource; - std::string m_jftNN_infosource; - std::string m_jfprob_infosource; - std::string m_softmuon_infosource; - std::string m_trainingConfig; - float d0sgn_wrtJet(const TLorentzVector& jet, const TLorentzVector& trk, float d0sig) const; float z0sgn_wrtJet(float trackTheta, float trackZ0, float jetEta) const; - //void setInputVariables(xAOD::Jet& jetToTag, xAOD::BTagging* BTag);//for future - //void ClearInputs(); - //void PrintInputs(); + std::vector<float> CreateVariables (const std::map<std::string, double> &inputs, const std::vector<std::string>& inputVars) const; diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultiSVTag.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultiSVTag.h index c37c61d50fc2d5453952f7d66c2da3b1e73a7555..7b5faa879d53fe6de453e62897225bde6e826d00 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultiSVTag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultiSVTag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -13,9 +13,6 @@ #include "GaudiKernel/ToolHandle.h" #include "JetTagTools/ITagTool.h" #include "JetTagCalibration/JetTagCalibCondData.h" -#include "GeoPrimitives/GeoPrimitives.h" -#include "xAODTracking/TrackParticle.h" -#include "xAODTracking/TrackParticleContainer.h" #include <string> #include <vector> #include <map> @@ -29,9 +26,8 @@ namespace Analysis { public: MultiSVTag(const std::string&,const std::string&,const IInterface*); - virtual ~MultiSVTag(); + virtual ~MultiSVTag() = default; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; virtual StatusCode tagJet(const xAOD::Vertex& priVtx, const xAOD::Jet& jetToTag, @@ -41,30 +37,19 @@ namespace Analysis virtual void finalizeHistos() override; private: - std::string m_taggerName; std::string m_taggerNameBase; // - std::string m_treeName; std::string m_varStrName; /** Key of calibration data: */ SG::ReadCondHandleKey<JetTagCalibCondData> m_readKey{this, "HistosKey", "JetTagCalibHistosKey", "Key of input (derived) JetTag calibration data"}; - std::string m_MultiSV; // std::string m_runModus; - std::string m_refType; - - int m_warnCounter; - std::vector<std::string> m_jetCollectionList; - std::vector<std::string> m_hypotheses; bool m_doForcedCalib; std::string m_ForcedCalibName; std::string m_secVxFinderName; - std::string m_xAODBaseName; - //... - //... - std::string m_sv0_infosource; + std::string m_sv1_infosource; struct Vars diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultivariateTagManager.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultivariateTagManager.h index 22bdbfc75b207f1847e2fa457f4e7c5d4b679474..3f129d6d6220f326fd36190eadb11f6fdc94e2fe 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultivariateTagManager.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultivariateTagManager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGTOOL_MULTIVARIATETAGMANAGER_C @@ -32,12 +32,10 @@ namespace Analysis { const std::string&, const IInterface*); - virtual ~MultivariateTagManager(){}; + virtual ~MultivariateTagManager() = default; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - virtual void finalizeHistos() override {}; - + virtual void finalizeHistos() override {}; virtual StatusCode tagJet(const xAOD::Vertex& priVtx, const xAOD::Jet& jetToTag, diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/NewLikelihoodTool.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/NewLikelihoodTool.h index 4fae388c94ec1b57acd5761bc27cecfc169cb06a..06686364a6bc17a3826ddc0ef3e3a5b8dc4a2a85 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/NewLikelihoodTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/NewLikelihoodTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGTOOLS_NEWLIKELIHOODMULTIDTOOL_H @@ -11,7 +11,6 @@ ********************************************************/ #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "JetTagTools/LikelihoodComponents.h" #include "JetTagCalibration/JetTagCalibCondData.h" #include <string> @@ -28,10 +27,9 @@ class NewLikelihoodTool : public AthAlgTool { public: NewLikelihoodTool(const std::string&,const std::string&,const IInterface*); - virtual ~NewLikelihoodTool(); + virtual ~NewLikelihoodTool() = default; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; static const InterfaceID& interfaceID() { return IID_NewLikelihoodTool; }; diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVForIPTool.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVForIPTool.h index d6598a8f147fcc3bbe5cc90edffea7add4539210..d5b7e6254c6a89c00ee91a67c0b76b7cde4f540e 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVForIPTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVForIPTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef JetTagTools_SVForIPTool_H @@ -15,10 +15,8 @@ @author Giacinto Piacquadio (giacinto.piacquadio AT physik.uni-freiburg.de) ********************************************************/ -#include "GeoPrimitives/GeoPrimitives.h" #include "AthenaBaseComps/AthAlgTool.h" #include "xAODTracking/Vertex.h" -#include "xAODTracking/VertexContainer.h" #include "xAODBTagging/BTagging.h" #include <vector> @@ -37,18 +35,14 @@ namespace Analysis { SVForIPTool(const std::string& name, const std::string& n, const IInterface* p); - virtual ~SVForIPTool(); - - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; + virtual ~SVForIPTool() = default; - /**Method to get the B flight direction from the secondary vertex info */ + /**Method to get the B flight direction from the secondary vertex info */ void getDirectionFromSecondaryVertexInfo(Amg::Vector3D & SvxDirection, bool & canUseSvxDirection, xAOD::BTagging * BTag, const std::string & secVxFinderName, const xAOD::Vertex & priVtx) const; - // const Trk::RecVertex & priVtx); /**Method to get the tracks from V0 from the secondary vertex info */ diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVTag.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVTag.h index 8b8a34c3e4cb3b1c7b20a9e0425c35a572509cf0..31c128b08f8db1fa3971686f441d365d49c05f02 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVTag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVTag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -9,22 +9,15 @@ #ifndef JETTAGTOOLS_SVTAG_H #define JETTAGTOOLS_SVTAG_H -#include "GeoPrimitives/GeoPrimitives.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" #include "JetTagTools/ITagTool.h" #include "xAODJet/Jet.h" -#include "xAODTracking/TrackParticle.h" -#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/Vertex.h" + #include <vector> #include <map> - -//namespace xAOD { class TrackParticle; class TrackParticleContainer; } -//namespace Trk { class RecVertex;} -//class Jet; -class StoreGateSvc; - namespace Analysis { class SVInfo; @@ -43,7 +36,7 @@ namespace Analysis const xAOD::Jet& jetToTag, xAOD::BTagging& BTag, const std::string &jetName) const override; - virtual void finalizeHistos() override; + virtual void finalizeHistos() override {}; private: @@ -51,9 +44,7 @@ namespace Analysis double get3DSignificance(const xAOD::Vertex& priVertex, std::vector<const xAOD::Vertex*>& secVertex, const Amg::Vector3D jetDirection) const; - // double get3DSignificance(const Trk::RecVertex & priVertex, - // std::vector<const Trk::RecVertex*> & secVertex, - // const Amg::Vector3D jetDirection); + double get3DSignificanceCorr(const xAOD::Vertex& priVertex, std::vector<const xAOD::Vertex*>& secVertex, const Amg::Vector3D jetDirection) const; @@ -71,11 +62,6 @@ namespace Analysis float m_pTjetmin; bool m_checkOverflows; double m_purificationDeltaR; - bool m_UseBinInterpol; - - /** information to persistify: */ - // std::string m_originalTPCollectionName; - // const xAOD::TrackParticleContainer* m_originalTPCollection; /** just print some info at the beginning */ void printParameterSettings(); diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterVariablesFactoryConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterVariablesFactoryConfig.py index 09f99b4735fc943a5acedf339a3a5c9ffc907c09..d08d1fb00835eeb6a7b22f9334c5b454cd8c8747 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterVariablesFactoryConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterVariablesFactoryConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -17,8 +17,7 @@ def JetFitterVariablesFactoryCfg(name, useBTagFlagsDefaults = True, **options): output: The actual tool, which can then by added to ToolSvc via ToolSvc += output.""" acc = ComponentAccumulator() if useBTagFlagsDefaults: - defaults = { 'JetFitterInstance' : 'JetFitterTag', - 'secVxFinderName' : 'JetFitterVxFinder' } + defaults = {} for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetVertexChargeConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetVertexChargeConfig.py deleted file mode 100644 index 5f6930d681be548267b444a0a5d322e15a4baa49..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetVertexChargeConfig.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from JetTagTools.MuonSelectorToolConfig import MuonSelectorToolCfg -from JetTagTools.MuonCorrectionsToolConfig import MuonCorrectionsToolCfg - -# import the JetVertexCharger configurable -from JetTagTools.JetTagToolsConf import Analysis__JetVertexCharge - -def JetVertexChargeCfg(flags, name = 'JetVertexCharge', scheme = '', useBTagFlagsDefaults = True, **options ): - - """Sets up a JetVertexCharge tool and returns it. - - The following options have BTaggingFlags defaults: - - Runmodus default: BTagging.RunModus - taggerNameBase default: "JetVertexCharge" - useForcedCalibration default: False - kFactor default: 1.1 - kFactorSV default: 0.7 - kFactorTV default: 0.7 - Trkd0Cut default: 3.5 - Trkz0Cut default: 4.5 - TrkPtCut default: 500.0 - TrkChi2Cut default: 5.0 - CutPrecisionHits default: 9 - CutPixelHits default: 1 - CutTRTHits default: 9 - CutIBLHits default: 0 - CutSCTHits default: 4 - CutSharedHits default: 2 - MuonQuality default: xAOD::Muon::Medium - - - input: name: The name of the tool (should be unique). - useBTagFlagsDefaults : Whether to use BTaggingFlags defaults for options that are not specified. - **options: Python dictionary with options for the tool. - output: The actual tool.""" - acc = ComponentAccumulator() - if useBTagFlagsDefaults: - muonSelectorTool = acc.popToolsAndMerge(MuonSelectorToolCfg('MuonSelectorTool')) - muonCorrectionsTool = acc.popToolsAndMerge(MuonCorrectionsToolCfg('MuonCorrectionsTool')) - defaults = { 'Runmodus' : flags.BTagging.RunModus, - 'taggerNameBase' : 'JetVertexCharge', - 'useForcedCalibration' : False, - 'kFactor' : 1.1, - 'kFactorSV' : 0.7, - 'kFactorTV' : 0.7, - 'Trkd0Cut' : 3.5, - 'Trkz0Cut' : 4.5, - 'TrkPtCut' : 500.0, - 'TrkChi2Cut' : 5.0, - 'CutPrecisionHits' : 9, - 'CutPixelHits' : 1, - 'CutTRTHits' : 9, - 'CutIBLHits' : 0, - 'CutSCTHits' : 4, - 'CutSharedHits' : 2, - 'MuonQuality' : 2, - 'muonCorrectionTool' : muonCorrectionsTool, - 'muonSelectorTool' : muonSelectorTool, - } - for option in defaults: - options.setdefault(option, defaults[option]) - options['name'] = name - if scheme == 'Trig': - options['HistosKey'] = 'JetTagTrigCalibHistosKey' - acc.setPrivateTools(Analysis__JetVertexCharge(**options)) - return acc - diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py index 7df05c9137e788f5a553efe95b32c32a21e304cf..b2078c56076874e22fcc16e92142711acc4bcd11 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -11,7 +11,6 @@ def MV2TagCfg( flags, name = 'MV2c10', scheme = '', useBTagFlagsDefaults = True, The following options have BTaggingFlags defaults: Runmodus default: BTagging.RunModus - taggerName default: "MV2c10" taggerNameBase default: "MV2c10" forceMV2CalibrationAlias default: BTaggingFlags.ForceMV2CalibrationAlias MV2CalibAlias default: BTaggingFlags.MV2CalibAlias @@ -31,7 +30,6 @@ def MV2TagCfg( flags, name = 'MV2c10', scheme = '', useBTagFlagsDefaults = True, if useBTagFlagsDefaults: defaults = { 'Runmodus' : flags.BTagging.RunModus, - 'taggerName' : basename, 'taggerNameBase' : basename, 'forceMV2CalibrationAlias' : ForceMV2CalibrationAlias, 'MV2CalibAlias' : MV2CalibAlias, diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/CTTDecorCheckInTool.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/CTTDecorCheckInTool.cxx index 430b48c1a487b3c352adf8edd940910bcc25180a..d2e9f89169519b0233559e40f22e4f60a67ed925 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/CTTDecorCheckInTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/CTTDecorCheckInTool.cxx @@ -1,14 +1,9 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#include "PathResolver/PathResolver.h" -#include "TLorentzVector.h" -//#include "StoreGate/ReadDecorHandle.h" - #include <cassert> #include "TestTools/FLOATassert.h" -#include <iostream> #include "JetTagTools/CTTDecorCheckInTool.h" // @@ -21,109 +16,83 @@ CTTDecorCheckInTool::CTTDecorCheckInTool( const std::string& name, m_classifiedTrackTagger("Analysis::ClassifiedTrackTaggerTool",this), m_jetCollection("AntiKt4EMPFlowJets") { - declareProperty("ClassifiedTrackTaggerTool", m_classifiedTrackTagger); - declareProperty("JetCollection",m_jetCollection); + declareProperty("ClassifiedTrackTaggerTool", m_classifiedTrackTagger); + declareProperty("JetCollection",m_jetCollection); } -//Destructor--------------------------------------------------------------- - CTTDecorCheckInTool::~CTTDecorCheckInTool(){ - ATH_MSG_DEBUG("ClassifiedTrackTaggerTool destructor called"); +//Initialize--------------------------------------------------------------- +StatusCode CTTDecorCheckInTool::initialize(){ + + ATH_CHECK( m_particlesKey.initialize() ); + ATH_CHECK( m_verticesKey.initialize() ); + ATH_CHECK( m_jetsKey.initialize() ); + + if(m_jetCollection.empty()){ + ATH_MSG_FATAL("No JetCollection specified! "); + } else { + m_jetReadDecorKey = m_jetCollection+".CTTScore"; + ATH_CHECK( m_jetReadDecorKey.initialize()); } -//Initialize--------------------------------------------------------------- - StatusCode CTTDecorCheckInTool::initialize(){ - - - ATH_CHECK( m_particlesKey.initialize() ); - ATH_CHECK( m_verticesKey.initialize() ); - ATH_CHECK( m_jetsKey.initialize() ); - - if(m_jetCollection!="") - { - m_jetReadDecorKey = m_jetCollection+".CTTScore"; - ATH_CHECK( m_jetReadDecorKey.initialize()); - } - - //------- - //check that the ClassifiedTrackTaggerTool can be accessed - if (m_classifiedTrackTagger.retrieve().isFailure()) { - ATH_MSG_DEBUG("Could not find Analysis::ClassifiedTrackTaggerTool"); - return StatusCode::SUCCESS; - } else { - ATH_MSG_DEBUG("Analysis::ClassifiedTrackTaggerTool found"); - } - - return StatusCode::SUCCESS; - } - - StatusCode CTTDecorCheckInTool::finalize() - { - ATH_MSG_DEBUG("CTTDecorCheckInTool finalize()"); - return StatusCode::SUCCESS; - } - - StatusCode CTTDecorCheckInTool::execute() - { - ATH_MSG_DEBUG( "Executing..." ); - if(m_jetCollection=="") {ATH_MSG_FATAL("No JetCollection specified! ");} - - SG::ReadDecorHandle< xAOD::JetContainer, float > jetReadDecorHandle (m_jetReadDecorKey); - - // Retrieve the track particles: - SG::ReadHandle<xAOD::TrackParticleContainer> trackTES(m_particlesKey); - if ( !trackTES.isValid() ) { - ATH_MSG_WARNING( "No TrackParticle container found in TDS" ); - return StatusCode::SUCCESS; } - ATH_MSG_DEBUG( "TrackParticleContainer successfully retrieved" ); - - SG::ReadHandle<xAOD::VertexContainer> pvTES(m_verticesKey); - if ( !pvTES.isValid() ) { - ATH_MSG_WARNING( "No Primary Vertices container found in TDS" ); - return StatusCode::SUCCESS; } - ATH_MSG_DEBUG( "Primary Vertices container successfully retrieved" ); - const xAOD::Vertex *primVertex=*(pvTES->begin()); - - - - //========================================================================== - SG::ReadHandle<xAOD::JetContainer> jetTES(m_jetsKey); - if ( !jetTES.isValid() ) { - ATH_MSG_WARNING( "No AntiKt4EMPflow jet container found in TDS" ); - return StatusCode::SUCCESS; } - ATH_MSG_DEBUG( "AntiKt4EMPflow jet container successfully retrieved" ); - - //save all TrackParticles in an std::vector (needed as input to the CTT tool) - xAOD::TrackParticleContainer::const_iterator trackItr = trackTES->begin(); - xAOD::TrackParticleContainer::const_iterator trackItrE = trackTES->end(); - std::vector<const xAOD::TrackParticle*> trkparticles(0); - - // Loop over all track particles: - for( ; trackItr != trackItrE; ++trackItr ) { - const xAOD::TrackParticle* trackParticle = ( *trackItr ); - trkparticles.push_back(trackParticle); - } - //first decorate all jets with the CTT method - m_classifiedTrackTagger->decorateJets(trkparticles,*primVertex,*jetTES); - - xAOD::JetContainer::const_iterator jetItr = jetTES->begin(); - xAOD::JetContainer::const_iterator jetItrE = jetTES->end(); - - for(jetItr = jetTES->begin(); jetItr != jetItrE; ++jetItr) { - /// this Jet - const xAOD::Jet* curjet = ( *jetItr ); - ATH_MSG_DEBUG( " Jet pt: " << curjet->pt()<<" eta: "<<curjet->eta()<<" phi: "<< curjet->phi() ); - float CTTScore = m_classifiedTrackTagger->bJetWgts(trkparticles, *primVertex, curjet->p4()); - ATH_MSG_DEBUG ("Retrieved CTT score from CTT tool: " << CTTScore); - ATH_MSG_DEBUG("CTT score of decorated xAOD::Jet : " << jetReadDecorHandle(*curjet)); - assert(Athena_test::isEqual(CTTScore,jetReadDecorHandle(*curjet))); - - } - - /** - for (const xAOD::Jet* & decoJet : *jetReadDecorHandle) { // Access the container. - ATH_MSG_INFO("CTT score of decorated xAOD::Jet : " << jetReadDecorHandle (decoJet); ) // Access the decoration. - }**/ - - return StatusCode::SUCCESS; + //------- + //check that the ClassifiedTrackTaggerTool can be accessed + if (m_classifiedTrackTagger.retrieve().isFailure()) { + ATH_MSG_DEBUG("Could not find Analysis::ClassifiedTrackTaggerTool"); + return StatusCode::SUCCESS; + } else { + ATH_MSG_DEBUG("Analysis::ClassifiedTrackTaggerTool found"); + } + + return StatusCode::SUCCESS; +} + +StatusCode CTTDecorCheckInTool::execute() +{ + ATH_MSG_DEBUG( "Executing..." ); + + SG::ReadDecorHandle< xAOD::JetContainer, float > jetReadDecorHandle (m_jetReadDecorKey); + + // Retrieve the track particles: + SG::ReadHandle<xAOD::TrackParticleContainer> trackTES(m_particlesKey); + if ( !trackTES.isValid() ) { + ATH_MSG_WARNING( "No TrackParticle container found in TDS" ); + return StatusCode::SUCCESS; } + ATH_MSG_DEBUG( "TrackParticleContainer successfully retrieved" ); + + SG::ReadHandle<xAOD::VertexContainer> pvTES(m_verticesKey); + if ( !pvTES.isValid() ) { + ATH_MSG_WARNING( "No Primary Vertices container found in TDS" ); + return StatusCode::SUCCESS; + } + ATH_MSG_DEBUG( "Primary Vertices container successfully retrieved" ); + const xAOD::Vertex *primVertex=*(pvTES->begin()); + + //========================================================================== + SG::ReadHandle<xAOD::JetContainer> jetTES(m_jetsKey); + if ( !jetTES.isValid() ) { + ATH_MSG_WARNING( "No AntiKt4EMPflow jet container found in TDS" ); + return StatusCode::SUCCESS; + } + ATH_MSG_DEBUG( "AntiKt4EMPflow jet container successfully retrieved" ); + + //save all TrackParticles in an std::vector (needed as input to the CTT tool) + std::vector<const xAOD::TrackParticle*> trkparticles(0); + for(const auto& trkPart : *trackTES){ + trkparticles.emplace_back(trkPart); + } + + //first decorate all jets with the CTT method + m_classifiedTrackTagger->decorateJets(trkparticles, *primVertex, *jetTES); + + for(const auto& curjet : *jetTES){ + ATH_MSG_DEBUG( " Jet pt: " << curjet->pt()<<" eta: "<<curjet->eta()<<" phi: "<< curjet->phi() ); + float CTTScore = m_classifiedTrackTagger->bJetWgts(trkparticles, *primVertex, curjet->p4()); + ATH_MSG_DEBUG ("Retrieved CTT score from CTT tool: " << CTTScore); + ATH_MSG_DEBUG("CTT score of decorated xAOD::Jet : " << jetReadDecorHandle(*curjet)); + assert(Athena_test::isEqual(CTTScore,jetReadDecorHandle(*curjet))); + } + + return StatusCode::SUCCESS; +} diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/ClassifiedTrackTaggerTool.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/ClassifiedTrackTaggerTool.cxx index 7e4c9f6bfe91bae1cea9560db581b94337a14491..bab59adbf2e4dd9664596ea2baee1f5a032d04a0 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/ClassifiedTrackTaggerTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/ClassifiedTrackTaggerTool.cxx @@ -1,11 +1,10 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "JetTagTools/ClassifiedTrackTaggerTool.h" #include "PathResolver/PathResolver.h" #include "TLorentzVector.h" -//#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" #include "MVAUtils/BDT.h" #include "TFile.h" @@ -16,39 +15,30 @@ namespace Analysis { // //Constructor-------------------------------------------------------------- -ClassifiedTrackTaggerTool::ClassifiedTrackTaggerTool(const std::string& type, - const std::string& name, - const IInterface* parent): - base_class(type,name,parent), - m_trackClassificator("InDet::InDetTrkInJetType/TrackClassificationTool",this), - m_deltaRConeSize(0.4), - m_useFivePtJetBinTCT(false), - m_calibFileName("CTT_calib_v00.root"), - m_jetCollection("AntiKt4EMPFlowJets") + ClassifiedTrackTaggerTool::ClassifiedTrackTaggerTool(const std::string& type, + const std::string& name, + const IInterface* parent): + base_class(type,name,parent), + m_trackClassificator("InDet::InDetTrkInJetType/TrackClassificationTool",this), + m_deltaRConeSize(0.4), + m_useFivePtJetBinTCT(false), + m_calibFileName("CTT_calib_v00.root"), + m_jetCollection("AntiKt4EMPFlowJets") { - declareProperty("TrackClassificationTool", m_trackClassificator); - declareProperty("deltaRConeSize", m_deltaRConeSize); - declareProperty("useFivePtJetBinTCT",m_useFivePtJetBinTCT); - declareProperty("JetCollection",m_jetCollection); - m_timingProfile=nullptr; - } - -//Destructor--------------------------------------------------------------- - ClassifiedTrackTaggerTool::~ClassifiedTrackTaggerTool(){ - ATH_MSG_DEBUG("ClassifiedTrackTaggerTool destructor called"); + declareProperty("TrackClassificationTool", m_trackClassificator); + declareProperty("deltaRConeSize", m_deltaRConeSize); + declareProperty("useFivePtJetBinTCT",m_useFivePtJetBinTCT); + declareProperty("JetCollection",m_jetCollection); + m_timingProfile=nullptr; } //Initialize--------------------------------------------------------------- - StatusCode ClassifiedTrackTaggerTool::initialize(){ - m_initialised = 0; -// - //retrieve calibration file and initialize the m_trkClassBDT - std::string fullPathToFile = PathResolverFindCalibFile("BTagging/20221012track/"+m_calibFileName); + StatusCode ClassifiedTrackTaggerTool::initialize(){ + //retrieve calibration file and initialize the m_trkClassBDT + std::string fullPathToFile = PathResolverFindCalibFile("BTagging/20221012track/"+m_calibFileName); - - std::string strBDTName=""; - if(m_useFivePtJetBinTCT) {strBDTName="CTTtrainedWithRetrainedTCT"; } - else {strBDTName="CTTtrainedWithDefaultTCT"; } + std::string strBDTName = m_useFivePtJetBinTCT ? + "CTTtrainedWithRetrainedTCT" : "CTTtrainedWithDefaultTCT"; std::unique_ptr<TFile> rootFile(TFile::Open(fullPathToFile.c_str(), "READ")); if (!rootFile) { @@ -57,71 +47,73 @@ ClassifiedTrackTaggerTool::ClassifiedTrackTaggerTool(const std::string& type, } std::unique_ptr<TTree> training( (TTree*)rootFile->Get(strBDTName.c_str()) ); m_CTTBDT = std::make_unique<MVAUtils::BDT>(training.get()); + + //------- + //check that the TrackClassificationTool can be accessed-> InDetTrkInJetType to get TCT weights per TrackParticle + if (m_trackClassificator.retrieve().isFailure()) { + ATH_MSG_DEBUG("Could not find InDet::InDetTrkInJetType - TrackClassificationTool"); + return StatusCode::FAILURE; + } else { + ATH_MSG_DEBUG("InDet::InDetTrkInJetType - TrackClassificationTool found"); + } - - //------- - //check that the TrackClassificationTool can be accessed-> InDetTrkInJetType to get TCT weights per TrackParticle - if (m_trackClassificator.retrieve().isFailure()) { - ATH_MSG_DEBUG("Could not find InDet::InDetTrkInJetType - TrackClassificationTool"); - return StatusCode::SUCCESS; - } else { - ATH_MSG_DEBUG("InDet::InDetTrkInJetType - TrackClassificationTool found"); - } - - //check that the fivePtJetBinTCT is actually used, if CTT is configured to do so - if(m_useFivePtJetBinTCT && !m_trackClassificator->usesFivePtJetBinVersion()) {ATH_MSG_ERROR("FivePtJetBin TCT tool is not used, but required by CTT!"); } - if(!m_useFivePtJetBinTCT && m_trackClassificator->usesFivePtJetBinVersion()) {ATH_MSG_ERROR("FivePtJetBin TCT tool is used, but default version required by CTT!"); } - if(m_useFivePtJetBinTCT) {ATH_MSG_DEBUG("FivePtJetBin version of TCT is used"); } - else {ATH_MSG_DEBUG("Default version of TCT is used"); } - - //SG::WriteDecorHandleKey for CTT jet decoration - if(m_jetCollection!="") - { - m_jetWriteDecorKey = m_jetCollection +".CTTScore"; - ATH_CHECK( m_jetWriteDecorKey.initialize()); - } - + //check that the fivePtJetBinTCT is actually used, if CTT is configured to do so + if(m_useFivePtJetBinTCT){ + ATH_MSG_DEBUG("FivePtJetBin version of TCT is used"); + if(!m_trackClassificator->usesFivePtJetBinVersion()) + ATH_MSG_ERROR("FivePtJetBin TCT tool is not used, but required by CTT!"); + } + else{ + ATH_MSG_DEBUG("Default version of TCT is used"); + if(m_trackClassificator->usesFivePtJetBinVersion()) + ATH_MSG_ERROR("FivePtJetBin TCT tool is used, but default version required by CTT!"); + } - m_initialised = 1; // Tool is initialised successfully. -//----- - if(msgLvl(MSG::DEBUG)) ATH_CHECK(service("ChronoStatSvc", m_timingProfile)); + //SG::WriteDecorHandleKey for CTT jet decoration + if(m_jetCollection.empty()) {ATH_MSG_FATAL("No JetCollection specified! ");} + else { + m_jetWriteDecorKey = m_jetCollection +".CTTScore"; + ATH_CHECK( m_jetWriteDecorKey.initialize()); + } + + if(msgLvl(MSG::DEBUG)) ATH_CHECK(service("ChronoStatSvc", m_timingProfile)); //----- - return StatusCode::SUCCESS; - } + return StatusCode::SUCCESS; + } - StatusCode ClassifiedTrackTaggerTool::finalize() - { + StatusCode ClassifiedTrackTaggerTool::finalize() + { if(m_timingProfile)m_timingProfile->chronoPrint("ClassifiedTrackTaggerTool"); ATH_MSG_DEBUG("ClassifiedTrackTaggerTool finalize()"); return StatusCode::SUCCESS; - } + } - float ClassifiedTrackTaggerTool::bJetWgts(const std::vector<const xAOD::TrackParticle*> & InpTrk, const xAOD::Vertex & PV, const TLorentzVector & Jet) const - { - if( !m_initialised ) return -999; - std::vector<std::vector<float>> TCTweights; - //for each track inside a cone of deltaR around the jet direction save the TCT output (wgtB, wgtL,wgtG) - //if it was not rejected by the TCT track quality cuts - for (auto itrk : InpTrk) { - if((itrk->p4()).DeltaR(Jet)<=m_deltaRConeSize) - { - std::vector<float> v_tctScore = m_trackClassificator->trkTypeWgts(itrk,PV,Jet); - bool b_zeroTCTScore = std::all_of(v_tctScore.begin(), v_tctScore.end(), [](float i) { return i==0; }); - if(!b_zeroTCTScore) { TCTweights.push_back(v_tctScore); } - } - } + float ClassifiedTrackTaggerTool::bJetWgts(const std::vector<const xAOD::TrackParticle*> & InpTrk, const xAOD::Vertex & PV, const TLorentzVector & Jet) const + { + std::vector<std::vector<float>> TCTweights; + //for each track inside a cone of deltaR around the jet direction save the TCT output (wgtB, wgtL,wgtG) + //if it was not rejected by the TCT track quality cuts + for (const auto &itrk : InpTrk) { + if((itrk->p4()).DeltaR(Jet)<=m_deltaRConeSize) { + std::vector<float> v_tctScore = m_trackClassificator->trkTypeWgts(itrk, PV, Jet); + bool b_zeroTCTScore = std::all_of(v_tctScore.begin(), v_tctScore.end(), [](float i) { return i==0; }); + if(!b_zeroTCTScore) { TCTweights.push_back(v_tctScore); } + } + } - ATH_MSG_DEBUG("[ClassifiedTrackTagger]: retrieved TCT score"); - int ntrk = TCTweights.size(); - if(ntrk< 3) {return -5; } //if less than three tracks passing quality cuts of TCT -> return default value of -5 - //get sorted indices w.r.t. wgtB (highest wgtB track -> first index in sorted_indices) - std::vector<int> sorted_indices = GetSortedIndices(TCTweights); - ATH_MSG_DEBUG("[ClassifiedTrackTagger]: ntrk = " << ntrk << " in jet"); - - float ptjet = Jet.Pt(); - float trackMultiplicity = ( ((float)ntrk) / ptjet) * 1.e3; -//--- + ATH_MSG_DEBUG("[ClassifiedTrackTagger]: retrieved TCT score"); + int ntrk = TCTweights.size(); + if(ntrk< 3) {return -5; } //if less than three tracks passing quality cuts of TCT -> return default value of -5 + + //get sorted indices w.r.t. wgtB (highest wgtB track -> first index in sorted_indices) + std::vector<int> sorted_indices = GetSortedIndices(TCTweights); + ATH_MSG_DEBUG("[ClassifiedTrackTagger]: ntrk = " << ntrk << " in jet"); + + float ptjet = Jet.Pt(); + float trackMultiplicity = ( ((float)ntrk) / ptjet) * 1.e3; + if(m_timingProfile)m_timingProfile->chronoStart("ClassifiedTrackTaggerTool"); + //-----Use MVAUtils to save CPU //order in which variables are given to the BDT wgtB_0,wgtG_0,wgtL_0,wgtB_1,wgtG_1,wgtL_1,wgtB_2,wgtG_2,wgtL_2, (ntrk/ptjet * 1.e3) // (0: track with highest wgtB), (1: track with 2nd highest wgtB), (2: track with 3rd highest wgtB) @@ -129,51 +121,42 @@ ClassifiedTrackTaggerTool::ClassifiedTrackTaggerTool(const std::string& type, ATH_MSG_DEBUG("[ClassifiedTrackTagger]: ordered signal TCT weights = " << TCTweights[sorted_indices[0]][iwgtB] << "," << TCTweights[sorted_indices[1]][iwgtB] << "," << TCTweights[sorted_indices[2]][iwgtB]); //change input variable ordering when final BDT model is chosen! - std::vector<float> bdt_vars={TCTweights[sorted_indices[0]][iwgtB],TCTweights[sorted_indices[0]][iwgtG],TCTweights[sorted_indices[0]][iwgtL], - TCTweights[sorted_indices[1]][iwgtB],TCTweights[sorted_indices[1]][iwgtG],TCTweights[sorted_indices[1]][iwgtL], - TCTweights[sorted_indices[2]][iwgtB],TCTweights[sorted_indices[2]][iwgtG],TCTweights[sorted_indices[2]][iwgtL], - trackMultiplicity}; + std::vector<float> bdt_vars = { + TCTweights[sorted_indices[0]][iwgtB], TCTweights[sorted_indices[0]][iwgtG], TCTweights[sorted_indices[0]][iwgtL], + TCTweights[sorted_indices[1]][iwgtB], TCTweights[sorted_indices[1]][iwgtG], TCTweights[sorted_indices[1]][iwgtL], + TCTweights[sorted_indices[2]][iwgtB], TCTweights[sorted_indices[2]][iwgtG], TCTweights[sorted_indices[2]][iwgtL], + trackMultiplicity}; float score=m_CTTBDT->GetGradBoostMVA(bdt_vars); ATH_MSG_DEBUG("[ClassifiedTrackTagger]: CTT classification score = " << score); - //----- if(m_timingProfile)m_timingProfile->chronoStop("ClassifiedTrackTaggerTool"); return score; } -void ClassifiedTrackTaggerTool::decorateJets(const std::vector<const xAOD::TrackParticle*> & InpTrk, const xAOD::Vertex & primVertex, const xAOD::JetContainer & jets) const -{ - if(m_jetCollection=="") {ATH_MSG_FATAL("No JetCollection specified! ");} - SG::WriteDecorHandle< xAOD::JetContainer, float > jetWriteDecorHandle (m_jetWriteDecorKey); - xAOD::JetContainer::const_iterator jetItr = jets.begin(); - xAOD::JetContainer::const_iterator jetItrE = jets.end(); - - for(jetItr = jets.begin(); jetItr != jetItrE; ++jetItr) { - /// this Jet - const xAOD::Jet* curjet = ( *jetItr ); - ATH_MSG_DEBUG( " Jet pt: " << curjet->pt()<<" eta: "<<curjet->eta()<<" phi: "<< curjet->phi() ); - float CTTScore = bJetWgts(InpTrk, primVertex, curjet->p4()); - jetWriteDecorHandle(*curjet) = CTTScore; - } - //return StatusCode::SUCCESS; -} - -std::vector<int> ClassifiedTrackTaggerTool::GetSortedIndices(std::vector<std::vector<float>> unordered_vec) const -{ - //from https://stackoverflow.com/questions/1577475/c-sorting-and-keeping-track-of-indexes - int ntrk = unordered_vec.size(); - std::vector<int> indices; - indices.clear(); - for(int i=0; i < ntrk; i++) + void ClassifiedTrackTaggerTool::decorateJets(const std::vector<const xAOD::TrackParticle*> & InpTrk, const xAOD::Vertex & primVertex, const xAOD::JetContainer & jets) const { - indices.push_back(i); + SG::WriteDecorHandle< xAOD::JetContainer, float > jetWriteDecorHandle (m_jetWriteDecorKey); + for(const auto& curjet : jets){ + ATH_MSG_DEBUG( " Jet pt: " << curjet->pt()<<" eta: "<<curjet->eta()<<" phi: "<< curjet->phi() ); + float CTTScore = bJetWgts(InpTrk, primVertex, curjet->p4()); + jetWriteDecorHandle(*curjet) = CTTScore; + } } - //sort the vector of indices, such that the index corresponding to the highest wgtB stands first, with the lowest last (unordered_vec[itrk][iwgt], wgtB-> iwgt=0) - std::sort(std::begin(indices), std::end(indices),[&unordered_vec](size_t itrk1, size_t itrk2) {return unordered_vec[itrk1][0] > unordered_vec[itrk2][0];}); - return indices; -} + std::vector<int> ClassifiedTrackTaggerTool::GetSortedIndices(std::vector<std::vector<float>> unordered_vec) const + { + //from https://stackoverflow.com/questions/1577475/c-sorting-and-keeping-track-of-indexes + int ntrk = unordered_vec.size(); + std::vector<int> indices; + indices.clear(); + for(int i=0; i < ntrk; i++) indices.push_back(i); + + //sort the vector of indices, such that the index corresponding to the highest wgtB stands first, with the lowest last (unordered_vec[itrk][iwgt], wgtB-> iwgt=0) + std::sort(std::begin(indices), std::end(indices),[&unordered_vec](size_t itrk1, size_t itrk2) {return unordered_vec[itrk1][0] > unordered_vec[itrk2][0];}); + + return indices; + } }// close namespace diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/CombinerToolTag.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/CombinerToolTag.cxx index 5a0a30338c529cb4854d309a1180b15b3501249c..ce449fbcf96db0916f41f38835442621619f86fc 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/CombinerToolTag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/CombinerToolTag.cxx @@ -23,12 +23,9 @@ #include "JetTagTools/CombinerToolTag.h" #include "JetTagInfo/BaseTagInfo.h" #include "JetTagTools/ICombinerTool.h" -//#include "JetEvent/Jet.h" - namespace Analysis { - CombinerToolTag::CombinerToolTag(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p), m_combinedTagString("combinedTag"), @@ -37,16 +34,10 @@ namespace Analysis { declareInterface<ITagTool>(this); // global configuration: declareProperty("listTaggers",m_listTaggers); - // declareProperty("useCharm",m_useCharm); declareProperty("combinedTagString",m_combinedTagString); declareProperty("CombinerTool",m_combinerTool); } - CombinerToolTag::~CombinerToolTag() { - - } - - StatusCode CombinerToolTag::initialize() { StatusCode sc = m_combinerTool.retrieve(); @@ -58,16 +49,6 @@ namespace Analysis { return StatusCode::SUCCESS; } - - void CombinerToolTag::finalizeHistos() { - } - - - - StatusCode CombinerToolTag::finalize() { - return StatusCode::SUCCESS; - } - void CombinerToolTag::tagJet(xAOD::Jet& jetToTag) { std::vector<double> combination=m_combinerTool->simpleCombine(jetToTag, @@ -77,7 +58,7 @@ namespace Analysis { newTagInfo->setTagLikelihood(combination); jetToTag.addInfo(newTagInfo); newTagInfo->makeValid(); - + } }//end namespace diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/DetailedTrackGradeFactory.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/DetailedTrackGradeFactory.cxx index cc46f57e0b3223c7c25b339ef267b7c05d68bf8a..72a6330987f89284dab8bf3bcd5ab3c8cbe2c6b5 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/DetailedTrackGradeFactory.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/DetailedTrackGradeFactory.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "JetTagTools/DetailedTrackGradeFactory.h" @@ -7,10 +7,6 @@ #include "JetTagInfo/TrackGrade.h" -#include "JetTagInfo/TrackGradesDefinition.h" - -#include "xAODTracking/TrackParticle.h" - namespace Analysis { @@ -61,9 +57,6 @@ DetailedTrackGradeFactory::DetailedTrackGradeFactory( const std::string& t, cons declareInterface<ITrackGradeFactory>( this ); } -DetailedTrackGradeFactory::~DetailedTrackGradeFactory() -{} - StatusCode DetailedTrackGradeFactory::initialize() { @@ -264,12 +257,6 @@ StatusCode DetailedTrackGradeFactory::initialize() return StatusCode::SUCCESS; } -StatusCode DetailedTrackGradeFactory::finalize() -{ - return StatusCode::SUCCESS; -} - - const TrackGradesDefinition & DetailedTrackGradeFactory::getTrackGradesDefinition() const { return m_trackGradesDefinition; diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/IPTag.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/IPTag.cxx index 0466e2bb73af2a767e706717c3933b5275305217..c9b725e03933982eb965f45a7107e196168ecfdd 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/IPTag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/IPTag.cxx @@ -1,16 +1,10 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "JetTagTools/IPTag.h" -#include "CLHEP/Vector/LorentzVector.h" -#include "GeoPrimitives/GeoPrimitives.h" #include "GaudiKernel/ITHistSvc.h" -#include "GaudiKernel/IToolSvc.h" -#include "JetTagInfo/TruthInfo.h" -#include "JetTagInfo/SvxSummary.h" #include "JetTagTools/NewLikelihoodTool.h" -#include "JetTagTools/LikelihoodComponents.h" #include "JetTagTools/HistoHelperRoot.h" #include "JetTagTools/TrackSelector.h" #include "JetTagTools/GradedTrack.h" @@ -20,24 +14,15 @@ #include "JetTagTools/ITrackGradeFactory.h" #include "xAODTracking/TrackParticle.h" #include "xAODTracking/TrackParticleContainer.h" -#include "Navigation/NavigationToken.h" -#include "ITrackToVertex/ITrackToVertex.h" #include "TrkVertexFitterInterfaces/ITrackToVertexIPEstimator.h" #include "ParticleJetTools/JetFlavourInfo.h" -#include "TH1.h" + #include <cmath> #include <sstream> #include <algorithm> #include <vector> #include <string> -#include "TLorentzVector.h" - - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//bool xaodTrackPtSorting(const xAOD::TrackParticle *track1, const xAOD::TrackParticle *track2) { -// return track1->pt()>track2->pt(); -//} namespace Analysis { @@ -109,17 +94,14 @@ namespace Analysis { declareProperty("unbiasIPEstimation" , m_unbiasIPEstimation); declareProperty("trackAssociationName" , m_trackAssociationName = "BTagTrackToJetAssociator"); - declareProperty("originalTPCollectionName", m_originalTPCollectionName = "InDetTrackParticles"); declareProperty("jetCollectionList" , m_jetCollectionList); - declareProperty("useVariables" , m_useVariables); declareProperty("impactParameterView" , m_impactParameterView = "2D"); - declareProperty("ForcedCalibrationName" , m_ForcedCalibName = "Cone4H1Tower"); + declareProperty("ForcedCalibrationName" , m_forcedCalibName = "Cone4H1Tower"); declareProperty("trackGradePartitions" , m_trackGradePartitionsDefinition); m_trackGradePartitionsDefinition.push_back("Good"); declareProperty("referenceType" , m_referenceType = "ALL"); // B, UDSG, ALL - declareProperty("truthMatchingName" , m_truthMatchingName = "TruthInfo"); declareProperty("purificationDeltaR" , m_purificationDeltaR = 0.8); declareProperty("jetPtMinRef" , m_jetPtMinRef = 15.*Gaudi::Units::GeV); @@ -296,9 +278,7 @@ namespace Analysis { /** book calibration histograms if needed */ if( m_runModus == "reference" ) { ATH_MSG_DEBUG("#BTAG# running IPTag in reference mode"); - for(uint j=0;j<m_jetCollectionList.size();j++) { - - //int nbGrades=trackFactoryGradesDefinition.numberOfGrades(); + for(uint j=0;j<m_jetCollectionList.size();j++) { for (std::vector<TrackGrade>::const_iterator listIter=listBegin ; listIter !=listEnd ; ++listIter ) { const TrackGrade & grd = (*listIter); @@ -358,7 +338,7 @@ namespace Analysis { ATH_MSG_VERBOSE("#BTAG# m_impactParameterView = " << m_impactParameterView ); /** author to know which jet algorithm: */ std::string author = jetName; - if (m_doForcedCalib) author = m_ForcedCalibName; + if (m_doForcedCalib) author = m_forcedCalibName; ATH_MSG_VERBOSE("#BTAG# Using jet type " << author << " for calibrations."); /** for the reference mode we need the true label: */ diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterInputWriter.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterInputWriter.cxx index 3ae5a181ca22b7346403023e1c0a77b706605f83..e0ae277fe5c91bbf4796ec8c2566f25f3b24df54 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterInputWriter.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterInputWriter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -15,15 +15,10 @@ /////////////////////////////////////////////////////////////////////////////////////////////////////// #include "GaudiKernel/ITHistSvc.h" -// #include <TMath.h> -// #include <TH1.h> -// #include <TH1F.h> -// #include <TH2F.h> #include <vector> #include <string> #include <map> - #include "JetTagTools/IJetFitterClassifierTool.h" #include "JetTagTools/JetFitterInputWriter.h" @@ -43,9 +38,6 @@ namespace Analysis { return StatusCode::SUCCESS; } - - - StatusCode JetFitterInputWriter::fillLikelihoodValues( xAOD::BTagging* BTag, const std::string & jetauthor, diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterVariablesFactory.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterVariablesFactory.cxx index 8d95811d3d61205792e6acf8cae6e2f7b18cc1c2..9941dc77c8e4f41a809930da99fcdb182d2bc772 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterVariablesFactory.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterVariablesFactory.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -20,16 +20,11 @@ #include "VxJetVertex/SelectedTracksInJet.h" #include "TrkParameters/TrackParameters.h" -//#include "TrkNeutralParameters/MeasuredNeutralPerigee.h" -#include "VxSecVertex/VxSecVertexInfo.h" #include "VxSecVertex/VxJetFitterVertexInfo.h" #include "TrkTrackLink/ITrackLink.h" -#include <TMath.h> - #include "CLHEP/Vector/LorentzVector.h" -#include "GeoPrimitives/GeoPrimitives.h" #include "JetTagTools/JetFitterVariablesFactory.h" @@ -43,14 +38,10 @@ namespace Analysis { JetFitterVariablesFactory::JetFitterVariablesFactory(const std::string& name, const std::string& n, const IInterface* p): AthAlgTool(name, n,p), - m_secVxFinderName("InDetJetFitterVxFinder"), - m_jetFitterInstance("JetFitterTag"), m_addNegativeTracksToPrimaryVertex(false), m_usePtCorrectedEnergy(false), m_useSingleTracksAlsoForMass(false) { - declareProperty("secVxFinderName",m_secVxFinderName); - declareProperty("JetFitterInstance",m_jetFitterInstance); declareProperty("addNegativeTracksToPrimaryVertex",m_addNegativeTracksToPrimaryVertex); declareProperty("usePtCorrectedEnergy",m_usePtCorrectedEnergy); declareProperty("useSingleTracksAlsoForMass",m_useSingleTracksAlsoForMass); @@ -139,7 +130,7 @@ StatusCode JetFitterVariablesFactory::finalize() { const Trk::TrackParameters* myParameters=(*myPrimaryLinksIter)->parameters(); if (myParameters) { - energyFromPrimary+=TMath::Sqrt(s_pion*s_pion+myParameters->momentum().mag2()); + energyFromPrimary+=std::sqrt(s_pion*s_pion+myParameters->momentum().mag2()); } else { @@ -180,16 +171,9 @@ StatusCode JetFitterVariablesFactory::finalize() { { energyFromPrimary+= - TMath::Sqrt(s_pion*s_pion+ - (*TracksAtPrimaryIter)->perigeeAtVertex()->momentum().mag2()); + std::sqrt(s_pion*s_pion+ + (*TracksAtPrimaryIter)->perigeeAtVertex()->momentum().mag2()); } -// else if (dynamic_cast<const Trk::MeasuredNeutralPerigee*>((*TracksAtPrimaryIter)->perigeeAtVertex())!=0) -// { -// ATH_MSG_VERBOSE(" Found KS pointing to primary vertex. Considering the correct mass. "); -// energyFromPrimary+= -// TMath::Sqrt(s_massks*s_massks+ -// (*TracksAtPrimaryIter)->perigeeAtVertex()->momentum().mag2()); -// } else { ATH_MSG_ERROR(" FIXME: VERTEX DOESN'T SUPPORT NEUTRAL PERIGEE, commented out in line 163"); @@ -267,13 +251,13 @@ StatusCode JetFitterVariablesFactory::finalize() { clustersOfTrackIter!=clustersOfTrackEnd;++clustersOfTrackIter) { energyFromPrimary+= - TMath::Sqrt(s_pion*s_pion+pow((*clustersOfTrackIter)->perigeeAtVertex()->momentum().mag(),2)); + std::hypot(s_pion, (*clustersOfTrackIter)->perigeeAtVertex()->momentum().mag()); } } } else { if ( (nVTX>0 && vertexSize>1) || nVTX==0 ) { - dist+=fabs(vertexPosition[ntrack])/vertexCovMatrix(ntrack,ntrack); + dist+=std::abs(vertexPosition[ntrack])/vertexCovMatrix(ntrack,ntrack); if (vertexCovMatrix(ntrack,ntrack)>0) { inverrordist+=1./vertexCovMatrix(ntrack,ntrack); @@ -301,18 +285,8 @@ StatusCode JetFitterVariablesFactory::finalize() { sumP+=mytrack; if (dynamic_cast<const Trk::Perigee*>((*clustersOfTrackIter)->perigeeAtVertex())!=0) { - massThisCluster+=CLHEP::HepLorentzVector(mytrack.x(),mytrack.y(),mytrack.z(),TMath::Sqrt(s_pion*s_pion+mytrack.mag()*mytrack.mag())); + massThisCluster+=CLHEP::HepLorentzVector(mytrack.x(), mytrack.y(), mytrack.z(), std::hypot(s_pion, mytrack.mag())); } - //WARNING/TODO: commented out until after vertex has been rewritten -// else if (dynamic_cast<const Trk::NeutralPerigee*>((*clustersOfTrackIter)->perigeeAtVertex())!=0) -// { -// ATH_MSG_VERBOSE(" Found KS in one vertex. Adding the correct KS mass! "); -// massThisCluster+=CLHEP::HepLorentzVector(TMath::Sqrt(s_massks*s_massks+mytrack.mag()*mytrack.mag()),mytrack); -// if (nVTX>0)//if there is at least a vertex with already two tracks in the event -// { -// nTracksAtVtx+=1; -// } -// } else { ATH_MSG_ERROR("Neutral parameter has been taken out until Vertex has been rewritten to support neutral perigee again. "); @@ -323,7 +297,7 @@ StatusCode JetFitterVariablesFactory::finalize() { sumPAllVertices+=sumP; double ptadd=sumP.perp(flightAxis.unit()); - double masswithneutrals=TMath::Sqrt(massThisCluster.mag2()+ptadd*ptadd)+ptadd; + double masswithneutrals=std::sqrt(massThisCluster.mag2()+ptadd*ptadd)+ptadd; if (m_useSingleTracksAlsoForMass) { @@ -340,13 +314,11 @@ StatusCode JetFitterVariablesFactory::finalize() { if (m_usePtCorrectedEnergy) { - energyFromSecondary+=TMath::Sqrt(masswithneutrals*masswithneutrals+ - sumP.mag2()); + energyFromSecondary+=std::sqrt(masswithneutrals*masswithneutrals+sumP.mag2()); } else { - energyFromSecondary+=TMath::Sqrt(massThisCluster.mag2()+ - sumP.mag2()); + energyFromSecondary+=std::sqrt(massThisCluster.mag2()+sumP.mag2()); } @@ -360,29 +332,29 @@ StatusCode JetFitterVariablesFactory::finalize() { } if (massVector.mag()>0) { - mass=TMath::Sqrt(massVector.mag2()+sumPtAdd*sumPtAdd)+sumPtAdd; - mass_uncorr=massVector.mag(); + mass=std::sqrt(massVector.mag2()+sumPtAdd*sumPtAdd)+sumPtAdd; + mass_uncorr=massVector.mag(); //port range of mass to maximum 10000. if (mass>5000.) { mass = - 5000.+(5000./M_PI)*2.*TMath::ATan((M_PI/2./5000.)*(mass-5000.)); + 5000.+(5000./M_PI)*2.*std::atan((M_PI/2./5000.)*(mass-5000.)); } if (mass_uncorr>5000.) { mass_uncorr = - 5000.+(5000./M_PI)*2.*TMath::ATan((M_PI/2./5000.)*(mass_uncorr-5000.)); + 5000.+(5000./M_PI)*2.*std::atan((M_PI/2./5000.)*(mass_uncorr-5000.)); } } if (inverrordist!=0) { - significance3d=dist/TMath::Sqrt(inverrordist); + significance3d=dist/std::sqrt(inverrordist); //port range of significance 3d to maximum 100. - significance3d=100./(M_PI/2.)*TMath::ATan((M_PI/2./100.)*significance3d); + significance3d=100./(M_PI/2.)*std::atan((M_PI/2./100.)*significance3d); } - if (fabs(sumPAllVertices.mag())>1e-7) { + if (std::abs(sumPAllVertices.mag())>1e-7) { deltaphi=sumPAllVertices.eta()-JetVector.Eta(); deltaeta=sumPAllVertices.deltaPhi(Amg::Vector3D(JetVector.Px(), JetVector.Py(), JetVector.Pz())); - deltaRFlightDir = TMath::Sqrt(sumPAllVertices.deltaPhi(flightAxis)*sumPAllVertices.deltaPhi(flightAxis) + (sumPAllVertices.eta()-flightAxis.eta())*(sumPAllVertices.eta()-flightAxis.eta())); + deltaRFlightDir = std::hypot(sumPAllVertices.deltaPhi(flightAxis), sumPAllVertices.eta()-flightAxis.eta()); } else { deltaphi=-10.; deltaeta=-10.; diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/JetVertexCharge.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/JetVertexCharge.cxx deleted file mode 100644 index dd5a7468be91ca0d1cc289b60a9b6826f27b3ca7..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/JetVertexCharge.cxx +++ /dev/null @@ -1,892 +0,0 @@ -/* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration -*/ - -/*************************************************************************** - JetVertexCharge.cxx - Description - ------------------- - - created : August 2015 - authors: Luca Colasurdo (Radboud University Nijmegen and Nikhef) - email : luca.colasurdo@cern.ch - - - Look at the header file for more information. - - ***************************************************************************/ - -#include "JetTagTools/JetVertexCharge.h" - -#include <cmath> -#include <algorithm> -#include <memory> - -#include "CLHEP/Vector/LorentzVector.h" - -#include "xAODMuon/MuonContainer.h" - -#include "MuonAnalysisInterfaces/IMuonSelectionTool.h" -#include "MuonAnalysisInterfaces/IMuonCalibrationAndSmearingTool.h" -#include "TMVA/Reader.h" -#include "TList.h" -#include "TObjString.h" - -#include "TMVA/MethodBase.h" -#include "TH1.h" - -#include "xAODBTagging/BTagVertex.h" - -const double minProb = 1e-9; - -namespace Analysis { - - - JetVertexCharge::JetVertexCharge(const std::string& t, const std::string& n, const IInterface* p) : - base_class(t,n,p), - m_muonSelectorTool("JVC_MuonSelectorTool", this), - m_muonCorrectionTool( "JVC_MuonCorrectionTool", this), - m_runModus("analysis") - { - - declareProperty("SecVxFinderName", m_secVxFinderName); - declareProperty("Runmodus", m_runModus); - - declareProperty("muonSelectorTool", m_muonSelectorTool); - declareProperty("muonCorrectionTool", m_muonCorrectionTool); - declareProperty("taggerNameBase", m_taggerNameBase = "JetVertexCharge"); - - declareProperty("useForcedCalibration", m_doForcedCalib = false); - declareProperty("forcedCalibName", m_ForcedCalibName = "AntiKt4EMTopo"); - - declareProperty("muonAssociationName", m_muonAssociationName = "Muons"); - declareProperty("trackAssociationName", m_trackAssociationName = "BTagTrackToJetAssociator"); - - declareProperty("kFactor", m_kappa = 1.1); - declareProperty("kFactorSV", m_kappa_SV = 0.7); - declareProperty("kFactorTV", m_kappa_TV = 0.7); - - declareProperty("Trkd0Cut", m_Trkd0Cut=3.5); - declareProperty("Trkz0Cut", m_Trkz0Cut=4.5); - declareProperty("TrkPtCut", m_TrkPtCut=500.0); - declareProperty("TrkChi2Cut", m_TrkChi2Cut=5.0); - declareProperty("CutPrecisionHits", m_CutPrecisionHits= 9 ); - declareProperty("CutPixelHits", m_CutPixelHits= 1 ); - declareProperty("CutTRTHits", m_CutTRTHits= 9 ); - declareProperty("CutIBLHits", m_CutIBLHits= 0 ); - declareProperty("CutSCTHits", m_CutSCTHits= 4 ); - declareProperty("CutSharedHits", m_CutSharedHits= 2 ); - - declareProperty("MuonQuality", m_muonQualityCut = xAOD::Muon::Medium ); - - } - -/////////// -//Destructor - JetVertexCharge::~JetVertexCharge() { } - - -/////////// -//Initialize method - StatusCode JetVertexCharge::initialize() { - - //Retrieve the Muon Selectot tool - StatusCode sc = m_muonSelectorTool.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_FATAL("#BTAG# Failed to retrieve tool " << m_muonSelectorTool); - return sc; - } else { - ATH_MSG_INFO("#BTAG# Retrieved tool " << m_muonSelectorTool); - } - - //Muon Calibration and Smearing - sc = m_muonCorrectionTool.retrieve(); - if ( sc.isFailure() ) { - ATH_MSG_FATAL("#BTAG# Failed to retrieve tool " << m_muonCorrectionTool); - return sc; - } else { - ATH_MSG_INFO("#BTAG# Retrieved tool " << m_muonCorrectionTool); - } - - ATH_CHECK( m_muonCorrectionTool->initialize() ); - - // prepare readKey for calibration data: - ATH_CHECK(m_readKey.initialize()); - - m_catNames[JC_SVC_noMu] = "JC_SVC_noMu"; - m_catNames[JC_SVC_incMu] = "JC_SVC_incMu"; - m_catNames[JC_SVC_TVC_noMu] = "JC_SVC_TVC_noMu"; - m_catNames[JC_SVC_TVC_incMu] = "JC_SVC_TVC_incMu"; - m_catNames[JC_incMu] = "JC_incMu"; - - return StatusCode::SUCCESS; - } - - -/////////// -//Finalize method - StatusCode JetVertexCharge::finalize() - { - ATH_MSG_DEBUG( "Finalize successful" ); - return StatusCode::SUCCESS; - } - - -////////////////////////////////////////////////////////////////// -StatusCode JetVertexCharge::tagJet( const xAOD::Vertex& priVtx, - const xAOD::Jet& jetToTag, - xAOD::BTagging& BTag, - const std::string &jetName) const -{ - //Retrieval of Calibration Condition Data objects - SG::ReadCondHandle<JetTagCalibCondData> readCdo(m_readKey); - - - /** author to know which jet algorithm: */ - std::string author = jetName; - if (m_doForcedCalib) author = m_ForcedCalibName; - std::string alias = readCdo->getChannelAlias(author); - - Vars vars; - - vars[Vars::JET_UNCALIBRATED_PT] = jetToTag.pt(); - - // computing the JetCharge (JC) - //============================================================== - - std::vector<ElementLink< xAOD::TrackParticleContainer > > tracksInJet; - tracksInJet = BTag.auxdata< std::vector<ElementLink< xAOD::TrackParticleContainer > > >(m_trackAssociationName); - if( tracksInJet.size() == 0 ) { - ATH_MSG_DEBUG("#BTAG# Could not find tracks associated with name " << m_trackAssociationName); - } else { - - ATH_MSG_DEBUG("#BTAG# There are "<<tracksInJet.size()<<" tracks associated to the jet."); - - float charge = 0, denom=0; - float charge_all = 0, denom_all=0; - float minpt = 0; - - for(std::vector<ElementLink< xAOD::TrackParticleContainer > >::iterator itEL = tracksInJet.begin(); itEL != tracksInJet.end(); ++itEL ) { - const xAOD::TrackParticle* tp = *(*itEL); - - charge_all += ( tp->charge()) * std::pow( tp->pt(), m_kappa ); - denom_all += pow( tp->pt(), m_kappa); - - if( !passTrackCuts(priVtx, *tp)) continue; - if( tp->pt() > minpt) { - vars[Vars::TRACK_GOOD_PT] = tp->pt(); - minpt = tp->pt(); - } - vars[Vars::NGOODTRK]++; - charge += ( tp->charge()) * std::pow( tp->pt(), m_kappa ); - denom += pow( tp->pt(), m_kappa); - } - - if(denom != 0) vars[Vars::JC] = charge / denom; - if(denom_all != 0) vars[Vars::JC_ALL]= charge_all / denom_all; - vars[Vars::JC_JETPT] = charge/jetToTag.pt(); - vars[Vars::JC_ALL_JETPT] = charge_all/jetToTag.pt(); - - - } - - - //============================================================== - // computing the Vertex Charges (SVC/TVC) - //============================================================== - - - std::vector< myVtxInfo > myVector; - - - - std::vector<ElementLink<xAOD::BTagVertexContainer> > JFVerticesLinks; - bool ret = BTag.variable<std::vector<ElementLink<xAOD::BTagVertexContainer>>>("JetFitter", "JFvertices", JFVerticesLinks ); - if(ret) { - if( JFVerticesLinks.size() ==0) { - ATH_MSG_DEBUG("#BTAG# No JF vertices "); - } else { - - ATH_MSG_DEBUG("#BTAG# There are "<<JFVerticesLinks.size()<<" JF vertices "); - - std::vector<float> fittedPosition; - std::vector< float > fittedCov; - BTag.variable<std::vector< float > >("JetFitter", "fittedPosition", fittedPosition); - BTag.variable<std::vector< float > >("JetFitter", "fittedCov", fittedCov); - - - - for( size_t ivx = 0; ivx< JFVerticesLinks.size(); ivx++) { - const xAOD::BTagVertex *myBTagVtx = (*JFVerticesLinks.at(ivx)); - - //Cutting on the vertices - if( myBTagVtx->chi2()/myBTagVtx->NDF() > 5. ) continue; - if( fittedPosition.at(ivx+5)<0. || fittedPosition.at(ivx+5)>250. ) continue; - if( sqrt(fittedCov.at(ivx+5)) > 5. ) continue; - - - myVtxInfo newVtx; - newVtx.tracks.clear(); - newVtx.pos = fittedPosition.at(ivx+5); - newVtx.err = sqrt(fittedCov.at(ivx+5) ); - const std::vector< ElementLink<xAOD::TrackParticleContainer> > tpLinks = myBTagVtx->track_links(); - - for( unsigned int it=0; it< tpLinks.size(); it++) { - newVtx.tracks.push_back( *tpLinks.at(it) ); - } - myVector.push_back(newVtx); - - } - - //ordering the Vx according to d0 - std::sort( myVector.begin(), myVector.end(), distOrdering ); - - } //There is at least 1 vtx - } //if (ret) - - - //Merge the "higher-vertices" - if( myVector.size()>2 ) { - double sumw = 0; - - for( int ivx = 1; ivx< (int) myVector.size(); ivx++) { //skip SV - double w = 1./std::pow( myVector.at(ivx).err, 2 ); - sumw += w; - if( ivx>1) myVector.at(1).pos += myVector.at(ivx).pos*w; - else if( ivx==1) myVector.at(1).pos = myVector.at(ivx).pos*w; - int size = myVector.at(ivx).tracks.size(); - for(int itrk=0; (itrk<size && ivx != 1); itrk++) { //so that I don't count the TV tracks twice - const xAOD::TrackParticle *tp = myVector.at(ivx).tracks.at(itrk); - myVector.at(1).tracks.push_back(tp); - } - } - - myVector.at(1).pos /= sumw; - myVector.at(1).err = 1./sumw; - - myVector.erase( myVector.begin() + 2, myVector.end() ); - } - - - - - //The preparation of the vertices is done, let's compute the charges! - - - if( myVector.size() >0 ) { //Let's work with the SV - - myVtxInfo svx = myVector.at(0); - vars[Vars::NTRK0] = svx.tracks.size(); - - - float charge = 0, denom = 0; - float ptmin = 0; - for(int itrk=0; itrk< vars[Vars::NTRK0]; itrk++) { - const xAOD::TrackParticle *tp = svx.tracks.at(itrk); - if( tp->pt() > ptmin) { - vars[Vars::TRACK_SV_PT] = tp->pt(); - ptmin = tp->pt(); - } - charge += ( tp->charge()) * std::pow( tp->pt(), m_kappa_SV); - denom += pow( tp->pt(), m_kappa_SV); - } - if(denom != 0) vars[Vars::SVC] = charge/denom; - vars[Vars::SVC_JETPT] = charge/jetToTag.pt(); - - vars[Vars::DISTSV] = svx.pos; - vars[Vars::ERRSV] = svx.err; - - //Computing the mass - TLorentzVector bhad; - for(int itrk=0; itrk< vars[Vars::NTRK0]; itrk++) { - const xAOD::TrackParticle *tp = svx.tracks.at(itrk); - TLorentzVector part; part.SetPtEtaPhiM( tp->pt(), tp->eta(), tp->phi(), 139.570 ); //Pion mass [MeV] - bhad += part; - } - vars[Vars::MASSSV_PIONS] = bhad.M(); - } - - - //----------------------------------------------------------------- - - if( myVector.size() >1 ) { //Let's work with the TV - myVtxInfo tvx = myVector.at(1); - //Use only an even N tracks for the TVC - vars[Vars::NTRK1_USED] = (tvx.tracks.size() & ~1u); - - - // pT-ordering the tracks - std::sort( tvx.tracks.begin(), tvx.tracks.end(), ptOrdering); - - float charge = 0, denom = 0; - for(int itrk=0; itrk< vars[Vars::NTRK1_USED]; itrk++) { - const xAOD::TrackParticle *tp = tvx.tracks.at(itrk); - charge += ( tp->charge()) * std::pow( tp->pt(), m_kappa_TV); - denom += pow( tp->pt(), m_kappa_TV); - } - if(denom != 0) vars[Vars::TVC] = charge/denom; - vars[Vars::DISTTV] = tvx.pos; - vars[Vars::ERRTV] = tvx.err; - vars[Vars::TVC_JETPT] = charge/jetToTag.pt(); - - - - TLorentzVector chad_k; - for(size_t itrk=0; itrk< tvx.tracks.size(); itrk++) { - const xAOD::TrackParticle *tp = tvx.tracks.at(itrk); - TLorentzVector part_k; - if( itrk == 0) part_k.SetPtEtaPhiM( tp->pt(), tp->eta(), tp->phi(), 493.667 ); //Kaon mass [MeV] - else part_k.SetPtEtaPhiM( tp->pt(), tp->eta(), tp->phi(), 139.570 ); //Pion mass [MeV] - chad_k += part_k; - } - vars[Vars::MASSTV_KAONS] = chad_k.M(); - } //check if I have a TV - - - - //============================================================== - // computing the muon variables - //============================================================== - - std::unique_ptr< xAOD::Muon> myMuon; - - std::vector<ElementLink< xAOD::MuonContainer > > muonsInJet; - muonsInJet = BTag.auxdata< std::vector<ElementLink< xAOD::MuonContainer > > >(m_muonAssociationName); - - if( muonsInJet.size() == 0 ) { - ATH_MSG_DEBUG("#BTAG# Could not find muons associated with name " << m_muonAssociationName); - } - else { - ATH_MSG_DEBUG("#BTAG# There are "<< muonsInJet.size() <<" associated with the jet"); - - for( const auto& muLink : muonsInJet) { - const xAOD::Muon* mu = *muLink; - - xAOD::Muon* corrMuHelper = nullptr; - if( m_muonCorrectionTool->correctedCopy( *mu, corrMuHelper) != CP::CorrectionCode::Ok ) { - ATH_MSG_WARNING("Cannot apply calibration nor smearing for muons." ); - continue; - } - - // Make sure that we don't lose it: - std::unique_ptr< xAOD::Muon > p_corrMu( corrMuHelper ); - - // Make all the muon quality cuts... - xAOD::Muon::Quality quality = m_muonSelectorTool->getQuality(*p_corrMu); - - //just added this cut - if( quality > m_muonQualityCut ) continue; - - //cuts on muons: - if( p_corrMu->muonType() != xAOD::Muon::MuonType::Combined) continue; - if( p_corrMu->pt() < 5.0 ) continue; - if( p_corrMu->eta() > 2.7 ) continue; - - TLorentzVector muon = p_corrMu->p4(); - TLorentzVector jet = jetToTag.p4(); - if( muon.DeltaR( jet ) > 0.3 ) continue; - - float chi2=-1; - int dof=-1; - float chi2_match = 999.; - if( p_corrMu->parameter( chi2, xAOD::Muon::ParamDef::msInnerMatchChi2 ) - && p_corrMu->parameter(dof, xAOD::Muon::ParamDef::msInnerMatchDOF ) ) - if (dof != 0) chi2_match = chi2/dof; - if( chi2_match > 5. ) continue; - - //Select the hardest one - if( myMuon.get() && ( myMuon->pt() > p_corrMu->pt() ) ) { - continue; - } - - myMuon = std::move( p_corrMu); - } - } - - - if( myMuon.get() ) { - - float iso_save = -1; - if( myMuon->isolation( iso_save, xAOD::Iso::IsolationType::ptvarcone40 )){ - vars[Vars::MU_ISO_PTVAR40] = iso_save; - } - - TLorentzVector muon = myMuon->p4(); - TLorentzVector jet = jetToTag.p4(); - vars[Vars::MU_PTREL] = muon.P()*sin( muon.Angle(jet.Vect() + muon.Vect()))/1000.; - vars[Vars::MU_PTLONG] = muon.P()*cos( muon.Angle( jet.Vect() + muon.Vect() ) )/1000.; - vars[Vars::MU_JET_DR] = muon.DeltaR( jet ); - - double deltaR = 0.08; - double deltaPt = 0.15*myMuon->pt(); - for( uint ivx=0; ivx< myVector.size(); ivx++) { - for( uint itrk=0; itrk< myVector.at(ivx).tracks.size(); itrk++) { - const xAOD::TrackParticle *tp = myVector.at(ivx).tracks.at(itrk); - - double rtu = myMuon->p4().DeltaR( tp->p4() ); - double ptu = fabs( myMuon->pt() - tp->pt() ); - if ( rtu < deltaR && ptu<deltaPt ) { - deltaR = rtu; - deltaPt = ptu; - vars[Vars::MU_VTX] = ivx +1.; - } - } - } - if( vars[Vars::MU_VTX] < 0) vars[Vars::MU_VTX] = 0.; - - - const xAOD::TrackParticle *trackMuon = myMuon->primaryTrackParticle(); - if( trackMuon) vars[Vars::MU_CHARGE] = trackMuon->charge(); - } else { - ATH_MSG_DEBUG("#BTAG# No muon passed the selection. "); - } //closes if I have myMuon - - - - //============================================================== - // now the MVA part - //============================================================== - - - int mvaCat = vars.category(); - - vars.clip (Vars::ERRSV, 5); - vars.clip (Vars::ERRTV, 5); - - if(mvaCat == JC_SVC_noMu ) { //limit the variables from above... - vars.clip (Vars::MASSSV_PIONS, 6000); - vars.clip (Vars::TRACK_GOOD_PT, 90000); - vars.clip (Vars::NTRK0, 14); - vars.clip (Vars::DISTSV, 105); - vars.clip (Vars::TRACK_SV_PT, 200000); - } - else if(mvaCat == JC_SVC_incMu ) { //limit the variables from above... - vars.clip (Vars::MASSSV_PIONS, 6000); - vars.clip (Vars::TRACK_GOOD_PT, 120000); - vars.clip (Vars::NTRK0, 13); - vars.clip (Vars::DISTSV, 120); - vars.clip (Vars::MU_PTREL, 20); - vars.clip (Vars::MU_PTLONG, 500); - } - else if(mvaCat == JC_SVC_TVC_noMu ) { //limit the variables from above... - vars.clip (Vars::DISTTV, 200); - vars.clip (Vars::NTRK1_USED, 10); - vars.clip (Vars::MASSSV_PIONS, 6000); - vars.clip (Vars::MASSTV_KAONS, 6000); - vars.clip (Vars::TRACK_GOOD_PT, 100000); - vars.clip (Vars::NTRK0, 10); - vars.clip (Vars::DISTSV, 90); - vars.clip (Vars::TRACK_SV_PT, 250000); - } - else if(mvaCat == JC_SVC_TVC_incMu ) { //limit the variables from above... - vars.clip (Vars::DISTTV, 200); - vars.clip (Vars::NTRK1_USED, 10); - vars.clip (Vars::MASSSV_PIONS, 6000); - vars.clip (Vars::MASSTV_KAONS, 6000); - vars.clip (Vars::TRACK_GOOD_PT, 120000); - vars.clip (Vars::NTRK0, 10); - vars.clip (Vars::DISTSV, 90); - vars.clip (Vars::MU_PTREL, 12); - vars.clip (Vars::MU_PTLONG, 400); - } - else if(mvaCat == JC_incMu ) { //limit the variables from above... - vars.clip (Vars::NGOODTRK, 28); - vars.clip (Vars::TRACK_GOOD_PT, 120000); - vars.clip (Vars::MU_ISO_PTVAR40, 700000); - vars.clip (Vars::MU_PTREL, 20); - vars.clip (Vars::MU_PTLONG, 400); - } - - - vars.print(msg()); - - - if( m_runModus == "reference") { - - BTag.setVariable<float>(m_taggerNameBase, "jet_uncalibrated_pt", vars[Vars::JET_UNCALIBRATED_PT] ); - BTag.setVariable<float>(m_taggerNameBase, "JC_jetPt", vars[Vars::JC_JETPT]); - BTag.setVariable<float>(m_taggerNameBase, "JC_all_jetPt", vars[Vars::JC_ALL_JETPT]); - BTag.setVariable<float>(m_taggerNameBase, "SVC_jetPt", vars[Vars::SVC_JETPT]); - BTag.setVariable<float>(m_taggerNameBase, "TVC_jetPt", vars[Vars::TVC_JETPT]); - - BTag.setVariable<float>(m_taggerNameBase, "JC_all", vars[Vars::JC_ALL] ); - BTag.setVariable<float>(m_taggerNameBase, "firstGoodTrkPt", vars[Vars::TRACK_GOOD_PT] ); - BTag.setVariable<float>(m_taggerNameBase, "firstTrkPt_SV", vars[Vars::TRACK_SV_PT]); - BTag.setVariable<float>(m_taggerNameBase, "massSV_pions", vars[Vars::MASSSV_PIONS]); - BTag.setVariable<float>(m_taggerNameBase, "massTV_kaons", vars[Vars::MASSTV_KAONS]); - - BTag.setVariable<float>(m_taggerNameBase, "JetCharge", vars[Vars::JC]); - BTag.setVariable<float>(m_taggerNameBase, "nJCtracks", vars[Vars::NGOODTRK]); - - BTag.setVariable<float>(m_taggerNameBase, "SVC", vars[Vars::SVC]); - BTag.setVariable<float>(m_taggerNameBase, "ntrk_sv", vars[Vars::NTRK0]); - BTag.setVariable<float>(m_taggerNameBase, "dist_SV", vars[Vars::DISTSV]); - BTag.setVariable<float>(m_taggerNameBase, "err_SV", vars[Vars::ERRSV]); - - BTag.setVariable<float>(m_taggerNameBase, "TVC", vars[Vars::TVC]); - BTag.setVariable<float>(m_taggerNameBase, "ntrk_tv_used", vars[Vars::NTRK1_USED]); - BTag.setVariable<float>(m_taggerNameBase, "dist_TV", vars[Vars::DISTTV]); - BTag.setVariable<float>(m_taggerNameBase, "err_TV", vars[Vars::ERRTV]); - - BTag.setVariable<float>(m_taggerNameBase, "mu_charge", vars[Vars::MU_CHARGE]); - BTag.setVariable<float>(m_taggerNameBase, "mu_ptRel", vars[Vars::MU_PTREL]); - BTag.setVariable<float>(m_taggerNameBase, "mu_ptLong", vars[Vars::MU_PTLONG]); - BTag.setVariable<float>(m_taggerNameBase, "mu_iso_ptvar40", vars[Vars::MU_ISO_PTVAR40]); - BTag.setVariable<float>(m_taggerNameBase, "mu_jet_dR", vars[Vars::MU_JET_DR]); - BTag.setVariable<float>(m_taggerNameBase, "mu_vtx", vars[Vars::MU_VTX]); - - BTag.setVariable<int>(m_taggerNameBase, "category", mvaCat ); - BTag.setVariable<float>(m_taggerNameBase, "discriminant", -7. ); - - } - else if( m_runModus == "analysis") { - - float llr; - if(mvaCat == JC_noMu ) { - llr = logLikelihoodRatio( JC_noMu, vars[Vars::JC] , author); - BTag.setVariable<float>(m_taggerNameBase, "discriminant", llr ); - return StatusCode::SUCCESS; - } - else if(mvaCat == JC_all ) { - llr = logLikelihoodRatio( JC_all, vars[Vars::JC_ALL] , author); - BTag.setVariable<float>(m_taggerNameBase, "discriminant", llr ); - return StatusCode::SUCCESS; - } - else if(mvaCat == SVC ) { - llr = logLikelihoodRatio( SVC, vars[Vars::SVC] , author); - BTag.setVariable<float>(m_taggerNameBase, "discriminant", llr ); - return StatusCode::SUCCESS; - } - else if(mvaCat < 0 ) { //NULL cat - BTag.setVariable<float>(m_taggerNameBase, "discriminant", -7. ); - return StatusCode::SUCCESS; - } - - TList* calib = readCdo->retrieveTObject<TList>(m_taggerNameBase, author, m_taggerNameBase + "Calib_cat_" + categoryToString(mvaCat)); - TMVA::Reader reader; - std::unique_ptr<TMVA::MethodBase> method = - SetupReaders(vars, reader, author, alias, mvaCat, calib ); - if( !method ) { - ATH_MSG_DEBUG("#BTAG# Could not setup the reader for the " << categoryToString(mvaCat) << " category and author " << author); - return StatusCode::SUCCESS; - } else ATH_MSG_DEBUG("#BTAG# Reader correctly setup for the " << categoryToString(mvaCat) << " category and author " << author); - - - //Finally compute the weight - float mvaWeight = reader.EvaluateMVA( method.get() ); - - - //Now I compute the log-likelihood ratio - llr = logLikelihoodRatio( mvaCat, mvaWeight , author); - BTag.setVariable<float>(m_taggerNameBase, "discriminant", llr ); - - - } //if runmodus Analysis - - - return StatusCode::SUCCESS; - -} - -//=============================================================== -// Helper functions -//=============================================================== - -bool JetVertexCharge::passTrackCuts( const xAOD::Vertex& priVtx, - const xAOD::TrackParticle &track) const { - - - double d0 = track.d0(); - double z0 = track.z0(); - double theta = track.theta(); - if (track.numberDoF() == 0) return false; - double chi2 = track.chiSquared() / track.numberDoF(); - double deltaZ0 = fabs( z0 - priVtx.z() + track.vz() ); - - - if( fabs(d0) > m_Trkd0Cut) return false; - if( deltaZ0*sin(theta) > m_Trkz0Cut) return false; - if( track.pt() < m_TrkPtCut) return false; - if( fabs(track.eta()) > 2.5 ) return false; - if( chi2 > m_TrkChi2Cut) return false; - - - - uint8_t PixelHits = 0; - if( !(track.summaryValue( PixelHits, xAOD::numberOfPixelHits)) || (PixelHits < m_CutPixelHits) ) return false; - uint8_t SCTHits = 0; - if( !(track.summaryValue( SCTHits, xAOD::numberOfSCTHits)) || (SCTHits < m_CutSCTHits) ) return false; - - if( (PixelHits + SCTHits) < m_CutPrecisionHits) return false; - - uint8_t TRTHits = 0; - if( !(track.summaryValue( TRTHits, xAOD::numberOfTRTHits)) || (TRTHits < m_CutTRTHits) ) return false; - - uint8_t IBLHits = 0; - if( !(track.summaryValue( IBLHits, xAOD::numberOfInnermostPixelLayerHits)) || (IBLHits < m_CutIBLHits) ) return false; - uint8_t IBLSharedHits = 0; - if( !(track.summaryValue( IBLSharedHits, xAOD::numberOfInnermostPixelLayerSharedHits))) return false; - uint8_t PixelSharedHits = 0; - if( !(track.summaryValue( PixelSharedHits, xAOD::numberOfPixelSharedHits))) return false; - uint8_t SCTSharedHits = 0; - if( !(track.summaryValue( SCTSharedHits, xAOD::numberOfSCTSharedHits))) return false; - - if( ( IBLSharedHits + PixelSharedHits + SCTSharedHits ) > m_CutSharedHits) return false; - - - return true; - -} - -//=============================================================================== - -int JetVertexCharge::Vars::category() const { - - if( m_v[JC] > -2 && m_v[SVC] > -2 && m_v[TVC] <-2 && fabs(m_v[MU_CHARGE]) <0.5 ) return JetVertexCharge::JC_SVC_noMu; - else if( m_v[JC] > -2 && m_v[SVC] > -2 && m_v[TVC] < -2 && fabs(m_v[MU_CHARGE]) >0.5 ) return JetVertexCharge::JC_SVC_incMu; - else if( m_v[JC] > -2 && m_v[SVC] > -2 && m_v[TVC] > -2 && fabs(m_v[MU_CHARGE]) < 0.5 ) return JetVertexCharge::JC_SVC_TVC_noMu; - else if( m_v[JC] > -2 && m_v[SVC] > -2 && m_v[TVC] > -2 && fabs(m_v[MU_CHARGE]) > 0.5 ) return JetVertexCharge::JC_SVC_TVC_incMu; - else if( m_v[JC] > -2 && m_v[SVC] < -2 && fabs(m_v[MU_CHARGE]) > 0.5 ) return JetVertexCharge::JC_incMu; - else if( m_v[JC] > -2 && m_v[SVC] < -2 && fabs(m_v[MU_CHARGE]) < 0.5 ) return JetVertexCharge::JC_noMu; - else if( m_v[JC] < -2 && m_v[SVC] > -2 ) return JetVertexCharge::SVC; - else if( m_v[JC] < -2 && m_v[JC_ALL] > -2 ) return JetVertexCharge::JC_all; - else return -1; - -} - -////////////////////////////////////////////////////// -float JetVertexCharge::logLikelihoodRatio( int mvaCat, float mvaWeight, std::string author) const { - - - TH1* histo_pos = nullptr; - TH1* histo_neg = nullptr; - - //Retrieval of Calibration Condition Data objects - SG::ReadCondHandle<JetTagCalibCondData> readCdo(m_readKey); - - if( mvaCat == JC_noMu) { - histo_pos = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_noMu_bbar"); - histo_neg = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_noMu_b"); - } - else if( mvaCat == JC_SVC_noMu) { - histo_pos = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_SVC_noMu_bbar"); - histo_neg = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_SVC_noMu_b"); - } - else if( mvaCat == JC_SVC_incMu) { - histo_pos = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_SVC_incMu_bbar"); - histo_neg = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_SVC_incMu_b"); - } - else if( mvaCat == JC_SVC_TVC_noMu) { - histo_pos = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_SVC_TVC_noMu_bbar"); - histo_neg = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_SVC_TVC_noMu_b"); - } - else if( mvaCat == JC_incMu) { - histo_pos = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_incMu_bbar"); - histo_neg = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_incMu_b"); - } - else if( mvaCat == JC_SVC_TVC_incMu) { - histo_pos = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_SVC_TVC_incMu_bbar"); - histo_neg = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_SVC_TVC_incMu_b"); - } - else if( mvaCat == SVC) { - histo_pos = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_SVC_bbar"); - histo_neg = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_SVC_b"); - } - else if( mvaCat == JC_all) { - histo_pos = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_all_bbar"); - histo_neg = readCdo->retrieveHistogram(m_taggerNameBase, author, "jvc_JC_all_b"); - } - else if(mvaCat == -1) { - return -7; - } - - if( histo_pos == nullptr ) { - ATH_MSG_WARNING("#BTAG# BBAR HISTO can't be retrieved -> no calibration for "<< m_taggerNameBase ); - return -3.; - } - if( histo_neg== nullptr) { - ATH_MSG_WARNING("#BTAG# B HISTO can't be retrieved -> no calibration for "<< m_taggerNameBase ); - return -3; - } - - int bin_pos = histo_pos->FindBin( mvaWeight ); - float histo_bbar = std::max(histo_pos->GetBinContent( bin_pos ), minProb); - - int bin_neg = histo_neg->FindBin( mvaWeight ); - float histo_b = std::max(histo_neg->GetBinContent( bin_neg ), minProb); - - ATH_MSG_DEBUG("#BTAG# probabilities for category " << categoryToString(mvaCat) << " and weight " << mvaWeight << ": " - << histo_bbar << "(bbar), " << histo_b << "(b)"); - return log( histo_bbar/histo_b); -} - - -std::unique_ptr<TMVA::MethodBase> -JetVertexCharge::SetupReaders( Vars& vars, - TMVA::Reader& reader, - const std::string& /*author*/, - const std::string& /*alias*/, - int mvaCat, TList* list) const -{ - ATH_MSG_DEBUG("#BTAG# setting up reader for category "<<mvaCat); - - if (! list) { - ATH_MSG_WARNING("#BTAG# Tlist can't be retrieved -> no calibration for "<< m_taggerNameBase ); - return std::unique_ptr<TMVA::MethodBase>(); - } - - - std::vector<std::string> inputVars; - std::ostringstream iss; - for(int i=0; i<list->GetSize(); ++i) { - TObjString* ss = (TObjString*)list->At(i); - std::string sss = ss->String().Data(); - //KM: if it doesn't find "<" in the string, it starts from non-space character - std::string::size_type posi = sss.find('<')!=std::string::npos ? sss.find('<') : sss.find_first_not_of(" "); - std::string tmp = sss.erase(0,posi); - iss << tmp; - if (tmp.find("<Variable")!=std::string::npos ) { - if ( tmp.find("Variable VarIndex")!=std::string::npos ) { - // Retrieve the original expression for use with a new TMVA::Reader object - std::string varIndex =tmp.substr(tmp.find("=\"")+2, tmp.find("\" ")-(tmp.find("=\"")+2)); - std::string tmpVar = tmp.erase(0,tmp.find("Expression=\"")+12); - std::string varExpress=tmp.substr(0, tmp.find("\"")); - posi = varExpress.find("<"); - while (posi != std::string::npos) { - varExpress.replace(posi, 4, "<"); - posi = varExpress.find("<"); - } - posi = varExpress.find(">"); - while (posi != std::string::npos) { - varExpress.replace(posi, 4, ">"); - posi = varExpress.find(">"); - } - posi = varExpress.find("&"); - while (posi != std::string::npos) { - varExpress.replace(posi, 5, "&"); - posi = varExpress.find("&"); - } - inputVars.push_back(varExpress); - } - } - } - - for (auto expression : inputVars) { - std::string var = expression.find_last_of(":") == std::string::npos ? expression : expression.substr(expression.find_last_of(":")+1); - ATH_MSG_DEBUG("#BTAG# adding variable " << var << " in category " - << categoryToString(mvaCat) - << " for tagger instance " << m_taggerNameBase); - reader.AddVariable(expression.c_str(), &vars[var]); - } - - TMVA::IMethod* method= reader.BookMVA(TMVA::Types::kMLP, iss.str().data()); - return std::unique_ptr<TMVA::MethodBase> - (dynamic_cast<TMVA::MethodBase*>(method)); -} //closes SetupReaders - - -void JetVertexCharge::Vars::print (MsgStream& msg) const -{ - if (msg.level() > MSG::DEBUG) return; - msg << MSG::DEBUG << "#BTAG# ===============================================================================" << endmsg; - msg << MSG::DEBUG << "#BTAG# Printing input variables: " << endmsg; - msg << MSG::DEBUG << "#BTAG# JC="<<m_v[JC]<<" SVC="<<m_v[SVC]<<" TVC="<<m_v[TVC]<<" mu charge="<<m_v[MU_CHARGE]<<" JC all="<<m_v[JC_ALL] << endmsg; - msg << MSG::DEBUG << "#BTAG# JC_jetPt="<<m_v[JC_JETPT]<<" SVC_jetPt="<<m_v[SVC_JETPT]<<" TVC_jetPt="<<m_v[TVC_JETPT]<<" mu charge="<<m_v[MU_CHARGE]<<" JC_all_jetPt="<<m_v[JC_ALL_JETPT] << endmsg; - msg << MSG::DEBUG << "#BTAG# ngood trk="<<m_v[NGOODTRK]<<" JC pt="<<m_v[TRACK_GOOD_PT]<<" SV pt= "<<m_v[TRACK_SV_PT] << endmsg; - msg << MSG::DEBUG << "#BTAG# ntrkSV="<<m_v[NTRK0]<<" distSV="<<m_v[DISTSV] <<" errSV="<<m_v[ERRSV]<<" mass SV="<<m_v[MASSSV_PIONS] << endmsg; - msg << MSG::DEBUG << "#BTAG# ntrkTV="<<m_v[NTRK1_USED]<<" distTV="<<m_v[DISTTV]<<" errTV="<<m_v[ERRTV]<<" mass TV="<<m_v[MASSTV_KAONS] << endmsg; - msg << MSG::DEBUG << "#BTAG# mu ptRel="<<m_v[MU_PTREL]<<" mu_ptLong="<<m_v[MU_PTLONG]<<" mu dR="<< m_v[MU_JET_DR]<<" mu_isolation="<<m_v[MU_ISO_PTVAR40]<<" mu_vtx="<<m_v[MU_VTX] << endmsg; - msg << MSG::DEBUG << "#BTAG# ===============================================================================" << endmsg; - -} - -std::string JetVertexCharge::categoryToString(int cat) const { - auto it = m_catNames.find(cat); - if (it != m_catNames.end()) return it->second; - - // this is for the non-MVA categories - switch (cat) { - case JC_noMu: - return "JC_noMu"; - case SVC: - return "SVC"; - case JC_all: - return "JC_all"; - default: - return "unknown"; - }; -} - -const std::unordered_map<std::string, JetVertexCharge::Vars::Var> -JetVertexCharge::Vars::s_namemap = - { - { "mu_ptRel", MU_PTREL }, - { "mu_ptLong", MU_PTLONG }, - { "mu_charge", MU_CHARGE }, - { "mu_jet_dR", MU_JET_DR }, - { "mu_iso_ptvar40", MU_ISO_PTVAR40 }, - { "TVC", TVC }, - { "distTV", DISTTV }, - { "errTV", ERRTV }, - { "massTV_kaons", MASSTV_KAONS }, - { "ntrk1_used", NTRK1_USED }, - { "SVC", SVC }, - { "distSV", DISTSV }, - { "errSV", ERRSV }, - { "massSV_pions", MASSSV_PIONS }, - { "ntrk0", NTRK0 }, - { "track_sv_pt", TRACK_SV_PT }, - { "JC", JC }, - { "track_good_pt", TRACK_GOOD_PT }, - { "ngoodtrk", NGOODTRK }, - { "jet_uncalibrated_pt", JET_UNCALIBRATED_PT }, - { "JC_jetPt", JC_JETPT }, - { "JC_all_jetPt", JC_ALL_JETPT }, - { "SVC_jetPt", SVC_JETPT }, - { "TVC_jetPt", TVC_JETPT }, - }; - -JetVertexCharge::Vars::Vars() -{ - m_v[MU_PTREL] = -999.; - m_v[MU_PTLONG] = -999.; - m_v[MU_CHARGE] = 0.; - m_v[MU_JET_DR] = -1.; - m_v[MU_ISO_PTVAR40] = -1.; - - m_v[TVC] = -3; - m_v[DISTTV] = -999.; - m_v[ERRTV] = -999.; - m_v[MASSTV_KAONS] = -999.; - m_v[NTRK1_USED] = -1.; - - m_v[SVC] = -3; - m_v[DISTSV] = -999.; - m_v[ERRSV] = -999.; - m_v[MASSSV_PIONS] = -999.; - m_v[NTRK0] = -1.; - m_v[TRACK_SV_PT] = -999.; - - m_v[JC] = -3; - m_v[TRACK_GOOD_PT] = -999.; - m_v[NGOODTRK] = 0; - m_v[JET_UNCALIBRATED_PT] = -999.; - m_v[JC_JETPT] = -999.; - m_v[JC_ALL_JETPT] = -999.; - m_v[SVC_JETPT] = -9.; - m_v[TVC_JETPT] = -9.; - - m_v[JC_ALL] = -3; - m_v[MU_VTX] = -1; -} - - -float& JetVertexCharge::Vars::operator[] (const std::string& name) -{ - auto it = s_namemap.find (name); - if (it == s_namemap.end()) { - throw std::out_of_range (name); - } - return m_v[it->second]; -} - -} //End of namespace diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/MSVVariablesFactory.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/MSVVariablesFactory.cxx index 1280ef51383bc14b1fc230b6aadabe9608c81dde..74c4e36d1d59691da402fad095003405c94d9773 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/MSVVariablesFactory.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/MSVVariablesFactory.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -12,18 +12,12 @@ /// the variables per vertex to MSV. /// /////////////////////////////////////////////////////////////////////////////////////////////////////// -//#include "VxJetVertex/VxVertexOnJetAxis.h" #include "VxVertex/VxTrackAtVertex.h" -//#include "VxJetVertex/VxJetCandidate.h" -//#include "VxJetVertex/SelectedTracksInJet.h" #include "TrkParameters/TrackParameters.h" -//#include "TrkNeutralParameters/MeasuredNeutralPerigee.h" #include "VxSecVertex/VxSecVertexInfo.h" #include "VxSecVertex/VxSecVKalVertexInfo.h" -//#include "TrkTrackLink/ITrackLink.h" - #include <TMath.h> #include "CLHEP/Vector/LorentzVector.h" @@ -33,137 +27,130 @@ #include "GeoPrimitives/GeoPrimitivesHelpers.h" -#include <vector> -// #include "xAODTracking/Vertex.h" #include "xAODTracking/TrackParticle.h" #include "xAODBTagging/SecVtxHelper.h" + +#include <vector> #include <string> namespace Analysis { MSVVariablesFactory::MSVVariablesFactory(const std::string& name, - const std::string& n, const IInterface* p): + const std::string& n, + const IInterface* p): AthAlgTool(name, n,p) -// m_secVxFinderName("InDetVKalVxInJetTool"), - { -// declareProperty("secVxFinderName",m_secVxFinderName); declareInterface<IMSVVariablesFactory>(this); } -///////////////////////////////////////////////////////////////////////////////////// -/// Destructor - check up memory allocation -/// delete any memory allocation on the heap - - MSVVariablesFactory::~MSVVariablesFactory() {} - -StatusCode MSVVariablesFactory::initialize() { - ATH_MSG_DEBUG(" Initialization of MSVVariablesFactory succesfull"); - return StatusCode::SUCCESS; -} + StatusCode MSVVariablesFactory::initialize() { + ATH_MSG_DEBUG(" Initialization of MSVVariablesFactory succesfull"); + return StatusCode::SUCCESS; + } -StatusCode MSVVariablesFactory::finalize() { - ATH_MSG_DEBUG(" Finalization of MSVVariablesFactory succesfull"); - return StatusCode::SUCCESS; -} + StatusCode MSVVariablesFactory::finalize() { + ATH_MSG_DEBUG(" Finalization of MSVVariablesFactory succesfull"); + return StatusCode::SUCCESS; + } - StatusCode MSVVariablesFactory::createMSVContainer(const xAOD::Jet &myJet, const Trk::VxSecVKalVertexInfo* myVertexInfoVKal, xAOD::VertexContainer* VertexContainer,const xAOD::Vertex& PrimaryVtx) const { + StatusCode MSVVariablesFactory::createMSVContainer + (const xAOD::Jet &myJet, const Trk::VxSecVKalVertexInfo* myVertexInfoVKal, + xAOD::VertexContainer* VertexContainer,const xAOD::Vertex& PrimaryVtx) const { + Amg::Vector3D jet_V3(myJet.p4().Px(), myJet.p4().Py(), myJet.p4().Pz()); float jetenergy=0.; const xAOD::Vertex* priVtx = &PrimaryVtx; std::vector< ElementLink< xAOD::VertexContainer > > MSVVertexLinks; const std::vector<xAOD::Vertex*> myVertices = myVertexInfoVKal->vertices(); - if(myVertices.size() == 0){ + if(myVertices.empty()){ ATH_MSG_DEBUG("#BTAG# no MSV vertices...fill default values only... "); - xAOD::Vertex* Vertex = new xAOD::Vertex(); - VertexContainer->push_back(Vertex); - xAOD::SecVtxHelper::setVertexMass(Vertex, -9.); - xAOD::SecVtxHelper::setEnergyFraction(Vertex, -9.); - xAOD::SecVtxHelper::setVtxNtrk(Vertex, -9); - xAOD::SecVtxHelper::setVtxpt(Vertex, -9.); - xAOD::SecVtxHelper::setVtxeta(Vertex, -9.); - xAOD::SecVtxHelper::setVtxphi(Vertex, -9.); - xAOD::SecVtxHelper::setVtxnormDist(Vertex, -9.); + xAOD::Vertex* vertex = new xAOD::Vertex(); + VertexContainer->push_back(vertex); + xAOD::SecVtxHelper::setVertexMass(vertex, -9.); + xAOD::SecVtxHelper::setEnergyFraction(vertex, -9.); + xAOD::SecVtxHelper::setVtxNtrk(vertex, -9); + xAOD::SecVtxHelper::setVtxpt(vertex, -9.); + xAOD::SecVtxHelper::setVtxeta(vertex, -9.); + xAOD::SecVtxHelper::setVtxphi(vertex, -9.); + xAOD::SecVtxHelper::setVtxnormDist(vertex, -9.); return StatusCode::SUCCESS; - } - std::vector<xAOD::Vertex*>::const_iterator verticesBegin = myVertexInfoVKal->vertices().begin(); - std::vector<xAOD::Vertex*>::const_iterator verticesEnd = myVertexInfoVKal->vertices().end(); jetenergy = myVertexInfoVKal->energyTrkInJet(); - for (std::vector<xAOD::Vertex*>::const_iterator verticesIter=verticesBegin; verticesIter!=verticesEnd;++verticesIter) { - - xAOD::Vertex* Vertex = *verticesIter; - VertexContainer->push_back(Vertex); + for (const auto& vertex : myVertexInfoVKal->vertices()){ + VertexContainer->push_back(vertex); //additional info per vertex double sumpx = 0.0; double sumpy = 0.0; double sumpz = 0.0; double sume = 0.0; - const std::vector<ElementLink<xAOD::TrackParticleContainer> > myTrackLinks = (*verticesIter)->trackParticleLinks(); - if (myTrackLinks.size()==0) { + const std::vector<ElementLink<xAOD::TrackParticleContainer> > myTrackLinks = vertex->trackParticleLinks(); + if (myTrackLinks.empty()) { ATH_MSG_WARNING("#BTAG# No Track Links attached to the track at the sec vertex... "); } int npsec = 0; - const std::vector<Trk::VxTrackAtVertex> myTracks=(*verticesIter)->vxTrackAtVertex(); - if (myTracks.size()!=0) { + const std::vector<Trk::VxTrackAtVertex> myTracks=vertex->vxTrackAtVertex(); + if (!myTracks.empty()) { npsec=myTracks.size(); - const std::vector<Trk::VxTrackAtVertex>::const_iterator tracksBegin=myTracks.begin(); - const std::vector<Trk::VxTrackAtVertex>::const_iterator tracksEnd=myTracks.end(); - for (std::vector<Trk::VxTrackAtVertex>::const_iterator tracksIter=tracksBegin; tracksIter!=tracksEnd;++tracksIter) { - const Trk::Perigee* perigee = dynamic_cast<const Trk::Perigee*>((*tracksIter).perigeeAtVertex()); + for (const auto& track : myTracks) { + const Trk::Perigee* perigee = dynamic_cast<const Trk::Perigee*>(track.perigeeAtVertex()); if(perigee){ sumpx += perigee->momentum().x(); sumpy += perigee->momentum().y(); sumpz += perigee->momentum().z(); - sume +=sqrt(perigee->momentum().mag()*perigee->momentum().mag() + 139.5702*139.5702 ); + sume += std::hypot(perigee->momentum().mag(), 139.5702); }else{ - ATH_MSG_WARNING("#BTAG# perigee for VxTrackAtVertex not found"); + ATH_MSG_WARNING("#BTAG# perigee for VxTrackAtVertex not found"); } } } + CLHEP::HepLorentzVector vtxp4(sumpx,sumpy,sumpz,sume); - float efrac = (jetenergy>0)?vtxp4.e()/jetenergy:0; - xAOD::SecVtxHelper::setVertexMass(Vertex, vtxp4.m()); - xAOD::SecVtxHelper::setEnergyFraction(Vertex, efrac); - xAOD::SecVtxHelper::setVtxNtrk(Vertex, npsec); - xAOD::SecVtxHelper::setVtxpt(Vertex, vtxp4.perp()); - xAOD::SecVtxHelper::setVtxeta(Vertex, vtxp4.eta()); - xAOD::SecVtxHelper::setVtxphi(Vertex, vtxp4.phi()); + float efrac = (jetenergy>0) ? vtxp4.e()/jetenergy : 0; + xAOD::SecVtxHelper::setVertexMass(vertex, vtxp4.m()); + xAOD::SecVtxHelper::setEnergyFraction(vertex, efrac); + xAOD::SecVtxHelper::setVtxNtrk(vertex, npsec); + xAOD::SecVtxHelper::setVtxpt(vertex, vtxp4.perp()); + xAOD::SecVtxHelper::setVtxeta(vertex, vtxp4.eta()); + xAOD::SecVtxHelper::setVtxphi(vertex, vtxp4.phi()); ATH_MSG_DEBUG("#BTAG# mass per vertex = "<<vtxp4.m()); - double localdistnrm=0; + double localdistnrm = 0; std::vector<const xAOD::Vertex*> vecVtxHolder; - vecVtxHolder.push_back(*verticesIter); + vecVtxHolder.push_back(vertex); - ATH_MSG_DEBUG("Factory PVX x = " << priVtx->x() << " y = " << priVtx->y() << " z = " << priVtx->z()); + ATH_MSG_DEBUG("Factory PVX x = " << priVtx->x() << " y = " << priVtx->y() << " z = " << priVtx->z()); if (priVtx) { - localdistnrm=get3DSignificance(priVtx, vecVtxHolder, Amg::Vector3D(myJet.p4().Px(),myJet.p4().Py(),myJet.p4().Pz())); + localdistnrm = get3DSignificance(priVtx, vecVtxHolder, jet_V3); } else { ATH_MSG_WARNING("#BTAG# Tagging requested, but no primary vertex supplied."); - localdistnrm=0.; } - xAOD::SecVtxHelper::setVtxnormDist(Vertex, localdistnrm); + xAOD::SecVtxHelper::setVtxnormDist(vertex, localdistnrm); //track links, - Vertex->setTrackParticleLinks(myTrackLinks); + vertex->setTrackParticleLinks(myTrackLinks); } //end loop vertexcontainer return StatusCode::SUCCESS; } - StatusCode MSVVariablesFactory::fillMSVVariables(const xAOD::Jet &myJet, xAOD::BTagging* BTag, const Trk::VxSecVKalVertexInfo* myVertexInfoVKal, xAOD::VertexContainer* VertexContainer,const xAOD::Vertex& PrimaryVtx, std::string basename) const { - //... + StatusCode MSVVariablesFactory::fillMSVVariables + (const xAOD::Jet &myJet, xAOD::BTagging* BTag, + const Trk::VxSecVKalVertexInfo* myVertexInfoVKal, + xAOD::VertexContainer* VertexContainer, const xAOD::Vertex& PrimaryVtx, + std::string basename) const { + + Amg::Vector3D jet_V3(myJet.p4().Px(), myJet.p4().Py(), myJet.p4().Pz()); int nvsec = 0; - float jetenergy=0.; + float jetenergy = 0.; int n2t = 0; - float distnrm=0.; + float distnrm = 0.; const xAOD::Vertex* priVtx = &PrimaryVtx; std::vector< ElementLink< xAOD::VertexContainer > > MSVVertexLinks; const std::vector<xAOD::Vertex*> myVertices = myVertexInfoVKal->vertices(); - if(myVertices.size() == 0){ + if(myVertices.empty()){ ATH_MSG_DEBUG("#BTAG# no MSV vertices...fill default values only... "); BTag->setVariable<int>(basename, "N2Tpair", n2t); BTag->setVariable<float>(basename, "energyTrkInJet", jetenergy); @@ -171,20 +158,17 @@ StatusCode MSVVariablesFactory::finalize() { BTag->setVariable<float>(basename, "normdist", distnrm); BTag->setVariable<std::vector<ElementLink<xAOD::VertexContainer> > >(basename, "vertices", MSVVertexLinks); BTag->setDynVxELName(basename, "vertices"); - xAOD::Vertex* Vertex = new xAOD::Vertex(); - VertexContainer->push_back(Vertex); - xAOD::SecVtxHelper::setVertexMass(Vertex, -9.); - xAOD::SecVtxHelper::setEnergyFraction(Vertex, -9.); - xAOD::SecVtxHelper::setVtxNtrk(Vertex, -9); - xAOD::SecVtxHelper::setVtxpt(Vertex, -9.); - xAOD::SecVtxHelper::setVtxeta(Vertex, -9.); - xAOD::SecVtxHelper::setVtxphi(Vertex, -9.); - xAOD::SecVtxHelper::setVtxnormDist(Vertex, -9.); + xAOD::Vertex* vertex = new xAOD::Vertex(); + VertexContainer->push_back(vertex); + xAOD::SecVtxHelper::setVertexMass(vertex, -9.); + xAOD::SecVtxHelper::setEnergyFraction(vertex, -9.); + xAOD::SecVtxHelper::setVtxNtrk(vertex, -9); + xAOD::SecVtxHelper::setVtxpt(vertex, -9.); + xAOD::SecVtxHelper::setVtxeta(vertex, -9.); + xAOD::SecVtxHelper::setVtxphi(vertex, -9.); + xAOD::SecVtxHelper::setVtxnormDist(vertex, -9.); return StatusCode::SUCCESS; - } - std::vector<xAOD::Vertex*>::const_iterator verticesBegin = myVertexInfoVKal->vertices().begin(); - std::vector<xAOD::Vertex*>::const_iterator verticesEnd = myVertexInfoVKal->vertices().end(); jetenergy = myVertexInfoVKal->energyTrkInJet(); n2t = myVertexInfoVKal->n2trackvertices(); @@ -192,65 +176,61 @@ StatusCode MSVVariablesFactory::finalize() { BTag->setVariable<float>(basename, "energyTrkInJet", jetenergy); std::vector<const xAOD::Vertex*> vecVertices; - for (std::vector<xAOD::Vertex*>::const_iterator verticesIter=verticesBegin; verticesIter!=verticesEnd;++verticesIter) { - - xAOD::Vertex* Vertex = *verticesIter; - VertexContainer->push_back(Vertex); + for (const auto& vertex : myVertexInfoVKal->vertices()) { + VertexContainer->push_back(vertex); //additional info per vertex - vecVertices.push_back(*verticesIter); + vecVertices.push_back(vertex); double sumpx = 0.0; double sumpy = 0.0; double sumpz = 0.0; double sume = 0.0; - const std::vector<ElementLink<xAOD::TrackParticleContainer> > myTrackLinks = (*verticesIter)->trackParticleLinks(); - if (myTrackLinks.size()==0) { + const std::vector<ElementLink<xAOD::TrackParticleContainer> > myTrackLinks = vertex->trackParticleLinks(); + if (myTrackLinks.empty()) { ATH_MSG_WARNING("#BTAG# No Track Links attached to the track at the sec vertex... "); } int npsec = 0; - const std::vector<Trk::VxTrackAtVertex> myTracks=(*verticesIter)->vxTrackAtVertex(); - if (myTracks.size()!=0) { + const std::vector<Trk::VxTrackAtVertex> myTracks=vertex->vxTrackAtVertex(); + if (!myTracks.empty()) { npsec=myTracks.size(); - const std::vector<Trk::VxTrackAtVertex>::const_iterator tracksBegin=myTracks.begin(); - const std::vector<Trk::VxTrackAtVertex>::const_iterator tracksEnd=myTracks.end(); - for (std::vector<Trk::VxTrackAtVertex>::const_iterator tracksIter=tracksBegin; tracksIter!=tracksEnd;++tracksIter) { - const Trk::Perigee* perigee = dynamic_cast<const Trk::Perigee*>((*tracksIter).perigeeAtVertex()); + for (const auto& track : myTracks) { + const Trk::Perigee* perigee = dynamic_cast<const Trk::Perigee*>(track.perigeeAtVertex()); if(perigee){ sumpx += perigee->momentum().x(); sumpy += perigee->momentum().y(); sumpz += perigee->momentum().z(); - sume +=sqrt(perigee->momentum().mag()*perigee->momentum().mag() + 139.5702*139.5702 ); + sume += std::hypot(perigee->momentum().mag(), 139.5702); }else{ - ATH_MSG_WARNING("#BTAG# perigee for VxTrackAtVertex not found"); + ATH_MSG_WARNING("#BTAG# perigee for VxTrackAtVertex not found"); } } } + CLHEP::HepLorentzVector vtxp4(sumpx,sumpy,sumpz,sume); - float efrac = (jetenergy>0)?vtxp4.e()/jetenergy:0; - xAOD::SecVtxHelper::setVertexMass(Vertex, vtxp4.m()); - xAOD::SecVtxHelper::setEnergyFraction(Vertex, efrac); - xAOD::SecVtxHelper::setVtxNtrk(Vertex, npsec); - xAOD::SecVtxHelper::setVtxpt(Vertex, vtxp4.perp()); - xAOD::SecVtxHelper::setVtxeta(Vertex, vtxp4.eta()); - xAOD::SecVtxHelper::setVtxphi(Vertex, vtxp4.phi()); + float efrac = (jetenergy>0) ? vtxp4.e()/jetenergy : 0; + xAOD::SecVtxHelper::setVertexMass(vertex, vtxp4.m()); + xAOD::SecVtxHelper::setEnergyFraction(vertex, efrac); + xAOD::SecVtxHelper::setVtxNtrk(vertex, npsec); + xAOD::SecVtxHelper::setVtxpt(vertex, vtxp4.perp()); + xAOD::SecVtxHelper::setVtxeta(vertex, vtxp4.eta()); + xAOD::SecVtxHelper::setVtxphi(vertex, vtxp4.phi()); ATH_MSG_DEBUG("#BTAG# mass per vertex = "<<vtxp4.m()); - double localdistnrm=0; + double localdistnrm = 0; std::vector<const xAOD::Vertex*> vecVtxHolder; - vecVtxHolder.push_back(*verticesIter); + vecVtxHolder.push_back(vertex); - ATH_MSG_DEBUG("Factory PVX x = " << priVtx->x() << " y = " << priVtx->y() << " z = " << priVtx->z()); + ATH_MSG_DEBUG("Factory PVX x = " << priVtx->x() << " y = " << priVtx->y() << " z = " << priVtx->z()); if (priVtx) { - localdistnrm=get3DSignificance(priVtx, vecVtxHolder, Amg::Vector3D(myJet.p4().Px(),myJet.p4().Py(),myJet.p4().Pz())); + localdistnrm = get3DSignificance(priVtx, vecVtxHolder, jet_V3); } else { ATH_MSG_WARNING("#BTAG# Tagging requested, but no primary vertex supplied."); - localdistnrm=0.; } - xAOD::SecVtxHelper::setVtxnormDist(Vertex, localdistnrm); + xAOD::SecVtxHelper::setVtxnormDist(vertex, localdistnrm); //track links, - Vertex->setTrackParticleLinks(myTrackLinks); + vertex->setTrackParticleLinks(myTrackLinks); ElementLink< xAOD::VertexContainer> linkBTagVertex; - linkBTagVertex.toContainedElement(*VertexContainer, Vertex); + linkBTagVertex.toContainedElement(*VertexContainer, vertex); MSVVertexLinks.push_back(linkBTagVertex); } //end loop vertexcontainer @@ -258,7 +238,7 @@ StatusCode MSVVariablesFactory::finalize() { BTag->setDynVxELName(basename, "vertices"); if (priVtx) { - distnrm=get3DSignificance(priVtx, vecVertices, Amg::Vector3D(myJet.p4().Px(),myJet.p4().Py(),myJet.p4().Pz())); + distnrm = get3DSignificance(priVtx, vecVertices, jet_V3); } else { ATH_MSG_WARNING("#BTAG# Tagging requested, but no primary vertex supplied."); distnrm=0.; @@ -267,42 +247,38 @@ StatusCode MSVVariablesFactory::finalize() { BTag->setVariable<int>(basename, "nvsec", nvsec); BTag->setVariable<float>(basename, "normdist", distnrm); - //... return StatusCode::SUCCESS; - } - double MSVVariablesFactory::get3DSignificance(const xAOD::Vertex* priVertex, - std::vector<const xAOD::Vertex*>& secVertex, - const Amg::Vector3D jetDirection) const { + double MSVVariablesFactory::get3DSignificance + (const xAOD::Vertex* priVertex, + std::vector<const xAOD::Vertex*>& secVertex, + const Amg::Vector3D jetDirection) const { + if(!secVertex.size()) return 0; std::vector<Amg::Vector3D> positions; std::vector<AmgSymMatrix(3)> weightMatrices; - std::vector<const xAOD::Vertex*>::const_iterator secEnd = secVertex.end(); - for (std::vector<const xAOD::Vertex*>::const_iterator secIter = secVertex.begin(); secIter != secEnd; ++secIter){ - positions.push_back((*secIter)->position()); - weightMatrices.push_back((*secIter)->covariancePosition().inverse()); - } Amg::Vector3D weightTimesPosition(0.,0.,0.); AmgSymMatrix(3) sumWeights; sumWeights.setZero(); - int count=0; - for (std::vector<const xAOD::Vertex*>::const_iterator secIter = secVertex.begin(); secIter != secEnd; ++secIter) { - weightTimesPosition+=(weightMatrices[count])*positions[count]; - sumWeights+=(weightMatrices[count]); - ++count; + for (const auto& vertex : secVertex) { + positions.push_back(vertex->position()); + weightMatrices.push_back(vertex->covariancePosition().inverse()); + weightTimesPosition += weightMatrices.back() * positions.back(); + sumWeights += weightMatrices.back(); } + bool invertible; AmgSymMatrix(3) meanCovariance; meanCovariance.setZero(); sumWeights.computeInverseWithCheck(meanCovariance, invertible); - if (! invertible) { + if (!invertible) { ATH_MSG_WARNING("#BTAG# Could not invert sum of sec vtx matrices"); return 0.; } - Amg::Vector3D meanPosition=meanCovariance*weightTimesPosition; + Amg::Vector3D meanPosition = meanCovariance * weightTimesPosition; AmgSymMatrix(3) covariance = meanCovariance + priVertex->covariancePosition(); double Lx = meanPosition[0]-priVertex->position().x(); @@ -315,11 +291,11 @@ StatusCode MSVVariablesFactory::finalize() { double dLdLy = Ly * inv_decaylength; double dLdLz = Lz * inv_decaylength; double decaylength_err = sqrt(dLdLx*dLdLx*covariance(0,0) + - dLdLy*dLdLy*covariance(1,1) + - dLdLz*dLdLz*covariance(2,2) + - 2.*dLdLx*dLdLy*covariance(0,1) + - 2.*dLdLx*dLdLz*covariance(0,2) + - 2.*dLdLy*dLdLz*covariance(1,2)); + dLdLy*dLdLy*covariance(1,1) + + dLdLz*dLdLz*covariance(2,2) + + 2.*dLdLx*dLdLy*covariance(0,1) + + 2.*dLdLx*dLdLz*covariance(0,2) + + 2.*dLdLy*dLdLz*covariance(1,2)); double decaylength_significance = 0.; if (decaylength_err != 0.) decaylength_significance = decaylength/decaylength_err; @@ -328,7 +304,6 @@ StatusCode MSVVariablesFactory::finalize() { return decaylength_significance; - } }//end Analysis namespace diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/MV2Tag.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/MV2Tag.cxx index 9f5f50ebd32723a504c680d5897a13dbd1b6a4f8..c535eec838557b4a3dafc4e09cb631ee9f63b078 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/MV2Tag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/MV2Tag.cxx @@ -1,14 +1,10 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#include "GaudiKernel/IToolSvc.h" -#include "xAODTracking/TrackParticle.h" - #include "JetTagTools/MV2Tag.h" #include "xAODBTagging/BTagging.h" -#include "xAODJet/Jet.h" #include <fstream> #include <sstream> @@ -16,19 +12,13 @@ #include <iostream> #include <limits> #include <cmath> - -#include "xAODTracking/Vertex.h" -#include "xAODTracking/VertexContainer.h" - -#include "AthenaKernel/Units.h" -#include <fstream> -#include <algorithm> #include <utility> #include <vector> #include <map> #include <list> #include <math.h> /* hypot */ +#include "AthenaKernel/Units.h" using Athena::Units::GeV; @@ -47,18 +37,15 @@ namespace Analysis { // force MV2 to always use a calibration derived from MV2CalibAlias jet collection declareProperty("forceMV2CalibrationAlias", m_forceMV2CalibrationAlias = true); - declareProperty("MV2CalibAlias", m_MV2CalibAlias = "AntiKt4TopoEM"); + declareProperty("MV2CalibAlias", m_MV2CalibAlias = "AntiKt4EMTopo"); // global configuration: declareProperty("Runmodus", m_runModus); - //declareProperty("DecorateMvaInputs", m_decorateBTaggingObj=false); declareProperty("xAODBaseName", m_xAODBaseName);//"MV2c20" or etc. // which calibration folder to use declareProperty("taggerNameBase", m_taggerNameBase = "MV2"); - declareProperty("taggerName", m_taggerName = "MV2"); - declareProperty("decTagName", m_decTagName = "MV2_inputs"); declareProperty("defaultvals", m_defaultvals ); declareProperty("MVTMvariableNames", m_MVTM_name_translations ); @@ -67,17 +54,11 @@ namespace Analysis { } - MV2Tag::~MV2Tag() { - - } - - StatusCode MV2Tag::initialize() { m_disableAlgo=false; m_warnCounter=0; - m_treeName = "BDT"; m_varStrName = "variables"; // prepare readKey for calibration data: @@ -87,16 +68,10 @@ namespace Analysis { m_MVTM_name_backtrans[p.second] = p.first; } - //m_egammaBDTs.clear(); return StatusCode::SUCCESS; } - StatusCode MV2Tag::finalize() { - ATH_MSG_DEBUG("#BTAG# Finalizing MV2."); - return StatusCode::SUCCESS; - } - void MV2Tag::assignProbability(xAOD::BTagging *BTag, const std::map<std::string, double> &inputs, const std::string& assigned_jet_author) const diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/MultiSVTag.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/MultiSVTag.cxx index 4d41247ace14ed278b52fd8905c106ec56bb5ab9..92d549a87f4c8af8cf21488958d16ed3bacb5112 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/MultiSVTag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/MultiSVTag.cxx @@ -1,29 +1,18 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** MultiSVTag.cxx ***************************************************************************/ #include "JetTagTools/MultiSVTag.h" -#include "GaudiKernel/IToolSvc.h" -#include "Navigation/NavigationToken.h" -#include "GaudiKernel/ITHistSvc.h" -#include "JetTagTools/HistoHelperRoot.h" - -#include "VxSecVertex/VxSecVertexInfo.h" -#include "VxSecVertex/VxSecVKalVertexInfo.h" -#include "TrkLinks/LinkToXAODTrackParticle.h" + #include "xAODJet/Jet.h" -#include "xAODTracking/TrackParticle.h" +#include "xAODTracking/TrackParticleContainer.h" #include "xAODTracking/Vertex.h" #include "xAODTracking/VertexContainer.h" #include "xAODBTagging/SecVtxHelper.h" -#include "GeoPrimitives/GeoPrimitivesHelpers.h" -#include "CLHEP/Vector/LorentzVector.h" -#include "VxVertex/RecVertex.h" -#include "VxVertex/VxTrackAtVertex.h" #include <fstream> #include <algorithm> #include <utility> @@ -45,26 +34,14 @@ namespace Analysis m_runModus("analysis") { declareProperty("Runmodus", m_runModus= "analysis"); - declareProperty("jetCollectionList", m_jetCollectionList); declareProperty("useForcedCalibration", m_doForcedCalib = false); declareProperty("ForcedCalibrationName", m_ForcedCalibName = "AntiKt4TopoEM");//Cone4H1Tower declareProperty("SecVxFinderName",m_secVxFinderName); declareProperty("taggerNameBase",m_taggerNameBase = "MultiSVbb1"); - declareProperty("taggerName", m_taggerName = "MultiSVbb1"); - declareProperty("xAODBaseName",m_xAODBaseName); - declareProperty("inputSV0SourceName", m_sv0_infosource = "SV0"); declareProperty("inputSV1SourceName", m_sv1_infosource = "SV1"); } - MultiSVTag::~MultiSVTag() { - } - StatusCode MultiSVTag::initialize() { - // define tagger name: - - m_warnCounter=0; - - m_treeName = "BDT"; m_varStrName = "variables"; // prepare readKey for calibration data: @@ -72,10 +49,6 @@ namespace Analysis return StatusCode::SUCCESS; } - StatusCode MultiSVTag::finalize(){ - return StatusCode::SUCCESS; - } - StatusCode MultiSVTag::tagJet(const xAOD::Vertex& priVtx, const xAOD::Jet& jetToTag, xAOD::BTagging& BTag, @@ -150,24 +123,23 @@ namespace Analysis std::vector<float> v_vtxy = std::vector<float>(10,0); std::vector<float> v_vtxz = std::vector<float>(10,0); // loop in msv vertices - if(msvVertices.size()>0){ - const std::vector<ElementLink<xAOD::VertexContainer> >::const_iterator verticesEnd = msvVertices.end(); - for(std::vector<ElementLink<xAOD::VertexContainer> >::const_iterator vtxIter=msvVertices.begin(); vtxIter!=verticesEnd; ++vtxIter){ + if(!msvVertices.empty()){ + for(const auto& vtx : msvVertices){ if(msvVertices.size()>=10) continue; - float mass = xAOD::SecVtxHelper::VertexMass(**vtxIter); - float efrc = xAOD::SecVtxHelper::EnergyFraction(**vtxIter); - int ntrk = xAOD::SecVtxHelper::VtxNtrk(**vtxIter); - float pt = xAOD::SecVtxHelper::Vtxpt(**vtxIter); - float eta = xAOD::SecVtxHelper::Vtxeta(**vtxIter); - float phi = xAOD::SecVtxHelper::Vtxphi(**vtxIter); - float dls = xAOD::SecVtxHelper::VtxnormDist(**vtxIter); - float x = (**vtxIter)->x(); - float y = (**vtxIter)->y(); - float z = (**vtxIter)->z(); + float mass = xAOD::SecVtxHelper::VertexMass(*vtx); + float efrc = xAOD::SecVtxHelper::EnergyFraction(*vtx); + int ntrk = xAOD::SecVtxHelper::VtxNtrk(*vtx); + float pt = xAOD::SecVtxHelper::Vtxpt(*vtx); + float eta = xAOD::SecVtxHelper::Vtxeta(*vtx); + float phi = xAOD::SecVtxHelper::Vtxphi(*vtx); + float dls = xAOD::SecVtxHelper::VtxnormDist(*vtx); + float x = (*vtx)->x(); + float y = (*vtx)->y(); + float z = (*vtx)->z(); TLorentzVector svp4; svp4.SetPtEtaPhiM(pt,eta,phi,mass); //if(jp4.DeltaR(svp4)>0.4) continue; vars.m_summass += mass; - const std::vector<ElementLink<xAOD::TrackParticleContainer> > svTrackLinks = (**vtxIter)->trackParticleLinks(); + const std::vector<ElementLink<xAOD::TrackParticleContainer> > svTrackLinks = (*vtx)->trackParticleLinks(); if(svTrackLinks.size()>1){ nvtx2trk++; } @@ -196,10 +168,11 @@ namespace Analysis int SV1ntrk = 0; std::vector< ElementLink< xAOD::VertexContainer > > SV1Vertice; status &= BTag.variable<std::vector<ElementLink<xAOD::VertexContainer> > >(m_sv1_infosource, "vertices", SV1Vertice); - if (SV1Vertice.size()>0 && SV1Vertice[0].isValid()){ - status &= BTag.taggerInfo(SV1ntrk, xAOD::BTagInfo::SV1_NGTinSvx); - vars.m_diffntrkSV1 = all_trks - SV1ntrk; - }else{ vars.m_diffntrkSV1 = all_trks; + if (!SV1Vertice.empty() && SV1Vertice[0].isValid()){ + status &= BTag.taggerInfo(SV1ntrk, xAOD::BTagInfo::SV1_NGTinSvx); + vars.m_diffntrkSV1 = all_trks - SV1ntrk; + }else{ + vars.m_diffntrkSV1 = all_trks; } vars.m_diffntrkSV0 = vars.m_diffntrkSV1; @@ -261,8 +234,7 @@ namespace Analysis // distances: max mass vertex to PV, and mx2 to max vertex: if(ivm1>=0&&ivm2>=0) { - vars.m_mx12_2d12 = TMath::Sqrt( (v_vtxx[ivm2] - v_vtxx[ivm1]) * (v_vtxx[ivm2] - v_vtxx[ivm1]) - + (v_vtxy[ivm2] - v_vtxy[ivm1]) * (v_vtxy[ivm2] - v_vtxy[ivm1]) ); + vars.m_mx12_2d12 = std::hypot( v_vtxx[ivm2] - v_vtxx[ivm1], v_vtxy[ivm2] - v_vtxy[ivm1] ); vars.m_mx12_DR = sv1p3.DeltaR(sv2p3); vars.m_mx12_Angle = sv1p3.Angle(sv2p3); @@ -313,28 +285,28 @@ namespace Analysis bool &badVariableFound, std::vector<float*> &inputPointers) { - for (unsigned ivar=0; ivar<inputVars.size(); ivar++) { - if (inputVars.at(ivar)=="pt" ) { inputPointers.push_back(&m_jetpt ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="Nvtx" ) { inputPointers.push_back(&m_nvtx ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="MaxEfrc" ) { inputPointers.push_back(&m_maxefrc ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="sumMass" ) { inputPointers.push_back(&m_summass ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="totalntrk" ) { inputPointers.push_back(&m_totalntrk ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="diffntrkSV0" ) { inputPointers.push_back(&m_diffntrkSV0 ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="diffntrkSV1" ) { inputPointers.push_back(&m_diffntrkSV1 ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="normDist" ) { inputPointers.push_back(&m_normDist ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="maxVtxMass" ) { inputPointers.push_back(&m_mmax_mass ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="maxSecVtxMass" ) { inputPointers.push_back(&m_mmx2_mass ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="EfrcmaxVtxMass" ) { inputPointers.push_back(&m_mmax_efrc ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="EfrcmaxSecVtxMass") { inputPointers.push_back(&m_mmx2_efrc ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="dlsmaxVtxMass" ) { inputPointers.push_back(&m_mmax_dist ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="dlsmaxSecVtxMass" ) { inputPointers.push_back(&m_mmx2_dist ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="dRmaxVtxMassj" ) { inputPointers.push_back(&m_mmax_DRjet ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="dRmaxSecVtxMassj" ) { inputPointers.push_back(&m_mmx2_DRjet ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="d2Mass12" ) { inputPointers.push_back(&m_mx12_2d12 ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="DRMass12" ) { inputPointers.push_back(&m_mx12_DR ) ; nConfgVar++; } - else if (inputVars.at(ivar)=="AngleMass12" ) { inputPointers.push_back(&m_mx12_Angle ) ; nConfgVar++; } + for (const auto& var : inputVars) { + if (var=="pt" ) { inputPointers.push_back(&m_jetpt ) ; nConfgVar++; } + else if (var=="Nvtx" ) { inputPointers.push_back(&m_nvtx ) ; nConfgVar++; } + else if (var=="MaxEfrc" ) { inputPointers.push_back(&m_maxefrc ) ; nConfgVar++; } + else if (var=="sumMass" ) { inputPointers.push_back(&m_summass ) ; nConfgVar++; } + else if (var=="totalntrk" ) { inputPointers.push_back(&m_totalntrk ) ; nConfgVar++; } + else if (var=="diffntrkSV0" ) { inputPointers.push_back(&m_diffntrkSV0 ) ; nConfgVar++; } + else if (var=="diffntrkSV1" ) { inputPointers.push_back(&m_diffntrkSV1 ) ; nConfgVar++; } + else if (var=="normDist" ) { inputPointers.push_back(&m_normDist ) ; nConfgVar++; } + else if (var=="maxVtxMass" ) { inputPointers.push_back(&m_mmax_mass ) ; nConfgVar++; } + else if (var=="maxSecVtxMass" ) { inputPointers.push_back(&m_mmx2_mass ) ; nConfgVar++; } + else if (var=="EfrcmaxVtxMass" ) { inputPointers.push_back(&m_mmax_efrc ) ; nConfgVar++; } + else if (var=="EfrcmaxSecVtxMass") { inputPointers.push_back(&m_mmx2_efrc ) ; nConfgVar++; } + else if (var=="dlsmaxVtxMass" ) { inputPointers.push_back(&m_mmax_dist ) ; nConfgVar++; } + else if (var=="dlsmaxSecVtxMass" ) { inputPointers.push_back(&m_mmx2_dist ) ; nConfgVar++; } + else if (var=="dRmaxVtxMassj" ) { inputPointers.push_back(&m_mmax_DRjet ) ; nConfgVar++; } + else if (var=="dRmaxSecVtxMassj" ) { inputPointers.push_back(&m_mmx2_DRjet ) ; nConfgVar++; } + else if (var=="d2Mass12" ) { inputPointers.push_back(&m_mx12_2d12 ) ; nConfgVar++; } + else if (var=="DRMass12" ) { inputPointers.push_back(&m_mx12_DR ) ; nConfgVar++; } + else if (var=="AngleMass12" ) { inputPointers.push_back(&m_mx12_Angle ) ; nConfgVar++; } else { - msg << MSG::WARNING << "#BTAG# \""<<inputVars.at(ivar)<<"\" <- This variable found in xml/calib-file does not match to any variable declared in MultiSV... the algorithm will be 'disabled'." << endmsg; + msg << MSG::WARNING << "#BTAG# \""<<var<<"\" <- This variable found in xml/calib-file does not match to any variable declared in MultiSV... the algorithm will be 'disabled'." << endmsg; badVariableFound=true; } } diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/MultivariateTagManager.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/MultivariateTagManager.cxx index fb58bfef5784e964cd4d6549955f8bf04cb414d2..3b88ccb258a14fca3bc6f0e7acfe7488f5e88397 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/MultivariateTagManager.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/MultivariateTagManager.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////// @@ -14,14 +14,9 @@ /// ///////////////////////////////////////////////////////////////////////////// -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/IToolSvc.h" - #include "JetTagTools/MultivariateTagManager.h" #include "JetTagTools/BTagVariables.h" -#include "TObjString.h" - #include <fstream> #include <sstream> #include <algorithm> @@ -61,8 +56,8 @@ namespace Analysis { { if (m_MultivariateTaggerHandleArray.empty()) { - ATH_MSG_ERROR("MVTagToolList is empty"); - return StatusCode::FAILURE; + ATH_MSG_ERROR("MVTagToolList is empty"); + return StatusCode::FAILURE; } if ( m_MultivariateTaggerHandleArray.retrieve().isFailure() ) { @@ -86,12 +81,6 @@ namespace Analysis { return StatusCode::SUCCESS; } - StatusCode MultivariateTagManager::finalize() { // all taken care of in destructor - ATH_MSG_INFO(" #BTAG# Finalization of MultivariateTagManager successfull" ); - return StatusCode::SUCCESS; - } - - // _______________________________________________________________________ // MultivariateTagManager functions @@ -153,16 +142,16 @@ namespace Analysis { float sm_mu_z0 = NAN; float sm_ID_qOverP = NAN; - BTag.variable<float>(m_softmuon_infosource, "mu_pt" , sm_mu_pt ); + BTag.variable<float>(m_softmuon_infosource, "mu_pt" , sm_mu_pt ); if(!std::isnan(sm_mu_pt) && sm_mu_pt>0){ - BTag.variable<float>(m_softmuon_infosource, "dR" , sm_dR ); - BTag.variable<float>(m_softmuon_infosource, "qOverPratio" , sm_qOverPratio ); - BTag.variable<float>(m_softmuon_infosource, "mombalsignif" , sm_mombalsignif ); - BTag.variable<float>(m_softmuon_infosource, "scatneighsignif" , sm_scatneighsignif); - BTag.variable<float>(m_softmuon_infosource, "pTrel" , sm_pTrel ); - BTag.variable<float>(m_softmuon_infosource, "mu_d0" , sm_mu_d0 ); - BTag.variable<float>(m_softmuon_infosource, "mu_z0" , sm_mu_z0 ); - BTag.variable<float>(m_softmuon_infosource, "ID_qOverP" , sm_ID_qOverP ); + BTag.variable<float>(m_softmuon_infosource, "dR" , sm_dR ); + BTag.variable<float>(m_softmuon_infosource, "qOverPratio" , sm_qOverPratio ); + BTag.variable<float>(m_softmuon_infosource, "mombalsignif" , sm_mombalsignif ); + BTag.variable<float>(m_softmuon_infosource, "scatneighsignif" , sm_scatneighsignif); + BTag.variable<float>(m_softmuon_infosource, "pTrel" , sm_pTrel ); + BTag.variable<float>(m_softmuon_infosource, "mu_d0" , sm_mu_d0 ); + BTag.variable<float>(m_softmuon_infosource, "mu_z0" , sm_mu_z0 ); + BTag.variable<float>(m_softmuon_infosource, "ID_qOverP" , sm_ID_qOverP ); }else{ sm_mu_pt= NAN; } @@ -177,21 +166,20 @@ namespace Analysis { inputs[btagvar::SM_MU_Z0] = sm_mu_z0; inputs[btagvar::SM_ID_QOVERP] = sm_ID_qOverP; - } + void MultivariateTagManager::fill_trkSum(var_map& inputs, xAOD::BTagging& BTag) const { float trkSum_ntrk = NAN; float trkSum_sPt = NAN; float trkSum_vPt = NAN; float trkSum_vAbsEta =NAN; - trkSum_ntrk = BTag.isAvailable<unsigned>("trkSum_ntrk") ? BTag.auxdata<unsigned>("trkSum_ntrk") : NAN; trkSum_sPt = BTag.isAvailable<float >("trkSum_SPt" ) ? BTag.auxdata<float >("trkSum_SPt" ) : NAN; if (!std::isnan(trkSum_ntrk)){ trkSum_vPt = BTag.isAvailable<float>("trkSum_VPt" ) ? BTag.auxdata<float>("trkSum_VPt" ) : NAN; - trkSum_vAbsEta= BTag.isAvailable<float>("trkSum_VEta") ? fabs(BTag.auxdata<float>("trkSum_VEta")) : NAN; + trkSum_vAbsEta= BTag.isAvailable<float>("trkSum_VEta") ? std::abs(BTag.auxdata<float>("trkSum_VEta")) : NAN; } inputs[btagvar::TRKSUM_NTRK] = trkSum_ntrk; @@ -199,7 +187,6 @@ namespace Analysis { inputs[btagvar::TRKSUM_VPT] = trkSum_vPt; inputs[btagvar::TRKSUM_ABSETA] = trkSum_vAbsEta; - } void MultivariateTagManager::fill_jetfitter(var_map& inputs, xAOD::BTagging& BTag) const { @@ -218,7 +205,8 @@ namespace Analysis { float jf_sig3d = NAN; // check if we have vertices - int jf_nvtx_tmp(INT_MISSING), jf_nvtx1t_tmp(INT_MISSING); bool jfitter_ok(false); + int jf_nvtx_tmp(INT_MISSING), jf_nvtx1t_tmp(INT_MISSING); + bool jfitter_ok(false); std::vector< ElementLink< xAOD::BTagVertexContainer > > jf_vertices; BTag.variable<std::vector<ElementLink<xAOD::BTagVertexContainer> > >(m_jftNN_infosource, "JFvertices", jf_vertices); if("JetFitter" == m_jftNN_infosource) { @@ -229,32 +217,35 @@ namespace Analysis { BTag.variable<int>(m_jftNN_infosource, "nVTX", jf_nvtx_tmp ); BTag.variable<int>(m_jftNN_infosource, "nSingleTracks", jf_nvtx1t_tmp); } - if(jf_vertices.size()>0 && jf_vertices[0].isValid() && (jf_nvtx_tmp > 0 || jf_nvtx1t_tmp > 0)) jfitter_ok = true; + + if(!jf_vertices.empty() && jf_vertices[0].isValid() && + (jf_nvtx_tmp > 0 || jf_nvtx1t_tmp > 0)) jfitter_ok = true; if(jfitter_ok) { // Get values from the xAOD if("JetFitter" == m_jftNN_infosource) { // check if JetFitter is known by the xAOD? - BTag.taggerInfo(jf_nvtx, xAOD::BTagInfo::JetFitter_nVTX); - BTag.taggerInfo(jf_nvtx1t, xAOD::BTagInfo::JetFitter_nSingleTracks); - BTag.taggerInfo(jf_ntrkAtVx, xAOD::BTagInfo::JetFitter_nTracksAtVtx); - BTag.taggerInfo(jf_n2tv, xAOD::BTagInfo::JetFitter_N2Tpair); - BTag.taggerInfo(jf_efrc, xAOD::BTagInfo::JetFitter_energyFraction); - BTag.taggerInfo(jf_mass, xAOD::BTagInfo::JetFitter_mass); - BTag.taggerInfo(jf_sig3d, xAOD::BTagInfo::JetFitter_significance3d); - BTag.taggerInfo(jf_dphi, xAOD::BTagInfo::JetFitter_deltaphi); - BTag.taggerInfo(jf_deta, xAOD::BTagInfo::JetFitter_deltaeta); + BTag.taggerInfo(jf_nvtx, xAOD::BTagInfo::JetFitter_nVTX); + BTag.taggerInfo(jf_nvtx1t, xAOD::BTagInfo::JetFitter_nSingleTracks); + BTag.taggerInfo(jf_ntrkAtVx, xAOD::BTagInfo::JetFitter_nTracksAtVtx); + BTag.taggerInfo(jf_n2tv, xAOD::BTagInfo::JetFitter_N2Tpair); + BTag.taggerInfo(jf_efrc, xAOD::BTagInfo::JetFitter_energyFraction); + BTag.taggerInfo(jf_mass, xAOD::BTagInfo::JetFitter_mass); + BTag.taggerInfo(jf_sig3d, xAOD::BTagInfo::JetFitter_significance3d); + BTag.taggerInfo(jf_dphi, xAOD::BTagInfo::JetFitter_deltaphi); + BTag.taggerInfo(jf_deta, xAOD::BTagInfo::JetFitter_deltaeta); } else { // get variables explicitely - BTag.variable<int>(m_jftNN_infosource, "nVTX", jf_nvtx); - BTag.variable<int>(m_jftNN_infosource, "nSingleTracks", jf_nvtx1t); - BTag.variable<int>(m_jftNN_infosource, "nTracksAtVtx", jf_ntrkAtVx); - BTag.variable<int>(m_jftNN_infosource, "N2Tpair", jf_n2tv); - BTag.variable<float>(m_jftNN_infosource, "energyFraction", jf_efrc); - BTag.variable<float>(m_jftNN_infosource, "mass", jf_mass); - BTag.variable<float>(m_jftNN_infosource, "significance3d", jf_sig3d); - BTag.variable<float>(m_jftNN_infosource, "deltaphi", jf_dphi); - BTag.variable<float>(m_jftNN_infosource, "deltaeta", jf_deta); + BTag.variable<int>(m_jftNN_infosource, "nVTX", jf_nvtx); + BTag.variable<int>(m_jftNN_infosource, "nSingleTracks", jf_nvtx1t); + BTag.variable<int>(m_jftNN_infosource, "nTracksAtVtx", jf_ntrkAtVx); + BTag.variable<int>(m_jftNN_infosource, "N2Tpair", jf_n2tv); + BTag.variable<float>(m_jftNN_infosource, "energyFraction", jf_efrc); + BTag.variable<float>(m_jftNN_infosource, "mass", jf_mass); + BTag.variable<float>(m_jftNN_infosource, "significance3d", jf_sig3d); + BTag.variable<float>(m_jftNN_infosource, "deltaphi", jf_dphi); + BTag.variable<float>(m_jftNN_infosource, "deltaeta", jf_deta); } + // NOTE: no need to check for NAN here, it should do the right thing // http://en.cppreference.com/w/cpp/numeric/math/hypot#Error_handling jf_dR = std::hypot(jf_dphi,jf_deta); @@ -295,9 +286,7 @@ namespace Analysis { std::vector<float> weightBofTracksIP2D; BTag.variable<std::vector<float> >(m_ip2d_infosource, "weightBofTracks", weightBofTracksIP2D); - int ntrk_ip2 = weightBofTracksIP2D.size(); - - if(ntrk_ip2>0) { + if(!weightBofTracksIP2D.empty()) { if( m_ip2d_infosource == "IP2D" ) { ip2d_pb = BTag.IP2D_pb(); @@ -362,8 +351,7 @@ namespace Analysis { std::vector<float> weightBofTracksIP3D; BTag.variable<std::vector<float> >(m_ip3d_infosource, "weightBofTracks", weightBofTracksIP3D); - int ntrk_ip3= weightBofTracksIP3D.size(); - if(ntrk_ip3>0) { + if(!weightBofTracksIP3D.empty()) { if( m_ip3d_infosource == "IP3D" ) { ip3d_pb = BTag.IP3D_pb(); ip3d_pc = BTag.IP3D_pc(); @@ -429,25 +417,23 @@ namespace Analysis { std::vector< ElementLink< xAOD::VertexContainer > > myVertices_SV0; BTag.variable<std::vector<ElementLink<xAOD::VertexContainer> > >(m_sv1_infosource, "vertices", myVertices_SV0); - if ( myVertices_SV0.size() > 0 && myVertices_SV0[0].isValid() ) { + if ( !myVertices_SV0.empty() && myVertices_SV0[0].isValid() ) { // if we found a vertex, then sv0 is okay to use sv0_ok = true; } if (sv0_ok) { if (m_sv0_infosource == "SV0") { - BTag.taggerInfo(sv0_mass, xAOD::BTagInfo::SV0_masssvx); - BTag.taggerInfo(sv0_efrc, xAOD::BTagInfo::SV0_efracsvx); - BTag.taggerInfo(sv0_n2t, xAOD::BTagInfo::SV0_N2Tpair); - BTag.taggerInfo(sv0_ntrkv, xAOD::BTagInfo::SV0_NGTinSvx); - //BTag.taggerInfo(sv0_sig3d, xAOD::BTagInfo::SV0_normdist); + BTag.taggerInfo(sv0_mass, xAOD::BTagInfo::SV0_masssvx); + BTag.taggerInfo(sv0_efrc, xAOD::BTagInfo::SV0_efracsvx); + BTag.taggerInfo(sv0_n2t, xAOD::BTagInfo::SV0_N2Tpair); + BTag.taggerInfo(sv0_ntrkv, xAOD::BTagInfo::SV0_NGTinSvx); } else { - BTag.variable<float>(m_sv0_infosource, "masssvx", sv0_mass); - BTag.variable<float>(m_sv0_infosource, "efracsvx", sv0_efrc); - BTag.variable<int>(m_sv0_infosource, "N2Tpair", sv0_n2t); - BTag.variable<int>(m_sv0_infosource, "NGTinSvx", sv0_ntrkv); - //BTag.variable<float>(m_sv0_infosource, "significance3D", sv0_sig3d); + BTag.variable<float>(m_sv0_infosource, "masssvx", sv0_mass); + BTag.variable<float>(m_sv0_infosource, "efracsvx", sv0_efrc); + BTag.variable<int>(m_sv0_infosource, "N2Tpair", sv0_n2t); + BTag.variable<int>(m_sv0_infosource, "NGTinSvx", sv0_ntrkv); } BTag.variable<float>(m_sv0_infosource, "significance3D", sv0_sig3d); @@ -486,7 +472,7 @@ namespace Analysis { bool sv1_ok(false); std::vector< ElementLink< xAOD::VertexContainer > > myVertices_SV1; BTag.variable<std::vector<ElementLink<xAOD::VertexContainer> > >(m_sv1_infosource, "vertices", myVertices_SV1); - if ( myVertices_SV1.size() > 0 && myVertices_SV1[0].isValid() ) { + if ( !myVertices_SV1.empty() && myVertices_SV1[0].isValid() ) { // if we found a vertex, then sv1 is okay to use sv1_ok = true; } @@ -561,7 +547,7 @@ namespace Analysis { inputs[btagvar::SV1_L3D] = sv1_L3d; inputs[btagvar::SV1_SIG3D] = sv1_sig3d; inputs[btagvar::SV1_DR] = sv1_dR; - inputs[btagvar::SV1_DISTMATLAY] = sv1_distmatlay; + inputs[btagvar::SV1_DISTMATLAY] = sv1_distmatlay; } void MultivariateTagManager::fill_arbitrary_aux_data( diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/NewLikelihoodTool.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/NewLikelihoodTool.cxx index 5baf6d9e333e6a78a0015cd38b27094967fa065b..0bbcf09695e80bfffae019ee27c1124ca832413b 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/NewLikelihoodTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/NewLikelihoodTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "JetTagTools/NewLikelihoodTool.h" @@ -42,16 +42,8 @@ namespace Analysis { m_vetoSmoothingOf.push_back("/Sip3D"); } - NewLikelihoodTool::~NewLikelihoodTool() { - } - StatusCode NewLikelihoodTool::initialize() { ATH_CHECK(m_readKey.initialize()); - - return StatusCode::SUCCESS; - } - - StatusCode NewLikelihoodTool::finalize() { return StatusCode::SUCCESS; } @@ -61,10 +53,10 @@ namespace Analysis { void NewLikelihoodTool::printStatus() const { msg(MSG::INFO) << "#BTAG# - hypotheses : "; - for(unsigned int ih=0;ih<m_hypotheses.size();ih++) msg(MSG::INFO) << m_hypotheses[ih] << ", "; + for(const auto& hypo : m_hypotheses) msg(MSG::INFO) << hypo << ", "; msg(MSG::INFO) << endmsg; msg(MSG::INFO) << "#BTAG# - histograms : " << endmsg; - for(unsigned int ih=0;ih<m_histograms.size();ih++) msg(MSG::INFO) << m_histograms[ih] << endmsg; + for(const auto& histo : m_histograms) msg(MSG::INFO) << histo << endmsg; } std::vector<std::string> NewLikelihoodTool::gradeList(const std::string& histoName) const { @@ -169,8 +161,8 @@ namespace Analysis { if(norm) { // check if smoothing of histogram is not vetoed: bool veto = false; - for(unsigned int iv=0; iv<m_vetoSmoothingOf.size(); iv++) { - if(hname.find(m_vetoSmoothingOf[iv])!=std::string::npos) { + for(const auto& v : m_vetoSmoothingOf) { + if(hname.find(v)!=std::string::npos) { veto = true; ATH_MSG_VERBOSE("#BTAG# Smoothing of " << hname << " is vetoed !"); break; @@ -208,10 +200,12 @@ namespace Analysis { for(int iz=1; iz<=Nz; iz++){ double content=dc_tmp->Integral(1,Nx,1,Ny,iz,iz,""); if(content==0.)content=Nz; double dnorm=total/content/Nz; - for(int ix=1; ix<=Nx; ix++){for(int iy=1; iy<=Ny; iy++){ - double cbin=dc_tmp->GetBinContent(ix,iy,iz)*dnorm; cbin= cbin>0. ? cbin : 0.1; //Protection against empty bins - dc_tmp->SetBinContent(ix,iy,iz, cbin); - }} + for(int ix=1; ix<=Nx; ix++){ + for(int iy=1; iy<=Ny; iy++){ + double cbin=dc_tmp->GetBinContent(ix,iy,iz)*dnorm; cbin= cbin>0. ? cbin : 0.1; //Protection against empty bins + dc_tmp->SetBinContent(ix,iy,iz, cbin); + } + } } HistoHelperRoot::smoothASH3D(dc_tmp, m3d1, m3d1, m3d3, msgLvl(MSG::DEBUG)); } @@ -237,32 +231,30 @@ namespace Analysis { } ATH_MSG_VERBOSE("#BTAG# -- lhVarVal size= " << lhVariableValues.size()); // loop on Tracks in the Jet (IP) / Vertices in the Jet (SV) - for (unsigned int iel = 0; iel<lhVariableValues.size(); iel++) { - ATH_MSG_VERBOSE( "#BTAG# -- element " << iel << " " - << lhVariableValues[iel].name ); - int ncompo = lhVariableValues[iel].composites.size(); - ATH_MSG_VERBOSE( "#BTAG# -- element " << iel << " " - << lhVariableValues[iel].name + for (const auto& value : lhVariableValues) { + ATH_MSG_VERBOSE( "#BTAG# -- element " << value.name ); + int ncompo = value.composites.size(); + ATH_MSG_VERBOSE( "#BTAG# -- element " << value.name << " has " << ncompo << " composites." ); // loop on variables that make up the Tag, e.g. // one 1D for IP2D, one 2D for IP3D, one 1D and one 2D for SV1, one 3D for SV2 - for (int icompo = 0;icompo<ncompo;icompo++) { + for (const auto& compo : value.composites) { double sum(0.); std::vector<double> tmpVector; - std::string histName = lhVariableValues[iel].composites[icompo].name; - int idim = lhVariableValues[iel].composites[icompo].atoms.size(); - ATH_MSG_VERBOSE( "#BTAG# -- composite " << icompo << " histo= " + std::string histName = compo.name; + int idim = compo.atoms.size(); + ATH_MSG_VERBOSE( "#BTAG# -- composite histo= " << histName << " dim= " << idim ); - for (unsigned int ihyp = 0 ; ihyp < m_hypotheses.size(); ++ihyp) { - TH1* tmpHisto = this->prepareHistogram(m_hypotheses[ihyp],histName); + for (const auto& hypo : m_hypotheses) { + TH1* tmpHisto = this->prepareHistogram(hypo,histName); if(tmpHisto) { if(1==idim) { - double valuex = lhVariableValues[iel].composites[icompo].atoms[0].value; + double valuex = compo.atoms[0].value; int binx = (tmpHisto->GetXaxis())->FindBin(valuex); if(valuex >= tmpHisto->GetXaxis()->GetXmax()) binx = tmpHisto->GetXaxis()->GetNbins(); if(valuex <= tmpHisto->GetXaxis()->GetXmin()) binx = 1; double tmp = tmpHisto->GetBinContent(binx); - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "#BTAG# For hypothesis= " << m_hypotheses[ihyp] + if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "#BTAG# For hypothesis= " << hypo << " (1D) actual value= " << valuex << " --> bin= " << binx << " f = " << tmp; if(m_interpolate) { @@ -288,8 +280,8 @@ namespace Analysis { sum += tmp; } if(2==idim) { - double valuex = lhVariableValues[iel].composites[icompo].atoms[0].value; - double valuey = lhVariableValues[iel].composites[icompo].atoms[1].value; + double valuex = compo.atoms[0].value; + double valuey = compo.atoms[1].value; int binx = (tmpHisto->GetXaxis())->FindBin(valuex); int biny = (tmpHisto->GetYaxis())->FindBin(valuey); if(valuex >= tmpHisto->GetXaxis()->GetXmax()) binx = tmpHisto->GetXaxis()->GetNbins(); @@ -297,7 +289,7 @@ namespace Analysis { if(valuey >= tmpHisto->GetYaxis()->GetXmax()) biny = tmpHisto->GetYaxis()->GetNbins(); if(valuey <= tmpHisto->GetYaxis()->GetXmin()) biny = 1; double tmp = tmpHisto->GetBinContent(binx, biny); - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "#BTAG# For hypothesis= " << m_hypotheses[ihyp] + if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "#BTAG# For hypothesis= " << hypo << " (2D) actual value= " << valuex << " " << valuey << " --> bin= " << binx << " " << biny << " f = " << tmp; if(m_interpolate) { @@ -324,9 +316,9 @@ namespace Analysis { sum += tmp; } if(3==idim) { - double valuex = lhVariableValues[iel].composites[icompo].atoms[0].value; - double valuey = lhVariableValues[iel].composites[icompo].atoms[1].value; - double valuez = lhVariableValues[iel].composites[icompo].atoms[2].value; + double valuex = compo.atoms[0].value; + double valuey = compo.atoms[1].value; + double valuez = compo.atoms[2].value; int binx = (tmpHisto->GetXaxis())->FindBin(valuex); int biny = (tmpHisto->GetYaxis())->FindBin(valuey); int binz = (tmpHisto->GetZaxis())->FindBin(valuez); @@ -337,7 +329,7 @@ namespace Analysis { if(valuez >= tmpHisto->GetZaxis()->GetXmax()) binz = tmpHisto->GetZaxis()->GetNbins(); if(valuez <= tmpHisto->GetZaxis()->GetXmin()) binz = 1; double tmp = tmpHisto->GetBinContent(binx, biny, binz); - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "#BTAG# For hypothesis= " << m_hypotheses[ihyp] + if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "#BTAG# For hypothesis= " << hypo << " (3D) actual value= " << valuex << " " << valuey << " " << valuez << " --> bin= " << binx << " " << biny @@ -372,11 +364,10 @@ namespace Analysis { } } // endloop on hypotheses (B,U,C..) unsigned int classCount(0); - for( std::vector<double>::iterator itr3 = tmpVector.begin(); - itr3 != tmpVector.end(); ++itr3 ) { + for (const auto& f : tmpVector) { if(sum != 0.) { if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "#BTAG# sum of pX = " << sum << endmsg; - double p = (*itr3); + double p = f; if(m_normalizedProb) p /= sum; probDensityPerEventClassAllVariables[classCount] *= p; } else { diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/SVForIPTool.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/SVForIPTool.cxx index 3f456bd2cd7ab61e413a978f97273feca9283c78..8cf2a2521ae2593fb8c9ce90cab4e59be8f488d8 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/SVForIPTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/SVForIPTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "JetTagTools/SVForIPTool.h" @@ -16,20 +16,6 @@ namespace Analysis { declareInterface<SVForIPTool>(this); } - SVForIPTool::~SVForIPTool() {} - - StatusCode SVForIPTool::initialize() { - - ATH_MSG_INFO(" Initialization of SVForIPTool succesful"); - return StatusCode::SUCCESS; - } - - StatusCode SVForIPTool::finalize() { - - ATH_MSG_INFO(" Finalization of SVForIPTool succesful"); - return StatusCode::SUCCESS; - } - void SVForIPTool::getDirectionFromSecondaryVertexInfo(Amg::Vector3D & SvxDirection, bool & canUseSvxDirection, xAOD::BTagging* BTag, @@ -39,40 +25,30 @@ namespace Analysis { std::vector< ElementLink< xAOD::VertexContainer > > myVertices; BTag->variable<std::vector<ElementLink<xAOD::VertexContainer> > >(secVxFinderName, "vertices", myVertices); - if (myVertices.size() == 0) { + if (myVertices.empty()) { ATH_MSG_DEBUG(" No secondary vertex found for getting the B flight direction (for the IP sign calculation)"); } else { - if (myVertices[0].isValid()) - { - canUseSvxDirection=true; - SvxDirection=(*myVertices[0])->position()-priVtx.position(); - ATH_MSG_VERBOSE(" Get direction from InDetVKalVertex: phi: " << SvxDirection.phi() << - " theta: " << SvxDirection.theta() ); - } - else - { - ATH_MSG_WARNING("SVX info seems usable, but no SVX available !!!"); - } - } + if (myVertices[0].isValid()) { + canUseSvxDirection=true; + SvxDirection=(*myVertices[0])->position()-priVtx.position(); + ATH_MSG_VERBOSE(" Get direction from InDetVKalVertex: phi: " << SvxDirection.phi() << + " theta: " << SvxDirection.theta() ); + } else { + ATH_MSG_WARNING("SVX info seems usable, but no SVX available !!!"); + } + } } - - - + + void SVForIPTool::getTrkFromV0FromSecondaryVertexInfo(std::vector<const xAOD::TrackParticle*> & TrkFromV0, xAOD::BTagging* BTag, const std::string & secVxFinderName) const { std::vector<ElementLink<xAOD::TrackParticleContainer> > TrkFromV0_ELs; - BTag->variable<std::vector<ElementLink<xAOD::TrackParticleContainer> > >(secVxFinderName, "badTracksIP", TrkFromV0_ELs); - - for (std::vector<ElementLink<xAOD::TrackParticleContainer> >::iterator itr=TrkFromV0_ELs.begin();itr!=TrkFromV0_ELs.end();++itr) - { - if (itr->isValid()) - { - TrkFromV0.push_back((**itr)); - } - } + for (const auto& link : TrkFromV0_ELs) { + if (link.isValid()) TrkFromV0.push_back(*link); + } } }//end namespace diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/SVTag.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/SVTag.cxx index cc7cbde3c31ae404351276cf48e94cf7b2c52640..de328422a46279b29539b79312f097a9f90ae734 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/SVTag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/SVTag.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,16 +7,12 @@ ***************************************************************************/ #include "JetTagTools/SVTag.h" -#include "GaudiKernel/IToolSvc.h" -#include "Navigation/NavigationToken.h" #include "JetTagTools/NewLikelihoodTool.h" #include "GaudiKernel/ITHistSvc.h" #include "JetTagTools/HistoHelperRoot.h" #include "JetTagTools/LikelihoodComponents.h" #include "ParticleJetTools/JetFlavourInfo.h" -#include "xAODTracking/TrackParticle.h" -#include "xAODTracking/Vertex.h" #include "xAODTracking/VertexContainer.h" #include <string> @@ -39,9 +35,7 @@ namespace Analysis declareProperty("LikelihoodTool", m_likelihoodTool); declareProperty("checkOverflows", m_checkOverflows = false); declareProperty("purificationDeltaR", m_purificationDeltaR = 0.8); - declareProperty("UseBinInterpol", m_UseBinInterpol = false); - // declareProperty("originalTPCollectionName", m_originalTPCollectionName = "InDetTrackParticles"); declareProperty("jetCollectionList", m_jetCollectionList); declareProperty("useForcedCalibration", m_doForcedCalib = false); declareProperty("ForcedCalibrationName", m_ForcedCalibName = "Cone4H1Tower"); @@ -102,19 +96,18 @@ namespace Analysis ATH_MSG_VERBOSE("#BTAG# Booking histos..."); std::vector<double> xb; double xbi[10] = {1., 2., 3., 4., 5., 6., 8., 10., 20., 50.}; - for(uint ijc=0;ijc<m_jetCollectionList.size();ijc++) { - + for(const auto& jetColl : m_jetCollectionList) { for(uint ih=0;ih<m_hypotheses.size();ih++) { // SV1 if (m_SVmode == "SV1") { - std::string hDir = "/RefFile/SV1/"+m_jetCollectionList[ijc]+"/"+m_hypotheses[ih]+"/"; + std::string hDir = "/RefFile/SV1/"+jetColl+"/"+m_hypotheses[ih]+"/"; m_histoHelper->bookHisto(hDir+"N2T", "Number of Good Two Track Vertices",9,xbi); m_histoHelper->bookHisto(hDir+"N2TEffSV1", "Number of Good Two Track Vertices",9,xbi); m_histoHelper->bookHisto(hDir+"N2TNormSV1", "Number of Good Two Track Vertices",30,0.,30.); m_histoHelper->bookHisto(hDir+"BidimME", "(E fraction)**0.7 vs Mass/(Mass+1)" ,50,0.218261406,1.,50,0.,1.); m_histoHelper->bookHisto(hDir+"DRJPVSV", "DeltaR between jet axis and (PV,SV) axis",100,0.,0.5); } else if (m_SVmode == "SV2") { - std::string hDir = "/RefFile/SV2/"+m_jetCollectionList[ijc]+"/"+m_hypotheses[ih]+"/"; + std::string hDir = "/RefFile/SV2/"+jetColl+"/"+m_hypotheses[ih]+"/"; // SV2 m_histoHelper->bookHisto(hDir+"N2TEffSV2", "Number of Good Two Track Vertices",9,xbi); m_histoHelper->bookHisto(hDir+"N2TNormSV2", "Number of Good Two Track Vertices",30,0.,30.); @@ -122,7 +115,7 @@ namespace Analysis else m_histoHelper->bookHisto(hDir+"TridimMEN2T"," ln(N) vs (E fraction)**0.7 vs Mass/(Mass+1)",20,0.,1.,20,0.,1.,7,0.,3.8); if(ih==0) { // Control with SV2 - hDir = "/RefFile/SV2/"+m_jetCollectionList[ijc]+"/controlSV/"; + hDir = "/RefFile/SV2/"+jetColl+"/controlSV/"; m_histoHelper->bookHisto(hDir+"eta","eta",60,-3.,3.); m_histoHelper->bookHisto(hDir+"phi","phi",64,-3.2,3.2); m_histoHelper->bookHisto(hDir+"pt","pt",50,0.,300.); @@ -175,13 +168,14 @@ namespace Analysis ATH_MSG_VERBOSE("#BTAG# Using jet type " << author << " for calibrations."); /* The jet */ + Amg::Vector3D jetDir(jetToTag.p4().Px(),jetToTag.p4().Py(),jetToTag.p4().Pz()); double jeteta = jetToTag.eta(), jetphi = jetToTag.phi(), jetpt = jetToTag.pt(); ATH_MSG_VERBOSE("#BTAG# Jet properties : eta = " << jeteta << " phi = " << jetphi << " pT = " <<jetpt/m_c_mom); // Fill control histograms if (m_runModus=="reference" && m_SVmode == "SV2") { - if (fabs(jeteta) <= 2.5) { + if (std::abs(jeteta) <= 2.5) { m_histoHelper->fillHisto("/RefFile/SV2/"+author+"/controlSV/eta",(double)jeteta); m_histoHelper->fillHisto("/RefFile/SV2/"+author+"/controlSV/phi",(double)jetphi); m_histoHelper->fillHisto("/RefFile/SV2/"+author+"/controlSV/pt",(double)jetpt/m_c_mom); @@ -190,7 +184,7 @@ namespace Analysis // // Get the SV info // - float ambtot = -1., xratio = -1., distnrm = 0., drJPVSV = 0., Lxy = -100., L3d = -100.; + float ambtot = -1., xratio = -1., distnrm = 0., drJPVSV = 0., Lxy = -100., L3d = -100.; int NSVPair = -1; float distnrmCorr=0.; @@ -199,9 +193,8 @@ namespace Analysis std::vector< ElementLink< xAOD::VertexContainer > > myVertices; // don't check the following status BTag.variable<std::vector<ElementLink<xAOD::VertexContainer> > >(m_secVxFinderName, "vertices", myVertices); - // BTag.auxdata<std::vector<ElementLink<xAOD::VertexContainer> > >(m_secVxFinderName+"_vertices"); - if (myVertices.size()>0) { + if (!myVertices.empty()) { status &= BTag.variable<float>(m_secVxFinderName, "masssvx", ambtot);// mass in MeV ambtot/=m_c_mom; @@ -215,11 +208,9 @@ namespace Analysis // DR between Jet axis and PV-SV axis // For the time being computed only for Single Vertex... if (myVertices[0].isValid()) { - // if (myVertices[0]!=0) { const xAOD::Vertex* firstVertex = *(myVertices[0]); //FIXME ugly hack to get a Amg::Vector3D out of a CLHEP::HepLorentzVector - Amg::Vector3D jetDir(jetToTag.p4().Px(),jetToTag.p4().Py(),jetToTag.p4().Pz()); const Amg::Vector3D PVposition = priVtx.position(); const Amg::Vector3D position = firstVertex->position(); Amg::Vector3D PvSvDir( position.x() - PVposition.x(), @@ -232,30 +223,26 @@ namespace Analysis if ( m_isFlipped ) drJPVSV = drJPVSV_2; // for negative tags ATH_MSG_VERBOSE("#BTAG# DRJPVSV regular="<<drJPVSV_1<<" flipped="<<drJPVSV_2<<" chosen="<<drJPVSV); - Lxy=sqrt(pow(PvSvDir(0,0),2)+pow(PvSvDir(1,0),2)); - L3d=sqrt(pow(PvSvDir(0,0),2)+pow(PvSvDir(1,0),2)+pow(PvSvDir(2,0),2)); + Lxy = std::hypot(PvSvDir(0,0), PvSvDir(1,0)); + L3d = std::hypot(PvSvDir(0,0), PvSvDir(1,0), PvSvDir(2,0)); }else{ ATH_MSG_VERBOSE("#BTAG# No secondary vertex."); } std::vector<const xAOD::Vertex*> vecVertices; - const std::vector<ElementLink<xAOD::VertexContainer> >::const_iterator verticesEnd = myVertices.end(); - for (std::vector<ElementLink<xAOD::VertexContainer> >::const_iterator verticesIter = myVertices.begin(); - verticesIter != verticesEnd; ++verticesIter) { - if (!verticesIter->isValid()) { - ATH_MSG_WARNING("#BTAG# Secondary vertex from InDetVKalVxInJetFinder has zero pointer. Skipping... "); + for (const auto& link : myVertices) { + if (!link.isValid()) { + ATH_MSG_WARNING("#BTAG# Secondary vertex from InDetVKalVxInJetFinder has zero pointer. Skipping... "); continue; - } - vecVertices.push_back(**verticesIter); + } + vecVertices.push_back(*link); } if (myVertices[0].isValid()) { const xAOD::Vertex* myVert = *myVertices[0]; - distnrm=get3DSignificance(priVtx, vecVertices, - Amg::Vector3D(jetToTag.p4().Px(),jetToTag.p4().Py(),jetToTag.p4().Pz())); + distnrm = get3DSignificance(priVtx, vecVertices, jetDir); ATH_MSG_VERBOSE("#BTAG# SVX x = " << myVert->position().x() << " y = " << myVert->position().y() << " z = " << myVert->position().z()); - distnrmCorr=get3DSignificanceCorr(priVtx, vecVertices, - Amg::Vector3D(jetToTag.p4().Px(),jetToTag.p4().Py(),jetToTag.p4().Pz())); + distnrmCorr = get3DSignificanceCorr(priVtx, vecVertices, jetDir); } else { ATH_MSG_VERBOSE("#BTAG# No vertex. Cannot calculate normalized distance."); distnrm=0.; @@ -281,7 +268,8 @@ namespace Analysis instanceName = prefix; instanceName += posfix; } -//AA: Move to filling xAOD::BTagging + + //AA: Move to filling xAOD::BTagging // note that this block is filling things other than likelihood, // it should not be conditional on m_save_probabilities if (m_runModus=="analysis") { @@ -319,12 +307,14 @@ namespace Analysis ATH_MSG_VERBOSE("#BTAG# SV mode = " << m_SVmode); if (m_SVmode != "SV0" ) { - float ambtotp = ambtot > 0. ? ambtot/(1.+ambtot): 0.; + float ambtotp = ambtot > 0. ? ambtot/(1.+ambtot) : 0.; float xratiop = xratio > 0. ? (float)pow(xratio,m_expos) : 0.; - float trfJetPt=log(jetToTag.pt()/20000.); if(trfJetPt<0.)trfJetPt=0.01; if(trfJetPt>4.8)trfJetPt=4.79; + float trfJetPt = log(jetToTag.pt()/20000.); + if(trfJetPt<0.) trfJetPt=0.01; + if(trfJetPt>4.8) trfJetPt=4.79; std::string pref = ""; if (m_runModus=="reference") { - if (jetpt >= m_pTjetmin && fabs(jeteta) <= 2.5) { + if (jetpt >= m_pTjetmin && std::abs(jeteta) <= 2.5) { int label = xAOD::jetFlavourLabel(&jetToTag); double deltaRtoClosestB = 999.;//, deltaRtoClosestC = 999.; if (jetToTag.getAttribute("TruthLabelDeltaR_B",deltaRtoClosestB)) { @@ -350,10 +340,9 @@ namespace Analysis m_ncjet++; } } + if (pref == "B" || pref == "C" || pref == "U") { std::string hDir = "/RefFile/"+m_SVmode+"/"+author+"/"+pref+"/"; - //std::cout<<"SVTAG tag histohelper: " << m_histoHelper << std::endl; - //m_histoHelper->print(); if (m_SVmode == "SV1") m_histoHelper->fillHisto(hDir+"N2TNormSV1",(float)NSVPair); if (m_SVmode == "SV2") m_histoHelper->fillHisto(hDir+"N2TNormSV2",(float)NSVPair); if (NSVPair > 0 && ambtot > 0.) { @@ -366,8 +355,8 @@ namespace Analysis } if (m_SVmode == "SV2") { m_histoHelper->fillHisto(hDir+"N2TEffSV2",(float)NSVPair); - if(m_usePtSV2)m_histoHelper->fillHisto(hDir+"TridimMENPt",ambtotp,xratiop,trfJetPt); - else m_histoHelper->fillHisto(hDir+"TridimMEN2T",ambtotp,xratiop,log((float)NSVPair)); + if(m_usePtSV2) m_histoHelper->fillHisto(hDir+"TridimMENPt",ambtotp,xratiop,trfJetPt); + else m_histoHelper->fillHisto(hDir+"TridimMEN2T",ambtotp,xratiop,log((float)NSVPair)); } } } @@ -474,9 +463,6 @@ namespace Analysis return StatusCode::SUCCESS; } - void SVTag::finalizeHistos() { - } - void SVTag::printParameterSettings() { ATH_MSG_INFO("#BTAG# " << name() << "Parameter settings "); ATH_MSG_INFO("#BTAG# I am in " << m_runModus << " modus."); @@ -487,65 +473,34 @@ namespace Analysis double SVTag::get3DSignificance(const xAOD::Vertex& priVertex, std::vector<const xAOD::Vertex*>& secVertex, const Amg::Vector3D jetDirection) const { - // double SVTag::get3DSignificance(const Trk::RecVertex & priVertex, - // std::vector<const Trk::RecVertex* > & secVertex, - // const Amg::Vector3D jetDirection) { std::vector<Amg::Vector3D> positions; std::vector<AmgSymMatrix(3)> weightMatrices; - - std::vector<const xAOD::Vertex*>::const_iterator secEnd = secVertex.end(); - - for (std::vector<const xAOD::Vertex*>::const_iterator secIter = secVertex.begin(); - secIter != secEnd; ++secIter) - { - // Amg::Vector3D position = (*secIter)->position(); - // Amg::Vector3D position; - // position[0]=(*secIter)->position().x(); - // position[1]=(*secIter)->position().y(); - // position[2]=(*secIter)->position().z(); - // positions.push_back(position); - positions.push_back((*secIter)->position()); - - weightMatrices.push_back((*secIter)->covariancePosition().inverse()); - } - // If multiple secondary vertices were reconstructed, then a common (weighted) position will be used // in the signed decay length significance calculation - Amg::Vector3D weightTimesPosition(0.,0.,0.); AmgSymMatrix(3) sumWeights; sumWeights.setZero(); - int count=0; - for (std::vector<const xAOD::Vertex*>::const_iterator secIter = secVertex.begin(); - secIter != secEnd; ++secIter) { - - weightTimesPosition+=(weightMatrices[count])*positions[count]; - sumWeights+=(weightMatrices[count]); - ++count; + for (const auto& vtx : secVertex) { + positions.push_back(vtx->position()); + weightMatrices.push_back(vtx->covariancePosition().inverse()); + weightTimesPosition += weightMatrices.back()*positions.back(); + sumWeights += weightMatrices.back(); } // now we have the sum of the weights, let's invert this matrix to get the mean covariance matrix - -// int failed(0); - // return value of m.inverse() on a non invertible matrix is undefined -// AmgSymMatrix(3) meanCovariance=sumWeights.inverse(); -// if (failed!=0) { -// ATH_MSG_ERROR("#BTAG# Could not invert sum of sec vtx matrices"); -// return 0.; -// } bool invertible; AmgSymMatrix(3) meanCovariance; meanCovariance.setZero(); sumWeights.computeInverseWithCheck(meanCovariance, invertible); - if (! invertible) { + if (!invertible) { ATH_MSG_WARNING("#BTAG# Could not invert sum of sec vtx matrices"); return 0.; } // calculate the weighted mean secondary vertex position - Amg::Vector3D meanPosition=meanCovariance*weightTimesPosition; + Amg::Vector3D meanPosition = meanCovariance*weightTimesPosition; // add the mean covariance matrix of the secondary vertices to that of the primary vertex // this is the covariance matrix for the decay length @@ -560,19 +515,19 @@ namespace Analysis double Lz = meanPosition[2]-priVertex.position().z(); const double decaylength = sqrt(Lx*Lx + Ly*Ly + Lz*Lz); - if(decaylength==0.)return 0.; //Safety + if(decaylength==0.) return 0.; //Safety const double inv_decaylength = 1. / decaylength; double dLdLx = Lx * inv_decaylength; double dLdLy = Ly * inv_decaylength; double dLdLz = Lz * inv_decaylength; - double decaylength_err2 = dLdLx*dLdLx*covariance(0,0) + - dLdLy*dLdLy*covariance(1,1) + - dLdLz*dLdLz*covariance(2,2) + - 2.*dLdLx*dLdLy*covariance(0,1) + - 2.*dLdLx*dLdLz*covariance(0,2) + - 2.*dLdLy*dLdLz*covariance(1,2); - if(decaylength_err2<=0.)return 0.; //Something is wrong + double decaylength_err2 = (dLdLx*dLdLx*covariance(0,0) + + dLdLy*dLdLy*covariance(1,1) + + dLdLz*dLdLz*covariance(2,2) + + 2.*dLdLx*dLdLy*covariance(0,1) + + 2.*dLdLx*dLdLz*covariance(0,2) + + 2.*dLdLy*dLdLz*covariance(1,2)); + if(decaylength_err2<=0.) return 0.; //Something is wrong double decaylength_err = sqrt(decaylength_err2); double decaylength_significance = 0.; @@ -593,26 +548,23 @@ namespace Analysis bool success=true; AmgSymMatrix(3) Wgt; - for (auto & svrt : secVertex) + for (const auto & svrt : secVertex) { Amg::Vector3D SVmPV = svrt->position()-priVertex.position(); - AmgSymMatrix(3) SVmPVCov=svrt->covariancePosition()+priVertex.covariancePosition(); + AmgSymMatrix(3) SVmPVCov = svrt->covariancePosition()+priVertex.covariancePosition(); SVmPVCov.computeInverseWithCheck(Wgt, success); if( !success || Wgt(0,0)<=0. || Wgt(1,1)<=0. || Wgt(2,2)<=0. )continue; //Inversion failure - double significance=SVmPV.transpose()*Wgt*SVmPV; + double significance = SVmPV.transpose()*Wgt*SVmPV; if(significance <= 0.) continue; //Something is still wrong! - significance=std::sqrt(significance); - if(SVmPV.dot(jetDirection)<0.)significance *= -1.; + significance = std::sqrt(significance); + if(SVmPV.dot(jetDirection)<0.) significance *= -1.; Sig3D.push_back(significance); } - if(Sig3D.size()==0)return 0.; + if(Sig3D.size()==0) return 0.; return *std::max_element(Sig3D.begin(),Sig3D.end()); - //return std::accumulate(Sig3D.begin(),Sig3D.end(),0.); } - - } diff --git a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx index 4380a94788b36f256682c45f32f8e904e336dae0..4873973e3501579e7d5163c7b7b000d7c52e33e8 100644 --- a/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx +++ b/PhysicsAnalysis/MCTruthClassifier/Root/MCTruthClassifierGen.cxx @@ -2073,7 +2073,7 @@ MCTruthClassifier::findEndVert(const xAOD::TruthParticle* thePart) for (unsigned int ipOut = 0; ipOut < EndVert->nOutgoingParticles(); ipOut++) { const xAOD::TruthParticle* itrDaug = EndVert->outgoingParticle(ipOut); if (!itrDaug) continue; - if (((itrDaug &&thePart && HepMC::is_same_generator_particle(itrDaug,thePart)) || + if (((itrDaug && HepMC::is_same_generator_particle(itrDaug,thePart)) || // brem on generator level for tau (EndVert->nOutgoingParticles() == 1 && EndVert->nIncomingParticles() == 1 && !HepMC::is_simulation_particle(itrDaug) && !HepMC::is_simulation_particle(thePart))) && diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx index 864c4b76e8444511e92625dce3d43426e91aeb27..48b8813634ff88f1add7873ae2d589b039a48beb 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // Framework include(s): @@ -81,8 +81,6 @@ CommonEfficiencyTool::CommonEfficiencyTool(const std::string& sName) , m_eCheckTruth(TauAnalysisTools::Unknown) , m_bSFIsAvailable(false) , m_bSFIsAvailableChecked(false) - , m_bPtTauEtaCalibIsAvailable(false) - , m_bPtTauEtaCalibIsAvailableIsChecked(false) { declareProperty( "InputFilePath", m_sInputFilePath = "" ); declareProperty( "VarName", m_sVarName = "" ); @@ -159,21 +157,6 @@ StatusCode CommonEfficiencyTool::initialize() CP::CorrectionCode CommonEfficiencyTool::getEfficiencyScaleFactor(const xAOD::TauJet& xTau, double& dEfficiencyScaleFactor, unsigned int iRunNumber, unsigned int iMu) { - // FIXME: remove this once R22 SF files are derived (they will all be parametrised vs MVA pt) - // save calo based TES if not available - if (not m_bPtTauEtaCalibIsAvailableIsChecked) - { - m_bPtTauEtaCalibIsAvailable = xTau.isAvailable<float>("ptTauEtaCalib"); - m_bPtTauEtaCalibIsAvailableIsChecked = true; - } - if (not m_bPtTauEtaCalibIsAvailable) - { - xTau.auxdecor<float>("ptTauEtaCalib") = xTau.pt(); - xTau.auxdecor<float>("etaTauEtaCalib") = xTau.eta(); - xTau.auxdecor<float>("phiTauEtaCalib") = xTau.phi(); - xTau.auxdecor<float>("mTauEtaCalib") = xTau.m(); - } - // check which true state is requested if (!m_bSkipTruthMatchCheck and getTruthParticleType(xTau) != m_eCheckTruth) { @@ -297,21 +280,6 @@ CP::CorrectionCode CommonEfficiencyTool::applyEfficiencyScaleFactor(const xAOD:: { double dSf = 0.; - // FIXME: remove this once R22 SF files are derived (they will all be parametrised vs MVA pt) - // save calo based TES if not available - if (not m_bPtTauEtaCalibIsAvailableIsChecked) - { - m_bPtTauEtaCalibIsAvailable = xTau.isAvailable<float>("ptTauEtaCalib"); - m_bPtTauEtaCalibIsAvailableIsChecked = true; - } - if (not m_bPtTauEtaCalibIsAvailable) - { - xTau.auxdecor<float>("ptTauEtaCalib") = xTau.pt(); - xTau.auxdecor<float>("etaTauEtaCalib") = xTau.eta(); - xTau.auxdecor<float>("phiTauEtaCalib") = xTau.phi(); - xTau.auxdecor<float>("mTauEtaCalib") = xTau.m(); - } - if (!m_bSFIsAvailableChecked) { m_bSFIsAvailable = xTau.isAvailable< double >(m_sVarName); diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauEfficiencyCorrectionsTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauEfficiencyCorrectionsTool.cxx index 06bb8f4085e53df393454d2ddfb9810099501632..f1b71f33d2eb7deae5aff165113366dd93b706d7 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauEfficiencyCorrectionsTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauEfficiencyCorrectionsTool.cxx @@ -1,6 +1,6 @@ /** * - * @copyright Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + * @copyright Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration * * @file DiTauEfficiencyCorrectionsTool.cxx * @brief Class for ditau efficiency correction scale factors and uncertainties @@ -29,9 +29,7 @@ DiTauEfficiencyCorrectionsTool::DiTauEfficiencyCorrectionsTool( const std::strin , m_bIsConfigured(false) { declareProperty( "EfficiencyCorrectionTypes", m_vEfficiencyCorrectionTypes = {} ); - declareProperty( "InputFilePathRecoHadTau", m_sInputFilePathRecoHadTau = "" ); declareProperty( "InputFilePathJetIDHadTau", m_sInputFilePathJetIDHadTau = "" ); - declareProperty( "VarNameRecoHadTau", m_sVarNameRecoHadTau = "" ); declareProperty( "VarNameJetIDHadTau", m_sVarNameJetIDHadTau = "" ); declareProperty( "RecommendationTag", m_sRecommendationTag = "2017-moriond" ); declareProperty( "JetIDLevel", m_iJetIDLevel = (int)JETIDBDTTIGHT ); @@ -111,8 +109,7 @@ void DiTauEfficiencyCorrectionsTool::printConfig() const for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes) { ATH_MSG_DEBUG( " EfficiencyCorrectionTypes " << iEfficiencyCorrectionType ); } - ATH_MSG_DEBUG( " InputFilePathRecoHadTau " << m_sInputFilePathRecoHadTau ); - ATH_MSG_DEBUG( " VarNameRecoHadTau " << m_sVarNameRecoHadTau ); + ATH_MSG_DEBUG( " InputFilePathJetIDHadTau " << m_sInputFilePathJetIDHadTau ); ATH_MSG_DEBUG( " VarNameJetIDHadTau " << m_sVarNameJetIDHadTau ); ATH_MSG_DEBUG( " RecommendationTag " << m_sRecommendationTag ); } diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx index 085eed7887d2e9ae0fdf00598c0f0bf3f14fcb28..34880102376e55f1590f49f321d414877d930b95 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx @@ -65,16 +65,7 @@ void DiTauTruthMatchingTool::getTruth(const xAOD::DiTauJet& xDiTau) } //______________________________________________________________________________ -void DiTauTruthMatchingTool::applyTruthMatch(const xAOD::DiTauJet& xDiTau) -{ - // this function only exists to have the same interface functions like - // TauTruthMatchingTool - getTruth(xDiTau); - return; -} - -//______________________________________________________________________________ -void DiTauTruthMatchingTool::applyTruthMatch(const std::vector<const xAOD::DiTauJet*>& vDiTaus) +void DiTauTruthMatchingTool::getTruth(const std::vector<const xAOD::DiTauJet*>& vDiTaus) { for (auto xDiTau : vDiTaus) getTruth(*xDiTau); diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx index 98ab118f78ded7eb3f55772ea933a0e86c114390..c18b575266def9e787e80b467b3515508216983d 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx @@ -106,15 +106,7 @@ const xAOD::TruthParticle* TauTruthMatchingTool::getTruth(const xAOD::TauJet& xT } //______________________________________________________________________________ -// FIXME: remove this method at the next occasion -const xAOD::TruthParticle* TauTruthMatchingTool::applyTruthMatch(const xAOD::TauJet& xTau) -{ - // this function only exists for historical reasons - return getTruth(xTau); -} - -//______________________________________________________________________________ -std::vector<const xAOD::TruthParticle*> TauTruthMatchingTool::applyTruthMatch(const std::vector<const xAOD::TauJet*>& vTaus) +std::vector<const xAOD::TruthParticle*> TauTruthMatchingTool::getTruth(const std::vector<const xAOD::TauJet*>& vTaus) { std::vector<const xAOD::TruthParticle*> vTruths; for (auto xTau : vTaus) @@ -159,48 +151,6 @@ TLorentzVector TauTruthMatchingTool::getTruthTauP4Vis(const xAOD::TruthParticle& return vTLV; } -//______________________________________________________________________________ -TLorentzVector TauTruthMatchingTool::getTruthTauP4Prompt(const xAOD::TauJet& xTau) -{ - const xAOD::TruthParticle* xTruthTau = getTruth(xTau); - TLorentzVector vTLV; - if (xTruthTau == nullptr) - { - ATH_MSG_INFO("no truth particle was found, returning TLorentzVector with all values equal to 0"); - return vTLV; - } - - static const SG::AuxElement::ConstAccessor<double> accPtPrompt("pt_prompt"); - static const SG::AuxElement::ConstAccessor<double> accEtaPrompt("eta_prompt"); - static const SG::AuxElement::ConstAccessor<double> accPhiPrompt("phi_prompt"); - static const SG::AuxElement::ConstAccessor<double> accMPrompt("m_prompt"); - vTLV.SetPtEtaPhiM( - accPtPrompt(*xTruthTau), - accEtaPrompt(*xTruthTau), - accPhiPrompt(*xTruthTau), - accMPrompt(*xTruthTau)); - return vTLV; -} - -//______________________________________________________________________________ -TLorentzVector TauTruthMatchingTool::getTruthTauP4Prompt(const xAOD::TruthParticle& xTruthTau) const -{ - TLorentzVector vTLV; - if (!xTruthTau.isAvailable<double>("pt_prompt")) - return vTLV; - - static const SG::AuxElement::ConstAccessor<double> accPtPrompt("pt_prompt"); - static const SG::AuxElement::ConstAccessor<double> accEtaPrompt("eta_prompt"); - static const SG::AuxElement::ConstAccessor<double> accPhiPrompt("phi_prompt"); - static const SG::AuxElement::ConstAccessor<double> accMPrompt("m_prompt"); - vTLV.SetPtEtaPhiM( - accPtPrompt(xTruthTau), - accEtaPrompt(xTruthTau), - accPhiPrompt(xTruthTau), - accMPrompt(xTruthTau)); - return vTLV; -} - //______________________________________________________________________________ TLorentzVector TauTruthMatchingTool::getTruthTauP4Invis(const xAOD::TauJet& xTau) { diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h index 901510d2868303565c7f278f7af189d1c5690a01..ef1d590e5c967da844a5a3c6704d3dd78739fd9f 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef TAUANALYSISTOOLS_COMMONEFFICIENCYTOOL_H @@ -151,8 +151,6 @@ protected: bool m_bSFIsAvailable; bool m_bSFIsAvailableChecked; - bool m_bPtTauEtaCalibIsAvailable; - bool m_bPtTauEtaCalibIsAvailableIsChecked; bool m_bSplitMu; bool m_bSplitMCCampaign; std::string m_sMCCampaign; diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauEfficiencyCorrectionsTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauEfficiencyCorrectionsTool.h index 36baa8fcbdbbe17ab891a5eeb56f97d02bb45fec..c7dd7eebb4f2542a7629cb0a27d747859c783908 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauEfficiencyCorrectionsTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauEfficiencyCorrectionsTool.h @@ -1,6 +1,6 @@ /** * - * @copyright Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + * @copyright Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration * * @file DiTauEfficiencyCorrectionsTool.h * @author Guillermo Hamity (ghamity@cern.ch) @@ -112,9 +112,7 @@ private: std::vector<int> m_vEfficiencyCorrectionTypes; std::vector< asg::AnaToolHandle<IDiTauEfficiencyCorrectionsTool>* > m_vCommonEfficiencyTools; - std::string m_sInputFilePathRecoHadTau; std::string m_sInputFilePathJetIDHadTau; - std::string m_sVarNameRecoHadTau; std::string m_sVarNameJetIDHadTau; std::string m_sRecommendationTag; bool m_bSkipTruthMatchCheck; diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauTruthMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauTruthMatchingTool.h index dcea908b75d4e2473be61de16f5b7d27264c5345..f8983ff44bfde663d211d4e83debbb34e0761612 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauTruthMatchingTool.h @@ -45,11 +45,7 @@ public: // Interface functions * if no truth particle was found a null pointer is returned */ virtual void getTruth(const xAOD::DiTauJet& xDiTau); - /** apply match to a single tau */ - virtual void applyTruthMatch(const xAOD::DiTauJet& xDiTau); - - /** apply match to all taus in a vector*/ - virtual void applyTruthMatch(const std::vector<const xAOD::DiTauJet*>& vDiTaus); + virtual void getTruth(const std::vector<const xAOD::DiTauJet*>& vDiTaus); private: // private helper functions diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h index aff089373f24cb021465d70e643279d9af53c666..ff8634e5f83315a4ed31fa835bef8a01859333b3 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h @@ -43,14 +43,10 @@ public: /** initialize the tool*/ virtual StatusCode initialize() = 0; - /** apply match to a single ditau jet*/ - virtual void applyTruthMatch(const xAOD::DiTauJet& xDiTau) = 0; - - /** apply match to all ditaus in a vector*/ - virtual void applyTruthMatch(const std::vector<const xAOD::DiTauJet*>& vDiTaus) = 0; - /** get pointer to truth tau, if no truth tau was found a null pointer is returned*/ virtual void getTruth(const xAOD::DiTauJet& xDiTau) = 0; + + virtual void getTruth(const std::vector<const xAOD::DiTauJet*>& vDiTaus) = 0; }; // class IDiTauTruthMatchingTool diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h index ef645b3e46776223cc098f5b8e1638eb323f90f9..a6fcc6a33b9c2170d69929cf814fc8db3c3128ef 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h @@ -39,27 +39,18 @@ public: // initialize the tool virtual StatusCode initialize() = 0; - // apply match to a single tau - virtual const xAOD::TruthParticle* applyTruthMatch(const xAOD::TauJet& xTau) = 0; - - // apply match to all taus in a vector - virtual std::vector<const xAOD::TruthParticle*> applyTruthMatch(const std::vector<const xAOD::TauJet*>& vTaus) = 0; - virtual std::unique_ptr<ITruthTausEvent> getEvent() const = 0; // get pointer to truth tau, if no truth tau was found a null pointer is returned virtual const xAOD::TruthParticle* getTruth(const xAOD::TauJet& xTau) = 0; virtual const xAOD::TruthParticle* getTruth(const xAOD::TauJet& xTau, ITruthTausEvent& truthTausEvent) const = 0; + virtual std::vector<const xAOD::TruthParticle*> getTruth(const std::vector<const xAOD::TauJet*>& vTaus) = 0; // wrapper function to get truth tau visible TLorentzvector virtual TLorentzVector getTruthTauP4Vis(const xAOD::TauJet& xTau) = 0; virtual TLorentzVector getTruthTauP4Vis(const xAOD::TruthParticle& xTruthTau) const = 0; - // wrapper function to get truth tau prompt TLorentzvector - virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TauJet& xTau) = 0; - virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TruthParticle& xTruthTau) const = 0; - // wrapper function to get truth tau invisible TLorentzvector virtual TLorentzVector getTruthTauP4Invis(const xAOD::TauJet& xTau) = 0; virtual TLorentzVector getTruthTauP4Invis(const xAOD::TruthParticle& xTruthTau) const = 0; diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h index f0275ee065b7b80511e7b3ae1e5dd87850aa93cb..b38a236d9df5e6c3a48d37a54b217acfbeb36c0c 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h @@ -42,12 +42,7 @@ public: // Interface functions virtual const xAOD::TruthParticle* getTruth(const xAOD::TauJet& xTau) override final; virtual const xAOD::TruthParticle* getTruth(const xAOD::TauJet& xTau, ITruthTausEvent& truthTausEVent) const override final; - - // apply match to a single tau - virtual const xAOD::TruthParticle* applyTruthMatch(const xAOD::TauJet& xTau) override final; - - // apply match to all taus in a vector - virtual std::vector<const xAOD::TruthParticle*> applyTruthMatch(const std::vector<const xAOD::TauJet*>& vTaus) override final; + virtual std::vector<const xAOD::TruthParticle*> getTruth(const std::vector<const xAOD::TauJet*>& vTaus) override final; public: // Wrapper functions @@ -55,10 +50,6 @@ public: // Wrapper functions virtual TLorentzVector getTruthTauP4Vis(const xAOD::TauJet& xTau) override final; virtual TLorentzVector getTruthTauP4Vis(const xAOD::TruthParticle& xTruthTau) const override final; - // wrapper function to get truth tau prompt TLorentzvector - virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TauJet& xTau) override final; - virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TruthParticle& xTruthTau) const override final; - // wrapper function to get truth tau invisible TLorentzvector virtual TLorentzVector getTruthTauP4Invis(const xAOD::TauJet& xTau) override final; virtual TLorentzVector getTruthTauP4Invis(const xAOD::TruthParticle& xTruthTau) const override final; diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-DiTauTruthMatchingTool.rst b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-DiTauTruthMatchingTool.rst index a4ec13398e229b1c7fc5d63660aab980427279be..071aa062b52893e05b16c58fcdb6bb448ea38647 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-DiTauTruthMatchingTool.rst +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-DiTauTruthMatchingTool.rst @@ -38,8 +38,8 @@ file or generates the TruthTau container if necessary. (For more information see The truth matching is done for either a single xAOD DiTauJet object or for a DiTauJets container with these functions:: - void DiTauTruthMatchingTool::applyTruthMatch(const xAOD::DiTauJet& xDiTau); - void DiTauTruthMatchingTool::applyTruthMatch(const std::vector<const xAOD::DiTauJet*>& vDiTaus); + void DiTauTruthMatchingTool::getTruth(const xAOD::DiTauJet& xDiTau); + void DiTauTruthMatchingTool::getTruth(const std::vector<const xAOD::DiTauJet*>& vDiTaus); ------------------ @@ -92,7 +92,7 @@ Tool configuration Output ------ -Calling applyTruthMatch(xDiTau) adds a vector of element links to the truth lepton +Calling getTruth(xDiTau) adds a vector of element links to the truth lepton particle as decoration: ``truthParticleLink``. Those can be accessed via:: auto vElementLinks = xDiTau.auxdata<std::vector<ElementLink<xAOD::TruthParticleContainer>>>("truthParticleLinks"); @@ -102,7 +102,7 @@ In addition two variables of type char are decorated to the DiTauJet * ``IsTruthMatched`` indicating if two leading subjets match to truth leptons * ``IsTruthHadronic`` indicating if two leading subjets match to truth hadronic tau decays -After calling applyTruthMatch(xDiTau) those information can be retrieved via:: +After calling getTruth(xDiTau) those information can be retrieved via:: bool bMatched = (bool)xDiTau.auxdata<char>("IsTruthMatched") bool bHadronic = (bool)xDiTau.auxdata<char>("IsTruthHadronic") diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauTruthMatchingTool.rst b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauTruthMatchingTool.rst index 1f0bdeae1029a2afc6284a3377541acae9057bdd..2fbdb8253162b3af55d3c2c08cdcae0d4b5e19ea 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauTruthMatchingTool.rst +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauTruthMatchingTool.rst @@ -52,17 +52,16 @@ MCTruthClassifier). In this case it is necessary to have a sufficiently complete TruthParticle container available, i.e. one should not have slimmed the tau decay products from the container. Information on how to change the default container names can be found in the section `Tool configuration`_. -The truth matching is done for a single xAOD tau object with one of these -functions:: +The truth matching is done for a single xAOD tau object with one of this +function:: - xAOD::TruthParticle* TauTruthMatchingTool::applyTruthMatch(const xAOD::TauJet& xTau) xAOD::TruthParticle* TauTruthMatchingTool::getTruth(const xAOD::TauJet& xTau) which returns a pointer to the truth lepton particle the xAOD tau object was matched to. If there was no match found, the return value is ``NULL``. Similarly for a vector of xAOD tau objects one can use this function:: - std::vector<xAOD::TruthParticle*> TauTruthMatchingTool::applyTruthMatch(const std::vector<const xAOD::TauJet*>& vTaus) + std::vector<xAOD::TruthParticle*> TauTruthMatchingTool::getTruth(const std::vector<const xAOD::TauJet*>& vTaus) which returns a vector of pointer to the matched truth lepton particle in the same order. Note, that again, if there is no truth particle found, the entry in @@ -118,7 +117,7 @@ Tool configuration Output ------ -Calling applyTruthMatch(xTau) or getTruth(xTau) adds a link to the truth lepton +Calling getTruth(xTau) adds a link to the truth lepton particle as decoration: ``truthParticleLink``. A link to the matched truth jet is decorated as well with name ``truthJetLink``. Please check the validity of this link before trying to access the linked truth jet or make use of the @@ -171,10 +170,6 @@ MCTruthClassifier (i.e. branches particleType and particleOrigin). - double - The truth invisible 4 momentum components - * - pt_prompt, eta_prompt, phi_prompt, m_prompt - - double - - The 4 momentum components of the first occurrence of the tau - * - DecayModeVector - std::vector<int> - pdg ID's of stable decay products of the tau decay stored as a vector @@ -226,7 +221,7 @@ functions are available ``TauAnalysisTools::TruthMatchedParticleType`` can be found in `Enums.h <https://svnweb.cern.ch/trac/atlasoff/browser/PhysicsAnalysis/TauID/TauAnalysisTools/trunk/TauAnalysisTools/Enums.h>`_ -* functions returning the TLorentzVector of the visible, invisible and prompt +* functions returning the TLorentzVector of the visible and invisible components:: virtual TLorentzVector getTruthTauP4Vis(const xAOD::TauJet& xTau) const; @@ -235,9 +230,6 @@ functions are available virtual TLorentzVector getTruthTauP4Invis(const xAOD::TauJet& xTau) const; virtual TLorentzVector getTruthTauP4Invis(const xAOD::TruthParticle& xTruthTau) const; - virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TauJet& xTau) const; - virtual TLorentzVector getTruthTauP4Prompt(const xAOD::TruthParticle& xTruthTau) const; - --- FAQ --- @@ -258,12 +250,6 @@ following:: ... } -**Question:** Is there any difference between applyTruthMatch and getTruth? ---------------------------------------------------------------------------- - -**Answer:** No, it is basically the same function, applyTruthMatch is for -backwards compatibility, so better call getTruth to reduce overhead. - **Question:** How do I check if the truth matched particle is an electron, muon, tau? ------------------------------------------------------------------------------------- diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.cxx index 43ea9b048d39f20c3b7423827976dfa587f8cd09..23de5a25d6a2a4f15b59ef07e401056eab719f5e 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration // =============================================================================== // Macro to compute the gluon initiated jets fraction in your sample/selection // To run the macro: .x MakeQuarkGluonFractionPlots.cxx+("config.txt") @@ -165,7 +165,7 @@ MakeQuarkGluonFractionPlots::MakeQuarkGluonFractionPlots(const std::string& file * Drawing methods * *******************************************/ // Draw histograms from a map -void MakeQuarkGluonFractionPlots::drawhistos(std::map<std::string, TH2D*> histos, const std::string& psfilename){ +void MakeQuarkGluonFractionPlots::drawhistos(const std::map<std::string, TH2D*> & histos, const std::string& psfilename){ TCanvas c1; c1.SetLogx(); for (std::map<std::string, TH2D*>::iterator it = histos.begin() ; it != histos.end(); ++it){ @@ -177,7 +177,7 @@ void MakeQuarkGluonFractionPlots::drawhistos(std::map<std::string, TH2D*> histos } } // Draw histograms from a vector -void MakeQuarkGluonFractionPlots::drawhistos(std::vector<TH2D*> histos, const std::string& psfilename){ +void MakeQuarkGluonFractionPlots::drawhistos(const std::vector<TH2D*> & histos, const std::string& psfilename){ TCanvas c1; c1.SetLogx(); for (std::vector<TH2D*>::iterator it = histos.begin() ; it != histos.end(); ++it){ @@ -257,11 +257,11 @@ void MakeQuarkGluonFractionPlots::DumpFileToMap(std::map<std::string, TH2D*> &h_ //QGF File creation void MakeQuarkGluonFractionPlots::CreateQGFFile(const std::string& prename, const std::map<std::string, TH2D*>& h_input, - std::vector< std::map<std::string, TH2D*> > h_input_1P, - std::vector< std::map<std::string, TH2D*> > h_input_1PVar, - std::vector< std::map<std::string, TH2D*> > h_input_2P, - std::vector< std::map<std::string, TH2D*> > h_input_2PUp, - std::vector< std::map<std::string, TH2D*> > h_input_2PDown){ + const std::vector< std::map<std::string, TH2D*> > & h_input_1P, + const std::vector< std::map<std::string, TH2D*> > & h_input_1PVar, + const std::vector< std::map<std::string, TH2D*> > & h_input_2P, + const std::vector< std::map<std::string, TH2D*> > & h_input_2PUp, + const std::vector< std::map<std::string, TH2D*> > & h_input_2PDown){ //Since I am here, all histograms have already been retrieved! printf("\n %s\n Computing the gluon fraction in %s channel\n %s\n",std::string(75,'%').c_str(),prename.c_str(),std::string(75,'%').c_str()); std::string outputName = prename + "_" + m_OutputFile; @@ -327,7 +327,7 @@ void MakeQuarkGluonFractionPlots::CreateQGFFile(const std::string& prename, c1.Print((psfilename+"]").c_str()); } // Evaluate Delta -std::vector<TH2D*> MakeQuarkGluonFractionPlots::getDelta (std::vector<TH2D*> h_nom, std::vector<TH2D*> h_var, double scale, const std::string& prehistname){ +std::vector<TH2D*> MakeQuarkGluonFractionPlots::getDelta (const std::vector<TH2D*> & h_nom, std::vector<TH2D*> h_var, double scale, const std::string& prehistname){ std::vector<TH2D*> QuarkGluonDiffFractionhistos; if(h_nom.size() != h_var.size()) std::cout<<"ERROR: Systematic variation don't have the same number of histograms!\n"; std::string JetCollection = extractJetCollectionName((h_nom.at(0))->GetName()); @@ -347,7 +347,7 @@ std::vector<TH2D*> MakeQuarkGluonFractionPlots::getDelta (std::vector<TH2D*> h_n } //Evaluate uncertainty -std::vector<TH2D*> MakeQuarkGluonFractionPlots::evaluateQGFUncertaity(std::vector<std::vector<TH2D*> > f_1P, std::vector<std::vector<TH2D*> > f_2PUp, std::vector<std::vector<TH2D*> > f_2PDown, const std::string& channel){ +std::vector<TH2D*> MakeQuarkGluonFractionPlots::evaluateQGFUncertaity(const std::vector<std::vector<TH2D*> > & f_1P, const std::vector<std::vector<TH2D*> > & f_2PUp, const std::vector<std::vector<TH2D*> > &f_2PDown, const std::string& channel){ std::vector<TH2D*> histUnc; TH2D *h_tmp; std::string h_tmp_name; diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.h index 1994011fb924cc1c19551ec3bf68c3b629910336..3fb80c6ebd18eb02a70bf5729472450dc8d76009 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.h @@ -75,9 +75,9 @@ class MakeQuarkGluonFractionPlots { void checkFile(std::string filename); //function to draw histograms from a map - void drawhistos(std::map<std::string, TH2D*> histos, const std::string& psfilename); + void drawhistos(const std::map<std::string, TH2D*> & histos, const std::string& psfilename); //function to draw histograms from a vector - void drawhistos(std::vector<TH2D*> histos, const std::string& psfilename); + void drawhistos(const std::vector<TH2D*> & histos, const std::string& psfilename); //function to extract the JetCollectionName std::string extractJetCollectionName(const std::string& histoname); @@ -92,10 +92,10 @@ class MakeQuarkGluonFractionPlots { void createOutputFile(std::string filename,std::vector<TH2D*> histos, std::vector<TH2D*> histosUnc ); //Subtract - std::vector<TH2D*> getDelta (std::vector<TH2D*> h_nom, std::vector<TH2D*> h_var, double scale, const std::string& prehistname); + std::vector<TH2D*> getDelta (const std::vector<TH2D*> & h_nom, std::vector<TH2D*> h_var, double scale, const std::string& prehistname); //function to compute the total systematic uncertainty - std::vector<TH2D*> evaluateQGFUncertaity(std::vector<std::vector<TH2D*> > f_1P, std::vector<std::vector<TH2D*> > f_2PUp, std::vector<std::vector<TH2D*> > f_2PDown, const std::string& channel); + std::vector<TH2D*> evaluateQGFUncertaity(const std::vector<std::vector<TH2D*> > & f_1P, const std::vector<std::vector<TH2D*> > & f_2PUp, const std::vector<std::vector<TH2D*> > & f_2PDown, const std::string& channel); @@ -127,7 +127,7 @@ class MakeQuarkGluonFractionPlots { void DumpToMap(std::map<std::string, TH2D*> &h_map, const std::string& filename, const std::string& channel, const std::string& folder, const std::string& keyname, bool createMap); void DumpFileToMap(std::map<std::string, TH2D*> &h_map, std::string filename, std::string channel, std::string folder, std::string keyname, bool createMap); - void CreateQGFFile(const std::string& prename, const std::map<std::string, TH2D*>& h_input,std::vector< std::map<std::string, TH2D*> > h_input_1P,std::vector< std::map<std::string, TH2D*> > h_input_1PVar,std::vector< std::map<std::string, TH2D*> > h_input_2P,std::vector< std::map<std::string, TH2D*> > h_input_2PUp,std::vector< std::map<std::string, TH2D*> > h_input_2PDown); + void CreateQGFFile(const std::string& prename, const std::map<std::string, TH2D*>& h_input,const std::vector< std::map<std::string, TH2D*> > & h_input_1P,const std::vector< std::map<std::string, TH2D*> > & h_input_1PVar,const std::vector< std::map<std::string, TH2D*> > & h_input_2P,const std::vector< std::map<std::string, TH2D*> > & h_input_2PUp,const std::vector< std::map<std::string, TH2D*> > & h_input_2PDown); }; diff --git a/Reconstruction/DiTauRec/DiTauRec/CellFinder.h b/Reconstruction/DiTauRec/DiTauRec/CellFinder.h index 5422f0837f15ee42aa7806fddc804bead86b4efc..0c4e5834269d41d21170865ad04806e4d610f167 100644 --- a/Reconstruction/DiTauRec/DiTauRec/CellFinder.h +++ b/Reconstruction/DiTauRec/DiTauRec/CellFinder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef DITAUREC_CELLFINDER_H diff --git a/Reconstruction/DiTauRec/DiTauRec/DiTauTrackFinder.h b/Reconstruction/DiTauRec/DiTauRec/DiTauTrackFinder.h index d7a4df235aed0c7f11e0e7a1fd43780a2299ca9d..bac1539f8ac0e3d5019426ae5d873b9dba2bb9a8 100644 --- a/Reconstruction/DiTauRec/DiTauRec/DiTauTrackFinder.h +++ b/Reconstruction/DiTauRec/DiTauRec/DiTauTrackFinder.h @@ -67,7 +67,6 @@ class DiTauTrackFinder : public DiTauToolBase { SG::ReadHandleKey<xAOD::TrackParticleContainer> m_TrackParticleContainerName { this, "TrackParticleContainer", "InDetTrackParticles", "" }; ToolHandle<Trk::ITrackSelectorTool> m_TrackSelectorTool; - // ToolHandle< Trk::IParticleCaloExtensionTool > m_ParticleCaloExtensionTool; }; diff --git a/Reconstruction/DiTauRec/DiTauRec/SubjetBuilder.h b/Reconstruction/DiTauRec/DiTauRec/SubjetBuilder.h index 643bc1c0cbf80badfd2243a187da3f43979c7c7b..bf5fd6818014f6a34337b2e8f8f1350e68b18ce0 100644 --- a/Reconstruction/DiTauRec/DiTauRec/SubjetBuilder.h +++ b/Reconstruction/DiTauRec/DiTauRec/SubjetBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef DITAUREC_SUBJETBUILDER_H @@ -33,11 +33,8 @@ class SubjetBuilder : public DiTauToolBase { private: float m_Rsubjet; - int m_Nsubjet; float m_ptmin; - // fastjet::Filter m_SubjetFilter; - }; #endif // DITAUREC_SUBJETBUILDER_H diff --git a/Reconstruction/DiTauRec/python/DiTauToolsConfig.py b/Reconstruction/DiTauRec/python/DiTauToolsConfig.py index 573e8023b32cffa936cf54f26e9a2c4e3236cbe5..91bad90ed3c85852c2158a1e68ea7aa433e90da0 100644 --- a/Reconstruction/DiTauRec/python/DiTauToolsConfig.py +++ b/Reconstruction/DiTauRec/python/DiTauToolsConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -15,7 +15,6 @@ def SubjetBuilderCfg(ConfigFlags, name="DiTauRec_SubjetBuilder", **kwargs): acc = ComponentAccumulator() kwargs.setdefault("Rsubjet", 0.2) - kwargs.setdefault("Nsubjet", 4) kwargs.setdefault("ptminsubjet", 10000) acc.setPrivateTools(CompFactory.SubjetBuilder(name, **kwargs)) diff --git a/Reconstruction/DiTauRec/src/CellFinder.cxx b/Reconstruction/DiTauRec/src/CellFinder.cxx index d89d0bb90f7149c4ac6e35579cfde25b80a33ca7..cb4f65739c673c486e0e211b1969af7077fe29f4 100644 --- a/Reconstruction/DiTauRec/src/CellFinder.cxx +++ b/Reconstruction/DiTauRec/src/CellFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ @@ -14,9 +14,6 @@ #include "fastjet/PseudoJet.hh" -#include "tauRecTools/KineUtils.h" - - CellFinder::CellFinder(const std::string& type, const std::string& name, const IInterface * parent) : @@ -88,11 +85,14 @@ StatusCode CellFinder::execute(DiTauCandidateData * data, // register cell hash as already seen cellSeen.set(cc->caloDDE()->calo_hash()); + TLorentzVector temp_cc_p4; + temp_cc_p4.SetPtEtaPhiM(cc->pt(), cc->eta(), cc->phi(), cc->m()); + // check if cell is in one of the subjets cones - double dR; for (const auto& subjet : vSubjets) { - dR = Tau1P3PKineUtils::deltaR(subjet.eta(), subjet.phi_std(), cc->eta(), cc->phi()); - if (dR < m_Rsubjet) { + TLorentzVector temp_sub_p4; + temp_sub_p4.SetPtEtaPhiM(subjet.pt(), subjet.eta(), subjet.phi_std(), subjet.m()); + if (temp_cc_p4.DeltaR(temp_sub_p4) < m_Rsubjet) { subjetCells.push_back(cc); } } diff --git a/Reconstruction/DiTauRec/src/DiTauTrackFinder.cxx b/Reconstruction/DiTauRec/src/DiTauTrackFinder.cxx index d999b7b8b468331a1c2a06bba868d048eac8f615..7a3c70cda453174f6a3ce06094fb6e6813c885f5 100644 --- a/Reconstruction/DiTauRec/src/DiTauTrackFinder.cxx +++ b/Reconstruction/DiTauRec/src/DiTauTrackFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "DiTauRec/DiTauTrackFinder.h" @@ -13,7 +13,6 @@ #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" #include "tauRecTools/TrackSort.h" -#include "tauRecTools/KineUtils.h" #include "StoreGate/ReadHandle.h" #include "fastjet/PseudoJet.hh" @@ -26,13 +25,11 @@ DiTauTrackFinder::DiTauTrackFinder(const std::string& type, m_MaxDrJet(1.0), m_MaxDrSubjet(0.2), m_TrackSelectorTool("") - // m_ParticleCaloExtensionTool("") { declareInterface<DiTauToolBase > (this); declareProperty("MaxDrJet", m_MaxDrJet); declareProperty("MaxDrSubjet", m_MaxDrSubjet); declareProperty("TrackSelectorTool", m_TrackSelectorTool); - // declareProperty("ParticleCaloExtensionTool", m_ParticleCaloExtensionTool); } @@ -86,15 +83,19 @@ StatusCode DiTauTrackFinder::execute(DiTauCandidateData * data, // drop subjets without good tracks std::vector<fastjet::PseudoJet> vSubjets = data->subjets; - double nTracks; - double dR; + int nTracks; for (auto subjet_itr = vSubjets.begin(); subjet_itr != vSubjets.end(); ) { nTracks = 0; + + TLorentzVector temp_p4; + temp_p4.SetPtEtaPhiM(subjet_itr->pt(), subjet_itr->eta(), subjet_itr->phi_std(), subjet_itr->m()); + for (const auto& track : tauTracks) { - dR = Tau1P3PKineUtils::deltaR(subjet_itr->eta(), subjet_itr->phi_std(), track->eta(), track->phi()); - if (dR < m_MaxDrSubjet) nTracks++; + if ( temp_p4.DeltaR(track->p4()) < m_MaxDrSubjet) nTracks++; } + ATH_MSG_DEBUG("number of tracks in subjet: "<< nTracks); + if (nTracks == 0) { ATH_MSG_DEBUG("number of tracks is zero. Drop subjet"); subjet_itr = vSubjets.erase(subjet_itr); //point subjet_itr to the next element/end of the vector @@ -173,21 +174,21 @@ DiTauTrackFinder::DiTauTrackType DiTauTrackFinder::diTauTrackType(const DiTauCan xAOD::DiTauJet *pDiTau = data->xAODDiTau; - double dRJet = Tau1P3PKineUtils::deltaR(pDiTau->eta(), pDiTau->phi(), track->eta(), track->phi()); - // check if track is outside the jet ditau cone - if (dRJet > m_MaxDrJet) return OutsideTrack; + if ( pDiTau->p4().DeltaR(track->p4()) > m_MaxDrJet) return OutsideTrack; // check quality criteria bool goodTrack = m_TrackSelectorTool->decision(*track, pVertex); if (!goodTrack) return DiTauOtherTrack; // check if track is inside a subjet - double dR = 100; std::vector<fastjet::PseudoJet> vSubjets = data->subjets; for (const auto &subjet : vSubjets) { - dR = Tau1P3PKineUtils::deltaR(subjet.eta(), subjet.phi_std(), track->eta(), track->phi()); - if (dR < m_MaxDrSubjet) + + TLorentzVector temp_p4; + temp_p4.SetPtEtaPhiM(subjet.pt(), subjet.eta(), subjet.phi_std(), subjet.m()); + + if (temp_p4.DeltaR(track->p4()) < m_MaxDrSubjet) return DiTauSubjetTrack; } diff --git a/Reconstruction/DiTauRec/src/ElMuFinder.cxx b/Reconstruction/DiTauRec/src/ElMuFinder.cxx index 62736518873d53bdbc57d7b5a335948093babc29..893da8ab5bb953d0182e33459a0007b2fa0649bf 100644 --- a/Reconstruction/DiTauRec/src/ElMuFinder.cxx +++ b/Reconstruction/DiTauRec/src/ElMuFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "DiTauRec/ElMuFinder.h" @@ -10,8 +10,6 @@ #include "xAODEgamma/ElectronContainer.h" #include "xAODMuon/MuonContainer.h" -#include "tauRecTools/KineUtils.h" - #include "StoreGate/ReadHandle.h" @@ -62,7 +60,6 @@ StatusCode ElMuFinder::execute(DiTauCandidateData * data, SG::ReadHandle<xAOD::MuonContainer> pMuCont (m_muContName, ctx); // select electrons - float dR; data->electrons.clear(); if (pElCont.isValid()) { for (const auto *const el : *pElCont ) { @@ -77,8 +74,7 @@ StatusCode ElMuFinder::execute(DiTauCandidateData * data, ATH_MSG_DEBUG("Electron passes basic kinematic selection"); // electron inside seed jet area? - dR = Tau1P3PKineUtils::deltaR(data->seed->eta(), data->seed->phi(), el->eta(), el->phi()); - if (dR > data->Rjet) + if (data->seed->p4().DeltaR(el->p4()) > data->Rjet) continue; data->electrons.push_back(el); @@ -99,9 +95,9 @@ StatusCode ElMuFinder::execute(DiTauCandidateData * data, if (muonQuality >= m_muQual && std::abs(mu->eta()) >= m_muMaxEta) continue; // muon inside seed jet area? - dR = Tau1P3PKineUtils::deltaR(data->seed->eta(), data->seed->phi(), mu->eta(), mu->phi()); - if (dR > data->Rjet) + if (data->seed->p4().DeltaR(mu->p4()) > data->Rjet) continue; + data->muons.push_back(mu); } ATH_MSG_DEBUG("Number of good muons found: " << data->muons.size() ); diff --git a/Reconstruction/DiTauRec/src/IDvarCalculator.cxx b/Reconstruction/DiTauRec/src/IDvarCalculator.cxx index 28292099135f5a45cf9bf0ff1d72f9be9eb0158d..a311037b08e5c8150ecaf5f53c6e211f324d7986 100644 --- a/Reconstruction/DiTauRec/src/IDvarCalculator.cxx +++ b/Reconstruction/DiTauRec/src/IDvarCalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "DiTauRec/IDVarCalculator.h" @@ -7,8 +7,6 @@ #include "DiTauRec/DiTauCandidateData.h" #include "fastjet/PseudoJet.hh" -#include "tauRecTools/KineUtils.h" - IDVarCalculator::IDVarCalculator(const std::string& type, const std::string& name, @@ -79,22 +77,25 @@ StatusCode IDVarCalculator::execute(DiTauCandidateData * data, return StatusCode::SUCCESS; } - float Rcore = data->Rcore; - float Rsubjet = data->Rsubjet; float f_core; - float dR; for (unsigned int i = 0; i < vSubjets.size(); i++) { const fastjet::PseudoJet& subjet = vSubjets.at(i); float ptAll = 0.; float ptCore = 0.; + TLorentzVector temp_sub_p4; + temp_sub_p4.SetPtEtaPhiM(subjet.pt(), subjet.eta(), subjet.phi_std(), subjet.m()); + for (const auto& cc : vSubjetCells) { - dR = Tau1P3PKineUtils::deltaR(subjet.eta(), subjet.phi_std(), cc->eta(), cc->phi()); + + TLorentzVector temp_cc_p4; + temp_cc_p4.SetPtEtaPhiM(cc->pt(), cc->eta(), cc->phi(), cc->m()); - if (dR < Rsubjet) { + if (temp_cc_p4.DeltaR(temp_sub_p4) < data->Rsubjet) { ptAll += cc->pt(); } - if (dR < Rcore) { + + if (temp_cc_p4.DeltaR(temp_sub_p4) < data->Rcore) { ptCore += cc->pt(); } } @@ -104,6 +105,7 @@ StatusCode IDVarCalculator::execute(DiTauCandidateData * data, f_core = ptCore/ptAll; else f_core = -999.; + ATH_MSG_DEBUG("subjet "<< i << ": f_core=" << f_core); pDiTau->setfCore(i, f_core); } diff --git a/Reconstruction/DiTauRec/src/SubjetBuilder.cxx b/Reconstruction/DiTauRec/src/SubjetBuilder.cxx index 69de4de440018307fa9faccbcf4b3c2317a36ea4..ac86a1e94bd5bbc1210537f2a672bc5286084d39 100644 --- a/Reconstruction/DiTauRec/src/SubjetBuilder.cxx +++ b/Reconstruction/DiTauRec/src/SubjetBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "DiTauRec/SubjetBuilder.h" @@ -25,12 +25,10 @@ SubjetBuilder::SubjetBuilder(const std::string& type, const IInterface * parent) : DiTauToolBase(type, name, parent), m_Rsubjet(0.2), - m_Nsubjet(4), m_ptmin(10000) { declareInterface<DiTauToolBase > (this); declareProperty("Rsubjet", m_Rsubjet); - declareProperty("Nsubjet", m_Nsubjet); declareProperty("ptminsubjet", m_ptmin); } @@ -40,8 +38,6 @@ SubjetBuilder::~SubjetBuilder() = default; StatusCode SubjetBuilder::initialize() { - // m_SubjetFilter = fastjet::Filter(m_Rsubjet, fastjet::SelectorNHardest(m_Nsubjet)); - return StatusCode::SUCCESS; } @@ -78,12 +74,10 @@ StatusCode SubjetBuilder::execute(DiTauCandidateData * data, std::vector<PseudoJet> vpjClusters; for (const auto *cl: vConst) { - double pt = cl->pt(); - double px = pt*std::cos(cl->phi()); - double py = pt*std::sin(cl->phi()); - double pz = pt*std::sinh(cl->eta()); - double e = std::sqrt(px*px + py*py + pz*pz); - PseudoJet c( px, py, pz, e); + + TLorentzVector temp_p4; + temp_p4.SetPtEtaPhiM(cl->pt(), cl->eta(), cl->phi(), cl->m()); + PseudoJet c( temp_p4.Px(), temp_p4.Py(), temp_p4.Pz(), temp_p4.E()); vpjClusters.push_back(c); } diff --git a/Reconstruction/HeavyIonRec/HIGlobal/python/HIGlobalConfig.py b/Reconstruction/HeavyIonRec/HIGlobal/python/HIGlobalConfig.py index ae0895b1883f79af5e0d7c297cd2263913a1adc1..53a1e0bac472f41b9348e40120e5d0306ddf972d 100644 --- a/Reconstruction/HeavyIonRec/HIGlobal/python/HIGlobalConfig.py +++ b/Reconstruction/HeavyIonRec/HIGlobal/python/HIGlobalConfig.py @@ -101,6 +101,7 @@ if __name__ == "__main__": from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags flags = initConfigFlags() flags.Input.Files = [defaultTestFiles.d + "/RecJobTransformTests/data18_hi.00367384.physics_HardProbes.daq.RAW._lb0145._SFO-8._0001.data"] + flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.Exec.MaxEvents=5 flags.Concurrency.NumThreads=1 diff --git a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecConfigCA.py b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecConfigCA.py index 2ff3589a7ed510288066ba4707ef71848e2d4a40..8da7f26fd030d92258ddfab758940eaebb1acfd0 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecConfigCA.py +++ b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecConfigCA.py @@ -696,6 +696,7 @@ if __name__ == "__main__": from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags flags = initConfigFlags() flags.Input.Files = [defaultTestFiles.d + "/RecJobTransformTests/data18_hi.00367384.physics_HardProbes.daq.RAW._lb0145._SFO-8._0001.data"] + flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.Exec.MaxEvents = 5 flags.Concurrency.NumThreads = 1 diff --git a/Reconstruction/HeavyIonRec/HIRecConfig/python/HIRecConfig.py b/Reconstruction/HeavyIonRec/HIRecConfig/python/HIRecConfig.py index 93a5e45f1a556ef40eb7f7388c6d42664d1648f1..751b62d564cbdbfafeacf88cbcbffd644e02a3f9 100644 --- a/Reconstruction/HeavyIonRec/HIRecConfig/python/HIRecConfig.py +++ b/Reconstruction/HeavyIonRec/HIRecConfig/python/HIRecConfig.py @@ -43,12 +43,12 @@ if __name__ == "__main__": # testing for Run 2: # flags.Input.Files = [defaultTestFiles.d + "/RecJobTransformTests/data18_hi.00367384.physics_HardProbes.daq.RAW._lb0145._SFO-8._0001.data"] # flags.IOVDb.GlobalTag = "CONDBR2-BLKPA-RUN2-09" - # flags.GeoModel.AtlasVersion = "ATLAS-R2-2016-01-00-01" + # flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 # testing for Run 3: flags.Input.Files = [defaultTestFiles.d + "/RecJobTransformTests/data22_hi/RAWFiles/data22_hi.00440101.physics_MinBias.daq.RAW/data22_hi.00440101.physics_MinBias.daq.RAW._lb0214._SFO-11._0001.data"] flags.IOVDb.GlobalTag = "CONDBR2-BLKPA-2022-09" - flags.GeoModel.AtlasVersion = "ATLAS-R3S-2021-03-01-00" + flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3 # set more flags: flags.Exec.MaxEvents=5 diff --git a/Reconstruction/MET/METInterface/METInterface/IMETSignificance.h b/Reconstruction/MET/METInterface/METInterface/IMETSignificance.h index 65dd8664581ac55a43145988bec2ec1c5626bebd..0b618461f2be4975a4c85755afa69a07201480cd 100644 --- a/Reconstruction/MET/METInterface/METInterface/IMETSignificance.h +++ b/Reconstruction/MET/METInterface/METInterface/IMETSignificance.h @@ -1,6 +1,6 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // IMETSignificance.h // Header file for interface IMETSignificance @@ -51,7 +51,7 @@ public: // Convenience methods that creates MET terms internally // Version with single soft term - virtual StatusCode varianceMET(xAOD::MissingETContainer* metCont, float avgmu, std::string jetTermName, std::string softTermName, std::string totalMETName) = 0; + virtual StatusCode varianceMET(xAOD::MissingETContainer* metCont, float avgmu, const std::string& jetTermName, const std::string& softTermName, const std::string& totalMETName) = 0; // Rotates the phi direction of the object resolutions & recomputes the MET significance virtual StatusCode RotateToPhi(float phi) = 0; diff --git a/Reconstruction/MET/METUtilities/METUtilities/METSignificance.h b/Reconstruction/MET/METUtilities/METUtilities/METSignificance.h index fd9be9b9831f4987c4f858f8d5ada5dd42711f6e..100d13bdf66183b445509705382dd67aa21af9a7 100644 --- a/Reconstruction/MET/METUtilities/METUtilities/METSignificance.h +++ b/Reconstruction/MET/METUtilities/METUtilities/METSignificance.h @@ -1,6 +1,6 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // METSignificance.h // Header file for class METSignificance @@ -62,7 +62,7 @@ namespace met { StatusCode initialize(); StatusCode finalize(); - StatusCode varianceMET(xAOD::MissingETContainer* metCont, float avgmu, std::string jetTermName, std::string softTermName, std::string totalMETName); + StatusCode varianceMET(xAOD::MissingETContainer* metCont, float avgmu, const std::string& jetTermName, const std::string& softTermName, const std::string& totalMETName); // Rotates the phi direction of the object resolutions & recomputes the MET significance StatusCode RotateToPhi(float phi); @@ -70,10 +70,10 @@ namespace met { // Subtracts the vector lambda from the MET & recomputes the MET signficance in new MET - lambda direction StatusCode SetLambda(const float px, const float py, const bool GeV=true); - double GetMETOverSqrtSumET() const { if(m_sumet>0.0) return (m_met/sqrt(m_sumet)); return -1.0; } - double GetMETOverSqrtHT () const { if(m_ht>0.0) return (m_met/sqrt(m_ht)); return -1.0; } - double GetSignificance() const { if(m_significance>0.0) return sqrt(m_significance); return -1.0; } - double GetSigDirectional() const { if(m_VarL>0.0) return m_met/sqrt(m_VarL); return -1.0; } + double GetMETOverSqrtSumET() const { if(m_sumet>0.0) return (m_met/std::sqrt(m_sumet)); return -1.0; } + double GetMETOverSqrtHT () const { if(m_ht>0.0) return (m_met/std::sqrt(m_ht)); return -1.0; } + double GetSignificance() const { if(m_significance>0.0) return std::sqrt(m_significance); return -1.0; } + double GetSigDirectional() const { if(m_VarL>0.0) return m_met/std::sqrt(m_VarL); return -1.0; } double GetRho() const { return m_rho; } double GetVarL() const { return m_VarL; } double GetVarT() const { return m_VarT; } diff --git a/Reconstruction/MET/METUtilities/Root/METSignificance.cxx b/Reconstruction/MET/METUtilities/Root/METSignificance.cxx index 83b1986dfd746420a04906ca4ca44b8f445167a1..046b500dc2635b48c7eb9d925159a5b251df90df 100644 --- a/Reconstruction/MET/METUtilities/Root/METSignificance.cxx +++ b/Reconstruction/MET/METUtilities/Root/METSignificance.cxx @@ -1,6 +1,6 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // METSignificance.cxx // Implementation file for class METSignificance @@ -48,8 +48,7 @@ namespace met { static const SG::AuxElement::ConstAccessor<float> acc_jvt("Jvt"); static const SG::AuxElement::ConstAccessor<float> acc_fjvt("fJvt"); static const SG::AuxElement::ConstAccessor<float> acc_fjvt_der("DFCommonJets_fJvt"); - - static const SG::AuxElement::ConstAccessor< std::vector<iplink_t > > dec_constitObjLinks("ConstitObjectLinks"); + static const SG::AuxElement::ConstAccessor< std::vector<iplink_t > > acc_constitObjLinks("ConstitObjectLinks"); const static MissingETBase::Types::bitmask_t invisSource = 0x100000; // doesn't overlap with any other METSignificance::METSignificance(const std::string& name) : @@ -119,6 +118,7 @@ namespace met { } else{ ATH_MSG_ERROR("PU Jet Uncertainty TFile is not valid: " << configpath); + return StatusCode::FAILURE; } std::string toolName; @@ -128,7 +128,7 @@ namespace met { if (m_jetCalibTool.empty()){ asg::AsgToolConfig toolConfig (toolName); - + // FIXME: it would be better to configure this via properties std::string config = "JES_data2017_2016_2015_Recommendation_Aug2018_rel21.config"; std::string calibSeq = "JetArea_Residual_EtaJES_GSC_Smear"; std::string calibArea = "00-04-81"; @@ -192,7 +192,7 @@ namespace met { } // **** Rebuild generic MET term **** - StatusCode METSignificance::varianceMET(xAOD::MissingETContainer* metCont, float avgmu, std::string jetTermName, std::string softTermName, std::string totalMETName){ + StatusCode METSignificance::varianceMET(xAOD::MissingETContainer* metCont, float avgmu, const std::string& jetTermName, const std::string& softTermName, const std::string& totalMETName){ // reset variables m_VarL = 0.0; @@ -266,7 +266,7 @@ namespace met { continue; } ATH_MSG_VERBOSE("Add MET term " << met->name() ); - for(const auto& el : dec_constitObjLinks(*met)) { + for(const auto& el : acc_constitObjLinks(*met)) { const xAOD::IParticle* obj(*el); float pt_reso=0.0, phi_reso=0.0; if(!obj){ @@ -335,8 +335,8 @@ namespace met { // should be done to reset the phi as well... if(m_softTermParam==met::TSTParam){ Double_t Bias_TST = BiasPtSoftdir(m_metsoft); - Double_t MEx = m_met * cos(m_metphi) - Bias_TST * cos(m_metsoftphi); - Double_t MEy = m_met * sin(m_metphi) - Bias_TST * sin(m_metsoftphi); + Double_t MEx = m_met * std::cos(m_metphi) - Bias_TST * std::cos(m_metsoftphi); + Double_t MEy = m_met * std::sin(m_metphi) - Bias_TST * std::sin(m_metsoftphi); met_vect.SetXYZ(MEx,MEy,0.0); } else if(m_softTermParam==met::PthardParam){ @@ -344,19 +344,19 @@ namespace met { m_pthard_vect = m_soft_vect - m_met_vect; Double_t PtSoftparaPH = m_pthard_vect.Mag()>0.0 ? (m_soft_vect.Dot(m_pthard_vect))/m_pthard_vect.Mag() : 0.0; Double_t Bias_pthard = Bias_PtSoftParall(PtSoftparaPH); - Double_t MEx = m_met * cos(m_metphi) - Bias_pthard * cos(m_metsoftphi); - Double_t MEy = m_met * sin(m_metphi) - Bias_pthard * sin(m_metsoftphi); + Double_t MEx = m_met * std::cos(m_metphi) - Bias_pthard * std::cos(m_metsoftphi); + Double_t MEy = m_met * std::sin(m_metphi) - Bias_pthard * std::sin(m_metsoftphi); met_vect.SetXYZ(MEx,MEy,0.0); } // Rotate & compute ATH_CHECK(RotateToPhi(met_vect.Phi())); m_significance = Significance_LT(met_vect.Pt(), m_VarL, m_VarT, m_CvLT); - m_rho = m_CvLT / sqrt( m_VarL * m_VarT ) ; + m_rho = m_CvLT / std::sqrt( m_VarL * m_VarT ) ; } else{ // standard calculation m_significance = Significance_LT(m_met, m_VarL, m_VarT, m_CvLT); - m_rho = m_CvLT / sqrt( m_VarL * m_VarT ) ; + m_rho = m_CvLT / std::sqrt( m_VarL * m_VarT ) ; } m_ht-=softSumET; ATH_MSG_VERBOSE(" Significance (squared): " << m_significance << " rho: " << GetRho() @@ -379,7 +379,7 @@ namespace met { if( m_VarL != 0 ){ m_significance = Significance_LT(m_met,m_VarL,m_VarT,m_CvLT ); - m_rho = m_CvLT / sqrt( m_VarL * m_VarT ) ; + m_rho = m_CvLT / std::sqrt( m_VarL * m_VarT ) ; } ATH_MSG_DEBUG(" Significance (squared) at new phi: " << m_significance << " rho: " << GetRho() @@ -403,7 +403,7 @@ namespace met { if( m_VarL != 0 ){ m_significance = Significance_LT(met_m_lamda,m_VarL,m_VarT,m_CvLT ); - m_rho = m_CvLT / sqrt( m_VarL * m_VarT ) ; + m_rho = m_CvLT / std::sqrt( m_VarL * m_VarT ) ; } ATH_MSG_DEBUG(" Significance (squared) at new phi: " << m_significance << " rho: " << GetRho() @@ -541,7 +541,7 @@ namespace met { ATH_MSG_ERROR("No fJVT decoration available - must have treat pileup jets set to off or provide fJVT!"); return StatusCode::FAILURE; } - pt_reso = sqrt(jet_pu_unc*jet_pu_unc + pt_reso*pt_reso); + pt_reso = std::sqrt(jet_pu_unc*jet_pu_unc + pt_reso*pt_reso); ATH_MSG_VERBOSE("jet_pu_unc: " << jet_pu_unc); } @@ -557,7 +557,7 @@ namespace met { SG::AuxElement::ConstAccessor<float> acc_extra(m_JetResoAux); if(acc_extra.isAvailable(*jet)){ float extra_relative_pt_reso = acc_extra(*jet); - pt_reso = sqrt(pt_reso*pt_reso + extra_relative_pt_reso*extra_relative_pt_reso); + pt_reso = std::sqrt(pt_reso*pt_reso + extra_relative_pt_reso*extra_relative_pt_reso); } } @@ -938,22 +938,22 @@ namespace met { std::tuple<double,double,double> METSignificance::CovMatrixRotation(double var_x, double var_y, double cv_xy, double Phi){ // Covariance matrix parallel and transverse to the Phi direction - Double_t V11 = pow(cos(Phi),2)*var_x + 2*sin(Phi)*cos(Phi)*cv_xy + pow(sin(Phi),2)*var_y; - Double_t V22 = pow(sin(Phi),2)*var_x - 2*sin(Phi)*cos(Phi)*cv_xy + pow(cos(Phi),2)*var_y; - Double_t V12 = pow(cos(Phi),2)*cv_xy -sin(Phi)*cos(Phi)*var_x + sin(Phi)*cos(Phi)*var_y - pow(sin(Phi),2)*cv_xy; // rho is equal to one for just one jet + Double_t V11 = std::pow(std::cos(Phi),2)*var_x + 2*std::sin(Phi)*std::cos(Phi)*cv_xy + std::pow(std::sin(Phi),2)*var_y; + Double_t V22 = std::pow(std::sin(Phi),2)*var_x - 2*std::sin(Phi)*std::cos(Phi)*cv_xy + std::pow(std::cos(Phi),2)*var_y; + Double_t V12 = std::pow(std::cos(Phi),2)*cv_xy -std::sin(Phi)*std::cos(Phi)*var_x + std::sin(Phi)*std::cos(Phi)*var_y - std::pow(std::sin(Phi),2)*cv_xy; // rho is equal to one for just one jet return std::make_tuple( V11, V22, V12); } double METSignificance::Significance_LT(double Numerator, double var_parall, double var_perpen, double cov){ - Double_t rho = cov / sqrt( var_parall * var_perpen ) ; + Double_t rho = cov / std::sqrt( var_parall * var_perpen ) ; Double_t Significance = 0; if (std::abs( rho ) >= 0.9 ){ //Cov Max not invertible -> Significance diverges ATH_MSG_VERBOSE("rho is large: " << rho); - Significance = pow( Numerator - m_scalarBias , 2 ) / ( var_parall ) ; + Significance = std::pow( Numerator - m_scalarBias , 2 ) / ( var_parall ) ; } else - Significance = pow( Numerator - m_scalarBias , 2 ) / ( var_parall * ( 1 - pow(rho,2) ) ) ; + Significance = std::pow( Numerator - m_scalarBias , 2 ) / ( var_parall * ( 1 - std::pow(rho,2) ) ) ; if( std::abs(Significance) >= 10e+15) ATH_MSG_WARNING("warning -->"<< Significance); @@ -988,8 +988,8 @@ namespace met { void METSignificance::RotateXY(const double (&mat)[2][2], double (&mat_new)[2][2], double phi){ - double c = cos(phi); - double s = sin(phi); + double c = std::cos(phi); + double s = std::sin(phi); double cc = c*c; double ss = s*s; double cs = c*s; @@ -1016,19 +1016,19 @@ namespace met { // Coefficients from Doug Schaefer <schae@cern.ch> and the MET subgroup double METSignificance::VarparPtSoftdir(const double PtSoft, const double SoftSumet){ if (SoftSumet<25){ - if (PtSoft<50.) return 41.9+3.8*PtSoft+0.1*pow(PtSoft,2)-12.7+ 1.39*SoftSumet-0.03*pow(SoftSumet,2); - else return 41.9+3.8*50.+0.1*pow(50.,2)-12.7+ 1.39*SoftSumet-0.03*pow(SoftSumet,2); + if (PtSoft<50.) return 41.9+3.8*PtSoft+0.1*std::pow(PtSoft,2)-12.7+ 1.39*SoftSumet-0.03*std::pow(SoftSumet,2); + else return 41.9+3.8*50.+0.1*std::pow(50.,2)-12.7+ 1.39*SoftSumet-0.03*std::pow(SoftSumet,2); } else{ - if (PtSoft<50.) return 41.9+3.8*PtSoft+0.1*pow(PtSoft,2); - else return (40.5614)+(4.10965)*50.+(0.0955044)*pow(50.,2); + if (PtSoft<50.) return 41.9+3.8*PtSoft+0.1*std::pow(PtSoft,2); + else return (40.5614)+(4.10965)*50.+(0.0955044)*std::pow(50.,2); } } // Coefficients from Doug Schaefer <schae@cern.ch> and the MET subgroup double METSignificance::Var_Ptsoft(const double PtSoft){ - if (PtSoft<45.) return 40. + 2*PtSoft + 0.1*pow(PtSoft,2); - else return 40. + 2*45 + 0.1*pow(45,2); + if (PtSoft<45.) return 40. + 2*PtSoft + 0.1*std::pow(PtSoft,2); + else return 40. + 2*45 + 0.1*std::pow(45,2); } // Coefficients from Doug Schaefer <schae@cern.ch> and the MET subgroup diff --git a/Reconstruction/RecJobTransforms/python/RDOtoRDO_TRIG_Skeleton.py b/Reconstruction/RecJobTransforms/python/RDOtoRDO_TRIG_Skeleton.py index b169f31980df93b27f6a26b9b900901b6877fccd..48a5dc9b4f97e39adba9664735cafdcd6113691f 100644 --- a/Reconstruction/RecJobTransforms/python/RDOtoRDO_TRIG_Skeleton.py +++ b/Reconstruction/RecJobTransforms/python/RDOtoRDO_TRIG_Skeleton.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration from PyJobTransforms.TransformUtils import processPreExec, processPreInclude, processPostExec, processPostInclude from TriggerJobOpts import runHLT @@ -18,8 +18,6 @@ def configureFlags(runArgs): flags = initConfigFlags() from PyJobTransforms.CommonRunArgsToFlags import commonRunArgsToFlags commonRunArgsToFlags(runArgs, flags) - from RecJobTransforms.RecoConfigFlags import recoRunArgsToFlags - recoRunArgsToFlags(runArgs, flags) # Set standard flags for HLT jobs runHLT.set_flags(flags) @@ -33,6 +31,9 @@ def configureFlags(runArgs): flags.Output.RDOFileName = runArgs.outputRDO_TRIGFile log.info("---------- Configured RDO_TRIG output") + from RecJobTransforms.RecoConfigFlags import recoRunArgsToFlags + recoRunArgsToFlags(runArgs, flags) + from AthenaConfiguration.Enums import ProductionStep flags.Common.ProductionStep=ProductionStep.Reconstruction diff --git a/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py b/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py index 4d97b996ff8ff004afc92481c4ad8e443a7ba1bf..335f1663dd48c805b17a8f6c5c6517aca27c15b3 100644 --- a/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py +++ b/Reconstruction/RecJobTransforms/python/RecoConfigFlags.py @@ -115,7 +115,7 @@ def createRecoConfigFlags(): flags.addFlag("Reco.EnableHI", lambda prevFlags: prevFlags.Reco.HIMode is not HIMode.pp) - flags.addFlag("Reco.HIMode", _hiModeChoice, enum=HIMode) + flags.addFlag("Reco.HIMode", _hiModeChoice, type=HIMode) # Enable alg for decorating EventInfo with BeamSpot info # (maybe not always available for calibration runs, etc) diff --git a/Reconstruction/egamma/egammaUtils/Root/egPhotonWrtPoint.cxx b/Reconstruction/egamma/egammaUtils/Root/egPhotonWrtPoint.cxx index 856d554d37100d5ac6ca22298c0ed5169c0c828d..cd699080405ee3b9e1ee4257a9283d4e6807d160 100644 --- a/Reconstruction/egamma/egammaUtils/Root/egPhotonWrtPoint.cxx +++ b/Reconstruction/egamma/egammaUtils/Root/egPhotonWrtPoint.cxx @@ -16,7 +16,7 @@ photonWrtPoint::PtEtaPhi photonWrtPoint::PtEtaPhiWrtZ(const xAOD::Egamma& ph, double rCalo = RZ1.first; double zCalo = RZ1.second; double correctedZ = zCalo - z; - double eta = std::asinh(correctedZ / rCalo); + double eta = rCalo>0. ? std::asinh(correctedZ / rCalo) : ph.eta(); return {ph.e() / std::cosh(eta), eta, ph.phi()}; } diff --git a/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx b/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx index 7cbf4fe380d07b32ad4d4b7e49652cb655cfd7ab..7c0f006a61c4cbc00a7eedc213314d95bad4a5d6 100644 --- a/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx +++ b/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------------- @@ -11,7 +11,6 @@ // This class calculates tau variables after core seed reconstruction //----------------------------------------------------------------------------- #include "tauRecTools/TauCommonCalcVars.h" -#include "tauRecTools/KineUtils.h" #include <vector> //----------------------------------------------------------------------------- diff --git a/Reconstruction/tauRecTools/src/TauCellVariables.cxx b/Reconstruction/tauRecTools/src/TauCellVariables.cxx index e5af439570c52bccd066428e9bc586d944585d33..d1ed0ef347e7ade95ed3b3414668a29f8abe4190 100644 --- a/Reconstruction/tauRecTools/src/TauCellVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauCellVariables.cxx @@ -1,11 +1,10 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef XAOD_ANALYSIS #include "TauCellVariables.h" -#include "tauRecTools/KineUtils.h" #include "tauRecTools/HelperFunctions.h" #include "xAODTau/TauJet.h" @@ -45,8 +44,7 @@ StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { TLorentzVector tauAxis = tauRecTools::getTauAxis(pTau, m_doVertexCorrection); // loop over cells in all the clusters and calculate the variables - std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = pTau.vertexedClusters(); - for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : pTau.vertexedClusters()){ const xAOD::CaloCluster& cluster = vertexedCluster.clust(); const CaloClusterCellLink* cellLinks = cluster.getCellLinks(); if (cellLinks == nullptr) { @@ -79,15 +77,18 @@ StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { cellEnergy = vxCell.energy(); } - double dR = Tau1P3PKineUtils::deltaR(tauAxis.Eta(), tauAxis.Phi(), cellEta, cellPhi); - CaloSampling::CaloSample calo = cell->caloDDE()->getSampling(); - + TLorentzVector temp_cc_p4; + temp_cc_p4.SetPtEtaPhiE(cellET, cellEta, cellPhi, cellEnergy); + double dR = tauAxis.DeltaR(temp_cc_p4); + if (dR < m_cellCone) { sumCellET += cellET; - + if (dR < 0.1) sumCellET01 += cellET; if (dR > 0.1 && dR < 0.2) sumCellET12 += cellET; + CaloSampling::CaloSample calo = cell->caloDDE()->getSampling(); + // EM layer: PreSamplerB, PreSamplerE, EMB1, EME1, EMB2, EME2 // Most energy of neutral particles are deposited in the first two EM laywers // The third layer is regarded as HAD layber diff --git a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx index 2875dc19856c5e48adb0fcd2faf5febeae3be575..40c5e2a41cd7aa6d03fd3bf7e619192bfd16f5b3 100644 --- a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx @@ -1,11 +1,10 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef XAOD_ANALYSIS #include "TauElectronVetoVariables.h" -#include "tauRecTools/KineUtils.h" #include "xAODTau/TauJet.h" #include "CaloUtils/CaloVertexedCell.h" @@ -19,6 +18,8 @@ #include <unordered_map> #include <array> +#include "TVector2.h" + using Gaudi::Units::GeV; @@ -187,7 +188,7 @@ StatusCode TauElectronVetoVariables::execute(xAOD::TauJet& pTau) const { int i = 2; if (sampling < 4) i = sampling; if (sampling == 12 || sampling == 13 || sampling == 14) i = 3; - detPhiTrk = Tau1P3PKineUtils::deltaPhi( cellPhi, extrapolatedPhi[i] ); + detPhiTrk = TVector2::Phi_mpi_pi(cellPhi-extrapolatedPhi[i]); detEtaTrk = std::abs( cellEta - extrapolatedEta[i] ); clEtaTrk = extrapolatedEta[i]; distEtaTrk = cellEta - extrapolatedEta[i]; diff --git a/Simulation/Digitization/DigitizationConfig/python/DigitizationConfigFlags.py b/Simulation/Digitization/DigitizationConfig/python/DigitizationConfigFlags.py index 18bd88a8bb9324521916bb51f5ceb24f65d4fc68..1cd19f365a7ce29c7cbd459d69e524551c925ef0 100644 --- a/Simulation/Digitization/DigitizationConfig/python/DigitizationConfigFlags.py +++ b/Simulation/Digitization/DigitizationConfig/python/DigitizationConfigFlags.py @@ -73,9 +73,11 @@ def createDigitizationCfgFlags(): flags.addFlag("Digitization.InputBeamSigmaZ", -1) # Set the type of the radiation damage simulation type for pixel planar sensors - flags.addFlag("Digitization.PixelPlanarRadiationDamageSimulationType", PixelRadiationDamageSimulationType.NoRadiationDamage, enum=PixelRadiationDamageSimulationType) + flags.addFlag("Digitization.PixelPlanarRadiationDamageSimulationType", + PixelRadiationDamageSimulationType.NoRadiationDamage, type=PixelRadiationDamageSimulationType) # Set the type of the radiation damage simulation type for 3D planar sensors - flags.addFlag("Digitization.Pixel3DRadiationDamageSimulationType", PixelRadiationDamageSimulationType.NoRadiationDamage, enum=PixelRadiationDamageSimulationType) + flags.addFlag("Digitization.Pixel3DRadiationDamageSimulationType", + PixelRadiationDamageSimulationType.NoRadiationDamage, type=PixelRadiationDamageSimulationType) # for PileUp digitization # Bunch structure configuration diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt index 022092e075cc629c101d38927971c3597361bda2..8b7316b87115c11b7586ef709e977dd98f23d08a 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/CMakeLists.txt @@ -1,4 +1,4 @@ -#Copyright(C) 2002 - 2023 CERN for the benefit of the ATLAS collaboration +#Copyright(C) 2002 - 2024 CERN for the benefit of the ATLAS collaboration #Declare the package name: atlas_subdir( ISF_FastCaloSimEvent ) @@ -8,7 +8,8 @@ find_package( Boost ) find_package( CLHEP ) find_package( HepPDT ) find_package( ROOT COMPONENTS Core Tree MathCore MathMore Hist RIO Matrix Physics ) -find_package( lwtnn ) +find_package( lwtnn REQUIRED ) +find_package( onnxruntime REQUIRED ) find_package( LibXml2 ) option(USE_GPU "whether to run FCS on GPU or not" OFF) @@ -17,13 +18,14 @@ if(USE_GPU AND CMAKE_CUDA_COMPILER) add_definitions( -DUSE_GPU) endif() -#Remove the-- as - needed linker flags: +#Remove the --as-needed linker flags: atlas_disable_as_needed() #Component(s) in the package: atlas_add_root_dictionary( ISF_FastCaloSimEvent _dictSource ROOT_HEADERS ISF_FastCaloSimEvent/IntArray.h ISF_FastCaloSimEvent/DoubleArray.h + ISF_FastCaloSimEvent/MLogging.h ISF_FastCaloSimEvent/TFCSFunction.h ISF_FastCaloSimEvent/TFCS1DFunction.h ISF_FastCaloSimEvent/TFCS1DFunctionHistogram.h @@ -90,26 +92,37 @@ atlas_add_root_dictionary( ISF_FastCaloSimEvent _dictSource ISF_FastCaloSimEvent/TFCSSimulationState.h ISF_FastCaloSimEvent/TFCSTruthState.h ISF_FastCaloSimEvent/TFCSVoxelHistoLateralCovarianceFluctuations.h + ISF_FastCaloSimEvent/VNetworkBase.h + ISF_FastCaloSimEvent/VNetworkLWTNN.h + ISF_FastCaloSimEvent/TFCSSimpleLWTNNHandler.h + ISF_FastCaloSimEvent/TFCSONNXHandler.h + ISF_FastCaloSimEvent/TFCSNetworkFactory.h ISF_FastCaloSimEvent/LinkDef.h EXTERNAL_PACKAGES HepPDT) +set(ALL_ONNX_LIBS ${onnxruntime_LIBRARY} ${onnxruntime_LIBRARIES} ${ONNXRUNTIME_LIBRARIES}) +message(NOTICE "-- ISF_FastCaloSimEvent/CMakeLists: Using onnx libs=${ALL_ONNX_LIBS}") +set(ALL_ONNX_INCS ${onnxruntime_INCLUDE_DIR} ${ONNXRUNTIME_INCLUDE_DIRS}) +message(NOTICE "-- ISF_FastCaloSimEvent/CMakeLists: Using onnx incs=${ALL_ONNX_INCS}") + + if(USE_GPU AND CMAKE_CUDA_COMPILER) message("compiling ISF_FastCaoSimEvent using cuda") atlas_add_library( ISF_FastCaloSimEvent ISF_FastCaloSimEvent/*.h ${_dictSource} src/*.cxx PUBLIC_HEADERS ISF_FastCaloSimEvent - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS} ${ALL_ONNX_INCS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaKernel AthenaBaseComps CaloDetDescrLib ${LWTNN_LIBRARIES} ${LIBXML2_LIBRARIES} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaKernel AthenaBaseComps CaloDetDescrLib ${LWTNN_LIBRARIES} ${LIBXML2_LIBRARIES} ${ALL_ONNX_LIBS} CaloGeoHelpers CxxUtils TileSimEvent ISF_FastCaloGpuLib PRIVATE_LINK_LIBRARIES GaudiKernel ) else() atlas_add_library( ISF_FastCaloSimEvent ISF_FastCaloSimEvent/*.h ${_dictSource} src/*.cxx PUBLIC_HEADERS ISF_FastCaloSimEvent - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS} + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS} ${ALL_ONNX_INCS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaKernel AthenaBaseComps CaloDetDescrLib ${LWTNN_LIBRARIES} ${LIBXML2_LIBRARIES} + LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaKernel AthenaBaseComps CaloDetDescrLib ${LWTNN_LIBRARIES} ${LIBXML2_LIBRARIES} ${ALL_ONNX_LIBS} CaloGeoHelpers CxxUtils TileSimEvent PRIVATE_LINK_LIBRARIES GaudiKernel ) endif() @@ -118,3 +131,25 @@ atlas_add_dictionary( ISF_FastCaloSimEventDict ISF_FastCaloSimEvent/ISF_FastCaloSimEventDict.h ISF_FastCaloSimEvent/selection.xml LINK_LIBRARIES ISF_FastCaloSimEvent ) + +# This really should only take 10s, but something strange is happening in CI +# TODO resolve +atlas_add_test( GenericNetwork_test + SOURCES test/GenericNetwork_test.cxx + INCLUDE_DIRS ${LWTNN_INCLUDE_DIRS} ${ALL_ONNX_INCS} + LINK_LIBRARIES ${LWTNN_LIBRARIES} ${ALL_ONNX_LIBS} ISF_FastCaloSimEvent + PROPERTIES TIMEOUT 600 ) + +# Takes a bit longer, could be converted to a atlas_add_citest +atlas_add_test( TFCSEnergyAndHitGANV2_test + SOURCES test/TFCSEnergyAndHitGANV2_test.cxx + INCLUDE_DIRS ${LWTNN_INCLUDE_DIRS} ${ALL_ONNX_INCS} + LINK_LIBRARIES ${LWTNN_LIBRARIES} ${ALL_ONNX_LIBS} ISF_FastCaloSimEvent + LOG_IGNORE_PATTERN "*(TFCSCenterPositionCalculation*)0x*" # it's a pointer + PROPERTIES TIMEOUT 1200 ) + +atlas_add_test( TFCSPredictExtrapWeights_test + SOURCES test/TFCSPredictExtrapWeights_test.cxx + INCLUDE_DIRS ${LWTNN_INCLUDE_DIRS} ${ALL_ONNX_INCS} + LINK_LIBRARIES ${LWTNN_LIBRARIES} ${ALL_ONNX_LIBS} ISF_FastCaloSimEvent ) + diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/LinkDef.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/LinkDef.h index 8b8a68a210015ea0a98c0dee3eba6c07bbdc831a..ed71d4de8cdcdf1965368a8ab5954c6a89d3f4a4 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/LinkDef.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/LinkDef.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "ISF_FastCaloSimEvent/DoubleArray.h" @@ -50,6 +50,11 @@ #include "ISF_FastCaloSimEvent/TFCSEnergyAndHitGAN.h" #include "ISF_FastCaloSimEvent/TFCSEnergyAndHitGANV2.h" #include "ISF_FastCaloSimEvent/TFCSPredictExtrapWeights.h" +#include "ISF_FastCaloSimEvent/VNetworkBase.h" +#include "ISF_FastCaloSimEvent/VNetworkLWTNN.h" +#include "ISF_FastCaloSimEvent/TFCSSimpleLWTNNHandler.h" +#include "ISF_FastCaloSimEvent/TFCSONNXHandler.h" +#include "ISF_FastCaloSimEvent/TFCSNetworkFactory.h" #endif #include "ISF_FastCaloSimEvent/TFCSLateralShapeParametrization.h" @@ -606,6 +611,11 @@ #pragma link C++ class TFCSEnergyAndHitGAN - ; #pragma link C++ class TFCSEnergyAndHitGANV2 + ; #pragma link C++ class TFCSPredictExtrapWeights - ; + +#pragma link C++ class VNetworkBase + ; +#pragma link C++ class VNetworkLWTNN + ; +#pragma link C++ class TFCSSimpleLWTNNHandler - ; +#pragma link C++ class TFCSONNXHandler - ; #endif #pragma link C++ class TFCSLateralShapeParametrization + ; diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/MLogging.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/MLogging.h index fce96ca23c31dfd00a799000670900b08e124976..d3a3a8f00a28057bd45003a65df9010d9ecf0249 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/MLogging.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/MLogging.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef ISF_FASTCALOSIMEVENT_MLogging_h @@ -8,14 +8,6 @@ #include <TNamed.h> //for ClassDef #include "CxxUtils/checker_macros.h" -// One macro for use outside classes. -// Use this in standalone functions or static methods. -#define ATH_MSG_NOCLASS(logger_name, x) \ - do { \ - logger_name.msg() << logger_name.startMsg(MSG::ALWAYS, __FILE__, __LINE__) \ - << x << std::endl; \ - } while (0) - #if defined(__FastCaloSimStandAlone__) #include <iomanip> #include <iostream> @@ -32,6 +24,14 @@ enum Level { NUM_LEVELS }; // enum Level } // end namespace MSG + +// Macro for use outside classes. +// Use this in standalone functions or static methods. +#define ATH_MSG_NOCLASS(logger_name, x) \ + do { \ + logger_name.msg() << logger_name.startMsg(MSG::ALWAYS, __FILE__, __LINE__) \ + << x << std::endl; \ + } while (0) #else // not __FastCaloSimStandAlone__ We get some things from AthenaKernal. // STL includes #include <iosfwd> @@ -45,6 +45,15 @@ enum Level { #include "AthenaKernel/getMessageSvc.h" #include <boost/thread/tss.hpp> + +// Macro for use outside classes. +// Use this in standalone functions or static methods. +// Differs, becuase it must call doOutput +#define ATH_MSG_NOCLASS(logger_name, x) \ + do { \ + logger_name.msg(MSG::ALWAYS) << x << std::endl; \ + logger_name.msg().doOutput(); \ + } while (0) #endif // end not __FastCaloSimStandAlone__ // Declare the class accessories in a namespace @@ -202,8 +211,8 @@ private: std::string m_nm; //! Do not persistify! /// MsgStream instance (a std::cout like with print-out levels) - inline static boost::thread_specific_ptr<MsgStream> - m_msg_tls ATLAS_THREAD_SAFE; //! Do not persistify! + inline static boost::thread_specific_ptr<MsgStream> m_msg_tls + ATLAS_THREAD_SAFE; //! Do not persistify! ClassDef(MLogging, 0) }; diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSEnergyAndHitGANV2.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSEnergyAndHitGANV2.h index 118ab5b0c706297e5a3d09d614ad77008757470f..217a70387362e616fc12bd05a02cfd0e745fb16b 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSEnergyAndHitGANV2.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSEnergyAndHitGANV2.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef ISF_FASTCALOSIMEVENT_TFCSEnergyAndHitGANV2_h @@ -70,7 +70,7 @@ public: return m_slice->GetExtrapolatorWeights(); }; - bool initializeNetwork(int pid, int etaMin, + bool initializeNetwork(int const &pid, int const &etaMin, const std::string &FastCaloGANInputFolderName); bool fillEnergy(TFCSSimulationState &simulstate, const TFCSTruthState *truth, @@ -81,6 +81,12 @@ public: virtual void Print(Option_t *option = "") const override; + static void test_path(std::string path, + TFCSSimulationState *simulstate = nullptr, + const TFCSTruthState *truth = nullptr, + const TFCSExtrapolationState *extrapol = nullptr, + std::string outputname = "unnamed", int pid = 211); + static void unit_test(TFCSSimulationState *simulstate = nullptr, const TFCSTruthState *truth = nullptr, const TFCSExtrapolationState *extrapol = nullptr); @@ -90,7 +96,7 @@ protected: std::string FastCaloGANInputFolderName); private: - static int GetBinsInFours(double bins); + static int GetBinsInFours(double const &bins); int GetAlphaBinsForRBin(const TAxis *x, int ix, int yBinNum) const; std::vector<int> m_bin_ninit; @@ -103,7 +109,7 @@ private: TFCSGANEtaSlice *m_slice = nullptr; TFCSGANXMLParameters m_param; - ClassDefOverride(TFCSEnergyAndHitGANV2, 1) // TFCSEnergyAndHitGANV2 + ClassDefOverride(TFCSEnergyAndHitGANV2, 2) // TFCSEnergyAndHitGANV2 }; #endif diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANEtaSlice.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANEtaSlice.h index ebb063ed8555cf050fed5466fbd5be28233b6036..5c2ad29e06db6eb2d3049d6fd5aaf4af3c8c45b8 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANEtaSlice.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANEtaSlice.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -17,11 +17,12 @@ #include "ISF_FastCaloSimEvent/TFCSSimulationState.h" #include "ISF_FastCaloSimEvent/TFCSExtrapolationState.h" #include "ISF_FastCaloSimEvent/TFCSGANXMLParameters.h" -#include "ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h" #include "ISF_FastCaloSimEvent/MLogging.h" -#include "lwtnn/LightweightGraph.hh" -#include "lwtnn/parse_json.hh" +// generic network class +#include "ISF_FastCaloSimEvent/VNetworkBase.h" +// net class for legacy loading +#include "ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h" #include <fstream> @@ -62,16 +63,26 @@ private: FitResultsPerLayer m_allFitResults; ExtrapolatorWeights m_extrapolatorWeights; + // legacy - keep or streamers are confused by + // old classes that didn't inherit TFCSGANLWTNNHandler *m_gan_all = nullptr; TFCSGANLWTNNHandler *m_gan_low = nullptr; TFCSGANLWTNNHandler *m_gan_high = nullptr; + // updated - can take an old or new class + std::unique_ptr<VNetworkBase> m_net_all = nullptr; + std::unique_ptr<VNetworkBase> m_net_low = nullptr; + std::unique_ptr<VNetworkBase> m_net_high = nullptr; + // getters so that we are insensitive to where the data actually is + VNetworkBase *GetNetAll() const; + VNetworkBase *GetNetLow() const; + VNetworkBase *GetNetHigh() const; bool LoadGANNoRange(std::string inputFileName); bool LoadGANFromRange(std::string inputFileName, std::string energyRange); TFCSGANXMLParameters m_param; - ClassDef(TFCSGANEtaSlice, 4) // TFCSGANEtaSlice + ClassDef(TFCSGANEtaSlice, 5) // TFCSGANEtaSlice }; #endif //> !ISF_TFCSGANETASLICE_H diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h index cd9646ee5262f77cd2afa127ceb3b92eb1f6a9a5..c5f56a3de1ebf199ffba5465105f080a85623445 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h @@ -1,19 +1,33 @@ -/* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration -*/ +/** + * Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + * + * Class for a neural network read in the LWTNN format. + * Derived from the abstract base class VNetworkBase + * such that it can be used interchangably with it's + * sibling class, TFCSONNXHandler, TFCSGANLWTNNHandler, + * TFCSSimpleLWTNNHandler. + * + * Frustratingly, LightweightNeuralNetwork and LightweightGraph + * from lwtnn do not have a common ancestor, + * they could be connected with the bridge pattern, + * but that is more complex that currently required. + * This one handles the graph case, TFCSSimpleLWTNNHandler + * is for the non-graph case. + * + * The LoadNetwork function has VNetworkBase as it's return type + * so that it can make a run-time decision about which derived class + * to use, based on the file name presented. + **/ -////////////////////////////////////////////////////////////////// -// TFCSGANLWTNNHandler.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// +// Hopefully documentation gets inherited from VNetworkBase -#ifndef ISF_TFCSGANLWTNNHANDLER_H -#define ISF_TFCSGANLWTNNHANDLER_H 1 +#ifndef TFCSGANLWTNNHANDLER_H +#define TFCSGANLWTNNHANDLER_H #include "ISF_FastCaloSimEvent/VNetworkLWTNN.h" +// Becuase we have a field of type LightweightGraph #include "lwtnn/LightweightGraph.hh" -#include "lwtnn/parse_json.hh" -#include <string> // For writing to a tree #include <vector> @@ -22,18 +36,86 @@ class TFCSGANLWTNNHandler : public VNetworkLWTNN { public: - TFCSGANLWTNNHandler(); - virtual ~TFCSGANLWTNNHandler(); + // Don't lose default constructors + using VNetworkLWTNN::VNetworkLWTNN; + + /** + * @brief TFCSGANLWTNNHandler constructor. + * + * Calls setupPersistedVariables and setupNet. + * + * @param inputFile file-path on disk (with file name) of a readable + * lwtnn file containing a json format description + * of the network to be constructed, or the json + * itself as a string. + **/ + explicit TFCSGANLWTNNHandler(const std::string &inputFile); + + /** + * @brief TFCSGANLWTNNHandler copy constructor. + * + * Will copy the variables that would be generated by + * setupPersistedVariables and setupNet. + * + * @param copy_from existing network that we are copying + **/ + TFCSGANLWTNNHandler(const TFCSGANLWTNNHandler ©_from); - const lwt::LightweightGraph *GetGraph() const { return m_graph; } + /** + * @brief Function to pass values to the network. + * + * This function hides variations in the formated needed + * by different network libraries, providing a uniform input + * and output type. + * + * @param inputs values to be evaluated by the network + * @return the output of the network + * @see VNetworkBase::NetworkInputs + * @see VNetworkBase::NetworkOutputs + **/ + NetworkOutputs compute(NetworkInputs const &inputs) const override; - bool LoadGAN(const std::string &inputFile); + /** + * @brief List the names of the outputs. + * + * Outputs are stored in an NetworkOutputs object + * which is indexed by strings. This function + * returns the list of all strings that will index the outputs. + * + **/ + std::vector<std::string> getOutputLayers() const override; + +protected: + /** + * @brief Perform actions that prepare network for use. + * + * Will be called in the streamer or class constructor + * after the inputs have been set (either automaically by the + * streamer or by setupPersistedVariables in the constructor). + * Does not delete any resources used. + * + **/ + void setupNet() override; private: - const lwt::LightweightGraph *m_graph; //! Do not persistify + // unique ptr deletes the object when it goes out of scope + /** + * @brief The network that we are wrapping here. + **/ + std::unique_ptr<lwt::LightweightGraph> m_lwtnn_graph; //! Do not persistify + + /** + * @brief List of names that index the output layer. + **/ + std::vector<std::string> m_outputLayers; //! Do not persistify + + /** + * @brief Just for backcompatability. + **/ std::string *m_input = nullptr; - ClassDef(TFCSGANLWTNNHandler, 5) // TFCSGANLWTNNHandler + // Suppling a ClassDef for writing to file. + ClassDefOverride(TFCSGANLWTNNHandler, 6); }; -#endif //> !ISF_TFCSGANLWTNNHANDLER_H +#endif // TFCSGANLWTNNHANDLER_H diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSPredictExtrapWeights.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSPredictExtrapWeights.h index 3e52f07b614612bb0efc377e633b35f31df60e9f..3ea73af820c13f254fec68c644674791e6962a83 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSPredictExtrapWeights.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSPredictExtrapWeights.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef ISF_FASTCALOSIMEVENT_TFCSPREDICTEXTRAPWEIGHTS_h @@ -51,6 +51,10 @@ public: const std::string &FastCaloTXTInputFolderName); // Test function + static void test_path(std::string &net_path, std::string const &norm_path, + TFCSSimulationState *simulstate = nullptr, + const TFCSTruthState *truth = nullptr, + const TFCSExtrapolationState *extrapol = nullptr); static void unit_test(TFCSSimulationState *simulstate = nullptr, const TFCSTruthState *truth = nullptr, const TFCSExtrapolationState *extrapol = nullptr); diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/MLogging.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/MLogging.cxx index 8c0425f2f0a650329ba8558d579d9dc08d5f5633..03feab1330be4e77d0f97ea1c950e4e4c150bc07 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/MLogging.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/MLogging.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "ISF_FastCaloSimEvent/MLogging.h" @@ -104,8 +104,8 @@ MLogging &MLogging::operator=(const MLogging &rhs) { void MLogging::setLevel(MSG::Level lvl) { lvl = (lvl >= MSG::NUM_LEVELS) ? MSG::ALWAYS - : (lvl < MSG::NIL) ? MSG::NIL - : lvl; + : (lvl < MSG::NIL) ? MSG::NIL + : lvl; msg().setLevel(lvl); } diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGANV2.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGANV2.cxx index 76d3bae494da9a2806b91701798d3693d0aad759..1998c5443120aa08ce2f8e68c7aa9b14d7a333c4 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGANV2.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSEnergyAndHitGANV2.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "ISF_FastCaloSimEvent/TFCSEnergyAndHitGANV2.h" @@ -70,7 +70,8 @@ void TFCSEnergyAndHitGANV2::set_nr_of_init(unsigned int bin, // initialize lwtnn network bool TFCSEnergyAndHitGANV2::initializeNetwork( - int pid, int etaMin, const std::string &FastCaloGANInputFolderName) { + int const &pid, int const &etaMin, + const std::string &FastCaloGANInputFolderName) { // initialize all necessary constants // FIXME eventually all these could be stored in the .json file @@ -78,7 +79,7 @@ bool TFCSEnergyAndHitGANV2::initializeNetwork( ATH_MSG_INFO( "Using FastCaloGANInputFolderName: " << FastCaloGANInputFolderName); // get neural net JSON file as an std::istream object - int etaMax = etaMin + 5; + const int etaMax = etaMin + 5; reset_match_all_pdgid(); set_pdgid(pid); @@ -95,7 +96,7 @@ bool TFCSEnergyAndHitGANV2::initializeNetwork( pidForXml = 211; } - int etaMid = (etaMin + etaMax) / 2; + const int etaMid = (etaMin + etaMax) / 2; m_param.InitialiseFromXML(pidForXml, etaMid, FastCaloGANInputFolderName); m_param.Print(); m_slice = new TFCSGANEtaSlice(pid, etaMin, etaMax, m_param); @@ -150,16 +151,15 @@ bool TFCSEnergyAndHitGANV2::fillEnergy( const TFCSGANEtaSlice::FitResultsPerLayer &fitResults = m_slice->GetFitResults(); // used only if GAN version > 1 - unsigned int energyBins = outputs.size(); - ATH_MSG_VERBOSE("energy voxels size = " << energyBins); + ATH_MSG_DEBUG("energy voxels size = " << outputs.size()); double totalEnergy = 0; - for (unsigned int i = 0; i < energyBins; ++i){ - totalEnergy += outputs.at("out_" + std::to_string(i)); + for (auto output : outputs) { + totalEnergy += output.second; } - if (totalEnergy < 0){ + if (totalEnergy < 0) { ATH_MSG_WARNING("Energy from GAN is negative, skipping particle"); - return false; + return false; } ATH_MSG_VERBOSE("Get binning"); @@ -168,11 +168,11 @@ bool TFCSEnergyAndHitGANV2::fillEnergy( int vox = 0; for (const auto &element : binsInLayers) { - int layer = element.first; + const int layer = element.first; const TH2D *h = &element.second; - int xBinNum = h->GetNbinsX(); - int yBinNum = h->GetNbinsY(); + const int xBinNum = h->GetNbinsX(); + const int yBinNum = h->GetNbinsY(); const TAxis *x = h->GetXaxis(); // If only one bin in r means layer is empty, no value should be added @@ -192,7 +192,7 @@ bool TFCSEnergyAndHitGANV2::fillEnergy( for (int ix = 1; ix <= xBinNum; ++ix) { double binsInAlphaInRBin = GetAlphaBinsForRBin(x, ix, yBinNum); for (int iy = 1; iy <= binsInAlphaInRBin; ++iy) { - double energyInVoxel = outputs.at("out_" + std::to_string(vox)); + const double energyInVoxel = outputs.at(std::to_string(vox)); ATH_MSG_VERBOSE(" Vox " << vox << " energy " << energyInVoxel << " binx " << ix << " biny " << iy); @@ -217,10 +217,10 @@ bool TFCSEnergyAndHitGANV2::fillEnergy( vox = 0; for (const auto &element : binsInLayers) { - int layer = element.first; + const int layer = element.first; const TH2D *h = &element.second; - int xBinNum = h->GetNbinsX(); - int yBinNum = h->GetNbinsY(); + const int xBinNum = h->GetNbinsX(); + const int yBinNum = h->GetNbinsY(); const TAxis *x = h->GetXaxis(); const TAxis *y = h->GetYaxis(); @@ -300,13 +300,13 @@ bool TFCSEnergyAndHitGANV2::fillEnergy( // Now create hits for (int ix = 1; ix <= xBinNum; ++ix) { - int binsInAlphaInRBin = GetAlphaBinsForRBin(x, ix, yBinNum); + const int binsInAlphaInRBin = GetAlphaBinsForRBin(x, ix, yBinNum); // Horrible work around for variable # of bins along alpha direction - int binsToMerge = yBinNum == 32 ? 32 / binsInAlphaInRBin : 1; + const int binsToMerge = yBinNum == 32 ? 32 / binsInAlphaInRBin : 1; for (int iy = 1; iy <= binsInAlphaInRBin; ++iy) { - double energyInVoxel = outputs.at("out_" + std::to_string(vox)); - int lowEdgeIndex = (iy - 1) * binsToMerge + 1; + const double energyInVoxel = outputs.at(std::to_string(vox)); + const int lowEdgeIndex = (iy - 1) * binsToMerge + 1; ATH_MSG_VERBOSE(" Vox " << vox << " energy " << energyInVoxel << " binx " << ix << " biny " << iy); @@ -328,15 +328,15 @@ bool TFCSEnergyAndHitGANV2::fillEnergy( nHitsR = x->GetBinUpEdge(ix) - x->GetBinLowEdge(ix); if (yBinNum == 1) { // nbins in alpha depend on circumference lenght - double r = x->GetBinUpEdge(ix); + const double r = x->GetBinUpEdge(ix); nHitsAlpha = ceil(2 * TMath::Pi() * r / binResolution); } else { // d = 2*r*sin (a/2r) this distance at the upper r must be 1mm for // layer 1 or 5, 5mm otherwise. const TAxis *y = h->GetYaxis(); - double angle = y->GetBinUpEdge(iy) - y->GetBinLowEdge(iy); - double r = x->GetBinUpEdge(ix); - double d = 2 * r * sin(angle / 2 * r); + const double angle = y->GetBinUpEdge(iy) - y->GetBinLowEdge(iy); + const double r = x->GetBinUpEdge(ix); + const double d = 2 * r * sin(angle / 2 * r); nHitsAlpha = ceil(d / binResolution); } @@ -344,7 +344,7 @@ bool TFCSEnergyAndHitGANV2::fillEnergy( // For layers that are not EMB1 or EMEC1 use a maximum of 10 hits // per direction, a higher granularity is needed for the other // layers - int maxNhits = 10; + const int maxNhits = 10; nHitsAlpha = std::min(maxNhits, std::max(1, nHitsAlpha)); nHitsR = std::min(maxNhits, std::max(1, nHitsR)); } @@ -539,8 +539,9 @@ TFCSEnergyAndHitGANV2::simulate(TFCSSimulationState &simulstate, void TFCSEnergyAndHitGANV2::Print(Option_t *option) const { TFCSParametrization::Print(option); TString opt(option); - bool shortprint = opt.Index("short") >= 0; - bool longprint = msgLvl(MSG::DEBUG) || (msgLvl(MSG::INFO) && !shortprint); + const bool shortprint = opt.Index("short") >= 0; + const bool longprint = + msgLvl(MSG::DEBUG) || (msgLvl(MSG::INFO) && !shortprint); TString optprint = opt; optprint.ReplaceAll("short", ""); @@ -574,6 +575,25 @@ void TFCSEnergyAndHitGANV2::unit_test(TFCSSimulationState *simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) { ISF_FCS::MLogging logger; + ATH_MSG_NOCLASS(logger, "Start lwtnn test" << std::endl); + std::string path = "/eos/atlas/atlascerngroupdisk/proj-simul/AF3_Run3/" + "InputsToBigParamFiles/FastCaloGANWeightsVer02/"; + test_path(path, simulstate, truth, extrapol, "lwtnn"); + + ATH_MSG_NOCLASS(logger, "Start onnx test" << std::endl); + path = "/eos/atlas/atlascerngroupdisk/proj-simul/AF3_Run3/" + "InputsToBigParamFiles/FastCaloGANWeightsONNXVer08/"; + test_path(path, simulstate, truth, extrapol, "onnx"); + ATH_MSG_NOCLASS(logger, "Finish all tests" << std::endl); +} + +void TFCSEnergyAndHitGANV2::test_path(std::string path, + TFCSSimulationState *simulstate, + const TFCSTruthState *truth, + const TFCSExtrapolationState *extrapol, + std::string outputname, int pid) { + ISF_FCS::MLogging logger; + ATH_MSG_NOCLASS(logger, "Running test on " << path << std::endl); if (!simulstate) { simulstate = new TFCSSimulationState(); #if defined(__FastCaloSimStandAlone__) @@ -586,7 +606,7 @@ void TFCSEnergyAndHitGANV2::unit_test(TFCSSimulationState *simulstate, ATH_MSG_NOCLASS(logger, "New particle"); TFCSTruthState *t = new TFCSTruthState(); t->SetPtEtaPhiM(65536, 0, 0, 139.6); - t->set_pdgid(211); + t->set_pdgid(pid); truth = t; } if (!extrapol) { @@ -610,21 +630,18 @@ void TFCSEnergyAndHitGANV2::unit_test(TFCSSimulationState *simulstate, } TFCSEnergyAndHitGANV2 GAN("GAN", "GAN"); - GAN.setLevel(MSG::VERBOSE); - int pid = 211; - int etaMin = 20; - int etaMax = etaMin + 5; + GAN.setLevel(MSG::INFO); + const int etaMin = 20; + const int etaMax = etaMin + 5; ATH_MSG_NOCLASS(logger, "Initialize Networks"); - GAN.initializeNetwork(pid, etaMin, - "/eos/atlas/atlascerngroupdisk/proj-simul/AF3_Run3/" - "InputsToBigParamFiles/FastCaloGANWeightsVer02"); + GAN.initializeNetwork(pid, etaMin, path); for (int i = 0; i < 24; ++i) if (GAN.is_match_calosample(i)) { TFCSCenterPositionCalculation *c = new TFCSCenterPositionCalculation( Form("center%d", i), Form("center layer %d", i)); c->set_calosample(i); c->setExtrapWeight(0.5); - c->setLevel(MSG::VERBOSE); + c->setLevel(MSG::INFO); c->set_pdgid(pid); if (pid == 11) c->add_pdgid(-pid); @@ -640,24 +657,28 @@ void TFCSEnergyAndHitGANV2::unit_test(TFCSSimulationState *simulstate, GAN.Print(); - ATH_MSG_NOCLASS(logger, "Writing GAN to FCSGANtest.root"); - TFile *fGAN = TFile::Open("FCSGANtest.root", "recreate"); - GAN.Write(); + ATH_MSG_NOCLASS(logger, "Writing GAN to " << outputname); + const std::string outname = "FCSGANtest_" + outputname + ".root"; + TFile *fGAN = TFile::Open(outname.c_str(), "recreate"); + fGAN->cd(); + // GAN.Write(); + fGAN->WriteObjectAny(&GAN, "TFCSEnergyAndHitGANV2", "GAN"); + fGAN->ls(); fGAN->Close(); - ATH_MSG_NOCLASS(logger, "Open FCSGANtest.root"); - fGAN = TFile::Open("FCSGANtest.root"); + ATH_MSG_NOCLASS(logger, "Open " << outname); + fGAN = TFile::Open(outname.c_str()); TFCSEnergyAndHitGANV2 *GAN2 = (TFCSEnergyAndHitGANV2 *)(fGAN->Get("GAN")); + GAN2->setLevel(MSG::INFO); GAN2->Print(); - GAN2->setLevel(MSG::DEBUG); ATH_MSG_NOCLASS(logger, "Before running GAN2->simulate()"); GAN2->simulate(*simulstate, truth, extrapol); simulstate->Print(); } -int TFCSEnergyAndHitGANV2::GetBinsInFours(double bins) { +int TFCSEnergyAndHitGANV2::GetBinsInFours(double const &bins) { if (bins < 4) return 4; else if (bins < 8) @@ -672,14 +693,15 @@ int TFCSEnergyAndHitGANV2::GetAlphaBinsForRBin(const TAxis *x, int ix, int yBinNum) const { double binsInAlphaInRBin = yBinNum; if (yBinNum == 32) { - double widthX = x->GetBinWidth(ix); - double radious = x->GetBinCenter(ix); + ATH_MSG_DEBUG("yBinNum is special value 32"); + const double widthX = x->GetBinWidth(ix); + const double radious = x->GetBinCenter(ix); double circumference = radious * 2 * TMath::Pi(); if (m_param.IsSymmetrisedAlpha()) { circumference = radious * TMath::Pi(); } - double bins = circumference / widthX; + const double bins = circumference / widthX; binsInAlphaInRBin = GetBinsInFours(bins); ATH_MSG_DEBUG("Bin in alpha: " << binsInAlphaInRBin << " for r bin: " << ix << " (" << x->GetBinLowEdge(ix) << "-" diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANEtaSlice.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANEtaSlice.cxx index d18c6e892d27037d197d64a512db96dbcdd07174..24abda57314d344e231a383b8b982f8ac033cabc 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANEtaSlice.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANEtaSlice.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -9,6 +9,8 @@ // class header include #include "ISF_FastCaloSimEvent/TFCSGANEtaSlice.h" +#include "ISF_FastCaloSimEvent/TFCSNetworkFactory.h" + #include "CLHEP/Random/RandGauss.h" #include "TFitResult.h" @@ -28,32 +30,38 @@ TFCSGANEtaSlice::TFCSGANEtaSlice() {} TFCSGANEtaSlice::TFCSGANEtaSlice(int pid, int etaMin, int etaMax, const TFCSGANXMLParameters ¶m) - : m_pid (pid), - m_etaMin (etaMin), - m_etaMax (etaMax), - m_param (param) -{ -} + : m_pid(pid), m_etaMin(etaMin), m_etaMax(etaMax), m_param(param) {} TFCSGANEtaSlice::~TFCSGANEtaSlice() { - if (m_gan_all != nullptr) { - delete m_gan_all; - } - if (m_gan_low != nullptr) { - delete m_gan_low; - } - if (m_gan_high != nullptr) { - delete m_gan_high; - } + // Deleting a nullptr is a noop + delete m_gan_all; + delete m_gan_low; + delete m_gan_high; +} + +VNetworkBase *TFCSGANEtaSlice::GetNetAll() const { + if (m_net_all != nullptr) + return m_net_all.get(); + return m_gan_all; +} +VNetworkBase *TFCSGANEtaSlice::GetNetLow() const { + if (m_net_low != nullptr) + return m_net_low.get(); + return m_gan_low; +} +VNetworkBase *TFCSGANEtaSlice::GetNetHigh() const { + if (m_net_high != nullptr) + return m_net_high.get(); + return m_gan_high; } bool TFCSGANEtaSlice::IsGanCorrectlyLoaded() const { if (m_pid == 211 || m_pid == 2212) { - if (m_gan_all == nullptr) { + if (GetNetAll() == nullptr) { return false; } } else { - if (m_gan_high == nullptr || m_gan_low == nullptr) { + if (GetNetHigh() == nullptr || GetNetLow() == nullptr) { return false; } } @@ -61,43 +69,47 @@ bool TFCSGANEtaSlice::IsGanCorrectlyLoaded() const { } bool TFCSGANEtaSlice::LoadGAN() { + // Now load new data std::string inputFileName; CalculateMeanPointFromDistributionOfR(); ExtractExtrapolatorMeansFromInputs(); + bool success = true; + if (m_pid == 211) { inputFileName = m_param.GetInputFolder() + "/neural_net_" + std::to_string(m_pid) + "_eta_" + std::to_string(m_etaMin) + - "_" + std::to_string(m_etaMax) + "_All.json"; + "_" + std::to_string(m_etaMax) + "_All.*"; ATH_MSG_DEBUG("Gan input file name " << inputFileName); - m_gan_all = new TFCSGANLWTNNHandler(); - return m_gan_all->LoadGAN(inputFileName); + m_net_all = TFCSNetworkFactory::create(inputFileName); + if (m_net_all == nullptr) + success = false; } else if (m_pid == 2212) { inputFileName = m_param.GetInputFolder() + "/neural_net_" + std::to_string(m_pid) + "_eta_" + std::to_string(m_etaMin) + - "_" + std::to_string(m_etaMax) + "_High10.json"; + "_" + std::to_string(m_etaMax) + "_High10.*"; ATH_MSG_DEBUG("Gan input file name " << inputFileName); - m_gan_all = new TFCSGANLWTNNHandler(); - return m_gan_all->LoadGAN(inputFileName); + m_net_all = TFCSNetworkFactory::create(inputFileName); + if (m_net_all == nullptr) + success = false; } else { - bool returnValue; inputFileName = m_param.GetInputFolder() + "/neural_net_" + std::to_string(m_pid) + "_eta_" + std::to_string(m_etaMin) + - "_" + std::to_string(m_etaMax) + "_High12.json"; - m_gan_high = new TFCSGANLWTNNHandler(); - returnValue = m_gan_high->LoadGAN(inputFileName); - if (!returnValue) { - return returnValue; - } + "_" + std::to_string(m_etaMax) + "_High12.*"; + ATH_MSG_DEBUG("Gan input file name " << inputFileName); + m_net_high = TFCSNetworkFactory::create(inputFileName); + if (m_net_high == nullptr) + success = false; inputFileName = m_param.GetInputFolder() + "/neural_net_" + std::to_string(m_pid) + "_eta_" + std::to_string(m_etaMin) + - "_" + std::to_string(m_etaMax) + "_UltraLow12.json"; - m_gan_low = new TFCSGANLWTNNHandler(); - return m_gan_low->LoadGAN(inputFileName); - return true; + "_" + std::to_string(m_etaMax) + "_UltraLow12.*"; + m_net_low = TFCSNetworkFactory::create(inputFileName); + if (m_net_low == nullptr) + success = false; } + return success; } void TFCSGANEtaSlice::CalculateMeanPointFromDistributionOfR() { @@ -158,7 +170,7 @@ void TFCSGANEtaSlice::ExtractExtrapolatorMeansFromInputs() { } } -TFCSGANEtaSlice::NetworkOutputs +VNetworkBase::NetworkOutputs TFCSGANEtaSlice::GetNetworkOutputs(const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol, TFCSSimulationState simulstate) const { @@ -194,7 +206,7 @@ TFCSGANEtaSlice::GetNetworkOutputs(const TFCSTruthState *truth, for (int i = 0; i < m_param.GetLatentSpaceSize(); i++) { randUniformZ = CLHEP::RandGauss::shoot(simulstate.randomEngine(), 0.5, 0.5); - inputs["node_0"].insert(std::pair<std::string, double>( + inputs["Noise"].insert(std::pair<std::string, double>( "variable_" + std::to_string(i), randUniformZ)); } @@ -204,35 +216,43 @@ TFCSGANEtaSlice::GetNetworkOutputs(const TFCSTruthState *truth, // truth->P() <<" mass:" << truth->M() <<" Ekin_off:" << // truth->Ekin_off() << " Ekin_min:"<<Ekin_min<<" // Ekin_max:"<<Ekin_max); - // inputs["node_1"].insert ( std::pair<std::string,double>("variable_0", + // inputs["mycond"].insert ( std::pair<std::string,double>("variable_0", // truth->Ekin()/(std::pow(2,maxExp))) ); //Old conditioning using linear // interpolation, now use logaritminc interpolation - inputs["node_1"].insert(std::pair<std::string, double>( + inputs["mycond"].insert(std::pair<std::string, double>( "variable_0", log(truth->Ekin() / Ekin_min) / log(Ekin_max / Ekin_min))); if (m_param.GetGANVersion() >= 2) { if (false) { // conditioning on eta, should only be needed in transition // regions and added only to the GANs that use it, for now all // GANs have 3 conditioning inputs so filling zeros - inputs["node_1"].insert(std::pair<std::string, double>( + inputs["mycond"].insert(std::pair<std::string, double>( "variable_1", fabs(extrapol->IDCaloBoundary_eta()))); } else { - inputs["node_1"].insert(std::pair<std::string, double>("variable_1", 0)); + inputs["mycond"].insert(std::pair<std::string, double>("variable_1", 0)); } } + VNetworkBase::NetworkOutputs outputs; if (m_param.GetGANVersion() == 1 || m_pid == 211 || m_pid == 2212) { - return m_gan_all->GetGraph()->compute(inputs); + outputs = GetNetAll()->compute(inputs); } else { if (truth->P() > 4096) { // This is the momentum, not the energy, because the split is // based on the samples which are produced with the momentum ATH_MSG_DEBUG("Computing outputs given inputs for high"); - return m_gan_high->GetGraph()->compute(inputs); + outputs = GetNetHigh()->compute(inputs); } else { - return m_gan_low->GetGraph()->compute(inputs); + outputs = GetNetLow()->compute(inputs); } } + ATH_MSG_DEBUG("Start Network inputs ~~~~~~~~"); + ATH_MSG_DEBUG(VNetworkBase::representNetworkInputs(inputs, 10000)); + ATH_MSG_DEBUG("End Network inputs ~~~~~~~~"); + ATH_MSG_DEBUG("Start Network outputs ~~~~~~~~"); + ATH_MSG_DEBUG(VNetworkBase::representNetworkOutputs(outputs, 10000)); + ATH_MSG_DEBUG("End Network outputs ~~~~~~~~"); + return outputs; } void TFCSGANEtaSlice::Print() const { diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANLWTNNHandler.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANLWTNNHandler.cxx index 8e03779ec80a8d91df0bfe103a2decc852d96e59..c159bad2f67bd05f1f4ced94ace703c42c6a9d62 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANLWTNNHandler.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANLWTNNHandler.cxx @@ -1,66 +1,39 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TFCSGANLWTNNHandler.cxx, (c) ATLAS Detector software // -/////////////////////////////////////////////////////////////////// - -// class header include #include "ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h" -#include "TFile.h" //Needed for TBuffer - -#include <iostream> -#include <fstream> -#include <string> -#include <sstream> +// For writing to a tree +#include "TBranch.h" +#include "TTree.h" -TFCSGANLWTNNHandler::TFCSGANLWTNNHandler() { m_graph = nullptr; } +// LWTNN +#include "lwtnn/LightweightGraph.hh" +#include "lwtnn/parse_json.hh" -TFCSGANLWTNNHandler::~TFCSGANLWTNNHandler() { - if (m_input != nullptr) { - delete m_input; - } - if (m_graph != nullptr) { - delete m_graph; - } -} +TFCSGANLWTNNHandler::TFCSGANLWTNNHandler(const std::string &inputFile) + : VNetworkLWTNN(inputFile) { + ATH_MSG_DEBUG("Setting up from inputFile."); + setupPersistedVariables(); + setupNet(); +}; -bool TFCSGANLWTNNHandler::LoadGAN(const std::string &inputFile) { - std::ifstream input(inputFile); - std::stringstream sin; - sin << input.rdbuf(); - input.close(); - // build the graph - auto config = lwt::parse_json_graph(sin); - m_graph = new lwt::LightweightGraph(config); - if (m_graph == nullptr) { - return false; - } - if (m_input != nullptr) { - delete m_input; - } - m_input = new std::string(sin.str()); - return true; -} +TFCSGANLWTNNHandler::TFCSGANLWTNNHandler(const TFCSGANLWTNNHandler ©_from) + : VNetworkLWTNN(copy_from) { + // Cannot take copies of lwt::LightweightGraph + // (copy constructor disabled) + ATH_MSG_DEBUG("Making a new m_lwtnn_graph for copied network"); + std::stringstream json_stream(m_json); + const lwt::GraphConfig config = lwt::parse_json_graph(json_stream); + m_lwtnn_graph = std::make_unique<lwt::LightweightGraph>(config); + m_outputLayers = copy_from.m_outputLayers; +}; -void TFCSGANLWTNNHandler::Streamer(TBuffer &R__b) { - // Stream an object of class TFCSGANLWTNNHandler - if (R__b.IsReading()) { - R__b.ReadClassBuffer(TFCSGANLWTNNHandler::Class(), this); - if (m_graph != nullptr) { - delete m_graph; - m_graph = nullptr; - } - if (m_input != nullptr) { - std::stringstream sin; - sin.str(*m_input); - auto config = lwt::parse_json_graph(sin); - m_graph = new lwt::LightweightGraph(config); - } -#ifndef __FastCaloSimStandAlone__ - // When running inside Athena, delete config to free the memory +void TFCSGANLWTNNHandler::setupNet() { + // Backcompatability, previous versions stored this in m_input + if (m_json.length() == 0 && m_input != nullptr) { + m_json = *m_input; delete m_input; m_input = nullptr; } @@ -133,6 +106,13 @@ void TFCSGANLWTNNHandler::Streamer(TBuffer &buf) { this->deleteAllButNet(); #endif } else { - R__b.WriteClassBuffer(TFCSGANLWTNNHandler::Class(), this); - } -} + if (!m_json.empty()) { + ATH_MSG_DEBUG("Writing buffer in TFCSGANLWTNNHandler "); + } else { + ATH_MSG_WARNING( + "Writing buffer in TFCSGANLWTNNHandler, but m_json is empty"); + }; + // Persist variables + TFCSGANLWTNNHandler::Class()->WriteBuffer(buf, this); + }; +}; diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx index 180de694a45915746ed9778ccd7b40cb2ada769e..2be2327e8a31721bf1bab96ba9a895e7716dafb5 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "ISF_FastCaloSimEvent/TFCSParametrizationBase.h" @@ -57,8 +57,7 @@ void TFCSParametrizationBase::Print(Option_t *option) const { optprint.ReplaceAll("short", ""); if (longprint) { - ATH_MSG_INFO(optprint << GetTitle() << " (" << IsA()->GetName() << "*)" - << this); + ATH_MSG_INFO(optprint << GetTitle() << " " << IsA()->GetName() ); ATH_MSG(INFO) << optprint << " PDGID: "; if (is_match_all_pdgid()) { ATH_MSG(INFO) << "all"; diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPredictExtrapWeights.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPredictExtrapWeights.cxx index 7495f0c8ba74e7eb7165375e979da7e4e3b5378c..0fd2668ff79bf77bc85a2304bffd74576b252cbf 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPredictExtrapWeights.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSPredictExtrapWeights.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "ISF_FastCaloSimEvent/TFCSPredictExtrapWeights.h" @@ -185,7 +185,7 @@ TFCSPredictExtrapWeights::prepareInputs(TFCSSimulationState &simulstate, inputVariables["pdgId"] = 1; // one hot enconding } else if (is_match_pdgid(11) || is_match_pdgid(-11)) { inputVariables["pdgId"] = 0; // one hot enconding - } + } return inputVariables; } @@ -301,6 +301,7 @@ bool TFCSPredictExtrapWeights::initializeNetwork( ATH_MSG_INFO( "Using FastCaloNNInputFolderName: " << FastCaloNNInputFolderName); + set_pdgid(pid); std::string inputFileName = FastCaloNNInputFolderName + "NN_" + etaBin + ".json"; @@ -373,7 +374,28 @@ void TFCSPredictExtrapWeights::Streamer(TBuffer &R__b) { void TFCSPredictExtrapWeights::unit_test( TFCSSimulationState *simulstate, const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol) { + const std::string this_file = __FILE__; + const std::string parent_dir = this_file.substr(0, this_file.find("/src/")); + const std::string norm_path = parent_dir + "/share/NormPredExtrapSample/"; + std::string net_path = "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/" + "FastCaloSim/LWTNNPredExtrapSample/"; + test_path(net_path, norm_path, simulstate, truth, extrapol); + //net_path = "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/FastCaloSim/" + // "ONNXPredExtrapSample/"; + //test_path(net_path, norm_path, simulstate, truth, extrapol); +} + +// test_path() +// Function for testing +void TFCSPredictExtrapWeights::test_path( + std::string &net_path, std::string const &norm_path, + TFCSSimulationState *simulstate, const TFCSTruthState *truth, + const TFCSExtrapolationState *extrapol) { ISF_FCS::MLogging logger; + ATH_MSG_NOCLASS(logger, "Testing net path ..." + << net_path.substr(net_path.length() - 20) + << " and norm path ..." + << norm_path.substr(norm_path.length() - 20)); if (!simulstate) { simulstate = new TFCSSimulationState(); #if defined(__FastCaloSimStandAlone__) @@ -430,7 +452,7 @@ void TFCSPredictExtrapWeights::unit_test( << " eta " << eta); // Find eta bin - int Eta = eta * 10; + const int Eta = eta * 10; std::string etaBin = ""; for (int i = 0; i <= 25; ++i) { int etaTmp = i * 5; @@ -442,13 +464,10 @@ void TFCSPredictExtrapWeights::unit_test( ATH_MSG_NOCLASS(logger, "etaBin = " << etaBin); TFCSPredictExtrapWeights NN("NN", "NN"); - NN.setLevel(MSG::VERBOSE); + NN.setLevel(MSG::INFO); const int pid = truth->pdgid(); - NN.initializeNetwork(pid, etaBin, - "/eos/atlas/atlascerngroupdisk/proj-simul/AF3_Run3/Jona/" - "lwtnn_inputs/json/v23/"); - NN.getNormInputs(etaBin, "/eos/atlas/atlascerngroupdisk/proj-simul/AF3_Run3/" - "Jona/lwtnn_inputs/txt/v23/"); + NN.initializeNetwork(pid, etaBin, net_path); + NN.getNormInputs(etaBin, norm_path); // Get extrapWeights and save them as AuxInfo in simulstate @@ -457,15 +476,16 @@ void TFCSPredictExtrapWeights::unit_test( NN.prepareInputs(*simulstate, truth->E() * 0.001); // Get predicted extrapolation weights + ATH_MSG_NOCLASS(logger, "computing with m_nn"); auto outputs = NN.m_nn->compute(inputVariables); - std::vector<int> layers = {0, 1, 2, 3, 12}; + const std::vector<int> layers = {0, 1, 2, 3, 12}; for (int ilayer : layers) { simulstate->setAuxInfo<float>( ilayer, outputs["extrapWeight_" + std::to_string(ilayer)]); } // Simulate - int layer = 0; + const int layer = 0; NN.set_calosample(layer); TFCSLateralShapeParametrizationHitBase::Hit hit; NN.simulate_hit(hit, *simulstate, truth, extrapol); @@ -481,9 +501,9 @@ void TFCSPredictExtrapWeights::unit_test( fNN = TFile::Open("FCSNNtest.root"); TFCSPredictExtrapWeights *NN2 = (TFCSPredictExtrapWeights *)(fNN->Get("NN")); - NN2->setLevel(MSG::DEBUG); + NN2->setLevel(MSG::INFO); NN2->simulate_hit(hit, *simulstate, truth, extrapol); - simulstate->Print(); + //simulstate->Print(); return; } diff --git a/Simulation/SimulationConfig/python/SimConfigFlags.py b/Simulation/SimulationConfig/python/SimConfigFlags.py index 9028eba99e1fd9e5d011e400e9d166e6500a3d8a..a7098218854fad33ca6d1f9804667b80c92d40ea 100644 --- a/Simulation/SimulationConfig/python/SimConfigFlags.py +++ b/Simulation/SimulationConfig/python/SimConfigFlags.py @@ -19,9 +19,9 @@ def createSimConfigFlags(): return CalibrationRun.Off return CalibrationRun.DeadLAr - scf.addFlag("Sim.CalibrationRun", _checkCalibrationRun, enum=CalibrationRun) + scf.addFlag("Sim.CalibrationRun", _checkCalibrationRun, type=CalibrationRun) - scf.addFlag("Sim.CavernBackground", CavernBackground.Off, enum=CavernBackground) + scf.addFlag("Sim.CavernBackground", CavernBackground.Off, type=CavernBackground) scf.addFlag("Sim.ReadTR", False) scf.addFlag("Sim.WorldRRange", False) # 12500. / int or float scf.addFlag("Sim.WorldZRange", False) # 22031. / int or float @@ -71,7 +71,7 @@ def createSimConfigFlags(): scf.addFlag("Sim.ReleaseGeoModel", False) scf.addFlag("Sim.RecordFlux", False) scf.addFlag("Sim.TruthStrategy", lambda prevFlags : TruthStrategy.Validation if prevFlags.Sim.ISF.ValidationMode else TruthStrategy.MC12, - enum=TruthStrategy) + type=TruthStrategy) scf.addFlag("Sim.UseShadowEvent", False) scf.addFlag("Sim.G4Commands", ["/run/verbose 2"]) scf.addFlag("Sim.FlagAbortedEvents", False) @@ -121,14 +121,14 @@ def createSimConfigFlags(): # G4AtlasToolsConfig scf.addFlag("Sim.RecordStepInfo", False) scf.addFlag("Sim.StoppedParticleFile", "") - scf.addFlag("Sim.BeamPipeSimMode", BeamPipeSimMode.Normal, enum=BeamPipeSimMode) - scf.addFlag("Sim.LArParameterization", LArParameterization.NoFrozenShowers, enum=LArParameterization) + scf.addFlag("Sim.BeamPipeSimMode", BeamPipeSimMode.Normal, type=BeamPipeSimMode) + scf.addFlag("Sim.LArParameterization", LArParameterization.NoFrozenShowers, type=LArParameterization) # TRT Range cut used in simulation in mm. Should be 0.05 or 30. scf.addFlag("Sim.TRTRangeCut", lambda prevFlags: float(GetFileMD(prevFlags.Input.Files).get('TRTRangeCut', 30.0))) # BeameffectsAlg - scf.addFlag("Sim.VertexSource", VertexSource.CondDB, enum=VertexSource) + scf.addFlag("Sim.VertexSource", VertexSource.CondDB, type=VertexSource) scf.addFlag("Sim.VertexTimeSmearing", lambda prevFlags: prevFlags.Beam.Type == BeamType.Collisions and prevFlags.GeoModel.Run >= LHCPeriod.Run4) @@ -196,7 +196,7 @@ def createSimConfigFlags(): simulator = SimulationFlavour.Unknown return simulator - scf.addFlag("Sim.ISF.Simulator", _checkSimulationFlavour, enum=SimulationFlavour) + scf.addFlag("Sim.ISF.Simulator", _checkSimulationFlavour, type=SimulationFlavour) scf.addFlag("Sim.ISF.DoTimeMonitoring", True) # bool: run time monitoring scf.addFlag("Sim.ISF.DoMemoryMonitoring", True) # bool: run time monitoring scf.addFlag("Sim.ISF.ValidationMode", False) # bool: run ISF internal validation checks