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 ) :
78 std::vector<int> ivec; ivec.push_back(-1);
80 std::vector<float> fvec; fvec.push_back(1.0);
82 std::vector<int> iivec; iivec.push_back(-1);
84 std::vector<float> ffvec; ffvec.push_back(1.0);
96 ATH_MSG_ERROR(
"CaloSamples and SampleValues vectors not equal length !!! " );
97 return StatusCode::FAILURE;
100 ATH_MSG_ERROR(
"HVLines and HVvalues vectors not equal length !!! " );
101 return StatusCode::FAILURE;
117 return StatusCode::SUCCESS;
122 return StatusCode::SUCCESS;
127 return StatusCode::SUCCESS;
142 for (
int i=CaloCell_ID::PreSamplerB; i<=CaloCell_ID::EME3; ++i) {
145 for (
int i=CaloCell_ID::HEC0; i<=CaloCell_ID::HEC3; ++i) {
148 for (
int i=CaloCell_ID::FCAL0; i<=CaloCell_ID::FCAL2; ++i) {
151 for (
int i=CaloCell_ID::TileBar0; i<=CaloCell_ID::TileExt2; ++i) {
154 if(maxsubcalo < 0 ) {
156 return StatusCode::FAILURE;
162 ATH_MSG_INFO(
"Working on hash range 0 to " << hashMax );
164 coral::AttributeListSpecification* spec =
new coral::AttributeListSpecification();
165 spec->extend(
"CaloCondBlob16M",
"blob");
167 coral::Blob& blob=(*attrList)[
"CaloCondBlob16M"].data<coral::Blob>();
174 std::vector<std::vector<float> > defVec;
175 defVec.emplace_back(1,1);
176 flt->init(defVec,hashMax,1);
183 const EventContext& ctx = Gaudi::Hive::currentContext();
185 std::vector<const CondAttrListCollection*> attrvec;
188 attrvec.push_back (*dcsHdl);
191 HVData hvdata (*manager, **hvCabling, attrvec);
197 std::vector<float> setVec(1,1);
200 for(
unsigned h=0;
h<hashMax;++
h) {
202 std::vector<int>::const_iterator pos;
205 const std::vector<float>::size_type idx = pos -
m_calosample.begin();
211 std::vector<int> hvlineId =
GetHVLines(hvdata, offId, caloMgr);
214 std::vector<int>::const_iterator poshv;
215 for(
unsigned i=0; i<hvlineId.size(); ++i) {
221 if(nfound == (
int)hvlineId.size()) {
228 flt->setData(
h,0,setVec);
231 ATH_MSG_INFO(
"Found " << nSet <<
" channels which have a sample correction. " );
232 ATH_MSG_INFO(
"Found " << nSetHV <<
" channels which have a HV correction. " );
234 return StatusCode::SUCCESS;
247 if (!embElement) std::abort();
249 unsigned int nelec = cell->getNumElectrodes();
250 for (
unsigned int i=0;i<nelec;i++) {
252 for (
unsigned int igap=0;igap<2;igap++) hv.insert(hvdata.
m_hvdata_EMB.
hvLineNo (electrode, igap));
256 if (!emecElement) std::abort();
258 unsigned int nelec = cell->getNumElectrodes();
259 for (
unsigned int i=0;i<nelec;i++) {
265 for (
unsigned int igap=0;igap<2;igap++) {
266 hv.insert(hvdata_EMEC.
hvLineNo (electrode, igap));
272 if (!hecElement) std::abort();
274 unsigned int nsubgaps = cell->getNumSubgaps();
275 for (
unsigned int igap=0;igap<nsubgaps;igap++) {
281 if (!fcalElement) std::abort();
283 unsigned int nlines = tile->getNumHVLines();
284 for (
unsigned int i=0;i<nlines;i++) {
291 if (!embElement) std::abort();
297 if (!emecElement) std::abort();
304 std::vector<int> hvlines;
305 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:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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
virtual StatusCode initialize() override
SG::ReadCondHandleKey< LArHVIdMapping > m_hvCablingKey
std::vector< int > m_hvlines
virtual ~CaloCellCalcEnergyCorr()
Destructor:
virtual StatusCode stop() override
CaloCellCalcEnergyCorr(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
std::vector< int > m_calosample
const LArHEC_ID * m_larhec_id
std::vector< int > GetHVLines(const HVData &hvdata, const Identifier &id, const CaloDetDescrManager *caloMgr)
SG::ReadCondHandleKeyArray< CondAttrListCollection > m_DCSFolderKeys
std::vector< float > m_value
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
std::vector< float > m_hvvalue
virtual StatusCode finalize() override
const LArEM_ID * m_larem_id
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