12#include "CoralBase/AttributeListException.h"
13#include "CoralBase/Blob.h"
26#include "TBufferFile.h"
55 m_klass = TClass::GetClass(
"LArHVPathologiesDb");
58 return StatusCode::FAILURE;
65 return StatusCode::SUCCESS;
70 return StatusCode::SUCCESS;
80 return StatusCode::SUCCESS;
87 ATH_MSG_ERROR(
"Do not have AthenaAttributeList for pathology");
88 return StatusCode::FAILURE;
97 const unsigned blobVersion=(*attrList)[
"blobVersion"].data<
unsigned int>();
98 const coral::Blob& blob = (*attrList)[
"Constants"].data<coral::Blob>();
100 if (blobVersion!=0) {
101 ATH_MSG_ERROR (
"Can't interpret BLOB version " << blobVersion );
102 return StatusCode::FAILURE;
107 TBufferFile buf(TBuffer::kRead, blob.size(), blob_data,
false);
108 std::unique_ptr<LArHVPathologiesDb> hvpathdb
111 auto hvpath = std::make_unique<LArHVPathology>(hvpathdb.get());
113 fillElectMap(calodetdescrmgr, hvpath.get(), writeHandle);
116 if(writeHandle.
record(std::move(hvpath)).isFailure()) {
119 <<
" with EventRange " << writeHandle.
getRange()
120 <<
" into Conditions Store");
121 return StatusCode::FAILURE;
124 return StatusCode::SUCCESS;
126 }
catch (coral::AttributeListException &e) {
128 return StatusCode::FAILURE;
131 return StatusCode::SUCCESS;
142 ATH_MSG_WARNING(
"Do not have HV mapping, will not fill LArHVPathology electIndMap !!!");
147 std::lock_guard<std::mutex> lock(
m_mut);
149 std::map<std::pair<Identifier, unsigned int>, std::vector<unsigned short> > &elecMap = hvpath->
getElecMap();
151 std::vector<unsigned short> list;
152 std::vector<HWIdentifier> hwlineId;
153 unsigned int HVline = 0;
157 m_hvmapTool->GetHVLines(
id,calodetdescrmgr, hwlineId);
162 unsigned int nelec = cell->getNumElectrodes();
163 for(
auto hwid:hwlineId) {
166 for (
unsigned int i=0;i<nelec;i++) {
168 for (
unsigned int igap=0;igap<2;igap++) {
169 if ((
unsigned)electrode.
hvLineNo(igap,hvCabling)==HVline) {
170 list.push_back(2*i+igap);
175 elecMap.insert(std::make_pair(std::make_pair(
id,HVline) ,list));
183 unsigned int nelec = cell->getNumElectrodes();
184 for(
auto hwid:hwlineId) {
187 for (
unsigned int i=0;i<nelec;i++) {
189 for (
unsigned int igap=0;igap<2;igap++) {
190 if ((
unsigned)electrode.
hvLineNo(igap,hvCabling)==HVline) {
191 list.push_back(2*i+igap);
196 elecMap.insert(std::make_pair(std::make_pair(
id,HVline),list));
205 for(
auto hwid:hwlineId) {
208 for (
unsigned int igap=0;igap<2;igap++) {
209 if ((
unsigned)hvmodule.
hvLineNo(igap,hvCabling)==HVline) {
210 list.push_back(igap);
213 elecMap.insert(std::make_pair(std::make_pair(
id,HVline),list));
223 for(
auto hwid:hwlineId) {
226 for (
unsigned int igap=0;igap<2;igap++) {
227 if ((
unsigned)hvmodule.
hvLineNo(igap,hvCabling)==HVline) {
228 list.push_back(igap);
231 elecMap.insert(std::make_pair(std::make_pair(
id,HVline),list));
240 m_hvmapTool->GetHVLines(
id,calodetdescrmgr,hwlineId);
243 unsigned int nsubgaps = cell->getNumSubgaps();
244 for(
auto hwid:hwlineId) {
247 for (
unsigned int i=0;i<nsubgaps;i++) {
249 if ((
unsigned)subgap.
hvLineNo(hvCabling)==HVline) {
253 elecMap.insert(std::make_pair(std::make_pair(
id,HVline),list));
261 m_hvmapTool->GetHVLines(
id,calodetdescrmgr, hwlineId);
263 const FCALTile* tile = fcalElement->getFCALTile();
264 unsigned int nlines = tile->getNumHVLines();
265 for(
auto hwid:hwlineId) {
268 for (
unsigned int i=0;i<nlines;i++) {
271 if ((
unsigned)line2->hvLineNo(hvCabling)==HVline) {
276 elecMap.insert(std::make_pair(std::make_pair(
id,HVline),list));
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Calo Subsystem specific Detector Elements + Dummy element for testing.
GeoIntrusivePtr< const EMBCell > EMBCellConstLink
GeoIntrusivePtr< const HECCell > HECCellConstLink
@Class: HECCellConstLink
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
const ServiceHandle< StoreGateSvc > & detStore() const
Base class for conditions algorithms.
An AttributeList represents a logical row of attributes in a metadata table.
Helper class for offline cell identifiers.
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
const LArEM_ID * em_idHelper() const
access to EM idHelper
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
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...
LAr EMB Detector Element.
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
Describes one HV Module within the EMB Presampler.
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
Smart Pointer to EMEC Cells.
LAr EMEC Detector Element.
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
Describes one HV Module within the EMEc Presampler.
int hvLineNo(int iGap, const LArHVIdMapping *hvIdMapping) const
LAr FCAL Detector Element.
A tile of the forward calorimeter readout geometry.
LAr HEC Detector Element.
int hvLineNo(const LArHVIdMapping *hvIdMapping) const
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
SG::WriteCondHandleKey< LArHVPathology > m_hvPathologyKey
ToolHandle< ILArHVMapTool > m_hvmapTool
virtual StatusCode finalize() override
void fillElectMap(const CaloDetDescrManager *calodetdescrmgr, LArHVPathology *hvpath, SG::WriteCondHandle< LArHVPathology > &writeHandle) const
virtual ~LArHVPathologyDbCondAlg()
const LArEM_ID * m_larem_id
virtual StatusCode execute(const EventContext &ctx) const override
const LArOnlineID * m_laronline_id
const LArHVLineID * m_hvlineHelper
SG::ReadCondHandleKey< AthenaAttributeList > m_pathologyFolderKey
SG::ReadCondHandleKey< LArHVIdMapping > m_hvMappingKey
const LArFCAL_ID * m_larfcal_id
const LArHEC_ID * m_larhec_id
virtual StatusCode initialize() override
LArHVPathologyDbCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
std::map< std::pair< Identifier, unsigned int >, std::vector< unsigned short > > & getElecMap()
const std::string & key() const
void addDependency(const EventIDRange &range)
const EventIDRange & getRange() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED