ATLAS Offline Software
LArCellRescaler.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LArCellRescaler.h"
6 #include "CaloEvent/CaloCell.h"
8 
10  const std::string& name,
11  const IInterface* parent) :
13  declareInterface<CaloCellCorrection>(this);
14  declareProperty("CorrectionKey",m_key="ZeeCalibration",
15  "Key of the CaloCellFactor object to be used");
16 
17 }
18 
19 
21 
22 
24  ATH_MSG_DEBUG( " initialization " );
26  this,
27  m_factors,m_key) );
28 
29  return StatusCode::SUCCESS;
30 }
31 
32 
34  const CaloCell_ID* cellID;
35  ATH_CHECK( detStore()->retrieve(cellID) );
36  IdentifierHash emMin, emMax;
37  cellID->calo_cell_hash_range(CaloCell_ID::LAREM,emMin,emMax);
38  if (m_factors->size() != emMax) {
39  ATH_MSG_ERROR( "CaloCellFactor object with key " << m_key
40  << " has wrong size " << m_factors->size()
41  << " HashMax is " << emMax );
42  return StatusCode::FAILURE;
43  }
44  ATH_MSG_DEBUG( "CaloCellFactor object with key " << m_key << " has proper size." );
45  return StatusCode::SUCCESS;
46 }
47 
48 
49 
51  const EventContext& /*ctx*/) const
52 {
53  const IdentifierHash& hash_id=theCell->caloDDE()->calo_hash();
54  if (m_factors.isValid() && hash_id<m_factors->size())
55  theCell->setEnergy(theCell->energy()*(*m_factors)[hash_id]);
56 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
LArCellRescaler::~LArCellRescaler
virtual ~LArCellRescaler()
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CaloRec::CaloCellFactor::size
size_type size() const
Definition: CaloCellFactor.h:54
CaloCellCorrection
Definition: CaloCellCorrection.h:51
CaloCell.h
CaloCell::setEnergy
virtual void setEnergy(float energy)
set energy
Definition: CaloCell.cxx:136
IOVSVC_CALLBACK_ARGS
#define IOVSVC_CALLBACK_ARGS
short hand for IOVSvc call back argument list, to be used when no access to formal arguments is neede...
Definition: IOVSvcDefs.h:24
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
LArCellRescaler.h
CaloCell::energy
double energy() const
get energy (data member)
Definition: CaloCell.h:311
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
CaloDetDescrElement::calo_hash
IdentifierHash calo_hash() const
cell calo hash
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:412
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CaloCell_Base_ID::calo_cell_hash_range
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
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
LArCellRescaler::m_factors
const DataHandle< CaloRec::CaloCellFactor > m_factors
Definition: LArCellRescaler.h:48
test_pyathena.parent
parent
Definition: test_pyathena.py:15
DataHandle::isValid
bool isValid() const
RETRIEVES the DO to check it is valid and unlocked.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CaloCell_ID
Helper class for offline cell identifiers.
Definition: CaloCell_ID.h:34
LArCellRescaler::LArCellRescaler
LArCellRescaler(const std::string &type, const std::string &name, const IInterface *parent)
Definition: LArCellRescaler.cxx:9
LArCellRescaler::initialize
virtual StatusCode initialize() override
Definition: LArCellRescaler.cxx:23
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
LArCellRescaler::m_key
std::string m_key
Definition: LArCellRescaler.h:49
LArCellRescaler::MakeCorrection
virtual void MakeCorrection(CaloCell *theCell, const EventContext &ctx) const override
Definition: LArCellRescaler.cxx:50
CaloCell
Data object for each calorimeter readout cell.
Definition: CaloCell.h:57
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
LArCellRescaler::checkConstants
StatusCode checkConstants(IOVSVC_CALLBACK_ARGS)
Definition: LArCellRescaler.cxx:33
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
CaloCell_Base_ID::LAREM
@ LAREM
Definition: CaloCell_Base_ID.h:46