83 return StatusCode::SUCCESS;
87 std::vector<const CondAttrListCollection*> attrListNoise;
92 attrListNoise.push_back(*larNoiseHdl);
99 attrListNoise.push_back(*tileNoiseHdl);
106 attrListNoise.push_back(*caloNoiseHdl);
112 std::forward_list<std::pair<unsigned, const coral::Blob&> > blobList;
113 for (
const auto& attrListColl : attrListNoise) {
114 for (
const auto& coll : *attrListColl) {
118 ATH_MSG_DEBUG(
"Empty blob in channel " << coll.first <<
". Ignored.");
121 blobList.emplace_front(coll.first, blob);
129 larHVCorr=*larHVCorrHdl;
142 const coral::AttributeList& attrList = lumiAttrListColl->
attributeList(0);
143 if (attrList[
"LBAvInstLumi"].isNull()) {
144 ATH_MSG_WARNING(
" NULL Luminosity information in database ... set it to 0 " );
147 lumi = attrList[
"LBAvInstLumi"].data<
float>() *1e-3;
149 if (std::isnan(lumi)) {
163 const size_t maxCells=
m_caloCellID->calo_cell_hash_max();
166 const size_t nTileCells=
m_hashRange->maxTileCells();
167 std::unique_ptr<CaloNoise> caloNoiseObj=std::make_unique<CaloNoise>(nLArCells,3,
172 std::array<unsigned,4> cellsPerGain{0,0,0,0};
176 for (
auto& blobPair : blobList) {
181 if (blob->getObjVersion()!=1) {
182 ATH_MSG_ERROR(
"Unexpected blob object version in COOL channel " << blobPair.first
183 <<
". Found " << blob->getObjVersion() <<
", expected 1");
184 return StatusCode::FAILURE;
189 const unsigned nChansThisblob=blob->getNChans();
190 const unsigned nGains=blob->getNGains();
191 for (
unsigned igain=0;igain<nGains;++igain) {
192 for (
unsigned i=0;i<nChansThisblob;++i) {
198 if (hvcorr<0.01) hvcorr=1.0;
200 const float a=blob->getData(i,igain,0)*hvcorr;
201 const float b=blob->getData(i,igain,1);
202 ++(cellsPerGain[igain]);
206 noise[igain][hash]=
a;
209 noise[igain][hash]=b*std::sqrt(lumi);
212 noise[igain][hash]=std::sqrt(
a*
a + b*b*lumi);
224 caloNoiseObj->setTileBlob(blob.release(),lumi);
232 ATH_MSG_ERROR(
"Unexpected number of COOL channels containing noise-blobs. Got " << nBlobs <<
" expected 7 (6 LAr, 1 Tile)");
233 return StatusCode::FAILURE;
239 ATH_MSG_INFO(
"Calculated electronic noise" << (larHVCorr ?
" with " :
" without ") <<
"HV Scale correction");
242 ATH_MSG_INFO(
"Calculated pile-up noise for lumi " << lumi);
245 ATH_MSG_INFO(
"Calculated total noise for lumi " << lumi<< (larHVCorr ?
" with " :
" without ") <<
"HV Scale correction");
251 for (
unsigned igain=0;igain<4;++igain) {
253 if (igain<3 && cellsPerGain[igain]!=maxCells) {
254 ATH_MSG_ERROR(
"Expected " << maxCells <<
" cells for gain " << igain <<
", got " << cellsPerGain[igain]);
257 ATH_MSG_DEBUG(
"Gain " << igain <<
" Nbr of cells: " << cellsPerGain[igain]);
264 ATH_MSG_INFO(
"recorded new CaloNoise object with key " << writeHandle.
key() <<
" and range " << writeHandle.
getRange());
266 return StatusCode::SUCCESS;