24 {
25
27 if (!cellCollection) {
28 ATH_MSG_ERROR(
"Cell Correction tool receives invalid cell Collection");
29 return StatusCode::FAILURE;
30 }
31
36 return StatusCode::SUCCESS;
37 }
38
39 SG::ReadCondHandle<LArDeadOTXCorrFactors> scToDeadHdl{
m_factors,ctx};
41 if (scToDead.empty()) {
42 return StatusCode::SUCCESS;
43 }
44
45
46 SG::ReadHandle<LArRawSCContainer> scHdl(
m_SCKey, ctx);
47 if (!scHdl.isValid()) {
51 }
52 return StatusCode::SUCCESS;
53 }
54
55 const unsigned int bcid = ctx.eventID().bunch_crossing_id();
56
57
58 const LArRawSCContainer* scells = scHdl.cptr();
59 for (
const auto*
sc : *scells) {
61 continue;
62 const HWIdentifier scHwid =
sc->hardwareID();
63 auto itr = scToDead.find(scHwid);
64 if (itr == scToDead.end())
65 continue;
66
67 const std::vector<unsigned short>& bcids =
sc->bcids();
68 const std::vector<int>& energies =
sc->energies();
69 const std::vector<bool>& satur =
sc->satur();
70
71
72 float scEne = 0;
73 const size_t nBCIDs = bcids.size();
75 for (i = 0;
i < nBCIDs && bcids[
i] !=
bcid;
i++)
76 ;
77
81 ATH_MSG_VERBOSE(
"SuperCell value " << scEne <<
" below threshold, ignoring");
82 continue;
83 }
84 float cellESum = 0;
85 float patchEneSum = 0;
86 for (const auto& [h, convFactor] : itr->second) {
88 if (cell) {
89 const float patchEne = scEne * convFactor;
91 cellESum +=
cell->energy();
92 patchEneSum += patchEne;
93 }
94 ATH_MSG_DEBUG(
"Cell id 0x" << std::hex <<
cell->ID().get_identifier32().get_compact() <<
" Replacing energy " <<
cell->energy() <<
" " << patchEne
95 << ", SCene=" << scEne);
96 cell->setEnergy(patchEne);
98 }
99 }
101 const float ratio = patchEneSum != 0 ? cellESum / patchEneSum : 0;
102 ATH_MSG_DEBUG(
"ESums=" << cellESum <<
"/" << patchEneSum <<
"=" << ratio);
103 std::scoped_lock
l(
m_mtx);
104 auto&
entry = m_testMap[scEne];
107 }
108 }
109
110 return StatusCode::SUCCESS;
111}
#define ATH_MSG_VERBOSE(x)
const CaloCell * findCell(const IdentifierHash theHash) const
fast find method given identifier hash.
bool hasCalo(const CaloCell_ID::SUBCALO caloNum) const
tell wether it has been filled with cells (maybe none) of a given calo
std::map< HWIdentifier, std::vector< std::pair< IdentifierHash, float > > > payload_t
l
Printing final latex table to .tex output file.
setEventNumber setTimeStamp bcid