ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigAlgorithms
TrigCaloRec
src
HLTCaloGlobalCellMaker.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
#include "
HLTCaloGlobalCellMaker.h
"
6
7
#include "
LArCabling/LArOnOffIdMapping.h
"
8
#include "
CaloIdentifier/CaloCell_ID.h
"
9
#include "
CaloConditions/CaloNoise.h
"
10
#include "
LArIdentifier/LArOnlineID.h
"
11
#include <memory>
12
#include <cmath>
13
#include <map>
14
#include <algorithm>
//for std::sort
15
HLTCaloGlobalCellMaker::HLTCaloGlobalCellMaker
(std::string
const
& name, ISvcLocator* pSvcLocator)
16
:
AthReentrantAlgorithm
(name, pSvcLocator) {
17
}
18
19
StatusCode
HLTCaloGlobalCellMaker::initialize
() {
20
21
ATH_CHECK
(
detStore
()->retrieve(
m_onlineId
,
"LArOnlineID"
) );
22
ATH_CHECK
(
detStore
()->retrieve(
m_caloCell_ID
) );
23
ATH_CHECK
(
m_onOffIdMappingKey
.initialize() );
24
ATH_CHECK
(
m_noiseCDOKey
.initialize());
25
ATH_CHECK
(
m_inputCellContainerKey
.initialize());
26
ATH_CHECK
(
m_outputCellContainerKey
.initialize());
27
28
return
StatusCode::SUCCESS;
29
}
30
31
StatusCode
HLTCaloGlobalCellMaker::execute
(EventContext
const
& context)
const
{
32
ATH_MSG_DEBUG
(
"HLTCaloGlobalCellMaker::execute()"
);
33
34
SG::ReadHandle<CaloConstCellContainer>
inputCellHandle(
m_inputCellContainerKey
, context);
35
36
SG::WriteHandle<CaloConstCellContainer>
outputCellHandle(
m_outputCellContainerKey
, context);
37
38
SG::ReadCondHandle<CaloNoise>
noiseHdl{
m_noiseCDOKey
,context};
39
const
CaloNoise
* noiseCDO=*noiseHdl;
40
SG::ReadCondHandle<LArOnOffIdMapping>
onoff (
m_onOffIdMappingKey
, context);
41
42
auto
outputCells = std::make_unique<CaloConstCellContainer>();
43
uint32_t n_febs =
m_onlineId
->febHashMax();
44
std::map<HWIdentifier,std::vector<uint16_t> > cells_idx_per_feb;
45
std::map<HWIdentifier,uint16_t > maxcell_idx_per_feb;
46
constexpr
uint16_t maxidx = 129;
47
for
(uint32_t i=0;i<n_febs;i++){
48
HWIdentifier
feb_id =
m_onlineId
->feb_Id(
IdentifierHash
(i));
49
maxcell_idx_per_feb[feb_id]=maxidx;
50
}
51
52
// Get all channels which are above a given sigma cut (usually 2) and
53
// organize them in vectors.
54
for
(
auto
const
* cell : *inputCellHandle) {
55
if
(!cell->caloDDE()->is_tile() ){
56
Identifier
cellID = cell->ID();
57
float
noiseSigma = noiseCDO->
getNoise
(cellID,cell->gain());
58
IdentifierHash
offhashid =
m_caloCell_ID
->calo_cell_hash(cellID);
59
HWIdentifier
hwid = (*onoff)->createSignalChannelIDFromHash(offhashid);
60
HWIdentifier
hwid_feb =
m_onlineId
->feb_Id(hwid);
61
uint16_t channel =
m_onlineId
->channel(hwid);
62
if
( cell->energy() >
m_NumberOfSigma
*noiseSigma ) {
63
cells_idx_per_feb[hwid_feb].push_back(channel);
64
}
65
}
66
}
67
68
// impose the channel order. One might want to have other organizations.
69
// Here, I assume channel order. Only worth to manipulate if above
70
// a given number
71
for
(uint32_t i=0;i<n_febs;i++){
72
HWIdentifier
hwid_feb =
m_onlineId
->feb_Id(
IdentifierHash
(i));
73
std::vector<uint16_t>& indexes = cells_idx_per_feb[hwid_feb];
74
if
( indexes.size() <
m_MaxNCellsPerFEB
)
continue
;
75
std::sort
(indexes.begin(),indexes.end());
76
// This is the maximal channel number that will be accepted in
77
// a given FEB
78
maxcell_idx_per_feb[hwid_feb]=indexes[
m_MaxNCellsPerFEB
-1];
79
}
80
81
for
(
auto
const
* cell : *inputCellHandle) {
82
if
(cell->caloDDE()->is_tile() ){
83
std::unique_ptr<CaloCell> copy = cell->clone();
84
outputCells->push_back(std::move(copy));
85
}
else
{
86
Identifier
cellID = cell->ID();
87
float
noiseSigma = noiseCDO->
getNoise
(cellID,cell->gain());
88
IdentifierHash
offhashid =
m_caloCell_ID
->calo_cell_hash(cellID);
89
HWIdentifier
hwid = (*onoff)->createSignalChannelIDFromHash(offhashid);
90
HWIdentifier
hwid_feb =
m_onlineId
->feb_Id(hwid);
91
uint16_t channel =
m_onlineId
->channel(hwid);
92
// remember, by default, no channel number is above 128
93
if
( (cell->energy() >
m_NumberOfSigma
*noiseSigma) && (channel <= maxcell_idx_per_feb[hwid_feb]) ) {
94
std::unique_ptr<CaloCell> copy = cell->clone();
95
outputCells->push_back(std::move(copy));
96
}
97
}
98
}
99
100
for
(
auto
const
id
: {
CaloCell_ID::LAREM
,
CaloCell_ID::LARHEC
,
CaloCell_ID::LARFCAL
,
CaloCell_ID::TILE
})
101
if
(inputCellHandle->hasCalo(
id
))
102
outputCells->setHasCalo(
id
);
103
104
outputCells->updateCaloIterators();
105
106
ATH_CHECK
(outputCellHandle.
record
(std::move(outputCells)));
107
108
return
StatusCode::SUCCESS;
109
}
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
CaloCell_ID.h
CaloNoise.h
HLTCaloGlobalCellMaker.h
LArOnOffIdMapping.h
LArOnlineID.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
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
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
HLTCaloGlobalCellMaker::m_MaxNCellsPerFEB
Gaudi::Property< uint32_t > m_MaxNCellsPerFEB
Definition
HLTCaloGlobalCellMaker.h:33
HLTCaloGlobalCellMaker::execute
virtual StatusCode execute(EventContext const &context) const override
Definition
HLTCaloGlobalCellMaker.cxx:31
HLTCaloGlobalCellMaker::m_onOffIdMappingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffIdMappingKey
Definition
HLTCaloGlobalCellMaker.h:41
HLTCaloGlobalCellMaker::initialize
virtual StatusCode initialize() override
Definition
HLTCaloGlobalCellMaker.cxx:19
HLTCaloGlobalCellMaker::m_outputCellContainerKey
SG::WriteHandleKey< CaloConstCellContainer > m_outputCellContainerKey
Definition
HLTCaloGlobalCellMaker.h:29
HLTCaloGlobalCellMaker::m_inputCellContainerKey
SG::ReadHandleKey< CaloConstCellContainer > m_inputCellContainerKey
Definition
HLTCaloGlobalCellMaker.h:26
HLTCaloGlobalCellMaker::m_NumberOfSigma
Gaudi::Property< float > m_NumberOfSigma
Definition
HLTCaloGlobalCellMaker.h:32
HLTCaloGlobalCellMaker::m_caloCell_ID
const CaloCell_ID * m_caloCell_ID
Definition
HLTCaloGlobalCellMaker.h:39
HLTCaloGlobalCellMaker::HLTCaloGlobalCellMaker
HLTCaloGlobalCellMaker(std::string const &name, ISvcLocator *pSvcLocator)
Definition
HLTCaloGlobalCellMaker.cxx:15
HLTCaloGlobalCellMaker::m_onlineId
const LArOnlineID * m_onlineId
Definition
HLTCaloGlobalCellMaker.h:40
HLTCaloGlobalCellMaker::m_noiseCDOKey
SG::ReadCondHandleKey< CaloNoise > m_noiseCDOKey
Definition
HLTCaloGlobalCellMaker.h:42
HWIdentifier
Definition
HWIdentifier.h:13
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
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.
Identifier
Definition
IdentifierFieldParser.cxx:14
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
Generated on
for ATLAS Offline Software by
1.17.0