28 #include "CoralBase/Blob.h"
42 ISvcLocator* pSvcLocator ) :
80 return StatusCode::SUCCESS;
86 const std::string&
outputName,
const unsigned nGain,
const bool withFCAL) {
89 unsigned nCopiedEMPS=0;
92 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
93 spec->extend(blobName,
"blob");
94 spec->extend<
unsigned>(
"version");
98 (*attrList)[
"version"].setValue(0U);
101 float* pblob=
static_cast<float*
>(
blob.startingAddress());
124 unsigned coolChan=
gain;
127 if (nGain==1) coolChan=1;
129 coll->add(coolChan,*attrList);
133 ATH_MSG_INFO(
"Converted " << blobName <<
" to inline storage. Total number of channels=" <<
nChannels );
134 ATH_MSG_INFO(
"Number of channels filled with default value (1.0) " << nDefault <<
" (including disconnected)" );
136 ATH_MSG_INFO(
"\t Number of low gain EMBPS channels copied from medium gain" << nCopiedEMPS );
138 if (
sc.isFailure()) {
148 ATH_MSG_INFO(
"LArCompleteToFlat::pedestalFlat, starting");
151 unsigned nCopiedEMPS=0;
153 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
154 spec->extend(
"Pedestal",
"blob");
155 spec->extend(
"PedestalRMS",
"blob");
156 spec->extend<
unsigned>(
"version");
160 const unsigned nGain =
m_isSC ? 1 : 3;
163 (*attrList)[
"version"].setValue(0U);
168 float* pblobPed=
static_cast<float*
>(blobPed.startingAddress());
169 float* pblobRMS=
static_cast<float*
>(blobRMS.startingAddress());
174 float pedRMS=
input->pedestalRMS(chid,
gain);
186 pedRMS=
input->pedestalRMS(chid,1);
194 collPed->add(
gain,*attrList);
195 ATH_MSG_INFO(
"Number of channels filled with default Pedestal (1000) and PedestalRMS (1) "<< nDefault <<
" (including disconnected)" );
199 if (
sc.isFailure()) {
205 ATH_MSG_INFO(
"\t Number of low gain EMBPS channels copied from medium gain" << nCopiedEMPS );
215 unsigned nCopiedEMPS=0;
218 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
219 spec->extend(
"OFCa",
"blob");
220 spec->extend(
"OFCb",
"blob");
221 spec->extend(
"TimeOffset",
"blob");
222 spec->extend<
unsigned>(
"nSamples");
223 spec->extend<
unsigned>(
"version");
226 const unsigned nGain =
m_isSC ? 1 : 3;
249 (*attrList)[
"version"].setValue(0U);
254 (*attrList)[
"nSamples"].setValue(
nSamples);
259 float* pOfca=
static_cast<float*
>(ofcaBlob.startingAddress());
260 float* pOfcb=
static_cast<float*
>(ofcbBlob.startingAddress());
261 float* pTimeOffset=
static_cast<float*
>(toBlob.startingAddress());
266 float timeOffset=
input->timeOffset(chid,
gain);
270 timeOffset=
input->timeOffset(chid,1);
281 message <<
"Number of samples don't match. Expect " <<
nSamples <<
", got " << ofca.size() <<
".";
305 message <<
"Number of samples don't match. Expect " <<
nSamples <<
", got " << ofcb.size() <<
".";
311 pTimeOffset[
hs]=timeOffset;
315 collOFC->add(
gain,*attrList);
319 if (
sc.isFailure()) {
325 ATH_MSG_INFO(
"Number of channels filled with default OFCs {1,1,1,1} " << nDefault <<
" (including disconnected)" );
327 ATH_MSG_INFO(
"\t Number of low gain EMBPS channels copied from medium gain" << nCopiedEMPS );
337 unsigned nCopiedEMPS=0;
340 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
341 spec->extend(
"Shape",
"blob");
342 spec->extend(
"ShapeDer",
"blob");
343 spec->extend(
"TimeOffset",
"blob");
344 spec->extend<
unsigned>(
"nSamples");
345 spec->extend<
unsigned>(
"version");
348 const unsigned nGain =
m_isSC ? 1 : 3;
365 (*attrList)[
"version"].setValue(0U);
370 (*attrList)[
"nSamples"].setValue(
nSamples);
375 float* pShape=
static_cast<float*
>(shapeBlob.startingAddress());
376 float* pShapeDer=
static_cast<float*
>(shapeDerBlob.startingAddress());
377 float* pTimeOffset=
static_cast<float*
>(toBlob.startingAddress());
383 float timeOffset=
input->timeOffset(chid,
gain);
385 shape=
input->Shape(chid,1);
386 shapeDer=
input->ShapeDer(chid,1);
387 timeOffset=
input->timeOffset(chid,1);
398 message <<
"Number of samples don't match. Expect " <<
nSamples <<
", got " << shape.size() <<
".";
414 message <<
"Number of samples don't match. Expect " <<
nSamples <<
", got " << shapeDer.size() <<
".";
420 pTimeOffset[
hs]=timeOffset;
424 coll->add(
gain,*attrList);
428 if (
sc.isFailure()) {
434 ATH_MSG_INFO(
"Number of channels filled with default shape {0,0,0,0} " << nDefault <<
" (including disconnected)" );
436 ATH_MSG_INFO(
"\t Number of low gain EMBPS channels copied from medium gain" << nCopiedEMPS );
448 unsigned nCopiedEMPS=0;
451 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
452 spec->extend(
"RampVec",
"blob");
453 spec->extend<
unsigned>(
"nPoints");
454 spec->extend<
unsigned>(
"version");
457 std::vector<float> defaultRamp={0.0,1.0};
472 const unsigned nGain =
m_isSC ? 1 : 3;
486 defaultRamp.resize(nPoints,0.0);
487 ATH_MSG_INFO(
"Gain " <<
gain <<
": Found a ramp polynom of degree " << nPoints <<
" in input data" );
489 (*attrList)[
"version"].setValue(0U);
491 (*attrList)[
"nPoints"].setValue(nPoints);
492 blobRamp.resize(
m_hashMax*
sizeof(
float)*nPoints);
493 float* pblobRamp=
static_cast<float*
>(blobRamp.startingAddress());
497 std::vector<float> rampVec(
input->ADC2DAC(chid,
gain).asVector());
498 if(rampVec.size()>=2 && rampVec[1]>500) {
503 rampVec=
input->ADC2DAC(chid,1).asVector();
504 if(rampVec.empty()) {
519 if (rampVec.size()>=nPoints) {
520 for (
size_t i=0;
i<nPoints;++
i) {
521 pblobRamp[nPoints*
hs+
i]=rampVec[
i];
526 message <<
"Polynom degree doesn't match. Expect " << nPoints <<
", got " << rampVec.size() <<
".";
528 for (
size_t i=0;
i<nPoints;++
i) {
529 pblobRamp[nPoints*
hs+
i]=defaultRamp[
i];
535 coll->add(
gain,*attrList);
539 if (
sc.isFailure()) {
545 ATH_MSG_INFO(
"Number of channels filled with default ramp {0,1} " << nDefault <<
" (including disconnected)" );
547 ATH_MSG_INFO(
"\t Number of low gain EMBPS channels copied from medium gain (applied factor 10)" << nCopiedEMPS );
555 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
556 spec->extend(
"DAC2uA",
"blob");
557 spec->extend<
unsigned>(
"version");
560 (*attrList)[
"version"].setValue(0U);
563 float* pblob=
static_cast<float*
>(
blob.startingAddress());
568 coll->add(1,*attrList);
571 if (
sc.isFailure()) {
580 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
581 spec->extend(
"uA2MeV",
"blob");
582 spec->extend<
unsigned>(
"version");
585 (*attrList)[
"version"].setValue(0U);
588 float* pblob=
static_cast<float*
>(
blob.startingAddress());
593 coll->add(1,*attrList);
596 if (
sc.isFailure()) {
605 coral::AttributeListSpecification*
spec =
new coral::AttributeListSpecification();
606 spec->extend(
"tQThr",
"blob");
607 spec->extend(
"samplesThr",
"blob");
608 spec->extend(
"trigSumThr",
"blob");
610 spec->extend(
"Name",
"string");
620 SamplesBlob.resize(
m_hashMax*
sizeof(
float));
621 TrigBlob.resize(
m_hashMax*
sizeof(
float));
622 float* ptQThr=
static_cast<float*
>(QBlob.startingAddress());
623 float* pSamplesThr=
static_cast<float*
>(SamplesBlob.startingAddress());
624 float* pTrigThr=
static_cast<float*
>(TrigBlob.startingAddress());
629 ptQThr[
hs] =
input->tQThr(chid);
630 pSamplesThr[
hs] =
input->samplesThr(chid);
631 pTrigThr[
hs] =
input->trigSumThr(chid);
639 if (
sc.isFailure()) {
650 std::string flatName =
"/LAR/ElecCalibFlat";
656 if (
sc.isFailure()) {
658 return StatusCode::FAILURE;
667 if (
sc.isFailure()) {
669 return StatusCode::FAILURE;
683 if (
sc.isFailure()) {
691 uA2MeVFlat(uA2MeVComplete, flatName+
"/uA2MeV");
699 if (
sc.isFailure()) {
707 DAC2uAFlat(DAC2uAComplete, flatName+
"/DAC2uA");
714 if (
sc.isFailure()) {
722 const int nGain =
m_isSC ? 1 : 3;
723 const bool wfcal =
m_isSC ? true :
false;
732 if (
sc.isFailure()) {
740 singleFloatFlat(
"HVScaleCorr", HVScaleCorrComplete, flatName+
"/HVScaleCorr",1);
747 if (
sc.isFailure()) {
780 if (
sc.isFailure()) {
791 weightsComplete=*wHdl;
792 if(!weightsComplete) {
796 ofcFlat(ofcComplete,flatName+
"/OFC",weightsComplete);
802 if (
sc.isFailure()) {
804 ATH_MSG_ERROR(
"Failed to get LArOFCComplete object (cali)" );
810 ofcFlat(ofcComplete,flatName+
"/OFCCali");
818 if (
sc.isFailure()) {
826 shapeFlat(shapeComplete,flatName+
"/Shape");
850 if (
sc.isFailure()) {
858 rampFlat(rampComplete,flatName+
"/Ramp");
866 if (
sc.isFailure()) {
868 ATH_MSG_ERROR(
"Failed to get LArDSPThresholdsComplete object" );
891 return StatusCode::SUCCESS;
913 if (
cabling->isOnlineConnected(chid)) {