ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloSim
src
JEMEnergySim.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
// JEMEnergySim.cxx - description
7
// -------------------
8
// begin : Monday 12 May 2014
9
// email : Alan.Watson@CERN.CH
10
// ***************************************************************************/
11
//
12
//================================================
13
// JEMEnergySim class Implementation
14
// ================================================
15
//
16
//
17
//
18
19
20
21
// This algorithm includes
22
#include "
JEMEnergySim.h
"
23
#include "
TrigT1CaloUtils/JetEnergyModuleKey.h
"
24
25
#include "
TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h
"
26
#include "
xAODTrigL1Calo/JetElementContainer.h
"
27
#include "
TrigT1CaloEvent/EnergyCMXData.h
"
28
#include "
TrigT1CaloUtils/ModuleEnergy.h
"
29
30
31
namespace
LVL1
{
32
33
34
//--------------------------------
35
// Constructors and destructors
36
//--------------------------------
37
38
JEMEnergySim::JEMEnergySim
39
(
const
std::string&
name
, ISvcLocator* pSvcLocator )
40
:
AthAlgorithm
(
name
, pSvcLocator ),
41
m_EtTool
(
"LVL1::L1EtTools/L1EtTools"
),
42
m_jemContainer
(0)
43
{}
44
45
46
//---------------------------------
47
// initialise()
48
//---------------------------------
49
50
StatusCode
JEMEnergySim::initialize
()
51
{
52
ATH_CHECK
(
m_JetElementInputKey
.initialize() );
53
ATH_CHECK
(
m_jemEtSumsOutputKey
.initialize() );
54
ATH_CHECK
(
m_energyCMXDataOutputKey
.initialize() );
55
56
ATH_CHECK
(
m_EtTool
.retrieve() );
57
return
StatusCode::SUCCESS ;
58
}
59
60
61
//----------------------------------------------
62
// execute() method called once per event
63
//----------------------------------------------
64
//
65
66
StatusCode
JEMEnergySim::execute
(
const
EventContext& ctx)
67
{
68
ATH_MSG_DEBUG
(
"Executing"
);
69
70
// form module sums
71
m_jemContainer
=
new
DataVector<ModuleEnergy>
;
72
73
auto
rh =
SG::makeHandle
(
m_JetElementInputKey
, ctx);
74
75
if
(rh.isValid()) {
76
const
DataVector<xAOD::JetElement>
* jetelements = &(*rh);
77
78
// Warn if we find an empty container
79
if
(jetelements->
size
() == 0)
80
ATH_MSG_WARNING
(
"Empty JetElementContainer - looks like a problem"
);
81
82
m_EtTool
->moduleSums(jetelements,
m_jemContainer
);
83
}
84
else
ATH_MSG_WARNING
(
"No JetElementCollection at "
<<
m_JetElementInputKey
);
85
86
// Done the processing. Now form & save the various output data
87
88
// For CMX simulation
89
storeBackplaneData
(ctx);
90
91
// for Bytestream simulation
92
storeJEMEtSums
(ctx);
93
94
cleanup
();
95
96
return
StatusCode::SUCCESS ;
97
}
98
99
100
}
// end of LVL1 namespace bracket
101
103
void
LVL1::JEMEnergySim::cleanup
(){
104
105
delete
m_jemContainer
;
106
}
107
109
void
LVL1::JEMEnergySim::storeJEMEtSums
(
const
EventContext& ctx) {
110
111
ATH_MSG_DEBUG
(
"storeJEMEtSums running"
);
112
113
JEMEtSumsCollection
* JEMRvector =
new
JEMEtSumsCollection
;
114
115
DataVector<ModuleEnergy>::iterator
it;
116
for
( it=
m_jemContainer
->begin(); it!=
m_jemContainer
->end(); ++it ) {
117
std::vector<unsigned int> eX;
118
eX.push_back((*it)->ex());
119
std::vector<unsigned int> eY;
120
eY.push_back((*it)->ey());
121
std::vector<unsigned int> eT;
122
eT.push_back((*it)->et());
123
JEMEtSums
* jemEtSums =
new
JEMEtSums
((*it)->crate(), (*it)->module(),eT,eX,eY,0);
124
JEMRvector->
push_back
(jemEtSums);
125
}
126
127
ATH_MSG_DEBUG
( JEMRvector->
size
()<<
" JEMEtSums objects are being saved"
);
128
129
StatusCode
sc
=
SG::makeHandle
(
m_jemEtSumsOutputKey
, ctx).record( std::unique_ptr<
DataVector<JEMEtSums>
>(JEMRvector) );
130
if
(
sc
!= StatusCode::SUCCESS) {
131
ATH_MSG_ERROR
(
"Error registering JEMEtSums collection in TDS "
);
132
}
133
134
}
135
137
void
LVL1::JEMEnergySim::storeBackplaneData
(
const
EventContext& ctx) {
138
139
ATH_MSG_DEBUG
(
"storeBackplaneData running"
);
140
141
EnergyCMXDataCollection
* bpVector =
new
EnergyCMXDataCollection
;
142
143
DataVector<ModuleEnergy>::iterator
it;
144
for
( it=
m_jemContainer
->begin(); it!=
m_jemContainer
->end(); ++it ) {
145
EnergyCMXData
* bpData =
new
EnergyCMXData
((*it)->crate(), (*it)->module(),
146
(*it)->ex(),(*it)->ey(),(*it)->et());
147
bpVector->
push_back
(bpData);
148
}
149
150
ATH_MSG_DEBUG
( bpVector->
size
()<<
" EnergyCMXData objects are being saved"
);
151
152
StatusCode
sc
=
SG::makeHandle
(
m_energyCMXDataOutputKey
, ctx).record( std::unique_ptr<
DataVector<EnergyCMXData>
>(bpVector) );
153
if
(
sc
!= StatusCode::SUCCESS) {
154
ATH_MSG_ERROR
(
"Error registering EnergyCMXData collection in TDS "
);
155
}
156
157
}
158
159
160
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_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
EnergyCMXData.h
JEMEnergySim.h
JetElementContainer.h
JetEnergyModuleKey.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
ModuleEnergy.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::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::iterator
DataModel_detail::iterator< DataVector > iterator
Standard iterator.
Definition
DataVector.h:842
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
LVL1::EnergyCMXData
The EnergyCMXData object contains the data transferred from the JEM to the EnergySum CMX in the crate...
Definition
EnergyCMXData.h:24
LVL1::JEMEnergySim::m_energyCMXDataOutputKey
SG::WriteHandleKey< DataVector< EnergyCMXData > > m_energyCMXDataOutputKey
Definition
JEMEnergySim.h:81
LVL1::JEMEnergySim::storeJEMEtSums
void storeJEMEtSums(const EventContext &ctx)
put results into SG
Definition
JEMEnergySim.cxx:109
LVL1::JEMEnergySim::storeBackplaneData
void storeBackplaneData(const EventContext &ctx)
Form EnergyCMXData and put into SG.
Definition
JEMEnergySim.cxx:137
LVL1::JEMEnergySim::initialize
StatusCode initialize()
Definition
JEMEnergySim.cxx:50
LVL1::JEMEnergySim::m_jemEtSumsOutputKey
SG::WriteHandleKey< DataVector< JEMEtSums > > m_jemEtSumsOutputKey
Definition
JEMEnergySim.h:78
LVL1::JEMEnergySim::m_JetElementInputKey
SG::ReadHandleKey< xAOD::JetElementContainer > m_JetElementInputKey
Definition
JEMEnergySim.h:75
LVL1::JEMEnergySim::JEMEnergySim
JEMEnergySim(const std::string &name, ISvcLocator *pSvcLocator)
Definition
JEMEnergySim.cxx:39
LVL1::JEMEnergySim::cleanup
void cleanup()
delete pointers etc.
Definition
JEMEnergySim.cxx:103
LVL1::JEMEnergySim::EnergyCMXDataCollection
DataVector< EnergyCMXData > EnergyCMXDataCollection
Definition
JEMEnergySim.h:50
LVL1::JEMEnergySim::m_EtTool
ToolHandle< LVL1::IL1EtTools > m_EtTool
Definition
JEMEnergySim.h:72
LVL1::JEMEnergySim::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
JEMEnergySim.cxx:66
LVL1::JEMEnergySim::JEMEtSumsCollection
DataVector< JEMEtSums > JEMEtSumsCollection
Definition
JEMEnergySim.h:49
LVL1::JEMEnergySim::m_jemContainer
DataVector< ModuleEnergy > * m_jemContainer
vector of ModuleEnergy objects
Definition
JEMEnergySim.h:84
LVL1::JEMEtSums
Definition
Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMEtSums.h:26
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