15#include "CoralBase/Blob.h"
20#include "Gaudi/Property.h"
31 ISvcLocator* pSvcLocator ) :
53 return StatusCode::SUCCESS;
79 return StatusCode::FAILURE;
86 return StatusCode::FAILURE;
93 coral::AttributeListSpecification* spec =
new coral::AttributeListSpecification();
94 spec->extend(
"Shape",
"blob");
95 spec->extend(
"ShapeDer",
"blob");
96 spec->extend(
"TimeOffset",
"blob");
97 spec->extend<
unsigned>(
"nSamples");
98 spec->extend<
unsigned>(
"version");
100 unsigned nSamples=32;
102 const unsigned blobSize=hashMax*nSamples;
105 coral::AttributeList attrList(*spec);
106 attrList[
"version"].setValue(0U);
107 coral::Blob& shapeBlob=attrList[
"Shape"].data<coral::Blob>();
108 coral::Blob& shapeDerBlob=attrList[
"ShapeDer"].data<coral::Blob>();
109 coral::Blob& toBlob=attrList[
"TimeOffset"].data<coral::Blob>();
115 attrList[
"nSamples"].setValue(nSamples);
116 shapeBlob.resize(blobSize*
sizeof(
float));
117 shapeDerBlob.resize(blobSize*
sizeof(
float));
118 toBlob.resize(hashMax*
sizeof(
float));
120 float *pShape=
static_cast<float*
>(shapeBlob.startingAddress());
121 float *pShapeDer=
static_cast<float*
>(shapeDerBlob.startingAddress());
122 float *pTimeOffset=
static_cast<float*
>(toBlob.startingAddress());
126 for (
unsigned i=0;i<blobSize;++i) {
132 for (
unsigned i=0;i<hashMax;++i) {
137 unsigned nTotalIds=0;
140 for (;scIt!=scIt_e;++scIt) {
148 const std::vector<Identifier> &cellIds=
m_scidTool->superCellToOfflineID(scId);
149 if (cellIds.empty()) {
150 ATH_MSG_ERROR(
"Got empty vector of cell ids for super cell id 0x"
152 return StatusCode::FAILURE;
160 auto shape=cellShape->
Shape(cabling->createSignalChannelID(cellId),0);
161 auto shapeDer=cellShape->
ShapeDer(cabling->createSignalChannelID(cellId),0);
163 if (nSamples!=shape.size() || nSamples!=shapeDer.size()) {
165 ATH_MSG_ERROR(
"Expected" << nSamples <<
", Shape:" << shape.size() <<
", ShapeDer:" << shapeDer.size());
166 return StatusCode::FAILURE;
168 for (
unsigned i=0;i<nSamples;++i) {
169 pShape[scOnlHash*nSamples+i]=shape[i];
170 pShapeDer[scOnlHash*nSamples+i]=shapeDer[i];
179 coll->
add(0,attrList);
181 ATH_MSG_INFO(
"Total number of SuperCells:" << nTotalIds <<
", Tile:" << nTileIds
182 <<
", LAr: " << nTotalIds-nTileIds);
186 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Helper class for offline supercell identifiers.
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Defines a common ERRORCODE enum for LAr-Calibration objects.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
const ServiceHandle< StoreGateSvc > & detStore() const
id_iterator cell_begin() const
begin iterator over full set of Identifiers (LAr + Tiles)
id_iterator cell_end() const
end iterator over full set of Identifiers (LAr + Tiles)
bool is_tile(const Identifier id) const
test if the id belongs to the Tiles
Helper class for offline supercell identifiers.
This class is a collection of AttributeLists where each one is associated with a channel number.
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
virtual ShapeRef_t Shape(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
virtual ShapeRef_t ShapeDer(const HWIdentifier &id, int gain, int tbin=0, int mode=0) const =0
This is a "hash" representation of an Identifier.
value_type get_compact() const
Get the compact id.
HWIdentifier createSignalChannelID(const Identifier &id) const
create a HWIdentifier from an Identifier (not inline)
IdentifierHash channel_Hash(HWIdentifier channelId) const
Create channel_hash from channel_Id.
size_type channelHashMax() const
Define channel hash tables max size.
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
virtual StatusCode initialize() override
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
virtual ~LArShapeToSCShape()
Destructor:
LArShapeToSCShape()
Default constructor:
ToolHandle< ICaloSuperCellIDTool > m_scidTool