ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1CaloFEX
L1CaloFEXSim
src
jTowerMakerFromJfexTowers.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
//***************************************************************************
6
// jTowerMakerFromJfexTowers - description
7
// ---------------------------------------------------------
8
// This algorithm is meant to create from the xAOD::jFexTowerContainer (EDM) a jTowerContainer (a SG object the jFEX simulation needs)
9
// It needs to get both inputs available:
10
// * Decoded jFex input data, known as L1_jFexDataTowers (It can be empty, since it is pre-scaled)
11
// * Emulated jFex input data, known as L1_jFexEmulatedTowers
12
//
13
// begin : 01 06 2023
14
// email : sergi.rodriguez@cern.ch
15
//
16
//***************************************************************************/
17
18
#include "
xAODTrigL1Calo/jFexTowerContainer.h
"
19
20
#include "
L1CaloFEXSim/jTower.h
"
21
#include "
jTowerBuilder.h
"
22
#include "
L1CaloFEXSim/jTowerContainer.h
"
23
#include "
./jTowerMakerFromJfexTowers.h
"
24
#include "
L1CaloFEXSim/jFEXCompression.h
"
25
26
#include "
StoreGate/WriteHandle.h
"
27
#include "
StoreGate/ReadHandle.h
"
28
29
namespace
LVL1
{
30
31
jTowerMakerFromJfexTowers::jTowerMakerFromJfexTowers
(
const
std::string&
name
, ISvcLocator* pSvcLocator)
32
:
AthReentrantAlgorithm
(
name
, pSvcLocator)
33
{}
34
35
36
StatusCode
jTowerMakerFromJfexTowers::initialize
()
37
{
38
ATH_MSG_DEBUG
(
"isMC: "
<<
m_isMC
);
39
ATH_MSG_DEBUG
(
"UseEmulated: "
<<
m_UseEmulated
);
40
ATH_CHECK
(
m_DataTowerKey
.initialize(!
m_isMC
) );
41
ATH_CHECK
(
m_EmulTowerKey
.initialize(
m_UseEmulated
) );
42
ATH_CHECK
(
m_jSuperCellTowerMapperTool
.retrieve() );
43
ATH_CHECK
(
m_jTowerBuilderTool
.retrieve() );
44
ATH_CHECK
(
m_jTowerContainerSGKey
.initialize() );
45
46
return
StatusCode::SUCCESS;
47
48
}
49
50
51
StatusCode
jTowerMakerFromJfexTowers::execute
(
const
EventContext& ctx)
const
52
{
53
ATH_MSG_DEBUG
(
"Executing "
<<
name
() <<
", processing event number "
);
54
55
//Reading the decoded Data jTower container
56
SG::ReadHandle<xAOD::jFexTowerContainer>
jDataTowerContainer;
57
bool
jDataTowerFilled =
false
;
58
if
(!
m_isMC
){
59
jDataTowerContainer =
SG::ReadHandle<xAOD::jFexTowerContainer>
(
m_DataTowerKey
, ctx);
60
if
(!jDataTowerContainer.
isValid
()) {
61
ATH_MSG_ERROR
(
"Could not retrieve collection "
<< jDataTowerContainer.
key
() );
62
return
StatusCode::FAILURE;
63
}
64
jDataTowerFilled = !jDataTowerContainer->empty();
65
}
66
67
//Reading the Emulated jTower container
68
SG::ReadHandle<xAOD::jFexTowerContainer>
jEmulatedTowerContainer;
69
70
if
(
m_UseEmulated
){
71
jEmulatedTowerContainer =
SG::ReadHandle<xAOD::jFexTowerContainer>
(
m_EmulTowerKey
, ctx);
72
if
(!jEmulatedTowerContainer.
isValid
()) {
73
ATH_MSG_ERROR
(
"Could not retrieve collection "
<< jEmulatedTowerContainer.
key
() );
74
return
StatusCode::FAILURE;
75
}
76
}
77
78
79
// STEP 0 - Make a fresh local jTowerContainer
80
std::unique_ptr<jTowerContainer> local_jTowerContainerRaw = std::make_unique<jTowerContainer>();
81
82
// STEP 1 - Make some jTowers and fill the local container (This is the one the simulation reads)
83
m_jTowerBuilderTool
->init(local_jTowerContainerRaw);
84
85
// STEP 2 - Mapping jFexTowers with decoded Energies
86
if
( jDataTowerFilled ||
m_UseEmulated
) {
87
88
SG::ReadHandle<xAOD::jFexTowerContainer>
* data_jTowerContainer;
89
90
if
(
m_UseEmulated
&& !jDataTowerFilled){
91
data_jTowerContainer = &jEmulatedTowerContainer;
92
}
93
else
{
94
data_jTowerContainer = &jDataTowerContainer;
95
}
96
97
ATH_MSG_DEBUG
(
"Collection used to build the jTower for simulation: "
<< (*data_jTowerContainer).key() <<
" with size: "
<<(*data_jTowerContainer)->size());
98
99
for
(
const
xAOD::jFexTower
* my_jTower : *(*data_jTowerContainer) ) {
100
101
unsigned
int
TTID = my_jTower->jFEXtowerID();
102
103
LVL1::jTower
*targetTower;
104
if
( (targetTower = local_jTowerContainerRaw->findTower(TTID)) ) {
105
106
targetTower->
setiEta
( my_jTower->globalEta() );
107
targetTower->
setiPhi
( my_jTower->globalPhi() );
108
targetTower->
setCentreEta
( my_jTower->eta() );
109
targetTower->
setCentrePhi
( my_jTower->phi() );
110
targetTower->
setOnlineID
( my_jTower->OnlineID() );
111
112
uint8_t source = my_jTower->Calosource();
// Values: EMB:0 Tile:1 EMEC:2 HEC:3 FCAL1:4 FCAL2:5 FCAL3:6
113
114
// Set up for Tile energies
115
if
(source == 1) {
116
// Always in the hadronic layer = 1
117
targetTower->
set_Et
(1,(my_jTower->et_count()).at(0)*500);
// conversion factor of 500
118
119
//setting the saturaion
120
if
( (my_jTower->isjTowerSat()).at(0) ) targetTower->
setHADSat
();
121
}
122
else
{
//Now we do LATOME
123
124
int
layer = 1;
// Hadronic layer
125
if
(source == 0 or source == 2 or source == 4 ) layer = 0;
// Electromagnetic layer
126
127
// LATOME encoded Et needs to be converted to MeV
128
targetTower->
set_Et
(layer,
jFEXCompression::Expand
( (my_jTower->et_count()).at(0) ) );
129
130
//Setting the saturation
131
if
( (my_jTower->isjTowerSat()).at(0) ){
132
if
( layer == 1 ){
133
targetTower->
setHADSat
();
134
}
135
else
{
136
targetTower->
setEMSat
();
137
}
138
}
139
}
140
}
141
else
{
142
ATH_MSG_ERROR
(
"Tower ID is officially unknown - it will be ignored. (Needs investigation). Please report this!"
);
143
continue
;
144
}
145
}
146
}
147
else
{
148
ATH_MSG_ERROR
(
"Falling into the legacy path. This should never happen!. Use EmulatedTowers or DataTowers - Contact L1Calo offline experts"
);
149
return
StatusCode::FAILURE;
150
151
// Prefer to keep this for debugging purposes - Experts only
152
// It does reconstruct the jTowers using eta/phi coordinates and internal parameters from the CaloCell and TriggerTower containers.
153
// EmulatedTowers and DataTowers are xAOD objects, so they can saved into an AOD file.
154
ATH_CHECK
(
m_jSuperCellTowerMapperTool
->AssignSuperCellsToTowers(local_jTowerContainerRaw));
155
ATH_CHECK
(
m_jSuperCellTowerMapperTool
->AssignTriggerTowerMapper(local_jTowerContainerRaw));
156
}
157
158
// STEP 3 - Once coordinates energies and all are filled, then we fill pileup and noise values
159
ATH_CHECK
(
m_jTowerBuilderTool
->AssignPileupAndNoiseValues(local_jTowerContainerRaw));
160
161
// STEP 4 - Write the completed jTowerContainer into StoreGate (move the local copy in memory)
162
SG::WriteHandle<LVL1::jTowerContainer>
jTowerContainerSG(
m_jTowerContainerSGKey
, ctx);
163
ATH_CHECK
(jTowerContainerSG.
record
(std::move( local_jTowerContainerRaw ) ) );
164
165
return
StatusCode::SUCCESS;
166
}
167
168
169
}
// end of LVL1 namespace
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_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
LVL1::jFEXCompression::Expand
static int Expand(unsigned int code)
Uncompress data.
Definition
jFEXCompression.cxx:53
LVL1::jTowerMakerFromJfexTowers::jTowerMakerFromJfexTowers
jTowerMakerFromJfexTowers(const std::string &name, ISvcLocator *pSvcLocator)
Definition
jTowerMakerFromJfexTowers.cxx:31
LVL1::jTowerMakerFromJfexTowers::m_EmulTowerKey
SG::ReadHandleKey< xAOD::jFexTowerContainer > m_EmulTowerKey
Definition
jTowerMakerFromJfexTowers.h:40
LVL1::jTowerMakerFromJfexTowers::m_jTowerContainerSGKey
SG::WriteHandleKey< LVL1::jTowerContainer > m_jTowerContainerSGKey
Definition
jTowerMakerFromJfexTowers.h:48
LVL1::jTowerMakerFromJfexTowers::m_DataTowerKey
SG::ReadHandleKey< xAOD::jFexTowerContainer > m_DataTowerKey
Definition
jTowerMakerFromJfexTowers.h:35
LVL1::jTowerMakerFromJfexTowers::m_UseEmulated
Gaudi::Property< bool > m_UseEmulated
Definition
jTowerMakerFromJfexTowers.h:43
LVL1::jTowerMakerFromJfexTowers::initialize
virtual StatusCode initialize() override
Definition
jTowerMakerFromJfexTowers.cxx:36
LVL1::jTowerMakerFromJfexTowers::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
jTowerMakerFromJfexTowers.cxx:51
LVL1::jTowerMakerFromJfexTowers::m_isMC
Gaudi::Property< bool > m_isMC
Definition
jTowerMakerFromJfexTowers.h:44
LVL1::jTowerMakerFromJfexTowers::m_jSuperCellTowerMapperTool
ToolHandle< IjSuperCellTowerMapper > m_jSuperCellTowerMapperTool
Definition
jTowerMakerFromJfexTowers.h:51
LVL1::jTowerMakerFromJfexTowers::m_jTowerBuilderTool
ToolHandle< IjTowerBuilder > m_jTowerBuilderTool
Definition
jTowerMakerFromJfexTowers.h:50
LVL1::jTower
The jTower class is an interface object for jFEX trigger algorithms The purposes are twofold:
Definition
jTower.h:36
LVL1::jTower::setiEta
void setiEta(int ieta)
Definition
jTower.cxx:300
LVL1::jTower::set_Et
void set_Et(int layer, int et)
Set ET value in MeV.
Definition
jTower.cxx:101
LVL1::jTower::setHADSat
void setHADSat()
Definition
jTower.h:58
LVL1::jTower::setiPhi
void setiPhi(int iphi)
Definition
jTower.cxx:310
LVL1::jTower::setCentrePhi
void setCentrePhi(float iphi)
Definition
jTower.cxx:304
LVL1::jTower::setEMSat
void setEMSat()
set and get saturation
Definition
jTower.h:55
LVL1::jTower::setOnlineID
void setOnlineID(int tower_id_online)
Definition
jTower.cxx:314
LVL1::jTower::setCentreEta
void setCentreEta(float ieta)
Add to eta/phi values of a specified tower.
Definition
jTower.cxx:296
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
jFEXCompression.h
jFexTowerContainer.h
jTowerBuilder.h
jTowerContainer.h
jTowerMakerFromJfexTowers.h
jTower.h
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition
IZdcDataAccess.h:13
xAOD::jFexTower
jFexTower_v1 jFexTower
Define the latest version of the TriggerTower class.
Definition
jFexTower.h:15
TrigConf::name
Definition
HLTChainList.h:35
Generated on
for ATLAS Offline Software by
1.17.0