ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloCondPhysAlgs
src
CaloCellEnergyCorr2Ntuple.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 "
CaloCellEnergyCorr2Ntuple.h
"
6
#include "
CaloIdentifier/CaloGain.h
"
7
#include "
CaloEvent/CaloCell.h
"
8
#include "Identifier/Identifier.h"
9
#include "
xAODEventInfo/EventInfo.h
"
10
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
11
#include "
CaloCondBlobObjs/CaloCondBlobFlt.h
"
12
13
#include "CoolKernel/types.h"
14
#include "CoolKernel/Record.h"
15
#include "CoralBase/AttributeListSpecification.h"
16
17
18
//Constructor
19
CaloCellEnergyCorr2Ntuple::CaloCellEnergyCorr2Ntuple
(
const
std::string& name, ISvcLocator* pSvcLocator):
20
AthAlgorithm
(name,pSvcLocator),
21
m_calo_id
(nullptr),
22
m_Hash
(0),
23
m_OffId
(0),
24
m_eta
(0),
25
m_phi
(0),
26
m_layer
(0),
27
m_detector
(0),
28
m_corr
(0),
29
m_tree
(nullptr)
30
{
31
}
32
33
//__________________________________________________________________________
34
//Destructor
35
CaloCellEnergyCorr2Ntuple::~CaloCellEnergyCorr2Ntuple
()
36
{
37
}
38
//__________________________________________________________________________
39
StatusCode
CaloCellEnergyCorr2Ntuple::initialize
()
40
{
41
ATH_MSG_DEBUG
(
"CaloCellEnergyCorr2Ntuple initialize()"
);
42
43
ATH_CHECK
(
m_thistSvc
.retrieve());
44
45
const
CaloIdManager
* mgr =
nullptr
;
46
ATH_CHECK
(
detStore
()->retrieve( mgr ) );
47
m_calo_id
= mgr->getCaloCell_ID();
48
49
ATH_CHECK
(
m_caloMgrKey
.initialize());
50
ATH_CHECK
(
m_attrListCollKey
.initialize());
51
52
m_tree
=
new
TTree(
"mytree"
,
"Calo Noise ntuple"
);
53
m_tree
->Branch(
"iHash"
,&
m_Hash
,
"iHash/I"
);
54
m_tree
->Branch(
"iOffId"
,&
m_OffId
,
"iOffId/I"
);
55
m_tree
->Branch(
"eta"
,&
m_eta
,
"eta/F"
);
56
m_tree
->Branch(
"phi"
,&
m_phi
,
"phi/F"
);
57
m_tree
->Branch(
"layer"
,&
m_layer
,
"layer/I"
);
58
m_tree
->Branch(
"detector"
,&
m_detector
,
"detector/I"
);
59
m_tree
->Branch(
"ECorr"
,&
m_corr
,
"ECorr/F"
);
60
ATH_CHECK
(
m_thistSvc
->regTree(
"/file1/mytree"
,
m_tree
) );
61
62
ATH_MSG_INFO
(
" end of CaloCellEnergyCorr2Ntuple::initialize "
);
63
return
StatusCode::SUCCESS;
64
65
}
66
//__________________________________________________________________________
67
StatusCode
CaloCellEnergyCorr2Ntuple::execute
(
const
EventContext&
/*ctx*/
)
68
{
69
ATH_MSG_DEBUG
(
"CaloCellEnergyCorr2Ntuple execute()"
);
70
71
return
StatusCode::SUCCESS;
72
}
73
74
//__________________________________________________________________________
75
StatusCode
CaloCellEnergyCorr2Ntuple::stop
()
76
{
77
SG::ReadCondHandle<AthenaAttributeList>
attrListColl (
m_attrListCollKey
);
78
const
coral::Blob& blob=(**attrListColl)[
"CaloCondBlob16M"
].data<coral::Blob>();
79
std::unique_ptr<const CaloCondBlobFlt> flt (
CaloCondBlobFlt::getInstance
(blob));
80
81
int
nobj=flt->getNObjs();
82
int
nchan=flt->getNChans();
83
ATH_MSG_INFO
(
"NObjs: "
<<nobj<<
" nChans: "
<<nchan<<
" nGains: "
<<flt->getNGains() );
84
85
SG::ReadCondHandle<CaloDetDescrManager>
caloMgrHandle{
m_caloMgrKey
};
86
ATH_CHECK
(caloMgrHandle.
isValid
());
87
const
CaloDetDescrManager
* calodetdescrmgr = *caloMgrHandle;
88
89
int
ncell=
m_calo_id
->calo_cell_hash_max();
90
ATH_MSG_INFO
(
" start loop over Calo cells "
<< ncell );
91
for
(
int
i=0;i<ncell;i++) {
92
IdentifierHash
idHash=i;
93
Identifier
id
=
m_calo_id
->cell_id(idHash);
94
const
CaloDetDescrElement
* calodde = calodetdescrmgr->
get_element
(
id
);
95
96
m_Hash
= i;
97
m_OffId
= (int)(
id
.get_identifier32().get_compact());
98
99
m_eta
= calodde->
eta_raw
();
100
m_phi
= calodde->
phi_raw
();
101
m_layer
=
m_calo_id
->calo_sample(
id
);
102
m_detector
=-1;
103
if
(
m_calo_id
->is_em(
id
)) {
104
if
(
m_calo_id
->is_em_barrel(
id
)) {
105
m_detector
=0;
106
}
else
if
(
m_calo_id
->is_em_endcap_outer(
id
)) {
107
m_detector
=1;
108
}
else
{
109
m_detector
=2;
110
}
111
}
else
if
(
m_calo_id
->is_hec(
id
)) {
112
m_detector
= 3;
113
}
else
if
(
m_calo_id
->is_fcal(
id
)) {
114
m_detector
= 4;
115
}
116
117
if
(
m_Hash
>= nchan)
break
;
118
m_corr
= flt->getData(
m_Hash
,0,0);
119
120
121
m_tree
->Fill();
122
123
}
// loop over cells
124
125
return
StatusCode::SUCCESS;
126
}
127
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_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
AthenaAttributeList.h
CaloCellEnergyCorr2Ntuple.h
CaloCell.h
CaloCondBlobFlt.h
CaloGain.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
CaloCellEnergyCorr2Ntuple::CaloCellEnergyCorr2Ntuple
CaloCellEnergyCorr2Ntuple(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition
CaloCellEnergyCorr2Ntuple.cxx:19
CaloCellEnergyCorr2Ntuple::m_attrListCollKey
SG::ReadCondHandleKey< AthenaAttributeList > m_attrListCollKey
Definition
CaloCellEnergyCorr2Ntuple.h:58
CaloCellEnergyCorr2Ntuple::stop
virtual StatusCode stop() override
standard Athena-Algorithm method
Definition
CaloCellEnergyCorr2Ntuple.cxx:75
CaloCellEnergyCorr2Ntuple::~CaloCellEnergyCorr2Ntuple
~CaloCellEnergyCorr2Ntuple()
Default Destructor.
Definition
CaloCellEnergyCorr2Ntuple.cxx:35
CaloCellEnergyCorr2Ntuple::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition
CaloCellEnergyCorr2Ntuple.h:53
CaloCellEnergyCorr2Ntuple::m_detector
int m_detector
Definition
CaloCellEnergyCorr2Ntuple.h:65
CaloCellEnergyCorr2Ntuple::m_tree
TTree * m_tree
Definition
CaloCellEnergyCorr2Ntuple.h:67
CaloCellEnergyCorr2Ntuple::m_eta
float m_eta
Definition
CaloCellEnergyCorr2Ntuple.h:62
CaloCellEnergyCorr2Ntuple::m_calo_id
const CaloCell_ID * m_calo_id
Definition
CaloCellEnergyCorr2Ntuple.h:51
CaloCellEnergyCorr2Ntuple::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition
CaloCellEnergyCorr2Ntuple.cxx:39
CaloCellEnergyCorr2Ntuple::m_phi
float m_phi
Definition
CaloCellEnergyCorr2Ntuple.h:63
CaloCellEnergyCorr2Ntuple::execute
virtual StatusCode execute(const EventContext &ctx) override
standard Athena-Algorithm method
Definition
CaloCellEnergyCorr2Ntuple.cxx:67
CaloCellEnergyCorr2Ntuple::m_layer
int m_layer
Definition
CaloCellEnergyCorr2Ntuple.h:64
CaloCellEnergyCorr2Ntuple::m_OffId
int m_OffId
Definition
CaloCellEnergyCorr2Ntuple.h:61
CaloCellEnergyCorr2Ntuple::m_corr
float m_corr
Definition
CaloCellEnergyCorr2Ntuple.h:66
CaloCellEnergyCorr2Ntuple::m_Hash
int m_Hash
Definition
CaloCellEnergyCorr2Ntuple.h:60
CaloCellEnergyCorr2Ntuple::m_thistSvc
ServiceHandle< ITHistSvc > m_thistSvc
Definition
CaloCellEnergyCorr2Ntuple.h:49
CaloCondBlobFlt::getInstance
static CaloCondBlobFlt * getInstance(coral::Blob &blob)
Returns a pointer to a non-const CaloCondBlobFlt.
Definition
CaloCondBlobFlt.cxx:12
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
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
Identifier
Definition
IdentifierFieldParser.cxx:14
EventInfo.h
Generated on
for ATLAS Offline Software by
1.17.0