ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloSim
src
JEMJetSim.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
// JEMJetSim.cxx - description
7
// -------------------
8
// begin : Wed Mar 12 2014
9
// email : Alan.Watson@CERN.CH
10
// ***************************************************************************/
11
//
12
//
13
//================================================
14
// JEMJetSim class Implementation
15
// ================================================
16
//
17
//
18
//
19
20
// Utilities
21
22
// This algorithm includes
23
#include "
JEMJetSim.h
"
24
#include "
TrigT1CaloUtils/JetEnergyModuleKey.h
"
25
26
#include "
TrigT1Interfaces/TrigT1CaloDefs.h
"
27
#include "
TrigT1CaloUtils/CoordToHardware.h
"
28
#include "
TrigConfL1Data/L1DataDef.h
"
29
30
#include "
TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h
"
31
#include "
xAODTrigL1Calo/JetElementContainer.h
"
32
#include "
TrigT1CaloEvent/JEMTobRoI_ClassDEF.h
"
33
#include "
TrigT1CaloEvent/JetCMXData.h
"
34
#include "
TrigT1CaloEvent/JetInput.h
"
35
36
37
38
namespace
LVL1
{
39
40
using namespace
TrigConf;
41
42
//--------------------------------
43
// Constructors and destructors
44
//--------------------------------
45
46
JEMJetSim::JEMJetSim
47
(
const
std::string&
name
, ISvcLocator* pSvcLocator )
48
:
AthAlgorithm
(
name
, pSvcLocator ),
49
m_allTOBs
(0),
50
m_JetCMXData
(0),
51
m_JetTool
(
"LVL1::L1JEMJetTools/L1JEMJetTools"
)
52
{
53
}
54
55
56
//---------------------------------
57
// initialise()
58
//---------------------------------
59
60
StatusCode
JEMJetSim::initialize
()
61
{
62
ATH_CHECK
(
m_JetElementInputKey
.initialize() );
63
ATH_CHECK
(
m_JEMTobRoIOutputKey
.initialize() );
64
ATH_CHECK
(
m_JetCMXDataOutputKey
.initialize() );
65
ATH_CHECK
(
m_JetTool
.retrieve() );
66
return
StatusCode::SUCCESS ;
67
}
68
69
70
//----------------------------------------------
71
// execute() method called once per event
72
//----------------------------------------------
73
//
74
75
76
StatusCode
JEMJetSim::execute
(
const
EventContext& ctx)
77
{
78
79
/*
80
Retrieve collection of JetElements
81
Fill a std::map of JetInputs from them
82
Loop over crates/modules
83
For each crate, loop over towers and find TOBs
84
form backplane data objects
85
form daq objects
86
*/
87
88
//make a message logging stream
89
90
ATH_MSG_DEBUG
(
"starting JEMJetSim"
);
91
92
// Create containers for this event
93
m_JetCMXData
=
new
DataVector<JetCMXData>
;
//Container of backplane data objects
94
m_allTOBs
=
new
DataVector<JEMTobRoI>
;
// Container to hold all TOB RoIs in event
95
96
// Retrieve the JetElementContainer
97
auto
rh =
SG::makeHandle
(
m_JetElementInputKey
, ctx);
98
99
if
(rh.isValid()) {
100
const
DataVector<xAOD::JetElement>
* storedJEs = &(*rh);
101
if
(
true
) {
102
// Check size of JetElementCollection - zero would indicate a problem
103
if
(storedJEs->
size
() == 0)
104
ATH_MSG_WARNING
(
"Empty JetElementContainer - looks like a problem"
);
105
106
// Form JetInputs and put them in a map
107
std::map<int, JetInput*>* inputMap =
new
std::map<int, JetInput*> ;
108
m_JetTool
->mapJetInputs(storedJEs, inputMap);
109
110
// Loop over crates and modules
111
for
(
int
iCrate = 0; iCrate < 2; ++iCrate) {
112
for
(
int
iModule = 0; iModule < 16; ++iModule) {
113
114
// For each module, find TOBs and backplane data
115
std::vector<unsigned int> jetCMXData;
116
m_JetTool
->findJEMResults(inputMap,iCrate,iModule,
m_allTOBs
,jetCMXData);
117
// Push backplane data into output DataVectors
118
JetCMXData
* bpData =
new
JetCMXData
(iCrate,iModule,jetCMXData);
119
m_JetCMXData
-> push_back(bpData);
120
121
}
// loop over modules
122
}
// loop over crates
123
125
for
(std::map<int, JetInput*>::iterator it = inputMap->begin(); it != inputMap->end(); ++it) {
126
delete
(*it).second;
127
}
128
delete
inputMap;
129
130
}
// found TriggerTowers
131
132
else
ATH_MSG_WARNING
(
"Error retrieving JetElements"
);
133
}
134
else
ATH_MSG_WARNING
(
"No JetElementContainer at "
<<
m_JetElementInputKey
);
135
136
137
// Store module readout and backplane results in the TES
138
storeBackplaneTOBs
(ctx);
139
storeModuleRoIs
(ctx);
140
141
// Clean up at end of event
142
m_JetCMXData
= 0;
143
m_allTOBs
= 0;
144
145
return
StatusCode::SUCCESS;
146
}
147
149
void
LVL1::JEMJetSim::storeBackplaneTOBs
(
const
EventContext& ctx) {
150
151
size_t
datasize =
m_JetCMXData
->size();
152
153
// Store backplane data objects
155
StatusCode
sc
=
SG::makeHandle
(
m_JetCMXDataOutputKey
, ctx).record( std::unique_ptr<
DataVector<JetCMXData>
>(
m_JetCMXData
) );
156
m_JetCMXData
=
nullptr
;
157
158
if
(
sc
.isSuccess()) {
159
ATH_MSG_VERBOSE
(
"Stored "
<< datasize
160
<<
" JetCMXData at "
<<
m_JetCMXDataOutputKey
);
161
}
162
else
{
163
ATH_MSG_ERROR
(
"failed to write JetCMXData to "
164
<<
m_JetCMXDataOutputKey
);
165
}
166
167
return
;
168
169
}
//end storeBackplaneTOBs
170
171
173
void
LVL1::JEMJetSim::storeModuleRoIs
(
const
EventContext& ctx) {
174
175
size_t
n_jetsTobs =
m_allTOBs
->size();
176
177
StatusCode
sc
=
SG::makeHandle
(
m_JEMTobRoIOutputKey
, ctx).record( std::unique_ptr<
DataVector<JEMTobRoI>
>(
m_allTOBs
) );
178
m_allTOBs
=
nullptr
;
179
180
if
(
sc
.isSuccess()) {
181
ATH_MSG_VERBOSE
(
"Stored "
<< n_jetsTobs
182
<<
" Jet TOBs at "
<<
m_JEMTobRoIOutputKey
);
183
}
184
else
{
185
ATH_MSG_ERROR
(
"failed to write JEMTobRoIs to "
186
<<
m_JEMTobRoIOutputKey
);
187
}
188
189
}
//end storeModuleRoIs
190
191
192
}
// end of LVL1 namespace bracket
193
194
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CoordToHardware.h
JEMJetSim.h
JEMTobRoI_ClassDEF.h
JetCMXData.h
JetElementContainer.h
JetEnergyModuleKey.h
JetInput.h
L1DataDef.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
TrigT1CaloDefs.h
TrigT1Interfaces_ClassDEF.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
DataVector
Derived DataVector<T>.
Definition
DataVector.h:795
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
LVL1::JEMJetSim::m_JetElementInputKey
SG::ReadHandleKey< xAOD::JetElementContainer > m_JetElementInputKey
Where to find the JetElements.
Definition
JEMJetSim.h:81
LVL1::JEMJetSim::initialize
StatusCode initialize()
Definition
JEMJetSim.cxx:60
LVL1::JEMJetSim::m_JEMTobRoIOutputKey
SG::WriteHandleKey< DataVector< JEMTobRoI > > m_JEMTobRoIOutputKey
Locations of outputs in StoreGate.
Definition
JEMJetSim.h:84
LVL1::JEMJetSim::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
JEMJetSim.cxx:76
LVL1::JEMJetSim::storeBackplaneTOBs
void storeBackplaneTOBs(const EventContext &ctx)
Store module outputs in TES as inputs to CMX simulation.
Definition
JEMJetSim.cxx:149
LVL1::JEMJetSim::storeModuleRoIs
void storeModuleRoIs(const EventContext &ctx)
Store TOB RoI objects in the TES.
Definition
JEMJetSim.cxx:173
LVL1::JEMJetSim::m_JetCMXData
DataVector< JetCMXData > * m_JetCMXData
Backplane data objects: CPM outputs to CMX.
Definition
JEMJetSim.h:78
LVL1::JEMJetSim::m_JetTool
ToolHandle< LVL1::IL1JEMJetTools > m_JetTool
The essentials - data access, configuration, tools.
Definition
JEMJetSim.h:88
LVL1::JEMJetSim::m_JetCMXDataOutputKey
SG::WriteHandleKey< DataVector< JetCMXData > > m_JetCMXDataOutputKey
Definition
JEMJetSim.h:85
LVL1::JEMJetSim::m_allTOBs
DataVector< JEMTobRoI > * m_allTOBs
TOB RoIs for RoIB input and DAQ output simulation.
Definition
JEMJetSim.h:75
LVL1::JEMJetSim::JEMJetSim
JEMJetSim(const std::string &name, ISvcLocator *pSvcLocator)
Definition
JEMJetSim.cxx:47
LVL1::JetCMXData
The JetCMXData object contains the data transferred from the CPM to one of the Jet CMX in the crate.
Definition
JetCMXData.h:25
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
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0