15#include "GaudiKernel/ToolHandle.h"
34#include "CoolKernel/types.h"
35#include "CoolKernel/Record.h"
36#include "CoralBase/AttributeListSpecification.h"
38#include "GaudiKernel/ThreadLocalContext.h"
45 const std::vector<const CondAttrListCollection*>& attrvec);
58 const std::vector<const CondAttrListCollection*>& attrvec)
59 :
m_hvdata_EMB (manager.getEMBHVManager().getData (hvCabling, attrvec)),
60 m_hvdata_EMBPS (manager.getEMBPresamplerHVManager().getData (hvCabling, attrvec)),
63 m_hvdata_EMECPS (manager.getEMECPresamplerHVManager().getData (hvCabling, attrvec)),
64 m_hvdata_HEC (manager.getHECHVManager().getData (hvCabling, attrvec)),
65 m_hvdata_FCAL (manager.getFCALHVManager().getData (hvCabling, attrvec))
71 ISvcLocator* pSvcLocator ):
82 ATH_MSG_ERROR(
"CaloSamples and SampleValues vectors not equal length !!! " );
83 return StatusCode::FAILURE;
86 ATH_MSG_ERROR(
"HVLines and HVvalues vectors not equal length !!! " );
87 return StatusCode::FAILURE;
103 return StatusCode::SUCCESS;
108 return StatusCode::SUCCESS;
113 return StatusCode::SUCCESS;
128 for (
int i=CaloCell_ID::PreSamplerB; i<=CaloCell_ID::EME3; ++i) {
131 for (
int i=CaloCell_ID::HEC0; i<=CaloCell_ID::HEC3; ++i) {
134 for (
int i=CaloCell_ID::FCAL0; i<=CaloCell_ID::FCAL2; ++i) {
137 for (
int i=CaloCell_ID::TileBar0; i<=CaloCell_ID::TileExt2; ++i) {
140 if(maxsubcalo < 0 ) {
142 return StatusCode::FAILURE;
148 ATH_MSG_INFO(
"Working on hash range 0 to " << hashMax );
150 coral::AttributeListSpecification* spec =
new coral::AttributeListSpecification();
151 spec->extend(
"CaloCondBlob16M",
"blob");
153 coral::Blob& blob=(*attrList)[
"CaloCondBlob16M"].data<coral::Blob>();
160 std::vector<std::vector<float> > defVec;
161 defVec.emplace_back(1,1);
162 flt->init(defVec,hashMax,1);
169 const EventContext& ctx = Gaudi::Hive::currentContext();
171 std::vector<const CondAttrListCollection*> attrvec;
174 attrvec.push_back (*dcsHdl);
177 HVData hvdata (*manager, **hvCabling, attrvec);
183 std::vector<float> setVec(1,1);
186 for(
unsigned h=0;
h<hashMax;++
h) {
188 std::vector<int>::const_iterator pos;
191 const std::vector<float>::size_type idx = pos -
m_calosample.begin();
197 std::vector<int> hvlineId =
GetHVLines(hvdata, offId, caloMgr);
200 std::vector<int>::const_iterator poshv;
201 for(
unsigned i=0; i<hvlineId.size(); ++i) {
207 if(nfound == (
int)hvlineId.size()) {
214 flt->setData(
h,0,setVec);
217 ATH_MSG_INFO(
"Found " << nSet <<
" channels which have a sample correction. " );
218 ATH_MSG_INFO(
"Found " << nSetHV <<
" channels which have a HV correction. " );
220 return StatusCode::SUCCESS;
233 if (!embElement) std::abort();
235 unsigned int nelec = cell->getNumElectrodes();
236 for (
unsigned int i=0;i<nelec;i++) {
238 for (
unsigned int igap=0;igap<2;igap++) hv.insert(hvdata.
m_hvdata_EMB.
hvLineNo (electrode, igap));
242 if (!emecElement) std::abort();
244 unsigned int nelec = cell->getNumElectrodes();
245 for (
unsigned int i=0;i<nelec;i++) {
251 for (
unsigned int igap=0;igap<2;igap++) {
252 hv.insert(hvdata_EMEC.
hvLineNo (electrode, igap));
258 if (!hecElement) std::abort();
260 unsigned int nsubgaps = cell->getNumSubgaps();
261 for (
unsigned int igap=0;igap<nsubgaps;igap++) {
267 if (!fcalElement) std::abort();
269 unsigned int nlines = tile->getNumHVLines();
270 for (
unsigned int i=0;i<nlines;i++) {
277 if (!embElement) std::abort();
283 if (!emecElement) std::abort();
290 std::vector<int> hvlines;
291 for (std::set<int>::iterator i=hv.begin();i!=hv.end();++i) hvlines.push_back(*i);
#define ATH_CHECK
Evaluate an expression and check for errors.
Calo Subsystem specific Detector Elements + Dummy element for testing.
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
GeoIntrusivePtr< const EMBCell > EMBCellConstLink
GeoIntrusivePtr< const HECCell > HECCellConstLink
@Class: HECCellConstLink
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
Header file for AthHistogramAlgorithm.
An AttributeList represents a logical row of attributes in a metadata table.
virtual StatusCode execute() override
Gaudi::Property< std::string > m_folder
virtual StatusCode initialize() override
SG::ReadCondHandleKey< LArHVIdMapping > m_hvCablingKey
Gaudi::Property< std::vector< float > > m_value
virtual ~CaloCellCalcEnergyCorr()
Destructor:
Gaudi::Property< std::vector< float > > m_hvvalue
virtual StatusCode stop() override
CaloCellCalcEnergyCorr(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const LArHEC_ID * m_larhec_id
std::vector< int > GetHVLines(const HVData &hvdata, const Identifier &id, const CaloDetDescrManager *caloMgr)
SG::ReadCondHandleKeyArray< CondAttrListCollection > m_DCSFolderKeys
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Gaudi::Property< std::vector< int > > m_calosample
virtual StatusCode finalize() override
const LArEM_ID * m_larem_id
Gaudi::Property< std::vector< int > > m_hvlines
const LArFCAL_ID * m_larfcal_id
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
int calo_sample(const Identifier id) const
returns an int taken from Sampling enum and describing the subCalo to which the Id belongs.
Identifier cell_id(const int subCalo, const int barec_or_posneg, const int sampling_or_fcalmodule, const int region_or_dummy, const int eta, const int phi) const
Make a cell (== channel) ID from constituting fields and subCalo index; for (Mini)FCAL,...
Helper class for offline cell identifiers.
Class for storing a number of floats (Flt) and functions on those.
static CaloCondBlobFlt * getInstance(coral::Blob &blob)
Returns a pointer to a non-const CaloCondBlobFlt.
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class provides the client interface for accessing the detector description information common to...
This class initializes the Calo (LAr and Tile) offline identifiers.
LAr EMB Detector Element.
EMBCellConstLink getEMBCell() const
EMB Cell description from LArReadoutGeometry.
int hvLineNo(const EMBHVElectrode &electrode, const int &iGap) const
int hvLineNo(const EMBPresamplerHVModule &module, const int &iGap) const
Describes one HV Module within the EMB Presampler.
Smart Pointer to EMEC Cells.
LAr EMEC Detector Element.
EMECCellConstLink getEMECCell() const
EMEC Cell description from LArReadoutGeometry.
const EMECHVModule & getModule() const
int hvLineNo(const EMECHVElectrode &electrode, const int &iGap) const
EMECHVModule::IOType getWheelIndex() const
int hvLineNo(const EMECPresamplerHVModule &module, const int &iGap) const
Describes one HV Module within the EMEc Presampler.
LAr FCAL Detector Element.
const FCALTile * getFCALTile() const
FCAL Tile description from LArReadoutGeometry.
int hvLineNo(const FCALHVLine &line) const
A tile of the forward calorimeter readout geometry.
LAr HEC Detector Element.
HECCellConstLink getHECCell() const
HEC Cell description from LArReadoutGeometry.
int hvLineNo(const HECHVSubgap &subgap) const
This is a "hash" representation of an Identifier.
This class provides access to the High Voltage throughout the LAr.
HVData(const LArHVManager &manager, const LArHVIdMapping &hvCabling, const std::vector< const CondAttrListCollection * > &attrvec)
FCALHVManager::FCALHVData m_hvdata_FCAL
HECHVManager::HECHVData m_hvdata_HEC
EMECPresamplerHVManager::EMECPresamplerHVData m_hvdata_EMECPS
EMBHVManager::EMBHVData m_hvdata_EMB
EMECHVManager::EMECHVData m_hvdata_EMEC_IN
EMECHVManager::EMECHVData m_hvdata_EMEC_OUT
EMBPresamplerHVManager::EMBPresamplerHVData m_hvdata_EMBPS