31 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.
fullKey() <<
" is already valid.. In theory this should not be called, but may happen if multiple concurrent events are being processed out of order.");
32 return StatusCode::SUCCESS;
36 std::unique_ptr<PixelHitDiscCnfgData> writeCdo(std::make_unique<PixelHitDiscCnfgData>());
40 if (readCdo==
nullptr) {
42 return StatusCode::FAILURE;
46 if (not readHandle.
range(rangeW)) {
48 return StatusCode::FAILURE;
50 ATH_MSG_DEBUG(
"Size of AthenaAttributeList " << readHandle.
fullKey() <<
" readCdo->size()= " << readCdo->size());
53 const coral::Blob& blob=(*readCdo)[
"HitDiscCnfgData"].data<coral::Blob>();
54 const uint32_t* p =
static_cast<const uint32_t*
>(blob.startingAddress());
57 unsigned int len = blob.size()/
sizeof(uint32_t);
58 ATH_MSG_DEBUG(
"blob.size() = " << blob.size() <<
", len = " << len);
64 for (
unsigned int i = 0; i < len; ++i) {
68 ATH_MSG_DEBUG(
"Got hitdisccnfgData[" << i <<
"] = 0x" << std::hex << cooldata << std::dec);
74 if ((cooldata & 0x8FFFFFFF)==0x0) {
75 ATH_MSG_DEBUG(
"Setting common HitDiscCnfg value to " << ((cooldata&0x30000000) >> 28));
77 hitPL+=((cooldata&0x30000000) >> 28);
80 else if ((cooldata & 0x8FFFFFFF)==0x80000000) {
81 ATH_MSG_DEBUG(
"Setting common 3D HitDiscCnfg value to " << ((cooldata&0x30000000) >> 28));
83 hit3D+=((cooldata&0x30000000) >> 28);
87 ATH_MSG_DEBUG(
"Setting HitDiscCnfg value to " << ((cooldata&0x30000000) >> 28)
88 <<
" for ROB 0x" << std::hex << (cooldata & 0xFFFFFF)
89 <<
", link " << std::dec << ((cooldata & 0xF000000) >> 24));
91 hitPL+=((cooldata&0x30000000) >> 28);
99 if (nhitPL) { aveHitPL = hitPL/(1.0*nhitPL); }
101 if (nhit3D) { aveHit3D = hit3D/(1.0*nhit3D); }
102 else { aveHit3D = aveHitPL; }
104 if (aveHitPL-(
double)(
int)aveHitPL<0.5) { aveHitPL=(double)(
int)aveHitPL; }
105 else { aveHitPL=(double)(
int)(aveHitPL+0.9); }
107 if (aveHit3D-(
double)(
int)aveHit3D<0.5) { aveHit3D=(double)(
int)aveHit3D; }
108 else { aveHit3D=(double)(
int)(aveHit3D+0.9); }
110 writeCdo -> setHitDiscCnfgPL((
int)aveHitPL);
111 writeCdo -> setHitDiscCnfg3D((
int)aveHit3D);
113 if (writeHandle.
record(rangeW, std::move(writeCdo)).isFailure()) {
114 ATH_MSG_FATAL(
"Could not record PixelHitDiscCnfgData " << writeHandle.
key() <<
" with EventRange " << rangeW <<
" into Conditions Store");
115 return StatusCode::FAILURE;
117 ATH_MSG_INFO(
"recorded new CDO " << writeHandle.
key() <<
" with range " << rangeW <<
" into Conditions Store");
119 return StatusCode::SUCCESS;