34 const std::string& outputName,
const unsigned nGain) {
37 unsigned nCopiedEMPS=0;
40 coral::AttributeListSpecification* spec =
new coral::AttributeListSpecification();
41 spec->extend(blobName,
"blob");
42 spec->extend<
unsigned>(
"version");
43 std::unique_ptr<CondAttrListCollection> coll= std::make_unique<CondAttrListCollection>(
true);
45 std::ifstream myfile(input);
47 std::vector< std::vector<float> > values(nGain, std::vector<float>(
m_hashMax,1.0f));
51 while (std::getline(myfile, line)) {
52 std::stringstream st(line);
54 st>>std::dec>>
id>>std::dec>>value;
57 st>>std::hex>>
id>>std::dec>>hash>>value;
69 else if (hash >=
static_cast<int>(nGain)) {
77 values[hash][
m_onlineID->channel_Hash(chid)]=value;
80 for (
unsigned gain=0;gain<nGain;++gain) {
81 auto attrList = std::make_unique<coral::AttributeList>(*spec);
82 (*attrList)[
"version"].setValue(0U);
83 coral::Blob& blob=(*attrList)[blobName].data<coral::Blob>();
85 float* pblob=
static_cast<float*
>(blob.startingAddress());
87 pblob[hs]=values[gain][hs];
90 unsigned coolChan=gain;
92 coll->add(coolChan,*attrList.release());
95 ATH_MSG_INFO(
"Converted " << blobName <<
" to inline storage. Total number of channels=" << nChannels );
96 ATH_MSG_INFO(
"Number of channels filled with default value (1.0) " << nDefault <<
" (including disconnected)" );
98 ATH_MSG_INFO(
"\t Number of low gain EMBPS channels copied from medium gain" << nCopiedEMPS );
99 StatusCode
sc=
detStore()->record(std::move(coll),outputName);
100 if (
sc.isFailure()) {
101 ATH_MSG_ERROR(
"Failed to record CondAttrListCollection with key" << outputName );
112 std::vector<std::vector<std::vector<float> > > vofc_a;
113 std::vector<std::vector<std::vector<float> > > vofc_b;
116 for (
unsigned i=0; i<
m_ngain; ++i) {
121 std::ifstream myfile(input);
124 std::string line, line1;
125 unsigned long id, id1;
126 unsigned hash, hash1;
127 char mychar, mychar1;
128 while (std::getline(myfile, line),std::getline(myfile, line1)) {
129 std::stringstream st(line);
130 st>>std::hex>>
id>>std::dec>>hash;
131 std::stringstream st1(line1);
132 st>>std::hex>>id1>>std::dec>>hash1;
134 if(
id != id1 || hash != hash1) {
135 ATH_MSG_ERROR(
"Different input id or hash: "<<line<<
" "<<line1);
141 if(mychar !=
'a' || mychar1 !=
'b') {
149 unsigned nChannels=0;
152 coral::AttributeListSpecification* spec =
new coral::AttributeListSpecification();
153 spec->extend(
"OFCa",
"blob");
154 spec->extend(
"OFCb",
"blob");
155 spec->extend(
"TimeOffset",
"blob");
156 spec->extend<
unsigned>(
"nSamples");
157 spec->extend<
unsigned>(
"version");
158 auto collOFC = std::make_unique<CondAttrListCollection>(
true);
162 for (
unsigned gain=0;gain<
m_ngain;++gain) {
164 auto attrList = std::make_unique<coral::AttributeList>(*spec);
165 (*attrList)[
"version"].setValue(0U);
166 coral::Blob& ofcaBlob=(*attrList)[
"OFCa"].data<coral::Blob>();
167 coral::Blob& ofcbBlob=(*attrList)[
"OFCb"].data<coral::Blob>();
168 coral::Blob& toBlob=(*attrList)[
"TimeOffset"].data<coral::Blob>();
170 (*attrList)[
"nSamples"].setValue(
m_nsample);
175 float* pOfca=
static_cast<float*
>(ofcaBlob.startingAddress());
176 float* pOfcb=
static_cast<float*
>(ofcbBlob.startingAddress());
177 float* pTimeOffset=
static_cast<float*
>(toBlob.startingAddress());
189 std::stringstream message;
190 message <<
"Number of samples don't match. Expect " <<
m_nsample <<
", got " << ofca.size() <<
".";
204 std::stringstream message;
205 message <<
"Number of samples don't match. Expect " <<
m_nsample <<
", got " << ofcb.size() <<
".";
211 pTimeOffset[hs]=timeOffset;
215 collOFC->add(gain,*(attrList.release()));
218 StatusCode
sc=
detStore()->record(std::move(collOFC),outputName);
219 if (
sc.isFailure()) {
220 ATH_MSG_ERROR(
"Failed to record CondAttrListCollection OFC with key " << outputName );
224 ATH_MSG_INFO(
"Converted OFCs to inline storage. Total number of channels=" << nChannels );
225 ATH_MSG_INFO(
"Number of channels filled with default OFCs {1,1,1,1} " << nDefault <<
" (including disconnected)" );
248 myfile.unsetf(std::ios_base::skipws);
251 unsigned line_count = std::count( std::istream_iterator<char>(myfile),
252 std::istream_iterator<char>(),
'\n');
256 return StatusCode::FAILURE;
269 myfile.unsetf(std::ios_base::skipws);
272 unsigned line_count = std::count( std::istream_iterator<char>(myfile),
273 std::istream_iterator<char>(),
'\n');
278 return StatusCode::FAILURE;
284 return StatusCode::SUCCESS;