ATLAS Offline Software
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"
8 #include <memory>
9 
11  const std::string& name,
12  const IInterface* parent) :
13  base_class (type, name, parent) {}
14 
16 
17 
20  return StatusCode::SUCCESS;
21 }
22 
23 
26  const EventContext& ctx) const {
27 
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->setEnergy(theCell->energy()*scale);
50  }//end if hash_id<NChans
51  }//end loop over cells
52  return StatusCode::SUCCESS;
53 }
CaloCellEnergyRescaler.h
CaloCondBlobDat::getData
T getData(const unsigned int channel, const unsigned int adc, const unsigned int idx) const
Returns a single T belonging to a channel/gain.
Definition: CaloCondBlobDat.h:134
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
CaloCellEnergyRescaler::m_eneShiftFldr
SG::ReadCondHandleKey< AthenaAttributeList > m_eneShiftFldr
Definition: CaloCellEnergyRescaler.h:36
CaloCellEnergyRescaler::CaloCellEnergyRescaler
CaloCellEnergyRescaler(const std::string &type, const std::string &name, const IInterface *parent)
Definition: CaloCellEnergyRescaler.cxx:10
skel.it
it
Definition: skel.GENtoEVGEN.py:423
python.subdetectors.tile.Blob
Blob
Definition: tile.py:17
CaloCell::setEnergy
virtual void setEnergy(float energy)
set energy
Definition: CaloCell.cxx:136
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:311
CaloDetDescrElement::calo_hash
IdentifierHash calo_hash() const
cell calo hash
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:412
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:305
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCondBlobBase::getNGains
uint32_t getNGains() const
Returns the number of gains stored for each channel.
Definition: CaloCondBlobBase.h:239
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CaloCellEnergyRescaler::process
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
Definition: CaloCellEnergyRescaler.cxx:25
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
CaloCellContainer.h
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
CaloCellEnergyRescaler::initialize
virtual StatusCode initialize() override
Definition: CaloCellEnergyRescaler.cxx:18
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
CaloCondBlobFlt.h
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
CaloCondBlobFlt::getInstance
static CaloCondBlobFlt * getInstance(coral::Blob &blob)
Returns a pointer to a non-const CaloCondBlobFlt.
Definition: CaloCondBlobFlt.cxx:12
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
IdentifierHash
Definition: IdentifierHash.h:38
CaloCondBlobAlgs_fillNoiseFromASCII.blob
blob
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:96
CaloCellEnergyRescaler::~CaloCellEnergyRescaler
~CaloCellEnergyRescaler()
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
CaloCondBlobBase::getNChans
uint32_t getNChans() const
Returns the number of channels stored in the BLOB.
Definition: CaloCondBlobBase.h:231