16 constexpr
float cellEtaSize = 0.1;
17 constexpr
float cellPhiSize = 0.1;
36 ATH_CHECK(m_caloDetDescrMgrKey.initialize());
38 ATH_MSG_DEBUG(
"Will store cookie cut clusters in this container "
39 << m_outClusterContainerKey.key());
40 ATH_CHECK(m_outClusterContainerKey.initialize());
41 m_outClusterContainerCellLinkKey = m_outClusterContainerKey.key() +
"_links";
42 ATH_CHECK(m_outClusterContainerCellLinkKey.initialize());
44 ATH_MSG_DEBUG(
"Using " << m_SGKey_electrons <<
" for electrons");
45 ATH_CHECK(m_SGKey_electrons.initialize());
47 const std::string containerKey = m_SGKey_electrons.key();
48 for (
const auto&
e : m_vecMName) {
51 key = containerKey +
".cookiecut" +
e;
52 m_SGKey_electrons_decorations.emplace_back(
key);
55 key = containerKey +
".original" +
e;
56 m_SGKey_electrons_decorations.emplace_back(
key);
59 m_SGKey_electrons_decorations.emplace_back(
60 containerKey +
".cookiecutClusterLink");
62 m_nDecor = m_SGKey_electrons_decorations.size();
64 ATH_CHECK(m_SGKey_electrons_decorations.initialize());
67 for (
const auto&
s : m_SGKey_electrons_decorations)
71 m_CookieCutPars.maxDelEta = m_maxDelEtaCells * cellEtaSize * 0.5;
72 m_CookieCutPars.maxDelPhi = m_maxDelPhiCells * cellPhiSize * 0.5;
73 m_CookieCutPars.maxDelR2 = m_maxDelR * m_maxDelR;
76 if (!m_clusterCorrectionTools.empty()) {
77 ATH_CHECK(m_clusterCorrectionTools.retrieve());
78 m_CookieCutPars.recomputeMoments =
true;
81 return StatusCode::SUCCESS;
88 const EventContext& ctx = Gaudi::Hive::currentContext();
91 static const std::vector<CaloSampling::CaloSample> s_sam
105 m_outClusterContainerKey,
111 m_outClusterContainerCellLinkKey,
115 std::make_unique<CaloClusterCellLinkContainer>())
123 return StatusCode::SUCCESS;
126 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> decoM;
127 decoM.reserve(m_nDecor);
128 for (
int i = 0;
i < m_nDecor - 1;
i++) {
129 decoM.emplace_back(m_SGKey_electrons_decorations[
i], ctx);
133 std::call_once(m_Seen, [
this,&decoM]() {
134 for (
int i = 0;
i < m_nDecor - 1;
i++) {
136 <<
" " << m_SGKey_electrons_decorations[
i].
key()
137 <<
" " << decoM[
i].decorKey());
143 decoEl(m_SGKey_electrons_decorations[m_nDecor-1],ctx);
147 m_caloDetDescrMgrKey, ctx
149 ATH_CHECK(caloDetDescrMgrHandle.isValid());
154 std::vector<bool> success(
nF,
true);
160 <<
" pT = " << cluster->
pt()
161 <<
" eta = " << cluster->
eta());
166 std::unique_ptr<xAOD::CaloCluster> newCluster =
168 cellCont, m_CookieCutPars);
175 <<
" original cluster " << cluster->
index()
176 <<
" pT = " << cluster->
pt()
177 <<
" eta = " << cluster->
eta()
178 <<
" has EME2 or FCAL0"
182 << (newCluster ?
" no cells in cluster" :
" no cluster"));
189 success[iel] =
false;
195 <<
" pT = " << newCluster->
pt()
196 <<
" eta = " << newCluster->
eta());
198 outClusterContainer->
push_back(std::move(newCluster));
199 size_t index = outClusterContainer->
size() - 1;
201 clusterLink(*outClusterContainer,
index, ctx);
207 if (m_storeOrigMom) {
208 for (
size_t i = 0;
i < m_vecM.size();
i++) {
209 int indexDecor = m_storeCookMom ? 2*
i+1 :
i;
214 <<
" does not exist for the original cluster");
216 decoM[indexDecor](*electron) =
float(
m);
218 <<
" with original moment "
219 <<
i <<
" " << m_vecMName[
i]
220 <<
" = " <<
m <<
" (decoration index =" << indexDecor
221 <<
" key = " << decoM[indexDecor].decorKey() <<
")");
227 if (!m_clusterCorrectionTools.empty()) {
228 ToolHandleArray<CaloClusterCollectionProcessor>::const_iterator
229 toolIt = m_clusterCorrectionTools.begin(),
230 toolIt_e = m_clusterCorrectionTools.end();
231 for (; toolIt != toolIt_e; ++toolIt) {
232 ATH_CHECK((*toolIt)->execute(ctx, outClusterContainer.
ptr()));
235 if (m_storeCookMom) {
238 cookClusLinkAcc(
"cookiecutClusterLink" );
242 if (success[iel] && cookClusLinkAcc.isAvailable(*
electron)) {
249 if (success[iel] && cluster ==
nullptr) {
251 "could not be retrieved");
254 for (
size_t i = 0;
i < m_vecM.size();
i++) {
255 int indexDecor = m_storeOrigMom ? 2*
i :
i;
261 <<
" does not exist for the new cluster");
264 decoM[indexDecor](*electron) =
float(
m);
266 <<
" with new moment "
267 <<
i <<
" " << m_vecMName[
i]
268 <<
" = " <<
m <<
" (decoration index = " << indexDecor
269 <<
" key = " << decoM[indexDecor].decorKey() <<
")");
278 outClusterContainerCellLink);
281 <<
" cookie cut clusters");
283 return StatusCode::SUCCESS;