16 #include "CoralBase/Attribute.h"
19 #include "Identifier/Identifier.h"
26 #include "GaudiKernel/StatusCode.h"
27 #include "GaudiKernel/IToolSvc.h"
52 m_regSvc(
"IOVRegistrationSvc",
name),
53 m_streamer(((m_version == 0) ?
"AthenaOutputStreamTool" :
"AthenaPoolOutputStreamTool"), this),
54 m_IOVDbSvc(
"IOVDbSvc",
name)
72 return AthAlgTool::queryInterface(riid, ppvIF);
74 return StatusCode::SUCCESS;
108 return StatusCode::SUCCESS;
117 return StatusCode::FAILURE;
120 return StatusCode::FAILURE;
123 return StatusCode::SUCCESS;
130 unsigned int iiside{
static_cast<unsigned int>(
m_pHelper->
side(elementId))};
131 unsigned int iistrip{
static_cast<unsigned int>(
m_pHelper->
strip(elementId))};
132 return 768*iiside + iistrip;
145 if (defectlist.empty())
return createDefectString(defectBeginChannel, defectEndChannel);
148 std::ostringstream
defect;
149 defect << defectlist <<
" " << defectBeginChannel;
150 if (defectBeginChannel==defectEndChannel) {
153 defect <<
"-" << defectEndChannel <<
" ";
162 std::ostringstream
defect;
163 defect <<
" " << defectBeginChannel;
164 if (defectBeginChannel!=defectEndChannel) {
165 defect <<
"-" << defectEndChannel;
176 std::ostringstream num_string;
178 if (numStr.empty()) {
181 num_string << numStr <<
" " <<
number;
183 return num_string.str();
190 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const std::string& defectType,
const float threshold,
const std::string& defectList)
const {
191 if (!m_writeCondObjs) {
192 return StatusCode::SUCCESS;
194 coral::AttributeListSpecification* attrSpec{createBasicDbSpec(
becCapsFormat)};
195 attrSpec->extend(
"DefectType",
"string");
196 attrSpec->extend(
"Threshold",
"float");
197 attrSpec->extend(
"DefectList",
"string");
199 if (!attrSpec->size()) {
201 return StatusCode::FAILURE;
205 setBasicValues(attrList0, wafer_id, samplesize,sctId,
becCapsFormat);
206 attrList0[
"DefectType"].setValue(
static_cast<std::string
>(defectType));
207 attrList0[
"Threshold"].setValue(
static_cast<float>(
threshold));
208 attrList0[
"DefectList"].setValue(
static_cast<std::string
>(defectList));
209 std::ostringstream attrStr2;
210 attrList0.toOutputStream(attrStr2);
211 m_attrListColl->add(wafer_id.get_identifier32().get_compact(), attrList0);
212 return StatusCode::SUCCESS;
221 const int samplesize,
222 const std::string& defectType,
224 const std::string& defectList)
const
226 if (!m_writeCondObjs) {
227 return StatusCode::SUCCESS;
229 coral::AttributeListSpecification* attrSpec{createBasicDbSpec(
becCapsFormat)};
230 attrSpec->extend(
"DefectType",
"string");
231 attrSpec->extend(
"Threshold",
"float");
232 attrSpec->extend(
"DefectList",
"string");
234 if (!attrSpec->size()) {
236 return StatusCode::FAILURE;
240 setBasicValues(attrList0, wafer_id, samplesize, sctId,
becCapsFormat);
241 attrList0[
"DefectType"].setValue(
static_cast<std::string
>(defectType));
242 attrList0[
"Threshold"].setValue(
static_cast<float>(
threshold));
243 attrList0[
"DefectList"].setValue(
static_cast<std::string
>(defectList));
245 std::ostringstream attrStr2;
246 attrList0.toOutputStream(attrStr2);
247 m_attrListColl_deadStrip->add(wafer_id.get_identifier32().get_compact(), attrList0);
248 return StatusCode::SUCCESS;
255 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const std::string& defectType,
const float threshold,
const std::string& defectList)
const {
256 if (!m_writeCondObjs) {
257 return StatusCode::SUCCESS;
259 coral::AttributeListSpecification* attrSpec{createBasicDbSpec(
becCapsFormat)};
260 attrSpec->extend(
"DefectType",
"string");
261 attrSpec->extend(
"Threshold",
"float");
262 attrSpec->extend(
"DefectList",
"string");
263 if (!attrSpec->size()) {
265 return StatusCode::FAILURE;
269 setBasicValues(attrList0, wafer_id, samplesize, sctId,
becCapsFormat);
270 attrList0[
"DefectType"].setValue(
static_cast<std::string
>(defectType));
271 attrList0[
"Threshold"].setValue(
static_cast<float>(
threshold));
272 attrList0[
"DefectList"].setValue(
static_cast<std::string
>(defectList));
274 std::ostringstream attrStr2;
275 attrList0.toOutputStream(attrStr2);
276 m_attrListColl_deadChip->add(wafer_id.get_identifier32().get_compact(), attrList0);
278 return StatusCode::SUCCESS;
285 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const float eff)
const {
286 if (!m_writeCondObjs) {
287 return StatusCode::SUCCESS;
291 attrSpec->extend(
"Efficiency",
"float");
292 if (!attrSpec->size()) {
294 return StatusCode::FAILURE;
299 attrList0[
"Efficiency"].setValue(
static_cast<float>(
eff));
301 std::ostringstream attrStr2;
302 attrList0.toOutputStream(attrStr2);
303 m_attrListColl_eff->add(wafer_id.get_identifier32().get_compact(), attrList0);
305 return StatusCode::SUCCESS;
312 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const float noise_occ)
const {
313 if (!m_writeCondObjs) {
314 return StatusCode::SUCCESS;
318 attrSpec->extend(
"NoiseOccupancy",
"float");
319 if (!attrSpec->size()) {
321 return StatusCode::FAILURE;
326 attrList0[
"NoiseOccupancy"].setValue(
static_cast<float>(noise_occ));
328 std::ostringstream attrStr2;
329 attrList0.toOutputStream(attrStr2);
330 m_attrListColl_no->add(wafer_id.get_identifier32().get_compact(), attrList0);
332 return StatusCode::SUCCESS;
339 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const float raw_occu)
const {
340 if (!m_writeCondObjs) {
341 return StatusCode::SUCCESS;
345 attrSpec->extend(
"RawOccupancy",
"float");
346 if (!attrSpec->size()) {
348 return StatusCode::FAILURE;
353 attrList0[
"RawOccupancy"].setValue(
static_cast<float>(raw_occu));
355 std::ostringstream attrStr2;
356 attrList0.toOutputStream(attrStr2);
357 m_attrListColl_RawOccu->add(wafer_id.get_identifier32().get_compact(), attrList0);
358 return StatusCode::SUCCESS;
365 (
const Identifier& wafer_id,
const SCT_ID* sctId,
const int samplesize,
const std::string& errorList,
const std::string& probList)
const {
366 if (!m_writeCondObjs) {
367 return StatusCode::SUCCESS;
371 attrSpec->extend(
"BSErrors",
"string");
372 attrSpec->extend(
"BadFraction",
"string");
374 if (!attrSpec->size()) {
376 return StatusCode::FAILURE;
381 attrList0[
"BSErrors"].setValue(
static_cast<std::string
>(errorList));
382 attrList0[
"BadFraction"].setValue(
static_cast<std::string
>(probList));
384 std::ostringstream attrStr2;
385 attrList0.toOutputStream(attrStr2);
386 m_attrListColl_BSErr->add(wafer_id.get_identifier32().get_compact(), attrList0);
387 return StatusCode::SUCCESS;
394 (
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 {
395 if (!m_writeCondObjs)
return StatusCode::SUCCESS;
396 int barrel_ec{sctId->barrel_ec(wafer_id)};
397 int layer{sctId->layer_disk(wafer_id)};
398 int side{sctId->side(wafer_id)};
400 coral::AttributeListSpecification* attrSpec{
new coral::AttributeListSpecification{}};
401 attrSpec->extend(
"SampleSize",
"int");
402 attrSpec->extend(
"barrel_endcap",
"int");
403 attrSpec->extend(
"Layer",
"int");
404 attrSpec->extend(
"Side",
"int");
405 attrSpec->extend(
"moduleType",
"int");
406 attrSpec->extend(
"lorentzAngle",
"float");
407 attrSpec->extend(
"err_lorentzAngle",
"float");
408 attrSpec->extend(
"chisq",
"float");
409 attrSpec->extend(
"fitParam_a",
"float");
410 attrSpec->extend(
"err_a",
"float");
411 attrSpec->extend(
"fitParam_b",
"float");
412 attrSpec->extend(
"err_b",
"float");
413 attrSpec->extend(
"fitParam_sigma",
"float");
414 attrSpec->extend(
"err_sigma",
"float");
415 attrSpec->extend(
"minClusterWidth",
"float");
416 attrSpec->extend(
"err_minClusterWidth",
"float");
418 if (!attrSpec->size()) {
420 return StatusCode::FAILURE;
425 attrList0[
"SampleSize"].setValue(
static_cast<int>(samplesize));
426 attrList0[
"barrel_endcap"].setValue(
static_cast<int>(barrel_ec));
427 attrList0[
"Layer"].setValue(
static_cast<int>(
layer));
428 attrList0[
"Side"].setValue(
static_cast<int>(
side));
429 attrList0[
"moduleType"].setValue(
static_cast<int>(
module));
430 attrList0[
"lorentzAngle"].setValue(
static_cast<float>(lorentz));
431 attrList0[
"err_lorentzAngle"].setValue(
static_cast<float>(err_lorentz));
432 attrList0[
"chisq"].setValue(
static_cast<float>(chisq));
433 attrList0[
"fitParam_a"].setValue(
static_cast<float>(fitParam_a));
434 attrList0[
"err_a"].setValue(
static_cast<float>(err_a));
435 attrList0[
"fitParam_b"].setValue(
static_cast<float>(fitParam_b));
436 attrList0[
"err_b"].setValue(
static_cast<float>(err_b));
437 attrList0[
"fitParam_sigma"].setValue(
static_cast<float>(fitParam_sigma));
438 attrList0[
"err_sigma"].setValue(
static_cast<float>(err_sigma));
439 attrList0[
"minClusterWidth"].setValue(
static_cast<float>(MCW));
440 attrList0[
"err_minClusterWidth"].setValue(
static_cast<float>(err_MCW));
442 std::ostringstream attrStr2;
443 attrList0.toOutputStream(attrStr2);
444 m_attrListColl_LA->add(wafer_id.get_identifier32().get_compact(), attrList0);
446 return StatusCode::SUCCESS;
453 std::lock_guard<std::mutex> lock{
m_mutex};
457 if (m_attrListCollectionMap.count(
foldername) == 0) {
462 m_attrListCollectionMap.insert(make_pair(
foldername, attrListCollection));
464 attrListCollection = m_attrListCollectionMap[
foldername];
466 return attrListCollection;
473 return atoi(
s.c_str());
482 return StatusCode::SUCCESS;
491 return StatusCode::SUCCESS;
500 return StatusCode::SUCCESS;
509 return StatusCode::SUCCESS;
518 return StatusCode::SUCCESS;
527 return StatusCode::SUCCESS;
536 return StatusCode::SUCCESS;
545 return StatusCode::SUCCESS;
555 return( StatusCode::FAILURE);
560 typeKeys[0] = attrCollPair;
563 if (
m_streamer->streamObjects(typeKeys).isFailure()) {
565 return StatusCode::FAILURE;
570 return StatusCode::FAILURE;
572 return StatusCode::SUCCESS;
582 return StatusCode::FAILURE;
584 return StatusCode::SUCCESS;
599 unsigned int beginRun;
603 const EventContext& ctx = Gaudi::Hive::currentContext();
604 beginRun = ctx.eventID().run_number();
616 ATH_MSG_DEBUG(
"registerCondObjects: registerCondObjects middle");
619 ATH_MSG_DEBUG(
"registerCondObjects: registerCondObjects before registerIOV 1");
620 ATH_MSG_DEBUG(
"registerCondObjects: foldername, tagname, beginRun, endRun, beginLB, endLB: " <<
foldername <<
", " <<
tagname <<
", " << beginRun <<
", " << endRun <<
", " << beginLB <<
", " << endLB);
625 ATH_MSG_DEBUG(
"registerCondObjects: foldername, beginRun, endRun, beginLB, endLB: " <<
foldername <<
", " << beginRun <<
", " << endRun <<
", " << beginLB <<
", " << endLB);
626 sc =
m_regSvc->registerIOV(
"CondAttrListCollection",
foldername,
"", beginRun, endRun, beginLB, endLB);
629 if (
sc.isFailure()) {
630 ATH_MSG_ERROR(
"registerCondObjects: Could not register in IOV DB for CondAttrListCollection");
631 return StatusCode::FAILURE;
638 return StatusCode::SUCCESS;
648 return StatusCode::FAILURE;
651 return StatusCode::SUCCESS;
662 return StatusCode::FAILURE;
667 return StatusCode::SUCCESS;
672 coral::AttributeListSpecification*
674 coral::AttributeListSpecification* attrSpec{
new coral::AttributeListSpecification{}};
675 const std::string becName{capsFormat?
"BarrelEndcap":
"barrel_endcap"};
676 attrSpec->extend(
"SampleSize",
"int");
677 attrSpec->extend(becName,
"int");
678 attrSpec->extend(
"Layer",
"int");
679 attrSpec->extend(
"Eta",
"int");
680 attrSpec->extend(
"Phi",
"int");
690 int barrel_ec{sctId->
barrel_ec(wafer_id)};
693 const std::string becName{capsFormat?
"BarrelEndcap":
"barrel_endcap"};
694 attrList[
"SampleSize"].setValue(
static_cast<int>(samplesize));
695 attrList[becName].setValue(
static_cast<int>(barrel_ec));
696 attrList[
"Layer"].setValue(
static_cast<int>(
layer));
697 attrList[
"Eta"].setValue(
static_cast<int>(
eta));
698 attrList[
"Phi"].setValue(
static_cast<int>(
phi));