ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAlgorithms
TrigCaloRec
src
CaloGlobalRoIBuilder.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
//
7
// NAME: CaloGlobalRoIBuilder.cxx
8
// PACKAGE: Trigger/TrigAlgorithms/TrigCaloRec
9
//
10
// AUTHOR: D.O. Damazio
11
// Algorithm to prepare RoIs based on the presence of cells
12
// above some noise threshold
13
//
14
// ********************************************************************
15
//
16
17
#include "
CaloGlobalRoIBuilder.h
"
18
#include "
CxxUtils/phihelper.h
"
19
#include "GaudiKernel/StatusCode.h"
20
#include "
TrigSteeringEvent/TrigRoiDescriptor.h
"
21
#include "
TrigT2CaloEgamma/RingerReFex.h
"
22
#include "
xAODTrigCalo/TrigEMCluster.h
"
23
#include "
xAODTrigCalo/TrigEMClusterContainer.h
"
24
#include "
xAODTrigCalo/TrigEMClusterAuxContainer.h
"
25
26
27
// Constructor
28
CaloGlobalRoIBuilder::CaloGlobalRoIBuilder
(
const
std::string& name, ISvcLocator* pSvcLocator)
29
:
AthReentrantAlgorithm
(name, pSvcLocator)
30
{
31
};
32
33
// Initialize
34
StatusCode
CaloGlobalRoIBuilder::initialize
()
35
{
36
ATH_MSG_DEBUG
(
"in CaloGlobalRoIBuilder::initialize()"
);
37
38
ATH_CHECK
(
m_inputCellsKey
.initialize() );
39
ATH_CHECK
(
m_noiseCDOKey
.initialize() );
40
ATH_CHECK
(
m_clusterContainerKey
.initialize());
41
ATH_CHECK
(
m_ringerContainerKey
.initialize() );
42
m_emAlgTools
.retrieve().ignore();
43
44
return
StatusCode::SUCCESS;
45
46
}
47
48
// Initialize
49
StatusCode
CaloGlobalRoIBuilder::execute
(
const
EventContext& ctx)
const
50
{
51
ATH_MSG_DEBUG
(
"in CaloGlobalRoIBuilder::execute()"
);
52
auto
cells =
SG::makeHandle
(
m_inputCellsKey
, ctx);
53
SG::ReadCondHandle<CaloNoise>
noiseHdl{
m_noiseCDOKey
, ctx};
54
const
CaloNoise
*noisep = *noiseHdl;
55
ATH_MSG_VERBOSE
(
" Input Cells : "
<< cells.name() <<
" of size "
<<cells->size() );
56
SG::WriteHandle<xAOD::TrigEMClusterContainer>
trigEmClusterCollection(
m_clusterContainerKey
, ctx);
57
ATH_CHECK
( trigEmClusterCollection.
record
(std::make_unique<xAOD::TrigEMClusterContainer>(),
58
std::make_unique<xAOD::TrigEMClusterAuxContainer>()) );
59
60
SG::WriteHandle<xAOD::TrigRingerRingsContainer>
ringsCollection =
61
SG::WriteHandle<xAOD::TrigRingerRingsContainer>
(
m_ringerContainerKey
, ctx );
62
63
ATH_CHECK
( ringsCollection.
record
( std::make_unique<xAOD::TrigRingerRingsContainer>(),
64
std::make_unique<xAOD::TrigRingerRingsAuxContainer>() ) );
65
66
unsigned
int
clustern=0;
// for linking
67
for
(
const
auto
cell : *cells ) {
68
const
CaloDetDescrElement
* cdde = cell->caloDDE();
69
if
( fabsf(cdde->
eta
()) >
m_abseta_thr
)
continue
;
70
if
( cdde->
getSampling
() >
m_samp_thr
)
continue
;
71
if
(cdde->
is_tile
() )
continue
;
72
float
thr=noisep->
getNoise
(cdde->
identifyHash
(), cell->gain());
73
if
( cell->energy() >
m_thr
*thr ){
74
// For each hot cell, let's make ringers
75
xAOD::TrigEMCluster
*ptrigEmCluster =
new
xAOD::TrigEMCluster
();
76
trigEmClusterCollection->push_back(ptrigEmCluster);
77
ptrigEmCluster->
setEnergy
(cell->energy());
78
ptrigEmCluster->
setEnergy
(cdde->
getSampling
(),cell->energy());
79
ptrigEmCluster->
setEt
(cell->pt());
80
ptrigEmCluster->
setEta
(cell->eta());
81
ptrigEmCluster->
setPhi
(cell->phi());
82
ptrigEmCluster->
setE233
(thr);
83
double
etaWidth(0.2);
84
double
phiWidth(0.2);
85
double
etamin = std::max(-2.5, cell->eta() - etaWidth);
86
double
etamax = std::min(2.5,
static_cast<
double
>
(cell->eta() + etaWidth));
87
double
phimin =
CxxUtils::wrapToPi
(cell->phi() - phiWidth);
88
double
phimax =
CxxUtils::wrapToPi
(
static_cast<
double
>
(cell->phi() + phiWidth));
89
const
TrigRoiDescriptor
newroi(cell->eta(),etamin,etamax,cell->phi(),phimin,phimax);
90
// use tool only to build rings
91
std::vector<RingerReFex::RingSet> vec_rs;
92
ATH_CHECK
(
m_emAlgTools
->prepareRinger(vec_rs,*ptrigEmCluster,newroi,ctx));
93
std::vector<float> ref_rings;
94
for
(std::vector<RingerReFex::RingSet>::iterator it=vec_rs.begin(); it!=vec_rs.end(); ++it)
95
{
96
auto
rings = it->rings();
97
ref_rings.insert(ref_rings.end(), rings.begin(), rings.end());
98
}
99
auto
ptrigRingerRings=
new
xAOD::TrigRingerRings
();
100
ringsCollection->push_back( ptrigRingerRings );
101
ptrigRingerRings->setRings(ref_rings);
102
auto
clusLink =
ElementLink<xAOD::TrigEMClusterContainer>
(
m_clusterContainerKey
.key(),clustern++,ctx);
103
ptrigRingerRings->setEmClusterLink( clusLink );
104
105
}
106
}
107
108
return
StatusCode::SUCCESS;
109
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ElementLink
ElementLink()
Default constructor.
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloGlobalRoIBuilder.h
TrigEMClusterContainer.h
TrigEMCluster.h
RingerReFex.h
TrigEMClusterAuxContainer.h
TrigRoiDescriptor.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell.
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrElement::identifyHash
IdentifierHash identifyHash() const override final
cell subcalo hash same as subcalo_hash(), but kept for backward compatibility
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:424
CaloDetDescrElement::is_tile
bool is_tile() const
cell belongs to Tile
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:442
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
CaloDetDescrElement::eta
float eta() const
cell eta
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:344
CaloGlobalRoIBuilder::m_samp_thr
Gaudi::Property< float > m_samp_thr
Definition
CaloGlobalRoIBuilder.h:42
CaloGlobalRoIBuilder::m_noiseCDOKey
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Definition
CaloGlobalRoIBuilder.h:39
CaloGlobalRoIBuilder::initialize
virtual StatusCode initialize() override
Definition
CaloGlobalRoIBuilder.cxx:34
CaloGlobalRoIBuilder::m_emAlgTools
ToolHandle< RingerReFex > m_emAlgTools
Definition
CaloGlobalRoIBuilder.h:44
CaloGlobalRoIBuilder::m_clusterContainerKey
SG::WriteHandleKey< xAOD::TrigEMClusterContainer > m_clusterContainerKey
Definition
CaloGlobalRoIBuilder.h:45
CaloGlobalRoIBuilder::m_abseta_thr
Gaudi::Property< float > m_abseta_thr
Definition
CaloGlobalRoIBuilder.h:41
CaloGlobalRoIBuilder::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CaloGlobalRoIBuilder.cxx:49
CaloGlobalRoIBuilder::m_ringerContainerKey
SG::WriteHandleKey< xAOD::TrigRingerRingsContainer > m_ringerContainerKey
Definition
CaloGlobalRoIBuilder.h:47
CaloGlobalRoIBuilder::m_thr
Gaudi::Property< float > m_thr
Definition
CaloGlobalRoIBuilder.h:40
CaloGlobalRoIBuilder::m_inputCellsKey
SG::ReadHandleKey< CaloCellContainer > m_inputCellsKey
Definition
CaloGlobalRoIBuilder.h:34
CaloGlobalRoIBuilder::CaloGlobalRoIBuilder
CaloGlobalRoIBuilder(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CaloGlobalRoIBuilder.cxx:28
CaloNoise
Definition
CaloNoise.h:17
CaloNoise::getNoise
float getNoise(const IdentifierHash h, const int gain) const
Accessor by IdentifierHash and gain.
Definition
CaloNoise.h:35
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
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.
TrigRoiDescriptor
nope - should be used for standalone also, perhaps need to protect the class def bits ifndef XAOD_ANA...
Definition
TrigRoiDescriptor.h:48
xAOD::TrigEMCluster_v1::setPhi
void setPhi(float)
set Phi (calibrated)
xAOD::TrigEMCluster_v1::setEta
void setEta(float)
set Eta (calibrated)
xAOD::TrigEMCluster_v1::setEt
void setEt(float)
set Et (calibrated)
xAOD::TrigEMCluster_v1::setEnergy
void setEnergy(float energy)
set Energy (calibrated)
xAOD::TrigEMCluster_v1::setE233
void setE233(float)
set Energy in a 3x3 cluster (no calibration) around hottest cell
CxxUtils::wrapToPi
constexpr T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition
phihelper.h:31
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
xAOD::TrigRingerRings
TrigRingerRings_v2 TrigRingerRings
Define the latest version of the TrigRingerRings class.
Definition
TrigRingerRings.h:17
xAOD::TrigEMCluster
TrigEMCluster_v1 TrigEMCluster
Define the latest version of the trigger EM cluster class.
Definition
Event/xAOD/xAODTrigCalo/xAODTrigCalo/TrigEMCluster.h:17
phihelper.h
Helper for azimuthal angle calculations.
Generated on
for ATLAS Offline Software by
1.17.0