ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloSim
src
CPMSim.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// /***************************************************************************
6
// CPMSim.cxx - description
7
// -------------------
8
// begin : Wed Mar 05 2014
9
// email : Alan.Watson@CERN.CH
10
// ***************************************************************************/
11
//
12
//
13
//================================================
14
// CPMSim class Implementation
15
// ================================================
16
//
17
//
18
//
19
20
// Utilities
21
22
// This algorithm includes
23
#include "
CPMSim.h
"
24
#include "
TrigT1CaloUtils/CoordToHardware.h
"
25
#include "
TrigConfL1Data/L1DataDef.h
"
26
27
#include "
TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h
"
28
#include "
xAODTrigL1Calo/CPMTowerContainer.h
"
29
#include "
TrigT1CaloEvent/CPMTobRoI_ClassDEF.h
"
30
#include "
TrigT1CaloEvent/CPMCMXData.h
"
31
32
#include "
StoreGate/ReadHandle.h
"
33
#include "
StoreGate/WriteHandle.h
"
34
35
36
37
namespace
LVL1
{
38
39
using namespace
TrigConf;
40
41
//--------------------------------
42
// Constructors and destructors
43
//--------------------------------
44
45
CPMSim::CPMSim
46
(
const
std::string&
name
, ISvcLocator* pSvcLocator )
47
:
AthReentrantAlgorithm
(
name
, pSvcLocator ),
48
m_CPMTool
(
"LVL1::L1CPMTools/L1CPMTools"
)
49
{
50
}
51
52
53
//---------------------------------
54
// initialise()
55
//---------------------------------
56
57
StatusCode
CPMSim::initialize
()
58
{
59
ATH_CHECK
(
m_CPMTool
.retrieve() );
60
ATH_CHECK
(
m_CPMTowerLocation
.initialize() );
61
ATH_CHECK
(
m_CPMCMXDataLocation
.initialize() );
62
ATH_CHECK
(
m_CPMTobRoILocation
.initialize() );
63
ATH_CHECK
(
m_L1MenuKey
.initialize() );
64
65
return
StatusCode::SUCCESS ;
66
}
67
68
69
//----------------------------------------------
70
// execute() method called once per event
71
//----------------------------------------------
72
//
73
74
75
StatusCode
CPMSim::execute
(
const
EventContext& ctx)
const
76
{
77
78
/* Retrieve collection of CPMTowers
79
Form TOBs from them
80
Form backplane data from TOBs
81
Store TOBs for BS simulation
82
Form and store RoI SLink data for RoIB
83
*/
84
85
ATH_MSG_DEBUG
(
"starting CPMSim"
);
86
87
// Create containers for this event
88
auto
CMXData = std::make_unique<DataVector<CPMCMXData> >();
//Container of backplane data objects
89
auto
allTOBs = std::make_unique<DataVector<CPMTobRoI> >();
// Container to hold all TOB RoIs in event
90
91
SG::ReadHandle<xAOD::CPMTowerContainer>
storedCPMTs
92
(
m_CPMTowerLocation
, ctx);
93
94
if
(storedCPMTs->size() == 0)
95
ATH_MSG_WARNING
(
"Empty CPMTowerContainer - looks like a problem"
);
96
97
// Map the CPMTs
98
xAOD::CPMTowerMap_t
towerMap;
99
m_CPMTool
->mapTowers(storedCPMTs.cptr(), &towerMap);
100
101
// get the L1Menu for the CPMTool
102
auto
l1Menu =
SG::makeHandle
(
m_L1MenuKey
, ctx );
103
const
TrigConf::L1Menu
* l1Menu_ptr=l1Menu.cptr();
104
105
// Loop over crates and modules
106
for
(
int
iCrate = 0; iCrate < 4; ++iCrate) {
107
for
(
int
iModule = 1; iModule <= 14; ++iModule) {
108
109
// For each module, find TOBs and backplane data
110
std::vector<unsigned int> emCMXData;
111
std::vector<unsigned int> tauCMXData;
112
m_CPMTool
->findCPMResults(l1Menu_ptr,&towerMap,iCrate,iModule,allTOBs.get(),emCMXData,tauCMXData);
113
// Push backplane data into output DataVectors
114
CMXData -> push_back(std::make_unique<CPMCMXData>(iCrate,iModule,0,emCMXData));
115
CMXData -> push_back(std::make_unique<CPMCMXData>(iCrate,iModule,1,tauCMXData));
116
117
}
// loop over modules
118
}
// loop over crates
119
120
121
// Store RoIB output, module readout and backplane results in the TES
122
ATH_CHECK
(
SG::makeHandle
(
m_CPMCMXDataLocation
, ctx).record (std::move (CMXData)) );
123
ATH_CHECK
(
SG::makeHandle
(
m_CPMTobRoILocation
, ctx).record (std::move (allTOBs)) );
124
125
return
StatusCode::SUCCESS ;
126
}
127
128
129
}
// end of LVL1 namespace bracket
130
131
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CPMCMXData.h
CPMSim.h
CPMTobRoI_ClassDEF.h
CPMTowerContainer.h
CoordToHardware.h
L1DataDef.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
TrigT1Interfaces_ClassDEF.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
LVL1::CPMSim::m_CPMCMXDataLocation
SG::WriteHandleKey< DataVector< CPMCMXData > > m_CPMCMXDataLocation
Definition
CPMSim.h:112
LVL1::CPMSim::initialize
virtual StatusCode initialize() override
Definition
CPMSim.cxx:57
LVL1::CPMSim::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CPMSim.cxx:75
LVL1::CPMSim::m_L1MenuKey
SG::ReadHandleKey< TrigConf::L1Menu > m_L1MenuKey
Definition
CPMSim.h:103
LVL1::CPMSim::m_CPMTool
ToolHandle< LVL1::IL1CPMTools > m_CPMTool
The essentials - data access, configuration, tools.
Definition
CPMSim.h:115
LVL1::CPMSim::CPMSim
CPMSim(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CPMSim.cxx:46
LVL1::CPMSim::m_CPMTobRoILocation
SG::WriteHandleKey< DataVector< CPMTobRoI > > m_CPMTobRoILocation
Locations of outputs in StoreGate.
Definition
CPMSim.h:110
LVL1::CPMSim::m_CPMTowerLocation
SG::ReadHandleKey< xAOD::CPMTowerContainer > m_CPMTowerLocation
Where to store the CPMTowers.
Definition
CPMSim.h:107
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
TrigConf::L1Menu
L1 menu configuration.
Definition
L1Menu.h:29
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition
IZdcDataAccess.h:13
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
xAOD::CPMTowerMap_t
std::map< int, const CPMTower * > CPMTowerMap_t
Definition
Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/CPMTower.h:18
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0