diff --git a/Event/xAOD/xAODTrigger/CMakeLists.txt b/Event/xAOD/xAODTrigger/CMakeLists.txt index 3e1d2e4cd67d263a3fe077a3205858f52acbd012..6db11bfc32c00918e13f7296aab4bc2e6b272599 100644 --- a/Event/xAOD/xAODTrigger/CMakeLists.txt +++ b/Event/xAOD/xAODTrigger/CMakeLists.txt @@ -30,8 +30,10 @@ atlas_add_xaod_smart_pointer_dicts( "xAOD::TrigPassBitsContainer_v1" "xAOD::TriggerMenuJsonContainer_v1" "xAOD::eFexEMRoIContainer_v1" "xAOD::eFexTauRoIContainer_v1" "xAOD::jFexSRJetRoIContainer_v1" - "xAOD::jFexLRJetRoIContainer_v1" "xAOD::jFexTauRoIContainer_v1" + "xAOD::jFexLRJetRoIContainer_v1" "xAOD::jFexTauRoIContainer_v1" "xAOD::jFexSumETRoIContainer_v1" "xAOD::jFexMETRoIContainer_v1" + + "xAOD::L1TopoSimResultsContainer_v1" "xAOD::gFexJetRoIContainer_v1" "xAOD::gFexGlobalRoIContainer_v1" OBJECTS "xAOD::EnergySumRoI_v1" "xAOD::EnergySumRoI_v2" diff --git a/Event/xAOD/xAODTrigger/Root/L1TopoSimResultsAuxContainer_v1.cxx b/Event/xAOD/xAODTrigger/Root/L1TopoSimResultsAuxContainer_v1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a3d286ad708549b7cc879797792e6adedcfb2528 --- /dev/null +++ b/Event/xAOD/xAODTrigger/Root/L1TopoSimResultsAuxContainer_v1.cxx @@ -0,0 +1,22 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: L1TopoSimResultsAuxContainer_v1.cxx 2021-10-06 @asonay $ +// Local include(s): +#include "xAODTrigger/versions/L1TopoSimResultsAuxContainer_v1.h" + +namespace xAOD { + + L1TopoSimResultsAuxContainer_v1::L1TopoSimResultsAuxContainer_v1() + : AuxContainerBase() { + + AUX_VARIABLE( boardName ); + AUX_VARIABLE( word32 ); + AUX_VARIABLE( word64 ); + AUX_VARIABLE( wordOptical ); + AUX_VARIABLE( clock ); + + } + +} // namespace xAOD diff --git a/Event/xAOD/xAODTrigger/Root/L1TopoSimResults_v1.cxx b/Event/xAOD/xAODTrigger/Root/L1TopoSimResults_v1.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9c3e27ee02e2b46091793d3a2cfac815c6e46ff4 --- /dev/null +++ b/Event/xAOD/xAODTrigger/Root/L1TopoSimResults_v1.cxx @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + + +// System include(s): +#include <iostream> +#include <stdexcept> + +// xAOD include(s): +#include "xAODCore/AuxStoreAccessorMacros.h" + +// Local include(s): +#include "xAODTrigger/versions/L1TopoSimResults_v1.h" + +namespace xAOD { + + L1TopoSimResults_v1::L1TopoSimResults_v1() + : SG::AuxElement() { + } + + + // Name + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( L1TopoSimResults_v1, std::string, boardName, + setName ) + + // Raw data words + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( L1TopoSimResults_v1, uint32_t, word32, + setWord32 ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( L1TopoSimResults_v1, uint64_t, word64, + setWord64 ) + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( L1TopoSimResults_v1, std::bitset<128>, wordOptical, + setWordOptical ) + + // Clock + AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( L1TopoSimResults_v1, unsigned int, clock, + setClock ) + +} diff --git a/Event/xAOD/xAODTrigger/Root/dict/ContainerProxies.cxx b/Event/xAOD/xAODTrigger/Root/dict/ContainerProxies.cxx index 7c09d4f7721db402dc11adda5e225cb96e1b1641..a55361127d45add916b56f56707ea1812e6beff3 100644 --- a/Event/xAOD/xAODTrigger/Root/dict/ContainerProxies.cxx +++ b/Event/xAOD/xAODTrigger/Root/dict/ContainerProxies.cxx @@ -32,6 +32,8 @@ #include "xAODTrigger/versions/BunchConfContainer_v1.h" #include "xAODTrigger/versions/TrigPassBitsContainer_v1.h" +#include "xAODTrigger/versions/L1TopoSimResultsContainer_v1.h" + // Set up the collection proxies: ADD_NS_DV_PROXY( xAOD, TriggerMenuContainer_v1 ); ADD_NS_DV_PROXY( xAOD, TriggerMenuJsonContainer_v1 ); @@ -54,3 +56,5 @@ ADD_NS_DV_PROXY( xAOD, gFexGlobalRoIContainer_v1 ); ADD_NS_DV_PROXY( xAOD, TrigCompositeContainer_v1 ); ADD_NS_DV_PROXY( xAOD, BunchConfContainer_v1 ); ADD_NS_DV_PROXY( xAOD, TrigPassBitsContainer_v1 ); + +ADD_NS_DV_PROXY( xAOD, L1TopoSimResultsContainer_v1 ); diff --git a/Event/xAOD/xAODTrigger/Root/xAODTriggerCLIDs.cxx b/Event/xAOD/xAODTrigger/Root/xAODTriggerCLIDs.cxx index cecec5532d298c3a70f93c1c7a85d4416e2c183b..73245b1b4b9e03eb8fa3ea5c003f680e272549f6 100644 --- a/Event/xAOD/xAODTrigger/Root/xAODTriggerCLIDs.cxx +++ b/Event/xAOD/xAODTrigger/Root/xAODTriggerCLIDs.cxx @@ -55,3 +55,6 @@ #include "xAODTrigger/gFexJetRoIAuxContainer.h" #include "xAODTrigger/gFexGlobalRoIContainer.h" #include "xAODTrigger/gFexGlobalRoIAuxContainer.h" + +#include "xAODTrigger/L1TopoSimResultsContainer.h" +#include "xAODTrigger/L1TopoSimResultsAuxContainer.h" diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/L1TopoSimResults.h b/Event/xAOD/xAODTrigger/xAODTrigger/L1TopoSimResults.h new file mode 100644 index 0000000000000000000000000000000000000000..5054a80752d7937fdb21f12c9bc4b0d5adaea43a --- /dev/null +++ b/Event/xAOD/xAODTrigger/xAODTrigger/L1TopoSimResults.h @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: L1TopoSimResults.h 2021-10-06 @asonay $ +#ifndef XAODL1TOPOSIMRESULTS_H +#define XAODL1TOPOSIMRESULTS_H + +// Local include(s): +#include "xAODTrigger/versions/L1TopoSimResults_v1.h" + +// Namespace holding all the xAOD EDM classes +namespace xAOD{ + /// Define the latest version of the L1TopoSimResults class + typedef L1TopoSimResults_v1 L1TopoSimResults; +} + +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF( xAOD::L1TopoSimResults , 14350674 , 1 ) +#endif diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/L1TopoSimResultsAuxContainer.h b/Event/xAOD/xAODTrigger/xAODTrigger/L1TopoSimResultsAuxContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..b04bab1371c91b3c9e91b12f1d7183cf4106424f --- /dev/null +++ b/Event/xAOD/xAODTrigger/xAODTrigger/L1TopoSimResultsAuxContainer.h @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: L1TopoSimResultsAuxContainer.h 2021-10-06 @asonay $ +#ifndef XAODTRIGGER_L1TOPOSIMRESULTSAUXCONTAINER_H +#define XAODTRIGGER_L1TOPOSIMRESULTSAUXCONTAINER_H + +// Local include(s): +#include "xAODTrigger/versions/L1TopoSimResultsAuxContainer_v1.h" + +namespace xAOD{ + typedef L1TopoSimResultsAuxContainer_v1 L1TopoSimResultsAuxContainer; +} + +// Set up a CLID for the class: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF( xAOD::L1TopoSimResultsAuxContainer , 913551489 , 1 ) + +#endif // XAODTRIGGER_L1TOPOSIMRESULTSAUXCONTAINER_H diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/L1TopoSimResultsContainer.h b/Event/xAOD/xAODTrigger/xAODTrigger/L1TopoSimResultsContainer.h new file mode 100644 index 0000000000000000000000000000000000000000..71c1fb5a7dcaa1d92b914d74d80d8b04b545b175 --- /dev/null +++ b/Event/xAOD/xAODTrigger/xAODTrigger/L1TopoSimResultsContainer.h @@ -0,0 +1,21 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: L1TopoSimResultsContainer.h 2021-10-06 @asonay $ +#ifndef XAODTRIGGER_L1TOPOSIMRESULTSCONTAINER_H +#define XAODTRIGGER_L1TOPOSIMRESULTSCONTAINER_H + +// Local include(s): +#include "xAODTrigger/L1TopoSimResults.h" +#include "xAODTrigger/versions/L1TopoSimResultsContainer_v1.h" + +namespace xAOD{ + typedef L1TopoSimResultsContainer_v1 L1TopoSimResultsContainer; +} + +// Set up a CLID for the container: +#include "xAODCore/CLASS_DEF.h" +CLASS_DEF( xAOD::L1TopoSimResultsContainer , 983476512 , 1 ) + +#endif // XAODTRIGGER_L1TOPOSIMRESULTSCONTAINER_H diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/selection.xml b/Event/xAOD/xAODTrigger/xAODTrigger/selection.xml index 132e00de3e07f78ba766202e5e1bdad398db2db9..820232c82d8098edfff82a39639c508725ff8552 100644 --- a/Event/xAOD/xAODTrigger/xAODTrigger/selection.xml +++ b/Event/xAOD/xAODTrigger/xAODTrigger/selection.xml @@ -315,4 +315,16 @@ <class name="xAOD::BunchConfKey_v1" id="B7FA1A14-95A4-4852-813E-CB2271906060" /> + <!-- xAOD::L1TopoSimResults interface type(s). --> + <class name="xAOD::L1TopoSimResults_v1" /> + <class name="xAOD::L1TopoSimResultsContainer_v1" + id="5CB2DCCD-3B78-4A15-AC49-D95B228A29AB" /> + <typedef name="xAOD::L1TopoSimResults" /> + <typedef name="xAOD::L1TopoSimResultsContainer" /> + + <!-- xAOD::L1TopoSimResults auxiliary type(s). --> + <class name="xAOD::L1TopoSimResultsAuxContainer_v1" + id="172EB8B8-A879-47Z2-94AC-43B2472E2AAF" /> + <typedef name="xAOD::L1TopoSimResultsAuxContainer" /> + </lcgdict> diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/versions/L1TopoSimResultsAuxContainer_v1.h b/Event/xAOD/xAODTrigger/xAODTrigger/versions/L1TopoSimResultsAuxContainer_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..7198beb0d53b254a85bfefc491b35849ea7297eb --- /dev/null +++ b/Event/xAOD/xAODTrigger/xAODTrigger/versions/L1TopoSimResultsAuxContainer_v1.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: L1TopoSimResultsAuxContainer_v1.h 2021-10-06 @asonay $ +#ifndef XAODTRIGGER_VERSIONS_L1TOPOSIMRESULTSAUXCONTAINER_V1_H +#define XAODTRIGGER_VERSIONS_L1TOPOSIMRESULTSAUXCONTAINER_V1_H + +// System include(s): +extern "C" { +# include <stdint.h> +} +#include <vector> +#include <string> +#include <bitset> + +// EDM include(s): +#include "xAODCore/AuxContainerBase.h" + +namespace xAOD { + + // Auxiliary store for the L1Topo decision container + // + // @author Anil Sonay <anil.sonay@cern.ch> + // + // $Revision: 0 $ + // $Date: 2021-10-06 $ + // + class L1TopoSimResultsAuxContainer_v1 : public AuxContainerBase { + + public: + /// Default constuctor + L1TopoSimResultsAuxContainer_v1(); + + private: + std::vector< std::string > boardName; + std::vector< uint32_t > word32; + std::vector< uint64_t > word64; + std::vector< std::bitset<128> > wordOptical; + std::vector< unsigned int > clock; + + }; // class L1TopoSimResultsAuxContainer_v1 + +} // namespace xAOD + +// Declare the inheritance of the container: +#include "xAODCore/BaseInfo.h" +SG_BASE( xAOD::L1TopoSimResultsAuxContainer_v1, xAOD::AuxContainerBase ); + +#endif // XAODTRIGGER_VERSIONS_L1TOPOSIMRESULTSAUXCONTAINER_V1_H diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/versions/L1TopoSimResultsContainer_v1.h b/Event/xAOD/xAODTrigger/xAODTrigger/versions/L1TopoSimResultsContainer_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..a4ceabd5b89c1b9202471ff785299b1352c7f76a --- /dev/null +++ b/Event/xAOD/xAODTrigger/xAODTrigger/versions/L1TopoSimResultsContainer_v1.h @@ -0,0 +1,20 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id: L1TopoSimResultsContainer_v1.cxx 2021-10-06 @asonay $ +#ifndef XAODTRIGGER_VERSIONS_L1TOPOSIMRESULTSCONTAINER_V1_H +#define XAODTRIGGER_VERSIONS_L1TOPOSIMRESULTSCONTAINER_V1_H + +// Core include(s): +#include "AthContainers/DataVector.h" + +// Local include(s): +#include "xAODTrigger/versions/L1TopoSimResults_v1.h" + +namespace xAOD { + /// Declare the em/tau RoI container type + typedef DataVector< xAOD::L1TopoSimResults_v1 > L1TopoSimResultsContainer_v1; +} + +#endif // XAODTRIGGER_VERSIONS_L1TOPOSIMRESULTSCONTAINER_V1_H diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/versions/L1TopoSimResults_v1.h b/Event/xAOD/xAODTrigger/xAODTrigger/versions/L1TopoSimResults_v1.h new file mode 100644 index 0000000000000000000000000000000000000000..ec5bff639ef8ae5900383f90f408fb9587224a48 --- /dev/null +++ b/Event/xAOD/xAODTrigger/xAODTrigger/versions/L1TopoSimResults_v1.h @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef XAODTRIGGER_VERSIONS_L1TOPOSIMRESULTS_V1_H +#define XAODTRIGGER_VERSIONS_L1TOPOSIMRESULTS_V1_H + +// System include(s): +extern "C" { +# include <stdint.h> +} +#include <string> +#include <vector> +#include <bitset> + +// EDM include(s): +#include "AthContainers/AuxElement.h" + +namespace xAOD { + + // Class used to describe L1Topo decision bits + // + // This is a generic class for describing the output of L1Topo + // simulation decisions for all boards + // + // @author Anil Sonay <anil.sonay@cern.ch> + // + // $Revision: 0 $ + // $D 2021-10-05 $ + class L1TopoSimResults_v1 : public SG::AuxElement { + + public: + + // Default constructor + L1TopoSimResults_v1(); + + // Get a human-readable name for the object + std::string boardName() const; + // Set a human-readable name for the object + void setName( const std::string name ); + + // The "raw" 32/64-bit words describing the topological decision + uint32_t word32() const; + uint64_t word64() const; + std::bitset<128> wordOptical() const; + + // Set the "raw" 32/64-bit words describing the topological decision + void setWord32( const uint32_t value ); + void setWord64( const uint64_t value ); + void setWordOptical( const std::bitset<128> value ); + + // Get clock information + unsigned int clock() const; + // Set clock information + void setClock( const unsigned int clock ); + + }; // class + +} // namespace xAOD + +#endif // XAODTRIGGER_VERSIONS_L1TOPOSIMRESULTS_V1_H diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/xAODTriggerDict.h b/Event/xAOD/xAODTrigger/xAODTrigger/xAODTriggerDict.h index 7859bd67119220a8be7da8b0ab093e9358706611..12d66e415be7cd9c91efe84e19c401dd865be2e3 100644 --- a/Event/xAOD/xAODTrigger/xAODTrigger/xAODTriggerDict.h +++ b/Event/xAOD/xAODTrigger/xAODTrigger/xAODTriggerDict.h @@ -167,6 +167,13 @@ #include "xAODTrigger/versions/RoiDescriptorStore_v1.h" #include "xAODTrigger/versions/RoiDescriptorStoreAuxInfo_v1.h" +#include "xAODTrigger/L1TopoSimResults.h" +#include "xAODTrigger/L1TopoSimResultsContainer.h" +#include "xAODTrigger/L1TopoSimResultsAuxContainer.h" +#include "xAODTrigger/versions/L1TopoSimResults_v1.h" +#include "xAODTrigger/versions/L1TopoSimResultsContainer_v1.h" +#include "xAODTrigger/versions/L1TopoSimResultsAuxContainer_v1.h" + // EDM include(s). #include "xAODCore/tools/DictHelpers.h" @@ -198,6 +205,8 @@ namespace { XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigCompositeContainer_v1 ); XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, TrigPassBitsContainer_v1 ); + + XAOD_INSTANTIATE_NS_CONTAINER_TYPES( xAOD, L1TopoSimResultsContainer_v1 ); XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, JetEtRoI_v1 ); XAOD_INSTANTIATE_NS_OBJECT_TYPES( xAOD, EnergySumRoI_v1 ); diff --git a/Event/xAOD/xAODTriggerAthenaPool/CMakeLists.txt b/Event/xAOD/xAODTriggerAthenaPool/CMakeLists.txt index 231b7f455f06bc2fe1efe57b370acc9865dd22e9..d6fd5022f1364ba71bf3f89a254c3b41a4ad8cd6 100644 --- a/Event/xAOD/xAODTriggerAthenaPool/CMakeLists.txt +++ b/Event/xAOD/xAODTriggerAthenaPool/CMakeLists.txt @@ -28,6 +28,7 @@ atlas_add_poolcnv_library( xAODTriggerAthenaPoolPoolCnv xAODTrigger/jFexTauRoIContainer.h xAODTrigger/jFexTauRoIAuxContainer.h xAODTrigger/jFexSumETRoIContainer.h xAODTrigger/jFexSumETRoIAuxContainer.h xAODTrigger/jFexMETRoIContainer.h xAODTrigger/jFexMETRoIAuxContainer.h + xAODTrigger/L1TopoSimResultsContainer.h xAODTrigger/L1TopoSimResultsAuxContainer.h xAODTrigger/gFexJetRoIContainer.h xAODTrigger/gFexJetRoIAuxContainer.h xAODTrigger/gFexGlobalRoIContainer.h xAODTrigger/gFexGlobalRoIAuxContainer.h TYPES_WITH_NAMESPACE xAOD::MuonRoIContainer xAOD::MuonRoIAuxContainer @@ -52,6 +53,7 @@ atlas_add_poolcnv_library( xAODTriggerAthenaPoolPoolCnv xAOD::jFexTauRoIContainer xAOD::jFexTauRoIAuxContainer xAOD::jFexSumETRoIContainer xAOD::jFexSumETRoIAuxContainer xAOD::jFexMETRoIContainer xAOD::jFexMETRoIAuxContainer + xAOD::L1TopoSimResultsContainer xAOD::L1TopoSimResultsAuxContainer xAOD::gFexJetRoIContainer xAOD::gFexJetRoIAuxContainer xAOD::gFexGlobalRoIContainer xAOD::gFexGlobalRoIAuxContainer diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/IInputTOBConverter.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/IInputTOBConverter.h index 0d6c1ed1cd3f89ec84dddc9798d7a5f959c2d862..3492960cb71b36f0d94f191f3a5c038cef336d06 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/IInputTOBConverter.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/IInputTOBConverter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef L1TopoSimulation_IInputTOBConverter diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/IReadTopoEDM.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/IReadTopoEDM.h new file mode 100644 index 0000000000000000000000000000000000000000..296cb5ecff01c61a8ef72938417f0573f19169d0 --- /dev/null +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/L1TopoSimulation/IReadTopoEDM.h @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef L1TopoSimulation_IReadTopoEDM +#define L1TopoSimulation_IReadTopoEDM + +//#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/IAlgTool.h" + +namespace TCS { + class TopoInputEvent; +} + +namespace LVL1 { + + /** + * \class IReadTopoEDM + */ + class IReadTopoEDM : virtual public extend_interfaces1<IAlgTool> { + public: + DeclareInterfaceID(IReadTopoEDM, 0, 1); + + virtual StatusCode Read(bool isLegacy) const = 0; + }; + +} + + +#endif diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx index e02bb40a453f2fca5e807aa39733deac8f0ca57f..fdc0b3c939c6beb53229d2fcbc19144bdf11fab3 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx @@ -18,6 +18,8 @@ #include "L1TopoRDO/L1TopoTOB.h" #include "L1TopoRDO/L1TopoRDOCollection.h" +#include "xAODTrigger/L1TopoSimResults.h" + using namespace LVL1; @@ -104,7 +106,14 @@ L1TopoSimulation::initialize() { topoHistSvc->setBaseDir("/EXPERT/" + m_histBaseDir.value()); m_topoSteering->setHistSvc(topoHistSvc); - + + if (m_isLegacyTopo) {ATH_CHECK(m_legacyL1topoKey.initialize());} + else {ATH_CHECK(m_l1topoKey.initialize());} + + ATH_MSG_DEBUG("retrieving " << m_topoEDM); + CHECK( m_topoEDM.retrieve() ); + + return StatusCode::SUCCESS; } @@ -138,6 +147,11 @@ StatusCode L1TopoSimulation::execute() { const EventContext& ctx = Gaudi::Hive::currentContext(); + // prepare container + m_l1topoContainer = std::make_unique<xAOD::L1TopoSimResultsContainer> (); + m_l1topoAuxContainer = std::make_unique<xAOD::L1TopoSimResultsAuxContainer> (); + m_l1topoContainer->setStore(m_l1topoAuxContainer.get()); + if (m_prescale>1 && not m_scaler->decision(m_prescale)){ ATH_MSG_DEBUG( "This event not processed due to prescale"); return StatusCode::SUCCESS; @@ -211,7 +225,7 @@ L1TopoSimulation::execute() { const TrigConf::L1Menu * l1menu = nullptr; ATH_CHECK( detStore()->retrieve(l1menu) ); - + if( m_isLegacyTopo ) { // set electrical connectors std::string conn1 = l1menu->board("LegacyTopo0").connectorNames()[0]; @@ -220,18 +234,23 @@ L1TopoSimulation::execute() { topoOutput2CTP->setCableWord0( clock, 0 ); // ALFA ATH_MSG_DEBUG("Word 1 " << conn1 << " clock " << clock << " " << globalOutput.decision_field( conn1, clock) ); topoOutput2CTP->setCableWord1( clock, globalOutput.decision_field( conn1, clock) ); // TOPO 0 + WriteEDM(m_l1topoContainer,conn1,clock,globalOutput.decision_field( conn1, clock)); ATH_MSG_DEBUG("Word 2 " << conn2 << " clock " << clock << " " << globalOutput.decision_field( conn2, clock) ); topoOutput2CTP->setCableWord2( clock, globalOutput.decision_field( conn2, clock) ); // TOPO 1 + WriteEDM(m_l1topoContainer,conn2,clock,globalOutput.decision_field( conn2, clock)); // topoOverflow2CTP->setCableWord0( clock, 0 ); // ALFA // topoOverflow2CTP->setCableWord1( clock, dec.overflow( 0, clock) ); // TOPO 0 // topoOverflow2CTP->setCableWord2( clock, dec.overflow( 1, clock) ); // TOPO 1 } - // set optical connectors - + SG::WriteHandle<xAOD::L1TopoSimResultsContainer> outputHandle(m_legacyL1topoKey/*, ctx*/); + ATH_MSG_DEBUG(" write: " << outputHandle.key() << " = " << "..." ); + ATH_CHECK(outputHandle.record(std::move(m_l1topoContainer),std::move(m_l1topoAuxContainer))); + CHECK(SG::makeHandle(m_legacyTopoCTPLocation) .record(std::move(topoOutput2CTP))); CHECK(SG::makeHandle(m_legacyTopoOverflowCTPLocation).record(std::move(topoOverflow2CTP))); + CHECK(m_topoEDM->Read(true)); } else { // set electrical connectors std::string conn1 = l1menu->board("Topo2").connectorNames()[0]; @@ -239,8 +258,10 @@ L1TopoSimulation::execute() { for(unsigned int clock=0; clock<2; ++clock) { ATH_MSG_DEBUG("Word 1 " << conn1 << " clock " << clock << " " << globalOutput.decision_field( conn1, clock) ); topoOutput2CTP->setCableWord1( clock, globalOutput.decision_field( conn1, clock) ); // TOPO 0 + WriteEDM(m_l1topoContainer,conn1,clock,globalOutput.decision_field( conn1, clock)); ATH_MSG_DEBUG("Word 2 " << conn2 << " clock " << clock << " " << globalOutput.decision_field( conn2, clock) ); topoOutput2CTP->setCableWord2( clock, globalOutput.decision_field( conn2, clock) ); // TOPO 1 + WriteEDM(m_l1topoContainer,conn2,clock,globalOutput.decision_field( conn2, clock)); // topoOverflow2CTP->setCableWord0( clock, 0 ); // ALFA // topoOverflow2CTP->setCableWord1( clock, dec.overflow( 0, clock) ); // TOPO 0 // topoOverflow2CTP->setCableWord2( clock, dec.overflow( 1, clock) ); // TOPO 1 @@ -249,12 +270,18 @@ L1TopoSimulation::execute() { // set optical connectors for( auto connOpt : l1menu->board("Topo1").connectorNames() ) { topoOutput2CTP->setOptCableWord( connOpt, globalOutput.count_field(connOpt) ); + WriteEDM(m_l1topoContainer,connOpt,0,globalOutput.count_field(connOpt)); } + SG::WriteHandle<xAOD::L1TopoSimResultsContainer> outputHandle(m_l1topoKey/*, ctx*/); + ATH_MSG_DEBUG(" write: " << outputHandle.key() << " = " << "..." ); + ATH_CHECK(outputHandle.record(std::move(m_l1topoContainer),std::move(m_l1topoAuxContainer))); + CHECK(SG::makeHandle(m_topoCTPLocation) .record(std::move(topoOutput2CTP))); CHECK(SG::makeHandle(m_topoOverflowCTPLocation).record(std::move(topoOverflow2CTP))); - } + CHECK(m_topoEDM->Read(false)); + } return StatusCode::SUCCESS; } @@ -266,6 +293,45 @@ L1TopoSimulation::finalize() { return StatusCode::SUCCESS; } +void +L1TopoSimulation::WriteEDM(std::unique_ptr<xAOD::L1TopoSimResultsContainer> &container, std::string name, unsigned int clock, uint32_t word) { + + xAOD::L1TopoSimResults *l1topo_dec = new xAOD::L1TopoSimResults(); + container->push_back(l1topo_dec); + l1topo_dec->setName(name); + l1topo_dec->setClock(clock); + l1topo_dec->setWord32(word); + + ATH_MSG_DEBUG( "L1Topo EDM:: BoardName: " << l1topo_dec->boardName() << " Clock: " << l1topo_dec->clock() << " Decision: " << l1topo_dec->word32() ); +} + +void +L1TopoSimulation::WriteEDM(std::unique_ptr<xAOD::L1TopoSimResultsContainer> &container, std::string name, unsigned int clock, uint64_t word) { + + xAOD::L1TopoSimResults *l1topo_dec = new xAOD::L1TopoSimResults(); + container->push_back(l1topo_dec); + l1topo_dec->setName(name); + l1topo_dec->setClock(clock); + l1topo_dec->setWord64(word); + + ATH_MSG_DEBUG( "L1Topo EDM:: BoardName: " << l1topo_dec->boardName() << " Clock: " << l1topo_dec->clock() << " Decision: " << l1topo_dec->word64() ); + +} + + +void +L1TopoSimulation::WriteEDM(std::unique_ptr<xAOD::L1TopoSimResultsContainer> &container, std::string name, unsigned int clock, std::bitset<128> word) { + + xAOD::L1TopoSimResults *l1topo_dec = new xAOD::L1TopoSimResults(); + container->push_back(l1topo_dec); + l1topo_dec->setName(name); + l1topo_dec->setClock(clock); + l1topo_dec->setWordOptical(word); + + ATH_MSG_DEBUG( "L1Topo EDM:: BoardName: " << l1topo_dec->boardName() << " Clock: " << l1topo_dec->clock() << " Decision: " << l1topo_dec->wordOptical() ); + +} + StatusCode L1TopoSimulation::retrieveHardwareDecision() diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.h index 33ee6c79ca0bd964481b5a3cfb64ae141a3367cb..5f4dd92a7adba2af6f07a1f5435dced0c411874c 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.h +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.h @@ -7,6 +7,7 @@ #include "L1TopoCoreSim/TopoSteering.h" #include "L1TopoSimulation/IInputTOBConverter.h" +#include "L1TopoSimulation/IReadTopoEDM.h" #include "PeriodicScaler.h" #include "TrigConfBase/MsgStream.h" @@ -14,6 +15,9 @@ #include "TrigConfData/L1Menu.h" #include "TrigT1Interfaces/FrontPanelCTP.h" +#include "xAODTrigger/L1TopoSimResultsContainer.h" +#include "xAODTrigger/L1TopoSimResultsAuxContainer.h" + #include "StoreGate/ReadHandleKey.h" #include "AthenaBaseComps/AthAlgorithm.h" @@ -48,18 +52,24 @@ namespace LVL1 { StatusCode retrieveHardwareDecision(); private: + void WriteEDM(std::unique_ptr<xAOD::L1TopoSimResultsContainer> &container, std::string name, unsigned int clock, uint32_t word); + void WriteEDM(std::unique_ptr<xAOD::L1TopoSimResultsContainer> &container, std::string name, unsigned int clock, uint64_t word); + void WriteEDM(std::unique_ptr<xAOD::L1TopoSimResultsContainer> &container, std::string name, unsigned int clock, std::bitset<128> word); std::unique_ptr<TCS::TopoSteering> m_topoSteering; //!< the topo steering std::unique_ptr<LVL1::PeriodicScaler> m_scaler {nullptr}; //! prescale decision tool + std::unique_ptr< xAOD::L1TopoSimResultsContainer > m_l1topoContainer; + std::unique_ptr< xAOD::L1TopoSimResultsAuxContainer > m_l1topoAuxContainer; - // Services and input tools + // Services and input tools ServiceHandle<ITHistSvc> m_histSvc { this, "HistSvc", "THistSvc/THistSvc", "Histogramming service for L1Topo algorithms" }; ToolHandle<IInputTOBConverter> m_emtauInputProvider { this, "EMTAUInputProvider", "LVL1::EMTauInputProvider/EMTauInputProvider", "Tool to fill the EMTAU TOBs of the topo input event" }; ToolHandle<IInputTOBConverter> m_jetInputProvider { this, "JetInputProvider", "LVL1::JetInputProvider/JetInputProvider", "Tool to fill the Jet TOBs of the topo input event" }; ToolHandle<IInputTOBConverter> m_energyInputProvider { this, "EnergyInputProvider", "LVL1::EnergyInputProvider/EnergyInputProvider", "Tool to fill the energy and MET TOBs of the topo input event"}; ToolHandle<IInputTOBConverter> m_muonInputProvider { this, "MuonInputProvider", "LVL1::MuonInputProvider/MuonInputProvider", "Tool to fill the muon TOBs of the topo input event" }; + ToolHandle<IReadTopoEDM> m_topoEDM { this, "TopoEDMReader", "LVL1::TopoEDM/TopoEDM", "Tool to read EDM" }; // outputs SG::WriteHandleKey<LVL1::FrontPanelCTP> m_topoCTPLocation { this, "TopoCTPLocation", LVL1::DEFAULT_L1TopoCTPLocation, "StoreGate key of topo decision output for CTP"}; ///< SG key of decision bits for CTP @@ -68,6 +78,10 @@ namespace LVL1 { SG::WriteHandleKey<LVL1::FrontPanelCTP> m_legacyTopoCTPLocation { this, "LegacyTopoCTPLocation", LVL1::DEFAULT_L1TopoLegacyCTPLocation, "StoreGate key of topo decision output for CTP"}; ///< SG key of decision bits for CTP SG::WriteHandleKey<LVL1::FrontPanelCTP> m_legacyTopoOverflowCTPLocation { this, "LegacyTopoOverflowCTPLocation", LVL1::DEFAULT_L1TopoLegacyOverflowCTPLocation, "StoreGate key of topo overflow output for CTP"}; ///< SG key of overflow bits for CTP + // Writing L1Topo EDMs + SG::WriteHandleKey< xAOD::L1TopoSimResultsContainer > m_legacyL1topoKey {this,"Key_LegacyL1TopoSimContainer","L1_LegacyTopoSimResults","Output legacy l1topo container"}; + SG::WriteHandleKey< xAOD::L1TopoSimResultsContainer > m_l1topoKey {this,"Key_L1TopoSimContainer","L1_TopoSimResults","Output l1topo container"}; + Gaudi::Property<bool> m_isLegacyTopo { this, "IsLegacyTopo", false, "Simulation of Legacy L1Topo boards" }; Gaudi::Property<bool> m_enableInputDump { this, "EnableInputDump", false, "Enable writing of input data for standalone running" }; Gaudi::Property<bool> m_enableBitwise { this, "UseBitwise", false, "Boolean to enable the bitwise version of software algorithms"}; diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/TopoEDM.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/TopoEDM.cxx new file mode 100644 index 0000000000000000000000000000000000000000..bcf77c6ba075e02d1b8f26b735c818e2b4d9f697 --- /dev/null +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/TopoEDM.cxx @@ -0,0 +1,46 @@ +// Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + +#include "./TopoEDM.h" + +#include "xAODTrigger/L1TopoSimResults.h" + +using namespace LVL1; + +TopoEDM::TopoEDM(const std::string& type, const std::string& name, + const IInterface* parent) : + AthAlgTool(type, name, parent) +{ + declareInterface<LVL1::IReadTopoEDM>( this ); +} + +TopoEDM::~TopoEDM() +{} + +StatusCode +TopoEDM::initialize() { + ATH_CHECK( m_legacyL1topoKey.initialize() ); + ATH_CHECK( m_l1topoKey.initialize() ); + + return StatusCode::SUCCESS; +} + + +StatusCode +TopoEDM::Read(bool isLegacy) const { + const xAOD::L1TopoSimResults* l1topo_dec = 0; + + SG::ReadHandle<xAOD::L1TopoSimResultsContainer> cont(isLegacy? m_legacyL1topoKey : m_l1topoKey); + if(!cont.isValid()){ + ATH_MSG_FATAL("Could not retrieve EDM Container"); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("----got container: " << cont.key()); + + for(const auto& it : * cont){ + l1topo_dec = it; + ATH_MSG_DEBUG( "Reading L1Topo EDM:: BoardName: " << l1topo_dec->boardName() << " Clock: " << l1topo_dec->clock() << " Word32: " << l1topo_dec->word32() << " Word64: " << l1topo_dec->word64() << " WordOpt: " << l1topo_dec->wordOptical() ); + } + + return StatusCode::SUCCESS; +} diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/TopoEDM.h b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/TopoEDM.h new file mode 100644 index 0000000000000000000000000000000000000000..bd6f88578ea058d3c51ddf344dfbfbd1b1a00210 --- /dev/null +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/TopoEDM.h @@ -0,0 +1,33 @@ +// Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + +#ifndef L1TopoSimulation_TopoEDM +#define L1TopoSimulation_TopoEDM + +#include "AthenaBaseComps/AthAlgTool.h" +#include "L1TopoSimulation/IReadTopoEDM.h" + +//EM/Tau EDMs +#include "xAODTrigger/L1TopoSimResultsContainer.h" + + +namespace LVL1 { + + class TopoEDM : public AthAlgTool, virtual public IReadTopoEDM { + public: + TopoEDM(const std::string& type, const std::string& name, + const IInterface* parent); + + virtual ~TopoEDM(); + + virtual StatusCode initialize() override final; + + virtual StatusCode Read(bool isLegacy) const override final; + + private: + + SG::ReadHandleKey<xAOD::L1TopoSimResultsContainer> m_l1topoKey {this, "L1_TopoKey", "L1_TopoSimResults", "l1topo EDM"}; + SG::ReadHandleKey<xAOD::L1TopoSimResultsContainer> m_legacyL1topoKey {this, "L1_LegacyTopoKey", "L1_LegacyTopoSimResults", "l1topo EDM"}; + }; +} + +#endif diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/components/L1TopoSimulation_entries.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/components/L1TopoSimulation_entries.cxx index 5cd0a35d09be7e01bc3c6682601afd60ff6383cc..509ed5c7c2d5ad8e431bc7051652d27262b76d28 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/components/L1TopoSimulation_entries.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/components/L1TopoSimulation_entries.cxx @@ -7,6 +7,7 @@ #include "../EnergyInputProvider.h" #include "../MuonInputProvider.h" #include "../RoiB2TopoInputDataCnv.h" +#include "../TopoEDM.h" DECLARE_COMPONENT( LVL1::L1TopoSimulation ) DECLARE_COMPONENT( LVL1::RoiB2TopoInputDataCnv ) @@ -17,3 +18,5 @@ DECLARE_COMPONENT( LVL1::JetInputProvider ) DECLARE_COMPONENT( LVL1::JetInputProviderFEX ) DECLARE_COMPONENT( LVL1::EnergyInputProvider ) DECLARE_COMPONENT( LVL1::MuonInputProvider ) + +DECLARE_COMPONENT( LVL1::TopoEDM )