ATLAS Offline Software
L1TopoSimulation.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef L1Topo_L1TopoSimulation
6 #define L1Topo_L1TopoSimulation
7 
11 
12 #include "PeriodicScaler.h"
13 #include "TrigConfBase/MsgStream.h"
15 #include "TrigConfData/L1Menu.h"
17 
20 
24 
25 #include "GaudiKernel/ServiceHandle.h"
26 #include "GaudiKernel/ToolHandle.h"
27 #include "GaudiKernel/ITHistSvc.h"
28 
29 #include "TH1F.h"
30 #include <memory>
31 
32 namespace LVL1 {
33 
34  class L1TopoSimulation : public AthAlgorithm {
35  public:
36  L1TopoSimulation(const std::string &name, ISvcLocator *pSvcLocator);
37 
39  virtual StatusCode start() override;
40  virtual StatusCode execute() override;
41  virtual StatusCode finalize() override;
42 
43  // make algorithm is clonable
44  virtual bool isClonable() const override;
45 
46 
47  private:
55  StatusCode retrieveHardwareDecision(bool isLegacy, const EventContext& ctx);
56 
57  StatusCode hardwareDecisionPhase1(const EventContext& ctx);
59 
60  void WriteEDM(SG::WriteHandle<xAOD::L1TopoSimResultsContainer> &handle, const std::string &name, unsigned int clock, uint32_t word);
61  void WriteEDM_Overflow(SG::WriteHandle<xAOD::L1TopoSimResultsContainer> &handle, const std::string &name, unsigned int clock, uint32_t word);
62  void WriteEDM(SG::WriteHandle<xAOD::L1TopoSimResultsContainer> &handle, const std::string &name, unsigned int clock, uint64_t word);
63  void WriteEDM_Overflow(SG::WriteHandle<xAOD::L1TopoSimResultsContainer> &handle, const std::string &name, unsigned int clock, uint64_t word);
64 
65  std::unique_ptr<TCS::TopoSteering> m_topoSteering;
66  std::unique_ptr<LVL1::PeriodicScaler> m_scaler {nullptr};
67 
68  // Services and input tools
69  ServiceHandle<ITHistSvc> m_histSvc { this, "HistSvc", "THistSvc/THistSvc", "Histogramming service for L1Topo algorithms" };
70 
71  ToolHandle<IInputTOBConverter> m_emtauInputProvider { this, "EMTAUInputProvider", "LVL1::EMTauInputProvider/EMTauInputProvider", "Tool to fill the EMTAU TOBs of the topo input event" };
72  ToolHandle<IInputTOBConverter> m_jetInputProvider { this, "JetInputProvider", "LVL1::JetInputProvider/JetInputProvider", "Tool to fill the Jet TOBs of the topo input event" };
73  ToolHandle<IInputTOBConverter> m_energyInputProvider { this, "EnergyInputProvider", "LVL1::EnergyInputProvider/EnergyInputProvider", "Tool to fill the energy and MET TOBs of the topo input event"};
74  ToolHandle<IInputTOBConverter> m_muonInputProvider { this, "MuonInputProvider", "LVL1::MuonInputProvider/MuonInputProvider", "Tool to fill the muon TOBs of the topo input event" };
75 
76  ToolHandle<IControlHistSvc> m_ControlHistSvc { this, "ControlHistSvc", "LVL1::ControlHistSvc/ControlHistSvc", "Tool to change the histogramming service when needed." };
77 
78 
79  // outputs
80  SG::WriteHandleKey<LVL1::FrontPanelCTP> m_topoCTPLocation { this, "TopoCTPLocation", LVL1::DEFAULT_L1TopoCTPLocation, "StoreGate key of topo decision output for CTP"};
81  SG::WriteHandleKey<LVL1::FrontPanelCTP> m_topoOverflowCTPLocation { this, "TopoOverflowCTPLocation", LVL1::DEFAULT_L1TopoOverflowCTPLocation, "StoreGate key of topo overflow output for CTP"};
82 
83  SG::WriteHandleKey<LVL1::FrontPanelCTP> m_legacyTopoCTPLocation { this, "LegacyTopoCTPLocation", LVL1::DEFAULT_L1TopoLegacyCTPLocation, "StoreGate key of topo decision output for CTP"};
84  SG::WriteHandleKey<LVL1::FrontPanelCTP> m_legacyTopoOverflowCTPLocation { this, "LegacyTopoOverflowCTPLocation", LVL1::DEFAULT_L1TopoLegacyOverflowCTPLocation, "StoreGate key of topo overflow output for CTP"};
85 
86  // Writing L1Topo EDMs
87  SG::WriteHandleKey< xAOD::L1TopoSimResultsContainer > m_legacyL1topoKey {this,"Key_LegacyL1TopoSimContainer","L1_LegacyTopoSimResults","Output legacy l1topo container"};
88  SG::WriteHandleKey< xAOD::L1TopoSimResultsContainer > m_l1topoKey {this,"Key_L1TopoSimContainer","L1_TopoSimResults","Output l1topo container"};
89 
90  SG::ReadHandleKey<xAOD::L1TopoRawDataContainer> m_l1topoRawDataKey {this, "L1_TopoRawDataKey", "L1_Phase1L1TopoRAWData", "l1topo Raw Data"};
91 
92 
93  Gaudi::Property<bool> m_isLegacyTopo { this, "IsLegacyTopo", false, "Simulation of Legacy L1Topo boards" };
94  Gaudi::Property<bool> m_enableInputDump { this, "EnableInputDump", false, "Enable writing of input data for standalone running" };
95  Gaudi::Property<bool> m_enableBitwise { this, "UseBitwise", true, "Boolean to enable the bitwise version of software algorithms"};
96  Gaudi::Property<std::string> m_inputDumpFile { this, "InputDumpFile", "inputdump.txt", "File name for dumping input data" };
97  Gaudi::Property<int> m_topoOutputLevel { this, "TopoOutputLevel", TrigConf::MSGTC::WARNING, "OutputLevel for L1Topo algorithms"};
98  Gaudi::Property<int> m_topoSteeringOutputLevel { this, "TopoSteeringOutputLevel", TrigConf::MSGTC::WARNING, "OutputLevel for L1Topo steering"};
99 
100  // Properties for hardware monitoring
101  Gaudi::Property<bool> m_fillHistogramsBasedOnHardwareDecision { this, "FillHistoBasedOnHardware", false, "Fill accept/reject histograms based on hdw; default based on sim" };
102  Gaudi::Property<unsigned int> m_prescaleForDAQROBAccess { this, "PrescaleDAQROBAccess", 4, "Prescale factor for requests for DAQ ROBs: can be used to avoid overloading ROS. Zero means disabled, 1 means always, N means sample only 1 in N events"};
103  Gaudi::Property<unsigned int> m_prescale { this, "Prescale", 1, "Internal prescale factor for this algorithm, implemented with a periodic scaler: so 1 means run every time, N means run every 1 in N times it is called; the other times it will exit without doing anything"};
104  Gaudi::Property<std::string> m_histBaseDir { this, "MonHistBaseDir", "L1/L1TopoAlgorithms", "Base directory for monitoring histograms will be /EXPERT/<MonHistBaseDir>"};
105  };
106 
107 }
108 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
initialize
void initialize()
Definition: run_EoverP.cxx:894
LVL1::L1TopoSimulation::m_topoOutputLevel
Gaudi::Property< int > m_topoOutputLevel
Definition: L1TopoSimulation.h:97
LVL1::L1TopoSimulation::m_topoCTPLocation
SG::WriteHandleKey< LVL1::FrontPanelCTP > m_topoCTPLocation
SG key of decision bits for CTP.
Definition: L1TopoSimulation.h:80
LVL1::L1TopoSimulation
Definition: L1TopoSimulation.h:34
LVL1::L1TopoSimulation::m_fillHistogramsBasedOnHardwareDecision
Gaudi::Property< bool > m_fillHistogramsBasedOnHardwareDecision
Definition: L1TopoSimulation.h:101
MsgStream.h
MsgStream for TrigConf classes.
LVL1::L1TopoSimulation::m_scaler
std::unique_ptr< LVL1::PeriodicScaler > m_scaler
Definition: L1TopoSimulation.h:66
LVL1::L1TopoSimulation::m_isLegacyTopo
Gaudi::Property< bool > m_isLegacyTopo
Definition: L1TopoSimulation.h:93
LVL1::L1TopoSimulation::m_emtauInputProvider
ToolHandle< IInputTOBConverter > m_emtauInputProvider
Definition: L1TopoSimulation.h:71
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1::L1TopoSimulation::m_enableInputDump
Gaudi::Property< bool > m_enableInputDump
Definition: L1TopoSimulation.h:94
LVL1::L1TopoSimulation::m_topoSteeringOutputLevel
Gaudi::Property< int > m_topoSteeringOutputLevel
Definition: L1TopoSimulation.h:98
TrigT1StoreGateKeys.h
LVL1::L1TopoSimulation::start
virtual StatusCode start() override
Definition: L1TopoSimulation.cxx:130
LVL1::L1TopoSimulation::m_topoSteering
std::unique_ptr< TCS::TopoSteering > m_topoSteering
the topo steering
Definition: L1TopoSimulation.h:65
LVL1::L1TopoSimulation::m_l1topoKey
SG::WriteHandleKey< xAOD::L1TopoSimResultsContainer > m_l1topoKey
Definition: L1TopoSimulation.h:88
LVL1::L1TopoSimulation::m_prescale
Gaudi::Property< unsigned int > m_prescale
Definition: L1TopoSimulation.h:103
LVL1::L1TopoSimulation::m_energyInputProvider
ToolHandle< IInputTOBConverter > m_energyInputProvider
Definition: L1TopoSimulation.h:73
FrontPanelCTP.h
AthAlgorithm.h
L1TopoRawDataContainer.h
LVL1::L1TopoSimulation::WriteEDM_Overflow
void WriteEDM_Overflow(SG::WriteHandle< xAOD::L1TopoSimResultsContainer > &handle, const std::string &name, unsigned int clock, uint32_t word)
Definition: L1TopoSimulation.cxx:320
LVL1::L1TopoSimulation::m_muonInputProvider
ToolHandle< IInputTOBConverter > m_muonInputProvider
Definition: L1TopoSimulation.h:74
PeriodicScaler.h
LVL1::L1TopoSimulation::m_l1topoRawDataKey
SG::ReadHandleKey< xAOD::L1TopoRawDataContainer > m_l1topoRawDataKey
Definition: L1TopoSimulation.h:90
SG::WriteHandleKey< LVL1::FrontPanelCTP >
LVL1::L1TopoSimulation::m_jetInputProvider
ToolHandle< IInputTOBConverter > m_jetInputProvider
Definition: L1TopoSimulation.h:72
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1::L1TopoSimulation::hardwareDecisionPhase1
StatusCode hardwareDecisionPhase1(const EventContext &ctx)
Definition: L1TopoSimulation.cxx:421
LVL1::L1TopoSimulation::isClonable
virtual bool isClonable() const override
Definition: L1TopoSimulation.cxx:45
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
LVL1::L1TopoSimulation::execute
virtual StatusCode execute() override
Definition: L1TopoSimulation.cxx:154
LVL1::L1TopoSimulation::m_topoOverflowCTPLocation
SG::WriteHandleKey< LVL1::FrontPanelCTP > m_topoOverflowCTPLocation
SG key of overflow bits for CTP.
Definition: L1TopoSimulation.h:81
LVL1::L1TopoSimulation::m_enableBitwise
Gaudi::Property< bool > m_enableBitwise
Definition: L1TopoSimulation.h:95
LVL1::L1TopoSimulation::WriteEDM
void WriteEDM(SG::WriteHandle< xAOD::L1TopoSimResultsContainer > &handle, const std::string &name, unsigned int clock, uint32_t word)
Definition: L1TopoSimulation.cxx:308
LVL1::L1TopoSimulation::m_legacyL1topoKey
SG::WriteHandleKey< xAOD::L1TopoSimResultsContainer > m_legacyL1topoKey
Definition: L1TopoSimulation.h:87
AthAlgorithm
Definition: AthAlgorithm.h:47
TrigConf::name
Definition: HLTChainList.h:35
LVL1::L1TopoSimulation::ATLAS_NOT_THREAD_SAFE
virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE() override
LVL1::L1TopoSimulation::m_legacyTopoOverflowCTPLocation
SG::WriteHandleKey< LVL1::FrontPanelCTP > m_legacyTopoOverflowCTPLocation
SG key of overflow bits for CTP.
Definition: L1TopoSimulation.h:84
LVL1::L1TopoSimulation::m_inputDumpFile
Gaudi::Property< std::string > m_inputDumpFile
Definition: L1TopoSimulation.h:96
LVL1::L1TopoSimulation::L1TopoSimulation
L1TopoSimulation(const std::string &name, ISvcLocator *pSvcLocator)
Definition: L1TopoSimulation.cxx:36
LVL1::L1TopoSimulation::hardwareDecisionLegacy
StatusCode hardwareDecisionLegacy()
Definition: L1TopoSimulation.cxx:363
TopoSteering.h
LVL1::L1TopoSimulation::m_prescaleForDAQROBAccess
Gaudi::Property< unsigned int > m_prescaleForDAQROBAccess
Definition: L1TopoSimulation.h:102
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
IControlHistSvc.h
LVL1::L1TopoSimulation::m_ControlHistSvc
ToolHandle< IControlHistSvc > m_ControlHistSvc
Definition: L1TopoSimulation.h:76
LVL1::L1TopoSimulation::m_legacyTopoCTPLocation
SG::WriteHandleKey< LVL1::FrontPanelCTP > m_legacyTopoCTPLocation
SG key of decision bits for CTP.
Definition: L1TopoSimulation.h:83
LVL1::L1TopoSimulation::m_histBaseDir
Gaudi::Property< std::string > m_histBaseDir
Definition: L1TopoSimulation.h:104
LVL1::L1TopoSimulation::m_histSvc
ServiceHandle< ITHistSvc > m_histSvc
prescale decision tool
Definition: L1TopoSimulation.h:69
LVL1::L1TopoSimulation::finalize
virtual StatusCode finalize() override
Definition: L1TopoSimulation.cxx:302
L1Menu.h
checker_macros.h
Define macros for attributes used to control the static checker.
LVL1::L1TopoSimulation::retrieveHardwareDecision
StatusCode retrieveHardwareDecision(bool isLegacy, const EventContext &ctx)
Retrieve the L1Topo hardware bits from the DAQ RODs.
Definition: L1TopoSimulation.cxx:356
IInputTOBConverter.h
L1TopoSimResultsContainer.h
ServiceHandle< ITHistSvc >
TrigConf::MSGTC::WARNING
@ WARNING
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:26