ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAlgorithms
TrigCaloRec
src
HLTCaloCellCorrector.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
#include "
HLTCaloCellCorrector.h
"
6
7
#include <
xAODHIEvent/HIEventShape.h
>
8
9
#include <memory>
10
#include <cmath>
11
12
namespace
{
13
double
get_average_energy(
xAOD::HIEventShapeContainer
const
& eventShape,
14
int
layer,
double
eta
) {
15
for
(
const
auto
es : eventShape) {
16
if
(es->layer() != layer ||
eta
> es->etaMax() ||
eta <= es->
etaMin
())
17
continue
;
18
19
double
et
= es->et();
20
21
/* energy in MeV; essentially zero */
22
if
(std::abs(
et
) < 0.1)
23
continue
;
24
25
return
et
/ es->nCells();
26
}
27
28
return
0.;
29
}
30
}
31
32
HLTCaloCellCorrector::HLTCaloCellCorrector
(std::string
const
& name, ISvcLocator* pSvcLocator)
33
:
AthReentrantAlgorithm
(name, pSvcLocator) {
34
}
35
36
StatusCode
HLTCaloCellCorrector::initialize
() {
37
ATH_CHECK
(
m_eventShapeCollectionKey
.initialize());
38
ATH_CHECK
(
m_inputCellContainerKey
.initialize());
39
ATH_CHECK
(
m_outputCellContainerKey
.initialize());
40
41
return
StatusCode::SUCCESS;
42
}
43
44
StatusCode
HLTCaloCellCorrector::execute
(EventContext
const
& context)
const
{
45
ATH_MSG_DEBUG
(
"HLTCaloCellCorrector::execute()"
);
46
47
SG::ReadHandle<xAOD::HIEventShapeContainer>
eventShapeHandle(
m_eventShapeCollectionKey
, context);
48
SG::ReadHandle<CaloConstCellContainer>
inputCellHandle(
m_inputCellContainerKey
, context);
49
50
SG::WriteHandle<CaloConstCellContainer>
outputCellHandle(
m_outputCellContainerKey
, context);
51
52
const
auto
& eventShape = *eventShapeHandle;
53
auto
outputCells = std::make_unique<CaloConstCellContainer>();
54
55
for
(
auto
const
* cell : *inputCellHandle) {
56
std::unique_ptr<CaloCell> copy = cell->clone();
57
58
int
layer = copy->caloDDE()->getSampling();
59
60
double
eavg = get_average_energy(eventShape, layer, copy->eta());
61
double
etotal = (copy->et() - eavg) / copy->sinTh();
62
63
copy->setEnergy(etotal);
64
outputCells->push_back(std::move(copy));
65
}
66
67
for
(
auto
const
id
: {
CaloCell_ID::LAREM
,
CaloCell_ID::LARHEC
,
CaloCell_ID::LARFCAL
,
CaloCell_ID::TILE
})
68
if
(inputCellHandle->hasCalo(
id
))
69
outputCells->setHasCalo(
id
);
70
71
outputCells->updateCaloIterators();
72
73
ATH_CHECK
(outputCellHandle.
record
(std::move(outputCells)));
74
75
return
StatusCode::SUCCESS;
76
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
HIEventShape.h
HLTCaloCellCorrector.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CaloCell_Base_ID::LAREM
@ LAREM
Definition
CaloCell_Base_ID.h:45
CaloCell_Base_ID::TILE
@ TILE
Definition
CaloCell_Base_ID.h:45
CaloCell_Base_ID::LARFCAL
@ LARFCAL
Definition
CaloCell_Base_ID.h:45
CaloCell_Base_ID::LARHEC
@ LARHEC
Definition
CaloCell_Base_ID.h:45
HLTCaloCellCorrector::HLTCaloCellCorrector
HLTCaloCellCorrector(std::string const &name, ISvcLocator *pSvcLocator)
Definition
HLTCaloCellCorrector.cxx:32
HLTCaloCellCorrector::m_eventShapeCollectionKey
SG::ReadHandleKey< xAOD::HIEventShapeContainer > m_eventShapeCollectionKey
Definition
HLTCaloCellCorrector.h:22
HLTCaloCellCorrector::m_inputCellContainerKey
SG::ReadHandleKey< CaloConstCellContainer > m_inputCellContainerKey
Definition
HLTCaloCellCorrector.h:24
HLTCaloCellCorrector::execute
virtual StatusCode execute(EventContext const &context) const override
Definition
HLTCaloCellCorrector.cxx:44
HLTCaloCellCorrector::initialize
virtual StatusCode initialize() override
Definition
HLTCaloCellCorrector.cxx:36
HLTCaloCellCorrector::m_outputCellContainerKey
SG::WriteHandleKey< CaloConstCellContainer > m_outputCellContainerKey
Definition
HLTCaloCellCorrector.h:27
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
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.
LArCellBinning.etaMin
etaMin
Definition
LArCellBinning.py:84
xAOD::HIEventShapeContainer
HIEventShapeContainer_v2 HIEventShapeContainer
Define the latest version of the container.
Definition
HIEventShapeContainer.h:17
et
Extra patterns decribing particle interation process.
Generated on
for ATLAS Offline Software by
1.17.0