16 #include "CoralBase/Attribute.h"
19 #include "Identifier/Identifier.h"
26 #include "GaudiKernel/StatusCode.h"
27 #include "GaudiKernel/IToolSvc.h"
47 m_regSvc(
"IOVRegistrationSvc",
name),
48 m_streamer(((m_version == 0) ?
"AthenaOutputStreamTool" :
"AthenaPoolOutputStreamTool"), this),
49 m_IOVDbSvc(
"IOVDbSvc",
name)
84 return StatusCode::SUCCESS;
91 unsigned int iiside{
static_cast<unsigned int>(
m_pHelper->
side(elementId))};
92 unsigned int iistrip{
static_cast<unsigned int>(
m_pHelper->
strip(elementId))};
93 return 768*iiside + iistrip;
106 if (defectlist.empty())
return createDefectString(defectBeginChannel, defectEndChannel);
109 std::ostringstream
defect;
110 defect << defectlist <<
" " << defectBeginChannel;
111 if (defectBeginChannel==defectEndChannel) {
114 defect <<
"-" << defectEndChannel <<
" ";
123 std::ostringstream
defect;
124 defect <<
" " << defectBeginChannel;
125 if (defectBeginChannel!=defectEndChannel) {
126 defect <<
"-" << defectEndChannel;
137 std::ostringstream num_string;
139 if (numStr.empty()) {
142 num_string << numStr <<
" " <<
number;
144 return num_string.str();
151 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const std::string& defectType,
const float threshold,
const std::string& defectList)
const {
152 if (!m_writeCondObjs) {
153 return StatusCode::SUCCESS;
155 coral::AttributeListSpecification* attrSpec{createBasicDbSpec(
becCapsFormat)};
156 attrSpec->extend(
"DefectType",
"string");
157 attrSpec->extend(
"Threshold",
"float");
158 attrSpec->extend(
"DefectList",
"string");
160 if (!attrSpec->size()) {
162 return StatusCode::FAILURE;
166 setBasicValues(attrList0, wafer_id, samplesize,sctId,
becCapsFormat);
167 attrList0[
"DefectType"].setValue(
static_cast<std::string
>(defectType));
168 attrList0[
"Threshold"].setValue(
static_cast<float>(
threshold));
169 attrList0[
"DefectList"].setValue(
static_cast<std::string
>(defectList));
170 std::ostringstream attrStr2;
171 attrList0.toOutputStream(attrStr2);
172 m_attrListColl->add(wafer_id.get_identifier32().get_compact(), attrList0);
173 return StatusCode::SUCCESS;
182 const int samplesize,
183 const std::string& defectType,
185 const std::string& defectList)
const
187 if (!m_writeCondObjs) {
188 return StatusCode::SUCCESS;
190 coral::AttributeListSpecification* attrSpec{createBasicDbSpec(
becCapsFormat)};
191 attrSpec->extend(
"DefectType",
"string");
192 attrSpec->extend(
"Threshold",
"float");
193 attrSpec->extend(
"DefectList",
"string");
195 if (!attrSpec->size()) {
197 return StatusCode::FAILURE;
201 setBasicValues(attrList0, wafer_id, samplesize, sctId,
becCapsFormat);
202 attrList0[
"DefectType"].setValue(
static_cast<std::string
>(defectType));
203 attrList0[
"Threshold"].setValue(
static_cast<float>(
threshold));
204 attrList0[
"DefectList"].setValue(
static_cast<std::string
>(defectList));
206 std::ostringstream attrStr2;
207 attrList0.toOutputStream(attrStr2);
208 m_attrListColl_deadStrip->add(wafer_id.get_identifier32().get_compact(), attrList0);
209 return StatusCode::SUCCESS;
216 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const std::string& defectType,
const float threshold,
const std::string& defectList)
const {
217 if (!m_writeCondObjs) {
218 return StatusCode::SUCCESS;
220 coral::AttributeListSpecification* attrSpec{createBasicDbSpec(
becCapsFormat)};
221 attrSpec->extend(
"DefectType",
"string");
222 attrSpec->extend(
"Threshold",
"float");
223 attrSpec->extend(
"DefectList",
"string");
224 if (!attrSpec->size()) {
226 return StatusCode::FAILURE;
230 setBasicValues(attrList0, wafer_id, samplesize, sctId,
becCapsFormat);
231 attrList0[
"DefectType"].setValue(
static_cast<std::string
>(defectType));
232 attrList0[
"Threshold"].setValue(
static_cast<float>(
threshold));
233 attrList0[
"DefectList"].setValue(
static_cast<std::string
>(defectList));
235 std::ostringstream attrStr2;
236 attrList0.toOutputStream(attrStr2);
237 m_attrListColl_deadChip->add(wafer_id.get_identifier32().get_compact(), attrList0);
239 return StatusCode::SUCCESS;
246 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const float eff)
const {
247 if (!m_writeCondObjs) {
248 return StatusCode::SUCCESS;
252 attrSpec->extend(
"Efficiency",
"float");
253 if (!attrSpec->size()) {
255 return StatusCode::FAILURE;
260 attrList0[
"Efficiency"].setValue(
static_cast<float>(
eff));
262 std::ostringstream attrStr2;
263 attrList0.toOutputStream(attrStr2);
264 m_attrListColl_eff->add(wafer_id.get_identifier32().get_compact(), attrList0);
266 return StatusCode::SUCCESS;
273 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const float noise_occ)
const {
274 if (!m_writeCondObjs) {
275 return StatusCode::SUCCESS;
279 attrSpec->extend(
"NoiseOccupancy",
"float");
280 if (!attrSpec->size()) {
282 return StatusCode::FAILURE;
287 attrList0[
"NoiseOccupancy"].setValue(
static_cast<float>(noise_occ));
289 std::ostringstream attrStr2;
290 attrList0.toOutputStream(attrStr2);
291 m_attrListColl_no->add(wafer_id.get_identifier32().get_compact(), attrList0);
293 return StatusCode::SUCCESS;
300 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const float raw_occu)
const {
301 if (!m_writeCondObjs) {
302 return StatusCode::SUCCESS;
306 attrSpec->extend(
"RawOccupancy",
"float");
307 if (!attrSpec->size()) {
309 return StatusCode::FAILURE;
314 attrList0[
"RawOccupancy"].setValue(
static_cast<float>(raw_occu));
316 std::ostringstream attrStr2;
317 attrList0.toOutputStream(attrStr2);
318 m_attrListColl_RawOccu->add(wafer_id.get_identifier32().get_compact(), attrList0);
319 return StatusCode::SUCCESS;
326 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const std::string& errorList,
const std::string& probList)
const {
327 if (!m_writeCondObjs) {
328 return StatusCode::SUCCESS;
332 attrSpec->extend(
"BSErrors",
"string");
333 attrSpec->extend(
"BadFraction",
"string");
335 if (!attrSpec->size()) {
337 return StatusCode::FAILURE;
342 attrList0[
"BSErrors"].setValue(
static_cast<std::string
>(errorList));
343 attrList0[
"BadFraction"].setValue(
static_cast<std::string
>(probList));
345 std::ostringstream attrStr2;
346 attrList0.toOutputStream(attrStr2);
347 m_attrListColl_BSErr->add(wafer_id.get_identifier32().get_compact(), attrList0);
348 return StatusCode::SUCCESS;
355 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
int module,
const float lorentz,
const float err_lorentz,
const float chisq,
const float fitParam_a,
const float err_a,
const float fitParam_b,
const float err_b,
const float fitParam_sigma,
const float err_sigma,
const float MCW,
const float err_MCW)
const {
356 if (!m_writeCondObjs)
return StatusCode::SUCCESS;
357 int barrel_ec{sctId->barrel_ec(wafer_id)};
358 int layer{sctId->layer_disk(wafer_id)};
359 int side{sctId->side(wafer_id)};
361 coral::AttributeListSpecification* attrSpec{
new coral::AttributeListSpecification{}};
362 attrSpec->extend(
"SampleSize",
"int");
363 attrSpec->extend(
"barrel_endcap",
"int");
364 attrSpec->extend(
"Layer",
"int");
365 attrSpec->extend(
"Side",
"int");
366 attrSpec->extend(
"moduleType",
"int");
367 attrSpec->extend(
"lorentzAngle",
"float");
368 attrSpec->extend(
"err_lorentzAngle",
"float");
369 attrSpec->extend(
"chisq",
"float");
370 attrSpec->extend(
"fitParam_a",
"float");
371 attrSpec->extend(
"err_a",
"float");
372 attrSpec->extend(
"fitParam_b",
"float");
373 attrSpec->extend(
"err_b",
"float");
374 attrSpec->extend(
"fitParam_sigma",
"float");
375 attrSpec->extend(
"err_sigma",
"float");
376 attrSpec->extend(
"minClusterWidth",
"float");
377 attrSpec->extend(
"err_minClusterWidth",
"float");
379 if (!attrSpec->size()) {
381 return StatusCode::FAILURE;
386 attrList0[
"SampleSize"].setValue(
static_cast<int>(samplesize));
387 attrList0[
"barrel_endcap"].setValue(
static_cast<int>(barrel_ec));
388 attrList0[
"Layer"].setValue(
static_cast<int>(
layer));
389 attrList0[
"Side"].setValue(
static_cast<int>(
side));
390 attrList0[
"moduleType"].setValue(
static_cast<int>(
module));
391 attrList0[
"lorentzAngle"].setValue(
static_cast<float>(lorentz));
392 attrList0[
"err_lorentzAngle"].setValue(
static_cast<float>(err_lorentz));
393 attrList0[
"chisq"].setValue(
static_cast<float>(chisq));
394 attrList0[
"fitParam_a"].setValue(
static_cast<float>(fitParam_a));
395 attrList0[
"err_a"].setValue(
static_cast<float>(err_a));
396 attrList0[
"fitParam_b"].setValue(
static_cast<float>(fitParam_b));
397 attrList0[
"err_b"].setValue(
static_cast<float>(err_b));
398 attrList0[
"fitParam_sigma"].setValue(
static_cast<float>(fitParam_sigma));
399 attrList0[
"err_sigma"].setValue(
static_cast<float>(err_sigma));
400 attrList0[
"minClusterWidth"].setValue(
static_cast<float>(MCW));
401 attrList0[
"err_minClusterWidth"].setValue(
static_cast<float>(err_MCW));
403 std::ostringstream attrStr2;
404 attrList0.toOutputStream(attrStr2);
405 m_attrListColl_LA->add(wafer_id.get_identifier32().get_compact(), attrList0);
407 return StatusCode::SUCCESS;
418 if (m_attrListCollectionMap.count(
foldername) == 0) {
423 m_attrListCollectionMap.insert(make_pair(
foldername, attrListCollection));
425 attrListCollection = m_attrListCollectionMap[
foldername];
427 return attrListCollection;
434 return atoi(
s.c_str());
443 return StatusCode::SUCCESS;
452 return StatusCode::SUCCESS;
461 return StatusCode::SUCCESS;
470 return StatusCode::SUCCESS;
479 return StatusCode::SUCCESS;
488 return StatusCode::SUCCESS;
497 return StatusCode::SUCCESS;
506 return StatusCode::SUCCESS;
516 return( StatusCode::FAILURE);
521 typeKeys[0] = attrCollPair;
524 if (
m_streamer->streamObjects(typeKeys).isFailure()) {
526 return StatusCode::FAILURE;
531 return StatusCode::FAILURE;
533 return StatusCode::SUCCESS;
543 return StatusCode::FAILURE;
545 return StatusCode::SUCCESS;
560 unsigned int beginRun;
564 const EventContext& ctx = Gaudi::Hive::currentContext();
565 beginRun = ctx.eventID().run_number();
577 ATH_MSG_DEBUG(
"registerCondObjects: registerCondObjects middle");
580 ATH_MSG_DEBUG(
"registerCondObjects: registerCondObjects before registerIOV 1");
581 ATH_MSG_DEBUG(
"registerCondObjects: foldername, tagname, beginRun, endRun, beginLB, endLB: " <<
foldername <<
", " <<
tagname <<
", " << beginRun <<
", " << endRun <<
", " << beginLB <<
", " << endLB);
586 ATH_MSG_DEBUG(
"registerCondObjects: foldername, beginRun, endRun, beginLB, endLB: " <<
foldername <<
", " << beginRun <<
", " << endRun <<
", " << beginLB <<
", " << endLB);
587 sc =
m_regSvc->registerIOV(
"CondAttrListCollection",
foldername,
"", beginRun, endRun, beginLB, endLB);
590 if (
sc.isFailure()) {
591 ATH_MSG_ERROR(
"registerCondObjects: Could not register in IOV DB for CondAttrListCollection");
592 return StatusCode::FAILURE;
599 return StatusCode::SUCCESS;
609 return StatusCode::FAILURE;
612 return StatusCode::SUCCESS;
623 return StatusCode::FAILURE;
628 return StatusCode::SUCCESS;
633 coral::AttributeListSpecification*
635 coral::AttributeListSpecification* attrSpec{
new coral::AttributeListSpecification{}};
636 const std::string becName{capsFormat?
"BarrelEndcap":
"barrel_endcap"};
637 attrSpec->extend(
"SampleSize",
"int");
638 attrSpec->extend(becName,
"int");
639 attrSpec->extend(
"Layer",
"int");
640 attrSpec->extend(
"Eta",
"int");
641 attrSpec->extend(
"Phi",
"int");
651 int barrel_ec{sctId->
barrel_ec(wafer_id)};
654 const std::string becName{capsFormat?
"BarrelEndcap":
"barrel_endcap"};
655 attrList[
"SampleSize"].setValue(
static_cast<int>(samplesize));
656 attrList[becName].setValue(
static_cast<int>(barrel_ec));
657 attrList[
"Layer"].setValue(
static_cast<int>(
layer));
658 attrList[
"Eta"].setValue(
static_cast<int>(
eta));
659 attrList[
"Phi"].setValue(
static_cast<int>(
phi));