ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloCondPhysAlgs
src
CaloNoise2Ntuple.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 "
CaloNoise2Ntuple.h
"
6
#include "
CaloIdentifier/CaloGain.h
"
7
#include "
CaloEvent/CaloCell.h
"
8
#include "Identifier/Identifier.h"
9
#include "
xAODEventInfo/EventInfo.h
"
10
#include "
CaloConditions/CaloNoise.h
"
11
12
//Constructor
13
CaloNoise2Ntuple::CaloNoise2Ntuple
(
const
std::string& name, ISvcLocator* pSvcLocator):
14
AthAlgorithm
(name,pSvcLocator)
15
{
16
}
17
18
//__________________________________________________________________________
19
//Destructor
20
CaloNoise2Ntuple::~CaloNoise2Ntuple() =
default
;
21
22
//__________________________________________________________________________
23
StatusCode
CaloNoise2Ntuple::initialize
()
24
{
25
ATH_MSG_DEBUG
(
"CaloNoise2Ntuple initialize()"
);
26
27
ATH_CHECK
(
m_thistSvc
.retrieve() );
28
29
const
CaloIdManager
* mgr =
nullptr
;
30
ATH_CHECK
(
detStore
()->retrieve( mgr ) );
31
m_calo_id
= mgr->getCaloCell_ID();
32
33
ATH_CHECK
(
m_totalNoiseKey
.initialize() );
34
ATH_CHECK
(
m_elecNoiseKey
.initialize() );
35
ATH_CHECK
(
m_pileupNoiseKey
.initialize() );
36
ATH_CHECK
(
m_caloMgrKey
.initialize() );
37
38
m_tree
=
new
TTree(
m_treeName
.value().c_str(),
"Calo Noise ntuple"
);
39
m_tree
->Branch(
"iCool"
,&
m_iCool
,
"iCool/I"
);
40
m_tree
->Branch(
"iSubHash"
,&
m_SubHash
,
"iSubHash/I"
);
41
m_tree
->Branch(
"iHash"
,&
m_Hash
,
"iHash/I"
);
42
m_tree
->Branch(
"iOffId"
,&
m_OffId
,
"iOffId/I"
);
43
m_tree
->Branch(
"eta"
,&
m_eta
,
"eta/F"
);
44
m_tree
->Branch(
"phi"
,&
m_phi
,
"phi/F"
);
45
m_tree
->Branch(
"layer"
,&
m_layer
,
"layer/I"
);
46
m_tree
->Branch(
"iGain"
,&
m_Gain
,
"iGain/I"
);
47
m_tree
->Branch(
"Noise"
,&
m_noise
,
"Noise/F"
);
48
m_tree
->Branch(
"ElecNoise"
,&
m_elecNoise
,
"ElecNoise/F"
);
49
m_tree
->Branch(
"PileupNoise"
,&
m_pileupNoise
,
"PileupNoise/F"
);
50
ATH_CHECK
(
m_thistSvc
->regTree((std::string(
"/file1/calonoise/"
)+
m_treeName
).c_str(),
m_tree
));
51
52
ATH_MSG_INFO
(
" end of CaloNoise2Ntuple::initialize "
);
53
return
StatusCode::SUCCESS;
54
55
}
56
//__________________________________________________________________________
57
StatusCode
CaloNoise2Ntuple::execute
(
const
EventContext&
/*ctx*/
)
58
{
59
ATH_MSG_DEBUG
(
"CaloNoise2Ntuple execute()"
);
60
61
const
xAOD::EventInfo
* eventInfo =
nullptr
;
62
if
(
evtStore
()->retrieve(eventInfo).isFailure()) {
63
ATH_MSG_WARNING
(
" Cannot access to event info "
);
64
return
StatusCode::SUCCESS;
65
}
66
m_lumiBlock
= eventInfo->
lumiBlock
();
67
m_runNumber
= eventInfo->
runNumber
();
68
69
return
StatusCode::SUCCESS;
70
}
71
72
//__________________________________________________________________________
73
StatusCode
CaloNoise2Ntuple::stop
()
74
{
75
ATH_MSG_INFO
(
" Run Number, lumiblock "
<<
m_runNumber
<<
" "
<<
m_lumiBlock
);
76
77
const
EventContext& ctx = Gaudi::Hive::currentContext();
78
SG::ReadCondHandle<CaloNoise>
totalNoise (
m_totalNoiseKey
, ctx);
79
SG::ReadCondHandle<CaloNoise>
elecNoise (
m_elecNoiseKey
, ctx);
80
SG::ReadCondHandle<CaloNoise>
pileupNoise (
m_pileupNoiseKey
, ctx);
81
SG::ReadCondHandle<CaloDetDescrManager>
caloMgrHandle{
m_caloMgrKey
, ctx};
82
ATH_CHECK
(caloMgrHandle.
isValid
());
83
const
CaloDetDescrManager
* calodetdescrmgr = *caloMgrHandle;
84
85
int
ncell=
m_calo_id
->calo_cell_hash_max();
86
ATH_MSG_INFO
(
" start loop over Calo cells "
<< ncell );
87
for
(
int
i=0;i<ncell;i++) {
88
IdentifierHash
idHash=i;
89
Identifier
id
=
m_calo_id
->cell_id(idHash);
90
const
CaloDetDescrElement
* calodde = calodetdescrmgr->
get_element
(
id
);
91
int
subCalo;
92
IdentifierHash
idSubHash =
m_calo_id
->subcalo_cell_hash (idHash, subCalo);
93
94
int
iCool=-1;
95
if
(
m_calo_id
->is_em(
id
)) {
// EM calo
96
if
(
m_calo_id
->is_em_barrel(
id
)) {
97
if
(
m_calo_id
->pos_neg(
id
) > 0 )
98
iCool=2;
99
else
100
iCool=1;
101
}
102
if
(
m_calo_id
->is_em_endcap(
id
)) {
103
if
(
m_calo_id
->pos_neg(
id
) > 0 )
104
iCool=3;
105
else
106
iCool=0;
107
}
108
109
}
110
if
(
m_calo_id
->is_hec(
id
)) {
// HEC
111
iCool=16;
112
}
113
if
(
m_calo_id
->is_fcal(
id
)) {
// Fcal
114
iCool=32;
115
}
116
if
(
m_calo_id
->is_tile(
id
)) {
// Tile
117
iCool=48;
118
}
119
int
ii = (
int
) (idSubHash);
120
121
m_iCool
= iCool;
122
m_SubHash
= ii;
123
m_Hash
= i;
124
m_OffId
= (
int
)(
id
.get_identifier32().get_compact());
125
126
m_eta
= calodde->
eta_raw
();
127
m_phi
= calodde->
phi_raw
();
128
m_layer
=
m_calo_id
->calo_sample(
id
);
129
130
int
ngain;
131
if
(subCalo<3) ngain=3;
132
else
ngain=4;
133
134
for
(
int
igain=0;igain<ngain;igain++) {
135
136
CaloGain::CaloGain
gain=
CaloGain::LARHIGHGAIN
;
137
if
(subCalo<3) {
138
if
(igain==0) gain=
CaloGain::LARHIGHGAIN
;
139
if
(igain==1) gain=
CaloGain::LARMEDIUMGAIN
;
140
if
(igain==2) gain=
CaloGain::LARLOWGAIN
;
141
}
142
else
{
143
if
(igain==0) gain=
CaloGain::TILELOWLOW
;
144
if
(igain==1) gain=
CaloGain::TILELOWHIGH
;
145
if
(igain==2) gain=
CaloGain::TILEHIGHLOW
;
146
if
(igain==3) gain=
CaloGain::TILEHIGHHIGH
;
147
}
148
m_Gain
= igain;
149
150
m_noise
= totalNoise->getNoise(
id
,gain);
151
m_elecNoise
= elecNoise->getNoise(
id
,gain);
152
m_pileupNoise
= pileupNoise->getNoise(
id
,gain);
153
154
m_tree
->Fill();
155
156
}
// loop over gains
157
158
}
// loop over cells
159
160
return
StatusCode::SUCCESS;
161
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloCell.h
CaloGain.h
CaloNoise2Ntuple.h
CaloNoise.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell.
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloDetDescrElement::eta_raw
float eta_raw() const
cell eta_raw
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:350
CaloDetDescrElement::phi_raw
float phi_raw() const
cell phi_raw
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:352
CaloDetDescrManager_Base::get_element
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
Definition
CaloDetDescrManager.cxx:159
CaloDetDescrManager
This class provides the client interface for accessing the detector description information common to...
Definition
CaloDetDescrManager.h:469
CaloIdManager
This class initializes the Calo (LAr and Tile) offline identifiers.
Definition
CaloIdManager.h:45
CaloNoise2Ntuple::m_pileupNoiseKey
SG::ReadCondHandleKey< CaloNoise > m_pileupNoiseKey
Definition
CaloNoise2Ntuple.h:58
CaloNoise2Ntuple::m_tree
TTree * m_tree
Definition
CaloNoise2Ntuple.h:75
CaloNoise2Ntuple::m_runNumber
int m_runNumber
Definition
CaloNoise2Ntuple.h:77
CaloNoise2Ntuple::m_calo_id
const CaloCell_ID * m_calo_id
Definition
CaloNoise2Ntuple.h:51
CaloNoise2Ntuple::m_elecNoise
float m_elecNoise
Definition
CaloNoise2Ntuple.h:73
CaloNoise2Ntuple::m_layer
int m_layer
Definition
CaloNoise2Ntuple.h:70
CaloNoise2Ntuple::m_Gain
int m_Gain
Definition
CaloNoise2Ntuple.h:71
CaloNoise2Ntuple::m_SubHash
int m_SubHash
Definition
CaloNoise2Ntuple.h:65
CaloNoise2Ntuple::m_noise
float m_noise
Definition
CaloNoise2Ntuple.h:72
CaloNoise2Ntuple::m_Hash
int m_Hash
Definition
CaloNoise2Ntuple.h:66
CaloNoise2Ntuple.int
int
Definition
CaloNoise2Ntuple.py:29
CaloNoise2Ntuple::m_treeName
Gaudi::Property< std::string > m_treeName
Definition
CaloNoise2Ntuple.h:62
CaloNoise2Ntuple::m_lumiBlock
int m_lumiBlock
Definition
CaloNoise2Ntuple.h:78
CaloNoise2Ntuple::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition
CaloNoise2Ntuple.h:60
CaloNoise2Ntuple::m_OffId
int m_OffId
Definition
CaloNoise2Ntuple.h:67
CaloNoise2Ntuple::m_totalNoiseKey
SG::ReadCondHandleKey< CaloNoise > m_totalNoiseKey
Definition
CaloNoise2Ntuple.h:54
CaloNoise2Ntuple::m_pileupNoise
float m_pileupNoise
Definition
CaloNoise2Ntuple.h:74
CaloNoise2Ntuple::stop
virtual StatusCode stop() override
standard Athena-Algorithm method
Definition
CaloNoise2Ntuple.cxx:73
CaloNoise2Ntuple::m_phi
float m_phi
Definition
CaloNoise2Ntuple.h:69
CaloNoise2Ntuple::m_thistSvc
ServiceHandle< ITHistSvc > m_thistSvc
Definition
CaloNoise2Ntuple.h:49
CaloNoise2Ntuple::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition
CaloNoise2Ntuple.cxx:23
CaloNoise2Ntuple::m_elecNoiseKey
SG::ReadCondHandleKey< CaloNoise > m_elecNoiseKey
Definition
CaloNoise2Ntuple.h:56
CaloNoise2Ntuple::m_eta
float m_eta
Definition
CaloNoise2Ntuple.h:68
CaloNoise2Ntuple::CaloNoise2Ntuple
CaloNoise2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition
CaloNoise2Ntuple.cxx:13
CaloNoise2Ntuple::execute
virtual StatusCode execute(const EventContext &ctx) override
standard Athena-Algorithm method
Definition
CaloNoise2Ntuple.cxx:57
CaloNoise2Ntuple::m_iCool
int m_iCool
Definition
CaloNoise2Ntuple.h:64
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::ReadCondHandle::isValid
bool isValid()
Definition
ReadCondHandle.h:205
xAOD::EventInfo_v1::lumiBlock
uint32_t lumiBlock() const
The current event's luminosity block number.
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
CaloGain::CaloGain
CaloGain
Definition
CaloGain.h:11
CaloGain::LARMEDIUMGAIN
@ LARMEDIUMGAIN
Definition
CaloGain.h:18
CaloGain::TILELOWLOW
@ TILELOWLOW
Definition
CaloGain.h:12
CaloGain::LARLOWGAIN
@ LARLOWGAIN
Definition
CaloGain.h:18
CaloGain::TILELOWHIGH
@ TILELOWHIGH
Definition
CaloGain.h:13
CaloGain::TILEHIGHLOW
@ TILEHIGHLOW
Definition
CaloGain.h:14
CaloGain::TILEHIGHHIGH
@ TILEHIGHHIGH
Definition
CaloGain.h:15
CaloGain::LARHIGHGAIN
@ LARHIGHGAIN
Definition
CaloGain.h:18
Identifier
Definition
IdentifierFieldParser.cxx:14
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0