ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloCellCorrection
src
CaloCellEnergyRescaler.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CaloCellEnergyRescaler.h
"
6
#include "
CaloEvent/CaloCellContainer.h
"
7
#include "
CaloCondBlobObjs/CaloCondBlobFlt.h
"
8
#include <memory>
9
10
CaloCellEnergyRescaler::CaloCellEnergyRescaler
(
const
std::string&
type
,
11
const
std::string& name,
12
const
IInterface* parent) :
13
base_class (
type
, name, parent) {}
14
15
CaloCellEnergyRescaler::~CaloCellEnergyRescaler
() =
default
;
16
17
18
StatusCode
CaloCellEnergyRescaler::initialize
() {
19
ATH_CHECK
(
m_eneShiftFldr
.initialize());
20
return
StatusCode::SUCCESS;
21
}
22
23
24
StatusCode
25
CaloCellEnergyRescaler::process
(
CaloCellContainer
* theCaloCellContainer,
26
const
EventContext& ctx)
const
{
27
28
SG::ReadCondHandle<AthenaAttributeList>
eneShiftHdl(
m_eneShiftFldr
,ctx);
29
30
//Possible optimization: If the following lines turn out to be slow to be executed on every event,
31
//put them into a conditions algo
32
const
coral::Blob& blob = (**eneShiftHdl)[
"CaloCondBlob16M"
].data<coral::Blob>();
33
if
(blob.size()<3) {
34
ATH_MSG_DEBUG
(
"Found empty blob, no corretion needed"
);
35
return
StatusCode::SUCCESS;
36
}
37
38
std::unique_ptr<const CaloCondBlobFlt> corrValues(
CaloCondBlobFlt::getInstance
(blob));
39
ATH_MSG_DEBUG
(
"Database folder has values for "
<< corrValues->getNChans() <<
" channels and "
<< corrValues->getNGains() <<
" gains."
);
40
41
42
CaloCellContainer::iterator
it=theCaloCellContainer->
begin
();
43
CaloCellContainer::iterator
it_e=theCaloCellContainer->
end
();
44
for
(;it!=it_e;++it) {
45
CaloCell
* theCell=(*it);
46
const
IdentifierHash
& hash_id=theCell->
caloDDE
()->
calo_hash
();
47
if
(hash_id<corrValues->getNChans()) {
48
const
float
& scale= corrValues->getData(hash_id);
49
theCell->
scaleEnergy
(scale);
50
}
//end if hash_id<NChans
51
}
//end loop over cells
52
return
StatusCode::SUCCESS;
53
}
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:28
CaloCellContainer.h
CaloCellEnergyRescaler.h
CaloCondBlobFlt.h
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
CaloCellEnergyRescaler::m_eneShiftFldr
SG::ReadCondHandleKey< AthenaAttributeList > m_eneShiftFldr
Definition
CaloCellEnergyRescaler.h:36
CaloCellEnergyRescaler::~CaloCellEnergyRescaler
~CaloCellEnergyRescaler()
CaloCellEnergyRescaler::process
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
Definition
CaloCellEnergyRescaler.cxx:25
CaloCellEnergyRescaler::CaloCellEnergyRescaler
CaloCellEnergyRescaler(const std::string &type, const std::string &name, const IInterface *parent)
Definition
CaloCellEnergyRescaler.cxx:10
CaloCellEnergyRescaler::initialize
virtual StatusCode initialize() override
Definition
CaloCellEnergyRescaler.cxx:18
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition
CaloCell.h:321
CaloCell::scaleEnergy
virtual void scaleEnergy(float scale)
scale energy
Definition
CaloCell.h:478
CaloCondBlobFlt::getInstance
static CaloCondBlobFlt * getInstance(coral::Blob &blob)
Returns a pointer to a non-const CaloCondBlobFlt.
Definition
CaloCondBlobFlt.cxx:12
CaloDetDescrElement::calo_hash
IdentifierHash calo_hash() const
cell calo hash
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:412
DataVector< CaloCell >::iterator
DataModel_detail::iterator< DataVector > iterator
Definition
DataVector.h:842
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
type
Generated on
for ATLAS Offline Software by
1.17.0