15#include "CoralBase/Blob.h"
20#include "Gaudi/Property.h"
31 ISvcLocator* pSvcLocator ) :
53 return StatusCode::SUCCESS;
74 const EventContext& ctx = Gaudi::Hive::currentContext();
80 return StatusCode::FAILURE;
87 return StatusCode::FAILURE;
94 coral::AttributeListSpecification* spec =
new coral::AttributeListSpecification();
95 spec->extend(
"Shape",
"blob");
96 spec->extend(
"ShapeDer",
"blob");
97 spec->extend(
"TimeOffset",
"blob");
98 spec->extend<
unsigned>(
"nSamples");
99 spec->extend<
unsigned>(
"version");
101 unsigned nSamples=32;
103 const unsigned blobSize=hashMax*nSamples;
106 coral::AttributeList attrList(*spec);
107 attrList[
"version"].setValue(0U);
108 coral::Blob& shapeBlob=attrList[
"Shape"].data<coral::Blob>();
109 coral::Blob& shapeDerBlob=attrList[
"ShapeDer"].data<coral::Blob>();
110 coral::Blob& toBlob=attrList[
"TimeOffset"].data<coral::Blob>();
116 attrList[
"nSamples"].setValue(nSamples);
117 shapeBlob.resize(blobSize*
sizeof(
float));
118 shapeDerBlob.resize(blobSize*
sizeof(
float));
119 toBlob.resize(hashMax*
sizeof(
float));
121 float *pShape=
static_cast<float*
>(shapeBlob.startingAddress());
122 float *pShapeDer=
static_cast<float*
>(shapeDerBlob.startingAddress());
123 float *pTimeOffset=
static_cast<float*
>(toBlob.startingAddress());
127 for (
unsigned i=0;i<blobSize;++i) {
133 for (
unsigned i=0;i<hashMax;++i) {
138 unsigned nTotalIds=0;
141 for (;scIt!=scIt_e;++scIt) {
149 const std::vector<Identifier> &cellIds=
m_scidTool->superCellToOfflineID(scId);
150 if (cellIds.empty()) {
151 ATH_MSG_ERROR(
"Got empty vector of cell ids for super cell id 0x"
153 return StatusCode::FAILURE;
161 auto shape=cellShape->
Shape(cabling->createSignalChannelID(cellId),0);
162 auto shapeDer=cellShape->
ShapeDer(cabling->createSignalChannelID(cellId),0);
164 if (nSamples!=shape.size() || nSamples!=shapeDer.size()) {
166 ATH_MSG_ERROR(
"Expected" << nSamples <<
", Shape:" << shape.size() <<
", ShapeDer:" << shapeDer.size());
167 return StatusCode::FAILURE;
169 for (
unsigned i=0;i<nSamples;++i) {
170 pShape[scOnlHash*nSamples+i]=shape[i];
171 pShapeDer[scOnlHash*nSamples+i]=shapeDer[i];
180 coll->
add(0,attrList);
182 ATH_MSG_INFO(
"Total number of SuperCells:" << nTotalIds <<
", Tile:" << nTileIds
183 <<
", LAr: " << nTotalIds-nTileIds);
187 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 with parameters:
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.
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKeySC
virtual StatusCode initialize() override
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
virtual StatusCode execute() override
virtual ~LArShapeToSCShape()
Destructor:
LArShapeToSCShape()
Default constructor:
ToolHandle< ICaloSuperCellIDTool > m_scidTool