diff --git a/AtlasTest/CITest/Athena.cmake b/AtlasTest/CITest/Athena.cmake index bab0df63c8f14bd7818e95d7b778991698ac047e..7f414072da90cf72ca683a3751dfecac4afa2a42 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 ActsWorkflow.sh + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/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,46 +244,43 @@ 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 ActsValidateClusters.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateClusters.sh ) atlas_add_citest( ACTS_ValidateActsCoreSpacePoints - SCRIPT ActsValidateActsCoreSpacePoints.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateActsCoreSpacePoints.sh ) atlas_add_citest( ACTS_ValidateActsTrkSpacePoints - SCRIPT ActsValidateActsSpacePoints.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateActsSpacePoints.sh ) atlas_add_citest( ACTS_ValidateSeeds - SCRIPT ActsValidateSeeds.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateSeeds.sh ) atlas_add_citest( ACTS_ValidateOrthogonalSeeds - SCRIPT ActsValidateOrthogonalSeeds.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateOrthogonalSeeds.sh ) atlas_add_citest( ACTS_ActsPersistifyEDM - SCRIPT ActsPersistifyEDM.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsPersistifyEDM.sh ) atlas_add_citest( ACTS_ValidateTracks - SCRIPT ActsValidateTracks.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateTracks.sh ) atlas_add_citest( ACTS_ValidateResolvedTracks - SCRIPT ActsValidateResolvedTracks.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateResolvedTracks.sh ) atlas_add_citest( ACTS_ValidateAmbiguityResolution - SCRIPT ActsValidateAmbiguityResolution.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsValidateAmbiguityResolution.sh ) atlas_add_citest( ACTS_ActsKfRefitting - SCRIPT ActsKfRefitting.sh ) - -atlas_add_citest( ACTS_ActsEFTrackFit - SCRIPT ActsEFTrackFit.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsKfRefitting.sh ) atlas_add_citest( ACTS_ActsGSFRefitting - SCRIPT ActsGSFRefitting.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsGSFRefitting.sh ) atlas_add_citest( ACTS_ActsGSFInEgamma - SCRIPT ActsGSFInEgamma.sh ) + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/ActsGSFInEgamma.sh ) atlas_add_citest( ACTS_ActsBenchmarkWithSpot - SCRIPT ActsBenchmarkWithSpot.sh 8 100 + SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/test/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 3a9d01ee158a6b2d467d0e76b240e4c47f168777..f78b533ed353f6b12d8ab776cb627d1cb32ec9a9 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** * @file AthContainers/AuxVectorBase.h @@ -21,7 +21,6 @@ #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" @@ -97,11 +96,6 @@ 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. * @@ -196,113 +190,6 @@ 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 2ec691cde01bc23a338c4aad467ea259f193571b..5dcccbb52c63354dac81b9cac26df5aca785e20a 100644 --- a/Control/AthContainers/AthContainers/AuxVectorBase.icc +++ b/Control/AthContainers/AthContainers/AuxVectorBase.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** @@ -45,146 +45,6 @@ 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 2b3fa605b730b2b56e3be74756934d16f2236e35..bcba7963bb9ec0d66a0e2233ae05ccb7d587aa8e 100644 --- a/Control/AthContainers/AthContainers/AuxVectorData.h +++ b/Control/AthContainers/AthContainers/AuxVectorData.h @@ -1,6 +1,7 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. + /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** * @file AthContainers/AuxVectorData.h @@ -166,6 +167,11 @@ 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(); @@ -438,6 +444,16 @@ 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. @@ -445,6 +461,16 @@ 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. @@ -452,8 +478,14 @@ public: bool isAvailableWritableAsDecoration (auxid_t id) const; - // Versions of isAvailable* that take a name rather than an ID are - // in the derived class AuxVectorBase. + /** + * @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; /** @@ -563,6 +595,70 @@ 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 cd066725d4128cd0c074486be0443bc3e391b666..b38814113307adf04ef8504f741010135ebafbb8 100644 --- a/Control/AthContainers/AthContainers/AuxVectorData.icc +++ b/Control/AthContainers/AthContainers/AuxVectorData.icc @@ -1,7 +1,9 @@ // Dear emacs, this is -*- c++ -*- + /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ + /** * @file AthContainers/AuxVectorData.icc * @author scott snyder <snyder@bnl.gov> @@ -10,6 +12,7 @@ */ +#include "AthContainers/AuxTypeRegistry.h" #include "AthContainersInterfaces/IAuxStore.h" #include "AthContainersInterfaces/IConstAuxStore.h" #include "AthContainers/tools/likely.h" @@ -126,6 +129,21 @@ 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. @@ -139,6 +157,22 @@ 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. @@ -152,6 +186,22 @@ 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. @@ -292,6 +342,99 @@ 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 3e74b2484721b9f3110108b4e4904d2a25d2e5cd..28c342a29e7e8631bd8aa110ad4417efd98a461a 100644 --- a/Control/AthContainers/share/AuxVectorBase_test.ref +++ b/Control/AthContainers/share/AuxVectorBase_test.ref @@ -1,8 +1,6 @@ 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 023c948a39625476ae1d5f60285c1da267964f0a..b57cf2071849dfcfeb3efca172e1f13c187d1061 100644 --- a/Control/AthContainers/test/AuxVectorBase_test.cxx +++ b/Control/AthContainers/test/AuxVectorBase_test.cxx @@ -1,6 +1,8 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ + +// $Id$ /** * @file AthContainers/test/AuxVectorBase_test.cxx * @author scott snyder <snyder@bnl.gov> @@ -520,73 +522,6 @@ 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"; @@ -1058,8 +993,6 @@ 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 0302613d8e453230cb3b46a2be16a96e90452647..934a2aa2a5759927b58a8b68b434c2beea6f09b4 100644 --- a/Control/AthContainers/test/AuxVectorData_test.cxx +++ b/Control/AthContainers/test/AuxVectorData_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** * @file AthContainers/test/AuxVectorData_test.cxx @@ -50,6 +50,13 @@ 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"; @@ -68,6 +75,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 (b1.getConstStore() == 0); assert (b1.getStore() == 0); b1.setStore (cstore); @@ -78,6 +88,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")); 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)); @@ -97,9 +110,15 @@ 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); @@ -107,6 +126,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")); SG::auxid_t ftyp = SG::AuxTypeRegistry::instance().getAuxID<float> ("aFloat"); float* ff = reinterpret_cast<float*> (store.getData (ftyp, 10, 20)); @@ -114,6 +136,11 @@ 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 65493f70f083c9b45bea213b433bc61c5bdde0cd..0f25f538d0f5a12feed98eba5924fe5901e2451c 100644 --- a/Control/AthenaConfiguration/CMakeLists.txt +++ b/Control/AthenaConfiguration/CMakeLists.txt @@ -81,10 +81,6 @@ 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 4aa1e36bccdea05e752c6981b16429eb54de6331..b20859b54671b7f9d95289117e8a456483f403b9 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, type=ProductionStep, help=argparse.SUPPRESS) + acf.addFlag('Common.ProductionStep', ProductionStep.Default, enum=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", "")), type=Campaign, help="expert flag, do not override") + acf.addFlag('Input.MCCampaign', lambda prevFlags : Campaign(GetFileMD(prevFlags.Input.Files).get("mc_campaign", "")), enum=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 5a88ad5f037416c623ad7a039a182feeded00d56..0e484cf617a8093ef1db46f649cb16242d375627 100644 --- a/Control/AthenaConfiguration/python/TestDefaults.py +++ b/Control/AthenaConfiguration/python/TestDefaults.py @@ -46,18 +46,3 @@ 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 1095aaa4c0a27ee74eece9b53d206c82802b20d9..48236eebbe0cbf8e5fc4f5f4085906366972f5dc 100755 --- a/Control/AthenaConfiguration/test/testAllConfigFlags_EVNT.py +++ b/Control/AthenaConfiguration/test/testAllConfigFlags_EVNT.py @@ -1,10 +1,19 @@ #!/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, defaultGeometryTags +from AthenaConfiguration.TestDefaults import defaultTestFiles 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: @@ -12,7 +21,6 @@ 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 f75753e366c374837a04f020458649eb1ff9f4ad..d6ffc83dc85cf391bac4bf5d3429ee1c4b868731 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, type=DQDataType ) + acf.addFlag('DQ.DataType', getDataType, enum=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 8ed1e1fbec1043b84bffed36f14022bfc026c25b..635f69055af73a6b409c95f78c384999272931a3 100644 --- a/Control/AthenaServices/src/AthenaOutputStreamTool.cxx +++ b/Control/AthenaServices/src/AthenaOutputStreamTool.cxx @@ -475,11 +475,12 @@ 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 (m_store->storeID() == StoreID::EVENT_STORE) { + if (proxy->address() == nullptr) { + proxy->setAddress(addr); + } else { addr->release(); } } diff --git a/Control/AthenaServices/src/MetaDataSvc.cxx b/Control/AthenaServices/src/MetaDataSvc.cxx index e663cb410c77d4b49b623cba1525fbcf8eb2fa3d..d192b6794daaaf717bd13bd48f7c465514aae1f5 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 on " << (*it)->name() << " for GUID \"" << guid << "\""); + ATH_MSG_DEBUG(" calling beginInputFile for " << (*it)->name()); 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,9 +284,8 @@ 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; } } @@ -302,7 +301,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; } } @@ -326,7 +325,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 3f3684b6c60be4ad665856415a91151377d7accc..3a7455ff4f54156093fb049c631877d4021e0539 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-2024 CERN for the benefit of the ATLAS collaboration. + * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration. */ /** * @file CxxUtils/vec.h @@ -45,21 +45,18 @@ * - @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. * - * Initializing with a value : + * Additional Helpers for common SIMD operations: * * - @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 - * Basic Algorithms : - * + * - @c CxxUtils::vany(const VEC& mask) check if any of the elements + * of a mask is true (not 0) * - @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 @@ -69,28 +66,15 @@ * 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]) * - * 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). + * 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. * 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 @@ -116,13 +100,12 @@ * from the second input vector should be placed * in the corresponding position in the result vector. * - * For good performance the user should + * In terms of expected performance it might be advantageous to * use vector types that fit the size of the ISA. - * e.g 128 bit wide for SSE, 256 wide for AVX etc. + * e.g 128 bit wide for SSE, 256 wide for AVX. * * 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. @@ -152,75 +135,70 @@ 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 Deduce the element type from a vectorized type. + * @brief Define a nice alias for the vectorized type */ -template <class VEC> -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; -}; +template <typename T, size_t N> +using vec = typename vec_typedef<T,N>::type; /** - * @brief Deduce the type of the mask returned by relational operations, - * for a vectorized type. + * @brief Deduce the element type from a vectorized 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 std::remove_cv_t<std::remove_reference_t<type1>> 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; }; /** - * @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 + * @brief Define a nice alias for the element type of a vectorized type */ -template <typename T, size_t N> -using vec = typename vecDetail::vec_typedef<T,N>::type; +template<class VEC> +using vec_type_t = typename vec_type<VEC>::type; /** - * @brief Define a nice alias for the element type of a vectorized type + * @brief Deduce the type of the mask returned by relational operations, + * for a vectorized type. */ template<class VEC> -using vec_type_t = typename vecDetail::vec_type<VEC>::type; +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 std::remove_cv_t<std::remove_reference_t<type1>> type; +}; /** * @brief Define a nice alias for the mask type for a vectorized type. */ template<class VEC> -using vec_mask_type_t = typename vecDetail::vec_mask_type<VEC>::type; +using vec_mask_type_t = typename vec_mask_type<VEC>::type; /** * @brief Return the number of elements in a vectorized type. @@ -291,14 +269,30 @@ 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) { @@ -311,7 +305,7 @@ void vselect(VEC& dst, const VEC& a, const VEC& b, const vec_mask_type_t<VEC>& m /* * @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 @@ -347,61 +341,6 @@ 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 @@ -421,6 +360,15 @@ 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 @@ -435,7 +383,7 @@ vpermute(VEC& dst, const VEC& src) static_assert((sizeof...(Indices) == N), "vpermute number of indices different than vector size"); static_assert( - vecDetail::bool_pack_helper::all_true<(Indices >= 0 && Indices < N)...>::value, + 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 @@ -461,7 +409,7 @@ vpermute2(VEC& dst, const VEC& src1, const VEC& src2) (sizeof...(Indices) == N), "vpermute2 number of indices different than vector size"); static_assert( - vecDetail::bool_pack_helper::all_true<(Indices >= 0 && Indices < 2 * N)...>::value, + 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 @@ -483,6 +431,7 @@ 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 998c5673a5ee2cac31a778aee656e7b97d62251e..de9ccff4f231289ced9f354d9ea53da7d14902d5 100644 --- a/Control/CxxUtils/test/vec_test_common.h +++ b/Control/CxxUtils/test/vec_test_common.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /** * @file CxxUtils/test/vec_test_common.h @@ -430,38 +430,21 @@ test_convert_to_int(const VEC& v1) template<class VEC> void -test_any(const VEC& v1) +test_any(const VEC& v1, const VEC& v2) { - VEC v2 = v1; - v2[0] += 1; //So v2 will be larger - CxxUtils::vec_mask_type_t<VEC> lt = v1 < v2; + CxxUtils::vec_mask_type_t<VEC> lt = v1<v2; + constexpr size_t N = CxxUtils::vec_size<VEC>(); bool result = CxxUtils::vany(lt); - 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); + bool loopResult = false; + for (size_t i = 0; i < N; ++i) { + if (lt[i] != 0) { + loopResult = true; + break; + } + } + assert(result == loopResult); } - - /** * Helper to fill a vector with N * elements. Where N the size of the vec @@ -545,9 +528,7 @@ testInt1() test_permute(testVec1); \ test_blend(testVec1); \ test_convert_to_double(testVec1); \ - test_any(testVec3); \ - test_none(testVec3); \ - test_all(testVec3); \ + test_any(testVec2, testVec3); \ test_int(testVec1); \ test_logops(testVec3); \ } while (0) diff --git a/Control/RootUtils/src/WithRootErrorHandler.cxx b/Control/RootUtils/src/WithRootErrorHandler.cxx index 6a8875215f45b7853c7d470e6bfa8fd3fe4f6145..4988e6f9a82fbf246acb4edfb5de53ba150fad94 100644 --- a/Control/RootUtils/src/WithRootErrorHandler.cxx +++ b/Control/RootUtils/src/WithRootErrorHandler.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration. + * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration. */ /** * @file RootUtils/src/WithRootErrorHandler.cxx @@ -11,7 +11,6 @@ #include "RootUtils/WithRootErrorHandler.h" #include <vector> -#include <cstdlib> namespace { diff --git a/Control/xAODRootAccess/Root/TAuxVector.cxx b/Control/xAODRootAccess/Root/TAuxVector.cxx index 3d77dca76b19a56554978271e52558b005b453ca..e1dba9b0d05257303a3bef0ccb9dcd5736980a34 100644 --- a/Control/xAODRootAccess/Root/TAuxVector.cxx +++ b/Control/xAODRootAccess/Root/TAuxVector.cxx @@ -30,9 +30,7 @@ namespace xAOD { XAOD_MESSAGE( "No collection proxy found for type %s" ), cl->GetName() ); } - else { - m_proxy->PushProxy( m_vec ); - } + 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 dd1f6205d133d066391f86e5a991b1367100c924..a675037f3553402abc0edf87e45008d373077363 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, nLast = pBranches->GetLast(); i <= nLast; ++i ) { + for( int i = 0; i < pBranches->GetLast() ; ++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 ef3751273e202677730448b9cf0f2c40d078ebfa..d4a7d211151640637faa840f6a90f8cefe9cce90 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 on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool 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,7 +974,6 @@ 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 e660ef7d8aab22e1b35e3ee539c9833f91d4e2b7..811ed7dfb812ae206f344edfd37195f9a5f4e19f 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 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" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.AthPoolEx::ReadMeta SimplePoolFile5... DEBUG --> Access DbContainer READ [ROOT_Tree] MetaData(ExampleHitContainer_p1/PedestalWriteData) MetaData(Exampl... DEBUG Opening MetaData(Exampl... DEBUG attributes# = 1 @@ -858,8 +858,6 @@ 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 91d9070e18ad8ec16d6c04deb33f9a2d7fed39e4..3ab8ae8ca254c6ce32f0f8a57a2ef954ded1396f 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 on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool 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,7 +1957,6 @@ 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 1b946346d0ab66e726a639da574f67d0b78c4f6d..4e8ff910b36a8ebd1fa552a80fb20ed17bcc00c6 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 on ToolSvc.IOVDbMetaDataTool for GUID "095498FF-E805-B142-9948-BD2D4AC79975" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool 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,7 +1981,6 @@ 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 4527c7358fe541483333191706937bc56860e0bf..55bcaf0f0cf81e491e8fb1841047ce10b179e70b 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 on ToolSvc.IOVDbMetaDataTool for GUID "A811B014-0297-AD47-AF4C-B75EF418982D" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool 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,7 +1335,6 @@ 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 b363125722d251860157fe8012eb7f1d1bf249df..eb18e862a1a9d2745bcd15a5da90bec950416773 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_Read.ref @@ -230,10 +230,9 @@ 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 on ToolSvc.IOVDbMetaDataTool for GUID "" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool 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 @@ -252,7 +251,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 on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool EventSelector INFO skipping event 1 EventSelector INFO skipping event 2 EventSelector INFO skipping event 3 @@ -631,7 +630,6 @@ 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 @@ -695,7 +693,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 on ToolSvc.IOVDbMetaDataTool for GUID "" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -703,7 +701,6 @@ 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 @@ -798,7 +795,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 on ToolSvc.IOVDbMetaDataTool for GUID "73F77177-D136-9344-B64D-29693F68D6C2" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool SimplePoolFile2... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1266,7 +1263,6 @@ 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 @@ -1365,7 +1361,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 on ToolSvc.IOVDbMetaDataTool for GUID "A811B014-0297-AD47-AF4C-B75EF418982D" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool SimplePoolFile3... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1958,7 +1954,6 @@ 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 1525756c4a7539dd95b3d498d912ecc6730d28d2..7eed833ee71e84bccaac48eac014e3e8c7d2aa17 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadAgain.ref @@ -258,10 +258,9 @@ 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 on ToolSvc.IOVDbMetaDataTool for GUID "" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool 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 @@ -280,7 +279,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 on ToolSvc.IOVDbMetaDataTool for GUID "095498FF-E805-B142-9948-BD2D4AC79975" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool EventSelector INFO skipping event 1 EventSelector INFO skipping event 2 EventSelector INFO skipping event 3 @@ -659,7 +658,6 @@ 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 @@ -723,7 +721,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 on ToolSvc.IOVDbMetaDataTool for GUID "" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -731,7 +729,6 @@ 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 @@ -826,7 +823,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 on ToolSvc.IOVDbMetaDataTool for GUID "73F77177-D136-9344-B64D-29693F68D6C2" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool SimplePoolFile2... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1294,7 +1291,6 @@ 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 @@ -1393,7 +1389,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 on ToolSvc.IOVDbMetaDataTool for GUID "298DE14D-49CF-674A-9171-CEBBD9BEC6F8" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool SimplePoolFile4... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -2006,7 +2002,6 @@ 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 a19e4ef7901ee6ce834a3d35f78351171cd9b22f..21c53a1b27ca7944dadd14073e7d81f59e537854 100644 --- a/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref +++ b/Database/AthenaPOOL/AthenaPoolExample/AthenaPoolExampleAlgorithms/share/AthenaPoolExample_ReadConcat.ref @@ -254,10 +254,9 @@ 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 on ToolSvc.IOVDbMetaDataTool for GUID "" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool 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 @@ -276,7 +275,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 on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool EventSelector INFO skipping event 1 EventSelector INFO skipping event 2 EventSelector INFO skipping event 3 @@ -650,7 +649,6 @@ 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 @@ -714,7 +712,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 on ToolSvc.IOVDbMetaDataTool for GUID "" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool EmptyPoolFile.root DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -722,7 +720,6 @@ 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 @@ -817,7 +814,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 on ToolSvc.IOVDbMetaDataTool for GUID "73F77177-D136-9344-B64D-29693F68D6C2" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool SimplePoolFile2... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1285,7 +1282,6 @@ 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 @@ -1408,7 +1404,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 on ToolSvc.IOVDbMetaDataTool for GUID "A811B014-0297-AD47-AF4C-B75EF418982D" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool SimplePoolFile3... DEBUG --> Access DbContainer READ [ROOT_TreeIndex] MetaData(IOVMetaDataContainer_p1//TagInfo) MetaData(IOVMet... DEBUG Opening MetaData(IOVMet... DEBUG attributes# = 1 @@ -1996,7 +1992,6 @@ 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 597064312f425a47ca0f5564c937e82501c83ac2..f8089c27e1f5c934f254f11e7901999448d2dbb1 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 on ToolSvc.IOVDbMetaDataTool for GUID "F2313678-C96A-964F-89E8-08BAB39F2DA7" +MetaDataSvc DEBUG calling beginInputFile for ToolSvc.IOVDbMetaDataTool 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,7 +1092,6 @@ 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 b73ffc6409e2813484d061c6ee921dedc66c9554..ec5a332c2aa88b97d144ac2a6ace8ff328b81385 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); + FileIncident firstInputFileIncident(name(), "FirstInputFile", "FID:" + 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, m_guid.toString()); + FileIncident beginInputFileIncident(name(), "BeginInputFile", *m_inputCollectionsIterator, "FID:" + 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(), m_guid.toString()); + FileIncident beginInputFileIncident(name(), "BeginInputFile", "FID:" + m_guid.toString()); m_incidentSvc->fireIncident(beginInputFileIncident); } } diff --git a/Database/EventIndex/EventIndexProducer/CMakeLists.txt b/Database/EventIndex/EventIndexProducer/CMakeLists.txt index 74283a13c90791508cc0c149ed6e5bd1670ed526..23fd4afbea1b6cb4e205c83df32d2824a7d44c3b 100644 --- a/Database/EventIndex/EventIndexProducer/CMakeLists.txt +++ b/Database/EventIndex/EventIndexProducer/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 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 900 ) + PROPERTIES TIMEOUT 600 ) 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 900 ) + PROPERTIES TIMEOUT 600 ) 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 900 ) + PROPERTIES TIMEOUT 600 ) 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 900 ) + PROPERTIES TIMEOUT 600 ) diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py index 89e655bab7adf9e8c56fdcbe531aecba58e0629e..c79d96c594464e6f4c4dced2e0a9c0a2f663369e 100644 --- a/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py +++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/GeoModelConfig.py @@ -7,9 +7,6 @@ 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 e751aa126ae7a801de6d55a4e809332effd1b289..0edd643fa9f70bcb58940d39f545295ad92dd199 100644 --- a/DetectorDescription/GeoPrimitives/GeoPrimitives/GeoPrimitivesToStringConverter.h +++ b/DetectorDescription/GeoPrimitives/GeoPrimitives/GeoPrimitivesToStringConverter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 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 cc7492c71bca2193f842213d37ea58cf5ca63402..442978ac3603d2af45cc0cfbce4c5640cace3a1e 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::TrackSummaryContainer, ActsTrk::MultiTrajectory, ActsTrk::DataLinkHolder, true> &track) { +nlohmann::json DumpEventDataToJsonAlg::getData(const Acts::TrackProxy<ActsTrk::TrackStorageContainer, 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 b0b699ee626e0225143d024421581d026fb53e3c..09bcb380ac18ecfd0a01dec26e0f1e3fddf586f7 100644 --- a/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx +++ b/Event/EventBookkeeperTools/Root/BookkeeperTool.cxx @@ -234,13 +234,6 @@ 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 69425e6759beb066a74a764d8641050d9c10731a..597f240b61cacabebb708ee5502534854a48c02c 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 & (1ul << bit)) s << ((bits * i) + bit) << " "; + if (entry & (1 << 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 ca9c9d3b60a36c38f2607aa4656046a02d564e00..877429a490d3002ad2416b0ed13e4efcde1430bb 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*1000.-TVP_C.timeGlobalOffset()) - (timeA*1000.-TVP_A.timeGlobalOffset()))/2.*0.299792458 ; + double position = (timeC-timeA)/2.*0.299792458 - (TVP_C.timeGlobalOffset()-TVP_A.timeGlobalOffset()); return createVertex(position, distA, distC, outputContainer); } diff --git a/Generators/Pythia8_i/README.md b/Generators/Pythia8_i/README.md index c1a9671b0c7fd96d4d2f0e51d84d5024d7afecff..b507fa36a7a325a343b0e7a16cb55b825225b99f 100644 --- a/Generators/Pythia8_i/README.md +++ b/Generators/Pythia8_i/README.md @@ -163,86 +163,3 @@ 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 9336481fc566e6483cbb9554de48aedb63acc983..7a465d0ba9e12c9f05fa569528239d150a7d4c25 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 SCT_ReadoutGeometry 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 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 be6683de1fa30c7bbdadb822c08afde2d1fcf029..f983ab53710b446c3f0f413792ce49fc8f4ae4db 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.cxx @@ -44,10 +44,6 @@ - -#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" - - namespace{ std::string commonAlignmentOutput(const HepGeom::Transform3D & initialAlignment){ std::ostringstream os; @@ -184,12 +180,9 @@ 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_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 ) ); + 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) ); } else { // did not manage to book the N tuple.... msg(MSG::ERROR) << "Failed to book InitialAlignment ntuple." << endmsg; } @@ -629,8 +622,7 @@ 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)); @@ -897,7 +889,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(); @@ -905,53 +897,11 @@ namespace InDetAlignment m_AlignResults_beta = beta; m_AlignResults_gamma = gamma; - - 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_center_x = center.x(); + m_AlignResults_center_y = center.y(); + m_AlignResults_center_z = center.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 3ba6ae92dd4d29ecf46eeb6b72bf0dc00e767931..dd6735c084320b8cbe06baeaeeaa1579974fb330 100644 --- a/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h +++ b/InnerDetector/InDetAlignAlgs/InDetAlignGenAlgs/src/CreateMisalignAlg.h @@ -125,14 +125,9 @@ 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_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 + 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 // Member Functions diff --git a/InnerDetector/InDetDetDescr/PixelReadoutGeometry/src/PixelDetectorManager.cxx b/InnerDetector/InDetDetDescr/PixelReadoutGeometry/src/PixelDetectorManager.cxx index 1a6bca84688bb1871790d12a8cfcad6ea1e55061..514bd6c0031fd75ac884ced8cae74335558733f9 100755 --- a/InnerDetector/InDetDetDescr/PixelReadoutGeometry/src/PixelDetectorManager.cxx +++ b/InnerDetector/InDetDetDescr/PixelReadoutGeometry/src/PixelDetectorManager.cxx @@ -586,10 +586,6 @@ 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 d29c37ee6cafc207ab40ab42b5bda1aae15008e7..f08eb6efbc08fe24b41cc286aa4fbe7e9c4da2e2 100755 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/SCT_ReadoutGeometry/SCT_ModuleSideDesign.h @@ -208,6 +208,7 @@ 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 c30b4e978b960ab423fbeb7dced99263f74a6166..2b3f034cc80ae6a818787b0adf1d4ecf0869980f 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETREADOUTGEOMETRY_STRIPBOXDESIGN_H @@ -41,8 +41,7 @@ public: const int nStrips, const double pitch, const double length, - InDetDD::DetectorType detectorType = InDetDD::Undefined, - const double zShift=0.0); + const double zShift=0.0); ~StripBoxDesign() = default; @@ -55,92 +54,90 @@ 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; - virtual int strip1Dim(int strip, int row) const override; + int strip1Dim(int strip, int row) const; int diodes() const; - virtual int diodesInRow(const int row) const override; + int diodesInRow(const int row) const; // // Pure virtual methods in base class: // // Distance to nearest detector active edge (+ve = inside, -ve = outside) - virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, - double &phiDist) const override; + void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, + double &phiDist) const; // check if the position is in active area - virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap = true) const override; + bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap = true) const; // Element boundary - virtual const Trk::SurfaceBounds &bounds() const override; + const Trk::SurfaceBounds &bounds() const; // Retrieve the two ends of a "strip" - virtual std::pair<SiLocalPosition, SiLocalPosition> endsOfStrip( - const SiLocalPosition &position) const override; + std::pair<SiLocalPosition, SiLocalPosition> endsOfStrip( + const SiLocalPosition &position) const; // Phi-pitch (strip-width). Two names for same thing - virtual double stripPitch(const SiLocalPosition &localPosition) const override; + double stripPitch(const SiLocalPosition &localPosition) const; double stripPitch(const SiCellId &cellId) const; - virtual double stripPitch() const override; - virtual double phiPitch(const SiLocalPosition &localPosition) const override; + double stripPitch() const; + double phiPitch(const SiLocalPosition &localPosition) const; double phiPitch(const SiCellId &cellId) const; - virtual double phiPitch() const override; + double phiPitch() const; // 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 - virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const override; + double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const; // readout or diode id -> position, size - 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; + SiDiodesParameters parameters(const SiCellId &cellId) const; + SiLocalPosition localPositionOfCell(const SiCellId &cellId) const; + SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const; // position -> id - virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const override; + SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const; // id to position SiLocalPosition positionFromStrip(const SiCellId &cellId) const; - virtual SiLocalPosition positionFromStrip(const int stripNumber) const override; + SiLocalPosition positionFromStrip(const int stripNumber) const; // row and strip from 1-dim strip number - virtual int row(int stripId1Dim) const override; - virtual int strip(int stripId1Dim) const override; + int row(int stripId1Dim) const; + int strip(int stripId1Dim) const; // Find and fill a vector with all neighbour strips of a given cell - virtual void neighboursOfCell(const SiCellId &cellId, - std::vector<SiCellId> &neighbours) const override; - virtual SiCellId cellIdInRange(const SiCellId &) const override; + void neighboursOfCell(const SiCellId &cellId, + std::vector<SiCellId> &neighbours) const; + SiCellId cellIdInRange(const SiCellId &) const; // For Strip sensors, readout cell == diode cell. Overload the SCT_ModuleSideDesign // member - virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const override; + SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const; - virtual const Amg::Transform3D moduleShift() const override final; - - virtual InDetDD::DetectorType type() const override final; + const Amg::Transform3D moduleShift() const final; // --------------------------------------------------------------------------------------- // DEPRECATED at least for Strips - virtual HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const override; + HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const; // Method to calculate length of a strip. Which strip?? - virtual double length() const override; + double length() const; // Method to calculate average width of a module. What is it used for?? - virtual double width() const override; + double width() const; // Method to calculate minimum width of a module - virtual double minWidth() const override; + double minWidth() const; // Method to calculate maximum width of a module - virtual double maxWidth() const override; + double maxWidth() const; // Pitch in eta direction Deprecated for strips: it varies in endcap - virtual double etaPitch() const override; + double etaPitch() const; // Return true if hit local direction is the same as readout direction. - virtual bool swapHitPhiReadoutDirection() const override; - virtual bool swapHitEtaReadoutDirection() const override; + bool swapHitPhiReadoutDirection() const; + bool swapHitEtaReadoutDirection() const; - virtual bool nearBondGap(const SiLocalPosition &, double) const override; + bool nearBondGap(const SiLocalPosition &, double) const; // ------------------------------------------------------------------------------------------ @@ -151,9 +148,9 @@ public: double stripLength(const SiCellId &cellId) const; // Give upper and lower boundaries, and length, of dead area - virtual double deadAreaUpperBoundary() const override; - virtual double deadAreaLowerBoundary() const override; - virtual double deadAreaLength() const override; + double deadAreaUpperBoundary() const; + double deadAreaLowerBoundary() const; + double deadAreaLength() const; private: int m_nRows; int m_nStrips; @@ -221,10 +218,6 @@ 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 01c7322114bd0b7b8dd39b6457c1ccc97b3a657f..ff5554e4158adfe845a9171789f10c0c56cd1832 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef INDETREADOUTGEOMETRY_STRIPSTEREOANNULUSDESIGN_H @@ -61,8 +61,7 @@ public: const std::vector<double> &stripEnd, const double &stereoAngle, const double ¢reR, - const bool &usePC, - InDetDD::DetectorType detectorType = InDetDD::Undefined); + const bool &usePC); StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, const SiDetectorDesign::Axis &thicknessDirection, @@ -77,8 +76,7 @@ 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, - InDetDD::DetectorType detectorType = InDetDD::Undefined); + const bool &usePC); ~StripStereoAnnulusDesign() = default; @@ -90,39 +88,39 @@ StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, SiLocalPosition stripToBeamPC(const SiLocalPosition &pos) const; SiLocalPosition stripToBeamPCpolar(const SiLocalPosition &pos) const; - virtual Amg::Vector3D sensorCenter() const override; + Amg::Vector3D sensorCenter() const; // Copy constructor and assignment: StripStereoAnnulusDesign(const StripStereoAnnulusDesign &design); StripStereoAnnulusDesign &operator = (const StripStereoAnnulusDesign &design); std::pair<int,int> getStripRow(SiCellId cellId) const final; - virtual int strip1Dim(int strip, int row) const override; + int strip1Dim(int strip, int row) const; SiLocalPosition stripPosAtR(int strip, int row, double r) const; - virtual int diodesInRow(const int row) const override; + int diodesInRow(const int row) const; // // Pure virtual methods in base class: // // Distance to nearest detector active edge (+ve = inside, -ve = outside) - virtual void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, - double &phiDist) const override; + void distanceToDetectorEdge(const SiLocalPosition &localPosition, double &etaDist, + double &phiDist) const; // check if the position is in active area - virtual bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap = true) const override; + bool inActiveArea(const SiLocalPosition &chargePos, bool checkBondGap = true) const; // Element boundary - virtual const Trk::SurfaceBounds &bounds() const override; + const Trk::SurfaceBounds &bounds() const; // Retrieve the two ends of a "strip" - virtual std::pair<SiLocalPosition, SiLocalPosition> endsOfStrip( - const SiLocalPosition &position) const override; + std::pair<SiLocalPosition, SiLocalPosition> endsOfStrip( + const SiLocalPosition &position) const; // Phi-pitch (strip-width). Two names for same thing - virtual double stripPitch(const SiLocalPosition &localPosition) const override; + double stripPitch(const SiLocalPosition &localPosition) const; double stripPitch(const SiCellId &cellId) const; - virtual double stripPitch() const override; - virtual double phiPitch(const SiLocalPosition &localPosition) const override; + double stripPitch() const; + double phiPitch(const SiLocalPosition &localPosition) const; double phiPitch(const SiCellId &cellId) const; - virtual double phiPitch() const override; + double phiPitch() const; // above methods return mm @@ -136,12 +134,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 - virtual double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const override; + double scaledDistanceToNearestDiode(const SiLocalPosition &chargePos) const; // readout or diode id -> position, size - 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; + SiDiodesParameters parameters(const SiCellId &cellId) const; + SiLocalPosition localPositionOfCell(const SiCellId &cellId) const; + SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int clusterSize) const; // these return local position in STRIP PC // Use only if you work with the polar coordinates, in all other @@ -150,23 +148,23 @@ StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, SiLocalPosition localPositionOfClusterPC(const SiCellId &cellId, int clusterSize) const; // position -> id - virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const override; + SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const; // id to position SiLocalPosition positionFromStrip(const SiCellId &cellId) const; - virtual SiLocalPosition positionFromStrip(const int stripNumber) const override; + SiLocalPosition positionFromStrip(const int stripNumber) const; // row and strip from 1-dim strip number - virtual int row(int stripId1Dim) const override; - virtual int strip(int stripId1Dim) const override; + int row(int stripId1Dim) const; + int strip(int stripId1Dim) const; // Find and fill a vector with all neighbour strips of a given cell - virtual void neighboursOfCell(const SiCellId &cellId, - std::vector<SiCellId> &neighbours) const override; - virtual SiCellId cellIdInRange(const SiCellId &) const override; + void neighboursOfCell(const SiCellId &cellId, + std::vector<SiCellId> &neighbours) const; + SiCellId cellIdInRange(const SiCellId &) const; // For Strip sensors, readout cell == diode cell. Overload the SCT_ModuleSideDesign // member - virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const override; + SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const; //Returns the wafer centre Radius (needed for annulus shape) double waferCentreR() const; @@ -176,37 +174,35 @@ 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 - virtual HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const override; + HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition &position) const; // Method to calculate length of a strip. Which strip?? - virtual double length() const override; + double length() const; // Method to calculate average width of a module. What is it used for?? - virtual double width() const override; + double width() const; // Method to calculate minimum width of a module - virtual double minWidth() const override; + double minWidth() const; // Method to calculate maximum width of a module - virtual double maxWidth() const override; + double maxWidth() const; // Pitch in eta direction Deprecated for strips: it varies in endcap - virtual double etaPitch() const override; + double etaPitch() const; // Return true if hit local direction is the same as readout direction. - virtual bool swapHitPhiReadoutDirection() const override; - virtual bool swapHitEtaReadoutDirection() const override; + bool swapHitPhiReadoutDirection() const; + bool swapHitEtaReadoutDirection() const; - virtual bool nearBondGap(const SiLocalPosition &, double) const override; + bool nearBondGap(const SiLocalPosition &, double) const; /** Shape of element */ - virtual DetectorShape shape() const override; + virtual DetectorShape shape() const; - virtual double sinStripAngleReco(double phiCoord, double etaCoord) const override; + double sinStripAngleReco(double phiCoord, double etaCoord) const; // ------------------------------------------------------------------------------------------ @@ -222,9 +218,9 @@ StripStereoAnnulusDesign(const SiDetectorDesign::Axis &stripDirection, double stereo() const; // Give upper and lower boundaries, and length, of dead area - virtual double deadAreaUpperBoundary() const override; - virtual double deadAreaLowerBoundary() const override; - virtual double deadAreaLength() const override; + double deadAreaUpperBoundary() const; + double deadAreaLowerBoundary() const; + double deadAreaLength() const; private: const int m_nRows; const std::vector<int> m_nStrips; @@ -367,10 +363,6 @@ 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 412416a033464de6ead0e17d6b92e599dda79ba5..e89e793328753fd53ee2bf9fc2796b117efcaa01 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripBoxDesign.cxx @@ -20,8 +20,7 @@ StripBoxDesign::StripBoxDesign(const SiDetectorDesign::Axis stripDirection, const int nStrips, const double pitch, const double length, - InDetDD::DetectorType detectorType, - const double zShift) : + 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( @@ -33,7 +32,6 @@ 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 adce76d9580f7012353559eb5853d38743538cf2..00b01b0fc39695b139515d2f1d9468d7b5099826 100644 --- a/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx +++ b/InnerDetector/InDetDetDescr/SCT_ReadoutGeometry/src/StripStereoAnnulusDesign.cxx @@ -25,8 +25,7 @@ StripStereoAnnulusDesign::StripStereoAnnulusDesign(const SiDetectorDesign::Axis const double &stereoAngle, const double ¢reR, const double &waferCentreR, - const bool &usePC, - InDetDD::DetectorType detectorType) : + const bool &usePC) : SCT_ModuleSideDesign(thickness, false, false, true, 1, 0, 0, 0, false, carrier, readoutSide, stripDirection, thicknessDirection), m_nRows(nRows), @@ -44,9 +43,6 @@ 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"); @@ -118,10 +114,9 @@ StripStereoAnnulusDesign::StripStereoAnnulusDesign(const SiDetectorDesign::Axis const std::vector<double> &stripEndRadius, const double &stereoAngle, const double ¢reR, - const bool &usePC, - InDetDD::DetectorType detectorType): + const bool &usePC): StripStereoAnnulusDesign(stripDirection,thicknessDirection,thickness,readoutSide,carrier,nRows,nStrips, - pitch,stripStartRadius,stripEndRadius,stereoAngle,centreR,centreR,usePC,detectorType){ + pitch,stripStartRadius,stripEndRadius,stereoAngle,centreR,centreR,usePC){ //assuming here that centreR==waferCentreR } diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx index 51ac6d55fdc4866e5620ec9a59537fca057baeef..41f505233a04cc3bb4bd6601ef577196f1697a72 100644 --- a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx @@ -192,16 +192,6 @@ 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 // @@ -222,8 +212,7 @@ void StripGmxInterface::makeSiStripBox(const std::string &typeName, nRows, nStrips, pitch, - length, - detectorType); + length); for (int i = 0; i< splitLevel; i++) { for (int side : {0,1}) { //need different additional shift transform per side... @@ -239,7 +228,6 @@ void StripGmxInterface::makeSiStripBox(const std::string &typeName, nStrips, pitch, length, - detectorType, zShift); design->setMother(motherDesign.get()); @@ -262,8 +250,7 @@ void StripGmxInterface::makeSiStripBox(const std::string &typeName, nRows, nStrips, pitch, - length, - detectorType); + length); // Add to map for addSensor routine m_geometryMap[typeName] = design.get(); @@ -371,16 +358,6 @@ 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 // @@ -404,8 +381,7 @@ void StripGmxInterface::makeStereoAnnulus(const std::string &typeName, endR, stereoAngle, centreR, - usePC, - detectorType); + usePC); for (int i = 0; i < splitLevel; i++) { singleRowStrips.clear(); @@ -435,8 +411,7 @@ void StripGmxInterface::makeStereoAnnulus(const std::string &typeName, stereoAngle, thisCentreR, centreR, - usePC, - detectorType); + usePC); // Add to map for addSensor routine std::string splitName = typeName + "_" + std::to_string(i); @@ -465,8 +440,7 @@ void StripGmxInterface::makeStereoAnnulus(const std::string &typeName, endR, stereoAngle, centreR, - usePC, - detectorType); + usePC); 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 2f65cd9bdd0e397c086e253bc612b77bfd5c6857..99618162d9f1f0ab1071566a0c7b2c9c4bae7e22 100755 --- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_DetectorManager.cxx +++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_DetectorManager.cxx @@ -541,10 +541,6 @@ 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 356cec3604b51662d409fc8049df8ffe203bed2f..afe3db27962b4613548c06b2475b64bfa57c01d8 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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(const std::vector<double> & v, double val) { +int isContainedAt(std::vector<double> v, double val) { for (uint i = 0; i < v.size(); i++) { //Equality for decimals - if (v[i] - 0.00001 < val && val < v[i] + 0.00001) return i; + if (v.at(i) - 0.00001 < val && val < v.at(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, const 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, 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 voltage ifix + double ef = v2vsv1.at(ie).at(ifix); // different fluences for volatge 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(const std::vector<double> & vvol, const std::vector<double> & vflu, const std::vector<std::vector<double> > & vfluvvol, double aimFlu, double aimVol, double measure) { +double EfieldInterpolator::estimateEfieldInvDistance(std::vector<double> vvol, std::vector<double> vflu, 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 fbb711e3496a44240f5fda400c9c56263734860a..b749ab41a8b511fee11a48cf260c911712663508 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/EfieldInterpolator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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(const std::vector<double> & vvol, const std::vector<double> & vflu, - const std::vector<std::vector<double> > & vfluvvol, double aimFlu, double aimVol, + double estimateEfieldInvDistance(std::vector<double> vvol, std::vector<double> vflu, + 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, const std::vector<std::vector<double> > & v2vsv1, + int fillXYvectors(std::vector<double> vLoop, int ifix, 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 6957236fcb9bb3b941206cdeaffc132eac4462b0..76610bf9a5e4b1d19c400b54a1cc5085623d03be 100755 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ //================================================================================== @@ -182,32 +182,31 @@ StatusCode IDPerfMonZmumu::initialize() } } - // 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 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 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){ @@ -232,7 +231,7 @@ StatusCode IDPerfMonZmumu::initialize() ATH_CHECK (m_EventInfoKey.initialize()); // initializing the eventInfo "accessor" - if (m_isMC) ATH_CHECK (m_extrapolator.retrieve()); // this is only used for the truth particles + ATH_CHECK (m_extrapolator.retrieve()); ATH_CHECK (m_vertexKey.initialize()); diff --git a/InnerDetector/InDetRecAlgs/InDetSecVtxFinder/share/runInDetSecVtxFinder.py b/InnerDetector/InDetRecAlgs/InDetSecVtxFinder/share/runInDetSecVtxFinder.py index b69a523ae19bf24905058e9a3921dac618bd9be8..029e09609107f5ce4f3f77ac307dfdc07b720a16 100644 --- a/InnerDetector/InDetRecAlgs/InDetSecVtxFinder/share/runInDetSecVtxFinder.py +++ b/InnerDetector/InDetRecAlgs/InDetSecVtxFinder/share/runInDetSecVtxFinder.py @@ -1,8 +1,11 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 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 51012d5cdf855f58e3d1c43f52b31617ba29cfb1..4f627ffcef1f2144371a315fd76e9af09316bd9a 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h @@ -183,7 +183,6 @@ 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"}; @@ -215,8 +214,6 @@ 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 a14c7296bb1c618bbb40947f606fff8f852627db..d2b81d14f2e8e1c20f997603c9c8b27db42e487f 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValFlags.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValFlags.py @@ -37,7 +37,6 @@ 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 fc547bf23c8154c6aa7cf215ac16228cc2a313d5..db3a4acb6b7e9a7bdfe289be085c7100d7eff160 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringConfig.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringConfig.py @@ -240,8 +240,6 @@ 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 9d524628b9238500725e9291b5324fcb49f1b99f..f09a8135796ca852c0b4a6d02de7cfb16c9b199a 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/runIDPVM.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/runIDPVM.py @@ -2,8 +2,6 @@ # 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 @@ -42,7 +40,6 @@ 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 @@ -61,7 +58,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 @@ -92,7 +89,6 @@ 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 @@ -105,11 +101,6 @@ 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 71f6dd4961aa70ea2471a9dfdf78503c4252e5c6..03c49c1177950bea6468514f611030bd4e4acb52 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx @@ -159,8 +159,6 @@ 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 6b476dd853e64b77e65c5d76c10510d5629af767..56240e925281afb0b560af7e94ce389c3c5764f0 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_shifter_last +# art-html: dcube_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 00e553939703d0ac083f5134a3499dd25564aeb5..94084602c4aae7fcb1083c0e7b8cddd51706109e 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_shifter_last +# art-html: dcube_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 5726a4f9d7a3496f682613bd2b7e1d5e1213987d..9c1dd456f65ff38a10b80ccf0959e97143f6b34c 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_shifter_last +# art-html: dcube_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 c7a40e2d3759e5f3f5cc984da78d0e01b58e9114..d7972608632d68225169bad8debf0deb8aeb9aa9 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_shifter_last +# art-html: dcube_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 af177e0c519d269deafbfecbf1089f13e8e52ea4..61cc321d7bac24eb38b75b288dc5077408e59b18 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_shifter_last +# art-html: dcube_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 ba0abee167d72df147b4b7f7861c9da6e6d8499c..9bbf10a262bc533db5e9bb69f22831ade8467f4a 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_shifter_last +# art-html: dcube_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 8da6a158a780e070abe0729b8bb71d292fb96c45..bc0db1d3fb89806ac83e210f3a726a50d05d7e7b 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_shifter_last +# art-html: dcube_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 9e942a8121cade6c86ad94f0c8a4c95fd90bef6f..05946767577697887240f1a4e316d1349ff97b4b 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu100GeV_simreco.sh @@ -11,7 +11,6 @@ # 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 bd6539766c37198c7615097e903fba32882accc2..67d3cc0b1aade8e776460640852265368e3497ad 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_shifter_last +# art-html: dcube_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_shifter \ + -p -x dcube \ -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_shifter_last \ + -p -x dcube_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 1667f2f2758f3e062e9c790510d2867ce5c3b281..67efcbbf79a83dd1bce2ab8e4245664dc5fb753b 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_shifter_last +# art-html: dcube_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_shifter \ + -p -x dcube \ -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_shifter_last \ + -p -x dcube_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 20b159d75958425655903ca73ef7a7d2c917e8cf..6c7cdabcde10a56c90cae46b70f82b935dd8ff28 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu1GeV_simreco.sh @@ -11,7 +11,6 @@ # 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 cad7a4c22f536e4e037abc4202d6dfb02f1c1fdd..a3d506fb2af69aeb2edded2290830b5055ac7f49 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_shifter_last +# art-html: dcube_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 98f4647a4fb756dbfa7ea088277de31ff45e6572..3acaf16d9e61c09c74c4ee5c52d325091d693db4 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu20GeV_simreco.sh @@ -11,7 +11,6 @@ # 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 cc55aa1237130c448aebbac99c1a2979e5cf6015..9bd85142181c239113ac3e4c3f526a73b632da7f 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu5GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_mu5GeV_simreco.sh @@ -11,7 +11,6 @@ # 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 2ad5b5e9b4540e18bf85abd892c1080dba4520df..15202516b6f00b2bd558d2781fd7b1a7b02a3ebc 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_shifter_last +# art-html: dcube_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_shifter \ + -p -x dcube \ -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_shifter_last \ + -p -x dcube_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 9ca9fc3a3365c50c1576b0827b12d3a10a5bc540..ef880ebaa9a01cc88141d66b4d5fbf771a62d84f 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus1GeV_simreco.sh @@ -11,7 +11,6 @@ # 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 daf9163b2def0cf816653b01c091191936c5a929..4bc8aace9588eef909b418add4a984765dc6fc89 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_shifter_last +# art-html: dcube_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 62e916d1715a65857b1156658d1df371a040e271..8ca1f45a6cb9b8698fd9c08065356688deab8418 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_simreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_piplus5GeV_simreco.sh @@ -11,8 +11,6 @@ # 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 1bed5a906a550c0da18d534aa97aa9c853b70afd..aca9a60ebd0574d53da18d4d7eaf58b9261fa06e 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_lrt_last +# art-html: dcube_idtide_last #RDO is made at rel 22.0.73 #reference plots are made at rel 22.0.73 @@ -26,8 +26,10 @@ 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 03ae26c664ddb27ffad6fa7d6dd178640d46c545..9e2b118cb25cee1b3f2fcb228fa99d9bd9e7bb39 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_idtide_last +# art-html: dcube_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 496d58cf44368467f1bb06a41009917c78bf06f3..75c3b2fe6a79a4b276d07de45492a2c5aa39c7c1 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-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef LARLATOMEMAPPING_H @@ -12,7 +12,6 @@ #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 6c19d97cdae8e694d254b04b0c20c992dd17f741..692b8d90a887de7cd63bb4317cd9bdb1d013a3f3 100644 --- a/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx +++ b/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataReadingAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 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 = LArProv::DSPCALC; //0x1000 + uint16_t iprovenance = 0x1000; if (quality>0) { - iprovenance |= LArProv::QTPRESENT; //0x2000 + iprovenance |= 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 1c515500d4b5c9fdbe3ed5af1751dfd640d1ccbc..270250d7e596c25141eff2f13c33dac769d3cf0d 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, type=RawChannelSource) + lcf.addFlag("LAr.RawChannelSource",_determineRawChannelSource,enum=RawChannelSource) lcf.addFlag("LAr.doCellNoiseMasking",True) lcf.addFlag("LAr.doCellSporadicNoiseMasking",True) diff --git a/LArCalorimeter/LArElecCalib/CMakeLists.txt b/LArCalorimeter/LArElecCalib/CMakeLists.txt index 6a9dc9c8ef5ef3d6d1624da7c616569930a21e6c..5b740888982c7b20d7fe9ccbd107bcb26c080fcd 100644 --- a/LArCalorimeter/LArElecCalib/CMakeLists.txt +++ b/LArCalorimeter/LArElecCalib/CMakeLists.txt @@ -18,8 +18,3 @@ 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 b61926fd5566408d6d31344bfff0c2e111ada871..bac126f79a4243f848e92cb8af03f11c080bb6ea 100755 --- a/LArCalorimeter/LArElecCalib/LArElecCalib/LArElecCalibDict.h +++ b/LArCalorimeter/LArElecCalib/LArElecCalib/LArElecCalibDict.h @@ -47,7 +47,5 @@ #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 8a734f55dcaeacffa437200658f4ab561bdd3f1e..ac56f87a834c7b7b1751c378b7a23976c297bd69 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/python/exampleDriverScript.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/python/exampleDriverScript.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2021 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,34 +7,33 @@ 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 initConfigFlags -flags = initConfigFlags() +from AthenaConfiguration.AllConfigFlags import ConfigFlags from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags -addLArCalibFlags(flags) +addLArCalibFlags(ConfigFlags) #This allows set flags from the command-line (not strictly required for the AP) -flags.fillFromArgs() +ConfigFlags.fillFromArgs() #Now we set the flags as required for this particular job: #The following flags help finding the input bytestream 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 +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 #Set the database (sqlite-file) containing the input conditions that #come typcially from the same calibration campaign #(in this case, Pedestal and AutoCorr) -flags.LArCalib.Input.Database="db.sqlite" +ConfigFlags.LArCalib.Input.Database="db.sqlite" #Some configs depend on the sub-calo in question, here HEC #(sets also the preselection of LArRawCalibDataReadingAlg) -flags.LArCalib.Input.SubDet="HEC" +ConfigFlags.LArCalib.Input.SubDet="HEC" #Configure the Bad-Channel database we are reading #(the AP typically uses a snapshot in an sqlite file -flags.LArCalib.BadChannelDB="BadChannelSnapshot.db" -flags.LArCalib.BadChannelTag="-RUN2-UPD3-00" +ConfigFlags.LArCalib.BadChannelDB="BadChannelSnapshot.db" +ConfigFlags.LArCalib.BadChannelTag="-RUN2-UPD3-00" #Set a Geometry version (not really needed, but the job complains otherwise) from AthenaConfiguration.TestDefaults import defaultGeometryTags @@ -42,42 +41,42 @@ flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3 #Output of this job: #ROOT file: -flags.LArCalib.Output.ROOTFile="ofccali.root" +ConfigFlags.LArCalib.Output.ROOTFile="ofccali.root" #POOL file: -flags.LArCalib.Output.POOLFile="ofccali.pool.root" +ConfigFlags.LArCalib.Output.POOLFile="ofccali.pool.root" #sqlite file (can be the same as the input-sqlite, but slightly different syntax -flags.IOVDb.DBConnection="sqlite://;schema=db.sqlite;dbname=CONDBR2" +ConfigFlags.IOVDb.DBConnection="sqlite://;schema=db.sqlite;dbname=CONDBR2" #The global tag we are working with -flags.IOVDb.GlobalTag="LARCALIB-RUN2-00" +ConfigFlags.IOVDb.GlobalTag="LARCALIB-RUN2-00" #Other potentially useful flags-settings: #Define the global output Level: #from AthenaCommon.Constants import * -#flags.Exec.OutputLevel=VERBOSE +#ConfigFlags.Exec.OutputLevel=VERBOSE #Feed-though preselection for bytestream input: -#flags.LArCalib.Preselection.BEC=[1] -#flags.LArCalib.Preselection.Side=[0] +#ConfigFlags.LArCalib.Preselection.BEC=[1] +#ConfigFlags.LArCalib.Preselection.Side=[0] #Print the input files we found print ("Input files to be processed:") -for f in flags.Input.Files: +for f in ConfigFlags.Input.Files: print (f) #Lock the flag-container (required) -flags.lock() +ConfigFlags.lock() #Get the Main services (EventLoopMgr, StoreGate, ... ) -cfg=MainServicesCfg(flags) +cfg=MainServicesCfg(ConfigFlags) #Merge our own config into it -cfg.merge(LArDelay_OFCCaliCfg(flags)) +cfg.merge(LArDelay_OFCCaliCfg(ConfigFlags)) #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 9d8723ad8682d70c0f746e30e471a66e6b22a051..d7bbfeef38a4c4f224f8f39a6fe44570d82ea312 100755 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArDigits2NtupleDumper.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArDigits2NtupleDumper.py @@ -1,13 +1,15 @@ #!/usr/bin/env python # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 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' ) @@ -39,84 +41,82 @@ if __name__=='__main__': log.debug(value) #Import the flag-container that is the arguemnt to the configuration methods - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags # add SCDump flags, here re-used for digitsdump from LArCafJobs.LArSCDumperFlags import addSCDumpFlags - addSCDumpFlags(flags) + addSCDumpFlags(ConfigFlags) if len(args.infile) > 0: - flags.Input.Files = [args.infile] + ConfigFlags.Input.Files = [args.infile] elif len(args.inppatt) > 0: from LArCalibProcessing.GetInputFiles import GetInputFilesFromPattern - flags.Input.Files = GetInputFilesFromPattern(args.indir,args.inppatt) + ConfigFlags.Input.Files = GetInputFilesFromPattern(args.indir,args.inppatt) else: from LArCalibProcessing.GetInputFiles import GetInputFilesFromPrefix - flags.Input.Files = GetInputFilesFromPrefix(args.indir,args.inpref) + ConfigFlags.Input.Files = GetInputFilesFromPrefix(args.indir,args.inpref) if args.run != 0: - flags.Input.RunNumbers = [args.run] + ConfigFlags.Input.RunNumbers = [args.run] # first autoconfig from LArConditionsCommon.LArRunFormat import getLArFormatForRun try: - runinfo=getLArFormatForRun(flags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2") + runinfo=getLArFormatForRun(ConfigFlags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2") except Exception: log.warning("Could not get run info, using defaults !") if args.nsamp > 0: - flags.LArSCDump.nSamples=args.nsamp + ConfigFlags.LArSCDump.nSamples=args.nsamp else: - flags.LArSCDump.nSamples=4 + ConfigFlags.LArSCDump.nSamples=4 else: - flags.LArSCDump.nSamples=runinfo.nSamples() + ConfigFlags.LArSCDump.nSamples=runinfo.nSamples() - flags.LArSCDump.digitsKey="FREE" - if args.nsamp > 0 and args.nsamp < flags.LArSCDump.nSamples: - flags.LArSCDump.nSamples=args.nsamp + ConfigFlags.LArSCDump.digitsKey="FREE" + if args.nsamp > 0 and args.nsamp < ConfigFlags.LArSCDump.nSamples: + ConfigFlags.LArSCDump.nSamples=args.nsamp log.info("Autoconfigured: ") - log.info("nSamples: %d digitsKey %s",flags.LArSCDump.nSamples, flags.LArSCDump.digitsKey) + log.info("nSamples: %d digitsKey %s",ConfigFlags.LArSCDump.nSamples, ConfigFlags.LArSCDump.digitsKey) # now construct the job - flags.LAr.doAlign=False + ConfigFlags.LAr.doAlign=False if args.evtree: # should include trigger info - 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.triggerConfig = 'DB' + ConfigFlags.Trigger.L1.doCTP = True + ConfigFlags.Trigger.L1.doMuon = False + ConfigFlags.Trigger.L1.doCalo = False + ConfigFlags.Trigger.L1.doTopo = False - flags.Trigger.enableL1CaloLegacy = True - flags.Trigger.enableL1CaloPhase1 = True + ConfigFlags.Trigger.enableL1CaloLegacy = True + ConfigFlags.Trigger.enableL1CaloPhase1 = True - flags.lock() + ConfigFlags.lock() #Import the MainServices (boilerplate) from AthenaConfiguration.MainServicesConfig import MainServicesCfg from LArGeoAlgsNV.LArGMConfig import LArGMCfg - acc = MainServicesCfg(flags) - acc.merge(LArGMCfg(flags)) + acc = MainServicesCfg(ConfigFlags) + acc.merge(LArGMCfg(ConfigFlags)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg - acc.merge(LArOnOffIdMappingCfg(flags)) + acc.merge(LArOnOffIdMappingCfg(ConfigFlags)) if args.evtree: # should include trigger info from LArCafJobs.LArSCDumperSkeleton import L1CaloMenuCfg - acc.merge(L1CaloMenuCfg(flags)) + acc.merge(L1CaloMenuCfg(ConfigFlags)) from TrigDecisionTool.TrigDecisionToolConfig import TrigDecisionToolCfg - tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(flags)) + tdt = acc.getPrimaryAndMerge(TrigDecisionToolCfg(ConfigFlags)) else: tdt = None if args.bc: from LArBadChannelTool.LArBadChannelConfig import LArBadFebCfg, LArBadChannelCfg - acc.merge(LArBadChannelCfg(flags)) - acc.merge(LArBadFebCfg(flags)) + acc.merge(LArBadChannelCfg(ConfigFlags)) + acc.merge(LArBadFebCfg(ConfigFlags)) 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(flags, AddBadChannelInfo=args.bc, AddFEBTempInfo=False, isSC=False, isFlat=True, + acc.merge(LArDigits2NtupleCfg(ConfigFlags, AddBadChannelInfo=args.bc, AddFEBTempInfo=False, isSC=False, isFlat=True, OffId=args.offline, AddHash=args.ahash, AddCalib=args.calib, RealGeometry=args.geom, # from LArCond2NtupleBase - NSamples=flags.LArSCDump.nSamples, FTlist={}, ContainerKey=flags.LArSCDump.digitsKey, # from LArDigits2Ntuple + NSamples=ConfigFlags.LArSCDump.nSamples, FTlist={}, ContainerKey=ConfigFlags.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 flags.Input.Files: + for f in ConfigFlags.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 94772afd84b205b3290da0445b79a79897f2aed4..bfbcaff9b1a57bfa446c0a6794941f3f47f8d6ff 100644 --- a/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py +++ b/LArCalorimeter/LArGeoModel/LArGeoAlgsNV/python/LArGMConfig.py @@ -5,28 +5,30 @@ from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.Enums import LHCPeriod, ProductionStep, Project from IOVDbSvc.IOVDbSvcConfig import addFolders -def LArGMCfg(flags): - result=GeoModelCfg(flags) +def LArGMCfg(configFlags): + + result=GeoModelCfg(configFlags) - 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: + 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: tool.GeometryConfig = "RECO" result.getPrimary().DetectorTools += [ tool ] - if flags.LAr.doAlign: - if flags.Input.isMC: + if doAlignment: + if configFlags.Input.isMC: #Monte Carlo case: if activateCondAlgs: - result.merge(addFolders(flags,"/LAR/Align","LAR_OFL",className="DetCondKeyTrans")) - result.merge(addFolders(flags,"/LAR/LArCellPositionShift","LAR_OFL",className="CaloRec::CaloCellPositionShift")) + result.merge(addFolders(configFlags,"/LAR/Align","LAR_OFL",className="DetCondKeyTrans")) + result.merge(addFolders(configFlags,"/LAR/LArCellPositionShift","LAR_OFL",className="CaloRec::CaloCellPositionShift")) else: - result.merge(addFolders(flags,"/LAR/Align","LAR_OFL")) - result.merge(addFolders(flags,"/LAR/LArCellPositionShift","LAR_OFL")) + result.merge(addFolders(configFlags,"/LAR/Align","LAR_OFL")) + result.merge(addFolders(configFlags,"/LAR/LArCellPositionShift","LAR_OFL")) else: - result.merge(addFolders(flags,"/LAR/Align","LAR_ONL",className="DetCondKeyTrans")) - result.merge(addFolders(flags,"/LAR/LArCellPositionShift","LAR_ONL",className="CaloRec::CaloCellPositionShift")) + result.merge(addFolders(configFlags,"/LAR/Align","LAR_ONL",className="DetCondKeyTrans")) + result.merge(addFolders(configFlags,"/LAR/LArCellPositionShift","LAR_ONL",className="CaloRec::CaloCellPositionShift")) if activateCondAlgs: result.addCondAlgo(CompFactory.LArAlignCondAlg()) @@ -39,7 +41,7 @@ def LArGMCfg(flags): from SGComps.AddressRemappingConfig import AddressRemappingCfg result.merge(AddressRemappingCfg()) - caloCellKeys = [i.split('#')[1] for i in flags.Input.TypedCollections if "CaloCellContainer"==i.split('#')[0] ] + caloCellKeys = [i.split('#')[1] for i in configFlags.Input.TypedCollections if "CaloCellContainer"==i.split('#')[0] ] for key in caloCellKeys: if key != 'AllCalo': sCellsInInput = True @@ -48,7 +50,7 @@ def LArGMCfg(flags): 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(flags)) + result.merge(TileGMCfg(configFlags)) result.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg()) AthReadAlg_ExtraInputs.add(('CaloSuperCellDetDescrManager', 'ConditionStore+CaloSuperCellDetDescrManager')) @@ -68,21 +70,19 @@ def LArGMCfg(flags): 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(flags)) + result.merge(TileGMCfg(configFlags)) result.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg()) return result if __name__ == "__main__": - from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.TestDefaults import defaultTestFiles - flags = initConfigFlags() - flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 - flags.lock() + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.lock() - acc = LArGMCfg(flags) + acc = LArGMCfg(ConfigFlags) 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 d6855a53084e1c251463393411fcb5f98c75c282..67d834893312e9e5d237ae6276edef1cdadcfe44 100644 --- a/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArAffectedRegionsAlg.py @@ -1,20 +1,30 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # -def LArAffectedRegionsConfig(flags): +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): '''Function to configures some algorithms in the monitoring system.''' from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'LArAffectedRegionsAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArAffectedRegionsAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArAffectedRegionsConfigCore(helper, CompFactory.LArAffectedRegionsAlg, flags) + LArAffectedRegionsConfigCore(helper, CompFactory.LArAffectedRegionsAlg, inputFlags) return helper.result() -def LArAffectedRegionsConfigCore(helper, algoinstance, flags): +def LArAffectedRegionsConfigCore(helper, algoinstance, inputFlags): larAffectedRegAlg = helper.addAlgorithm(algoinstance,'larAffectedRegAlg') @@ -27,7 +37,7 @@ def LArAffectedRegionsConfigCore(helper, algoinstance, flags): isOnline=False from AthenaConfiguration.ComponentFactory import isComponentAccumulatorCfg if isComponentAccumulatorCfg(): - if flags.DQ.Environment == 'online': + if inputFlags.DQ.Environment == 'online': isOnline=True else: from AthenaCommon.AthenaCommonFlags import athenaCommonFlags @@ -369,29 +379,27 @@ def LArAffectedRegionsConfigCore(helper, algoinstance, flags): if __name__=='__main__': # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles - flags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.Output.HISTFileName = 'LArAffectedRegionsOutput.root' - flags.DQ.enableLumiAccess = False - flags.DQ.useTrigger = False - flags.lock() + ConfigFlags.Output.HISTFileName = 'LArAffectedRegionsOutput.root' + ConfigFlags.DQ.enableLumiAccess = False + ConfigFlags.DQ.useTrigger = False + ConfigFlags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(flags) + cfg=CaloRecoCfg(ConfigFlags) #add affected regions - affregmon = LArAffectedRegionsConfig(flags) + affregmon = LArAffectedRegionsConfig(ConfigFlags) cfg.merge(affregmon) - flags.dump() + ConfigFlags.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 314b8cca69004eab12bfc6a0f6b1ec06bc1a2245..aafee2872192f8dfd7a55f9d46da620c6694d63c 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCalibDelayMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCalibDelayMonAlg.py @@ -1,28 +1,28 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # -def LArCalibDelayMonConfig(flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): +def LArCalibDelayMonConfig(inputFlags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'LArCalibDelayMonCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArCalibDelayMonCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArCalibDelayMonConfigCore(helper,CompFactory.LArCalibDelayMonAlg,flags,gain,doAccDigit,doCalibDigit,doAccCalibDigit) + LArCalibDelayMonConfigCore(helper,CompFactory.LArCalibDelayMonAlg,inputFlags,gain,doAccDigit,doCalibDigit,doAccCalibDigit) rv = ComponentAccumulator() # adding LAr*Mapping algos from LArCabling.LArCablingConfig import LArFebRodMappingCfg, LArCalibIdMappingCfg - rv.merge(LArFebRodMappingCfg(flags)) - rv.merge(LArCalibIdMappingCfg(flags)) + rv.merge(LArFebRodMappingCfg(inputFlags)) + rv.merge(LArCalibIdMappingCfg(inputFlags)) rv.merge(helper.result()) return rv -def LArCalibDelayMonConfigCore(helper,algoinstance,flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): +def LArCalibDelayMonConfigCore(helper,algoinstance,inputFlags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -135,23 +135,19 @@ def LArCalibDelayMonConfigCore(helper,algoinstance,flags,gain="",doAccDigit=Fals if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) from AthenaMonitoring.DQConfigFlags import DQDataType - - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() type_run="Delay" run="00404654" part="HecFcal" - - flags.Input.Files = [ + ConfigFlags.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", @@ -159,34 +155,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"] - 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 + 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 from AthenaConfiguration.Enums import BeamType - flags.Beam.Type = BeamType.Collisions - flags.DQ.DataType = DQDataType.Collisions + ConfigFlags.Beam.Type = BeamType.Collisions + ConfigFlags.DQ.DataType = DQDataType.Collisions from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2 - flags.Detector.GeometryCSC=False - flags.Detector.GeometrysTGC=False - flags.Detector.GeometryMM=False - flags.Exec.OutputLevel=DEBUG - flags.lock() + ConfigFlags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2 + ConfigFlags.Detector.GeometryCSC=False + ConfigFlags.Detector.GeometrysTGC=False + ConfigFlags.Detector.GeometryMM=False + ConfigFlags.Exec.OutputLevel=DEBUG + ConfigFlags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg - cfg = MainServicesCfg(flags) + cfg = MainServicesCfg(ConfigFlags) from LArByteStream.LArRawCalibDataReadingConfig import LArRawCalibDataReadingCfg - cfg.merge(LArRawCalibDataReadingCfg(flags,gain="HIGH",doAccCalibDigit=True)) + cfg.merge(LArRawCalibDataReadingCfg(ConfigFlags,gain="HIGH",doAccCalibDigit=True)) - cfg.merge(LArCalibDelayMonConfig(flags, gain="HIGH",doAccCalibDigit=True)) + cfg.merge(LArCalibDelayMonConfig(ConfigFlags, gain="HIGH",doAccCalibDigit=True)) cfg.printConfig(withDetails=False) #set True for exhaustive info - flags.dump() + ConfigFlags.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 5f6cd77db78353f1328cb4156981f8a669ab26a2..26113e1526357b58ca91e5e86a35646834a0434c 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCalibPedMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCalibPedMonAlg.py @@ -1,32 +1,32 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # -def LArCalibPedMonConfig(flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): +def LArCalibPedMonConfig(inputFlags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'LArCalibPedMonCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArCalibPedMonCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArCalibPedMonConfigCore(helper,CompFactory.LArCalibPedMonAlg,flags,gain,doAccDigit,doCalibDigit,doAccCalibDigit) + LArCalibPedMonConfigCore(helper,CompFactory.LArCalibPedMonAlg,inputFlags,gain,doAccDigit,doCalibDigit,doAccCalibDigit) rv = ComponentAccumulator() # adding LAr*Mapping algos from LArCabling.LArCablingConfig import LArFebRodMappingCfg, LArCalibIdMappingCfg - rv.merge(LArFebRodMappingCfg(flags)) - rv.merge(LArCalibIdMappingCfg(flags)) + rv.merge(LArFebRodMappingCfg(inputFlags)) + rv.merge(LArCalibIdMappingCfg(inputFlags)) # adding LArFebErrorSummary algo from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg - rv.merge(LArFebErrorSummaryMakerCfg(flags)) + rv.merge(LArFebErrorSummaryMakerCfg(inputFlags)) rv.merge(helper.result()) return rv -def LArCalibPedMonConfigCore(helper,algoinstance,flags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): +def LArCalibPedMonConfigCore(helper,algoinstance,inputFlags,gain="",doAccDigit=False,doCalibDigit=False,doAccCalibDigit=False): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -129,55 +129,50 @@ def LArCalibPedMonConfigCore(helper,algoinstance,flags,gain="",doAccDigit=False, if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import initConfigFlags - - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) from AthenaMonitoring.DQConfigFlags import DQDataType - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - - flags.addFlagsCategory("LArMon", addLArMonFlags) + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() run="00404637" - - flags.Input.Files = [ + ConfigFlags.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"] - flags.Output.HISTFileName = 'LArCalibPedMonOutput_'+run+'.root' + ConfigFlags.Output.HISTFileName = 'LArCalibPedMonOutput_'+run+'.root' - flags.DQ.enableLumiAccess = False - flags.Input.isMC = False - flags.DQ.useTrigger = False - flags.LAr.doAlign=False + ConfigFlags.DQ.enableLumiAccess = False + ConfigFlags.Input.isMC = False + ConfigFlags.DQ.useTrigger = False + ConfigFlags.LAr.doAlign=False from AthenaConfiguration.Enums import BeamType - flags.Beam.Type = BeamType.Collisions - flags.DQ.DataType = DQDataType.Collisions + ConfigFlags.Beam.Type = BeamType.Collisions + ConfigFlags.DQ.DataType = DQDataType.Collisions from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2 - flags.Detector.GeometryCSC=False - flags.Detector.GeometrysTGC=False - flags.Detector.GeometryMM=False - flags.Exec.OutputLevel=DEBUG - flags.lock() + ConfigFlags.GeoModel.AtlasVersion=defaultGeometryTags.RUN2 + ConfigFlags.Detector.GeometryCSC=False + ConfigFlags.Detector.GeometrysTGC=False + ConfigFlags.Detector.GeometryMM=False + ConfigFlags.Exec.OutputLevel=DEBUG + ConfigFlags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg - cfg = MainServicesCfg(flags) + cfg = MainServicesCfg(ConfigFlags) from LArByteStream.LArRawCalibDataReadingConfig import LArRawCalibDataReadingCfg - cfg.merge(LArRawCalibDataReadingCfg(flags,gain="HIGH",doAccDigit=True)) + cfg.merge(LArRawCalibDataReadingCfg(ConfigFlags,gain="HIGH",doAccDigit=True)) - cfg.merge(LArCalibPedMonConfig(flags, gain="HIGH",doAccDigit=True)) + cfg.merge(LArCalibPedMonConfig(ConfigFlags, gain="HIGH",doAccDigit=True)) cfg.printConfig(withDetails=False) #set True for exhaustive info - flags.dump() + ConfigFlags.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 332de3bf9bf62638be2a60f2021d7de65bb2d538..69e7f6b130e556240ed46dabb11dc6e7cab1d295 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCoherentNoisefractionAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCoherentNoisefractionAlg.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # '''@file LArCoherentNoisefractionAlg @author P. Strizenec @@ -7,15 +7,27 @@ @brief Adapted from LArNoiseCorrelationMonAlg by M. Spalla ''' -def LArCoherentNoisefractionConfig(inputFlags, groupsToMonitor=[]): + +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): from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'LArCoherentNoisefractionMonAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArCoherentNoisefractionMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - return LArCoherentNoisefractionConfigCore(helper, CompFactory.LArCoherentNoisefractionMonAlg,inputFlags,groupsToMonitor) + return LArCoherentNoisefractionConfigCore(helper, CompFactory.LArCoherentNoisefractionMonAlg,inputFlags,febsToMonitor,groupsToMonitor,isCalib) + +def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, febsToMonitor, groupsToMonitor, isCalib): + -def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, groupsToMonitor): from LArMonitoring.GlobalVariables import lArDQGlobals larCoherentNoisefractionMonAlg = helper.addAlgorithm(algoinstance,'larCoherentNoisefractionMonAlg') @@ -27,14 +39,8 @@ def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, groupsT #from AthenaCommon.Constants import DEBUG #larCoherentNoisefractionMonAlg.OutputLevel = DEBUG - try: - larCoherentNoisefractionMonAlg.IsCalibrationRun = inputFlags.LArMon.calibRun - except AttributeError: - larCoherentNoisefractionMonAlg.IsCalibrationRun = False - try: - larCoherentNoisefractionMonAlg.LArDigitContainerKey = inputFlags.LArMon.LArDigitKey - except AttributeError: - larCoherentNoisefractionMonAlg.LArDigitContainerKey = 'FREE' + larCoherentNoisefractionMonAlg.IsCalibrationRun = isCalib + larCoherentNoisefractionMonAlg.LArDigitContainerKey = "HIGH" larCoherentNoisefractionMonAlg.ListOfGroupNames = allGroups larCoherentNoisefractionMonAlg.GroupNchan = groupsNChan if len(groupsToMonitor) == 0: @@ -48,10 +54,14 @@ def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, groupsT customGroupstoMonitor = groupsToMonitor larCoherentNoisefractionMonAlg.GroupsToMonitor = customGroupstoMonitor - try: - customFEBStoMonitor = inputFlags.LArMon.customFEBsToMonitor - except AttributeError: - customFEBStoMonitor = ["endcapAft19slot12","endcapAft19slot09","endcapAft20slot09"] + # 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 #correct custom FEBs for upper-lower cases or single-digit ft and slot numbers (e.g. 3 instead of 03) from ROOT import LArStrHelper @@ -169,41 +179,36 @@ def LArCoherentNoisefractionConfigCore(helper, algoinstance, inputFlags, groupsT if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import initConfigFlags + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - flags = initConfigFlags() - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) - from LArCalibProcessing.LArCalibConfigFlags import addLArCalibFlags - addLArCalibFlags(flags) - #from AthenaConfiguration.TestDefaults import defaultTestFiles + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() - 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.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 from AthenaConfiguration.Enums import BeamType - flags.Beam.Type = BeamType.Collisions - flags.lock() + ConfigFlags.Beam.Type = BeamType.Collisions + ConfigFlags.lock() from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg=ComponentAccumulator() from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg - cfg.merge(LArRawDataReadingCfg(flags,LArDigitKey="HIGH",LArRawChannelKey="")) + cfg.merge(LArRawDataReadingCfg(ConfigFlags,LArDigitKey="HIGH",LArRawChannelKey="")) # for calib digits: #from LArByteStream.LArRawCalibDataReadingConfig import LArRawCalibDataReadingCfg - #cfg.merge(LArRawCalibDataReadingCfg(flags,gain="HIGH",doCalibDigit=True)) + #cfg.merge(LArRawCalibDataReadingCfg(ConfigFlags,gain="HIGH",doCalibDigit=True)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg - cfg.merge(LArOnOffIdMappingCfg(flags)) + cfg.merge(LArOnOffIdMappingCfg(ConfigFlags)) from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg - cfg.merge(LArElecCalibDBCfg(flags,["Pedestal"])) + cfg.merge(LArElecCalibDBCfg(ConfigFlags,["Pedestal"])) feblist=[] for ft in [11,12,23,24]: @@ -212,13 +217,13 @@ if __name__=='__main__': feblist += ['EndcapAft'+str(ft)+'slot0'+str(slot)] else: feblist += ['EndcapAft'+str(ft)+'slot'+str(slot)] - aff_acc = LArCoherentNoisefractionConfig(flags,feblist) + aff_acc = LArCoherentNoisefractionConfig(ConfigFlags,feblist) cfg.merge(aff_acc) cfg.printConfig() log.setLevel(DEBUG) - flags.dump() + ConfigFlags.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 e3d1124e1bd4d0c3b37920adb2c1a59285d3b220..24779aac18aa6cded58381a3b4d39123e9a24313 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCosmicsMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCosmicsMonAlg.py @@ -1,24 +1,33 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # -def LArCosmicsMonConfig(flags): + +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): '''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(flags,'LArCosmicsMonAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArCosmicsMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArCosmicsMonConfigCore(helper, CompFactory.LArCosmicsMonAlg,flags) + LArCosmicsMonConfigCore(helper, CompFactory.LArCosmicsMonAlg,inputFlags) return helper.result() -def LArCosmicsMonConfigCore(helper, algoinstance,flags): +def LArCosmicsMonConfigCore(helper, algoinstance,inputFlags): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -72,34 +81,33 @@ def LArCosmicsMonConfigCore(helper, algoinstance,flags): if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import WARNING log.setLevel(WARNING) - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles - flags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.Output.HISTFileName = 'LArCosmicsMonOutput.root' - flags.DQ.enableLumiAccess = False - flags.DQ.useTrigger = False - flags.lock() + ConfigFlags.Output.HISTFileName = 'LArCosmicsMonOutput.root' + ConfigFlags.DQ.enableLumiAccess = False + ConfigFlags.DQ.useTrigger = False + ConfigFlags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(flags) + cfg=CaloRecoCfg(ConfigFlags) from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - cfg.merge(LArNoisyROSummaryCfg(flags)) + cfg.merge(LArNoisyROSummaryCfg(ConfigFlags)) - cosm_acc = LArCosmicsMonConfig(flags) + cosm_acc = LArCosmicsMonConfig(ConfigFlags) cfg.merge(cosm_acc) - flags.dump() + ConfigFlags.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 e772c233d9d07288d1d0add0d5811f0910706c17..6b8fff0eea3dbb1c0219e5f42cea57e09128069d 100644 --- a/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArCoverageAlg.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # '''@file LArCoverageAlg @@ -7,6 +7,14 @@ @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.''' @@ -505,26 +513,25 @@ def LArCoverageConfigCore(helper, algoinstance,flags): if __name__=='__main__': # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles - flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.DQ.useTrigger = False + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.DQ.useTrigger = False - flags.Output.HISTFileName = 'LArCoverageOutput.root' - flags.lock() + ConfigFlags.Output.HISTFileName = 'LArCoverageOutput.root' + ConfigFlags.lock() # Cell building from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(flags) + cfg=CaloRecoCfg(ConfigFlags) - larCoverageAcc = LArCoverageConfig(flags) + larCoverageAcc = LArCoverageConfig(ConfigFlags) cfg.merge(larCoverageAcc) - flags.dump() + ConfigFlags.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 25caf5be2b721a64aba8875b65953061c664e7e8..3208ae9b4734353cf109bc1a76a94cf899d0a2aa 100644 --- a/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArDigitMonAlg.py @@ -1,20 +1,28 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # -def LArDigitMonConfig(flags): +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): '''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(flags,'LArDigitMonAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArDigitMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - return LArDigitMonConfigCore(helper, CompFactory.LArDigitMonAlg,flags) + return LArDigitMonConfigCore(helper, CompFactory.LArDigitMonAlg,inputFlags) -def LArDigitMonConfigCore(helper, algoinstance,flags): +def LArDigitMonConfigCore(helper, algoinstance,inputFlags): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -184,35 +192,34 @@ def LArDigitMonConfigCore(helper, algoinstance,flags): if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles - flags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.Output.HISTFileName = 'LArDigitsMonOutput.root' - flags.DQ.enableLumiAccess = False - flags.DQ.useTrigger = False - flags.lock() + ConfigFlags.Output.HISTFileName = 'LArDigitsMonOutput.root' + ConfigFlags.DQ.enableLumiAccess = False + ConfigFlags.DQ.useTrigger = False + ConfigFlags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(flags) + cfg=CaloRecoCfg(ConfigFlags) from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - cfg.merge(LArNoisyROSummaryCfg(flags)) + cfg.merge(LArNoisyROSummaryCfg(ConfigFlags)) # from LArMonitoring.LArDigitMonAlg import LArDigitMonConfig - aff_acc = LArDigitMonConfig(flags) + aff_acc = LArDigitMonConfig(ConfigFlags) cfg.merge(aff_acc) - flags.dump() + ConfigFlags.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 6da525fac4f5c2f29b99d9c6e7d0c60c6ffd68ab..f9e8d1cad31a1487477f2b952a19318903dc230d 100644 --- a/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArFEBMonAlg.py @@ -1,25 +1,34 @@ # 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 -def LArFEBMonConfig(flags, cellDebug=False, dspDebug=False): + helper = AthMonitorCfgHelperOld(inputFlags, 'LArFEBMonAlgOldCfg') + LArFEBMonConfigCore(helper, LArFEBMonAlg,inputFlags,cellDebug, dspDebug) + + return helper.result() + + +def LArFEBMonConfig(inputFlags, cellDebug=False, dspDebug=False): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'LArFEBMonAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArFEBMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArFEBMonConfigCore(helper, CompFactory.LArFEBMonAlg,flags,cellDebug, dspDebug) + LArFEBMonConfigCore(helper, CompFactory.LArFEBMonAlg,inputFlags,cellDebug, dspDebug) rv = ComponentAccumulator() # adding LArFebErrorSummary algo from LArROD.LArFebErrorSummaryMakerConfig import LArFebErrorSummaryMakerCfg - rv.merge(LArFebErrorSummaryMakerCfg(flags)) + rv.merge(LArFebErrorSummaryMakerCfg(inputFlags)) rv.merge(helper.result()) return rv -def LArFEBMonConfigCore(helper,algoinstance,flags, cellDebug=False, dspDebug=False): +def LArFEBMonConfigCore(helper,algoinstance,inputFlags, cellDebug=False, dspDebug=False): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -38,7 +47,7 @@ def LArFEBMonConfigCore(helper,algoinstance,flags, cellDebug=False, dspDebug=Fal isCOMP200=False from AthenaConfiguration.ComponentFactory import isComponentAccumulatorCfg if isComponentAccumulatorCfg(): - if "COMP200" in flags.IOVDb.DatabaseInstance: + if "COMP200" in inputFlags.IOVDb.DatabaseInstance: isCOMP200=True else: from IOVDbSvc.CondDB import conddb @@ -60,7 +69,7 @@ def LArFEBMonConfigCore(helper,algoinstance,flags, cellDebug=False, dspDebug=Fal pass if not havethem: from IOVDbSvc.IOVDbSvcConfig import IOVDbSvcCfg - helper.resobj.merge(IOVDbSvcCfg(flags)) + helper.resobj.merge(IOVDbSvcCfg(inputFlags)) condLoader=helper.resobj.getCondAlgo("CondInputLoader") iovDbSvc=helper.resobj.getService("IOVDbSvc") else: @@ -79,7 +88,7 @@ def LArFEBMonConfigCore(helper,algoinstance,flags, cellDebug=False, dspDebug=Fal obj='LArDSPThresholdsComplete' if isComponentAccumulatorCfg(): from IOVDbSvc.IOVDbSvcConfig import addFolders - helper.resobj.merge(addFolders(flags,fld,db,obj)) + helper.resobj.merge(addFolders(inputFlags,fld,db,obj)) else: conddb.addFolder (db, fld, className=obj) larFEBMonAlg.Run1DSPThresholdsKey = 'LArDSPThresholds' @@ -201,7 +210,7 @@ def LArFEBMonConfigCore(helper,algoinstance,flags, cellDebug=False, dspDebug=Fal isOnline=False if isComponentAccumulatorCfg() : - if flags.DQ.Environment == 'online': + if inputFlags.DQ.Environment == 'online': isOnline=True else: from AthenaCommon.AthenaCommonFlags import athenaCommonFlags @@ -410,37 +419,36 @@ def LArFEBMonConfigCore(helper,algoinstance,flags, cellDebug=False, dspDebug=Fal if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles - flags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.Output.HISTFileName = 'LArFEBMonOutput.root' - flags.DQ.enableLumiAccess = True - flags.DQ.useTrigger = False - flags.lock() + ConfigFlags.Output.HISTFileName = 'LArFEBMonOutput.root' + ConfigFlags.DQ.enableLumiAccess = True + ConfigFlags.DQ.useTrigger = False + ConfigFlags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(flags) + cfg=CaloRecoCfg(ConfigFlags) #from CaloD3PDMaker.CaloD3PDConfig import CaloD3PDCfg,CaloD3PDAlg - #cfg.merge(CaloD3PDCfg(flags, filename=flags.Output.HISTFileName, streamname='CombinedMonitoring')) + #cfg.merge(CaloD3PDCfg(ConfigFlags, filename=ConfigFlags.Output.HISTFileName, streamname='CombinedMonitoring')) - aff_acc = LArFEBMonConfig(flags) + aff_acc = LArFEBMonConfig(ConfigFlags) cfg.merge(aff_acc) cfg.printConfig() - flags.dump() + ConfigFlags.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 c4f1a68ee9df38b06359f6c788da1714d74bff55..44136873c34dd04b010024bcad7f5d9dbc73e098 100644 --- a/LArCalorimeter/LArMonitoring/python/LArHVCorrMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArHVCorrMonAlg.py @@ -1,25 +1,38 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # -def LArHVCorrMonConfig(flags): +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): + from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'LArHVCorrMonAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArHVCorrMonAlgCfg') from LArGeoAlgsNV.LArGMConfig import LArGMCfg - acc = LArGMCfg(flags) + acc = LArGMCfg(inputFlags) from TileGeoModel.TileGMConfig import TileGMCfg - acc.merge(TileGMCfg(flags)) + acc.merge(TileGMCfg(inputFlags)) from LArCalibUtils.LArHVScaleConfig import LArHVScaleCfg - acc.merge(LArHVScaleCfg(flags)) + acc.merge(LArHVScaleCfg(inputFlags)) from AthenaConfiguration.ComponentFactory import CompFactory - LArHVCorrMonConfigCore(helper, CompFactory.LArHVCorrectionMonAlg, flags) + LArHVCorrMonConfigCore(helper, CompFactory.LArHVCorrectionMonAlg, inputFlags) acc.merge(helper.result()) return acc -def LArHVCorrMonConfigCore(helper, algoinstance,flags): +def LArHVCorrMonConfigCore(helper, algoinstance,inputFlags): larHVCorrAlg = helper.addAlgorithm(algoinstance,'larHVCorrMonAlg') @@ -191,23 +204,21 @@ def LArHVCorrMonConfigCore(helper, algoinstance,flags): if __name__=='__main__': # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags 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' - flags.Input.Files = [nightly+file] - flags.Input.isMC = False - flags.Output.HISTFileName = 'LArHVCorrMonOutput.root' - flags.lock() + ConfigFlags.Input.Files = [nightly+file] + ConfigFlags.Input.isMC = False + ConfigFlags.Output.HISTFileName = 'LArHVCorrMonOutput.root' + ConfigFlags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - cfg = MainServicesCfg(flags) - cfg.merge(PoolReadCfg(flags)) + cfg = MainServicesCfg(ConfigFlags) + cfg.merge(PoolReadCfg(ConfigFlags)) - cfg.merge(LArHVCorrMonConfig(flags)) + cfg.merge(LArHVCorrMonConfig(ConfigFlags)) 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 bfca2c7d067bfe84d67f0d74166c7c89907303a0..dc163ab042c961f0a469a3c5f9cf0e8f18bbdce9 100644 --- a/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArNoiseCorrelationMonAlg.py @@ -1,19 +1,30 @@ + # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # -def LArNoiseCorrelationMonConfig(flags): + + +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): '''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(flags,'LArNoiseCorrelationMonAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArNoiseCorrelationMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - return LArNoiseCorrelationMonConfigCore(helper, CompFactory.LArNoiseCorrelationMonAlg,flags) + return LArNoiseCorrelationMonConfigCore(helper, CompFactory.LArNoiseCorrelationMonAlg,inputFlags) -def LArNoiseCorrelationMonConfigCore(helper, algoinstance,flags): +def LArNoiseCorrelationMonConfigCore(helper, algoinstance,inputFlags): from LArMonitoring.GlobalVariables import lArDQGlobals @@ -21,11 +32,9 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,flags): 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"] - try: - customFEBStoMonitor = flags.LArMon.customFEBsToMonitor - except AttributeError: - customFEBStoMonitor = ["endcapAft19slot12","endcapAft19slot09","endcapAft20slot09"] + customFEBStoMonitor=FEBs_from_DQ_run_350440 #correct custom FEBs for upper-lower cases or single-digit ft and slot numbers (e.g. 3 instead of 03) @@ -39,7 +48,7 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,flags): if isComponentAccumulatorCfg(): - if flags.DQ.Environment == 'online': + if inputFlags.DQ.Environment == 'online': isOnline=True else: from AthenaCommon.AthenaCommonFlags import athenaCommonFlags @@ -48,7 +57,7 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,flags): isOnline=False #needed later if isComponentAccumulatorCfg() : - if flags.DQ.Environment == 'online': + if inputFlags.DQ.Environment == 'online': isOnline=True else : from AthenaCommon.AthenaCommonFlags import athenaCommonFlags @@ -58,14 +67,7 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,flags): 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 - try: - larNoiseCorrelMonAlg.IsCalibrationRun = flags.LArMon.calibRun - except AttributeError: - larNoiseCorrelMonAlg.IsCalibrationRun = False - try: - larNoiseCorrelMonAlg.LArDigitContainerKey = flags.LArMon.LArDigitKey - except AttributeError: - larNoiseCorrelMonAlg.LArDigitContainerKey = 'FREE' + larNoiseCorrelMonAlg.IsCalibrationRun = False #deal with custom febs to monitor (if any) if len(customFEBStoMonitor)==0: @@ -192,37 +194,36 @@ def LArNoiseCorrelationMonConfigCore(helper, algoinstance,flags): if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles - flags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.Output.HISTFileName = 'LArNoiseCorrMonOutput.root' - flags.DQ.enableLumiAccess = False - flags.DQ.useTrigger = False - flags.lock() + ConfigFlags.Output.HISTFileName = 'LArNoiseCorrMonOutput.root' + ConfigFlags.DQ.enableLumiAccess = False + ConfigFlags.DQ.useTrigger = False + ConfigFlags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(flags) + cfg=CaloRecoCfg(ConfigFlags) from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - cfg.merge(LArNoisyROSummaryCfg(flags)) + cfg.merge(LArNoisyROSummaryCfg(ConfigFlags)) # from LArMonitoring.LArNoiseCorrelationMonAlg import LArNoiseCorrelationMonConfig - aff_acc = LArNoiseCorrelationMonConfig(flags) + aff_acc = LArNoiseCorrelationMonConfig(ConfigFlags) cfg.merge(aff_acc) log.setLevel(DEBUG) - flags.dump() + ConfigFlags.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 2c70b55641c9ec4d4e58330b3d0cca52ea2e28bb..7269edd6c84976e64a6a6d0bfa6f6fea08c717ab 100644 --- a/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArNoisyROMonAlg.py @@ -1,26 +1,47 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # -def LArNoisyROMonConfig(flags, inKey="", +def LArNoisyROMonConfig(inputFlags, inKey="", NoisyFEBDefStr="(>30 chan with Q>4000)", MNBTightFEBDefStr="", MNBTight_PsVetoFEBDefStr="", MNBLooseFEBDefStr=""): from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'LArNoisyROMonAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArNoisyROMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - 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)+")" + 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)+")" - return LArNoisyROMonConfigCore(helper,CompFactory.LArNoisyROMonAlg, flags, inKey, NoisyFEBDefStr, MNBTightFEBDefStr, MNBTight_PsVetoFEBDefStr, MNBLooseFEBDefStr) + return LArNoisyROMonConfigCore(helper,CompFactory.LArNoisyROMonAlg, inputFlags, inKey, NoisyFEBDefStr, MNBTightFEBDefStr, MNBTight_PsVetoFEBDefStr, MNBLooseFEBDefStr) -def LArNoisyROMonConfigCore(helper,algoinstance,flags, +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, inKey="", NoisyFEBDefStr="(>30 chan with Q>4000)", MNBTightFEBDefStr="", @@ -33,8 +54,8 @@ def LArNoisyROMonConfigCore(helper,algoinstance,flags, from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg=ComponentAccumulator() from LArBadChannelTool.LArBadFebsConfig import LArKnownBadFebCfg, LArKnownMNBFebCfg - cfg.merge(LArKnownBadFebCfg(flags)) - cfg.merge(LArKnownMNBFebCfg(flags)) + cfg.merge(LArKnownBadFebCfg(inputFlags)) + cfg.merge(LArKnownMNBFebCfg(inputFlags)) larNoisyROMonAlg = helper.addAlgorithm(algoinstance,'larNoisyROMonAlg') @@ -46,7 +67,8 @@ def LArNoisyROMonConfigCore(helper,algoinstance,flags, larNoisyROMonAlg.SubDetNames=lArDQGlobals.SubDet[0:2] larNoisyROMonAlg.PartitionNames=lArDQGlobals.Partitions[0:4] - larNoisyROMonAlg.storeLooseMNBFEBs=True + #FIXME: True only for testing + larNoisyROMonAlg.storeLooseMNBFEBs=False if inKey != "": larNoisyROMonAlg.inputKey=inKey @@ -83,10 +105,10 @@ def LArNoisyROMonConfigCore(helper,algoinstance,flags, ] doTrigger=False if isComponentAccumulatorCfg(): - if flags.DQ.useTrigger or LArNoisyROMonForceTrigger: + if inputFlags.DQ.useTrigger or LArNoisyROMonForceTrigger: doTrigger=True else: - if flags.doHLTMon or LArNoisyROMonForceTrigger: + if inputFlags.doHLTMon or LArNoisyROMonForceTrigger: doTrigger=True if doTrigger: @@ -255,48 +277,47 @@ if __name__=='__main__': from AthenaCommon.Logging import log log.setLevel(DEBUG) + # Set the Athena configuration flags - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q431/21.0/v1/' file = 'myESD.pool.root' - - flags.Input.Files = [nightly+file] - flags.Input.isMC = False - flags.DQ.useTrigger = True + ConfigFlags.Input.Files = [nightly+file] + ConfigFlags.Input.isMC = False + ConfigFlags.DQ.useTrigger = True - flags.Output.HISTFileName = 'LArNoisyROMonitoringOutput.root' + ConfigFlags.Output.HISTFileName = 'LArNoisyROMonitoringOutput.root' - flags.Exec.OutputLevel=DEBUG - flags.lock() + ConfigFlags.Exec.OutputLevel=DEBUG + ConfigFlags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - cfg = MainServicesCfg(flags) - cfg.merge(PoolReadCfg(flags)) + cfg = MainServicesCfg(ConfigFlags) + cfg.merge(PoolReadCfg(ConfigFlags)) # try NoisyRO algo #first geometry from LArGeoAlgsNV.LArGMConfig import LArGMCfg from TileGeoModel.TileGMConfig import TileGMCfg - cfg.merge(LArGMCfg(flags)) - cfg.merge(TileGMCfg(flags)) + cfg.merge(LArGMCfg(ConfigFlags)) + cfg.merge(TileGMCfg(ConfigFlags)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg - cfg.merge(LArOnOffIdMappingCfg(flags)) + cfg.merge(LArOnOffIdMappingCfg(ConfigFlags)) # then NoisyROSummary creator from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - noisyROSumm = LArNoisyROSummaryCfg(flags) + noisyROSumm = LArNoisyROSummaryCfg(ConfigFlags) noisyROSumm.getEventAlgo("LArNoisyROAlg").OutputKey="LArNoisyROSummary_recomputed" cfg.merge(noisyROSumm) # then monitoring algo - noisemon=LArNoisyROMonConfig(flags, inKey="LArNoisyROSummary_recomputed") + noisemon=LArNoisyROMonConfig(ConfigFlags, inKey="LArNoisyROSummary_recomputed") cfg.merge(noisemon) - flags.dump() + ConfigFlags.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 038500dbe109c19e18c6697f4829eca7be68ac3e..ce9a2d2f67c95e321bff8aa9a32015dac7232d7c 100644 --- a/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArRODMonAlg.py @@ -1,20 +1,30 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # -def LArRODMonConfig(flags,cellDebug=False, dspDebug=False): +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): + from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'LArRODMonAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArRODMonAlgCfg') from AthenaConfiguration.ComponentFactory import CompFactory - LArRODMonConfigCore(helper, CompFactory.LArRODMonAlg,flags,cellDebug, dspDebug) + LArRODMonConfigCore(helper, CompFactory.LArRODMonAlg,inputFlags,cellDebug, dspDebug) return helper.result() -def LArRODMonConfigCore(helper, algoinstance,flags, cellDebug=False, dspDebug=False): +def LArRODMonConfigCore(helper, algoinstance,inputFlags, cellDebug=False, dspDebug=False): larRODMonAlg = helper.addAlgorithm(algoinstance,'larRODMonAlg') @@ -42,7 +52,7 @@ def LArRODMonConfigCore(helper, algoinstance,flags, cellDebug=False, dspDebug=Fa if dspDebug: larRODMonAlg.DoDspTestDump=True - if flags.Common.isOnline: + if inputFlags.Common.isOnline: larRODMonAlg.MaxEvDump=100 #from AthenaCommon.Constants import VERBOSE @@ -206,37 +216,36 @@ def LArRODMonConfigCore(helper, algoinstance,flags, cellDebug=False, dspDebug=Fa if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles - flags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.Output.HISTFileName = 'LArRODMonOutput.root' - flags.DQ.enableLumiAccess = False - flags.DQ.useTrigger = False - flags.lock() + ConfigFlags.Output.HISTFileName = 'LArRODMonOutput.root' + ConfigFlags.DQ.enableLumiAccess = False + ConfigFlags.DQ.useTrigger = False + ConfigFlags.lock() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(flags) + cfg=CaloRecoCfg(ConfigFlags) #from CaloD3PDMaker.CaloD3PDConfig import CaloD3PDCfg,CaloD3PDAlg - #cfg.merge(CaloD3PDCfg(flags, filename=flags.Output.HISTFileName, streamname='CombinedMonitoring')) + #cfg.merge(CaloD3PDCfg(ConfigFlags, filename=ConfigFlags.Output.HISTFileName, streamname='CombinedMonitoring')) - aff_acc = LArRODMonConfig(flags) + aff_acc = LArRODMonConfig(ConfigFlags) cfg.merge(aff_acc) cfg.printConfig() - flags.dump() + ConfigFlags.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 b77ea8198d3c893836ce87e832f8917ec99480b2..d867f6df632c1ba702424efff0964cae74820d78 100644 --- a/LArCalorimeter/LArMonitoring/python/LArRawChannelMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArRawChannelMonAlg.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # """!@file LArRawChannelMonAlg.py @@ -15,33 +15,55 @@ from GaudiKernel.SystemOfUnits import MeV, GeV _USE_LEGACY_BINNING_IN_ENDCAPS = True -def LArRawChannelMonConfig(flags): +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): 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 = (flags.Beam.Type is BeamType.Cosmics) - stream = _get_stream(flags.DQ) - try: - signal = flags.LArMon.doLArRawMonitorSignal - except AttributeError: - signal = False - helper = AthMonitorCfgHelper(flags, 'LArRawChannelMonAlgCfg') + cosmics = (inputFlags.Beam.Type is BeamType.Cosmics) + stream = _get_stream(inputFlags.DQ) + signal = inputFlags.LArMon.doLArRawMonitorSignal + helper = AthMonitorCfgHelper(inputFlags, 'LArRawChannelMonAlgCfg') alg = LArRawChannelMonConfigCore( helper, instance=CompFactory.LArRawChannelMonAlg, - flags=flags, cosmics=cosmics, stream=stream, doSignal=signal) - noise_alg = CaloNoiseCondAlgCfg(flags, noisetype=alg.NoiseKey.Path) + inputFlags=inputFlags, cosmics=cosmics, stream=stream, doSignal=signal) + noise_alg = CaloNoiseCondAlgCfg(inputFlags, noisetype=alg.NoiseKey.Path) accumulator = ComponentAccumulator() accumulator.merge(noise_alg) alg.AtlasReadyFilterTool.append( - accumulator.popToolsAndMerge(AtlasReadyFilterCfg(flags))) + accumulator.popToolsAndMerge(AtlasReadyFilterCfg(inputFlags))) accumulator.merge(helper.result()) return accumulator -def LArRawChannelMonConfigCore(helper, instance, flags, cosmics, stream, doSignal): +def LArRawChannelMonConfigCore(helper, instance, inputFlags, cosmics, stream, doSignal): alg = helper.addAlgorithm(instance, 'LArRawChannelMonAlg') alg.occupancy_thresholds = [ 100 * MeV, # EMBA @@ -104,7 +126,7 @@ def LArRawChannelMonConfigCore(helper, instance, flags, cosmics, stream, doSigna alg.db_and_ofc_only = True from LArConfiguration.LArConfigFlags import RawChannelSource - if flags.LAr.RawChannelSource is RawChannelSource.Calculated: + if inputFlags.LAr.RawChannelSource is RawChannelSource.Calculated: alg.LArRawChannelContainerKey="LArRawChannels_FromDigits" # Histograms for different partitions are handled together via a @@ -306,28 +328,26 @@ def _superslot_channel_axis_ranges(partition): if __name__=='__main__': - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import WARNING log.setLevel(WARNING) - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.Enums import BeamType - 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() + 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() from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg = CaloRecoCfg(flags) - acc = LArRawChannelMonConfig(flags) + cfg = CaloRecoCfg(ConfigFlags) + acc = LArRawChannelMonConfig(ConfigFlags) 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 9a231fd46cc3e5067f028d7e5cc21a012391bd64..93075ee91eb3a2aab18dfd0efff539fd5bb538a9 100644 --- a/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py +++ b/LArCalorimeter/LArMonitoring/python/LArReco_fromraw_Cfg.py @@ -1,64 +1,63 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration if __name__=="__main__": - from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() - + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - from LArMonitoring.LArMonConfigFlags import addLArMonFlags - flags.addFlagsCategory("LArMon", addLArMonFlags) + + from LArMonitoring.LArMonConfigFlags import createLArMonConfigFlags + createLArMonConfigFlags() from AthenaConfiguration.TestDefaults import defaultTestFiles - flags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.Output.HISTFileName = 'LArMonitoringOutput.root' - flags.DQ.enableLumiAccess = False - flags.DQ.useTrigger = False - flags.lock() + ConfigFlags.Output.HISTFileName = 'LArMonitoringOutput.root' + ConfigFlags.DQ.enableLumiAccess = False + ConfigFlags.DQ.useTrigger = False + ConfigFlags.lock() ## Cell building from CaloRec.CaloRecoConfig import CaloRecoCfg - cfg=CaloRecoCfg(flags) + cfg=CaloRecoCfg(ConfigFlags) #larCoverage monitoring from LArMonitoring.LArCoverageAlg import LArCoverageConfig - cov_acc = LArCoverageConfig(flags) + cov_acc = LArCoverageConfig(ConfigFlags) cfg.merge(cov_acc) #affectedRegions monitoring from LArMonitoring.LArAffectedRegionsAlg import LArAffectedRegionsConfig - aff_acc = LArAffectedRegionsConfig(flags) + aff_acc = LArAffectedRegionsConfig(ConfigFlags) cfg.merge(aff_acc) #collision time algo from LArCellRec.LArCollisionTimeConfig import LArCollisionTimeCfg - cfg.merge(LArCollisionTimeCfg(flags, cutIteration=False)) + cfg.merge(LArCollisionTimeCfg(ConfigFlags, cutIteration=False)) # and collision time monitoring algo from LArMonitoring.LArCollisionTimeMonAlg import LArCollisionTimeMonConfig - collmon=LArCollisionTimeMonConfig(flags) + collmon=LArCollisionTimeMonConfig(ConfigFlags) cfg.merge(collmon) #ROD monitoring from LArMonitoring.LArRODMonAlg import LArRODMonConfig - rodmon = LArRODMonConfig(flags) + rodmon = LArRODMonConfig(ConfigFlags) cfg.merge(rodmon) #Digit monitoring from LArCellRec.LArNoisyROSummaryConfig import LArNoisyROSummaryCfg - cfg.merge(LArNoisyROSummaryCfg(flags)) + cfg.merge(LArNoisyROSummaryCfg(ConfigFlags)) from LArMonitoring.LArDigitMonAlg import LArDigitMonConfig - digimon = LArDigitMonConfig(flags) + digimon = LArDigitMonConfig(ConfigFlags) cfg.merge(digimon) - flags.dump() + ConfigFlags.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 5d821c6a47aa7846e8a78a2533df87510ef61161..98f7e971284e2c9942b884be3eabb82f957deee5 100644 --- a/LArCalorimeter/LArMonitoring/python/LArSuperCellMonAlg.py +++ b/LArCalorimeter/LArMonitoring/python/LArSuperCellMonAlg.py @@ -1,8 +1,46 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # -def LArSuperCellMonConfig(flags, **kwargs): +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): from AthenaCommon.Logging import logging from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg from AthenaConfiguration.ComponentFactory import CompFactory @@ -10,47 +48,47 @@ def LArSuperCellMonConfig(flags, **kwargs): mask=True from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'LArSuperCellMonAlgCfg') + helper = AthMonitorCfgHelper(inputFlags,'LArSuperCellMonAlgCfg') from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator cfg=ComponentAccumulator() - if not flags.DQ.enableLumiAccess and not flags.DQ.Environment == 'online': + if not inputFlags.DQ.enableLumiAccess and not inputFlags.DQ.Environment == 'online': mlog.warning('This algo needs Lumi access, returning empty config') return cfg from LArGeoAlgsNV.LArGMConfig import LArGMCfg - cfg.merge(LArGMCfg(flags)) + cfg.merge(LArGMCfg(inputFlags)) from TileGeoModel.TileGMConfig import TileGMCfg - cfg.merge(TileGMCfg(flags)) + cfg.merge(TileGMCfg(inputFlags)) from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg - cfg.merge(DetDescrCnvSvcCfg(flags)) + cfg.merge(DetDescrCnvSvcCfg(inputFlags)) - if flags.Common.isOnline: + if inputFlags.Common.isOnline: cfg.addCondAlgo(CompFactory.CaloSuperCellAlignCondAlg('CaloSuperCellAlignCondAlg')) from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg - cfg.merge(BunchCrossingCondAlgCfg(flags)) + cfg.merge(BunchCrossingCondAlgCfg(inputFlags)) from CaloTools.CaloNoiseCondAlgConfig import CaloNoiseCondAlgCfg - cfg.merge(CaloNoiseCondAlgCfg(flags)) - cfg.merge(CaloNoiseCondAlgCfg(flags,noisetype="electronicNoise")) + cfg.merge(CaloNoiseCondAlgCfg(inputFlags)) + cfg.merge(CaloNoiseCondAlgCfg(inputFlags,noisetype="electronicNoise")) - cfg.merge(ByteStreamReadCfg(flags)) + cfg.merge(ByteStreamReadCfg(inputFlags)) from LArByteStream.LArRawSCDataReadingConfig import LArRawSCDataReadingCfg - cfg.merge(LArRawSCDataReadingCfg(flags)) + cfg.merge(LArRawSCDataReadingCfg(inputFlags)) from TrigT1CaloFexPerf.EmulationConfig import emulateSC_Cfg - cfg.merge(emulateSC_Cfg(flags)) + cfg.merge(emulateSC_Cfg(inputFlags)) from LArCellRec.LArRAWtoSuperCellConfig import LArRAWtoSuperCellCfg - cfg.merge(LArRAWtoSuperCellCfg(flags,mask=mask) ) + cfg.merge(LArRAWtoSuperCellCfg(inputFlags,mask=mask) ) # Reco SC: #get SC onl-offl mapping from DB from LArCabling.LArCablingConfig import LArOnOffIdMappingSCCfg - cfg.merge(LArOnOffIdMappingSCCfg(flags)) + cfg.merge(LArOnOffIdMappingSCCfg(inputFlags)) # and elec. calib. coeffs from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBSCCfg @@ -58,7 +96,7 @@ def LArSuperCellMonConfig(flags, **kwargs): larLATOMEBuilderAlg=CompFactory.LArLATOMEBuilderAlg("LArLATOMEBuilderAlg") from LArConditionsCommon.LArRunFormat import getLArDTInfoForRun try: - runinfo=getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2") + runinfo=getLArDTInfoForRun(inputFlags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2") streamTypes=runinfo.streamTypes() except Exception as e: mlog.warning("Could not get DT run info, using defaults !") @@ -75,10 +113,10 @@ def LArSuperCellMonConfig(flags, **kwargs): larLATOMEBuilderAlg.LArDigitKey = "SC_ADC_BAS" cfg.addEventAlgo(larLATOMEBuilderAlg) - cfg.merge(LArRAWtoSuperCellCfg(flags,name="LArRAWRecotoSuperCell",mask=mask,doReco=True,SCIn="SC_ET_RECO",SCellContainerOut="SCell_ET_RECO") ) + cfg.merge(LArRAWtoSuperCellCfg(inputFlags,name="LArRAWRecotoSuperCell",mask=mask,doReco=True,SCIn="SC_ET_RECO",SCellContainerOut="SCell_ET_RECO") ) - cfg.merge(LArElecCalibDBSCCfg(flags, condObjs=["Ramp","DAC2uA", "Pedestal", "uA2MeV", "MphysOverMcal", "OFC", "Shape", "HVScaleCorr"])) + cfg.merge(LArElecCalibDBSCCfg(inputFlags, condObjs=["Ramp","DAC2uA", "Pedestal", "uA2MeV", "MphysOverMcal", "OFC", "Shape", "HVScaleCorr"])) #return cfg @@ -86,27 +124,27 @@ def LArSuperCellMonConfig(flags, **kwargs): lArCellMonAlg=CompFactory.LArSuperCellMonAlg(algname,CaloCellContainerReco="SCell_ET_RECO",doSCReco=True) - if flags.Input.isMC is False and not flags.Common.isOnline: + if inputFlags.Input.isMC is False and not inputFlags.Common.isOnline: from LumiBlockComps.LuminosityCondAlgConfig import LuminosityCondAlgCfg - cfg.merge(LuminosityCondAlgCfg(flags)) + cfg.merge(LuminosityCondAlgCfg(inputFlags)) from LumiBlockComps.LBDurationCondAlgConfig import LBDurationCondAlgCfg - cfg.merge(LBDurationCondAlgCfg(flags)) + cfg.merge(LBDurationCondAlgCfg(inputFlags)) from AthenaConfiguration.Enums import BeamType - if flags.Beam.Type is BeamType.Cosmics: + if inputFlags.Beam.Type is BeamType.Cosmics: algname=algname+'Cosmics' - LArSuperCellMonConfigCore(helper, lArCellMonAlg, flags, - flags.Beam.Type is BeamType.Cosmics, - flags.Input.isMC, algname, RemoveMasked=mask) + LArSuperCellMonConfigCore(helper, lArCellMonAlg, inputFlags, + inputFlags.Beam.Type is BeamType.Cosmics, + inputFlags.Input.isMC, algname, RemoveMasked=mask) cfg.merge(helper.result()) return cfg -def LArSuperCellMonConfigCore(helper, algclass, flags, isCosmics=False, isMC=False, algname='LArSuperCellMonAlg', RemoveMasked=True): +def LArSuperCellMonConfigCore(helper, algclass, inputFlags, isCosmics=False, isMC=False, algname='LArSuperCellMonAlg', RemoveMasked=True): LArSuperCellMonAlg = helper.addAlgorithm(algclass, algname) @@ -116,8 +154,8 @@ def LArSuperCellMonConfigCore(helper, algclass, flags, isCosmics=False, isMC=Fal LArSuperCellMonAlg.MonGroupName = GroupName LArSuperCellMonAlg.EnableLumi = False - LArSuperCellMonAlg.CaloCellContainer = flags.LAr.DT.ET_IDKey - LArSuperCellMonAlg.CaloCellContainerRef = flags.Trigger.L1.L1CaloSuperCellContainerName + LArSuperCellMonAlg.CaloCellContainer = inputFlags.LAr.DT.ET_IDKey + LArSuperCellMonAlg.CaloCellContainerRef = inputFlags.Trigger.L1.L1CaloSuperCellContainerName LArSuperCellMonAlg.RemoveMasked = RemoveMasked @@ -335,50 +373,50 @@ if __name__=='__main__': # Set the Athena configuration flags from AthenaConfiguration.AllConfigFlags import initConfigFlags - flags = initConfigFlags() + ConfigFlags = initConfigFlags() #from AthenaConfiguration.TestDefaults import defaultTestFiles - #flags.Input.Files = defaultTestFiles.ESD + #ConfigFlags.Input.Files = defaultTestFiles.ESD # to test tier0 workflow: - #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 + #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 import sys - flags.fillFromArgs(sys.argv[1:]) - flags.lock() + ConfigFlags.fillFromArgs(sys.argv[1:]) + ConfigFlags.lock() # Initialize configuration object, add accumulator, merge, and run. from AthenaConfiguration.MainServicesConfig import MainServicesCfg - cfg = MainServicesCfg(flags) + cfg = MainServicesCfg(ConfigFlags) storeGateSvc = cfg.getService("StoreGateSvc") storeGateSvc.Dump=True # in case of tier0 workflow: #from CaloRec.CaloRecoConfig import CaloRecoCfg - #cfg.merge(CaloRecoCfg(flags)) + #cfg.merge(CaloRecoCfg(ConfigFlags)) #from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - #cfg.merge(PoolReadCfg(flags)) + #cfg.merge(PoolReadCfg(ConfigFlags)) - if not flags.DQ.Environment == 'online': + if not ConfigFlags.DQ.Environment == 'online': from LumiBlockComps.BunchCrossingCondAlgConfig import BunchCrossingCondAlgCfg # FillParamsFolderKey = /TDAQ/OLC/LHC/FILLPARAMS - cfg.merge(BunchCrossingCondAlgCfg(flags)) + cfg.merge(BunchCrossingCondAlgCfg(ConfigFlags)) - cfg.merge(LArSuperCellMonConfig(flags)) + cfg.merge(LArSuperCellMonConfig(ConfigFlags)) f=open("LArSuperCellMon.pkl","wb") cfg.store(f) diff --git a/LArCalorimeter/LArROD/python/LArFebErrorSummaryMakerConfig.py b/LArCalorimeter/LArROD/python/LArFebErrorSummaryMakerConfig.py index 7403c404bdb525388d205940a9eb032639401b38..67377e7c1030021df37e590ba5d1567b55e2c429 100644 --- a/LArCalorimeter/LArROD/python/LArFebErrorSummaryMakerConfig.py +++ b/LArCalorimeter/LArROD/python/LArFebErrorSummaryMakerConfig.py @@ -1,16 +1,16 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 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(flags): +def LArFebErrorSummaryMakerCfg(configFlags): log = logging.getLogger('LArFebErrorSummaryMakerConfig') - projectName=flags.Input.ProjectName + projectName=configFlags.Input.ProjectName bCheckAllFEB=True - streamName=flags.Input.ProcessingTags + streamName=configFlags.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(flags): # needed only if it is not in DB. #lMaskFebZeroSample = [0x39618000,0x39930000,0x3b1b0000,0x38db0000,0x38f60000,0x39ae8000,0x3bb90000] - acc = LArBadFebCfg(flags) + acc = LArBadFebCfg(configFlags) minErrFeb=1 # In online or express processing, EventInfo::LArError is triggered if >=4 FEB with data corrupted - if flags.Common.isOnline or flags.Common.doExpressProcessing: + if configFlags.Common.isOnline or configFlags.Common.doExpressProcessing: minErrFeb=4 acc.addEventAlgo(CompFactory.LArFebErrorSummaryMaker("LArFebErrorSummaryMaker",CheckAllFEB=bCheckAllFEB, @@ -52,29 +52,28 @@ def LArFebErrorSummaryMakerCfg(flags): ) ) - acc.merge(addToESD(flags,["LArFebErrorSummary#LArFebErrorSummary",])) + acc.merge(addToESD(configFlags,["LArFebErrorSummary#LArFebErrorSummary",])) return acc if __name__=="__main__": - from AthenaConfiguration.AllConfigFlags import initConfigFlags + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) from AthenaConfiguration.TestDefaults import defaultTestFiles - flags = initConfigFlags() - flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.lock() + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 + ConfigFlags.lock() from AthenaConfiguration.MainServicesConfig import MainServicesCfg from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg - acc=MainServicesCfg(flags) - acc.merge(LArRawDataReadingCfg(flags)) - acc.merge(LArFebErrorSummaryMakerCfg(flags)) + acc=MainServicesCfg(ConfigFlags) + acc.merge(LArRawDataReadingCfg(ConfigFlags)) + acc.merge(LArFebErrorSummaryMakerCfg(ConfigFlags)) acc.run(3) diff --git a/LArCalorimeter/LArROD/python/LArRawChannelBuilderAlgConfig.py b/LArCalorimeter/LArROD/python/LArRawChannelBuilderAlgConfig.py index 5f00491ffd936d032548f6dc0bde0d04454fdcd6..cd43f47a796801a663bbd0d4a57a2df865c402b6 100644 --- a/LArCalorimeter/LArROD/python/LArRawChannelBuilderAlgConfig.py +++ b/LArCalorimeter/LArROD/python/LArRawChannelBuilderAlgConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 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(flags, **kwargs): +def LArRawChannelBuilderAlgCfg(configFlags, **kwargs): - acc = LArADC2MeVCondAlgCfg(flags) + acc = LArADC2MeVCondAlgCfg(configFlags) kwargs.setdefault("name", "LArRawChannelBuilder") - kwargs.setdefault("firstSample", flags.LAr.ROD.nPreceedingSamples if flags.LAr.ROD.nPreceedingSamples!=0 else flags.LAr.ROD.FirstSample) + kwargs.setdefault("firstSample", configFlags.LAr.ROD.nPreceedingSamples if configFlags.LAr.ROD.nPreceedingSamples!=0 else configFlags.LAr.ROD.FirstSample) obj = "AthenaAttributeList" dspkey = 'Run2DSPThresholdsKey' from IOVDbSvc.IOVDbSvcConfig import addFolders - if flags.Input.isMC: + if configFlags.Input.isMC: # need OFC configuration, which includes appropriate ElecCalibDb - acc.merge(LArOFCCondAlgCfg(flags)) + acc.merge(LArOFCCondAlgCfg(configFlags)) kwargs.setdefault("LArRawChannelKey", "LArRawChannels") kwargs.setdefault("ShapeKey", "LArShapeSym") - if flags.GeoModel.Run is LHCPeriod.Run1: # back to flat threshold + if configFlags.GeoModel.Run is LHCPeriod.Run1: # back to flat threshold kwargs.setdefault("useDB", False) dspkey = '' else: @@ -28,20 +28,20 @@ def LArRawChannelBuilderAlgCfg(flags, **kwargs): sgkey=fld dbString="OFLP200" dbInstance="LAR_OFL" - acc.merge(addFolders(flags,fld, dbInstance, className=obj, db=dbString)) + acc.merge(addFolders(configFlags,fld, dbInstance, className=obj, db=dbString)) - if flags.Common.ProductionStep is ProductionStep.PileUpPresampling: - kwargs.setdefault("LArDigitKey", flags.Overlay.BkgPrefix + "LArDigitContainer_MC") + if configFlags.Common.ProductionStep is ProductionStep.PileUpPresampling: + kwargs.setdefault("LArDigitKey", configFlags.Overlay.BkgPrefix + "LArDigitContainer_MC") else: kwargs.setdefault("LArDigitKey", "LArDigitContainer_MC") else: - acc.merge(LArElecCalibDBCfg(flags,("OFC","Shape","Pedestal"))) - if flags.Overlay.DataOverlay: + acc.merge(LArElecCalibDBCfg(configFlags,("OFC","Shape","Pedestal"))) + if configFlags.Overlay.DataOverlay: kwargs.setdefault("LArDigitKey", "LArDigitContainer_MC") kwargs.setdefault("LArRawChannelKey", "LArRawChannels") else: kwargs.setdefault("LArRawChannelKey", "LArRawChannels_FromDigits") - if 'COMP200' in flags.IOVDb.DatabaseInstance: + if 'COMP200' in configFlags.IOVDb.DatabaseInstance: fld='/LAR/Configuration/DSPThreshold/Thresholds' obj='LArDSPThresholdsComplete' dspkey = 'Run1DSPThresholdsKey' @@ -52,12 +52,12 @@ def LArRawChannelBuilderAlgCfg(flags, **kwargs): sgkey=fld dbString="CONDBR2" dbInstance="LAR_ONL" - acc.merge(addFolders(flags,fld, dbInstance, className=obj, db=dbString)) + acc.merge(addFolders(configFlags,fld, dbInstance, className=obj, db=dbString)) if len (dspkey) > 0: kwargs.setdefault(dspkey, sgkey) - if flags.LAr.ROD.forceIter or flags.LAr.RawChannelSource is RawChannelSource.Calculated: + if configFlags.LAr.ROD.forceIter or configFlags.LAr.RawChannelSource is RawChannelSource.Calculated: # iterative OFC procedure kwargs.setdefault('minSample',2) kwargs.setdefault('maxSample',12) @@ -66,7 +66,7 @@ def LArRawChannelBuilderAlgCfg(flags, **kwargs): kwargs.setdefault('defaultPhase',12) nominalPeakSample=2 from LArConditionsCommon.LArRunFormat import getLArFormatForRun - larformat=getLArFormatForRun(flags.Input.RunNumbers[0],connstring="COOLONL_LAR/"+flags.IOVDb.DatabaseInstance) + larformat=getLArFormatForRun(configFlags.Input.RunNumbers[0],connstring="COOLONL_LAR/"+configFlags.IOVDb.DatabaseInstance) if larformat is not None: nominalPeakSample = larformat.firstSample() else: @@ -87,28 +87,26 @@ def LArRawChannelBuilderAlgCfg(flags, **kwargs): if __name__=="__main__": - from AthenaConfiguration.AllConfigFlags import initConfigFlags + from AthenaConfiguration.AllConfigFlags import ConfigFlags from AthenaCommon.Logging import log from AthenaCommon.Constants import DEBUG log.setLevel(DEBUG) - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags - flags = initConfigFlags() - flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 + from AthenaConfiguration.TestDefaults import defaultTestFiles + ConfigFlags.Input.Files = defaultTestFiles.RAW_RUN2 # in case of testing iterative OFC: - #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() + #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() from AthenaConfiguration.MainServicesConfig import MainServicesCfg from LArByteStream.LArRawDataReadingConfig import LArRawDataReadingCfg - acc=MainServicesCfg(flags) - acc.merge(LArRawDataReadingCfg(flags)) - acc.merge(LArRawChannelBuilderAlgCfg(flags)) + acc=MainServicesCfg(ConfigFlags) + acc.merge(LArRawDataReadingCfg(ConfigFlags)) + acc.merge(LArRawChannelBuilderAlgCfg(ConfigFlags)) 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 31342ecd7cbeae829f49f730ee9abcba8c321a56..3b9aeedc2e0ccd694371be82ff9144d8344b4bb3 100644 --- a/LArCalorimeter/LArROD/src/LArNNRawChannelBuilder.cxx +++ b/LArCalorimeter/LArROD/src/LArNNRawChannelBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2023 CERN for the benefit of the ATLAS collaboration */ #include "LArNNRawChannelBuilder.h" @@ -11,7 +11,6 @@ #include "LArRawEvent/LArDigitContainer.h" #include "LArIdentifier/LArOnlineID.h" #include "LArCOOLConditions/LArDSPThresholdsFlat.h" -#include "LArElecCalib/LArProvenance.h" #include <cmath> #include "lwtnn/LightweightGraph.hh" @@ -165,8 +164,8 @@ StatusCode LArNNRawChannelBuilder::execute(const EventContext& ctx) const { float tau = 0; - uint16_t prov = LArProv::PEAKNN | LArProv::RAMPDB | LArProv::PEDDB; - if (saturated) prov |= LArProv::SATURATED; + uint16_t prov = 0xa5; //Means all constants from DB + if (saturated) prov |= 0x0400; 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 12df8aa563b285bea0019ef320473e08075c947f..f74e8b77555989a42138c4e641ab89b482d27d34 100644 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "LArRawChannelBuilderAlg.h" @@ -8,7 +8,6 @@ #include "LArIdentifier/LArOnlineID.h" #include "LArRawEvent/LArDigitContainer.h" #include "LArRawEvent/LArRawChannelContainer.h" -#include "LArElecCalib/LArProvenance.h" #include <cmath> #include <memory> @@ -161,8 +160,8 @@ StatusCode LArRawChannelBuilderAlg::execute(const EventContext& ctx) const { float tau=0; - uint16_t prov=LArProv::DEFAULTRECO; //Means all constants from DB + OFC - if (saturated) prov|=LArProv::SATURATED; + uint16_t prov=0xa5; //Means all constants from DB + if (saturated) prov|=0x0400; const float E1=m_absECutFortQ.value() ? std::fabs(E) : E; float ecut(0.); @@ -183,7 +182,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|=LArProv::QTPRESENT; // fill bit in provenance that time+quality information are available + prov|=0x2000; // 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 3849416d00c219fa8a1a436cec27b50d22fb6dc7..6a9205ebe9788afd2f2c9c68855d22534656948c 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,5 +44,6 @@ std::unique_ptr<CaloCell> LArCell::clone() const bool LArCell::badcell() const { - return LArProv::test(this->provenance(),LArProv::MASKED); + if (this->provenance() & 0x0800) return true; + return false; } diff --git a/LArCalorimeter/LArRecUtils/python/LArADC2MeVCondAlgConfig.py b/LArCalorimeter/LArRecUtils/python/LArADC2MeVCondAlgConfig.py index cedb7f25042d6f3ae0c204290020e634432d4040..fc880a0057d4367d72902aaa9b64d21f3a63e879 100644 --- a/LArCalorimeter/LArRecUtils/python/LArADC2MeVCondAlgConfig.py +++ b/LArCalorimeter/LArRecUtils/python/LArADC2MeVCondAlgConfig.py @@ -1,20 +1,24 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + +from __future__ import print_function from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -def LArADC2MeVCondAlgCfg(flags): +def LArADC2MeVCondAlgCfg(configFlags): from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg from LArGeoAlgsNV.LArGMConfig import LArGMCfg result=ComponentAccumulator() - result.merge(LArOnOffIdMappingCfg(flags)) - result.merge(LArGMCfg(flags)) #Needed for identifier helpers + result.merge(LArOnOffIdMappingCfg(configFlags)) + result.merge(LArGMCfg(configFlags)) #Needed for identifier helpers theADC2MeVCondAlg=CompFactory.LArADC2MeVCondAlg(LArADC2MeVKey = 'LArADC2MeV') + + isMC=configFlags.Input.isMC - if flags.Input.isMC: + if isMC: requiredConditions=["Ramp","DAC2uA","uA2MeV","MphysOverMcal","HVScaleCorr"] theADC2MeVCondAlg.LAruA2MeVKey="LAruA2MeVSym" theADC2MeVCondAlg.LArDAC2uAKey="LArDAC2uASym" @@ -25,24 +29,23 @@ def LArADC2MeVCondAlgCfg(flags): else: # not MC: requiredConditions=["Ramp","DAC2uA","uA2MeV","MphysOverMcal","HVScaleCorr"] from LArRecUtils.LArFebConfigCondAlgConfig import LArFebConfigCondAlgCfg - if 'COMP200' in flags.IOVDb.DatabaseInstance: # Run1 case + if 'COMP200' in configFlags.IOVDb.DatabaseInstance: # Run1 case theADC2MeVCondAlg.LAruA2MeVKey="LAruA2MeVSym" theADC2MeVCondAlg.LArDAC2uAKey="LArDAC2uASym" - result.merge(LArFebConfigCondAlgCfg(flags)) + result.merge(LArFebConfigCondAlgCfg(configFlags)) - result.merge(LArElecCalibDBCfg(flags,requiredConditions)) + result.merge(LArElecCalibDBCfg(configFlags,requiredConditions)) result.addCondAlgo(theADC2MeVCondAlg,primary=True) return result if __name__ == "__main__": from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles print ('--- data') flags1 = initConfigFlags() flags1.Input.Files = defaultTestFiles.RAW_RUN2 - flags1.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags1.lock() acc1 = LArADC2MeVCondAlgCfg (flags1) acc1.printCondAlgs(summariseProps=True) @@ -52,7 +55,6 @@ 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 5307ed2c1ca1f8066523c195cd735c442f0b7c10..89657f0c45534dabebe0b9690e6d33abed2a85fe 100644 --- a/LArCalorimeter/LArRecUtils/python/LArADC2MeVSCCondAlgConfig.py +++ b/LArCalorimeter/LArRecUtils/python/LArADC2MeVSCCondAlgConfig.py @@ -1,20 +1,22 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -def LArADC2MeVSCCondAlgCfg(flags): +def LArADC2MeVSCCondAlgCfg(configFlags): from LArConfiguration.LArElecCalibDBConfig import LArElecCalibDBCfg, LArElecCalibDBMCSCCfg from LArGeoAlgsNV.LArGMConfig import LArGMCfg result=ComponentAccumulator() from LArCabling.LArCablingConfig import LArOnOffIdMappingSCCfg - result.merge(LArOnOffIdMappingSCCfg(flags)) - result.merge(LArGMCfg(flags)) #Needed for identifier helpers + result.merge(LArOnOffIdMappingSCCfg(configFlags)) + result.merge(LArGMCfg(configFlags)) #Needed for identifier helpers theADC2MeVCondAlg=CompFactory.LArADC2MeVCondAlg(name = "LArADC2MeVSCCondAlg", LArADC2MeVKey = 'LArADC2MeVSC') - if flags.Input.isMC: + isMC=configFlags.Input.isMC + + if isMC: requiredConditions=["RampSC","DAC2uASC","uA2MeVSC"] theADC2MeVCondAlg.LAruA2MeVKey="LAruA2MeVSC" theADC2MeVCondAlg.LArDAC2uAKey="LArDAC2uASC" @@ -24,27 +26,26 @@ def LArADC2MeVSCCondAlgCfg(flags): theADC2MeVCondAlg.UseFEBGainTresholds=False theADC2MeVCondAlg.LArOnOffIdMappingKey="LArOnOffIdMapSC" theADC2MeVCondAlg.isSuperCell=True - result.merge(LArElecCalibDBMCSCCfg(flags,requiredConditions)) + result.merge(LArElecCalibDBMCSCCfg(configFlags,requiredConditions)) else: # not MC: requiredConditions=["Ramp","DAC2uA","uA2MeV","MphysOverMcal","HVScaleCorr"] from LArRecUtils.LArFebConfigCondAlgConfig import LArFebConfigCondAlgCfg - if 'COMP200' in flags.IOVDb.DatabaseInstance: # Run1 case + if 'COMP200' in configFlags.IOVDb.DatabaseInstance: # Run1 case theADC2MeVCondAlg.LAruA2MeVKey="LAruA2MeVSC" theADC2MeVCondAlg.LArDAC2uAKey="LArDAC2uASC" - result.merge(LArFebConfigCondAlgCfg(flags)) - result.merge(LArElecCalibDBCfg(flags,requiredConditions)) + result.merge(LArFebConfigCondAlgCfg(configFlags)) + result.merge(LArElecCalibDBCfg(configFlags,requiredConditions)) result.addCondAlgo(theADC2MeVCondAlg,primary=True) return result if __name__ == "__main__": from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles print ('--- data') flags1 = initConfigFlags() flags1.Input.Files = defaultTestFiles.RAW_RUN2 - flags1.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags1.lock() acc1 = LArADC2MeVSCCondAlgCfg (flags1) acc1.printCondAlgs(summariseProps=True) @@ -54,7 +55,6 @@ 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 0c619d6b6834edd5bea4a4ec0cbd64b4a74ab98b..a4b075b92dbacc83a42f2329011c6912999b80e1 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 initConfigFlags - flags = initConfigFlags() - flags.Input.Files = ["myRDO.pool.root",] - flags.lock() + from AthenaConfiguration.AllConfigFlags import ConfigFlags + + ConfigFlags.Input.Files = ["myRDO.pool.root",] + ConfigFlags.lock() from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - cfg=MainServicesCfg(flags) - cfg.merge(PoolReadCfg(flags)) + cfg=MainServicesCfg(ConfigFlags) + cfg.merge(PoolReadCfg(ConfigFlags)) from LArGeoAlgsNV.LArGMConfig import LArGMCfg - cfg.merge(LArGMCfg(flags)) + cfg.merge(LArGMCfg(ConfigFlags)) from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg - cfg.merge(LArOnOffIdMappingCfg(flags)) + cfg.merge(LArOnOffIdMappingCfg(ConfigFlags)) 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 189552ac27ba4e09d1e6d449e3e8a5ba7707d67e..12880d988a907334f822ef4aff3c732d2a6af003 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); + map_data.subdetectorId = CxxUtils::atoi(subdetector_id.c_str()); 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 09f37a8bffbb1362e2f7f555d441eb7bdeda7a5f..fc868d8870e3ed6efc62c13ee7512a1483ae92f7 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/MuonCalibSegmentCreator/MuonSegmentReader.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibSegmentCreator/MuonCalibSegmentCreator/MuonSegmentReader.h @@ -120,7 +120,6 @@ 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 e9a61eef5d6a52491414539ccf6d5393aac3c35a..d4ccce4fc20b1c4a6cb2d994fa3bf74fe8985e9c 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_nRpcEtaHits.push_back(trkSummary->get(Trk::numberOfRpcEtaHits)); + m_trk_nRpcPhiHits.push_back(trkSummary->get(Trk::numberOfRpcPhiHits)); 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/MuonConditions/MuonCondGeneral/MuonCondDump/python/MdtMezzExtraction.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondDump/python/MdtMezzExtraction.py index 1dc691cb71d2cc17ee77bf6ad8d42ee2ee8b53ac..c279b1b8ed5fc5ce5bc1894b650db250a8c4662e 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondDump/python/MdtMezzExtraction.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondDump/python/MdtMezzExtraction.py @@ -24,7 +24,6 @@ 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 5c1f4955adab8ee0f4830da83faad50a2ef46a0d..8d0a5dbdaa2ec643690fcd87a85d0e6cd2b18f83 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/python/MdtCablingTester.py +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondTest/python/MdtCablingTester.py @@ -8,7 +8,6 @@ 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 @@ -55,8 +54,7 @@ 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.GeoModel.AtlasVersion = args.geometry + flags.Input.Files = args.inputFile flags.lock() cfg = MdtCablingTestAlgCfg(flags, diff --git a/MuonSpectrometer/MuonConfig/python/MuonCablingConfig.py b/MuonSpectrometer/MuonConfig/python/MuonCablingConfig.py index df20bd423e8bd69d30fe6260fc8b4640ae32aeb1..274b0cc0a65f22a3b933db10b2ea36ddf5708594 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonCablingConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonCablingConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 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 @@ -183,10 +183,9 @@ def MuonCablingConfigCfg(flags): if __name__ == '__main__': from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.lock() acc = ComponentAccumulator() @@ -197,3 +196,6 @@ 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 9033d031d6facbfd68cc8dc106a6c04950fa62a8..58f7820b6a3df1884abdf41a0e073cb3b1d7c983 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, type=MMClusterBuilderEnum) + mcf.addFlag("Muon.MMClusterCalibRecoTool", lambda prevFlags : MMClusterBuilderEnum.ClusterTimeProjection if prevFlags.Input.isMC else MMClusterBuilderEnum.Centroid, enum = MMClusterBuilderEnum) diff --git a/MuonSpectrometer/MuonConfig/test/MdtRdoToPrepDataTool_test.py b/MuonSpectrometer/MuonConfig/test/MdtRdoToPrepDataTool_test.py index 293330d4c33e2488462bfaeef8a3bf319c5f79c9..bf49f253a4a240c2821a280b2ac50760be480659 100644 --- a/MuonSpectrometer/MuonConfig/test/MdtRdoToPrepDataTool_test.py +++ b/MuonSpectrometer/MuonConfig/test/MdtRdoToPrepDataTool_test.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration. +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration. # # File: MuonMDT_CnvTools/share/MdtRdoToPrepDataTool_test.py # Author: scott snyder @@ -52,13 +52,11 @@ def testCfg (flags): from AthenaConfiguration.AllConfigFlags import initConfigFlags -from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags +from AthenaConfiguration.TestDefaults import defaultTestFiles 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 1b36fdbf215bb718dbc80dbf2ca797f352d1a47b..d14e92b27b3655dd13cd94d80094e970908bf849 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/MuonNSWAsBuilt/ElementModelSTGC.h +++ b/MuonSpectrometer/MuonDetDescr/MuonNSWAsBuilt/MuonNSWAsBuilt/ElementModelSTGC.h @@ -79,7 +79,6 @@ 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 2992a415c87a2b4c2075910c18d0d8a562ee1961..96dfa1b10bc0e9812bf8fb4efda7343131c4fb4e 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),m_lenX(lenX), +ElementModelSTGC::ElementModelSTGC(double /*lenX*/, double lenY, Amg::Vector3D defo0) + : m_lenY(lenY), 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_lenX*m_lenY); + double delta = npar*d0[0]*d0[1]/(m_lenY*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_lenX*m_lenY); + double npar = parvec[NPAR]/(m_lenY*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 c9d30fd3f4d93519c3231c976c4b36f5d31df6ef..433ff4427713cff38964a6070e5d1ad2d0e21bf9 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithmsDict.h @@ -18,6 +18,5 @@ #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 0b03af25676431bfaf15ac9c6c194311bb11de67..1af94ac2b25c4c855b0fa1f19dd414f35f2b3d9b 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h @@ -43,14 +43,12 @@ namespace CP /// \brief the systematics list we run SysListHandle m_systematicsList {this}; - SysReadHandle<xAOD::IParticleContainer> m_egammaContKey{this, "ElectronOrPhotonContKey", "", "Electrons or photons for dR comparison"}; + SysReadHandle<xAOD::IParticleContainer> m_egammaContH{this, "ElectronOrPhotonContKey", "", "Electrons or photons for dR comparison"}; - SysReadHandle<xAOD::MuonContainer> m_muonContKey{this, "MuonContKey", "AnalysisMuons", "Muons to compare with for selecting FSR"}; + SysReadHandle<xAOD::MuonContainer> m_muonContH{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 03fcf69cc1d4d62ae8dbc4972d82a157714cc153..a792d44ce1a205a57487dc62cd85ea725f05b352 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/selection.xml +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/EgammaAnalysisAlgorithms/selection.xml @@ -10,6 +10,5 @@ <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 0361d4cbc084580a58a15c03d0de0af890955b81..01e7fcc8ce7c7d193c08640cdad7491c3ce9acbb 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaFSRForMuonsCollectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/Root/EgammaFSRForMuonsCollectorAlg.cxx @@ -12,9 +12,6 @@ #include "EgammaAnalysisAlgorithms/EgammaFSRForMuonsCollectorAlg.h" #include <FourMomUtils/xAODP4Helpers.h> #include <xAODEgamma/Electron.h> - -#include "xAODEgamma/ElectronxAODHelpers.h" - #include <SelectionHelpers/SelectionHelpers.h> namespace CP @@ -35,18 +32,13 @@ namespace CP return StatusCode::FAILURE; } - ATH_CHECK(m_egammaContKey.initialize(m_systematicsList)); - ATH_CHECK(m_muonContKey.initialize(m_systematicsList)); + ATH_CHECK(m_egammaContH.initialize(m_systematicsList)); + ATH_CHECK(m_muonContH.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; @@ -58,45 +50,26 @@ 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_egammaContKey.retrieve (egammaCont, sys)); + ANA_CHECK (m_egammaContH.retrieve (egammaCont, sys)); // Retrieve muons const xAOD::MuonContainer* muonCont = nullptr; - ANA_CHECK (m_muonContKey.retrieve (muonCont, sys)); + ANA_CHECK (m_muonContH.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 (!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 - } + // 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) ); const xAOD::Electron* el = (eg->type() == xAODType::Electron) ? dynamic_cast<const xAOD::Electron*>(eg) : 0; @@ -115,27 +88,17 @@ 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 = - ( (std::abs(electron_track->theta()- muon_track->theta()) < 0.01) && + ( (fabs(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) = (m_vetoFSR) ? selectionReject() : selectionAccept(); + (*m_wpDec)(*eg) = 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 8b61712b945ae00a1b2b45f1195903f52de9e631..5d8fee1f1e8fc16d9e85a661d0c695f3b1b04080 100644 --- a/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py +++ b/PhysicsAnalysis/Algorithms/EgammaAnalysisAlgorithms/python/ElectronAnalysisConfig.py @@ -169,52 +169,30 @@ 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 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' + 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] 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: + 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: # Set up the DNN ID selection algorithm alg = config.createAlgorithm( 'CP::AsgSelectionAlg', 'ElectronDNNAlg' + postfix ) alg.selectionDecoration = 'selectDNN' + selectionPostfix + ',as_bits' @@ -229,7 +207,6 @@ 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) @@ -241,11 +218,6 @@ 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 6f78d9d05c974f6459115d6cec63c182869e5d10..4836be8f96404d65d3b303acfbed40068a140558 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,5 +22,4 @@ 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 bd6e2d3b4a8d746accbc0ca14df7425440c673f1..994ebc145471f8562fee7fc8212365aa0d5d51fd 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/CMakeLists.txt +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 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 bf262ccbc111f997eb395d0fa257039ceb5f7c66..700cbb72c753509f8c758d22151a5f188d6c8625 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/ChargeSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/ChargeSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 14c7d8e33e6e775da773079a10aaa3160ce77613..017d5ea29e2cbc1b00146706a78d1fd71c5225c8 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 7a64df02a01f1dfdbc52d8345a228e85f2bd5129..23dd2d07338b3b529194655fbd769a415362aaa9 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassWindowSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/DileptonInvariantMassWindowSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 5c604a48edaaf9e866d75f0224d39e36db5ad4b5..0dc1fec471677c02c2af22b058bbad6a2737fae6 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/EventSelectionAlgorithmsDict.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/EventSelectionAlgorithmsDict.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina @@ -16,9 +16,5 @@ #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 edb76c7939443d42a08a4b5fa5e96048c8d9b5c8..2261fc005ff7319aab1927ef49baf941a89c8261 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETPlusTransverseMassSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETPlusTransverseMassSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 155b60c1c5aad444ba6616f357984dd429ffcda5..9f85bf164c251f9a8cd6c731376d53a22fd41c59 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/MissingETSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 dda4c143ab7d5716267e7ddc4f6fd2ff6264d8e9..40553137d0aa334c2fa371cd337a46c605a92341 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/NObjectPtSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/NObjectPtSelectorAlg.h @@ -1,11 +1,11 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina -#ifndef EVENT_SELECTOR_NOBJECTPTSELECTORALG_H -#define EVENT_SELECTOR_NOBJECTPTSELECTORALG_H +#ifndef EVENT_SELECTOR_NOBJECTPTELECTORALG_H +#define EVENT_SELECTOR_NOBJECTPTELECTORALG_H // Algorithm includes #include <AnaAlgorithm/AnaAlgorithm.h> @@ -81,4 +81,4 @@ namespace CP { }; // class } // namespace CP -#endif // EVENT_SELECTOR_NOBJECTPTSELECTORALG_H +#endif // EVENT_SELECTOR_NOBJECTPTELECTORALG_H diff --git a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SaveFilterAlg.h b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SaveFilterAlg.h index bbef3a0a2404df9b75183d1ded5de6c36b47690f..37aec0fa777523e939bd4cb69a4cb0f7119dd9d0 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SaveFilterAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SaveFilterAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 d94227d7ce5f4a846045d742cf5e51e855f4bf43..73116256a3129a3bc90fe6ce7bfe5bc954617d46 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SignEnums.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/SignEnums.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 00a5d726b50bec81e483c3d1ea5168b092b427f4..6e48ca4b094f176198121a3d10f690802756ddda 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/TransverseMassSelectorAlg.h +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/TransverseMassSelectorAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 d7109666271b2d8bed5907befde2e4c5df8719cb..7332cc65810de6b30575f36456ff3cdbb988fc93 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/selection.xml +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/EventSelectionAlgorithms/selection.xml @@ -9,10 +9,6 @@ <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 e470c2a2168998d6c35a5d41345ee903cbe83795..24d4227bb88277c4afaeec6a653ae02a509cab4e 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/ChargeSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/ChargeSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 3887669a99c46316f826d61f480b3ae6c71abff5..426eb129a5d034c92c4f4a524425c3a90d54a681 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 7c9b0bec6ccb2c339f1151313e2f52b4f97a1d56..ec4fe2030211bad48d08d4adf5b4855a2dce6218 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassWindowSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/DileptonInvariantMassWindowSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 ea7c6f3401dd55d2c3b2034a3a281c595014ba7a..e0db4405edc8678ff9fcb500c856db6b50464231 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETPlusTransverseMassSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETPlusTransverseMassSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 7039c8107cc04b5fa32fbded03f7b99d5dead22c..5d8fcb5c19c95eec34181c15394e0347b2b5cfcb 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/MissingETSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 49198d2aa9ae5a554b44c0cfc92a9cf100eeb8ae..f4150db19bd05ca49cfd950879e7656df9ece0ce 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/NObjectPtSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/NObjectPtSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 4ee73f2db7d64edf8e87a1521830775fc9a4d1ec..a06b0a26b2e0ad75970930b6e06d49c7246cc135 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/SaveFilterAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/SaveFilterAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 18b5666561703f1150dcfcef03c122358ad12c32..1a11c1cde5fc39b661030b0788f546aa83c4906c 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/TransverseMassSelectorAlg.cxx +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/Root/TransverseMassSelectorAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 1182d01857a2e6f0ef4ae5cc66916a259d835cce..4e2f94726cd3776b7bf8b5a0c9a38782f675d13e 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/EventSelectionConfig.py +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/EventSelectionConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock from AsgAnalysisAlgorithms.AsgAnalysisConfig import makeEventCutFlowConfig @@ -28,7 +28,6 @@ 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) @@ -68,8 +67,6 @@ 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(): @@ -78,8 +75,6 @@ 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(): @@ -94,12 +89,6 @@ 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(): @@ -212,7 +201,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]) @@ -240,39 +229,13 @@ 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": @@ -294,7 +257,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]) @@ -349,7 +312,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]) @@ -377,95 +340,13 @@ 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": @@ -547,7 +428,7 @@ class EventSelectionConfig(ConfigBlock): items = text.split() if items[0] != "MLLWINDOW": self.raise_misconfig(text, "MLLWINDOW") - if len(items) != 3 and len(items) != 4: + if len(items) != 3: self.raise_misconfig(text, "number of arguments") if not self.electrons and not self.muons: self.raise_missinginput("electrons or muons") @@ -559,7 +440,8 @@ 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]) - alg.vetoMode = (len(items) == 4 and self.check_string(items[3]) == "veto") + # if high<low we are trying to veto events in that window; otherwise we select them + alg.vetoMode = alg.highMLL < alg.lowMLL alg.eventPreselection = f'{self.currentDecoration}' self.setDecorationName(alg, config, f'{thisalg}_%SYS%') return @@ -598,27 +480,6 @@ 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": @@ -639,7 +500,6 @@ 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, @@ -651,7 +511,6 @@ 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 @@ -667,7 +526,6 @@ 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') @@ -685,7 +543,6 @@ 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, @@ -696,7 +553,6 @@ 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 @@ -711,13 +567,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, largeRjets, photons, taus, met, btagDecoration, preselection, selectionCuts, noFilter=noFilter, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms) + makeEventSelectionConfig(seq, name, electrons, muons, jets, 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, largeRjets, photons, taus, met, btagDecoration, preselection, selectionCuts, noFilter=True, debugMode=debugMode, cutFlowHistograms=cutFlowHistograms) + makeEventSelectionConfig(seq, name, electrons, muons, jets, 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 2bce7f19313916c34fa2f1ffb71c0d1b5213f006..de5fa7402d66bc45603a69407775aaf463363f7f 100644 --- a/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/__init__.py +++ b/PhysicsAnalysis/Algorithms/EventSelectionAlgorithms/python/__init__.py @@ -1,3 +1,3 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 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 6a459a7a5878f640c6a28064eead7c101a123637..855b0d0407410d2c819099c9ff48ed2dc36c6931 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /// @author Baptiste Ravina @@ -12,10 +12,6 @@ #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) @@ -25,7 +21,3 @@ 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 73b9726e34896e5e14216202c292b886602e0cff..0e17600a9ea61ac335ec4ff3ec6392ca9265dc8d 100644 --- a/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py +++ b/PhysicsAnalysis/Algorithms/MuonAnalysisAlgorithms/python/MuonAnalysisSequence.py @@ -11,7 +11,6 @@ def makeMuonAnalysisSequence( dataType, workingPoint, postfix = '', ptSelectionOutput = False, trackSelection = True, - maxEta = 2.7, qualitySelectionOutput = True, enableCutflow = False, enableKinematicHistograms = False, @@ -55,8 +54,7 @@ def makeMuonAnalysisSequence( dataType, workingPoint, makeMuonCalibrationSequence (seq, dataType, postfix=postfix, ptSelectionOutput = ptSelectionOutput, - trackSelection = trackSelection, - maxEta = maxEta) + trackSelection = trackSelection) makeMuonWorkingPointSequence (seq, dataType, workingPoint, postfix=postfix, qualitySelectionOutput = qualitySelectionOutput, isRun3Geo = isRun3Geo) makeSharedObjectSequence (seq, deepCopyOutput = deepCopyOutput, @@ -74,7 +72,7 @@ def makeMuonAnalysisSequence( dataType, workingPoint, def makeMuonCalibrationSequence( seq, dataType, - postfix = '', ptSelectionOutput = False, trackSelection = False, maxEta = 2.7): + postfix = '', ptSelectionOutput = False, trackSelection = False): """Create muon calibration analysis algorithms This makes all the algorithms that need to be run first befor @@ -104,7 +102,7 @@ def makeMuonCalibrationSequence( seq, dataType, alg = createAlgorithm( 'CP::AsgSelectionAlg', 'MuonEtaCutAlg' + postfix ) addPrivateTool( alg, 'selectionTool', 'CP::AsgPtEtaSelectionTool' ) - alg.selectionTool.maxEta = maxEta + alg.selectionTool.maxEta = 2.7 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 b0042e081548a070e391ea8e216790acb844b438..ba2f8643f4f2f8c55d72c5ee792c16ad40a9c709 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->getTruth (*tau); + m_matchingTool->applyTruthMatch (*tau); } } } diff --git a/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauTruthMatchingAlg.cxx b/PhysicsAnalysis/Algorithms/TauAnalysisAlgorithms/Root/TauTruthMatchingAlg.cxx index 18bcffd3ed0fda7327da959356a38ca68cf1e0d9..3525b8d565c2b4a7fb37a141bddbc38d6337bba8 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->getTruth (*tau); + m_matchingTool->applyTruthMatch (*tau); } } } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY18.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/python/BPHY18.py index f99511340fb8859daa5a709d8b0b0f31eedadfb1..c1236ba45262f8b089bdbc63190476239f099de1 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 || abs(TruthParticles.pdgId) == 511 || abs(TruthParticles.pdgId) == 513", + 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", PreserveDescendants = True, StreamName = streamName, PreserveAncestors = True) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/TriggerContent.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/TriggerContent.py index ad01a9404369a4e10bd5c6c0f9f3517b25191d08..44acf3daa25626fd51e1dcbdfc49ce04357eb02c 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/TriggerContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/TriggerContent.py @@ -1,9 +1,9 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 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,811 +11,830 @@ # 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", -] - - -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", +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', + ] + + + +#==================================================================== # 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_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.", -] +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.", + ] # Additional contaienrs for electron trigger studies ExtraContainersElectronTrigger = {} -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.", -] +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.", + ] # 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.", + ] + + +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.", -] +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 4d7069b5bdad8883251f8524f3937523bbf1e38f..f6cee020dcedf51b1b20d29c325692b660471407 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonExtraContent.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonExtraContent.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration #==================================================================== # Common file used by TOPQCommonSlimming.py @@ -190,6 +190,7 @@ 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 02f5d6d13f0a8691421ba9f64a02e67382b4b30f..b627425c8cfed0dd612acc97f3deae5241f60763 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 = defaultGeometryTags.RUN2 + # flags.GeoModel.AtlasVersion = "ATLAS-R2-2016-01-00-01" ### 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 = defaultGeometryTags.RUN3 + flags.GeoModel.AtlasVersion = "ATLAS-R3S-2021-03-01-00" ### ### ### diff --git a/PhysicsAnalysis/JetTagging/FlavourTaggingTests/test/test_FTAG_grid.sh b/PhysicsAnalysis/JetTagging/FlavourTaggingTests/test/test_FTAG_grid.sh index 186272377e79bb94a1bf34db2216fe76ca43c31e..6454088b615053b24b45f1c4fbd74929de867101 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_FTAG_PHYSVAL.sh +file=test_full_chain_mu0.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 27979e8d350f5340ce0b28257287bf9bf8c543d4..b4e1a1a337a9a96d95cda0d7447084e1483f29e2 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagLightSecVertexing.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagLightSecVertexing.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_BTAGLIGHTSECVERTEXING_H @@ -17,8 +17,9 @@ #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" @@ -34,12 +35,15 @@ 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() = default; + virtual ~BTagLightSecVertexing(); virtual StatusCode initialize() override; virtual StatusCode BTagSecVertexing_exec(const xAOD::JetContainer * jetContainer, xAOD::BTaggingContainer * btaggingContainer) const override; @@ -50,10 +54,12 @@ 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 30e07a5bf289c624d33aef2a2bc45ef2f3819f50..78b7c4a4a551308c6707976486b2aa59af9ffc2f 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 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,6 +29,7 @@ /** 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 @@ -68,7 +69,7 @@ namespace Analysis /** Constructors and destructors */ BTagTool(const std::string&,const std::string&,const IInterface*); - virtual ~BTagTool() = default; + virtual ~BTagTool(); /** Main routines specific to an ATHENA algorithm */ virtual StatusCode initialize() override; @@ -88,8 +89,14 @@ 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 e334500babd846e66bbbcb62b3fe0fc8d0970dd9..0f9a593168f0b4dab386dce9cb8cb9c487eb589c 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTrackAugmenterAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/BTagTrackAugmenterAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_TRACK_AUGMENTER_ALG_HH @@ -7,8 +7,12 @@ #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 8ff82a3dd9044ef0c07bdba5a8e765e023711307..7a791247289efd5cee3245c412cd840387d385c9 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/IBTagLightSecVertexing.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/IBTagLightSecVertexing.h @@ -1,12 +1,18 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 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 5ce68396d0f5e21004dcb4431af15e82113fa362..aae1fb80a6060e66a33291f01817bac8e41b2a6f 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetBTaggingAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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() = default; + virtual ~JetBTaggingAlg(); /** 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 5978d330bae8ebbf9bb47362b8e27c1b5b764732..305d7159d73dfccd55f61c9fca8d90ee2cf9b60b 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVertexingAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVertexingAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_JETSECVERTEXINGALG_H @@ -14,15 +14,16 @@ 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" @@ -37,13 +38,14 @@ 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() = default; + virtual ~JetSecVertexingAlg(); /** Main routines specific to an ATHENA algorithm */ virtual StatusCode initialize() override; @@ -57,6 +59,7 @@ 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 26003b3cc7203f1110ade50d030670d0a243254c..efa7948607c5ab79225ab66e09a39bbf79978e5f 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVtxFindingAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/BTagging/JetSecVtxFindingAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGGING_JETSECVTXFINDINGALG_H @@ -10,16 +10,18 @@ #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 { @@ -29,7 +31,7 @@ namespace Analysis public: /** Constructors and destructors */ JetSecVtxFindingAlg(const std::string& name, ISvcLocator *pSvcLocator); - virtual ~JetSecVtxFindingAlg() = default; + virtual ~JetSecVtxFindingAlg(); /** Main routines specific to an ATHENA algorithm */ virtual StatusCode initialize() override final; @@ -39,6 +41,8 @@ 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 6ffe683cee772d9a703259a5c7dea1e6d6a57d4c..c7ec30f9c209754b70e442c272ad4cec0d58fb45 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 JetTagToolsLib MagFieldConditions ParticleJetToolsLib StoreGateLib TrkExInterfaces TrkVertexFitterInterfaces VxSecVertex VxVertex xAODBTagging xAODEventInfo xAODJet xAODMuon xAODTracking - PRIVATE_LINK_LIBRARIES InDetRecToolInterfaces JetTagEvent Particle TrkLinks TrkSurfaces VxJetVertex xAODBase xAODCore ) + 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 ) 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 966121057a9c21b514dc422ab1e2234c87a3fb50..4e6b79e4b0591c0c0dd0bdcd17ba3597d7622254 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -74,6 +74,11 @@ 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)) @@ -84,7 +89,8 @@ def BTagToolCfg(flags, TaggerList, PrimaryVertexCollectionName="", scheme = '', options = {} if useBTagFlagsDefaults: - defaults = { 'vxPrimaryCollectionName' : PrimaryVertexCollectionName, + defaults = { 'Runmodus' : flags.BTagging.RunModus, + '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 new file mode 100644 index 0000000000000000000000000000000000000000..d1bcf74c3c7f3250c25301af45c1f464ad2856ff --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/share/btaggingAlgs.py @@ -0,0 +1,24 @@ +# 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 dcbffc3c393388506dd100a888567d444c641dd3..9472b7551c77164cec964c220c5b2732e0653fc8 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagLightSecVertexing.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagLightSecVertexing.cxx @@ -1,27 +1,49 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 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/RecVertexPositions.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/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" @@ -30,16 +52,22 @@ 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_JFvarFactory("Analysis::JetFitterVariablesFactory",this), + //m_MSVvarFactory("Analysis::MSVVariablesFactory",this), + m_vxPrimaryName("PrimaryVertices") { 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("JetFitterVariableFactory", m_JFvarFactory); + //declareProperty("MSVVariableFactory", m_MSVvarFactory); } + BTagLightSecVertexing::~BTagLightSecVertexing() = default; + StatusCode BTagLightSecVertexing::initialize() { // This will check that the properties were initialized properly @@ -70,15 +98,20 @@ 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); @@ -171,10 +204,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; @@ -319,8 +352,8 @@ namespace Analysis { } for (const auto *fz : *h_VertexCollectionName) { if (fz->vertexType() == xAOD::VxType::PriVtx) { - primaryVertex = fz; - break; + primaryVertex = fz; + break; } } @@ -330,7 +363,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"); } } @@ -373,15 +406,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"); @@ -396,12 +429,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 08194d6c27c9bc1a36424f49fc6312bb2cb52fc1..1e0d545c9d6874bc1acefa6994670c290e731819 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -17,18 +17,33 @@ #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_bTagTool(std::map<std::string, ITagTool*>()), + m_BaselineTagger("IP3D+SV1"), + m_vxPrimaryName("PrimaryVertices"), + m_runModus("analysis") { + // 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 @@ -77,36 +92,40 @@ namespace Analysis { /* RETRIEVE PRIMARY VERTEX CONTAINER FROM STOREGATE */ /* ----------------------------------------------------------------------------------- */ const xAOD::Vertex* primaryVertex(nullptr); - SG::ReadHandle<xAOD::VertexContainer> h_VertexCollectionName (m_VertexCollectionName); + StatusCode sc = StatusCode::SUCCESS; if (vtx) { primaryVertex = vtx; } else { - if (!h_VertexCollectionName.isValid()) { - ATH_MSG_ERROR( " cannot retrieve primary vertex container with key " << m_VertexCollectionName.key() ); - return StatusCode::FAILURE; + 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; } - unsigned int nVertexes = h_VertexCollectionName->size(); - if (nVertexes == 0) { + + if (vxContainer->empty()) { ATH_MSG_DEBUG("#BTAG# Vertex container is empty"); return StatusCode::SUCCESS; } - for (const auto *fz : *h_VertexCollectionName) { + for (const auto *fz : *vxContainer) { 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 = h_VertexCollectionName->begin(); - primaryVertex = *fz; + xAOD::VertexContainer::const_iterator fz = vxContainer->begin(); + primaryVertex = *fz; if (primaryVertex->nTrackParticles() == 0) { ATH_MSG_DEBUG("#BTAG# PV==BeamSpot: probably poor tagging"); m_nBeamSpotPvx++; - } + } } } @@ -115,12 +134,22 @@ namespace Analysis { /* ----------------------------------------------------------------------------------- */ for (const ToolHandle<ITagTool>& tool : m_bTagToolHandleArray) { - StatusCode sc = tool->tagJet(*primaryVertex, *jetToTag, *BTag, jetName); + 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); + } +*/ // ---------------------------------------------------------------------------------- @@ -135,8 +164,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 7f93432537d1508f2dddc801995811c79975bf6b..5fa5ec91e1032f16bd7036fe05394943418dbeb4 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx @@ -1,8 +1,19 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 91df01bf76bfa60d9a653c9afb4debe1f905863f..cd206ed5f9744bf8955cffeb8eb939e979d59650 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetBTaggingAlg.cxx @@ -1,13 +1,21 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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> @@ -26,6 +34,12 @@ 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 fb50219bc16e2c134132ea9e17d0be36c4b73019..b3fa6e4d814de6dc43e07e10a9267d74c6db0b68 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVertexingAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVertexingAlg.cxx @@ -1,41 +1,68 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "BTagging/JetSecVertexingAlg.h" -#include "VxJetVertex/RecVertexPositions.h" +#include "xAODCore/ShallowCopy.h" +#include "VxVertex/VxContainer.h" +#include "VxVertex/RecVertex.h" +#include "VxVertex/PrimaryVertexSelector.h" // new since rel 17.2 //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/VertexAuxContainer.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_MSVvarFactory("Analysis::MSVVariablesFactory",this), + m_vxPrimaryName("PrimaryVertices") { + 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 79f6dd780060c9301d6e174c9f26d4cbec1d2b80..3ced256342151b884662a9f92aa407ea60d85e47 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVtxFindingAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/JetSecVtxFindingAlg.cxx @@ -1,7 +1,13 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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" @@ -11,12 +17,16 @@ namespace Analysis { JetSecVtxFindingAlg::JetSecVtxFindingAlg(const std::string& name, ISvcLocator* pSvcLocator): AthReentrantAlgorithm(name,pSvcLocator), - m_secVertexFinderToolHandle(this) + m_secVertexFinderToolHandle(this), + m_vxPrimaryName("PrimaryVertices") { + 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 7104776949270845bf6d5b361ceac9b78a917864..bcd431acb629ffcd76ab93054dfa76531928eb06 100755 --- a/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondAlg.h +++ b/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGCALIBRATION_JETTAGCALIBCONDALG_H @@ -75,6 +75,7 @@ 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 578c8d83f85f43c99f98a063a8319aa992325b84..28163240e7cb55652ec86eba68d28b54b7fff744 100644 --- a/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondAlg.cxx @@ -1,11 +1,12 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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" @@ -180,6 +181,11 @@ 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"); @@ -373,6 +379,36 @@ 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 6b47153a8e903c71419f6a89de761561796987c1..4ba32a41f095365974a3a1622ae0b05c44fc4999 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CTTDecorCheckInTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CTTDecorCheckInTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // // CTTDecorCheck.h - Description @@ -16,26 +16,37 @@ #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 CTTDecorCheckInTool : public AthAlgorithm + + +class TLorentzVector; + + + + class CTTDecorCheckInTool : public AthAlgorithm { public: /* Constructor */ CTTDecorCheckInTool(const std::string& type, ISvcLocator* pSvcLocator); /* Destructor */ - virtual ~CTTDecorCheckInTool() = default; + virtual ~CTTDecorCheckInTool(); + virtual StatusCode initialize() override; virtual StatusCode execute() override; + virtual StatusCode finalize() override; //------------------------------------------------------------------------------------------------------------------ // Private data and functions @@ -53,7 +64,11 @@ class CTTDecorCheckInTool : public AthAlgorithm 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 baa61c943047e941a069247584cb97e04f3c905c..c7c8207ad4db08f7499650c8c338ae151aaba1eb 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/ClassifiedTrackTaggerTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/ClassifiedTrackTaggerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // // ClassifiedTrackTaggerTool.h - Description @@ -22,6 +22,7 @@ #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" @@ -57,7 +58,8 @@ namespace Analysis { /* Constructor */ ClassifiedTrackTaggerTool(const std::string& type, const std::string& name, const IInterface* parent); /* Destructor */ - virtual ~ClassifiedTrackTaggerTool() = default; + virtual ~ClassifiedTrackTaggerTool(); + virtual StatusCode initialize() override; virtual StatusCode finalize() override; @@ -73,7 +75,9 @@ namespace Analysis { private: //debugging - IChronoStatSvc* m_timingProfile{}; + IChronoStatSvc* m_timingProfile{}; + //variable to check: before public method bJetWgts can be executed, check that initialize() has been run! + int m_initialised{}; //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 1c7b32498bca5dd21245a0e95c32a5da371fd9ac..d9cc2ff7ea451863735fccc1d88c907edb0b444f 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CombinerToolTag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/CombinerToolTag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ /****************************************************** @@ -44,14 +44,19 @@ namespace Analysis { /** Implementations of the methods defined in the abstract base class */ - virtual ~CombinerToolTag() = default; - virtual StatusCode initialize() override; - virtual void tagJet(xAOD::Jet& jetToTag); + virtual ~CombinerToolTag(); + StatusCode initialize(); + StatusCode finalize(); + virtual void finalizeHistos(); + virtual void tagJet(xAOD::Jet& jetToTag); + + void setOrigin(const Trk::VxCandidate*) { } 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 d87e4ca146baaa161cc52e61a523e3502f7984d5..b4b0bcfa68ae721dbfcc2e476353c71659803844 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/DetailedTrackGradeFactory.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/DetailedTrackGradeFactory.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGTOOLS_DetailedTrackGradeFactory_H @@ -27,6 +27,9 @@ #include "JetTagInfo/TrackGradesDefinition.h" +//namespace xAOD { class TrackParticle; } + + namespace Analysis { @@ -37,15 +40,17 @@ class DetailedTrackGradeFactory : public AthAlgTool, virtual public ITrackGradeF public: DetailedTrackGradeFactory(const std::string&,const std::string&,const IInterface*); - virtual ~DetailedTrackGradeFactory() = default; + virtual ~DetailedTrackGradeFactory(); - /** AlgTool initialize method */ - virtual StatusCode initialize() override; + /** AlgTool initailize method */ + StatusCode initialize(); + /** AlgTool finalize method */ + StatusCode finalize(); - virtual TrackGrade* getGrade(const xAOD::TrackParticle & track, - const xAOD::IParticle::FourMom_t & jetMomentum) const override; + TrackGrade* getGrade(const xAOD::TrackParticle & track, + const xAOD::IParticle::FourMom_t & jetMomentum) const; - virtual const TrackGradesDefinition & getTrackGradesDefinition() const override; + virtual const TrackGradesDefinition & getTrackGradesDefinition() const; private: diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/IPTag.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/IPTag.h index 8f70a27b2f2d9893162ede609249a8a815363e40..1bdd2928e78e0e23aee23932935bfba08d57fed5 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/IPTag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/IPTag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGTOOLS_IPTAG_H @@ -15,17 +15,22 @@ #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; @@ -81,6 +86,8 @@ 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; @@ -94,19 +101,25 @@ 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 */ @@ -118,10 +131,13 @@ 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; + std::vector<std::string> m_jetCollectionList, m_jetWithInfoPlus; // //// VD: list of tools below diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterInputWriter.h b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterInputWriter.h index 0132b25efbf4dc3b438fcb8f925eb7b46ef37d94..c218be25412f2edac5d2a40bfccffea60e9cb0dc 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterInputWriter.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterInputWriter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGTOOL_JETFITTERINPUTWRITER_H @@ -53,6 +53,8 @@ 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 37a6ba1b3abb5ea3b88bb27a2228602ddab4405d..7db44c0445bf32fa7269fa184b2c68c3d152b7cc 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterVariablesFactory.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetFitterVariablesFactory.h @@ -1,7 +1,7 @@ // -*- c++ -*- /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGTOOL_JETFITTERVARIABLESFACTORY_C @@ -25,6 +25,10 @@ namespace Analysis { + + //static const InterfaceID IID_JetFitterVariablesFactory("Analysis::JetFitterVariablesFactory", 1, 0); + + class JetFitterVariablesFactory : public AthAlgTool , virtual public IJetFitterVariablesFactory { public: @@ -38,9 +42,15 @@ 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 new file mode 100644 index 0000000000000000000000000000000000000000..8d7f8752d01d3289f474d6241431b51fa8175a9e --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/JetVertexCharge.h @@ -0,0 +1,207 @@ +/* + 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 419986f708a8e850b4444fc440b161ff89597107..72f34061cef2cc704aa1f8c36335b99e8c0ffa1c 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MSVVariablesFactory.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MSVVariablesFactory.h @@ -1,7 +1,7 @@ // -*- c++ -*- /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGTOOL_MSVVARIABLESFACTORY_C @@ -20,33 +20,38 @@ 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() = default; - + virtual ~MSVVariablesFactory(); + 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; + 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; }; + 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 7932c8c8d85ac0e0ff8b9668f0d6b74e9d0ef6e5..d9f904e498b6d7781b0d4e40df0017c041564632 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MV2Tag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MV2Tag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGTOOLS_MV2TAG_H @@ -19,7 +19,6 @@ #include <list> #include "MVAUtils/BDT.h" #include "JetTagCalibration/JetTagCalibCondData.h" -#include "TLorentzVector.h" namespace Analysis { @@ -33,8 +32,9 @@ namespace Analysis { /** Implementations of the methods defined in the abstract base class */ - virtual ~MV2Tag() = default; + virtual ~MV2Tag(); virtual StatusCode initialize()override ; + virtual StatusCode finalize() override; virtual void assignProbability(xAOD::BTagging* BTag, @@ -44,13 +44,17 @@ 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; @@ -70,9 +74,29 @@ 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 7b5faa879d53fe6de453e62897225bde6e826d00..c37c61d50fc2d5453952f7d66c2da3b1e73a7555 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultiSVTag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultiSVTag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -13,6 +13,9 @@ #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> @@ -26,8 +29,9 @@ namespace Analysis { public: MultiSVTag(const std::string&,const std::string&,const IInterface*); - virtual ~MultiSVTag() = default; + virtual ~MultiSVTag(); virtual StatusCode initialize() override; + virtual StatusCode finalize() override; virtual StatusCode tagJet(const xAOD::Vertex& priVtx, const xAOD::Jet& jetToTag, @@ -37,19 +41,30 @@ 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 3f129d6d6220f326fd36190eadb11f6fdc94e2fe..22bdbfc75b207f1847e2fa457f4e7c5d4b679474 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultivariateTagManager.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/MultivariateTagManager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef BTAGTOOL_MULTIVARIATETAGMANAGER_C @@ -32,10 +32,12 @@ namespace Analysis { const std::string&, const IInterface*); - virtual ~MultivariateTagManager() = default; + virtual ~MultivariateTagManager(){}; virtual StatusCode initialize() override; - virtual void finalizeHistos() override {}; + virtual StatusCode finalize() 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 06686364a6bc17a3826ddc0ef3e3a5b8dc4a2a85..4fae388c94ec1b57acd5761bc27cecfc169cb06a 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/NewLikelihoodTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/NewLikelihoodTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef JETTAGTOOLS_NEWLIKELIHOODMULTIDTOOL_H @@ -11,6 +11,7 @@ ********************************************************/ #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ToolHandle.h" #include "JetTagTools/LikelihoodComponents.h" #include "JetTagCalibration/JetTagCalibCondData.h" #include <string> @@ -27,9 +28,10 @@ class NewLikelihoodTool : public AthAlgTool { public: NewLikelihoodTool(const std::string&,const std::string&,const IInterface*); - virtual ~NewLikelihoodTool() = default; + virtual ~NewLikelihoodTool(); 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 d5b7e6254c6a89c00ee91a67c0b76b7cde4f540e..d6598a8f147fcc3bbe5cc90edffea7add4539210 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVForIPTool.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVForIPTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef JetTagTools_SVForIPTool_H @@ -15,8 +15,10 @@ @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> @@ -35,14 +37,18 @@ namespace Analysis { SVForIPTool(const std::string& name, const std::string& n, const IInterface* p); - virtual ~SVForIPTool() = default; + virtual ~SVForIPTool(); + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; - /**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 31c128b08f8db1fa3971686f441d365d49c05f02..8b8a34c3e4cb3b1c7b20a9e0425c35a572509cf0 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVTag.h +++ b/PhysicsAnalysis/JetTagging/JetTagTools/JetTagTools/SVTag.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -9,15 +9,22 @@ #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/Vertex.h" - +#include "xAODTracking/TrackParticle.h" +#include "xAODTracking/TrackParticleContainer.h" #include <vector> #include <map> + +//namespace xAOD { class TrackParticle; class TrackParticleContainer; } +//namespace Trk { class RecVertex;} +//class Jet; +class StoreGateSvc; + namespace Analysis { class SVInfo; @@ -36,7 +43,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: @@ -44,7 +51,9 @@ 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; @@ -62,6 +71,11 @@ 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 d08d1fb00835eeb6a7b22f9334c5b454cd8c8747..09f99b4735fc943a5acedf339a3a5c9ffc907c09 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterVariablesFactoryConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterVariablesFactoryConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -17,7 +17,8 @@ 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 = {} + defaults = { 'JetFitterInstance' : 'JetFitterTag', + 'secVxFinderName' : 'JetFitterVxFinder' } 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 new file mode 100644 index 0000000000000000000000000000000000000000..5f6930d681be548267b444a0a5d322e15a4baa49 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetVertexChargeConfig.py @@ -0,0 +1,70 @@ +# 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 b2078c56076874e22fcc16e92142711acc4bcd11..7df05c9137e788f5a553efe95b32c32a21e304cf 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -11,6 +11,7 @@ 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 @@ -30,6 +31,7 @@ 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 d2e9f89169519b0233559e40f22e4f60a67ed925..430b48c1a487b3c352adf8edd940910bcc25180a 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/CTTDecorCheckInTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/CTTDecorCheckInTool.cxx @@ -1,9 +1,14 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 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" // @@ -16,83 +21,109 @@ CTTDecorCheckInTool::CTTDecorCheckInTool( const std::string& name, m_classifiedTrackTagger("Analysis::ClassifiedTrackTaggerTool",this), m_jetCollection("AntiKt4EMPFlowJets") { - declareProperty("ClassifiedTrackTaggerTool", m_classifiedTrackTagger); - declareProperty("JetCollection",m_jetCollection); - } - -//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()); + declareProperty("ClassifiedTrackTaggerTool", m_classifiedTrackTagger); + declareProperty("JetCollection",m_jetCollection); } - //------- - //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"); +//Destructor--------------------------------------------------------------- + CTTDecorCheckInTool::~CTTDecorCheckInTool(){ + ATH_MSG_DEBUG("ClassifiedTrackTaggerTool destructor called"); } - 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))); +//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; } - return StatusCode::SUCCESS; -} - diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/ClassifiedTrackTaggerTool.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/ClassifiedTrackTaggerTool.cxx index bab59adbf2e4dd9664596ea2baee1f5a032d04a0..7e4c9f6bfe91bae1cea9560db581b94337a14491 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/ClassifiedTrackTaggerTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/ClassifiedTrackTaggerTool.cxx @@ -1,10 +1,11 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 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" @@ -15,30 +16,39 @@ 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; + 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"); } //Initialize--------------------------------------------------------------- - StatusCode ClassifiedTrackTaggerTool::initialize(){ - //retrieve calibration file and initialize the m_trkClassBDT - std::string fullPathToFile = PathResolverFindCalibFile("BTagging/20221012track/"+m_calibFileName); + StatusCode ClassifiedTrackTaggerTool::initialize(){ + m_initialised = 0; +// + //retrieve calibration file and initialize the m_trkClassBDT + std::string fullPathToFile = PathResolverFindCalibFile("BTagging/20221012track/"+m_calibFileName); - std::string strBDTName = m_useFivePtJetBinTCT ? - "CTTtrainedWithRetrainedTCT" : "CTTtrainedWithDefaultTCT"; + + std::string strBDTName=""; + if(m_useFivePtJetBinTCT) {strBDTName="CTTtrainedWithRetrainedTCT"; } + else {strBDTName="CTTtrainedWithDefaultTCT"; } std::unique_ptr<TFile> rootFile(TFile::Open(fullPathToFile.c_str(), "READ")); if (!rootFile) { @@ -47,73 +57,71 @@ namespace Analysis { } 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 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!"); - } - - //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()); - } + + //------- + //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()); + } + - if(msgLvl(MSG::DEBUG)) ATH_CHECK(service("ChronoStatSvc", m_timingProfile)); + m_initialised = 1; // Tool is initialised successfully. //----- - return StatusCode::SUCCESS; - } + if(msgLvl(MSG::DEBUG)) ATH_CHECK(service("ChronoStatSvc", m_timingProfile)); +//----- + 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 - { - 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); } - } - } + 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); } + } + } - 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) @@ -121,42 +129,51 @@ namespace Analysis { 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 - { - 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; - } - } +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(); - std::vector<int> ClassifiedTrackTaggerTool::GetSortedIndices(std::vector<std::vector<float>> unordered_vec) const + 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++) { - //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; + 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 ce449fbcf96db0916f41f38835442621619f86fc..5a0a30338c529cb4854d309a1180b15b3501249c 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/CombinerToolTag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/CombinerToolTag.cxx @@ -23,9 +23,12 @@ #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"), @@ -34,10 +37,16 @@ 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(); @@ -49,6 +58,16 @@ 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, @@ -58,7 +77,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 72a6330987f89284dab8bf3bcd5ab3c8cbe2c6b5..cc46f57e0b3223c7c25b339ef267b7c05d68bf8a 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/DetailedTrackGradeFactory.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/DetailedTrackGradeFactory.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "JetTagTools/DetailedTrackGradeFactory.h" @@ -7,6 +7,10 @@ #include "JetTagInfo/TrackGrade.h" +#include "JetTagInfo/TrackGradesDefinition.h" + +#include "xAODTracking/TrackParticle.h" + namespace Analysis { @@ -57,6 +61,9 @@ DetailedTrackGradeFactory::DetailedTrackGradeFactory( const std::string& t, cons declareInterface<ITrackGradeFactory>( this ); } +DetailedTrackGradeFactory::~DetailedTrackGradeFactory() +{} + StatusCode DetailedTrackGradeFactory::initialize() { @@ -257,6 +264,12 @@ 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 c9b725e03933982eb965f45a7107e196168ecfdd..0466e2bb73af2a767e706717c3933b5275305217 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/IPTag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/IPTag.cxx @@ -1,10 +1,16 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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" @@ -14,15 +20,24 @@ #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 { @@ -94,14 +109,17 @@ 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); @@ -278,7 +296,9 @@ 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++) { + for(uint j=0;j<m_jetCollectionList.size();j++) { + + //int nbGrades=trackFactoryGradesDefinition.numberOfGrades(); for (std::vector<TrackGrade>::const_iterator listIter=listBegin ; listIter !=listEnd ; ++listIter ) { const TrackGrade & grd = (*listIter); @@ -338,7 +358,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 e0ae277fe5c91bbf4796ec8c2566f25f3b24df54..3ae5a181ca22b7346403023e1c0a77b706605f83 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterInputWriter.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterInputWriter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -15,10 +15,15 @@ /////////////////////////////////////////////////////////////////////////////////////////////////////// #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" @@ -38,6 +43,9 @@ 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 9941dc77c8e4f41a809930da99fcdb182d2bc772..8d95811d3d61205792e6acf8cae6e2f7b18cc1c2 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterVariablesFactory.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/JetFitterVariablesFactory.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -20,11 +20,16 @@ #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" @@ -38,10 +43,14 @@ 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); @@ -130,7 +139,7 @@ StatusCode JetFitterVariablesFactory::finalize() { const Trk::TrackParameters* myParameters=(*myPrimaryLinksIter)->parameters(); if (myParameters) { - energyFromPrimary+=std::sqrt(s_pion*s_pion+myParameters->momentum().mag2()); + energyFromPrimary+=TMath::Sqrt(s_pion*s_pion+myParameters->momentum().mag2()); } else { @@ -171,9 +180,16 @@ StatusCode JetFitterVariablesFactory::finalize() { { energyFromPrimary+= - std::sqrt(s_pion*s_pion+ - (*TracksAtPrimaryIter)->perigeeAtVertex()->momentum().mag2()); + TMath::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"); @@ -251,13 +267,13 @@ StatusCode JetFitterVariablesFactory::finalize() { clustersOfTrackIter!=clustersOfTrackEnd;++clustersOfTrackIter) { energyFromPrimary+= - std::hypot(s_pion, (*clustersOfTrackIter)->perigeeAtVertex()->momentum().mag()); + TMath::Sqrt(s_pion*s_pion+pow((*clustersOfTrackIter)->perigeeAtVertex()->momentum().mag(),2)); } } } else { if ( (nVTX>0 && vertexSize>1) || nVTX==0 ) { - dist+=std::abs(vertexPosition[ntrack])/vertexCovMatrix(ntrack,ntrack); + dist+=fabs(vertexPosition[ntrack])/vertexCovMatrix(ntrack,ntrack); if (vertexCovMatrix(ntrack,ntrack)>0) { inverrordist+=1./vertexCovMatrix(ntrack,ntrack); @@ -285,8 +301,18 @@ StatusCode JetFitterVariablesFactory::finalize() { sumP+=mytrack; if (dynamic_cast<const Trk::Perigee*>((*clustersOfTrackIter)->perigeeAtVertex())!=0) { - massThisCluster+=CLHEP::HepLorentzVector(mytrack.x(), mytrack.y(), mytrack.z(), std::hypot(s_pion, mytrack.mag())); + massThisCluster+=CLHEP::HepLorentzVector(mytrack.x(),mytrack.y(),mytrack.z(),TMath::Sqrt(s_pion*s_pion+mytrack.mag()*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. "); @@ -297,7 +323,7 @@ StatusCode JetFitterVariablesFactory::finalize() { sumPAllVertices+=sumP; double ptadd=sumP.perp(flightAxis.unit()); - double masswithneutrals=std::sqrt(massThisCluster.mag2()+ptadd*ptadd)+ptadd; + double masswithneutrals=TMath::Sqrt(massThisCluster.mag2()+ptadd*ptadd)+ptadd; if (m_useSingleTracksAlsoForMass) { @@ -314,11 +340,13 @@ StatusCode JetFitterVariablesFactory::finalize() { if (m_usePtCorrectedEnergy) { - energyFromSecondary+=std::sqrt(masswithneutrals*masswithneutrals+sumP.mag2()); + energyFromSecondary+=TMath::Sqrt(masswithneutrals*masswithneutrals+ + sumP.mag2()); } else { - energyFromSecondary+=std::sqrt(massThisCluster.mag2()+sumP.mag2()); + energyFromSecondary+=TMath::Sqrt(massThisCluster.mag2()+ + sumP.mag2()); } @@ -332,29 +360,29 @@ StatusCode JetFitterVariablesFactory::finalize() { } if (massVector.mag()>0) { - mass=std::sqrt(massVector.mag2()+sumPtAdd*sumPtAdd)+sumPtAdd; - mass_uncorr=massVector.mag(); + mass=TMath::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.*std::atan((M_PI/2./5000.)*(mass-5000.)); + 5000.+(5000./M_PI)*2.*TMath::ATan((M_PI/2./5000.)*(mass-5000.)); } if (mass_uncorr>5000.) { mass_uncorr = - 5000.+(5000./M_PI)*2.*std::atan((M_PI/2./5000.)*(mass_uncorr-5000.)); + 5000.+(5000./M_PI)*2.*TMath::ATan((M_PI/2./5000.)*(mass_uncorr-5000.)); } } if (inverrordist!=0) { - significance3d=dist/std::sqrt(inverrordist); + significance3d=dist/TMath::Sqrt(inverrordist); //port range of significance 3d to maximum 100. - significance3d=100./(M_PI/2.)*std::atan((M_PI/2./100.)*significance3d); + significance3d=100./(M_PI/2.)*TMath::ATan((M_PI/2./100.)*significance3d); } - if (std::abs(sumPAllVertices.mag())>1e-7) { + if (fabs(sumPAllVertices.mag())>1e-7) { deltaphi=sumPAllVertices.eta()-JetVector.Eta(); deltaeta=sumPAllVertices.deltaPhi(Amg::Vector3D(JetVector.Px(), JetVector.Py(), JetVector.Pz())); - deltaRFlightDir = std::hypot(sumPAllVertices.deltaPhi(flightAxis), sumPAllVertices.eta()-flightAxis.eta()); + deltaRFlightDir = TMath::Sqrt(sumPAllVertices.deltaPhi(flightAxis)*sumPAllVertices.deltaPhi(flightAxis) + (sumPAllVertices.eta()-flightAxis.eta())*(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 new file mode 100644 index 0000000000000000000000000000000000000000..dd5a7468be91ca0d1cc289b60a9b6826f27b3ca7 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/JetVertexCharge.cxx @@ -0,0 +1,892 @@ +/* + 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 74c4e36d1d59691da402fad095003405c94d9773..1280ef51383bc14b1fc230b6aadabe9608c81dde 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/MSVVariablesFactory.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/MSVVariablesFactory.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////////////////////////////////////////// @@ -12,12 +12,18 @@ /// 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" @@ -27,130 +33,137 @@ #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); } - StatusCode MSVVariablesFactory::initialize() { - ATH_MSG_DEBUG(" Initialization of MSVVariablesFactory succesfull"); - return StatusCode::SUCCESS; - } +///////////////////////////////////////////////////////////////////////////////////// +/// Destructor - check up memory allocation +/// delete any memory allocation on the heap - StatusCode MSVVariablesFactory::finalize() { - ATH_MSG_DEBUG(" Finalization of MSVVariablesFactory succesfull"); - return StatusCode::SUCCESS; - } + MSVVariablesFactory::~MSVVariablesFactory() {} - StatusCode MSVVariablesFactory::createMSVContainer - (const xAOD::Jet &myJet, const Trk::VxSecVKalVertexInfo* myVertexInfoVKal, - xAOD::VertexContainer* VertexContainer,const xAOD::Vertex& PrimaryVtx) const { +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::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.empty()){ + if(myVertices.size() == 0){ 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 (const auto& vertex : myVertexInfoVKal->vertices()){ - VertexContainer->push_back(vertex); + for (std::vector<xAOD::Vertex*>::const_iterator verticesIter=verticesBegin; verticesIter!=verticesEnd;++verticesIter) { + + xAOD::Vertex* Vertex = *verticesIter; + 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 = vertex->trackParticleLinks(); - if (myTrackLinks.empty()) { + const std::vector<ElementLink<xAOD::TrackParticleContainer> > myTrackLinks = (*verticesIter)->trackParticleLinks(); + if (myTrackLinks.size()==0) { ATH_MSG_WARNING("#BTAG# No Track Links attached to the track at the sec vertex... "); } int npsec = 0; - const std::vector<Trk::VxTrackAtVertex> myTracks=vertex->vxTrackAtVertex(); - if (!myTracks.empty()) { + const std::vector<Trk::VxTrackAtVertex> myTracks=(*verticesIter)->vxTrackAtVertex(); + if (myTracks.size()!=0) { npsec=myTracks.size(); - for (const auto& track : myTracks) { - const Trk::Perigee* perigee = dynamic_cast<const Trk::Perigee*>(track.perigeeAtVertex()); + 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()); if(perigee){ sumpx += perigee->momentum().x(); sumpy += perigee->momentum().y(); sumpz += perigee->momentum().z(); - sume += std::hypot(perigee->momentum().mag(), 139.5702); + sume +=sqrt(perigee->momentum().mag()*perigee->momentum().mag() + 139.5702*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(vertex); + vecVtxHolder.push_back(*verticesIter); - 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, jet_V3); + localdistnrm=get3DSignificance(priVtx, vecVtxHolder, Amg::Vector3D(myJet.p4().Px(),myJet.p4().Py(),myJet.p4().Pz())); } 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 { - - Amg::Vector3D jet_V3(myJet.p4().Px(), myJet.p4().Py(), myJet.p4().Pz()); + 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 { + //... 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.empty()){ + if(myVertices.size() == 0){ ATH_MSG_DEBUG("#BTAG# no MSV vertices...fill default values only... "); BTag->setVariable<int>(basename, "N2Tpair", n2t); BTag->setVariable<float>(basename, "energyTrkInJet", jetenergy); @@ -158,17 +171,20 @@ namespace Analysis { 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(); @@ -176,61 +192,65 @@ namespace Analysis { BTag->setVariable<float>(basename, "energyTrkInJet", jetenergy); std::vector<const xAOD::Vertex*> vecVertices; - for (const auto& vertex : myVertexInfoVKal->vertices()) { - VertexContainer->push_back(vertex); + for (std::vector<xAOD::Vertex*>::const_iterator verticesIter=verticesBegin; verticesIter!=verticesEnd;++verticesIter) { + + xAOD::Vertex* Vertex = *verticesIter; + VertexContainer->push_back(Vertex); //additional info per vertex - vecVertices.push_back(vertex); + vecVertices.push_back(*verticesIter); double sumpx = 0.0; double sumpy = 0.0; double sumpz = 0.0; double sume = 0.0; - const std::vector<ElementLink<xAOD::TrackParticleContainer> > myTrackLinks = vertex->trackParticleLinks(); - if (myTrackLinks.empty()) { + const std::vector<ElementLink<xAOD::TrackParticleContainer> > myTrackLinks = (*verticesIter)->trackParticleLinks(); + if (myTrackLinks.size()==0) { ATH_MSG_WARNING("#BTAG# No Track Links attached to the track at the sec vertex... "); } int npsec = 0; - const std::vector<Trk::VxTrackAtVertex> myTracks=vertex->vxTrackAtVertex(); - if (!myTracks.empty()) { + const std::vector<Trk::VxTrackAtVertex> myTracks=(*verticesIter)->vxTrackAtVertex(); + if (myTracks.size()!=0) { npsec=myTracks.size(); - for (const auto& track : myTracks) { - const Trk::Perigee* perigee = dynamic_cast<const Trk::Perigee*>(track.perigeeAtVertex()); + 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()); if(perigee){ sumpx += perigee->momentum().x(); sumpy += perigee->momentum().y(); sumpz += perigee->momentum().z(); - sume += std::hypot(perigee->momentum().mag(), 139.5702); + sume +=sqrt(perigee->momentum().mag()*perigee->momentum().mag() + 139.5702*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(vertex); + vecVtxHolder.push_back(*verticesIter); - 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, jet_V3); + localdistnrm=get3DSignificance(priVtx, vecVtxHolder, Amg::Vector3D(myJet.p4().Px(),myJet.p4().Py(),myJet.p4().Pz())); } 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 @@ -238,7 +258,7 @@ namespace Analysis { BTag->setDynVxELName(basename, "vertices"); if (priVtx) { - distnrm = get3DSignificance(priVtx, vecVertices, jet_V3); + distnrm=get3DSignificance(priVtx, vecVertices, Amg::Vector3D(myJet.p4().Px(),myJet.p4().Py(),myJet.p4().Pz())); } else { ATH_MSG_WARNING("#BTAG# Tagging requested, but no primary vertex supplied."); distnrm=0.; @@ -247,38 +267,42 @@ namespace Analysis { 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(); - for (const auto& vertex : secVertex) { - positions.push_back(vertex->position()); - weightMatrices.push_back(vertex->covariancePosition().inverse()); - weightTimesPosition += weightMatrices.back() * positions.back(); - sumWeights += weightMatrices.back(); + 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; } - 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(); @@ -291,11 +315,11 @@ namespace Analysis { 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; @@ -304,6 +328,7 @@ namespace Analysis { return decaylength_significance; + } }//end Analysis namespace diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/MV2Tag.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/MV2Tag.cxx index c535eec838557b4a3dafc4e09cb631ee9f63b078..9f5f50ebd32723a504c680d5897a13dbd1b6a4f8 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/MV2Tag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/MV2Tag.cxx @@ -1,10 +1,14 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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> @@ -12,13 +16,19 @@ #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; @@ -37,15 +47,18 @@ namespace Analysis { // force MV2 to always use a calibration derived from MV2CalibAlias jet collection declareProperty("forceMV2CalibrationAlias", m_forceMV2CalibrationAlias = true); - declareProperty("MV2CalibAlias", m_MV2CalibAlias = "AntiKt4EMTopo"); + declareProperty("MV2CalibAlias", m_MV2CalibAlias = "AntiKt4TopoEM"); // 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 ); @@ -54,11 +67,17 @@ namespace Analysis { } + MV2Tag::~MV2Tag() { + + } + + StatusCode MV2Tag::initialize() { m_disableAlgo=false; m_warnCounter=0; + m_treeName = "BDT"; m_varStrName = "variables"; // prepare readKey for calibration data: @@ -68,10 +87,16 @@ 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 92d549a87f4c8af8cf21488958d16ed3bacb5112..4d41247ace14ed278b52fd8905c106ec56bb5ab9 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/MultiSVTag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/MultiSVTag.cxx @@ -1,18 +1,29 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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/TrackParticleContainer.h" +#include "xAODTracking/TrackParticle.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> @@ -34,14 +45,26 @@ 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: @@ -49,6 +72,10 @@ 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, @@ -123,23 +150,24 @@ 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.empty()){ - for(const auto& vtx : msvVertices){ + 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.size()>=10) continue; - 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(); + 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(); 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 = (*vtx)->trackParticleLinks(); + const std::vector<ElementLink<xAOD::TrackParticleContainer> > svTrackLinks = (**vtxIter)->trackParticleLinks(); if(svTrackLinks.size()>1){ nvtx2trk++; } @@ -168,11 +196,10 @@ 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.empty() && 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.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; } vars.m_diffntrkSV0 = vars.m_diffntrkSV1; @@ -234,7 +261,8 @@ namespace Analysis // distances: max mass vertex to PV, and mx2 to max vertex: if(ivm1>=0&&ivm2>=0) { - vars.m_mx12_2d12 = std::hypot( v_vtxx[ivm2] - v_vtxx[ivm1], v_vtxy[ivm2] - v_vtxy[ivm1] ); + 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_DR = sv1p3.DeltaR(sv2p3); vars.m_mx12_Angle = sv1p3.Angle(sv2p3); @@ -285,28 +313,28 @@ namespace Analysis bool &badVariableFound, std::vector<float*> &inputPointers) { - 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++; } + 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++; } else { - 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; + 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; badVariableFound=true; } } diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/MultivariateTagManager.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/MultivariateTagManager.cxx index 3b88ccb258a14fca3bc6f0e7acfe7488f5e88397..fb58bfef5784e964cd4d6549955f8bf04cb414d2 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/MultivariateTagManager.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/MultivariateTagManager.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////////////////// @@ -14,9 +14,14 @@ /// ///////////////////////////////////////////////////////////////////////////// +#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> @@ -56,8 +61,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() ) { @@ -81,6 +86,12 @@ 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 @@ -142,16 +153,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; } @@ -166,20 +177,21 @@ 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") ? std::abs(BTag.auxdata<float>("trkSum_VEta")) : NAN; + trkSum_vAbsEta= BTag.isAvailable<float>("trkSum_VEta") ? fabs(BTag.auxdata<float>("trkSum_VEta")) : NAN; } inputs[btagvar::TRKSUM_NTRK] = trkSum_ntrk; @@ -187,6 +199,7 @@ 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 { @@ -205,8 +218,7 @@ 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) { @@ -217,35 +229,32 @@ 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.empty() && jf_vertices[0].isValid() && - (jf_nvtx_tmp > 0 || jf_nvtx1t_tmp > 0)) jfitter_ok = true; + if(jf_vertices.size()>0 && 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); @@ -286,7 +295,9 @@ namespace Analysis { std::vector<float> weightBofTracksIP2D; BTag.variable<std::vector<float> >(m_ip2d_infosource, "weightBofTracks", weightBofTracksIP2D); - if(!weightBofTracksIP2D.empty()) { + int ntrk_ip2 = weightBofTracksIP2D.size(); + + if(ntrk_ip2>0) { if( m_ip2d_infosource == "IP2D" ) { ip2d_pb = BTag.IP2D_pb(); @@ -351,7 +362,8 @@ namespace Analysis { std::vector<float> weightBofTracksIP3D; BTag.variable<std::vector<float> >(m_ip3d_infosource, "weightBofTracks", weightBofTracksIP3D); - if(!weightBofTracksIP3D.empty()) { + int ntrk_ip3= weightBofTracksIP3D.size(); + if(ntrk_ip3>0) { if( m_ip3d_infosource == "IP3D" ) { ip3d_pb = BTag.IP3D_pb(); ip3d_pc = BTag.IP3D_pc(); @@ -417,23 +429,25 @@ 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.empty() && myVertices_SV0[0].isValid() ) { + if ( myVertices_SV0.size() > 0 && 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_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); } 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, "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, "significance3D", sv0_sig3d); @@ -472,7 +486,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.empty() && myVertices_SV1[0].isValid() ) { + if ( myVertices_SV1.size() > 0 && myVertices_SV1[0].isValid() ) { // if we found a vertex, then sv1 is okay to use sv1_ok = true; } @@ -547,7 +561,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 0bbcf09695e80bfffae019ee27c1124ca832413b..5baf6d9e333e6a78a0015cd38b27094967fa065b 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/NewLikelihoodTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/NewLikelihoodTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #include "JetTagTools/NewLikelihoodTool.h" @@ -42,8 +42,16 @@ 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; } @@ -53,10 +61,10 @@ namespace Analysis { void NewLikelihoodTool::printStatus() const { msg(MSG::INFO) << "#BTAG# - hypotheses : "; - for(const auto& hypo : m_hypotheses) msg(MSG::INFO) << hypo << ", "; + for(unsigned int ih=0;ih<m_hypotheses.size();ih++) msg(MSG::INFO) << m_hypotheses[ih] << ", "; msg(MSG::INFO) << endmsg; msg(MSG::INFO) << "#BTAG# - histograms : " << endmsg; - for(const auto& histo : m_histograms) msg(MSG::INFO) << histo << endmsg; + for(unsigned int ih=0;ih<m_histograms.size();ih++) msg(MSG::INFO) << m_histograms[ih] << endmsg; } std::vector<std::string> NewLikelihoodTool::gradeList(const std::string& histoName) const { @@ -161,8 +169,8 @@ namespace Analysis { if(norm) { // check if smoothing of histogram is not vetoed: bool veto = false; - for(const auto& v : m_vetoSmoothingOf) { - if(hname.find(v)!=std::string::npos) { + for(unsigned int iv=0; iv<m_vetoSmoothingOf.size(); iv++) { + if(hname.find(m_vetoSmoothingOf[iv])!=std::string::npos) { veto = true; ATH_MSG_VERBOSE("#BTAG# Smoothing of " << hname << " is vetoed !"); break; @@ -200,12 +208,10 @@ 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)); } @@ -231,30 +237,32 @@ namespace Analysis { } ATH_MSG_VERBOSE("#BTAG# -- lhVarVal size= " << lhVariableValues.size()); // loop on Tracks in the Jet (IP) / Vertices in the Jet (SV) - for (const auto& value : lhVariableValues) { - ATH_MSG_VERBOSE( "#BTAG# -- element " << value.name ); - int ncompo = value.composites.size(); - ATH_MSG_VERBOSE( "#BTAG# -- element " << value.name + 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 << " 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 (const auto& compo : value.composites) { + for (int icompo = 0;icompo<ncompo;icompo++) { double sum(0.); std::vector<double> tmpVector; - std::string histName = compo.name; - int idim = compo.atoms.size(); - ATH_MSG_VERBOSE( "#BTAG# -- composite histo= " + std::string histName = lhVariableValues[iel].composites[icompo].name; + int idim = lhVariableValues[iel].composites[icompo].atoms.size(); + ATH_MSG_VERBOSE( "#BTAG# -- composite " << icompo << " histo= " << histName << " dim= " << idim ); - for (const auto& hypo : m_hypotheses) { - TH1* tmpHisto = this->prepareHistogram(hypo,histName); + for (unsigned int ihyp = 0 ; ihyp < m_hypotheses.size(); ++ihyp) { + TH1* tmpHisto = this->prepareHistogram(m_hypotheses[ihyp],histName); if(tmpHisto) { if(1==idim) { - double valuex = compo.atoms[0].value; + double valuex = lhVariableValues[iel].composites[icompo].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= " << hypo + if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "#BTAG# For hypothesis= " << m_hypotheses[ihyp] << " (1D) actual value= " << valuex << " --> bin= " << binx << " f = " << tmp; if(m_interpolate) { @@ -280,8 +288,8 @@ namespace Analysis { sum += tmp; } if(2==idim) { - double valuex = compo.atoms[0].value; - double valuey = compo.atoms[1].value; + double valuex = lhVariableValues[iel].composites[icompo].atoms[0].value; + double valuey = lhVariableValues[iel].composites[icompo].atoms[1].value; int binx = (tmpHisto->GetXaxis())->FindBin(valuex); int biny = (tmpHisto->GetYaxis())->FindBin(valuey); if(valuex >= tmpHisto->GetXaxis()->GetXmax()) binx = tmpHisto->GetXaxis()->GetNbins(); @@ -289,7 +297,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= " << hypo + if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "#BTAG# For hypothesis= " << m_hypotheses[ihyp] << " (2D) actual value= " << valuex << " " << valuey << " --> bin= " << binx << " " << biny << " f = " << tmp; if(m_interpolate) { @@ -316,9 +324,9 @@ namespace Analysis { sum += tmp; } if(3==idim) { - double valuex = compo.atoms[0].value; - double valuey = compo.atoms[1].value; - double valuez = compo.atoms[2].value; + 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; int binx = (tmpHisto->GetXaxis())->FindBin(valuex); int biny = (tmpHisto->GetYaxis())->FindBin(valuey); int binz = (tmpHisto->GetZaxis())->FindBin(valuez); @@ -329,7 +337,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= " << hypo + if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "#BTAG# For hypothesis= " << m_hypotheses[ihyp] << " (3D) actual value= " << valuex << " " << valuey << " " << valuez << " --> bin= " << binx << " " << biny @@ -364,10 +372,11 @@ namespace Analysis { } } // endloop on hypotheses (B,U,C..) unsigned int classCount(0); - for (const auto& f : tmpVector) { + for( std::vector<double>::iterator itr3 = tmpVector.begin(); + itr3 != tmpVector.end(); ++itr3 ) { if(sum != 0.) { if( msgLvl(MSG::DEBUG) ) msg(MSG::DEBUG) << "#BTAG# sum of pX = " << sum << endmsg; - double p = f; + double p = (*itr3); 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 8cf2a2521ae2593fb8c9ce90cab4e59be8f488d8..3f456bd2cd7ab61e413a978f97273feca9283c78 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/SVForIPTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/SVForIPTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "JetTagTools/SVForIPTool.h" @@ -16,6 +16,20 @@ 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, @@ -25,30 +39,40 @@ namespace Analysis { std::vector< ElementLink< xAOD::VertexContainer > > myVertices; BTag->variable<std::vector<ElementLink<xAOD::VertexContainer> > >(secVxFinderName, "vertices", myVertices); - if (myVertices.empty()) { + if (myVertices.size() == 0) { 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 (const auto& link : TrkFromV0_ELs) { - if (link.isValid()) TrkFromV0.push_back(*link); - } + + for (std::vector<ElementLink<xAOD::TrackParticleContainer> >::iterator itr=TrkFromV0_ELs.begin();itr!=TrkFromV0_ELs.end();++itr) + { + if (itr->isValid()) + { + TrkFromV0.push_back((**itr)); + } + } } }//end namespace diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/src/SVTag.cxx b/PhysicsAnalysis/JetTagging/JetTagTools/src/SVTag.cxx index de328422a46279b29539b79312f097a9f90ae734..cc7cbde3c31ae404351276cf48e94cf7b2c52640 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/src/SVTag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagTools/src/SVTag.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -7,12 +7,16 @@ ***************************************************************************/ #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> @@ -35,7 +39,9 @@ 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"); @@ -96,18 +102,19 @@ 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(const auto& jetColl : m_jetCollectionList) { + for(uint ijc=0;ijc<m_jetCollectionList.size();ijc++) { + for(uint ih=0;ih<m_hypotheses.size();ih++) { // SV1 if (m_SVmode == "SV1") { - std::string hDir = "/RefFile/SV1/"+jetColl+"/"+m_hypotheses[ih]+"/"; + std::string hDir = "/RefFile/SV1/"+m_jetCollectionList[ijc]+"/"+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/"+jetColl+"/"+m_hypotheses[ih]+"/"; + std::string hDir = "/RefFile/SV2/"+m_jetCollectionList[ijc]+"/"+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.); @@ -115,7 +122,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/"+jetColl+"/controlSV/"; + hDir = "/RefFile/SV2/"+m_jetCollectionList[ijc]+"/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.); @@ -168,14 +175,13 @@ 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 (std::abs(jeteta) <= 2.5) { + if (fabs(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); @@ -184,7 +190,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.; @@ -193,8 +199,9 @@ 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.empty()) { + if (myVertices.size()>0) { status &= BTag.variable<float>(m_secVxFinderName, "masssvx", ambtot);// mass in MeV ambtot/=m_c_mom; @@ -208,9 +215,11 @@ 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(), @@ -223,26 +232,30 @@ 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 = std::hypot(PvSvDir(0,0), PvSvDir(1,0)); - L3d = std::hypot(PvSvDir(0,0), PvSvDir(1,0), PvSvDir(2,0)); + 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)); }else{ ATH_MSG_VERBOSE("#BTAG# No secondary vertex."); } std::vector<const xAOD::Vertex*> vecVertices; - for (const auto& link : myVertices) { - if (!link.isValid()) { - ATH_MSG_WARNING("#BTAG# Secondary vertex from InDetVKalVxInJetFinder has zero pointer. Skipping... "); + 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... "); continue; - } - vecVertices.push_back(*link); + } + vecVertices.push_back(**verticesIter); } if (myVertices[0].isValid()) { const xAOD::Vertex* myVert = *myVertices[0]; - distnrm = get3DSignificance(priVtx, vecVertices, jetDir); + distnrm=get3DSignificance(priVtx, vecVertices, + Amg::Vector3D(jetToTag.p4().Px(),jetToTag.p4().Py(),jetToTag.p4().Pz())); ATH_MSG_VERBOSE("#BTAG# SVX x = " << myVert->position().x() << " y = " << myVert->position().y() << " z = " << myVert->position().z()); - distnrmCorr = get3DSignificanceCorr(priVtx, vecVertices, jetDir); + distnrmCorr=get3DSignificanceCorr(priVtx, vecVertices, + Amg::Vector3D(jetToTag.p4().Px(),jetToTag.p4().Py(),jetToTag.p4().Pz())); } else { ATH_MSG_VERBOSE("#BTAG# No vertex. Cannot calculate normalized distance."); distnrm=0.; @@ -268,8 +281,7 @@ 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") { @@ -307,14 +319,12 @@ 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 && std::abs(jeteta) <= 2.5) { + if (jetpt >= m_pTjetmin && fabs(jeteta) <= 2.5) { int label = xAOD::jetFlavourLabel(&jetToTag); double deltaRtoClosestB = 999.;//, deltaRtoClosestC = 999.; if (jetToTag.getAttribute("TruthLabelDeltaR_B",deltaRtoClosestB)) { @@ -340,9 +350,10 @@ 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.) { @@ -355,8 +366,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)); } } } @@ -463,6 +474,9 @@ 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."); @@ -473,34 +487,65 @@ 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(); - for (const auto& vtx : secVertex) { - positions.push_back(vtx->position()); - weightMatrices.push_back(vtx->covariancePosition().inverse()); - weightTimesPosition += weightMatrices.back()*positions.back(); - sumWeights += weightMatrices.back(); + 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; } // 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 @@ -515,19 +560,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.; @@ -548,23 +593,26 @@ namespace Analysis bool success=true; AmgSymMatrix(3) Wgt; - for (const auto & svrt : secVertex) + for (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 4873973e3501579e7d5163c7b7b000d7c52e33e8..4380a94788b36f256682c45f32f8e904e336dae0 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 && HepMC::is_same_generator_particle(itrDaug,thePart)) || + if (((itrDaug &&thePart && 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 48b8813634ff88f1add7873ae2d589b039a48beb..864c4b76e8444511e92625dce3d43426e91aeb27 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/CommonEfficiencyTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // Framework include(s): @@ -81,6 +81,8 @@ 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 = "" ); @@ -157,6 +159,21 @@ 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) { @@ -280,6 +297,21 @@ 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 f1b71f33d2eb7deae5aff165113366dd93b706d7..06bb8f4085e53df393454d2ddfb9810099501632 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauEfficiencyCorrectionsTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauEfficiencyCorrectionsTool.cxx @@ -1,6 +1,6 @@ /** * - * @copyright Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + * @copyright Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration * * @file DiTauEfficiencyCorrectionsTool.cxx * @brief Class for ditau efficiency correction scale factors and uncertainties @@ -29,7 +29,9 @@ 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 ); @@ -109,7 +111,8 @@ void DiTauEfficiencyCorrectionsTool::printConfig() const for (auto iEfficiencyCorrectionType : m_vEfficiencyCorrectionTypes) { ATH_MSG_DEBUG( " EfficiencyCorrectionTypes " << iEfficiencyCorrectionType ); } - ATH_MSG_DEBUG( " InputFilePathJetIDHadTau " << m_sInputFilePathJetIDHadTau ); + ATH_MSG_DEBUG( " InputFilePathRecoHadTau " << m_sInputFilePathRecoHadTau ); + ATH_MSG_DEBUG( " VarNameRecoHadTau " << m_sVarNameRecoHadTau ); 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 34880102376e55f1590f49f321d414877d930b95..085eed7887d2e9ae0fdf00598c0f0bf3f14fcb28 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/DiTauTruthMatchingTool.cxx @@ -65,7 +65,16 @@ void DiTauTruthMatchingTool::getTruth(const xAOD::DiTauJet& xDiTau) } //______________________________________________________________________________ -void DiTauTruthMatchingTool::getTruth(const std::vector<const xAOD::DiTauJet*>& vDiTaus) +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) { for (auto xDiTau : vDiTaus) getTruth(*xDiTau); diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx index c18b575266def9e787e80b467b3515508216983d..98ab118f78ded7eb3f55772ea933a0e86c114390 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/TauTruthMatchingTool.cxx @@ -106,7 +106,15 @@ const xAOD::TruthParticle* TauTruthMatchingTool::getTruth(const xAOD::TauJet& xT } //______________________________________________________________________________ -std::vector<const xAOD::TruthParticle*> TauTruthMatchingTool::getTruth(const std::vector<const xAOD::TauJet*>& vTaus) +// 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*> vTruths; for (auto xTau : vTaus) @@ -151,6 +159,48 @@ 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 ef1d590e5c967da844a5a3c6704d3dd78739fd9f..901510d2868303565c7f278f7af189d1c5690a01 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/CommonEfficiencyTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef TAUANALYSISTOOLS_COMMONEFFICIENCYTOOL_H @@ -151,6 +151,8 @@ 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 c7dd7eebb4f2542a7629cb0a27d747859c783908..36baa8fcbdbbe17ab891a5eeb56f97d02bb45fec 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauEfficiencyCorrectionsTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauEfficiencyCorrectionsTool.h @@ -1,6 +1,6 @@ /** * - * @copyright Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + * @copyright Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration * * @file DiTauEfficiencyCorrectionsTool.h * @author Guillermo Hamity (ghamity@cern.ch) @@ -112,7 +112,9 @@ 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 f8983ff44bfde663d211d4e83debbb34e0761612..dcea908b75d4e2473be61de16f5b7d27264c5345 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/DiTauTruthMatchingTool.h @@ -45,7 +45,11 @@ public: // Interface functions * if no truth particle was found a null pointer is returned */ virtual void getTruth(const xAOD::DiTauJet& xDiTau); - virtual void getTruth(const std::vector<const xAOD::DiTauJet*>& vDiTaus); + /** 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); private: // private helper functions diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h index ff8634e5f83315a4ed31fa835bef8a01859333b3..aff089373f24cb021465d70e643279d9af53c666 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h @@ -43,10 +43,14 @@ 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 a6fcc6a33b9c2170d69929cf814fc8db3c3128ef..ef645b3e46776223cc098f5b8e1638eb323f90f9 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h @@ -39,18 +39,27 @@ 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 b38a236d9df5e6c3a48d37a54b217acfbeb36c0c..f0275ee065b7b80511e7b3ae1e5dd87850aa93cb 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/TauTruthMatchingTool.h @@ -42,7 +42,12 @@ 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; - virtual std::vector<const xAOD::TruthParticle*> getTruth(const std::vector<const xAOD::TauJet*>& vTaus) 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; public: // Wrapper functions @@ -50,6 +55,10 @@ 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 071aa062b52893e05b16c58fcdb6bb448ea38647..a4ec13398e229b1c7fc5d63660aab980427279be 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::getTruth(const xAOD::DiTauJet& xDiTau); - void DiTauTruthMatchingTool::getTruth(const std::vector<const xAOD::DiTauJet*>& vDiTaus); + void DiTauTruthMatchingTool::applyTruthMatch(const xAOD::DiTauJet& xDiTau); + void DiTauTruthMatchingTool::applyTruthMatch(const std::vector<const xAOD::DiTauJet*>& vDiTaus); ------------------ @@ -92,7 +92,7 @@ Tool configuration Output ------ -Calling getTruth(xDiTau) adds a vector of element links to the truth lepton +Calling applyTruthMatch(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 getTruth(xDiTau) those information can be retrieved via:: +After calling applyTruthMatch(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 2fbdb8253162b3af55d3c2c08cdcae0d4b5e19ea..1f0bdeae1029a2afc6284a3377541acae9057bdd 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauTruthMatchingTool.rst +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/doc/README-TauTruthMatchingTool.rst @@ -52,16 +52,17 @@ 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 this -function:: +The truth matching is done for a single xAOD tau object with one of these +functions:: + 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::getTruth(const std::vector<const xAOD::TauJet*>& vTaus) + std::vector<xAOD::TruthParticle*> TauTruthMatchingTool::applyTruthMatch(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 @@ -117,7 +118,7 @@ Tool configuration Output ------ -Calling getTruth(xTau) adds a link to the truth lepton +Calling applyTruthMatch(xTau) or 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 @@ -170,6 +171,10 @@ 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 @@ -221,7 +226,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 and invisible +* functions returning the TLorentzVector of the visible, invisible and prompt components:: virtual TLorentzVector getTruthTauP4Vis(const xAOD::TauJet& xTau) const; @@ -230,6 +235,9 @@ 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 --- @@ -250,6 +258,12 @@ 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 23de5a25d6a2a4f15b59ef07e401056eab719f5e..43ea9b048d39f20c3b7423827976dfa587f8cd09 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/scripts/MakeQuarkGluonFractionPlots.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +// Copyright (C) 2002-2022 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(const std::map<std::string, TH2D*> & histos, const std::string& psfilename){ +void MakeQuarkGluonFractionPlots::drawhistos(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(const std::map<std::string, TH2D*> } } // Draw histograms from a vector -void MakeQuarkGluonFractionPlots::drawhistos(const std::vector<TH2D*> & histos, const std::string& psfilename){ +void MakeQuarkGluonFractionPlots::drawhistos(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, - 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){ + 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){ //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 (const std::vector<TH2D*> & h_nom, std::vector<TH2D*> h_var, double scale, const std::string& prehistname){ +std::vector<TH2D*> MakeQuarkGluonFractionPlots::getDelta (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 (const std::vector<TH2D } //Evaluate uncertainty -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*> 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*> 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 3fb80c6ebd18eb02a70bf5729472450dc8d76009..1994011fb924cc1c19551ec3bf68c3b629910336 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(const std::map<std::string, TH2D*> & histos, const std::string& psfilename); + void drawhistos(std::map<std::string, TH2D*> histos, const std::string& psfilename); //function to draw histograms from a vector - void drawhistos(const std::vector<TH2D*> & histos, const std::string& psfilename); + void drawhistos(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 (const std::vector<TH2D*> & h_nom, std::vector<TH2D*> h_var, double scale, const std::string& prehistname); + std::vector<TH2D*> getDelta (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(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*> 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); @@ -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,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); + 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); }; diff --git a/Reconstruction/DiTauRec/DiTauRec/CellFinder.h b/Reconstruction/DiTauRec/DiTauRec/CellFinder.h index 0c4e5834269d41d21170865ad04806e4d610f167..5422f0837f15ee42aa7806fddc804bead86b4efc 100644 --- a/Reconstruction/DiTauRec/DiTauRec/CellFinder.h +++ b/Reconstruction/DiTauRec/DiTauRec/CellFinder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 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 bac1539f8ac0e3d5019426ae5d873b9dba2bb9a8..d7a4df235aed0c7f11e0e7a1fd43780a2299ca9d 100644 --- a/Reconstruction/DiTauRec/DiTauRec/DiTauTrackFinder.h +++ b/Reconstruction/DiTauRec/DiTauRec/DiTauTrackFinder.h @@ -67,6 +67,7 @@ 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 bf5fd6818014f6a34337b2e8f8f1350e68b18ce0..643bc1c0cbf80badfd2243a187da3f43979c7c7b 100644 --- a/Reconstruction/DiTauRec/DiTauRec/SubjetBuilder.h +++ b/Reconstruction/DiTauRec/DiTauRec/SubjetBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef DITAUREC_SUBJETBUILDER_H @@ -33,8 +33,11 @@ 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 91bad90ed3c85852c2158a1e68ea7aa433e90da0..573e8023b32cffa936cf54f26e9a2c4e3236cbe5 100644 --- a/Reconstruction/DiTauRec/python/DiTauToolsConfig.py +++ b/Reconstruction/DiTauRec/python/DiTauToolsConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -15,6 +15,7 @@ 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 cb4f65739c673c486e0e211b1969af7077fe29f4..d89d0bb90f7149c4ac6e35579cfde25b80a33ca7 100644 --- a/Reconstruction/DiTauRec/src/CellFinder.cxx +++ b/Reconstruction/DiTauRec/src/CellFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ @@ -14,6 +14,9 @@ #include "fastjet/PseudoJet.hh" +#include "tauRecTools/KineUtils.h" + + CellFinder::CellFinder(const std::string& type, const std::string& name, const IInterface * parent) : @@ -85,14 +88,11 @@ 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) { - 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) { + dR = Tau1P3PKineUtils::deltaR(subjet.eta(), subjet.phi_std(), cc->eta(), cc->phi()); + if (dR < m_Rsubjet) { subjetCells.push_back(cc); } } diff --git a/Reconstruction/DiTauRec/src/DiTauTrackFinder.cxx b/Reconstruction/DiTauRec/src/DiTauTrackFinder.cxx index 7a3c70cda453174f6a3ce06094fb6e6813c885f5..d999b7b8b468331a1c2a06bba868d048eac8f615 100644 --- a/Reconstruction/DiTauRec/src/DiTauTrackFinder.cxx +++ b/Reconstruction/DiTauRec/src/DiTauTrackFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "DiTauRec/DiTauTrackFinder.h" @@ -13,6 +13,7 @@ #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" #include "tauRecTools/TrackSort.h" +#include "tauRecTools/KineUtils.h" #include "StoreGate/ReadHandle.h" #include "fastjet/PseudoJet.hh" @@ -25,11 +26,13 @@ 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); } @@ -83,19 +86,15 @@ StatusCode DiTauTrackFinder::execute(DiTauCandidateData * data, // drop subjets without good tracks std::vector<fastjet::PseudoJet> vSubjets = data->subjets; - int nTracks; + double nTracks; + double dR; 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) { - if ( temp_p4.DeltaR(track->p4()) < m_MaxDrSubjet) nTracks++; + dR = Tau1P3PKineUtils::deltaR(subjet_itr->eta(), subjet_itr->phi_std(), track->eta(), track->phi()); + if (dR < 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 @@ -174,21 +173,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 ( pDiTau->p4().DeltaR(track->p4()) > m_MaxDrJet) return OutsideTrack; + if (dRJet > 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) { - - TLorentzVector temp_p4; - temp_p4.SetPtEtaPhiM(subjet.pt(), subjet.eta(), subjet.phi_std(), subjet.m()); - - if (temp_p4.DeltaR(track->p4()) < m_MaxDrSubjet) + dR = Tau1P3PKineUtils::deltaR(subjet.eta(), subjet.phi_std(), track->eta(), track->phi()); + if (dR < m_MaxDrSubjet) return DiTauSubjetTrack; } diff --git a/Reconstruction/DiTauRec/src/ElMuFinder.cxx b/Reconstruction/DiTauRec/src/ElMuFinder.cxx index 893da8ab5bb953d0182e33459a0007b2fa0649bf..62736518873d53bdbc57d7b5a335948093babc29 100644 --- a/Reconstruction/DiTauRec/src/ElMuFinder.cxx +++ b/Reconstruction/DiTauRec/src/ElMuFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "DiTauRec/ElMuFinder.h" @@ -10,6 +10,8 @@ #include "xAODEgamma/ElectronContainer.h" #include "xAODMuon/MuonContainer.h" +#include "tauRecTools/KineUtils.h" + #include "StoreGate/ReadHandle.h" @@ -60,6 +62,7 @@ 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 ) { @@ -74,7 +77,8 @@ StatusCode ElMuFinder::execute(DiTauCandidateData * data, ATH_MSG_DEBUG("Electron passes basic kinematic selection"); // electron inside seed jet area? - if (data->seed->p4().DeltaR(el->p4()) > data->Rjet) + dR = Tau1P3PKineUtils::deltaR(data->seed->eta(), data->seed->phi(), el->eta(), el->phi()); + if (dR > data->Rjet) continue; data->electrons.push_back(el); @@ -95,9 +99,9 @@ StatusCode ElMuFinder::execute(DiTauCandidateData * data, if (muonQuality >= m_muQual && std::abs(mu->eta()) >= m_muMaxEta) continue; // muon inside seed jet area? - if (data->seed->p4().DeltaR(mu->p4()) > data->Rjet) + dR = Tau1P3PKineUtils::deltaR(data->seed->eta(), data->seed->phi(), mu->eta(), mu->phi()); + if (dR > 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 a311037b08e5c8150ecaf5f53c6e211f324d7986..28292099135f5a45cf9bf0ff1d72f9be9eb0158d 100644 --- a/Reconstruction/DiTauRec/src/IDvarCalculator.cxx +++ b/Reconstruction/DiTauRec/src/IDvarCalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "DiTauRec/IDVarCalculator.h" @@ -7,6 +7,8 @@ #include "DiTauRec/DiTauCandidateData.h" #include "fastjet/PseudoJet.hh" +#include "tauRecTools/KineUtils.h" + IDVarCalculator::IDVarCalculator(const std::string& type, const std::string& name, @@ -77,25 +79,22 @@ 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) { - - TLorentzVector temp_cc_p4; - temp_cc_p4.SetPtEtaPhiM(cc->pt(), cc->eta(), cc->phi(), cc->m()); + dR = Tau1P3PKineUtils::deltaR(subjet.eta(), subjet.phi_std(), cc->eta(), cc->phi()); - if (temp_cc_p4.DeltaR(temp_sub_p4) < data->Rsubjet) { + if (dR < Rsubjet) { ptAll += cc->pt(); } - - if (temp_cc_p4.DeltaR(temp_sub_p4) < data->Rcore) { + if (dR < Rcore) { ptCore += cc->pt(); } } @@ -105,7 +104,6 @@ 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 ac86a1e94bd5bbc1210537f2a672bc5286084d39..69de4de440018307fa9faccbcf4b3c2317a36ea4 100644 --- a/Reconstruction/DiTauRec/src/SubjetBuilder.cxx +++ b/Reconstruction/DiTauRec/src/SubjetBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "DiTauRec/SubjetBuilder.h" @@ -25,10 +25,12 @@ 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); } @@ -38,6 +40,8 @@ SubjetBuilder::~SubjetBuilder() = default; StatusCode SubjetBuilder::initialize() { + // m_SubjetFilter = fastjet::Filter(m_Rsubjet, fastjet::SelectorNHardest(m_Nsubjet)); + return StatusCode::SUCCESS; } @@ -74,10 +78,12 @@ StatusCode SubjetBuilder::execute(DiTauCandidateData * data, std::vector<PseudoJet> vpjClusters; for (const auto *cl: vConst) { - - 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()); + 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); vpjClusters.push_back(c); } diff --git a/Reconstruction/HeavyIonRec/HIGlobal/python/HIGlobalConfig.py b/Reconstruction/HeavyIonRec/HIGlobal/python/HIGlobalConfig.py index 53a1e0bac472f41b9348e40120e5d0306ddf972d..ae0895b1883f79af5e0d7c297cd2263913a1adc1 100644 --- a/Reconstruction/HeavyIonRec/HIGlobal/python/HIGlobalConfig.py +++ b/Reconstruction/HeavyIonRec/HIGlobal/python/HIGlobalConfig.py @@ -101,7 +101,6 @@ 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 8da7f26fd030d92258ddfab758940eaebb1acfd0..2ff3589a7ed510288066ba4707ef71848e2d4a40 100644 --- a/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecConfigCA.py +++ b/Reconstruction/HeavyIonRec/HIJetRec/python/HIJetRecConfigCA.py @@ -696,7 +696,6 @@ 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 751b62d564cbdbfafeacf88cbcbffd644e02a3f9..93a5e45f1a556ef40eb7f7388c6d42664d1648f1 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 = defaultGeometryTags.RUN2 + # flags.GeoModel.AtlasVersion = "ATLAS-R2-2016-01-00-01" # 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 = defaultGeometryTags.RUN3 + flags.GeoModel.AtlasVersion = "ATLAS-R3S-2021-03-01-00" # set more flags: flags.Exec.MaxEvents=5 diff --git a/Reconstruction/MET/METInterface/METInterface/IMETSignificance.h b/Reconstruction/MET/METInterface/METInterface/IMETSignificance.h index 0b618461f2be4975a4c85755afa69a07201480cd..65dd8664581ac55a43145988bec2ec1c5626bebd 100644 --- a/Reconstruction/MET/METInterface/METInterface/IMETSignificance.h +++ b/Reconstruction/MET/METInterface/METInterface/IMETSignificance.h @@ -1,6 +1,6 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 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, const std::string& jetTermName, const std::string& softTermName, const std::string& totalMETName) = 0; + virtual StatusCode varianceMET(xAOD::MissingETContainer* metCont, float avgmu, std::string jetTermName, std::string softTermName, 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 100d13bdf66183b445509705382dd67aa21af9a7..fd9be9b9831f4987c4f858f8d5ada5dd42711f6e 100644 --- a/Reconstruction/MET/METUtilities/METUtilities/METSignificance.h +++ b/Reconstruction/MET/METUtilities/METUtilities/METSignificance.h @@ -1,6 +1,6 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 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, const std::string& jetTermName, const std::string& softTermName, const std::string& totalMETName); + StatusCode varianceMET(xAOD::MissingETContainer* metCont, float avgmu, std::string jetTermName, std::string softTermName, 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/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 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 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 046b500dc2635b48c7eb9d925159a5b251df90df..83b1986dfd746420a04906ca4ca44b8f445167a1 100644 --- a/Reconstruction/MET/METUtilities/Root/METSignificance.cxx +++ b/Reconstruction/MET/METUtilities/Root/METSignificance.cxx @@ -1,6 +1,6 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // METSignificance.cxx // Implementation file for class METSignificance @@ -48,7 +48,8 @@ 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 > > acc_constitObjLinks("ConstitObjectLinks"); + + static const SG::AuxElement::ConstAccessor< std::vector<iplink_t > > dec_constitObjLinks("ConstitObjectLinks"); const static MissingETBase::Types::bitmask_t invisSource = 0x100000; // doesn't overlap with any other METSignificance::METSignificance(const std::string& name) : @@ -118,7 +119,6 @@ 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, const std::string& jetTermName, const std::string& softTermName, const std::string& totalMETName){ + StatusCode METSignificance::varianceMET(xAOD::MissingETContainer* metCont, float avgmu, std::string jetTermName, std::string softTermName, 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 : acc_constitObjLinks(*met)) { + for(const auto& el : dec_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 * 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); + 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); 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 * 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); + 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); 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 / std::sqrt( m_VarL * m_VarT ) ; + m_rho = m_CvLT / sqrt( m_VarL * m_VarT ) ; } else{ // standard calculation m_significance = Significance_LT(m_met, m_VarL, m_VarT, m_CvLT); - m_rho = m_CvLT / std::sqrt( m_VarL * m_VarT ) ; + m_rho = m_CvLT / 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 / std::sqrt( m_VarL * m_VarT ) ; + m_rho = m_CvLT / 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 / std::sqrt( m_VarL * m_VarT ) ; + m_rho = m_CvLT / 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 = std::sqrt(jet_pu_unc*jet_pu_unc + pt_reso*pt_reso); + pt_reso = 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 = std::sqrt(pt_reso*pt_reso + extra_relative_pt_reso*extra_relative_pt_reso); + pt_reso = 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 = 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 + 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 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 / std::sqrt( var_parall * var_perpen ) ; + Double_t rho = cov / 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 = std::pow( Numerator - m_scalarBias , 2 ) / ( var_parall ) ; + Significance = pow( Numerator - m_scalarBias , 2 ) / ( var_parall ) ; } else - Significance = std::pow( Numerator - m_scalarBias , 2 ) / ( var_parall * ( 1 - std::pow(rho,2) ) ) ; + Significance = pow( Numerator - m_scalarBias , 2 ) / ( var_parall * ( 1 - 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 = std::cos(phi); - double s = std::sin(phi); + double c = cos(phi); + double s = 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*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); + 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); } else{ - 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); + 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); } } // 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*std::pow(PtSoft,2); - else return 40. + 2*45 + 0.1*std::pow(45,2); + if (PtSoft<45.) return 40. + 2*PtSoft + 0.1*pow(PtSoft,2); + else return 40. + 2*45 + 0.1*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 48a5dc9b4f97e39adba9664735cafdcd6113691f..b169f31980df93b27f6a26b9b900901b6877fccd 100644 --- a/Reconstruction/RecJobTransforms/python/RDOtoRDO_TRIG_Skeleton.py +++ b/Reconstruction/RecJobTransforms/python/RDOtoRDO_TRIG_Skeleton.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from PyJobTransforms.TransformUtils import processPreExec, processPreInclude, processPostExec, processPostInclude from TriggerJobOpts import runHLT @@ -18,6 +18,8 @@ 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) @@ -31,9 +33,6 @@ 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 335f1663dd48c805b17a8f6c5c6517aca27c15b3..4d97b996ff8ff004afc92481c4ad8e443a7ba1bf 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, type=HIMode) + flags.addFlag("Reco.HIMode", _hiModeChoice, enum=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 cd699080405ee3b9e1ee4257a9283d4e6807d160..856d554d37100d5ac6ca22298c0ed5169c0c828d 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 = rCalo>0. ? std::asinh(correctedZ / rCalo) : ph.eta(); + double eta = std::asinh(correctedZ / rCalo); return {ph.e() / std::cosh(eta), eta, ph.phi()}; } diff --git a/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx b/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx index 7c0f006a61c4cbc00a7eedc213314d95bad4a5d6..7cbf4fe380d07b32ad4d4b7e49652cb655cfd7ab 100644 --- a/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx +++ b/Reconstruction/tauRecTools/Root/TauCommonCalcVars.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------------- @@ -11,6 +11,7 @@ // 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 d1ed0ef347e7ade95ed3b3414668a29f8abe4190..e5af439570c52bccd066428e9bc586d944585d33 100644 --- a/Reconstruction/tauRecTools/src/TauCellVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauCellVariables.cxx @@ -1,10 +1,11 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 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" @@ -44,7 +45,8 @@ 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 - for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : pTau.vertexedClusters()){ + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = pTau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ const xAOD::CaloCluster& cluster = vertexedCluster.clust(); const CaloClusterCellLink* cellLinks = cluster.getCellLinks(); if (cellLinks == nullptr) { @@ -77,18 +79,15 @@ StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { cellEnergy = vxCell.energy(); } - TLorentzVector temp_cc_p4; - temp_cc_p4.SetPtEtaPhiE(cellET, cellEta, cellPhi, cellEnergy); - double dR = tauAxis.DeltaR(temp_cc_p4); - + double dR = Tau1P3PKineUtils::deltaR(tauAxis.Eta(), tauAxis.Phi(), cellEta, cellPhi); + CaloSampling::CaloSample calo = cell->caloDDE()->getSampling(); + 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 40c5e2a41cd7aa6d03fd3bf7e619192bfd16f5b3..2875dc19856c5e48adb0fcd2faf5febeae3be575 100644 --- a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx @@ -1,10 +1,11 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 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" @@ -18,8 +19,6 @@ #include <unordered_map> #include <array> -#include "TVector2.h" - using Gaudi::Units::GeV; @@ -188,7 +187,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 = TVector2::Phi_mpi_pi(cellPhi-extrapolatedPhi[i]); + detPhiTrk = Tau1P3PKineUtils::deltaPhi( cellPhi, extrapolatedPhi[i] ); detEtaTrk = std::abs( cellEta - extrapolatedEta[i] ); clEtaTrk = extrapolatedEta[i]; distEtaTrk = cellEta - extrapolatedEta[i]; diff --git a/Reconstruction/tauRecTools/tauRecTools/KineUtils.h b/Reconstruction/tauRecTools/tauRecTools/KineUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..a45711ba11c547ebbeae6cbbdc1198eab56e8fb3 --- /dev/null +++ b/Reconstruction/tauRecTools/tauRecTools/KineUtils.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TAURECTOOLS_KINEUTILS_H +#define TAURECTOOLS_KINEUTILS_H + +#include <string> +#include "TVector2.h" + +//! +//! @class Tau1P3PKineUtils +//! @brief Provides methods for simple kinematical calculations +//! +//! Provides methods for simple kinematical calculations: absolute value +//! of difference in pseudorapidity, in phi position, half-opening angle +//! in ( eta, phi ) space +//! + +class Tau1P3PKineUtils +{ + public: + //! + //! Calculates absolute value for difference in eta position + //! + //! @param x eta position of object 1 + //! @param y eta position of object 2 + //! + static double deltaEta(double eta1, double eta2) { return std::abs(eta1 - eta2); } + + //! + //! Calculates absolute value for difference in phi position, + //! corrected for 2pi symmetry + //! + //! @param x phi position of object 1 + //! @param y phi position of object 2 + //! + + static double deltaPhi(double phi1, double phi2) + { + return TVector2::Phi_mpi_pi(phi1-phi2); + } + + //! + //! Calculates half-opening angle in (eta,phi) space + //! + //! @param x detphi of two objects + //! @param y deteta of two objects + //! + static double deltaR(double de,double dp) { return std::sqrt(de*de+dp*dp); } + static double deltaR(double eta1, double phi1, double eta2, double phi2) { + return std::sqrt(deltaEta(eta1,eta2)*deltaEta(eta1,eta2)+deltaPhi(phi1,phi2)*deltaPhi(phi1,phi2)); + } + +}; + +#endif // TAURECTOOLS_KINEUTILS_H diff --git a/Simulation/Digitization/DigitizationConfig/python/DigitizationConfigFlags.py b/Simulation/Digitization/DigitizationConfig/python/DigitizationConfigFlags.py index 1cd19f365a7ce29c7cbd459d69e524551c925ef0..18bd88a8bb9324521916bb51f5ceb24f65d4fc68 100644 --- a/Simulation/Digitization/DigitizationConfig/python/DigitizationConfigFlags.py +++ b/Simulation/Digitization/DigitizationConfig/python/DigitizationConfigFlags.py @@ -73,11 +73,9 @@ 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, type=PixelRadiationDamageSimulationType) + flags.addFlag("Digitization.PixelPlanarRadiationDamageSimulationType", PixelRadiationDamageSimulationType.NoRadiationDamage, enum=PixelRadiationDamageSimulationType) # Set the type of the radiation damage simulation type for 3D planar sensors - flags.addFlag("Digitization.Pixel3DRadiationDamageSimulationType", - PixelRadiationDamageSimulationType.NoRadiationDamage, type=PixelRadiationDamageSimulationType) + flags.addFlag("Digitization.Pixel3DRadiationDamageSimulationType", PixelRadiationDamageSimulationType.NoRadiationDamage, enum=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 8b7316b87115c11b7586ef709e977dd98f23d08a..022092e075cc629c101d38927971c3597361bda2 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 - 2024 CERN for the benefit of the ATLAS collaboration +#Copyright(C) 2002 - 2023 CERN for the benefit of the ATLAS collaboration #Declare the package name: atlas_subdir( ISF_FastCaloSimEvent ) @@ -8,8 +8,7 @@ find_package( Boost ) find_package( CLHEP ) find_package( HepPDT ) find_package( ROOT COMPONENTS Core Tree MathCore MathMore Hist RIO Matrix Physics ) -find_package( lwtnn REQUIRED ) -find_package( onnxruntime REQUIRED ) +find_package( lwtnn ) find_package( LibXml2 ) option(USE_GPU "whether to run FCS on GPU or not" OFF) @@ -18,14 +17,13 @@ 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 @@ -92,37 +90,26 @@ 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} ${ALL_ONNX_INCS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaKernel AthenaBaseComps CaloDetDescrLib ${LWTNN_LIBRARIES} ${LIBXML2_LIBRARIES} ${ALL_ONNX_LIBS} + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaKernel AthenaBaseComps CaloDetDescrLib ${LWTNN_LIBRARIES} ${LIBXML2_LIBRARIES} 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} ${ALL_ONNX_INCS} + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaKernel AthenaBaseComps CaloDetDescrLib ${LWTNN_LIBRARIES} ${LIBXML2_LIBRARIES} ${ALL_ONNX_LIBS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaKernel AthenaBaseComps CaloDetDescrLib ${LWTNN_LIBRARIES} ${LIBXML2_LIBRARIES} CaloGeoHelpers CxxUtils TileSimEvent PRIVATE_LINK_LIBRARIES GaudiKernel ) endif() @@ -131,25 +118,3 @@ 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 ed71d4de8cdcdf1965368a8ab5954c6a89d3f4a4..8b8a68a210015ea0a98c0dee3eba6c07bbdc831a 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "ISF_FastCaloSimEvent/DoubleArray.h" @@ -50,11 +50,6 @@ #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" @@ -611,11 +606,6 @@ #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 d3a3a8f00a28057bd45003a65df9010d9ecf0249..fce96ca23c31dfd00a799000670900b08e124976 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef ISF_FASTCALOSIMEVENT_MLogging_h @@ -8,6 +8,14 @@ #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> @@ -24,14 +32,6 @@ 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,15 +45,6 @@ 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 @@ -211,8 +202,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 217a70387362e616fc12bd05a02cfd0e745fb16b..118ab5b0c706297e5a3d09d614ad77008757470f 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 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 const &pid, int const &etaMin, + bool initializeNetwork(int pid, int etaMin, const std::string &FastCaloGANInputFolderName); bool fillEnergy(TFCSSimulationState &simulstate, const TFCSTruthState *truth, @@ -81,12 +81,6 @@ 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); @@ -96,7 +90,7 @@ protected: std::string FastCaloGANInputFolderName); private: - static int GetBinsInFours(double const &bins); + static int GetBinsInFours(double bins); int GetAlphaBinsForRBin(const TAxis *x, int ix, int yBinNum) const; std::vector<int> m_bin_ninit; @@ -109,7 +103,7 @@ private: TFCSGANEtaSlice *m_slice = nullptr; TFCSGANXMLParameters m_param; - ClassDefOverride(TFCSEnergyAndHitGANV2, 2) // TFCSEnergyAndHitGANV2 + ClassDefOverride(TFCSEnergyAndHitGANV2, 1) // 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 5c2ad29e06db6eb2d3049d6fd5aaf4af3c8c45b8..ebb063ed8555cf050fed5466fbd5be28233b6036 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -17,12 +17,11 @@ #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" -// generic network class -#include "ISF_FastCaloSimEvent/VNetworkBase.h" -// net class for legacy loading -#include "ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h" +#include "lwtnn/LightweightGraph.hh" +#include "lwtnn/parse_json.hh" #include <fstream> @@ -63,26 +62,16 @@ 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, 5) // TFCSGANEtaSlice + ClassDef(TFCSGANEtaSlice, 4) // 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 c5f56a3de1ebf199ffba5465105f080a85623445..cd9646ee5262f77cd2afa127ceb3b92eb1f6a9a5 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h @@ -1,33 +1,19 @@ -/** - * 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. - **/ +/* + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +*/ -// Hopefully documentation gets inherited from VNetworkBase +////////////////////////////////////////////////////////////////// +// TFCSGANLWTNNHandler.h, (c) ATLAS Detector software +/////////////////////////////////////////////////////////////////// -#ifndef TFCSGANLWTNNHANDLER_H -#define TFCSGANLWTNNHANDLER_H +#ifndef ISF_TFCSGANLWTNNHANDLER_H +#define ISF_TFCSGANLWTNNHANDLER_H 1 #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> @@ -36,86 +22,18 @@ class TFCSGANLWTNNHandler : public VNetworkLWTNN { public: - // 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); + TFCSGANLWTNNHandler(); + virtual ~TFCSGANLWTNNHandler(); - /** - * @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; + const lwt::LightweightGraph *GetGraph() const { return m_graph; } - /** - * @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; + bool LoadGAN(const std::string &inputFile); private: - // 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. - **/ + const lwt::LightweightGraph *m_graph; //! Do not persistify std::string *m_input = nullptr; - // Suppling a ClassDef for writing to file. - ClassDefOverride(TFCSGANLWTNNHandler, 6); + ClassDef(TFCSGANLWTNNHandler, 5) // TFCSGANLWTNNHandler }; -#endif // TFCSGANLWTNNHANDLER_H +#endif //> !ISF_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 3ea73af820c13f254fec68c644674791e6962a83..3e52f07b614612bb0efc377e633b35f31df60e9f 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef ISF_FASTCALOSIMEVENT_TFCSPREDICTEXTRAPWEIGHTS_h @@ -51,10 +51,6 @@ 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 03feab1330be4e77d0f97ea1c950e4e4c150bc07..8c0425f2f0a650329ba8558d579d9dc08d5f5633 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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 1998c5443120aa08ce2f8e68c7aa9b14d7a333c4..76d3bae494da9a2806b91701798d3693d0aad759 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #include "ISF_FastCaloSimEvent/TFCSEnergyAndHitGANV2.h" @@ -70,8 +70,7 @@ void TFCSEnergyAndHitGANV2::set_nr_of_init(unsigned int bin, // initialize lwtnn network bool TFCSEnergyAndHitGANV2::initializeNetwork( - int const &pid, int const &etaMin, - const std::string &FastCaloGANInputFolderName) { + int pid, int etaMin, const std::string &FastCaloGANInputFolderName) { // initialize all necessary constants // FIXME eventually all these could be stored in the .json file @@ -79,7 +78,7 @@ bool TFCSEnergyAndHitGANV2::initializeNetwork( ATH_MSG_INFO( "Using FastCaloGANInputFolderName: " << FastCaloGANInputFolderName); // get neural net JSON file as an std::istream object - const int etaMax = etaMin + 5; + int etaMax = etaMin + 5; reset_match_all_pdgid(); set_pdgid(pid); @@ -96,7 +95,7 @@ bool TFCSEnergyAndHitGANV2::initializeNetwork( pidForXml = 211; } - const int etaMid = (etaMin + etaMax) / 2; + int etaMid = (etaMin + etaMax) / 2; m_param.InitialiseFromXML(pidForXml, etaMid, FastCaloGANInputFolderName); m_param.Print(); m_slice = new TFCSGANEtaSlice(pid, etaMin, etaMax, m_param); @@ -151,15 +150,16 @@ bool TFCSEnergyAndHitGANV2::fillEnergy( const TFCSGANEtaSlice::FitResultsPerLayer &fitResults = m_slice->GetFitResults(); // used only if GAN version > 1 - ATH_MSG_DEBUG("energy voxels size = " << outputs.size()); + unsigned int energyBins = outputs.size(); + ATH_MSG_VERBOSE("energy voxels size = " << energyBins); double totalEnergy = 0; - for (auto output : outputs) { - totalEnergy += output.second; + for (unsigned int i = 0; i < energyBins; ++i){ + totalEnergy += outputs.at("out_" + std::to_string(i)); } - 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) { - const int layer = element.first; + int layer = element.first; const TH2D *h = &element.second; - const int xBinNum = h->GetNbinsX(); - const int yBinNum = h->GetNbinsY(); + int xBinNum = h->GetNbinsX(); + 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) { - const double energyInVoxel = outputs.at(std::to_string(vox)); + double energyInVoxel = outputs.at("out_" + 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) { - const int layer = element.first; + int layer = element.first; const TH2D *h = &element.second; - const int xBinNum = h->GetNbinsX(); - const int yBinNum = h->GetNbinsY(); + int xBinNum = h->GetNbinsX(); + 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) { - const int binsInAlphaInRBin = GetAlphaBinsForRBin(x, ix, yBinNum); + int binsInAlphaInRBin = GetAlphaBinsForRBin(x, ix, yBinNum); // Horrible work around for variable # of bins along alpha direction - const int binsToMerge = yBinNum == 32 ? 32 / binsInAlphaInRBin : 1; + int binsToMerge = yBinNum == 32 ? 32 / binsInAlphaInRBin : 1; for (int iy = 1; iy <= binsInAlphaInRBin; ++iy) { - const double energyInVoxel = outputs.at(std::to_string(vox)); - const int lowEdgeIndex = (iy - 1) * binsToMerge + 1; + double energyInVoxel = outputs.at("out_" + std::to_string(vox)); + 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 - const double r = x->GetBinUpEdge(ix); + 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(); - const double angle = y->GetBinUpEdge(iy) - y->GetBinLowEdge(iy); - const double r = x->GetBinUpEdge(ix); - const double d = 2 * r * sin(angle / 2 * r); + double angle = y->GetBinUpEdge(iy) - y->GetBinLowEdge(iy); + double r = x->GetBinUpEdge(ix); + 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 - const int maxNhits = 10; + int maxNhits = 10; nHitsAlpha = std::min(maxNhits, std::max(1, nHitsAlpha)); nHitsR = std::min(maxNhits, std::max(1, nHitsR)); } @@ -539,9 +539,8 @@ TFCSEnergyAndHitGANV2::simulate(TFCSSimulationState &simulstate, void TFCSEnergyAndHitGANV2::Print(Option_t *option) const { TFCSParametrization::Print(option); TString opt(option); - const bool shortprint = opt.Index("short") >= 0; - const bool longprint = - msgLvl(MSG::DEBUG) || (msgLvl(MSG::INFO) && !shortprint); + bool shortprint = opt.Index("short") >= 0; + bool longprint = msgLvl(MSG::DEBUG) || (msgLvl(MSG::INFO) && !shortprint); TString optprint = opt; optprint.ReplaceAll("short", ""); @@ -575,25 +574,6 @@ 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__) @@ -606,7 +586,7 @@ void TFCSEnergyAndHitGANV2::test_path(std::string path, ATH_MSG_NOCLASS(logger, "New particle"); TFCSTruthState *t = new TFCSTruthState(); t->SetPtEtaPhiM(65536, 0, 0, 139.6); - t->set_pdgid(pid); + t->set_pdgid(211); truth = t; } if (!extrapol) { @@ -630,18 +610,21 @@ void TFCSEnergyAndHitGANV2::test_path(std::string path, } TFCSEnergyAndHitGANV2 GAN("GAN", "GAN"); - GAN.setLevel(MSG::INFO); - const int etaMin = 20; - const int etaMax = etaMin + 5; + GAN.setLevel(MSG::VERBOSE); + int pid = 211; + int etaMin = 20; + int etaMax = etaMin + 5; ATH_MSG_NOCLASS(logger, "Initialize Networks"); - GAN.initializeNetwork(pid, etaMin, path); + GAN.initializeNetwork(pid, etaMin, + "/eos/atlas/atlascerngroupdisk/proj-simul/AF3_Run3/" + "InputsToBigParamFiles/FastCaloGANWeightsVer02"); 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::INFO); + c->setLevel(MSG::VERBOSE); c->set_pdgid(pid); if (pid == 11) c->add_pdgid(-pid); @@ -657,28 +640,24 @@ void TFCSEnergyAndHitGANV2::test_path(std::string path, GAN.Print(); - 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"); - + ATH_MSG_NOCLASS(logger, "Writing GAN to FCSGANtest.root"); + TFile *fGAN = TFile::Open("FCSGANtest.root", "recreate"); + GAN.Write(); fGAN->ls(); fGAN->Close(); - ATH_MSG_NOCLASS(logger, "Open " << outname); - fGAN = TFile::Open(outname.c_str()); + ATH_MSG_NOCLASS(logger, "Open FCSGANtest.root"); + fGAN = TFile::Open("FCSGANtest.root"); 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 const &bins) { +int TFCSEnergyAndHitGANV2::GetBinsInFours(double bins) { if (bins < 4) return 4; else if (bins < 8) @@ -693,15 +672,14 @@ int TFCSEnergyAndHitGANV2::GetAlphaBinsForRBin(const TAxis *x, int ix, int yBinNum) const { double binsInAlphaInRBin = yBinNum; if (yBinNum == 32) { - ATH_MSG_DEBUG("yBinNum is special value 32"); - const double widthX = x->GetBinWidth(ix); - const double radious = x->GetBinCenter(ix); + double widthX = x->GetBinWidth(ix); + double radious = x->GetBinCenter(ix); double circumference = radious * 2 * TMath::Pi(); if (m_param.IsSymmetrisedAlpha()) { circumference = radious * TMath::Pi(); } - const double bins = circumference / widthX; + 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 24abda57314d344e231a383b8b982f8ac033cabc..d18c6e892d27037d197d64a512db96dbcdd07174 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -9,8 +9,6 @@ // class header include #include "ISF_FastCaloSimEvent/TFCSGANEtaSlice.h" -#include "ISF_FastCaloSimEvent/TFCSNetworkFactory.h" - #include "CLHEP/Random/RandGauss.h" #include "TFitResult.h" @@ -30,38 +28,32 @@ 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) {} - -TFCSGANEtaSlice::~TFCSGANEtaSlice() { - // Deleting a nullptr is a noop - delete m_gan_all; - delete m_gan_low; - delete m_gan_high; + : m_pid (pid), + m_etaMin (etaMin), + m_etaMax (etaMax), + m_param (param) +{ } -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; +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; + } } bool TFCSGANEtaSlice::IsGanCorrectlyLoaded() const { if (m_pid == 211 || m_pid == 2212) { - if (GetNetAll() == nullptr) { + if (m_gan_all == nullptr) { return false; } } else { - if (GetNetHigh() == nullptr || GetNetLow() == nullptr) { + if (m_gan_high == nullptr || m_gan_low == nullptr) { return false; } } @@ -69,47 +61,43 @@ 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.*"; + "_" + std::to_string(m_etaMax) + "_All.json"; ATH_MSG_DEBUG("Gan input file name " << inputFileName); - m_net_all = TFCSNetworkFactory::create(inputFileName); - if (m_net_all == nullptr) - success = false; + m_gan_all = new TFCSGANLWTNNHandler(); + return m_gan_all->LoadGAN(inputFileName); } 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.*"; + "_" + std::to_string(m_etaMax) + "_High10.json"; ATH_MSG_DEBUG("Gan input file name " << inputFileName); - m_net_all = TFCSNetworkFactory::create(inputFileName); - if (m_net_all == nullptr) - success = false; + m_gan_all = new TFCSGANLWTNNHandler(); + return m_gan_all->LoadGAN(inputFileName); } 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.*"; - ATH_MSG_DEBUG("Gan input file name " << inputFileName); - m_net_high = TFCSNetworkFactory::create(inputFileName); - if (m_net_high == nullptr) - success = false; + "_" + std::to_string(m_etaMax) + "_High12.json"; + m_gan_high = new TFCSGANLWTNNHandler(); + returnValue = m_gan_high->LoadGAN(inputFileName); + if (!returnValue) { + return returnValue; + } inputFileName = m_param.GetInputFolder() + "/neural_net_" + std::to_string(m_pid) + "_eta_" + std::to_string(m_etaMin) + - "_" + std::to_string(m_etaMax) + "_UltraLow12.*"; - m_net_low = TFCSNetworkFactory::create(inputFileName); - if (m_net_low == nullptr) - success = false; + "_" + std::to_string(m_etaMax) + "_UltraLow12.json"; + m_gan_low = new TFCSGANLWTNNHandler(); + return m_gan_low->LoadGAN(inputFileName); + return true; } - return success; } void TFCSGANEtaSlice::CalculateMeanPointFromDistributionOfR() { @@ -170,7 +158,7 @@ void TFCSGANEtaSlice::ExtractExtrapolatorMeansFromInputs() { } } -VNetworkBase::NetworkOutputs +TFCSGANEtaSlice::NetworkOutputs TFCSGANEtaSlice::GetNetworkOutputs(const TFCSTruthState *truth, const TFCSExtrapolationState *extrapol, TFCSSimulationState simulstate) const { @@ -206,7 +194,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["Noise"].insert(std::pair<std::string, double>( + inputs["node_0"].insert(std::pair<std::string, double>( "variable_" + std::to_string(i), randUniformZ)); } @@ -216,43 +204,35 @@ TFCSGANEtaSlice::GetNetworkOutputs(const TFCSTruthState *truth, // truth->P() <<" mass:" << truth->M() <<" Ekin_off:" << // truth->Ekin_off() << " Ekin_min:"<<Ekin_min<<" // Ekin_max:"<<Ekin_max); - // inputs["mycond"].insert ( std::pair<std::string,double>("variable_0", + // inputs["node_1"].insert ( std::pair<std::string,double>("variable_0", // truth->Ekin()/(std::pow(2,maxExp))) ); //Old conditioning using linear // interpolation, now use logaritminc interpolation - inputs["mycond"].insert(std::pair<std::string, double>( + inputs["node_1"].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["mycond"].insert(std::pair<std::string, double>( + inputs["node_1"].insert(std::pair<std::string, double>( "variable_1", fabs(extrapol->IDCaloBoundary_eta()))); } else { - inputs["mycond"].insert(std::pair<std::string, double>("variable_1", 0)); + inputs["node_1"].insert(std::pair<std::string, double>("variable_1", 0)); } } - VNetworkBase::NetworkOutputs outputs; if (m_param.GetGANVersion() == 1 || m_pid == 211 || m_pid == 2212) { - outputs = GetNetAll()->compute(inputs); + return m_gan_all->GetGraph()->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"); - outputs = GetNetHigh()->compute(inputs); + return m_gan_high->GetGraph()->compute(inputs); } else { - outputs = GetNetLow()->compute(inputs); + return m_gan_low->GetGraph()->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 c159bad2f67bd05f1f4ced94ace703c42c6a9d62..8e03779ec80a8d91df0bfe103a2decc852d96e59 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANLWTNNHandler.cxx +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSGANLWTNNHandler.cxx @@ -1,39 +1,66 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ +/////////////////////////////////////////////////////////////////// +// TFCSGANLWTNNHandler.cxx, (c) ATLAS Detector software // +/////////////////////////////////////////////////////////////////// + +// class header include #include "ISF_FastCaloSimEvent/TFCSGANLWTNNHandler.h" -// For writing to a tree -#include "TBranch.h" -#include "TTree.h" +#include "TFile.h" //Needed for TBuffer -// LWTNN -#include "lwtnn/LightweightGraph.hh" -#include "lwtnn/parse_json.hh" +#include <iostream> +#include <fstream> +#include <string> +#include <sstream> -TFCSGANLWTNNHandler::TFCSGANLWTNNHandler(const std::string &inputFile) - : VNetworkLWTNN(inputFile) { - ATH_MSG_DEBUG("Setting up from inputFile."); - setupPersistedVariables(); - setupNet(); -}; +TFCSGANLWTNNHandler::TFCSGANLWTNNHandler() { m_graph = nullptr; } -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; -}; +TFCSGANLWTNNHandler::~TFCSGANLWTNNHandler() { + if (m_input != nullptr) { + delete m_input; + } + if (m_graph != nullptr) { + delete m_graph; + } +} + +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; +} -void TFCSGANLWTNNHandler::setupNet() { - // Backcompatability, previous versions stored this in m_input - if (m_json.length() == 0 && m_input != nullptr) { - m_json = *m_input; +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 delete m_input; m_input = nullptr; } @@ -106,13 +133,6 @@ void TFCSGANLWTNNHandler::Streamer(TBuffer &buf) { this->deleteAllButNet(); #endif } else { - 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); - }; -}; + R__b.WriteClassBuffer(TFCSGANLWTNNHandler::Class(), this); + } +} diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/src/TFCSParametrizationBase.cxx index 2be2327e8a31721bf1bab96ba9a895e7716dafb5..180de694a45915746ed9778ccd7b40cb2ada769e 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #include "ISF_FastCaloSimEvent/TFCSParametrizationBase.h" @@ -57,7 +57,8 @@ void TFCSParametrizationBase::Print(Option_t *option) const { optprint.ReplaceAll("short", ""); if (longprint) { - ATH_MSG_INFO(optprint << GetTitle() << " " << IsA()->GetName() ); + ATH_MSG_INFO(optprint << GetTitle() << " (" << IsA()->GetName() << "*)" + << this); 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 0fd2668ff79bf77bc85a2304bffd74576b252cbf..7495f0c8ba74e7eb7165375e979da7e4e3b5378c 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-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 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,7 +301,6 @@ bool TFCSPredictExtrapWeights::initializeNetwork( ATH_MSG_INFO( "Using FastCaloNNInputFolderName: " << FastCaloNNInputFolderName); - set_pdgid(pid); std::string inputFileName = FastCaloNNInputFolderName + "NN_" + etaBin + ".json"; @@ -374,28 +373,7 @@ 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__) @@ -452,7 +430,7 @@ void TFCSPredictExtrapWeights::test_path( << " eta " << eta); // Find eta bin - const int Eta = eta * 10; + int Eta = eta * 10; std::string etaBin = ""; for (int i = 0; i <= 25; ++i) { int etaTmp = i * 5; @@ -464,10 +442,13 @@ void TFCSPredictExtrapWeights::test_path( ATH_MSG_NOCLASS(logger, "etaBin = " << etaBin); TFCSPredictExtrapWeights NN("NN", "NN"); - NN.setLevel(MSG::INFO); + NN.setLevel(MSG::VERBOSE); const int pid = truth->pdgid(); - NN.initializeNetwork(pid, etaBin, net_path); - NN.getNormInputs(etaBin, norm_path); + 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/"); // Get extrapWeights and save them as AuxInfo in simulstate @@ -476,16 +457,15 @@ void TFCSPredictExtrapWeights::test_path( 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); - const std::vector<int> layers = {0, 1, 2, 3, 12}; + std::vector<int> layers = {0, 1, 2, 3, 12}; for (int ilayer : layers) { simulstate->setAuxInfo<float>( ilayer, outputs["extrapWeight_" + std::to_string(ilayer)]); } // Simulate - const int layer = 0; + int layer = 0; NN.set_calosample(layer); TFCSLateralShapeParametrizationHitBase::Hit hit; NN.simulate_hit(hit, *simulstate, truth, extrapol); @@ -501,9 +481,9 @@ void TFCSPredictExtrapWeights::test_path( fNN = TFile::Open("FCSNNtest.root"); TFCSPredictExtrapWeights *NN2 = (TFCSPredictExtrapWeights *)(fNN->Get("NN")); - NN2->setLevel(MSG::INFO); + NN2->setLevel(MSG::DEBUG); 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 a7098218854fad33ca6d1f9804667b80c92d40ea..9028eba99e1fd9e5d011e400e9d166e6500a3d8a 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, type=CalibrationRun) + scf.addFlag("Sim.CalibrationRun", _checkCalibrationRun, enum=CalibrationRun) - scf.addFlag("Sim.CavernBackground", CavernBackground.Off, type=CavernBackground) + scf.addFlag("Sim.CavernBackground", CavernBackground.Off, enum=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, - type=TruthStrategy) + enum=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, type=BeamPipeSimMode) - scf.addFlag("Sim.LArParameterization", LArParameterization.NoFrozenShowers, type=LArParameterization) + scf.addFlag("Sim.BeamPipeSimMode", BeamPipeSimMode.Normal, enum=BeamPipeSimMode) + scf.addFlag("Sim.LArParameterization", LArParameterization.NoFrozenShowers, enum=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, type=VertexSource) + scf.addFlag("Sim.VertexSource", VertexSource.CondDB, enum=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, type=SimulationFlavour) + scf.addFlag("Sim.ISF.Simulator", _checkSimulationFlavour, enum=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 diff --git a/TileCalorimeter/TileMonitoring/python/TileDigitsFlxMonitorAlgorithm.py b/TileCalorimeter/TileMonitoring/python/TileDigitsFlxMonitorAlgorithm.py index 85798e204d77fe71e7f2a09ca3f2a95531c1d213..29e93166b6146be062e55d829f6a596b5f3e9e2c 100644 --- a/TileCalorimeter/TileMonitoring/python/TileDigitsFlxMonitorAlgorithm.py +++ b/TileCalorimeter/TileMonitoring/python/TileDigitsFlxMonitorAlgorithm.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # ''' @@ -147,7 +147,11 @@ def TileDigitsFlxMonitoringConfig(flags, fragIDs=[0x201, 0x402], **kwargs): return result -if __name__=='__main__': +if __name__=='__main__': + # Setup the Run III behavior + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + # Setup logs from AthenaCommon.Logging import log from AthenaCommon.Constants import INFO diff --git a/TileCalorimeter/TileMonitoring/src/TileTBBeamMonitorAlgorithm.cxx b/TileCalorimeter/TileMonitoring/src/TileTBBeamMonitorAlgorithm.cxx index 6f6bfa90d6d6250f93e0310d365f363610c01c3c..df7f311bab46816e4d59487c3c4fa2f9b68f4b52 100644 --- a/TileCalorimeter/TileMonitoring/src/TileTBBeamMonitorAlgorithm.cxx +++ b/TileCalorimeter/TileMonitoring/src/TileTBBeamMonitorAlgorithm.cxx @@ -64,6 +64,8 @@ StatusCode TileTBBeamMonitorAlgorithm::fillHistograms( const EventContext& ctx ) uint32_t run = GetEventInfo(ctx)->runNumber(); + using Tile = TileCalibUtils; + // TDC/BEAM Items int muTag = 0; int muHalo = 0; diff --git a/TileCalorimeter/TileMonitoring/src/TileTBMonitorAlgorithm.cxx b/TileCalorimeter/TileMonitoring/src/TileTBMonitorAlgorithm.cxx index 375f0e01b1badb55b33499e34c8f6ebcdefb9e23..cde166a6ce1dd4a69dc769747b6901dbc4a8e3f5 100644 --- a/TileCalorimeter/TileMonitoring/src/TileTBMonitorAlgorithm.cxx +++ b/TileCalorimeter/TileMonitoring/src/TileTBMonitorAlgorithm.cxx @@ -197,6 +197,8 @@ StatusCode TileTBMonitorAlgorithm::fillHistograms( const EventContext& ctx ) con // In case you want to measure the execution time auto timer = Monitored::Timer("TIME_execute"); + using Tile = TileCalibUtils; + SG::ReadHandle<CaloCellContainer> caloCellContainer(m_caloCellContainerKey, ctx); ATH_CHECK( caloCellContainer.isValid() ); diff --git a/Tools/Campaigns/python/MC21.py b/Tools/Campaigns/python/MC21.py index 9bf7cc9bd4f5b2745fe0ec6cee9a3d5706b21861..dd15edd8d76ab1ec1372f44b61d757ebef36267e 100644 --- a/Tools/Campaigns/python/MC21.py +++ b/Tools/Campaigns/python/MC21.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.Enums import ProductionStep from Campaigns.Utils import Campaign @@ -148,6 +148,11 @@ def MC21SimulationMultipleIoV(flags): profile= 'RunDependentSimData.PileUpProfile_run410000_MC21a_MultiBeamspot') +def MC21SimulationMultiBeamSpot(flags): + """MC21 flags for simulation (alias)""" + MC21SimulationMultipleIoV(flags) + + def MC21SimulationSingleIoVCalibrationHits(flags): """MC21 flags for simulation with CalibrationHits""" MC21SimulationSingleIoV(flags) @@ -167,3 +172,8 @@ def MC21SimulationMultipleIoVCalibrationHits(flags): from SimuJobTransforms import CalHits, ParticleID CalHits(flags) ParticleID(flags) + + +def MC21SimulationMultiBeamSpotCalibrationHits(flags): + """MC21 flags for simulation with CalibrationHits (alias)""" + MC21SimulationMultipleIoVCalibrationHits(flags) diff --git a/Tools/Campaigns/python/MC23.py b/Tools/Campaigns/python/MC23.py index 82417e4d05f4bef80403b2a782af121dcdca4830..36facc503000d571a66cef9b000d8dc045d25293 100644 --- a/Tools/Campaigns/python/MC23.py +++ b/Tools/Campaigns/python/MC23.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.Enums import ProductionStep from Campaigns.Utils import Campaign @@ -216,6 +216,12 @@ def MC23SimulationLowMuRun(flags): flags.Input.LumiBlockNumbers = [1] # dummy value +def MC23cSimulationNoIoV(flags): + """MC23 base flags for simulation without specifying conditions IoVs""" + MC23SimulationNoIoV(flags) + flags.Input.MCCampaign = Campaign.MC23c + + def MC23SimulationSingleIoV(flags): """MC23 flags for simulation""" MC23SimulationNoIoV(flags) @@ -225,6 +231,15 @@ def MC23SimulationSingleIoV(flags): flags.Input.LumiBlockNumbers = [1] # dummy value +def MC23cSimulationSingleIoV(flags): + """MC23 flags for simulation""" + MC23SimulationNoIoV(flags) + + flags.Input.RunNumbers = [450000] + flags.Input.OverrideRunNumber = True + flags.Input.LumiBlockNumbers = [1] # dummy value + + def MC23aSimulationMultipleIoV(flags): """MC23 flags for simulation""" MC23SimulationNoIoV(flags) @@ -238,7 +253,7 @@ def MC23aSimulationMultipleIoV(flags): def MC23cSimulationMultipleIoV(flags): """MC23 flags for simulation""" - MC23SimulationNoIoV(flags) + MC23cSimulationNoIoV(flags) flags.Input.OverrideRunNumber = True diff --git a/Tools/Campaigns/python/__init__.py b/Tools/Campaigns/python/__init__.py index 8f80f2b3e9dae86fd088b080b102687b9b581292..c24c5a0c6481d11e439afa57a457d6f40ced73a7 100644 --- a/Tools/Campaigns/python/__init__.py +++ b/Tools/Campaigns/python/__init__.py @@ -1,20 +1,19 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from .MC16 import (MC16a, MC16d, MC16e, MC16NoPileUp, MC16SimulationNoIoV, MC16SimulationSingleIoV, MC16Simulation) from .MC20 import MC20a, MC20d, MC20e, MC20NoPileUp -from .MC21 import (MC21a, MC21aSingleBeamspot, BeamspotSplitMC21a, - MC21SimulationNoIoV, MC21SimulationSingleIoV, MC21Simulation, MC21SimulationLowMuRun, +from .MC21 import (MC21a, MC21aSingleBeamspot, MC21LowMu, MC21NoPileUp, MC21NoPileUpLowMuRun, BeamspotSplitMC21a, + MC21SimulationNoIoV, MC21SimulationSingleIoV, MC21SimulationLowMuRun, MC21Simulation, MC21SimulationMultipleIoV, MC21SimulationMultiBeamSpot, MC21SimulationSingleIoVCalibrationHits, MC21SimulationCalibrationHits, - MC21SimulationMultipleIoV, MC21SimulationMultipleIoVCalibrationHits, - MC21LowMu, MC21NoPileUp, MC21NoPileUpLowMuRun) -from .MC23 import (MC23a, MC23aSingleBeamspot, BeamspotSplitMC23a, - MC23SimulationNoIoV, MC23SimulationSingleIoV, MC23SimulationSingleIoVCalibrationHits, MC23SimulationLowMuRun, - MC23aSimulationMultipleIoV, MC23aSimulationMultipleIoVCalibrationHits, + MC21SimulationMultipleIoVCalibrationHits, MC21SimulationMultiBeamSpotCalibrationHits) +from .MC23 import (MC23a, MC23aSingleBeamspot, MC23LowMu, MC23NoPileUp, MC23NoPileUpLowMuRun, BeamspotSplitMC23a, + MC23SimulationNoIoV, MC23SimulationLowMuRun, MC23SimulationSingleIoV, MC23aSimulationMultipleIoV, + MC23SimulationSingleIoVCalibrationHits, MC23aSimulationMultipleIoVCalibrationHits, MC23c, MC23cSingleBeamspot, BeamspotSplitMC23c, - MC23cSimulationMultipleIoV, MC23cSimulationMultipleIoVCalibrationHits, - MC23d, MC23dSingleBeamspot, BeamspotSplitMC23d, - MC23LowMu, MC23NoPileUp, MC23NoPileUpLowMuRun ) + MC23cSimulationNoIoV, MC23cSimulationSingleIoV, MC23cSimulationMultipleIoV, + MC23cSimulationMultipleIoVCalibrationHits, + MC23d, MC23dSingleBeamspot, BeamspotSplitMC23d) from .PhaseII import (PhaseIIPileUp1, PhaseIIPileUp60, PhaseIIPileUp140, PhaseIIPileUp200, PhaseIIPileUpMC21a, PhaseIINoPileUp, PhaseIISimulationNoIoV, PhaseIISimulationSingleIoV, PhaseIISimulation) @@ -31,18 +30,17 @@ __all__ = [ 'MC16a', 'MC16d', 'MC16e', 'MC16NoPileUp', 'MC16SimulationNoIoV', 'MC16SimulationSingleIoV', 'MC16Simulation', 'MC20a', 'MC20d', 'MC20e', 'MC20NoPileUp', - 'MC21a', 'MC21aSingleBeamspot', 'BeamspotSplitMC21a', - 'MC21SimulationNoIoV', 'MC21SimulationSingleIoV', 'MC21Simulation', 'MC21SimulationLowMuRun', + 'MC21a', 'MC21aSingleBeamspot', 'MC21LowMu', 'MC21NoPileUp', 'MC21NoPileUpLowMuRun', 'BeamspotSplitMC21a', + 'MC21SimulationNoIoV', 'MC21SimulationLowMuRun', 'MC21SimulationSingleIoV', 'MC21Simulation', 'MC21SimulationMultipleIoV', 'MC21SimulationMultiBeamSpot', 'MC21SimulationSingleIoVCalibrationHits', 'MC21SimulationCalibrationHits', - 'MC21SimulationMultipleIoV', 'MC21SimulationMultipleIoVCalibrationHits', - 'MC21LowMu', 'MC21NoPileUp', 'MC21NoPileUpLowMuRun', - 'MC23a', 'MC23aSingleBeamspot', 'BeamspotSplitMC23a', - 'MC23SimulationNoIoV', 'MC23SimulationSingleIoV', 'MC23SimulationSingleIoVCalibrationHits', 'MC23SimulationLowMuRun', - 'MC23aSimulationMultipleIoV', 'MC23aSimulationMultipleIoVCalibrationHits', + 'MC21SimulationMultipleIoVCalibrationHits', 'MC21SimulationMultiBeamSpotCalibrationHits', + 'MC23a', 'MC23aSingleBeamspot', 'MC23LowMu', 'MC23NoPileUp', 'MC23NoPileUpLowMuRun', 'BeamspotSplitMC23a', + 'MC23SimulationNoIoV', 'MC23SimulationLowMuRun', 'MC23SimulationSingleIoV', 'MC23aSimulationMultipleIoV', + 'MC23SimulationSingleIoVCalibrationHits', 'MC23aSimulationMultipleIoVCalibrationHits', 'MC23c', 'MC23cSingleBeamspot', 'BeamspotSplitMC23c', - 'MC23cSimulationMultipleIoV', 'MC23cSimulationMultipleIoVCalibrationHits', + 'MC23cSimulationNoIoV', 'MC23cSimulationSingleIoV', 'MC23cSimulationMultipleIoV', + 'MC23cSimulationMultipleIoVCalibrationHits', 'MC23d', 'MC23dSingleBeamspot', 'BeamspotSplitMC23d', - 'MC23LowMu', 'MC23NoPileUp', 'MC23NoPileUpLowMuRun', 'PhaseIIPileUp1', 'PhaseIIPileUp60', 'PhaseIIPileUp140', 'PhaseIIPileUp200', 'PhaseIIPileUpMC21a', 'PhaseIINoPileUp', 'PhaseIISimulationNoIoV', 'PhaseIISimulationSingleIoV', 'PhaseIISimulation', diff --git a/Tools/Campaigns/share/MC21SimulationMultiBeamSpot.py b/Tools/Campaigns/share/MC21SimulationMultiBeamSpot.py new file mode 100644 index 0000000000000000000000000000000000000000..0880995c0221e72a035c094eecbdc45d039a4ba5 --- /dev/null +++ b/Tools/Campaigns/share/MC21SimulationMultiBeamSpot.py @@ -0,0 +1,4 @@ +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon.Resilience import protectedInclude +protectedInclude("Campaigns/MC21SimulationMultipleIoV.py") diff --git a/Tools/Campaigns/share/MC21SimulationMultiBeamSpotCalibrationHits.py b/Tools/Campaigns/share/MC21SimulationMultiBeamSpotCalibrationHits.py new file mode 100644 index 0000000000000000000000000000000000000000..3851d4632061d40e3b21dc2a333fc164d57665f9 --- /dev/null +++ b/Tools/Campaigns/share/MC21SimulationMultiBeamSpotCalibrationHits.py @@ -0,0 +1,4 @@ +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon.Resilience import protectedInclude +protectedInclude("Campaigns/MC21SimulationMultipleIoVCalibrationHits.py") diff --git a/Tools/TrfTestsART/test/test_trf_data15_mt.sh b/Tools/TrfTestsART/test/test_trf_data15_mt.sh index 00f891ad42ddff4d52a85bfa182b125fec0b0293..19d190807305bc8d896f95575af9c497876415d2 100755 --- a/Tools/TrfTestsART/test/test_trf_data15_mt.sh +++ b/Tools/TrfTestsART/test/test_trf_data15_mt.sh @@ -18,7 +18,7 @@ timeout 64800 Reco_tf.py --CA\ --preExec 'all:flags.DQ.Steering.doHLTMon=False; flags.Exec.FPE=10;' \ --autoConfiguration='everything' \ --conditionsTag 'all:CONDBR2-BLKPA-RUN2-11' --geometryVersion='default:ATLAS-R2-2016-01-00-01' \ - --runNumber='276689' --maxEvents='-1' + --runNumber='357750' --maxEvents='-1' rc1=$? echo "art-result: ${rc1} Reco_tf_data15_mt" diff --git a/Tools/TrfTestsART/test/test_trf_data16_mt.sh b/Tools/TrfTestsART/test/test_trf_data16_mt.sh index 4140256fe9eade608b547d11978657d250848e6d..e9aae2672a8ca7313f257c196bfa35cf4fb6f2a1 100755 --- a/Tools/TrfTestsART/test/test_trf_data16_mt.sh +++ b/Tools/TrfTestsART/test/test_trf_data16_mt.sh @@ -18,7 +18,7 @@ timeout 64800 Reco_tf.py --CA\ --preExec 'all:flags.DQ.Steering.doHLTMon=False; flags.Exec.FPE=10;' \ --autoConfiguration='everything' \ --conditionsTag 'all:CONDBR2-BLKPA-RUN2-11' --geometryVersion='default:ATLAS-R2-2016-01-00-01' \ - --runNumber='304008' --maxEvents='-1' + --runNumber='357750' --maxEvents='-1' rc1=$? echo "art-result: ${rc1} Reco_tf_data16_mt" diff --git a/Tools/TrfTestsART/test/test_trf_data17_mt.sh b/Tools/TrfTestsART/test/test_trf_data17_mt.sh index 75a51fa3ec8b07faaa039c8d91eb2c901d975583..f8ce383b48e96c01f525225c11ab105998c05f02 100755 --- a/Tools/TrfTestsART/test/test_trf_data17_mt.sh +++ b/Tools/TrfTestsART/test/test_trf_data17_mt.sh @@ -18,7 +18,7 @@ timeout 64800 Reco_tf.py --CA\ --preExec 'all:flags.DQ.Steering.doHLTMon=False; flags.Exec.FPE=10;' \ --autoConfiguration='everything' \ --conditionsTag 'all:CONDBR2-BLKPA-RUN2-11' --geometryVersion='default:ATLAS-R2-2016-01-00-01' \ - --runNumber='330470' --maxEvents='-1' + --runNumber='357750' --maxEvents='-1' rc1=$? echo "art-result: ${rc1} Reco_tf_data17_mt" diff --git a/Tools/TrfTestsARTPlots/test/test_trf_q443_phys_physlite_ca.sh b/Tools/TrfTestsARTPlots/test/test_trf_q443_phys_physlite_ca.sh index 18fadde9665db7e2e674dccf055f145fb878860f..a4d93c0d4b43e96f3eb3875fdfb99338dd60d61d 100755 --- a/Tools/TrfTestsARTPlots/test/test_trf_q443_phys_physlite_ca.sh +++ b/Tools/TrfTestsARTPlots/test/test_trf_q443_phys_physlite_ca.sh @@ -16,7 +16,7 @@ Reco_tf.py --CA "all:True" "RDOtoRDOTrigger:False" \ --athenaopts "HITtoRDO:--threads=${ATHENA_CORE_NUMBER} --nprocs=0" "RDOtoRDOTrigger:--threads=0 --nprocs=${ATHENA_CORE_NUMBER}" "RAWtoALL:--threads=${ATHENA_CORE_NUMBER} --nprocs=0" \ --preExec 'HITtoRDO:flags.Exec.FPE=10' 'RAWtoALL:flags.Exec.FPE=10' \ --postExec 'RDOtoRDOTrigger:from AthenaAuditors.AthenaAuditorsConf import FPEAuditor;FPEAuditor.NStacktracesOnFPE=10;' \ - --runNumber=410470 \ + --runNumber=310000 \ --DataRunNumber=310000 \ --maxEvents 2000 @@ -31,7 +31,7 @@ Reco_tf.py --CA \ --outputAODFile myAOD.pool.root \ --athenaopts "HITtoRDO:--threads=${ATHENA_CORE_NUMBER} --nprocs=0" "RDOtoRDOTrigger:--threads=0 --nprocs=${ATHENA_CORE_NUMBER}" "RAWtoALL:--threads=${ATHENA_CORE_NUMBER} --nprocs=0" \ --preExec 'flags.Exec.FPE=10' \ - --runNumber=410470 \ + --runNumber=310000 \ --DataRunNumber=310000 \ --maxEvents 2000 rcfail=$? diff --git a/Tools/TrfTestsARTPlots/test/test_trf_q445_phys_physlite_ca.sh b/Tools/TrfTestsARTPlots/test/test_trf_q445_phys_physlite_ca.sh index 654653cd4887068cf368491dcabcf15bca795498..248367faad5e280ef4f597eca4800197a63dad19 100755 --- a/Tools/TrfTestsARTPlots/test/test_trf_q445_phys_physlite_ca.sh +++ b/Tools/TrfTestsARTPlots/test/test_trf_q445_phys_physlite_ca.sh @@ -17,7 +17,7 @@ Reco_tf.py --CA \ --outputAODFile myAOD.pool.root \ --athenaopts "HITtoRDO:--threads=${ATHENA_CORE_NUMBER} --nprocs=0" "RDOtoRDOTrigger:--threads=${ATHENA_CORE_NUMBER} --nprocs=0" "RAWtoALL:--threads=${ATHENA_CORE_NUMBER} --nprocs=0" "AODtoDAOD:--threads=0 --nprocs=${ATHENA_CORE_NUMBER}" \ --preExec 'flags.Exec.FPE=10' \ - --runNumber=601229 \ + --runNumber=410000 \ --DataRunNumber=410000 \ --maxEvents 1000 diff --git a/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py b/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py index 052e3080ce8654b7e2301ea1d8de0f37a87f074b..bac2e0e1034ccd4ef9d747b7ace48a4e0149d01c 100644 --- a/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py +++ b/Tracking/Acts/ActsConfig/python/ActsConfigFlags.py @@ -41,10 +41,10 @@ def createActsConfigFlags(): actscf.addFlag('Acts.doAnalysis', False) # SpacePoint - actscf.addFlag("Acts.SpacePointStrategy", SpacePointStrategy.ActsTrk, type=SpacePointStrategy) # Define SpacePoint Strategy + actscf.addFlag("Acts.SpacePointStrategy", SpacePointStrategy.ActsTrk, enum=SpacePointStrategy) # Define SpacePoint Strategy # Seeding - actscf.addFlag("Acts.SeedingStrategy", SeedingStrategy.Default, type=SeedingStrategy) # Define Seeding Strategy + actscf.addFlag("Acts.SeedingStrategy", SeedingStrategy.Default, enum=SeedingStrategy) # Define Seeding Strategy # Track finding actscf.addFlag('Acts.doRotCorrection', True) @@ -59,7 +59,7 @@ def createActsConfigFlags(): # Track fitting actscf.addFlag('Acts.writeTrackCollection', False) # save to file (ESD, AOD) the Resolved and Refitted track collections actscf.addFlag('Acts.fitFromPRD', False) # Acts.writeTrackCollection needs to be True for either cases. If Acts.fitFromPRD is False, fit from ROT; else, fit from PRD - actscf.addFlag('Acts.trackFitterType', TrackFitterType.KalmanFitter, type=TrackFitterType) # Define Tracking algorithm for refitting + actscf.addFlag('Acts.trackFitterType', TrackFitterType.KalmanFitter, enum=TrackFitterType) # Define Tracking algorithm for refitting actscf.addFlag("Acts.useActsGsfInEgamma", False) diff --git a/Tracking/Acts/ActsEvent/ActsEvent/TrackContainer.h b/Tracking/Acts/ActsEvent/ActsEvent/TrackContainer.h index eca05dc3d51a6a51102b477f1ca76121f3b3773b..aea0bd04669de13c02910382b0bfd06e793128d3 100644 --- a/Tracking/Acts/ActsEvent/ActsEvent/TrackContainer.h +++ b/Tracking/Acts/ActsEvent/ActsEvent/TrackContainer.h @@ -6,11 +6,11 @@ #define ACTSTRKEVENT_TRACKCONTAINER_H 1 #include "ActsEvent/MultiTrajectory.h" -#include "ActsEvent/TrackSummaryContainer.h" +#include "ActsEvent/TrackStorageContainer.h" namespace ActsTrk { -using MutableTrackBackend = ActsTrk::MutableTrackSummaryContainer; -using TrackBackend = ActsTrk::TrackSummaryContainer; +using MutableTrackBackend = ActsTrk::MutableTrackStorageContainer; +using TrackBackend = ActsTrk::TrackStorageContainer; using MutableTrackStateBackend = ActsTrk::MutableMultiTrajectory; using TrackStateBackend = ActsTrk::MultiTrajectory; diff --git a/Tracking/Acts/ActsEvent/ActsEvent/TrackStorageContainer.h b/Tracking/Acts/ActsEvent/ActsEvent/TrackStorageContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..e6e091529210c802b5dbbb1dbba6c4df7cb4d145 --- /dev/null +++ b/Tracking/Acts/ActsEvent/ActsEvent/TrackStorageContainer.h @@ -0,0 +1,290 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef ActsEvent_TrackStorageContainer_h +#define ActsEvent_TrackStorageContainer_h +#include <type_traits> + +#include "Acts/EventData/TrackContainer.hpp" +#include "Acts/Surfaces/Surface.hpp" +#include "Acts/Utilities/HashedString.hpp" +#include "ActsEvent/Decoration.h" +#include "xAODTracking/TrackSummaryContainer.h" +#include "xAODTracking/TrackSummaryAuxContainer.h" +#include "xAODTracking/TrackSurfaceAuxContainer.h" +#include "xAODTracking/TrackSurfaceContainer.h" +#include "ActsEvent/SurfaceEncoding.h" +// #include "xAODTracking/TrackStorageContainer.h" +// #include "xAODTracking/TrackStorageAuxContainer.h" + + + +namespace ActsTrk { +class MutableTrackStorageContainer; +class TrackStorageContainer; +} // namespace ActsTrk + +namespace Acts { +class Surface; +template <typename T> +struct IsReadOnlyTrackContainer {}; + +template <typename T> +struct IsReadOnlyTrackContainer<T&> : IsReadOnlyTrackContainer<T> {}; + +template <typename T> +struct IsReadOnlyTrackContainer<T&&> : IsReadOnlyTrackContainer<T> {}; + +template <> +struct IsReadOnlyTrackContainer<ActsTrk::TrackStorageContainer> + : std::true_type {}; + +template <> +struct IsReadOnlyTrackContainer<ActsTrk::MutableTrackStorageContainer> + : std::false_type {}; + + +} // namespace Acts + +namespace ActsTrk { + +using ConstParameters = Acts::TrackStateTraits<3>::Parameters; +using ConstCovariance = Acts::TrackStateTraits<3>::Covariance; +using Parameters = Acts::TrackStateTraits<3, false>::Parameters; +using Covariance = Acts::TrackStateTraits<3, false>::Covariance; + +class MutableTrackStorageContainer; + +class TrackStorageContainer { + public: + using IndexType = uint32_t; // TODO find common place for it + static constexpr auto kInvalid = Acts::MultiTrajectoryTraits::kInvalid; + TrackStorageContainer(const DataLink<xAOD::TrackSummaryContainer>& lin = nullptr, + const DataLink<xAOD::TrackSurfaceAuxContainer>& surfLink = nullptr); + static const std::set<std::string> staticVariables; + /** + * return true if the container has specific decoration + */ + constexpr bool hasColumn_impl(Acts::HashedString key) const; + + /** + * return pointer to reference surface + */ + const Acts::Surface* referenceSurface_impl(ActsTrk::IndexType itrack) const; + + /** + * return pointer to reference surface + */ + Acts::ParticleHypothesis particleHypothesis_impl(IndexType itrack) const; + + /** + * returns number of stored tracks + */ + std::size_t size_impl() const; + + /** + * access to components by pointer with type + */ + std::any component_impl(Acts::HashedString key, + ActsTrk::IndexType itrack) const; + + /** + * parameters of the track + */ + ActsTrk::ConstParameters parameters(ActsTrk::IndexType itrack) const; + + /** + * covariance of the track fit + */ + ActsTrk::ConstCovariance covariance(ActsTrk::IndexType itrack) const; + + /** + * surface + */ + std::shared_ptr<const Acts::Surface> surface(ActsTrk::IndexType itrack) const; + + void fillFrom(ActsTrk::MutableTrackStorageContainer& mtb); + + template<typename T> + friend class MutableTrackContainerHandle; + friend class MutableTrackStorageContainer; + + void restoreDecorations(); + + const xAOD::TrackSummaryContainer* trackBackend() const{ + return m_trackBackend.cptr(); + } + + protected: + + DataLink<xAOD::TrackSummaryContainer> m_trackBackend = nullptr; + DataLink<xAOD::TrackSurfaceAuxContainer> m_surfBackendAux = nullptr; + + std::vector<ActsTrk::detail::Decoration> m_decorations; + + std::vector<std::shared_ptr<const Acts::Surface>> m_surfaces; + std::vector<Acts::ParticleHypothesis> m_particleHypothesis; // TODO move the storage to the backend +}; + +class MutableTrackStorageContainer : public TrackStorageContainer { + public: + MutableTrackStorageContainer(); + MutableTrackStorageContainer(const MutableTrackStorageContainer&) = delete; + MutableTrackStorageContainer operator=(const MutableTrackStorageContainer&) = delete; + MutableTrackStorageContainer(MutableTrackStorageContainer&&) noexcept; + + /** + * adds new surface to the tail of the container + */ + ActsTrk::IndexType addSurface_impl(); + + /** + * clears surface data under index + */ + void removeSurface_impl(ActsTrk::IndexType isurf); + + /** + * adds new track to the tail of the container + */ + ActsTrk::IndexType addTrack_impl(); + + /** + * clears track data under index + */ + void removeTrack_impl(ActsTrk::IndexType itrack); + + /** + * enables the container to support decoration of given name and type + */ + template <typename T> + constexpr void addColumn_impl(const std::string& key); + + /** + * copies decorations from other container + */ + void copyDynamicFrom_impl (ActsTrk::IndexType itrack, + const ActsTrk::TrackStorageContainer& other, + ActsTrk::IndexType other_itrack); + + + /** + * write access to decorations + */ + std::any component_impl(Acts::HashedString key, + ActsTrk::IndexType itrack); + using TrackStorageContainer::component_impl; + + /** + * write access to parameters + */ + ActsTrk::Parameters parameters(ActsTrk::IndexType itrack); + using TrackStorageContainer::parameters; + + /** + * write access to covariance + */ + ActsTrk::Covariance covariance(ActsTrk::IndexType itrack); + using TrackStorageContainer::covariance; + + /** + * synchronizes decorations + */ + void ensureDynamicColumns_impl(const MutableTrackStorageContainer& other); + void ensureDynamicColumns_impl(const TrackStorageContainer& other); + + /** + * preallocate number of track objects + */ + void reserve(ActsTrk::IndexType size); + + /** + * zeroes container + */ + void clear(); + + /** + * point given track to surface + * The surface ownership is shared + */ + void setReferenceSurface_impl(ActsTrk::IndexType itrack, + std::shared_ptr<const Acts::Surface> surface); + /** + * sets particle hypothesis + * @warning it will fail for an arbitrary particles as it converts to + * a predefined set (@see xAOD::ParticleHypothesis in TrackingPrimitives.h) of values + */ + void setParticleHypothesis_impl(ActsTrk::IndexType itrack, + const Acts::ParticleHypothesis& particleHypothesis); + + template<typename T> + friend class MutableTrackContainerHandle; + + + xAOD::TrackSummaryContainer* trackBackend(){ + return m_mutableTrackBackend.get(); + } + + xAOD::TrackSurfaceContainer* surfBackend(){ + return m_mutableSurfBackend.get(); + } + + private: + std::unique_ptr<xAOD::TrackSummaryContainer> m_mutableTrackBackend; + std::unique_ptr<xAOD::TrackSummaryAuxContainer> m_mutableTrackBackendAux; + + std::unique_ptr<xAOD::TrackSurfaceContainer> m_mutableSurfBackend; + std::unique_ptr<xAOD::TrackSurfaceAuxContainer> m_mutableSurfBackendAux; +}; + + +constexpr bool ActsTrk::TrackStorageContainer::hasColumn_impl( + Acts::HashedString key) const { + using namespace Acts::HashedStringLiteral; + switch (key) { + case "params"_hash: + case "cov"_hash: + case "nMeasurements"_hash: + case "nHoles"_hash: + case "d0"_hash: + case "chi2"_hash: + case "ndf"_hash: + case "nOutliers"_hash: + case "hSharedHits"_hash: + case "tipIndex"_hash: + case "stemIndex"_hash: + + return true; + } + for (auto& d : m_decorations) { + if (d.hash == key) { + return true; + } + } + return false; +} + +namespace details{ +} // EOF detail + +template <typename T> +constexpr void MutableTrackStorageContainer::addColumn_impl( + const std::string& name) { + if (not ActsTrk::detail::accepted_decoration_types<T>::value) { + throw std::runtime_error( + "TrackStorageContainer::addColumn_impl: " + "unsupported decoration type"); + } + m_decorations.emplace_back(ActsTrk::detail::decoration<T>( + name, + ActsTrk::detail::constDecorationGetter<T>, + ActsTrk::detail::decorationCopier<T>, + ActsTrk::detail::decorationSetter<T> + )); +} + +} // namespace ActsTrk + +#include "AthenaKernel/CLASS_DEF.h" +CLASS_DEF( ActsTrk::TrackStorageContainer , 1333051576 , 1 ) + +#endif diff --git a/Tracking/Acts/ActsEvent/Root/TrackStorageContainer.cxx b/Tracking/Acts/ActsEvent/Root/TrackStorageContainer.cxx new file mode 100644 index 0000000000000000000000000000000000000000..26836fdeec2d57fc4c7cfca638c19c0b7bda366c --- /dev/null +++ b/Tracking/Acts/ActsEvent/Root/TrackStorageContainer.cxx @@ -0,0 +1,262 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include "ActsEvent/TrackStorageContainer.h" +#include "xAODTracking/TrackSummary.h" +#include "ActsEvent/ParticleHypothesisEncoding.h" + +// this is list of xAOD container varaible names that are "hardcoded" in TrackStorage_v1 +// their compatibility is maintained by the unit tests: AllStaticxAODVaraiblesAreKnown +const std::set<std::string> ActsTrk::TrackStorageContainer::staticVariables = { + "params", "covParams", "nMeasurements", "nHoles", "chi2f", + "ndf", "nOutliers", "nSharedHits", "tipIndex", "stemIndex", + "particleHypothesis"}; + + +ActsTrk::TrackStorageContainer::TrackStorageContainer( + const DataLink<xAOD::TrackSummaryContainer>& link, + const DataLink<xAOD::TrackSurfaceAuxContainer>& surfLink) + : m_trackBackend(link), m_surfBackendAux(surfLink) {} + +const Acts::Surface* ActsTrk::TrackStorageContainer::referenceSurface_impl( + ActsTrk::IndexType itrack) const { + if (itrack >= m_surfaces.size()) + throw std::out_of_range( + "TrackStorageContainer index out of range when accessing reference " + "surface"); + return m_surfaces[itrack].get(); +} + +Acts::ParticleHypothesis ActsTrk::TrackStorageContainer::particleHypothesis_impl(IndexType itrack) const{ + return ActsTrk::ParticleHypothesis::convert( static_cast<xAOD::ParticleHypothesis>(m_trackBackend->at(itrack)->particleHypothesis())); +} + +std::size_t ActsTrk::TrackStorageContainer::size_impl() const { + return m_trackBackend->size(); +} + +namespace { +template <typename C> +std::any component_impl(C& container, Acts::HashedString key, + ActsTrk::IndexType itrack) { + using namespace Acts::HashedStringLiteral; + switch (key) { + case "nMeasurements"_hash: + return container.at(itrack)->nMeasurementsPtr(); + case "nHoles"_hash: + return container.at(itrack)->nHolesPtr(); + case "chi2"_hash: + return container.at(itrack)->chi2fPtr(); + case "ndf"_hash: + return container.at(itrack)->ndfPtr(); + case "nOutliers"_hash: + return container.at(itrack)->nOutliersPtr(); + case "nSharedHits"_hash: + return container.at(itrack)->nSharedHitsPtr(); + case "tipIndex"_hash: + return container.at(itrack)->tipIndexPtr(); + case "stemIndex"_hash: + return container.at(itrack)->stemIndexPtr(); + + default: + return std::any(); + } +} +} // namespace + +std::any ActsTrk::TrackStorageContainer::component_impl( + Acts::HashedString key, ActsTrk::IndexType itrack) const { + std::any result = ::component_impl(*m_trackBackend, key, itrack); + if (result.has_value()) { + return result; + } + using namespace Acts::HashedStringLiteral; + if (key == "particleHypothesis"_hash) { + return &m_particleHypothesis[itrack]; + } + for (auto& d : m_decorations) { + if (d.hash == key) { + // TODO the dynamic case will be eliminated once we switch to use Aux containers directly + return d.getter(m_trackBackend->getStore(), itrack, d.auxid); + } + } + throw std::runtime_error("TrackStorageContainer no such component " + + std::to_string(key)); +} + +ActsTrk::ConstParameters ActsTrk::TrackStorageContainer::parameters( + ActsTrk::IndexType itrack) const { + return m_trackBackend->at(itrack)->paramsEigen(); +} + +ActsTrk::ConstCovariance ActsTrk::TrackStorageContainer::covariance( + ActsTrk::IndexType itrack) const { + return m_trackBackend->at(itrack)->covParamsEigen(); +} + +std::shared_ptr<const Acts::Surface> ActsTrk::TrackStorageContainer::surface( + ActsTrk::IndexType itrack) const { + const ActsGeometryContext& geoContext{}; + return decodeSurface( m_surfBackendAux.cptr(), itrack, geoContext ); +} + +void ActsTrk::TrackStorageContainer::fillFrom( + ActsTrk::MutableTrackStorageContainer& mtb) { + m_surfaces = std::move(mtb.m_surfaces); + m_particleHypothesis = std::move(mtb.m_particleHypothesis); +} + + + +void ActsTrk::TrackStorageContainer::restoreDecorations() { + m_decorations = ActsTrk::detail::restoreDecorations(m_trackBackend->getConstStore(), staticVariables); +} + + +//////////////////////////////////////////////////////////////////// +// write api +//////////////////////////////////////////////////////////////////// +ActsTrk::MutableTrackStorageContainer::MutableTrackStorageContainer() { + + m_mutableTrackBackend = std::make_unique<xAOD::TrackSummaryContainer>(); + m_mutableTrackBackendAux = std::make_unique<xAOD::TrackSummaryAuxContainer>(); + m_mutableTrackBackend->setStore(m_mutableTrackBackendAux.get()); + + TrackStorageContainer::m_trackBackend = m_mutableTrackBackend.get(); + m_mutableSurfBackend = std::make_unique<xAOD::TrackSurfaceContainer>(); + m_mutableSurfBackendAux = std::make_unique<xAOD::TrackSurfaceAuxContainer>(); + m_mutableSurfBackend->setStore(m_mutableSurfBackendAux.get()); + + TrackStorageContainer::m_surfBackendAux = m_mutableSurfBackendAux.get(); +} + +ActsTrk::MutableTrackStorageContainer::MutableTrackStorageContainer( + MutableTrackStorageContainer&& other) noexcept { + m_mutableTrackBackend = std::move(other.m_mutableTrackBackend); + m_mutableTrackBackendAux = std::move(other.m_mutableTrackBackendAux); + m_mutableTrackBackend->setStore(m_mutableTrackBackendAux.get()); + TrackStorageContainer::m_trackBackend = m_mutableTrackBackend.get(); + + m_mutableSurfBackend = std::move(other.m_mutableSurfBackend); + m_mutableSurfBackendAux = std::move(other.m_mutableSurfBackendAux); + m_mutableSurfBackend->setStore(m_mutableSurfBackendAux.get()); + TrackStorageContainer::m_surfBackendAux = m_mutableSurfBackendAux.get(); + + m_surfaces = std::move(other.m_surfaces); + m_particleHypothesis = std::move(other.m_particleHypothesis); + m_decorations = std::move(other.m_decorations); +} + +ActsTrk::IndexType ActsTrk::MutableTrackStorageContainer::addTrack_impl() { + m_mutableTrackBackend->push_back(std::make_unique<xAOD::TrackSummary>()); + m_mutableTrackBackend->back()->resize(); + m_particleHypothesis.resize(m_mutableTrackBackend->size(), + Acts::ParticleHypothesis::pion()); + return m_mutableTrackBackend->size() - 1; +} + +void ActsTrk::MutableTrackStorageContainer::removeTrack_impl( + ActsTrk::IndexType itrack) { + if (itrack >= m_mutableTrackBackend->size()) { + throw std::out_of_range("removeTrack_impl"); + } + m_mutableTrackBackend->erase(m_mutableTrackBackend->begin() + itrack); +} + +// Add and remove surface +ActsTrk::IndexType ActsTrk::MutableTrackStorageContainer::addSurface_impl() { + m_mutableSurfBackendAux->resize(m_mutableSurfBackendAux->size()+1); + return m_mutableSurfBackendAux->size() - 1; +} + +void ActsTrk::MutableTrackStorageContainer::removeSurface_impl( + ActsTrk::IndexType isurf) { + if (isurf >= m_mutableSurfBackendAux->size()) { + throw std::out_of_range("removeSurface_impl"); + } + // TODO find a more generic way to do this (possible issue may sneak ins when adding more variables to backend) + for (auto i = isurf; i < m_mutableSurfBackendAux->size()-1; ++i) { + m_mutableSurfBackendAux->surfaceType[i] = m_mutableSurfBackendAux->surfaceType[i+1]; + m_mutableSurfBackendAux->translation[i] = m_mutableSurfBackendAux->translation[i+1]; + m_mutableSurfBackendAux->rotation[i] = m_mutableSurfBackendAux->rotation[i+1]; + m_mutableSurfBackendAux->boundValues[i] = m_mutableSurfBackendAux->boundValues[i+1]; + } + m_mutableSurfBackendAux->resize(m_mutableSurfBackendAux->size()-1); +} + + + +// this in fact may be a copy from other MutableTrackStorageContainer +void ActsTrk::MutableTrackStorageContainer::copyDynamicFrom_impl( + ActsTrk::IndexType itrack, const ActsTrk::TrackStorageContainer& other, + ActsTrk::IndexType other_itrack) { + std::set<std::string> usedDecorations; + for ( const auto& other_decor: other.m_decorations) { + if ( staticVariables.count(other_decor.name) == 1) { continue; } + // TODO dynamic cast will disappear + other_decor.copier(m_mutableTrackBackendAux.get(), itrack, other_decor.auxid, other.trackBackend()->getStore(), + other_itrack); + } +} + +std::any ActsTrk::MutableTrackStorageContainer::component_impl( + Acts::HashedString key, ActsTrk::IndexType itrack) { + std::any result = ::component_impl(*m_mutableTrackBackend, key, itrack); + if (result.has_value()) { + return result; + } + using namespace Acts::HashedStringLiteral; + if (key == "particleHypothesis"_hash) { + return &m_particleHypothesis[itrack]; + } + for (auto& d : m_decorations) { + if (d.hash == key) { + return d.setter(m_mutableTrackBackendAux.get(), itrack, d.auxid); + } + } + throw std::runtime_error("TrackStorageContainer no such component " + + std::to_string(key)); +} + +ActsTrk::Parameters ActsTrk::MutableTrackStorageContainer::parameters( + ActsTrk::IndexType itrack) { + return m_mutableTrackBackend->at(itrack)->paramsEigen(); +} + +ActsTrk::Covariance ActsTrk::MutableTrackStorageContainer::covariance( + ActsTrk::IndexType itrack) { + return m_mutableTrackBackend->at(itrack)->covParamsEigen(); +} + +void ActsTrk::MutableTrackStorageContainer::ensureDynamicColumns_impl( + const MutableTrackStorageContainer& other) { + for (auto& d : other.m_decorations) { + m_decorations.push_back(d); + } +} + +void ActsTrk::MutableTrackStorageContainer::ensureDynamicColumns_impl( + const TrackStorageContainer& other) { + for (auto& d : other.m_decorations) { + m_decorations.push_back(d); + } +} + +void ActsTrk::MutableTrackStorageContainer::reserve(ActsTrk::IndexType size) { + m_mutableTrackBackend->reserve(size); +} + +void ActsTrk::MutableTrackStorageContainer::clear() { + m_mutableTrackBackend->clear(); + m_surfaces.clear(); +} + +void ActsTrk::MutableTrackStorageContainer::setReferenceSurface_impl( + ActsTrk::IndexType itrack, std::shared_ptr<const Acts::Surface> surface) { + m_surfaces.resize(itrack + 1, nullptr); + m_surfaces[itrack] = std::move(surface); +} + +void ActsTrk::MutableTrackStorageContainer::setParticleHypothesis_impl(ActsTrk::IndexType itrack, const Acts::ParticleHypothesis& particleHypothesis) { + m_mutableTrackBackend->at(itrack)->setParticleHypothesis(ActsTrk::ParticleHypothesis::convert(particleHypothesis)); +} diff --git a/Tracking/Acts/ActsEvent/test/TrackStorageContainer_test.cxx b/Tracking/Acts/ActsEvent/test/TrackStorageContainer_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d11036522c199b3b31407724ac8d62b30368e713 --- /dev/null +++ b/Tracking/Acts/ActsEvent/test/TrackStorageContainer_test.cxx @@ -0,0 +1,205 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ +#include <boost/test/tools/old/interface.hpp> +#undef NDEBUG +#define BOOST_TEST_MODULE MultiTrajectoryBasic_test +#include <boost/test/data/test_case.hpp> +#include <boost/test/included/unit_test.hpp> +#include <Acts/EventData/TrackContainer.hpp> + +#include "ActsEvent/MultiTrajectory.h" +#include "ActsEvent/TrackStorageContainer.h" +#include "xAODTracking/TrackSummaryContainer.h" +#include "xAODTracking/TrackSummaryAuxContainer.h" + +#include "xAODTracking/TrackSummary.h" +#include "xAODTracking/TrackSurface.h" +#include "xAODTracking/TrackSurfaceContainer.h" +#include "xAODTracking/TrackSurfaceAuxContainer.h" + + +BOOST_AUTO_TEST_SUITE(EventDataTrackStorage) + +BOOST_AUTO_TEST_CASE(ConstCompilesWithInterface) { + ACTS_STATIC_CHECK_CONCEPT(Acts::ConstTrackContainerBackend, + ActsTrk::TrackStorageContainer); +} + +BOOST_AUTO_TEST_CASE(MutableCompilesWithInterface) { + ACTS_STATIC_CHECK_CONCEPT(Acts::TrackContainerBackend, + ActsTrk::MutableTrackStorageContainer); + + using MutableTrackContainer = Acts::TrackContainer<ActsTrk::MutableTrackStorageContainer, ActsTrk::MutableMultiTrajectory>; +} + +struct EmptyBackend { + EmptyBackend() { + m = std::make_unique<ActsTrk::MutableTrackStorageContainer>(); + } + std::unique_ptr<ActsTrk::MutableTrackStorageContainer> m; +}; + +BOOST_FIXTURE_TEST_CASE(AllStaticxAODVaraiblesAreKnown, EmptyBackend) { + for (auto id : m->trackBackend()->getConstStore()->getAuxIDs()) { + const std::string name = SG::AuxTypeRegistry::instance().getName(id); + BOOST_CHECK( ActsTrk::TrackStorageContainer::staticVariables.count(name) == 1); + } + BOOST_CHECK( m->trackBackend()->getConstStore()->getAuxIDs().size() == ActsTrk::TrackStorageContainer::staticVariables.size()); +} + + +struct FilledBackend : public EmptyBackend { + FilledBackend() + { + m->addColumn_impl<short>("author"); + m->addTrack_impl(); + + using namespace Acts::HashedStringLiteral; + *std::any_cast<float*>(m->component_impl("chi2"_hash, 0)) = 2.5f; + *std::any_cast<ActsTrk::IndexType*>(m->component_impl("tipIndex"_hash, 0)) = 8; + *std::any_cast<unsigned int*>(m->component_impl("nHoles"_hash, 0)) = 2; + *std::any_cast<short*>(m->component_impl("author"_hash, 0)) = 77; + m->addTrack_impl(); + } +}; + + + +BOOST_FIXTURE_TEST_CASE(BareContainerFill, FilledBackend) { + using namespace Acts::HashedStringLiteral; + + BOOST_CHECK_EQUAL(m->size_impl(), 2); + BOOST_CHECK(m->hasColumn_impl("author"_hash)); + BOOST_CHECK(m->hasColumn_impl("tipIndex"_hash)); + + BOOST_CHECK(m->hasColumn_impl("z0"_hash) == false); + + BOOST_CHECK_EQUAL(*std::any_cast<float*>(m->component_impl("chi2"_hash, 0)), 2.5f); + BOOST_CHECK_EQUAL(*std::any_cast<unsigned int*>(m->component_impl("nHoles"_hash, 0)), 2); + BOOST_CHECK_EQUAL(*std::any_cast<short*>(m->component_impl("author"_hash, 0)), 77); + BOOST_CHECK_EQUAL(*std::any_cast<ActsTrk::IndexType*>(m->component_impl("tipIndex"_hash, 0)), 8); + + BOOST_CHECK_EQUAL(*std::any_cast<float*>(m->component_impl("chi2"_hash, 1)), 0.0f); + BOOST_CHECK_EQUAL(*std::any_cast<unsigned int*>(m->component_impl("nHoles"_hash, 1)), 0); + BOOST_CHECK_EQUAL(*std::any_cast<short*>(m->component_impl("author"_hash, 1)), 0); + BOOST_CHECK_EQUAL(*std::any_cast<ActsTrk::IndexType*>(m->component_impl("tipIndex"_hash, 1)), 0); + +} + + +BOOST_FIXTURE_TEST_CASE(ImmutableAccess, FilledBackend) { + using namespace Acts::HashedStringLiteral; + + auto c = std::make_unique<ActsTrk::TrackStorageContainer>(m->trackBackend()); + c->restoreDecorations(); + BOOST_CHECK_EQUAL(c->size_impl(), 2); + BOOST_CHECK(c->hasColumn_impl("author"_hash)); + BOOST_CHECK(c->hasColumn_impl("z0"_hash) == false); + + BOOST_CHECK_EQUAL(*std::any_cast<const float*>(c->component_impl("chi2"_hash, 0)), 2.5f); + BOOST_CHECK_EQUAL(*std::any_cast<const unsigned int*>(c->component_impl("nHoles"_hash, 0)), 2); + + BOOST_CHECK_EQUAL(*std::any_cast<const short*>(c->component_impl("author"_hash, 0)), 77); + + BOOST_CHECK_EQUAL(*std::any_cast<const float*>(c->component_impl("chi2"_hash, 1)), 0.0f); + BOOST_CHECK_EQUAL(*std::any_cast<const unsigned int*>(c->component_impl("nHoles"_hash, 1)), 0); + BOOST_CHECK_EQUAL(*std::any_cast<const short*>(c->component_impl("author"_hash, 1)), 0); + + +} + + +///////////////////////////////////////////////////////////////////// +// Test of TrackSurfaceContainer in mutable TrackStorageContainer + +BOOST_FIXTURE_TEST_CASE(MutableSurfaceBackend_test, FilledBackend){ + +//TODO: Here the empty surface is created. Tests of surfase filling are needed + + auto i = m->addSurface_impl(); + BOOST_CHECK_EQUAL(i, 0); + + i = m->addSurface_impl(); + BOOST_CHECK_EQUAL(i, 1); + + m->removeSurface_impl(i); + i = m->addSurface_impl(); + BOOST_CHECK_EQUAL(i, 1); +}; + + +template<typename surfType> +void testSurface(surfType surf, std::shared_ptr<const Acts::Surface> outSurf, const ActsGeometryContext& gctx) { + BOOST_CHECK_EQUAL(int(surf->type()), int(outSurf->type())); + BOOST_CHECK_EQUAL(surf->center(gctx.context()), outSurf->center(gctx.context())); + BOOST_CHECK_EQUAL(surf->transform(gctx.context()).rotation().eulerAngles(2, 1, 0), + outSurf->transform(gctx.context()).rotation().eulerAngles(2, 1, 0)); + BOOST_CHECK_EQUAL(size(surf->bounds().values()), size(outSurf->bounds().values())); + for (unsigned int i=0; i<size(surf->bounds().values()); i++) { + BOOST_TEST(surf->bounds().values()[i] == outSurf->bounds().values()[i], boost::test_tools::tolerance(0.001)); + } +} + + +// Test of const TrackStorageContainer with TrackSurfaceContainer +BOOST_AUTO_TEST_CASE(ConstSurfaceBackend_test){ + + // Create filled xAOD::TrackSummaryContainer + constexpr static size_t sz = 6; + + xAOD::TrackSummaryContainer backend; + xAOD::TrackSummaryAuxContainer aux; + backend.setStore(&aux); + + std::vector<double> semirandoms = {0.12, 0.92}; + for (const double sr : semirandoms) { + auto par = new xAOD::TrackSummary(); + backend.push_back(par); + par->resize(); + for ( size_t i = 0; i < sz; ++i) { + par->paramsEigen()(i) = i * sr; + for ( size_t j = 0; j < sz; ++j) { + par->covParamsEigen()(i, j) = (i+j) * sr; + } + } + } + + + // Create filled xAOD::TrackSurfaceContainer + const ActsGeometryContext& gctx{}; + + float layerZ = 30.; + Acts::Transform3 transform(Acts::Translation3(0., 0., -layerZ)); + float rotation[3] = {2.1, 1.2, 0.4}; + transform *= Acts::AngleAxis3(rotation[0], Acts::Vector3(0., 0., 1.)); //rotZ + transform *= Acts::AngleAxis3(rotation[1], Acts::Vector3(0., 1., 0.)); //rotY + transform *= Acts::AngleAxis3(rotation[2], Acts::Vector3(1., 0., 0.)); //rotX + + xAOD::TrackSurfaceContainer surfBackend; + xAOD::TrackSurfaceAuxContainer aux0; + surfBackend.setStore(&aux0); + + auto surfCurr = new xAOD::TrackSurface(); + surfBackend.push_back(surfCurr); + + // create the ConeSurface + double alpha(M_PI/4.), minZ(5.), maxZ(25), halfPhi(M_PI); + auto surf = Acts::Surface::makeShared<Acts::ConeSurface>( + transform, alpha, minZ, maxZ, halfPhi); + ActsTrk::encodeSurface(surfCurr, surf.get(), gctx); + + // Create constant ActsTrk::TrackStorageContainer + std::unique_ptr<ActsTrk::TrackStorageContainer> ms = std::make_unique<ActsTrk::TrackStorageContainer>(&backend, &aux0); + + // Read the ActsTrk::TrackStorageContainer and check track storage and track surfaces + auto cc = std::make_unique<ActsTrk::TrackStorageContainer>(ms->trackBackend()); + BOOST_CHECK_EQUAL(cc->size_impl(), 2); + + auto outSurf = ActsTrk::decodeSurface(surfBackend[0], gctx); + testSurface(surf, outSurf, gctx); + +}; + + +BOOST_AUTO_TEST_SUITE_END() diff --git a/Tracking/Acts/ActsGeometry/scripts/RunActsWriteTrackingGeometry.py b/Tracking/Acts/ActsGeometry/scripts/RunActsWriteTrackingGeometry.py index 1615c0d3e625e113647e98f8a15a74b83f20ac75..9c8c92de3d1142a490a5d03b325b17a9d301332f 100644 --- a/Tracking/Acts/ActsGeometry/scripts/RunActsWriteTrackingGeometry.py +++ b/Tracking/Acts/ActsGeometry/scripts/RunActsWriteTrackingGeometry.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration #!/usr/bin/env python """ @@ -6,10 +6,13 @@ Dump ACTS tracking geometry. """ +from AthenaCommon.Configurable import Configurable from AthenaCommon.Logging import log from argparse import ArgumentParser from AthenaConfiguration.AllConfigFlags import initConfigFlags +Configurable.configurableRun3Behavior = True + # Argument parsing parser = ArgumentParser("RunActsWriteTrackingGeometry.py") parser.add_argument("detectors", metavar="detectors", type=str, nargs="*", @@ -94,3 +97,5 @@ cfg.merge(FPEAndCoreDumpCfg(flags)) cfg.printConfig(withDetails = True, summariseProps = True) cfg.run(1) + + diff --git a/Tracking/Acts/ActsToolInterfaces/ActsToolInterfaces/IFitterTool.h b/Tracking/Acts/ActsToolInterfaces/ActsToolInterfaces/IFitterTool.h index 1189cc88ccd3745f0259d52be62683eb793cc9e0..7244a4b559919b5fa4436aa7d713599a3b6d945f 100644 --- a/Tracking/Acts/ActsToolInterfaces/ActsToolInterfaces/IFitterTool.h +++ b/Tracking/Acts/ActsToolInterfaces/ActsToolInterfaces/IFitterTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ #ifndef ACTSTOOLINTERFACES_IFITTERTOOL_H @@ -9,7 +9,6 @@ #include "GaudiKernel/EventContext.h" #include "ActsGeometry/TrackingSurfaceHelper.h" -#include "ActsGeometry/ATLASSourceLink.h" #include "ActsEvent/TrackContainer.h" #include "ActsEvent/Seed.h" @@ -17,8 +16,7 @@ #include "Acts/Geometry/GeometryContext.hpp" #include "Acts/MagneticField/MagneticFieldContext.hpp" #include "Acts/Utilities/CalibrationContext.hpp" -#include "xAODMeasurementBase/UncalibratedMeasurement.h" -#include "TrkTrack/Track.h" + namespace ActsTrk { class IFitterTool : virtual public IAlgTool { @@ -34,18 +32,6 @@ namespace ActsTrk { const Acts::MagneticFieldContext& mfContext, const Acts::CalibrationContext& calContext, const TrackingSurfaceHelper &tracking_surface_helper) const = 0; - - /// @brief development interface for EF tracking usage. - virtual - std::unique_ptr< ActsTrk::MutableTrackContainer > - fit(const EventContext& ctx, - const std::vector<ActsTrk::ATLASUncalibSourceLink> & clusterList, - const Acts::BoundTrackParameters& initialParams, - const Acts::GeometryContext& tgContext, - const Acts::MagneticFieldContext& mfContext, - const Acts::CalibrationContext& calContext, - const TrackingSurfaceHelper &tracking_surface_helper, - const Acts::Surface* targetSurface = nullptr) const = 0; }; } diff --git a/Tracking/Acts/ActsTrackReconstruction/src/KalmanFitter.cxx b/Tracking/Acts/ActsTrackReconstruction/src/KalmanFitter.cxx index d3e0219cc3297967d660d5cbd28660abe3e3795b..1b603ca319d6e01ff891a71d11691d6122622209 100644 --- a/Tracking/Acts/ActsTrackReconstruction/src/KalmanFitter.cxx +++ b/Tracking/Acts/ActsTrackReconstruction/src/KalmanFitter.cxx @@ -1,8 +1,8 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#include "KalmanFitter.h" +#include "ActsKalmanFitter.h" // ATHENA #include "GaudiKernel/ListItem.h" @@ -168,12 +168,12 @@ const Acts::Surface* PRDSourceLinkSurfaceAccessor::operator()(const Acts::Source return &actsSrf; } -KalmanFitter::KalmanFitter(const std::string& t,const std::string& n, - const IInterface* p) : +ActsKalmanFitter::ActsKalmanFitter(const std::string& t,const std::string& n, + const IInterface* p) : base_class(t,n,p) {} -StatusCode KalmanFitter::initialize() { +StatusCode ActsKalmanFitter::initialize() { ATH_MSG_DEBUG(name() << "::" << __FUNCTION__); ATH_CHECK(m_trackingGeometryTool.retrieve()); @@ -185,7 +185,7 @@ StatusCode KalmanFitter::initialize() { ATH_CHECK(m_broadROTcreator.retrieve()); } - m_logger = makeActsAthenaLogger(this, "KalmanRefit"); + m_logger = makeActsAthenaLogger(this, "ActsKalmanRefit"); auto field = std::make_shared<ATLASMagneticFieldWrapper>(); @@ -226,10 +226,10 @@ StatusCode KalmanFitter::initialize() { // refit a track // ------------------------------------------------------- std::unique_ptr<Trk::Track> -KalmanFitter::fit(const EventContext& ctx, - const Trk::Track& inputTrack, - const Trk::RunOutlierRemoval /*runOutlier*/, - const Trk::ParticleHypothesis /*prtHypothesis*/) const +ActsKalmanFitter::fit(const EventContext& ctx, + const Trk::Track& inputTrack, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*prtHypothesis*/) const { std::unique_ptr<Trk::Track> track = nullptr; ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,,) with Track from author = " @@ -309,11 +309,11 @@ KalmanFitter::fit(const EventContext& ctx, // fit a set of MeasurementBase objects // -------------------------------- std::unique_ptr<Trk::Track> -KalmanFitter::fit(const EventContext& ctx, - const Trk::MeasurementSet& inputMeasSet, - const Trk::TrackParameters& estimatedStartParameters, - const Trk::RunOutlierRemoval /*runOutlier*/, - const Trk::ParticleHypothesis /*matEffects*/) const +ActsKalmanFitter::fit(const EventContext& ctx, + const Trk::MeasurementSet& inputMeasSet, + const Trk::TrackParameters& estimatedStartParameters, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*matEffects*/) const { std::unique_ptr<Trk::Track> track = nullptr; @@ -374,13 +374,13 @@ KalmanFitter::fit(const EventContext& ctx, // fit a set of PrepRawData objects // -------------------------------- std::unique_ptr<Trk::Track> -KalmanFitter::fit(const EventContext& ctx, - const Trk::PrepRawDataSet& inputPRDColl, - const Trk::TrackParameters& estimatedStartParameters, - const Trk::RunOutlierRemoval /*runOutlier*/, - const Trk::ParticleHypothesis /*prtHypothesis*/) const +ActsKalmanFitter::fit(const EventContext& ctx, + const Trk::PrepRawDataSet& inputPRDColl, + const Trk::TrackParameters& estimatedStartParameters, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*prtHypothesis*/) const { - ATH_MSG_DEBUG("--> entering KalmanFitter::fit(PRDS,TP,)"); + ATH_MSG_DEBUG("--> entering ActsKalmanFitter::fit(PRDS,TP,)"); std::unique_ptr<Trk::Track> track = nullptr; @@ -441,82 +441,16 @@ KalmanFitter::fit(const EventContext& ctx, return track; } -// fit a set of PrepRawData objects -// -------------------------------- -std::unique_ptr< ActsTrk::MutableTrackContainer > -KalmanFitter::fit(const EventContext& , - const std::vector< ActsTrk::ATLASUncalibSourceLink> & clusterList, - const Acts::BoundTrackParameters& initialParams, - const Acts::GeometryContext& tgContext, - const Acts::MagneticFieldContext& mfContext, - const Acts::CalibrationContext& calContext, - const TrackingSurfaceHelper &tracking_surface_helper, - const Acts::Surface* targetSurface) const{ - ATH_MSG_DEBUG("--> entering KalmanFitter::fit(xAODMeasure...things,TP,)"); - - std::vector<Acts::SourceLink> sourceLinks; - sourceLinks.reserve(clusterList.size()); - - std::vector<const Acts::Surface*> surfaces; - surfaces.reserve(clusterList.size()); - - for (const ActsTrk::ATLASUncalibSourceLink& el : clusterList) { - sourceLinks.emplace_back( el ); - surfaces.push_back(&tracking_surface_helper.associatedActsSurface(**el)); - } - - Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions; - - ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor surfaceAccessor{ &(*m_ATLASConverterTool), &tracking_surface_helper }; - kfExtensions.surfaceAccessor.connect<&ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor); - - UncalibratedMeasurementCalibrator calibrator(*m_ATLASConverterTool, tracking_surface_helper); - kfExtensions.calibrator.connect<&UncalibratedMeasurementCalibrator::calibrate<ActsTrk::MutableTrackStateBackend>>(&calibrator); - - Acts::PropagatorPlainOptions propagationOption; - propagationOption.maxSteps = m_option_maxPropagationStep; - - // Construct a perigee surface as the target surface if none is provided - std::shared_ptr<Acts::Surface> pSurface{nullptr}; - if (!targetSurface){ - pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3{0., 0., 0.}); - targetSurface = pSurface.get(); - } - - // Set the KalmanFitter options - Acts::KalmanFitterOptions<ActsTrk::MutableTrackStateBackend> - kfOptions(tgContext, mfContext, calContext, - kfExtensions, - propagationOption, - targetSurface); - - std::unique_ptr< ActsTrk::MutableTrackContainer > tracks = std::make_unique< ActsTrk::MutableTrackContainer >(); - - - auto result = m_directFitter->fit(sourceLinks.begin(), - sourceLinks.end(), - initialParams, - kfOptions, - surfaces, - *tracks.get()); - - if (not result.ok()) { - ATH_MSG_VERBOSE("Kalman Fitter on Seed has failed"); - return nullptr; - } - return tracks; -} - // extend a track fit to include an additional set of MeasurementBase objects // re-implements the TrkFitterUtils/TrackFitter.cxx general code in a more // mem efficient and stable way // -------------------------------- std::unique_ptr<Trk::Track> -KalmanFitter::fit(const EventContext& ctx, - const Trk::Track& inputTrack, - const Trk::MeasurementSet& addMeasColl, - const Trk::RunOutlierRemoval /*runOutlier*/, - const Trk::ParticleHypothesis /*matEffects*/) const +ActsKalmanFitter::fit(const EventContext& ctx, + const Trk::Track& inputTrack, + const Trk::MeasurementSet& addMeasColl, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*matEffects*/) const { ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,Meas'BaseSet,,)"); ATH_MSG_VERBOSE (" with Track from author = " << inputTrack.info().dumpInfo()); @@ -587,11 +521,11 @@ KalmanFitter::fit(const EventContext& ctx, // extend a track fit to include an additional set of PrepRawData objects // -------------------------------- std::unique_ptr<Trk::Track> -KalmanFitter::fit(const EventContext& /*ctx*/, - const Trk::Track& /*inputTrack*/, - const Trk::PrepRawDataSet& /*addPrdColl*/, - const Trk::RunOutlierRemoval /*runOutlier*/, - const Trk::ParticleHypothesis /*matEffects*/) const +ActsKalmanFitter::fit(const EventContext& /*ctx*/, + const Trk::Track& /*inputTrack*/, + const Trk::PrepRawDataSet& /*addPrdColl*/, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*matEffects*/) const { ATH_MSG_DEBUG("Fit of Track with additional PrepRawDataSet not yet implemented"); return nullptr; @@ -600,11 +534,11 @@ KalmanFitter::fit(const EventContext& /*ctx*/, // combined fit of two tracks // -------------------------------- std::unique_ptr<Trk::Track> -KalmanFitter::fit(const EventContext& ctx, - const Trk::Track& intrk1, - const Trk::Track& intrk2, - const Trk::RunOutlierRemoval /*runOutlier*/, - const Trk::ParticleHypothesis /*matEffects*/) const +ActsKalmanFitter::fit(const EventContext& ctx, + const Trk::Track& intrk1, + const Trk::Track& intrk2, + const Trk::RunOutlierRemoval /*runOutlier*/, + const Trk::ParticleHypothesis /*matEffects*/) const { ATH_MSG_VERBOSE ("--> enter KalmanFitter::fit(Track,Track,)"); ATH_MSG_VERBOSE (" with Tracks from #1 = " << intrk1.info().dumpInfo() @@ -685,12 +619,12 @@ KalmanFitter::fit(const EventContext& ctx, return track; } -std::unique_ptr<Trk::Track> -KalmanFitter::makeTrack(const EventContext& ctx, - Acts::GeometryContext& tgContext, - ActsTrk::MutableTrackContainer& tracks, - Acts::Result<ActsTrk::MutableTrackContainer::TrackProxy, std::error_code>& fitResult, bool SourceLinkType) const { - +std::unique_ptr<Trk::Track> +ActsKalmanFitter::makeTrack(const EventContext& ctx, + Acts::GeometryContext& tgContext, + ActsTrk::MutableTrackContainer& tracks, + Acts::Result<ActsTrk::MutableTrackContainer::TrackProxy, std::error_code>& fitResult, bool SourceLinkType) const { + if (not fitResult.ok()) return nullptr; @@ -869,15 +803,15 @@ KalmanFitter::makeTrack(const EventContext& ctx, } std::unique_ptr< ActsTrk::MutableTrackContainer > -KalmanFitter::fit(const EventContext& ctx, - const ActsTrk::Seed &seed, - const Acts::BoundTrackParameters& initialParams, - const Acts::GeometryContext& tgContext, - const Acts::MagneticFieldContext& mfContext, - const Acts::CalibrationContext& calContext, - const TrackingSurfaceHelper &tracking_surface_helper) const +ActsKalmanFitter::fit(const EventContext& /*ctx*/, + const ActsTrk::Seed &seed, + const Acts::BoundTrackParameters& initialParams, + const Acts::GeometryContext& tgContext, + const Acts::MagneticFieldContext& mfContext, + const Acts::CalibrationContext& calContext, + const TrackingSurfaceHelper &tracking_surface_helper) const { - std::vector<ActsTrk::ATLASUncalibSourceLink> sourceLinks; + std::vector<Acts::SourceLink> sourceLinks; sourceLinks.reserve(6); std::vector<const Acts::Surface*> surfaces; @@ -886,13 +820,45 @@ KalmanFitter::fit(const EventContext& ctx, const auto& sps = seed.sp(); for (const xAOD::SpacePoint* sp : sps) { const auto& measurements = sp->measurements(); - for (const xAOD::UncalibratedMeasurement *umeas : measurements) { - ActsTrk::ATLASUncalibSourceLink el(*dynamic_cast<const xAOD::UncalibratedMeasurementContainer*>(umeas->container()), umeas->index()); + for (const ActsTrk::ATLASUncalibSourceLink& el : measurements) { sourceLinks.emplace_back( el ); surfaces.push_back(&tracking_surface_helper.associatedActsSurface(**el)); } } - return fit(ctx, sourceLinks, initialParams, tgContext, mfContext, calContext, tracking_surface_helper, surfaces.front()); + + Acts::KalmanFitterExtensions<ActsTrk::MutableTrackStateBackend> kfExtensions = m_kfExtensions; + + ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor surfaceAccessor{ &(*m_ATLASConverterTool), &tracking_surface_helper }; + kfExtensions.surfaceAccessor.connect<&ActsTrk::ATLASUncalibSourceLinkSurfaceAccessor::operator()>(&surfaceAccessor); + + UncalibratedMeasurementCalibrator calibrator(*m_ATLASConverterTool, tracking_surface_helper); + kfExtensions.calibrator.connect<&UncalibratedMeasurementCalibrator::calibrate<ActsTrk::MutableTrackStateBackend>>(&calibrator); + + Acts::PropagatorPlainOptions propagationOption; + propagationOption.maxSteps = m_option_maxPropagationStep; + + // Set the KalmanFitter options + Acts::KalmanFitterOptions<ActsTrk::MutableTrackStateBackend> + kfOptions(tgContext, mfContext, calContext, + kfExtensions, + propagationOption, + surfaces.front()); + + std::unique_ptr< ActsTrk::MutableTrackContainer > tracks = std::make_unique<ActsTrk::MutableTrackContainer>(); + + auto result = m_directFitter->fit(sourceLinks.begin(), + sourceLinks.end(), + initialParams, + kfOptions, + surfaces, + *tracks.get()); + + if (not result.ok()) { + ATH_MSG_VERBOSE("Kalman Fitter on Seed has failed"); + return nullptr; + } + + return tracks; } } diff --git a/Tracking/Acts/ActsTrackReconstruction/src/KalmanFitter.h b/Tracking/Acts/ActsTrackReconstruction/src/KalmanFitter.h index 59c55cc63b8eb280881b43cb1ee457aaed1f4825..ff742ba8971da5b32e083143604e4256e6a88d63 100644 --- a/Tracking/Acts/ActsTrackReconstruction/src/KalmanFitter.h +++ b/Tracking/Acts/ActsTrackReconstruction/src/KalmanFitter.h @@ -1,11 +1,11 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ -#ifndef ACTSGEOMETRY_KALMANFITTER_H -#define ACTSGEOMETRY_KALMANFITTER_H +#ifndef ACTSGEOMETRY_ACTSKALMANFITTER_H +#define ACTSGEOMETRY_ACTSKALMANFITTER_H -#include "FitterHelperFunctions.h" +#include "ActsFitterHelperFunctions.h" #include "GaudiKernel/ToolHandle.h" @@ -84,11 +84,11 @@ struct PRDSourceLinkSurfaceAccessor { const Acts::Surface* operator()(const Acts::SourceLink& sourceLink) const; }; -class KalmanFitter : public extends2<AthAlgTool, Trk::ITrackFitter, ActsTrk::IFitterTool> { +class ActsKalmanFitter : public extends2<AthAlgTool, Trk::ITrackFitter, ActsTrk::IFitterTool> { public: - KalmanFitter(const std::string&,const std::string&,const IInterface*); - virtual ~KalmanFitter() = default; + ActsKalmanFitter(const std::string&,const std::string&,const IInterface*); + virtual ~ActsKalmanFitter() = default; // standard Athena methods virtual StatusCode initialize() override; @@ -123,19 +123,6 @@ public: const Trk::PrepRawDataSet&, const Trk::RunOutlierRemoval runOutlier = false, const Trk::ParticleHypothesis matEffects = Trk::nonInteracting) const override; - - //! fit a set of xAOD uncalibrated Measurements - virtual - std::unique_ptr< ActsTrk::MutableTrackContainer > - fit(const EventContext& ctx, - const std::vector<ActsTrk::ATLASUncalibSourceLink> & clusterList, - const Acts::BoundTrackParameters& initialParams, - const Acts::GeometryContext& tgContext, - const Acts::MagneticFieldContext& mfContext, - const Acts::CalibrationContext& calContext, - const TrackingSurfaceHelper &tracking_surface_helper, - const Acts::Surface* targetSurface = nullptr // optional target surface - defaults to perigee in global origin - ) const override; //! extend a track fit including a new set of MeasurementBase objects virtual std::unique_ptr<Trk::Track> fit( diff --git a/Tracking/TrkConfig/python/AtlasTrackingGeometrySvcConfig.py b/Tracking/TrkConfig/python/AtlasTrackingGeometrySvcConfig.py index e184a1d64fbfb14f3d04885cffe5ee455bbffd6c..793b89f2db1f160d91b04a4fd28ab6594cb1b356 100644 --- a/Tracking/TrkConfig/python/AtlasTrackingGeometrySvcConfig.py +++ b/Tracking/TrkConfig/python/AtlasTrackingGeometrySvcConfig.py @@ -70,9 +70,9 @@ if __name__ == '__main__': from AthenaConfiguration.AllConfigFlags import initConfigFlags flags = initConfigFlags() - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles + flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.lock() acc = TrackingGeometrySvcCfg(flags) diff --git a/Tracking/TrkConfig/python/TrkConfigFlags.py b/Tracking/TrkConfig/python/TrkConfigFlags.py index d43a3d8d700c4387105bcd85b9e52be652699288..52fb2f3f43610fc11aeefdf954b8d84591c83ddd 100644 --- a/Tracking/TrkConfig/python/TrkConfigFlags.py +++ b/Tracking/TrkConfig/python/TrkConfigFlags.py @@ -63,10 +63,10 @@ def createTrackingConfigFlags(): # control which fitter to be used icf.addFlag("Tracking.trackFitterType", - TrackFitterType.GlobalChi2Fitter, type=TrackFitterType) + TrackFitterType.GlobalChi2Fitter, enum=TrackFitterType) # control which measurement updator to load as InDetUpdator icf.addFlag("Tracking.kalmanUpdator", - KalmanUpdatorType.KalmanUpdatorSMatrix, type=KalmanUpdatorType) + KalmanUpdatorType.KalmanUpdatorSMatrix, enum=KalmanUpdatorType) icf.addFlag("Tracking.materialInteractions", lambda prevFlags: prevFlags.Beam.Type is not BeamType.SingleBeam) @@ -107,7 +107,7 @@ def createTrackingConfigFlags(): PixelClusterSplittingType.NeuralNet if prevFlags.GeoModel.Run <= LHCPeriod.Run3 else PixelClusterSplittingType.Truth, - type=PixelClusterSplittingType) + enum=PixelClusterSplittingType) # Cut value for splitting clusters into two parts icf.addFlag("Tracking.pixelClusterSplitProb1", lambda prevFlags: ( @@ -348,7 +348,7 @@ def createTrackingConfigFlags(): return PrimaryPassConfig.Default icf.addFlag("Tracking.PrimaryPassConfig", lambda prevFlags: - primaryPass(prevFlags), type=PrimaryPassConfig) + primaryPass(prevFlags), enum=PrimaryPassConfig) # Set up for first tracking pass, updated for second passes icf.addFlagsCategory("Tracking.MainPass", @@ -415,7 +415,7 @@ def createTrackingConfigFlags(): return ITkPrimaryPassConfig.Default icf.addFlag("Tracking.ITkPrimaryPassConfig", lambda prevFlags: - itkPrimaryPass(prevFlags), type=ITkPrimaryPassConfig) + itkPrimaryPass(prevFlags), enum=ITkPrimaryPassConfig) icf.addFlagsCategory ("Tracking.ITkMainPass", createITkTrackingPassFlags, prefix=True) diff --git a/Tracking/TrkConfig/python/VertexFindingFlags.py b/Tracking/TrkConfig/python/VertexFindingFlags.py index a04b480dd624e83707829d121b68e600e435083d..91f1ca9f30c6852ccbb36ccead3312a3e67ba8da 100644 --- a/Tracking/TrkConfig/python/VertexFindingFlags.py +++ b/Tracking/TrkConfig/python/VertexFindingFlags.py @@ -55,10 +55,10 @@ def createPriVertexingFlags(): else: # Default return VertexSetup.ActsGaussAMVF - flags.addFlag("setup", vertexSetup, type=VertexSetup) + flags.addFlag("setup", vertexSetup, enum=VertexSetup) # string to store the type of sorting algorithm to separate signal and pile-up vertices. - flags.addFlag("sortingSetup", VertexSortingSetup.SumPt2Sorting, type=VertexSortingSetup) + flags.addFlag("sortingSetup", VertexSortingSetup.SumPt2Sorting, enum=VertexSortingSetup) flags.addFlag("useBeamConstraint", lambda pcf: not(pcf.Tracking.PrimaryPassConfig in [ PrimaryPassConfig.VtxLumi, diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.cxx index d89ca2867a951410ee8d12743afcde643e4df2f9..5baf169beeb1004c4f8b200f1e78777d74df7223 100644 --- a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimAlgorithms/src/FPGATrackSimLogicalHitsProcessAlg.cxx @@ -82,9 +82,8 @@ StatusCode FPGATrackSimLogicalHitsProcessAlg::initialize() ATH_CHECK(m_dataFlowTool.retrieve()); ATH_CHECK(m_writeOutputTool.retrieve()); ATH_CHECK(m_FPGATrackSimMapping.retrieve()); - if ( m_doEvtSel ) { + if ( m_doEvtSel ) ATH_CHECK(m_evtSel.retrieve()); - } ATH_MSG_DEBUG("initialize() Instantiating root objects"); m_logicEventHeader_1st = m_writeOutputTool->getLogicalEventInputHeader_1st(); @@ -147,12 +146,16 @@ StatusCode FPGATrackSimLogicalHitsProcessAlg::execute() // Map, cluster, and filter hits ATH_CHECK(processInputs()); + // Get reference to hits unsigned regionID = m_evtSel->getRegionID(); + + // Recording Data auto mon_regionID = Monitored::Scalar<unsigned>("regionID", regionID); Monitored::Group(m_monTool, mon_regionID); + std::vector<FPGATrackSimHit> const & hits_1st = m_logicEventHeader_1st->towers().at(regionID).hits(); TIME(m_tprocess); @@ -160,28 +163,9 @@ StatusCode FPGATrackSimLogicalHitsProcessAlg::execute() std::vector<FPGATrackSimRoad*> prefilter_roads; std::vector<FPGATrackSimRoad*>& roads_1st = prefilter_roads; std::vector<const FPGATrackSimHit*> phits_1st; - std::vector<FPGATrackSimHit> const & hits_1st = m_logicEventHeader_1st->towers().at(regionID).hits(); - for (FPGATrackSimHit const & h : hits_1st) phits_1st.push_back(&h); - - auto mon_nhits_1st = Monitored::Scalar<unsigned>("nHits_1st", hits_1st.size()); - auto mon_nhits_1st_unmapped = Monitored::Scalar<unsigned>("nHits_1st_unmapped", m_hits_1st_miss.size()); - Monitored::Group(m_monTool, mon_nhits_1st, mon_nhits_1st_unmapped); - ATH_CHECK(m_roadFinderTool->getRoads(phits_1st, roads_1st)); - auto mon_nroads_1st = Monitored::Scalar<unsigned>("nroads_1st", roads_1st.size()); - for (auto road : roads_1st) { - unsigned bitmask = road->getHitLayers(); - for (size_t l = 0; l < m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers(); l++) { - if (bitmask & (1 << l)) { - auto mon_layerIDs_1st = Monitored::Scalar<unsigned>("layerIDs_1st",l); - Monitored::Group(m_monTool,mon_layerIDs_1st); - } - } - } - Monitored::Group(m_monTool, mon_nroads_1st); - TIME(m_troads); // Standard road Filter @@ -418,11 +402,6 @@ StatusCode FPGATrackSimLogicalHitsProcessAlg::processInputs() m_logicEventHeader_1st->reset(); ATH_CHECK(m_hitMapTool->convert(1, m_eventHeader, *m_logicEventHeader_1st)); if (!m_runSecondStage) m_eventHeader.clearHits(); - - ATH_CHECK(m_hitMapTool->getUnmapped(m_hits_1st_miss)); - - - ATH_MSG_DEBUG("Hits conversion done"); // Random removal of hits if (m_doHitFiltering) { diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.cxx index 42b40b4892aae32b21919cd841a6653d39dbbb3e..38a126c6c11b825f764c7c437589864e355e0013 100644 --- a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimHough/src/FPGATrackSimHoughTransformTool.cxx @@ -55,7 +55,7 @@ StatusCode FPGATrackSimHoughTransformTool::initialize() ATH_MSG_INFO("Convolution size: " << m_convSize_x << " x " << m_convSize_y); ATH_MSG_INFO("Convolution: " << to_string(const_cast<std::vector<int>&>(m_conv.value()))); ATH_MSG_INFO("Hit Extend: " << to_string(const_cast<std::vector<unsigned>&>(m_hitExtend_x.value()))); - + // Retrieve info ATH_CHECK(m_FPGATrackSimBankSvc.retrieve()); ATH_CHECK(m_FPGATrackSimMapping.retrieve()); @@ -167,7 +167,6 @@ FPGATrackSimHoughTransformTool::Image FPGATrackSimHoughTransformTool::createLaye { if (std::find(layers.begin(), layers.end(), hit->getLayer()) == layers.end()) continue; if (m_subRegion >= 0 && !m_FPGATrackSimMapping->SubRegionMap()->isInRegion(m_subRegion, *hit)) continue; - // This scans over y (pT) because that is more efficient in memory, in C. // Unknown if firmware will want to scan over x instead. unsigned new_size_y = m_imageSize_y / scale; diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawToLogicalHitsTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawToLogicalHitsTool.cxx index b32b7552b195cf8c688808530d93385544f50d94..d1e3f5cc5fd70efdfc9e5517caf41a930a6f97d4 100644 --- a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawToLogicalHitsTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimInput/src/FPGATrackSimRawToLogicalHitsTool.cxx @@ -94,8 +94,8 @@ StatusCode FPGATrackSimRawToLogicalHitsTool::convert(unsigned stage, const FPGAT // skip over hits in layers that are not included in the FPGATrackSim geometry, with plane = -1 if (pmap->getLayerSection(hit.getDetType(), hit.getDetectorZone(), hit.getPhysLayer()).layer == -1) { - m_missing_hits.push_back(hit); - continue; + // m_missing_hits.push_back(hit); // comment this out so hits in unused layers aren't considered "unmapped" + continue; } bool mapped=false; diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/python/FPGATrackSimSGInputConfig.py b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/python/FPGATrackSimSGInputConfig.py index 9f38ee14e0fac758b2f1222cb10e63d8ef2a319d..9e0be96efc76d7e90fd2ae3b9a1833b926d1d74c 100644 --- a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/python/FPGATrackSimSGInputConfig.py +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/python/FPGATrackSimSGInputConfig.py @@ -30,10 +30,17 @@ def FPGATrackSimSGInputCfg(flags,**kwargs): acc.merge(ITkPixelReadoutGeometryCfg(flags)) from StripGeoModelXml.ITkStripGeoModelConfig import ITkStripReadoutGeometryCfg acc.merge(ITkStripReadoutGeometryCfg(flags)) + from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg + extrapolator = acc.popToolsAndMerge(AtlasExtrapolatorCfg(flags)) + acc.addPublicTool(extrapolator) + + + FPGATrackSimSGInputTool = CompFactory.FPGATrackSimSGToRawHitsTool(maxEta=3.2, minPt=0.8 * GeV, + Extrapolator = extrapolator ) + acc.addPublicTool(FPGATrackSimSGInputTool) wrapperAlg = CompFactory.TrigFPGATrackSimRawHitsWrapperAlg( - InputTool=acc.popToolsAndMerge(FPGATrackSimSGInputToolCfg(flags)), - OutFileName=flags.Trigger.FPGATrackSim.wrapperFileName, + InputTool=FPGATrackSimSGInputTool, OutFileName=flags.Trigger.FPGATrackSim.wrapperFileName, WrapperMetaData=flags.Trigger.FPGATrackSim.wrapperMetaData ) acc.addEventAlgo(wrapperAlg) diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.cxx b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.cxx index b5c3e64c6ce56b8487e17d5220667ea3bc71817c..9060153b761b8982b3fc073166121eb034de03fb 100644 --- a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.cxx +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.cxx @@ -51,7 +51,7 @@ StatusCode FPGATrackSimSGToRawHitsTool::initialize() { ATH_MSG_DEBUG("FPGATrackSimSGToRawHitsTool::initialize()"); - if(!m_truthToTrack.empty() ) ATH_CHECK(m_truthToTrack.retrieve()); + if(!m_truthToTrack.empty() ) ATH_CHECK(m_truthToTrack.retrieve()); if(!m_extrapolator.empty()) ATH_CHECK(m_extrapolator.retrieve()); ATH_CHECK(m_beamSpotKey.initialize()); @@ -70,7 +70,6 @@ StatusCode FPGATrackSimSGToRawHitsTool::initialize() { ATH_CHECK(m_sctClusterContainerKey.initialize(SG::AllowEmpty)); ATH_CHECK(m_offlineTracksKey.initialize(SG::AllowEmpty)); - ATH_CHECK(m_mcCollectionKey.initialize(SG::AllowEmpty)); ATH_CHECK(m_pixelSDOKey.initialize(SG::AllowEmpty)); ATH_CHECK(m_stripSDOKey.initialize(SG::AllowEmpty)); @@ -101,17 +100,25 @@ StatusCode FPGATrackSimSGToRawHitsTool::readData(FPGATrackSimEventInputHeader* h event_info.setBCID(eventInfo->bcid()); event_info.setaverageInteractionsPerCrossing(eventInfo->averageInteractionsPerCrossing()); event_info.setactualInteractionsPerCrossing(eventInfo->actualInteractionsPerCrossing()); + event_info.setextendedLevel1ID(eventInfo->extendedLevel1ID()); event_info.setlevel1TriggerType(eventInfo->level1TriggerType()); // event_info.setlevel1TriggerInfo(eventInfo->level1TriggerInfo ()); // unclear if needed, TODO come back to it + m_eventHeader->newEvent(event_info);//this also reset all variables + HitIndexMap hitIndexMap; // keep running index event-unique to each hit HitIndexMap pixelClusterIndexMap; + // get pixel and sct cluster containers + // dump raw silicon data ATH_MSG_DEBUG("Dump raw silicon data"); ATH_CHECK(readRawSilicon(hitIndexMap, eventContext)); + + ATH_MSG_DEBUG("Found list of hits, size =" << m_eventHeader->nHits()); FPGATrackSimOptionalEventInfo optional; + if (m_readOfflineClusters) { std::vector <FPGATrackSimCluster> clusters; ATH_CHECK(readOfflineClusters(clusters, eventContext)); @@ -119,18 +126,22 @@ StatusCode FPGATrackSimSGToRawHitsTool::readData(FPGATrackSimEventInputHeader* h ATH_MSG_DEBUG("Saved " << optional.nOfflineClusters() << " offline clusters"); ATH_CHECK(dumpPixelClusters(pixelClusterIndexMap, eventContext)); } + if (m_readTruthTracks) { std::vector <FPGATrackSimTruthTrack> truth; ATH_CHECK(readTruthTracks(truth, eventContext)); for (const FPGATrackSimTruthTrack& trk : truth) optional.addTruthTrack(trk); ATH_MSG_DEBUG("Saved " << optional.nTruthTracks() << " truth tracks"); } + std::vector <FPGATrackSimOfflineTrack> offline; if (m_readOfflineTracks) { ATH_CHECK(readOfflineTracks(offline, eventContext)); for (const FPGATrackSimOfflineTrack& trk : offline) optional.addOfflineTrack(trk); ATH_MSG_DEBUG("Saved " << optional.nOfflineTracks() << " offline tracks"); } + + m_eventHeader->setOptional(optional); ATH_MSG_DEBUG(*m_eventHeader); ATH_MSG_DEBUG("End of execute()"); @@ -604,6 +615,7 @@ FPGATrackSimSGToRawHitsTool::readTruthTracks(std::vector <FPGATrackSimTruthTrack // dump each truth track for (unsigned int ievt = 0; ievt < simTracksHandle->size(); ++ievt) { + const HepMC::GenEvent* genEvent = simTracksHandle->at(ievt); // retrieve the primary interaction vertex here. for now, use the dummy origin. HepGeom::Point3D<double> primaryVtx(0., 0., 0.); @@ -617,7 +629,9 @@ FPGATrackSimSGToRawHitsTool::readTruthTracks(std::vector <FPGATrackSimTruthTrack ATH_MSG_DEBUG("using signal process vertex for eventIndex " << ievt << ":" << primaryVtx.x() << "\t" << primaryVtx.y() << "\t" << primaryVtx.z()); } + for (const auto& particle: *genEvent) { + const int pdgcode = particle->pdg_id(); // reject generated particles without a production vertex. if (particle->production_vertex() == nullptr) { @@ -630,16 +644,19 @@ FPGATrackSimSGToRawHitsTool::readTruthTracks(std::vector <FPGATrackSimTruthTrack } float charge = pd->charge(); if (pdgcode < 0) charge *= -1.; // since we took absolute value above + if (std::abs(charge) < 0.5) { continue; } if (!MC::isStable(particle)) { continue; } + // truth-to-track tool const Amg::Vector3D momentum(particle->momentum().px(), particle->momentum().py(), particle->momentum().pz()); const Amg::Vector3D position(particle->production_vertex()->position().x(), particle->production_vertex()->position().y(), particle->production_vertex()->position().z()); const Trk::CurvilinearParameters cParameters(position, momentum, charge); + Trk::PerigeeSurface persf; if (m_UseNominalOrigin) { Amg::Vector3D origin(0, 0, 0); @@ -649,6 +666,7 @@ FPGATrackSimSGToRawHitsTool::readTruthTracks(std::vector <FPGATrackSimTruthTrack SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle{ m_beamSpotKey, eventContext }; Trk::PerigeeSurface persf(beamSpotHandle->beamPos()); } + const Trk::TrackParameters* tP = m_extrapolator->extrapolate(eventContext, cParameters, persf, Trk::anyDirection, false).release(); const double track_truth_d0 = tP ? tP->parameters()[Trk::d0] : 999.; const double track_truth_phi = tP ? tP->parameters()[Trk::phi] : 999.; @@ -670,6 +688,7 @@ FPGATrackSimSGToRawHitsTool::readTruthTracks(std::vector <FPGATrackSimTruthTrack if (std::abs(truth_d0corr) > 2.) { isPrimary = false; } const int bc = HepMC::barcode(particle); if (HepMC::is_simulation_particle(particle) || bc == 0) { isPrimary = false; } + if (isPrimary && particle->production_vertex()) { const HepGeom::Point3D<double> startVertex(particle->production_vertex()->position().x(), particle->production_vertex()->position().y(), particle->production_vertex()->position().z()); if (std::abs(startVertex.z() - truth_zvertex) > 100.) { isPrimary = false; } diff --git a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.h b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.h index 9ea47f3c1cda4ce93832a05291b64d458761b4c2..0aa86cf76dd988a3445b139b83260fbd51fabf42 100644 --- a/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.h +++ b/Trigger/EFTracking/FPGATrackSim/FPGATrackSimSGInput/src/FPGATrackSimSGToRawHitsTool.h @@ -54,9 +54,9 @@ public: private: - ToolHandle<Trk::ITruthToTrack> m_truthToTrack {this, "TruthToTrackTool", "Trk::TruthToTrack/InDetTruthToTrack" }; //!< tool to create track parameters from a gen particle - ToolHandle<Trk::IExtrapolator> m_extrapolator {this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator"}; //!< ToolHandle for Extrapolator - + ToolHandle<Trk::ITruthToTrack> m_truthToTrack { this, "TruthToTrackTool", "Trk::TruthToTrack/InDetTruthToTrack" }; //!< tool to create track parameters from a gen particle + ToolHandle<Trk::IExtrapolator> m_extrapolator { this, "Extrapolator", "Trk::Extrapolator/AtlasExtrapolator" }; + ///// ServiceHandle<IBeamCondSvc> m_beamSpotSvc; SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey { this, "EventInfo", "EventInfo" }; SG::ReadHandleKey<InDet::SiClusterContainer> m_pixelClusterContainerKey { this, "pixelClustersName", "ITkPixelClusters" }; diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py index 3070a0307e2b01cc8ae20f025853257334b5eb22..9823d0a0e405d96e849a8004cd8c35bc58e5bd1b 100755 --- a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaCommon.SystemOfUnits import MeV, deg from AthenaCommon.Logging import logging @@ -518,12 +518,14 @@ def HICaloTowerCfg(flags): if __name__ == "__main__": - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.AllConfigFlags import initConfigFlags + from AthenaConfiguration.Enums import LHCPeriod flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN3 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3 + #flags.Input.isMC=False + flags.GeoModel.Run=LHCPeriod.Run3 flags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07" flags.Common.isOnline = True outputContainers = ["CaloCellContainer#SeedLessFS", diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/MdtDataPreparator_test.py b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/MdtDataPreparator_test.py index b14e4748126f23a2da165378192a6540938f5ec7..06401726fb518c4f22acbcc6cea50827f8576af9 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/MdtDataPreparator_test.py +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/MdtDataPreparator_test.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration. +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration. # # File: TrigL2MuonSA/share/MdtDataPreparator_test.py # Author: scott snyder @@ -51,11 +51,10 @@ def testCfg (configFlags): from AthenaConfiguration.AllConfigFlags import initConfigFlags -from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags +from AthenaConfiguration.TestDefaults import defaultTestFiles 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/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py index 52350e973e9980f1f891a1a088bf9c7eafd957ef..6c63b4a935dd8e57bf9e7713ed2eac0b26f2060c 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/python/TrigL2MuonSAConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # # This file configs the L2MuonSA reco alg in the newJO way, # but now is located here temporarily until newJO migrations are done in all trigger signatures. @@ -368,11 +368,10 @@ def l2MuFastAlgCfg( flags, roisKey, setup="", **kwargs ): if __name__ == "__main__": - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.AllConfigFlags import initConfigFlags flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.lock() cfg = l2MuFastAlgCfg(flags, roisKey="MURoIs") diff --git a/Trigger/TrigAlgorithms/TrigMinBias/python/MbtsConfig.py b/Trigger/TrigAlgorithms/TrigMinBias/python/MbtsConfig.py index dc2a111df615aaa1c1370253d3887d02005f7395..b041f9ece14db73975be0233d6185fa527a6a070 100644 --- a/Trigger/TrigAlgorithms/TrigMinBias/python/MbtsConfig.py +++ b/Trigger/TrigAlgorithms/TrigMinBias/python/MbtsConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from TrigMinBias.TrigMinBiasMonitoring import MbtsFexMonitoring from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator @@ -25,12 +25,13 @@ def MbtsSGInputCfg(flags): if __name__ == '__main__': + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=1 from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles flags = initConfigFlags() flags.Input.Files=defaultTestFiles.RAW_RUN2 # or ESD or AOD or ... - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.lock() acc=ComponentAccumulator() diff --git a/Trigger/TrigAlgorithms/TrigMinBias/python/MinBiasCountersConfig.py b/Trigger/TrigAlgorithms/TrigMinBias/python/MinBiasCountersConfig.py index 9323db1315024a3d4cb9cc63634561aff30ccb9d..661619346a4c19bb43f8e40f90187d1708232f2b 100644 --- a/Trigger/TrigAlgorithms/TrigMinBias/python/MinBiasCountersConfig.py +++ b/Trigger/TrigAlgorithms/TrigMinBias/python/MinBiasCountersConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator @@ -26,6 +26,8 @@ def TrackCounterHypoAlgCfg(flags): if __name__ == '__main__': + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=1 from AthenaConfiguration.AllConfigFlags import initConfigFlags from AthenaConfiguration.TestDefaults import defaultTestFiles diff --git a/Trigger/TrigAlgorithms/TrigPartialEventBuilding/python/TrigPartialEventBuildingConfig.py b/Trigger/TrigAlgorithms/TrigPartialEventBuilding/python/TrigPartialEventBuildingConfig.py index 5a68618a3d5cd17c5d109c3ad9e59467da2867be..43aa37f75924af090d035d1d3477c91780a8c44a 100644 --- a/Trigger/TrigAlgorithms/TrigPartialEventBuilding/python/TrigPartialEventBuildingConfig.py +++ b/Trigger/TrigAlgorithms/TrigPartialEventBuilding/python/TrigPartialEventBuildingConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # from AthenaConfiguration.ComponentFactory import CompFactory @@ -99,11 +99,10 @@ def StaticPEBInfoWriterToolCfg(flags, name='StaticPEBInfoWriterTool', if __name__ == '__main__': - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.AllConfigFlags import initConfigFlags flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN3 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3 flags.lock() cfg = ComponentAccumulator() diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigCaloDataAccessConfig.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigCaloDataAccessConfig.py index 26fbed9bde3502cee1dbb2b6aa59834e7d795004..a07304375e7514c1b6e97077b2eb045c4d5ec11c 100644 --- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigCaloDataAccessConfig.py +++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigCaloDataAccessConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 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 from AthenaConfiguration.AccumulatorCache import AccumulatorCache @@ -101,13 +101,12 @@ def trigCaloDataAccessSvcCfg( flags ): if __name__ == "__main__": - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.AllConfigFlags import initConfigFlags import sys flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.Input.isMC=False flags.lock() diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts-offline.dat b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts-offline.dat index 4dc51283e63e132bbc0b7b4c5b72d32b7fd7b38a..9ca9749b686efd229116cf823867ae3d80368eef 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts-offline.dat +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts-offline.dat @@ -5,12 +5,7 @@ pT = 400; pT = 1000; #endif -#if defined(ITk) - eta = 4.5; -#else - eta = 2.5; -#endif - +eta = 2.5; #if defined(LARGED0) a0=10.; #elif defined(LARGED0_EL) diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts.dat b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts.dat index 00367f5c6c6b77e0a80200cbb5028f30a74bc840..24fa1f88188fdbb0e92bbe6de0623ba2d9366de2 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts.dat +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/share/TIDAdata_cuts.dat @@ -6,12 +6,7 @@ z0 = 150; pT = 1000; #endif -#if defined(ITk) - eta = 4.5; -#else - eta = 2.5; -#endif - +eta = 2.5; #if defined(LARGED0) a0=10.; #elif defined(LARGED0_EL) diff --git a/Trigger/TrigEvent/TrigNavStructure/Root/TriggerElement.cxx b/Trigger/TrigEvent/TrigNavStructure/Root/TriggerElement.cxx index e2bcd889c38ea3c006ef80bea01bb752840878d8..3e9274ad1c1e2ea5730a6ba044b2b889868ddbbe 100644 --- a/Trigger/TrigEvent/TrigNavStructure/Root/TriggerElement.cxx +++ b/Trigger/TrigEvent/TrigNavStructure/Root/TriggerElement.cxx @@ -1,12 +1,11 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include <iostream> #include <stdexcept> #include <iterator> #include <functional> -#include <algorithm> #include "TrigNavStructure/Types.h" #include "TrigNavStructure/TriggerElement.h" diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/L2MuonSAIOMon.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/L2MuonSAIOMon.cxx index 1c401f2a009c81fd7e3658dbcbcdf229eaf9e4dd..3d9fb556cbe6af998214ad1676e4e37442ef7af0 100644 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/L2MuonSAIOMon.cxx +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/L2MuonSAIOMon.cxx @@ -104,16 +104,7 @@ StatusCode L2MuonSAIOMon :: fillVariablesPerOfflineMuonPerChain(const EventConte if( chain.find("probe") != std::string::npos ){ // L2Inside-Out efficiency using Tag&Probe chain - if(chain.find("L1MU14FCH")){ - if ( !getTrigDecisionTool()->isPassed("HLT_mu24_ivarmedium_L1MU14FCH") ) return StatusCode::SUCCESS; // impose trigger pass in order to eliminate bias - } - else if(chain.find("L1MU18VFCH")){ - if ( !getTrigDecisionTool()->isPassed("HLT_mu24_ivarmedium_L1MU18VFCH") ) return StatusCode::SUCCESS; // impose trigger pass in order to eliminate bias - } - else - { - return StatusCode::SUCCESS; - } + if ( !getTrigDecisionTool()->isPassed(chain) ) return StatusCode::SUCCESS; // impose trigger pass in order to eliminate bias // search tag offline muon const xAOD::Muon* tag = searchTagOfflineMuon( ctx, mu ); @@ -132,38 +123,35 @@ StatusCode L2MuonSAIOMon :: fillVariablesPerOfflineMuonPerChain(const EventConte float tpext_dphi = xAOD::P4Helpers::deltaPhi((*tag_ms_track)->phi(), (*probe_ms_track)->phi()); offdR = std::sqrt(tpext_deta*tpext_deta + tpext_dphi*tpext_dphi); - passL2InsideOut = false; - passL2SA = false; - - // retrieve probe l2SA objects - int legIndex_probe = 1; // probe - std::vector< TrigCompositeUtils::LinkInfo<xAOD::L2StandAloneMuonContainer> > featureCont = getTrigDecisionTool()->features<xAOD::L2StandAloneMuonContainer>( chain, - TrigDefs::includeFailedDecisions, - "HLT_MuonL2SAInfo", - TrigDefs::lastFeatureOfType, - TrigCompositeUtils::featureString(), - legIndex_probe ); - - for(const TrigCompositeUtils::LinkInfo<xAOD::L2StandAloneMuonContainer>& probe_L2SALinkInfo : featureCont){ - ATH_CHECK( probe_L2SALinkInfo.isValid() ); - const ElementLink<xAOD::L2StandAloneMuonContainer> probe_L2SAobject = probe_L2SALinkInfo.link; - if( m_matchTool->isMatchedL2SA( (*probe_L2SAobject), mu ) ){ - if( probe_L2SALinkInfo.state == TrigCompositeUtils::ActiveState::ACTIVE ) passL2SA = true; - } - } - - if(passL2SA == true){ - if(m_matchTool->isMatchedL2InsideOut( Trig_L2IOobject, mu )) - { - bool isPass = false; - ATH_CHECK(isPassedmuCombHypo( chain, Trig_L2IOobject ,isPass)); - passL2InsideOut = isPass; + if( Trig_L2IOobject == nullptr ){ + passL2InsideOut = false; + passL2SA = false; + + // retrieve probe l2SA objects + int legIndex_probe = 1; // probe + std::vector< TrigCompositeUtils::LinkInfo<xAOD::L2StandAloneMuonContainer> > featureCont = getTrigDecisionTool()->features<xAOD::L2StandAloneMuonContainer>( chain, + TrigDefs::includeFailedDecisions, + "HLT_MuonL2SAInfo", + TrigDefs::lastFeatureOfType, + TrigCompositeUtils::featureString(), + legIndex_probe ); + + for(const TrigCompositeUtils::LinkInfo<xAOD::L2StandAloneMuonContainer>& probe_L2SALinkInfo : featureCont){ + ATH_CHECK( probe_L2SALinkInfo.isValid() ); + const ElementLink<xAOD::L2StandAloneMuonContainer> probe_L2SAobject = probe_L2SALinkInfo.link; + if( m_matchTool->isMatchedL2SA( (*probe_L2SAobject), mu ) ){ + if( probe_L2SALinkInfo.state == TrigCompositeUtils::ActiveState::ACTIVE ) passL2SA = true; + ATH_MSG_WARNING(" There is at least one ACTIVE probe L2SA object but no L2IO objects." ); + return StatusCode::SUCCESS; + } } } else{ - return StatusCode::SUCCESS; + if( !m_matchTool->isMatchedL2InsideOut( Trig_L2IOobject, mu ) ) return StatusCode::SUCCESS; // dR between L2Inside-Out object and offline muon is too large + + passL2InsideOut = isPassedmuCombHypo( chain, Trig_L2IOobject ); + passL2SA = true; } - fill(m_group+"_"+chain, passL2InsideOut, passL2SA, offPt); @@ -939,29 +927,31 @@ StatusCode L2MuonSAIOMon :: chooseBestMuon( std::vector< const xAOD::L2CombinedM } -StatusCode L2MuonSAIOMon :: muCombHypo_TDTworkaround( const std::string &chain, const std::vector< const xAOD::L2CombinedMuon* >& Trig_L2IOobjects, std::vector< bool > &pass_muCombHypo ) const{ +bool L2MuonSAIOMon :: muCombHypo_TDTworkaround( const std::string &chain, const std::vector< const xAOD::L2CombinedMuon* >& Trig_L2IOobjects, std::vector< bool > &pass_muCombHypo ) const{ + bool pass_muCombHypo_evt = false; int requireMuonNum = 1; int passHypo_MuonNum = 0; for(auto &Trig_L2IOobject : Trig_L2IOobjects){ - bool isPass_muCombHypo = false; - ATH_CHECK(isPassedmuCombHypo( chain, Trig_L2IOobject ,isPass_muCombHypo)); - bool pass_muCombHypo_obj = isPass_muCombHypo; + bool pass_muCombHypo_obj = isPassedmuCombHypo( chain, Trig_L2IOobject ); pass_muCombHypo.push_back(pass_muCombHypo_obj); if( pass_muCombHypo_obj ) passHypo_MuonNum++; } if( passHypo_MuonNum >= requireMuonNum ){ ATH_MSG_DEBUG("this evt passed muCombhypo"); + pass_muCombHypo_evt = true; } - return StatusCode::SUCCESS; + + return pass_muCombHypo_evt; } -StatusCode L2MuonSAIOMon :: isPassedmuCombHypo( const std::string &chain, const xAOD::L2CombinedMuon* Trig_L2IOobject , bool &pass_muCombHypo) const{ - pass_muCombHypo = false; +bool L2MuonSAIOMon :: isPassedmuCombHypo( const std::string &chain, const xAOD::L2CombinedMuon* Trig_L2IOobject ) const{ + + bool pass_muCombHypo = false; // config std::vector< float > my_EtaBins = {0, 1.05, 1.5, 2.0, 9.9}; @@ -969,7 +959,8 @@ StatusCode L2MuonSAIOMon :: isPassedmuCombHypo( const std::string &chain, const bool my_pikCuts = true; float my_maxPtToApplyPik = 25.; float my_chi2MaxID = 3.5; - ATH_CHECK( decision_ptthreshold( chain, my_EtaBins, my_muCombThres, my_pikCuts, my_maxPtToApplyPik, my_chi2MaxID ) ); + ATH_MSG_DEBUG( "decision_ptthreshold: " << decision_ptthreshold( chain, my_EtaBins, my_muCombThres, my_pikCuts, my_maxPtToApplyPik, my_chi2MaxID ) ); + bool pikCut = true; bool stdCut = true; @@ -997,7 +988,8 @@ StatusCode L2MuonSAIOMon :: isPassedmuCombHypo( const std::string &chain, const ATH_MSG_DEBUG("this obj passed muCombhypo"); pass_muCombHypo = true; } - return StatusCode::SUCCESS; + + return pass_muCombHypo; } @@ -1006,7 +998,6 @@ StatusCode L2MuonSAIOMon :: decision_ptthreshold( const std::string &chain, std: my_maxPtToApplyPik = 25.; my_chi2MaxID = 3.5; - ATH_MSG_DEBUG("this chain is" << chain); if(chain == "HLT_mu4_l2io_L1MU3V"){ my_EtaBins = {0, 1.05, 1.5, 2.0, 9.9}; //4GeV_v15a my_muCombThres = {3.86, 3.77, 3.69, 3.70}; //4GeV_v15a @@ -1015,13 +1006,10 @@ StatusCode L2MuonSAIOMon :: decision_ptthreshold( const std::string &chain, std: my_EtaBins = {0, 1.05, 1.5, 2.0, 9.9}; //6GeV_v15a my_muCombThres = {5.87, 5.79, 5.70, 5.62}; //6GeV_v15a my_pikCuts = false; - }else if(chain == "HLT_mu24_ivarmedium_mu6_l2io_probe_L1MU18VFCH"){ - my_EtaBins = {0, 1.05, 1.5, 2.0, 9.9}; //6GeV_v15a - my_muCombThres = {5.87, 5.79, 5.70, 5.62}; //6GeV_v15a - my_pikCuts = false; }else{ ATH_MSG_ERROR("muCombHypo config is NOT defined in this package:chain = " << chain); } + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/L2MuonSAIOMon.h b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/L2MuonSAIOMon.h index 0f99804f01c19b5723fb6772c28dfbc0726cd4fa..eeeb2648d8914ab1c3d6855e3dee9f949dc08d4c 100644 --- a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/L2MuonSAIOMon.h +++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/L2MuonSAIOMon.h @@ -31,8 +31,8 @@ class L2MuonSAIOMon : public TrigMuonMonitorAlgorithm{ StatusCode L2OverlapRemover( std::vector< const xAOD::L2CombinedMuon* > matchSA_L2IOobjects, std::vector< bool > &isoverlap, std::vector< bool > &passOR ) const; bool isOverlap( const xAOD::L2CombinedMuon* matchSA_L2IOobject1, const xAOD::L2CombinedMuon* matchSA_L2IOobject2 ) const; StatusCode chooseBestMuon( std::vector< const xAOD::L2CombinedMuon* > matchSA_L2IOobjects, std::vector< bool > &passOR, std::vector< unsigned int > &mucombResult ) const; - StatusCode muCombHypo_TDTworkaround( const std::string &chain, const std::vector< const xAOD::L2CombinedMuon* >& Trig_L2IOobjects, std::vector< bool > &pass_muCombHypo ) const; - StatusCode isPassedmuCombHypo( const std::string &chain, const xAOD::L2CombinedMuon* Trig_L2IOobjects ,bool &pass_muCombHypo) const; + bool muCombHypo_TDTworkaround( const std::string &chain, const std::vector< const xAOD::L2CombinedMuon* >& Trig_L2IOobjects, std::vector< bool > &pass_muCombHypo ) const; + bool isPassedmuCombHypo( const std::string &chain, const xAOD::L2CombinedMuon* Trig_L2IOobjects ) const; StatusCode decision_ptthreshold( const std::string &chain, std::vector< float > &my_EtaBins, std::vector< float > &my_muCombThres, bool &my_pikCuts, float &my_maxPtToApplyPik, float &my_chi2MaxID ) const; diff --git a/Trigger/TrigSteer/HLTSeeding/python/HLTSeedingConfig.py b/Trigger/TrigSteer/HLTSeeding/python/HLTSeedingConfig.py index df19cd9d127e8384ea90c983155e877b124e55a4..30f80816e1ed70b5a1a4a1090e5895c283011024 100644 --- a/Trigger/TrigSteer/HLTSeeding/python/HLTSeedingConfig.py +++ b/Trigger/TrigSteer/HLTSeeding/python/HLTSeedingConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 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 @@ -399,8 +399,6 @@ if __name__ == "__main__": flags = initConfigFlags() flags.Trigger.forceEnableAllChains= True flags.Input.Files= ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",] - from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.lock() acc = HLTSeedingCfg( flags ) acc.wasMerged() diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/FexEmulatedTowersConfig.py b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/FexEmulatedTowersConfig.py index 11f3db1e1161d7efd55bb74d339c36f208dc55ee..c22dc7442b5b0a5735d94e03099b46f840d21abb 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/FexEmulatedTowersConfig.py +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/FexEmulatedTowersConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 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 @@ -65,11 +65,7 @@ if __name__ == '__main__': flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)] flags.Concurrency.NumThreads = 1 flags.Concurrency.NumConcurrentEvents = 1 - - if not flags.Input.isMC: - from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags) - + if any(["data" in f for f in args.filesInput]): s=args.filesInput[0].replace('*','').replace('.data','') flags.Output.AODFileName = "AOD."+(s.split("/")[-1]).split('_SFO')[0]+"pool.root" @@ -80,6 +76,10 @@ if __name__ == '__main__': flags.Trigger.doLVL1 = True flags.Trigger.enableL1CaloPhase1 = True + from AthenaConfiguration.Enums import LHCPeriod + if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2: + flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01' + # Enable only calo for this test from AthenaConfiguration.DetectorConfigFlags import setupDetectorsFromList setupDetectorsFromList(flags,['LAr','Tile','MBTS'],True) diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/L1CaloFEXAlgosConfig.py b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/L1CaloFEXAlgosConfig.py index 86ad0b7a1f641f5500cfe42e037ced3afffcd15f..489d2e2f95ecfad86897d6df530b01a24e849e3f 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/L1CaloFEXAlgosConfig.py +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXAlgos/python/L1CaloFEXAlgosConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 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 @@ -98,11 +98,7 @@ if __name__ == '__main__': flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)] flags.Concurrency.NumThreads = 1 flags.Concurrency.NumConcurrentEvents = 1 - - if not flags.Input.isMC: - from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags) - + if any(["data" in f for f in args.filesInput]): s=args.filesInput[0].replace('*','').replace('.data','') flags.Output.AODFileName = "AOD."+(s.split("/")[-1]).split('_SFO')[0]+"pool.root" @@ -113,6 +109,10 @@ if __name__ == '__main__': flags.Trigger.doLVL1 = True flags.Trigger.enableL1CaloPhase1 = True + from AthenaConfiguration.Enums import LHCPeriod + if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2: + flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01' + # Enable only calo for this test from AthenaConfiguration.DetectorConfigFlags import setupDetectorsFromList setupDetectorsFromList(flags,['LAr','Tile','MBTS'],True) diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/FEXReprocessingRun3.py b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/FEXReprocessingRun3.py index 40e7daafcfae7203016845abed1207c81899231f..c5f2815e4d1ca2f69bea26feca84e2c127f677df 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/FEXReprocessingRun3.py +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/FEXReprocessingRun3.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # from AthenaConfiguration.ComponentFactory import CompFactory @@ -42,10 +42,6 @@ if __name__ == '__main__': flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)] flags.Concurrency.NumThreads = 1 flags.Concurrency.NumConcurrentEvents = 1 - - if not flags.Input.isMC: - from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags) if any(["data" in f for f in args.filesInput]): s=args.filesInput[0].replace('*','').replace('.data','') @@ -57,6 +53,10 @@ if __name__ == '__main__': flags.Trigger.doLVL1 = True flags.Trigger.enableL1CaloPhase1 = True + from AthenaConfiguration.Enums import LHCPeriod + if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2: + flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01' + # Enable only calo for this test from AthenaConfiguration.DetectorConfigFlags import setupDetectorsFromList setupDetectorsFromList(flags,['LAr','Tile','MBTS'],True) diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/L1CaloFEXSimCfg.py b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/L1CaloFEXSimCfg.py index 11a763fd691cd4d486fa161fb9ad1532b3ed726d..499c35228d677d830d7684e417097914eae5e56f 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/L1CaloFEXSimCfg.py +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXSim/python/L1CaloFEXSimCfg.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 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 @@ -333,13 +333,7 @@ if __name__ == '__main__': import os flags = initConfigFlags() - flags.Common.isOnline = True flags.Input.Files = [args.input] if os.path.isfile(args.input) else Input.get_input(args.input).paths - if not flags.Input.isMC: - from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags) - from AthenaConfiguration.Enums import LHCPeriod - flags.IOVDb.GlobalTag = 'CONDBR2-HLTP-2023-01' if flags.GeoModel.Run is LHCPeriod.Run3 else 'CONDBR2-HLTP-2018-04' flags.Output.AODFileName = 'AOD.pool.root' flags.Exec.MaxEvents = args.nevents flags.Concurrency.NumThreads = 1 @@ -352,6 +346,10 @@ if __name__ == '__main__': flags.Trigger.enableL1CaloPhase1 = True flags.Trigger.triggerConfig = 'FILE' + from AthenaConfiguration.Enums import LHCPeriod + if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2: + flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01' + # Enable only calo for this test from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags setupDetectorFlags(flags, ['LAr','Tile','MBTS'], toggle_geometry=True) diff --git a/Trigger/TrigT1/TrigGepPerf/share/run_gep.py b/Trigger/TrigT1/TrigGepPerf/share/run_gep.py index 507e8a359666fff051c25fbc8780d0d71ede3088..edbadebb10e34cb7bc074c8fbc7a422b9c40b63e 100644 --- a/Trigger/TrigT1/TrigGepPerf/share/run_gep.py +++ b/Trigger/TrigT1/TrigGepPerf/share/run_gep.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # if __name__ == '__main__': @@ -77,10 +77,6 @@ if __name__ == '__main__': else: flags.Input.Files = Input.get_input(args.input).paths - if not flags.Input.isMC: - from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags) - info('Command line args: ' + str(args)) flags.Output.AODFileName = 'AOD.pool.root' @@ -95,6 +91,10 @@ if __name__ == '__main__': flags.Trigger.doLVL1 = True flags.Trigger.enableL1CaloPhase1 = True + from AthenaConfiguration.Enums import LHCPeriod + if not flags.Input.isMC and flags.GeoModel.Run is LHCPeriod.Run2: + flags.GeoModel.AtlasVersion = 'ATLAS-R2-2016-01-00-01' + # Enable only calo for this test from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags setupDetectorFlags(flags, ['LAr','Tile','MBTS'], toggle_geometry=True) @@ -223,7 +223,7 @@ if __name__ == '__main__': acc.merge(calo_acc422) - from AthenaCommon.Constants import DEBUG + from AthenaCommon.Constants import DEBUG,INFO gepAlgs_output_level = DEBUG from TrigGepPerf.GepClusterTimingAlgConfig import GepClusterTimingAlgCfg @@ -336,3 +336,5 @@ if __name__ == '__main__': sc = acc.run() if sc.isFailure(): exit(1) + + diff --git a/Trigger/TrigT1/TrigT1CaloCalibUtils/share/L1CaloRampMaker.py b/Trigger/TrigT1/TrigT1CaloCalibUtils/share/L1CaloRampMaker.py index d184c151ec4b0139d01152debd85466360dbc874..2ff4bd9eafdbe2ed3b49cdee950c9092fdc508dc 100644 --- a/Trigger/TrigT1/TrigT1CaloCalibUtils/share/L1CaloRampMaker.py +++ b/Trigger/TrigT1/TrigT1CaloCalibUtils/share/L1CaloRampMaker.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration import glob, sys from AthenaConfiguration.AllConfigFlags import initConfigFlags diff --git a/Trigger/TrigT1/TrigT1CaloCondSvc/python/L1CaloCondConfig.py b/Trigger/TrigT1/TrigT1CaloCondSvc/python/L1CaloCondConfig.py index c83c8ddc24b69dc80f1888196dc7ff865be377fe..1e9538dd0965f340af67eb08fdbe85b6aa47c144 100644 --- a/Trigger/TrigT1/TrigT1CaloCondSvc/python/L1CaloCondConfig.py +++ b/Trigger/TrigT1/TrigT1CaloCondSvc/python/L1CaloCondConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration import sys @@ -62,13 +62,13 @@ def L1CaloCondAlgCfg(flags, readTest=False, Physics=True, Calib1=True, Calib2=Tr if __name__=="__main__": from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles flags = initConfigFlags() - flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 + flags.Input.Files = defaultTestFiles.RAW_RUN2 flags.Exec.MaxEvents = 1 flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-2022-02' + flags.GeoModel.AtlasVersion="ATLAS-R2-2015-03-01-00" flags.Trigger.enableL1CaloLegacy = True flags.fillFromArgs() flags.lock() diff --git a/Trigger/TrigT1/TrigT1Monitoring/python/L1CaloCTPMonitorAlgorithm.py b/Trigger/TrigT1/TrigT1Monitoring/python/L1CaloCTPMonitorAlgorithm.py index 6a7a3ad42eec64acab6c983eb84b58d870274b12..3c3113906109838e5f87aec28f3ea9de869f83c5 100644 --- a/Trigger/TrigT1/TrigT1Monitoring/python/L1CaloCTPMonitorAlgorithm.py +++ b/Trigger/TrigT1/TrigT1Monitoring/python/L1CaloCTPMonitorAlgorithm.py @@ -1,7 +1,7 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration # -def L1CaloCTPMonitoringConfig(flags): +def L1CaloCTPMonitoringConfig(inputFlags): '''Function to configure LVL1 L1CaloCTP algorithm in the monitoring system.''' #import math @@ -12,11 +12,11 @@ def L1CaloCTPMonitoringConfig(flags): # any things that need setting up for job e.g. #from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg - #result.merge(AtlasGeometryCfg(flags)) + #result.merge(AtlasGeometryCfg(inputFlags)) # make the athena monitoring helper from AthenaMonitoring import AthMonitorCfgHelper - helper = AthMonitorCfgHelper(flags,'L1CaloCTPMonitoringCfg') + helper = AthMonitorCfgHelper(inputFlags,'L1CaloCTPMonitoringCfg') # get any algorithms L1CaloCTPMonAlg = helper.addAlgorithm(CompFactory.L1CaloCTPMonitorAlgorithm,'L1CaloCTPMonAlg') @@ -59,31 +59,38 @@ def L1CaloCTPMonitoringConfig(flags): if __name__=='__main__': + # For direct tests + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + # set debug level for whole job from AthenaCommon.Logging import log from AthenaCommon.Constants import INFO #DEBUG log.setLevel(INFO) # set input file and config options - from AthenaConfiguration.AllConfigFlags import initConfigFlags + from AthenaConfiguration.AllConfigFlags import ConfigFlags import glob #inputs = glob.glob('/eos/atlas/atlastier0/rucio/data18_13TeV/physics_Main/00357750/data18_13TeV.00357750.physics_Main.recon.ESD.f1072/data18_13TeV.00357750.physics_Main.recon.ESD.f1072._lb0117._SFO-1._0201.1') inputs = glob.glob('/eos/atlas/atlastier0/rucio/data18_13TeV/physics_Main/00354311/data18_13TeV.00354311.physics_Main.recon.ESD.f1129/data18_13TeV.00354311.physics_Main.recon.ESD.f1129._lb0013._SFO-8._0001.1') - flags = initConfigFlags() - flags.Input.Files = inputs - flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1.root' - flags.lock() - flags.dump() # print all the configs + ConfigFlags.Input.Files = inputs + ConfigFlags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1.root' + + ConfigFlags.lock() + ConfigFlags.dump() # print all the configs + + from AthenaCommon.AppMgr import ServiceMgr + ServiceMgr.Dump = False from AthenaConfiguration.MainServicesConfig import MainServicesCfg from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg - cfg = MainServicesCfg(flags) - cfg.merge(PoolReadCfg(flags)) + cfg = MainServicesCfg(ConfigFlags) + cfg.merge(PoolReadCfg(ConfigFlags)) - L1CaloCTPMonitorCfg = L1CaloCTPMonitoringConfig(flags) + L1CaloCTPMonitorCfg = L1CaloCTPMonitoringConfig(ConfigFlags) cfg.merge(L1CaloCTPMonitorCfg) # message level for algorithm diff --git a/Trigger/TrigT1/TrigT1ResultByteStream/python/TrigT1ResultByteStreamConfig.py b/Trigger/TrigT1/TrigT1ResultByteStream/python/TrigT1ResultByteStreamConfig.py index 013228a3f9d35714801c46b256f9cd1479900610..2e89a1354b47c2f3b3e5d064f02fd85fe4cde175 100644 --- a/Trigger/TrigT1/TrigT1ResultByteStream/python/TrigT1ResultByteStreamConfig.py +++ b/Trigger/TrigT1/TrigT1ResultByteStream/python/TrigT1ResultByteStreamConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # from AthenaCommon.Logging import logging from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator @@ -352,19 +352,21 @@ if __name__ == '__main__': if any(["data23" in f for f in args.filesInput]): flags.IOVDb.GlobalTag = "CONDBR2-HLTP-2022-02" flags.Trigger.triggerConfig='DB' + from AthenaConfiguration.Enums import LHCPeriod + flags.GeoModel.Run = LHCPeriod.Run3 # needed for LArGMConfig elif any(["data22" in f for f in args.filesInput]): - flags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07" flags.Trigger.triggerConfig='DB' - - flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)] - - from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags) + from AthenaConfiguration.Enums import LHCPeriod + flags.GeoModel.Run = LHCPeriod.Run3 # needed for LArGMConfig + flags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07" + + flags.Exec.OutputLevel = algLogLevel flags.Exec.MaxEvents = args.evtMax flags.Exec.SkipEvents = args.skipEvents + flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)] flags.Concurrency.NumThreads = 1 flags.Concurrency.NumConcurrentEvents = 1 flags.Output.HISTFileName = args.outputHISTFile diff --git a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py index 446788b568f58a607bd459c7cad18cfa3b36a228..940a4daa03bcd1f3a28609310e8d4b86f6daec5d 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # from AthenaConfiguration.AccumulatorCache import AccumulatorCache @@ -139,11 +139,10 @@ def trigInDetVertexingCfg(flags, inputTracks, outputVtx): if __name__ == "__main__": from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles ComponentAccumulator.debugMode = "trackCA trackPublicTool trackEventAlgo trackCondAlgo trackPrivateTool" flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN2 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.lock() # this configuration is not runable, the test checks if there is no mistake in python scripts above # output can be used by experts to check actual configuration (e.g. here we configure to run on RAW and it should be reflected in settings) diff --git a/Trigger/TrigTools/TrigInDetTrackFitter/src/components/TrigInDetTrackFitter_entries.cxx b/Trigger/TrigTools/TrigInDetTrackFitter/src/components/TrigInDetTrackFitter_entries.cxx index 2c6266e64110487469ac582ee476039ff5e9f294..14993b279346d83a46e2f32b41b5d85551bfd5af 100644 --- a/Trigger/TrigTools/TrigInDetTrackFitter/src/components/TrigInDetTrackFitter_entries.cxx +++ b/Trigger/TrigTools/TrigInDetTrackFitter/src/components/TrigInDetTrackFitter_entries.cxx @@ -1,9 +1,7 @@ #include "../TrigInDetTrackFitter.h" #include "../TrigDkfTrackMakerTool.h" #include "../TrigInDetTrackFollowingTool.h" -#include "../TrigInDetRoadPredictorTool.h" DECLARE_COMPONENT( TrigInDetTrackFitter ) DECLARE_COMPONENT( TrigDkfTrackMakerTool ) DECLARE_COMPONENT( TrigInDetTrackFollowingTool ) -DECLARE_COMPONENT( TrigInDetRoadPredictorTool ) diff --git a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruth.h b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruth.h index b7ebd627ab56881edc5734f14f8a0a917d181a34..e0e9352c078805cf5b878c753a8021a5229f2191 100644 --- a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruth.h +++ b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/TrigInDetTruthEvent/TrigInDetTrackTruth.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ @@ -44,7 +44,7 @@ class TrigInDetTrackTruth { /** initialized constructor: easier way to construct an instance if there is just one true particle associated with a track */ - TrigInDetTrackTruth(const HepMcParticleLink& p_tru_part, TrigIDHitStats hits) + TrigInDetTrackTruth(const HepMcParticleLink p_tru_part, TrigIDHitStats hits) { // add this particle to the vector m_true_part_vec.push_back(p_tru_part); diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py index 4138e31b40a3b7799949ee982373d0ce897de38b..12b8633968607d61efb3718a73f0e2b941022b22 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py +++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_Base.py @@ -45,7 +45,6 @@ if "Art_type" not in locals(): Art_type = 'grid' if "GridFiles" not in locals(): GridFiles=False if "Malloc" not in locals(): Malloc=False if "AbortDryRun" in locals(): abort_dry_run=AbortDryRun -if "useCA_Reco" not in locals(): useCA_Reco=False for opt,arg in opts: if opt in ("-l", "--local"): @@ -75,14 +74,14 @@ if vdry_run == '1': if 'postinclude_file' in dir() : if 'preinclude_file' in dir() : - rdo2aod = TrigInDetReco( postinclude_file=postinclude_file, preinclude_file=preinclude_file, useCA_Reco=useCA_Reco ) + rdo2aod = TrigInDetReco( postinclude_file=postinclude_file, preinclude_file=preinclude_file ) else : - rdo2aod = TrigInDetReco( postinclude_file=postinclude_file, useCA_Reco=useCA_Reco ) + rdo2aod = TrigInDetReco( postinclude_file=postinclude_file ) else : if 'preinclude_file' in dir() : - rdo2aod = TrigInDetReco( preinclude_file=preinclude_file, useCA_Reco=useCA_Reco ) + rdo2aod = TrigInDetReco( preinclude_file=preinclude_file ) else : - rdo2aod = TrigInDetReco( useCA_Reco=useCA_Reco ) + rdo2aod = TrigInDetReco() # test specific variables ... diff --git a/Trigger/TrigValidation/TrigValAlgs/python/TrigValAlgsConfig.py b/Trigger/TrigValidation/TrigValAlgs/python/TrigValAlgsConfig.py index e0f67b6c08b352af971e1c36464a9dcb0136e7a3..16b2ffb714027d07a74bb72a922d433af57e3693 100755 --- a/Trigger/TrigValidation/TrigValAlgs/python/TrigValAlgsConfig.py +++ b/Trigger/TrigValidation/TrigValAlgs/python/TrigValAlgsConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 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 @@ -49,10 +49,9 @@ def getEDMAuxList(flags): if __name__ == '__main__': from AthenaConfiguration.AllConfigFlags import initConfigFlags - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN3 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3 flags.lock() cfg = ComponentAccumulator() diff --git a/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json b/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json index 633f4185c9df9abc345123f62ae4ee1965760c3c..e23d93357ef371e6401a03a6fb1488336b0a3b3d 100644 --- a/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json +++ b/Trigger/TrigValidation/TrigValTools/share/TrigValInputs.json @@ -293,13 +293,6 @@ "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigInDetValidation/samples/valid1.901969.PG_e_Et7to80_vertxy20.recon.RDO.e8544_e8528_s4159_s4114_r14814_tid34085687_00/RDO.34085687._000001.pool.root.1" ] }, - "Single_el_Run4": { - "source": "mc", - "format": "RDO", - "paths": [ - "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/PhaseIIUpgrade/RDO/ATLAS-P2-RUN4-03-00-00/mc21_14TeV.900497.PG_single_epm_Pt100_etaFlatnp0_43.recon.RDO.e8481_s4149_r14697/RDO.33675664._000001.pool.root.1" - ] - }, "Ztautau": { "source": "mc", "format": "RDO", diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py index d774e08ab46f359e1513834a9b744e99276dd3e8..a03669676a4b71e6da3f0764f154162de11f4c21 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration import re from collections import OrderedDict, defaultdict @@ -816,8 +816,6 @@ if __name__ == "__main__": flags = initConfigFlags() flags.Trigger.forceEnableAllChains = True flags.Input.Files = ["/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1",] - from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2 flags.lock() def testMenu(flags): diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerRecoConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerRecoConfig.py index 10c0883fddf867b8f61604310771ea35d065de99..eba9b76fa59c3eedff9ec3219b583e95d8c957a3 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerRecoConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerRecoConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2024 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 @@ -464,9 +464,6 @@ if __name__ == '__main__': elif flags.Trigger.EDMVersion==3: flags.Input.Files = defaultTestFiles.RAW_RUN3 - from AthenaConfiguration.TestDefaults import defaultGeometryTags - flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags) - flags.lock() acc = MainServicesCfg(flags) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py index 25c06891a965164baee4fbb1c6aa114fcfa50e90..0f94cead6fe14e34b573a49e31418ecf329d0915 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLT/CommonSequences/EventBuildingSequences.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration # import functools from TrigEDMConfig import DataScoutingInfo @@ -364,11 +364,10 @@ def isNoAlg(chain): # Unit test if __name__ == "__main__": - from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags + from AthenaConfiguration.TestDefaults import defaultTestFiles from AthenaConfiguration.AllConfigFlags import initConfigFlags flags = initConfigFlags() flags.Input.Files = defaultTestFiles.RAW_RUN3 - flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3 flags.lock() # Ensure all DS identifiers have been added to the EB list: diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py index 3439e826f98deb63d4e0176c0255e7a43aa39b3e..e4b8c31751d5c249b4d83c4c8216cfe35d18363c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py @@ -489,10 +489,6 @@ class ItemDef: MenuItem('L1_eTAU35' ).setLogic( d.eTAU35 & physcond).setTriggerType( TT.calo ) MenuItem('L1_cTAU35M' ).setLogic( d.cTAU35M & physcond).setTriggerType( TT.calo ) MenuItem('L1_eTAU40HM').setLogic( d.eTAU40HM & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eTAU40HT').setLogic( d.eTAU40HT & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eTAU60HM').setLogic( d.eTAU60HM & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eTAU80HL').setLogic( d.eTAU80HL & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eTAU60HL').setLogic( d.eTAU60HL & physcond).setTriggerType( TT.calo ) MenuItem('L1_eTAU60' ).setLogic( d.eTAU60 & physcond).setTriggerType( TT.calo ) MenuItem('L1_eTAU80' ).setLogic( d.eTAU80 & physcond).setTriggerType( TT.calo ) MenuItem('L1_eTAU140' ).setLogic( d.eTAU140 & physcond).setTriggerType( TT.calo ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDef.py index 2d84eaa2cd962ffad11e79c1673248b54583cf64..bb2227e67b9546f38c5ff21fb6892eadcd9d5433 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDef.py @@ -176,16 +176,10 @@ class ThresholdDef: eTAU_cuts = [20, 30, 35] for thrV in eTAU_cuts: eTauThreshold('eTAU%iM' % thrV, 'eTAU').setEt(get_threshold_cut('eTAU', thrV)).setIsolation( rCore = "Medium" ) - eTAU_cuts = [40] - for thrV in eTAU_cuts: - eTauThreshold('eTAU%iHT' % thrV, 'eTAU').setEt(get_threshold_cut('eTAU', thrV)).setIsolation( rHad = "Tight" ) - eTAU_cuts = [40,60] for thrV in eTAU_cuts: eTauThreshold('eTAU%iHM' % thrV, 'eTAU').setEt(get_threshold_cut('eTAU', thrV)).setIsolation( rHad = "Medium" ) - eTAU_cuts = [60,80] - for thrV in eTAU_cuts: - eTauThreshold('eTAU%iHL' % thrV, 'eTAU').setEt(get_threshold_cut('eTAU', thrV)).setIsolation( rHad = "Loose" ) + # eTAU SPARES for thrV in range(1,11): eTauThreshold('eTAUSPARE%i' % thrV, 'eTAU').setEt(thrVal_SPARE)