36 if (m_clustersIn.empty()) {
37 ATH_MSG_ERROR(
"Empty name provided for TopoCluster collection nothing to "
38 "work with -- aborting");
39 return StatusCode::FAILURE;
44 return StatusCode::SUCCESS;
51 return StatusCode::SUCCESS;
64 return StatusCode::SUCCESS;
75 if (tcItr->e() > 1
e-9 || !m_reqPosE) {
77 if (*tcItr && *rcItr && (*tcItr == *rcItr)) {
79 sharedE += tcItr->e();
86 ATH_MSG_VERBOSE(
"Reference cluster and target cluster share " << nSharedCells <<
" cells, " << sharedE <<
" / " << totalE <<
" MeV");
89 return totalE<1
e-9 ? 0. : sharedE/totalE;
96 return getClusterSharedEfrac(refCluster,testCluster)>m_minSharedEfrac;
103 const std::vector<const xAOD::CaloCluster*>& testClusters,
104 std::vector<const xAOD::CaloCluster*>& matchedClusters)
const
107 matchedClusters.clear();
109 for(
const auto& testCluster : testClusters) {
110 if(clustersAreMatched(refCluster, *testCluster)) matchedClusters.push_back(testCluster);
112 return !matchedClusters.empty();
119 std::vector<const xAOD::CaloCluster*>& matchedClusters,
121 bool useLeadingCellEtaPhi)
const
123 float refEta(0.), refPhi(0.);
124 if(useLeadingCellEtaPhi) {
128 if(refItr->e() > leadcellE) leadcell = *refItr;
131 refEta = leadcell->
eta();
132 refPhi = leadcell->
phi();
135 refEta = refCluster.
eta();
136 refPhi = refCluster.
phi();
141 const std::vector<const xAOD::CaloCluster*> testClusters =
144 return getMatchedClusters(refCluster, testClusters, matchedClusters);
151 const std::vector<const xAOD::CaloCluster*>& testClusters,
152 std::vector<std::pair<const xAOD::CaloCluster*, float> >& matchedClustersAndE)
const
155 matchedClustersAndE.clear();
157 for(
const auto& testCluster : testClusters) {
158 float sharedEfrac = getClusterSharedEfrac(refCluster, *testCluster);
159 if(sharedEfrac>m_minSharedEfrac) {
160 matchedClustersAndE.emplace_back(testCluster,sharedEfrac);
163 return !matchedClustersAndE.empty();
170 std::vector<std::pair<const xAOD::CaloCluster*, float> >& matchedClustersAndE,
172 bool useLeadingCellEtaPhi)
const
174 float refEta(0.), refPhi(0.);
175 if(useLeadingCellEtaPhi) {
179 if(refItr->e() > leadcellE) leadcell = *refItr;
182 refEta = leadcell->
eta();
183 refPhi = leadcell->
phi();
186 refEta = refCluster.
eta();
187 refPhi = refCluster.
phi();
192 const std::vector<const xAOD::CaloCluster*> testClusters =
195 return getMatchedClusters(refCluster, testClusters, matchedClustersAndE);
203 const std::vector<const xAOD::CaloCluster*>& testClusters,
204 bool (*gtrthan)(
const std::pair<const xAOD::CaloCluster*,float>&
pair1,
205 const std::pair<const xAOD::CaloCluster*,float>&
pair2))
const
207 std::vector<std::pair<const CaloCluster*,float> > matchedClustersAndE;
208 std::vector<ElementLink<CaloClusterContainer> > tcLinks;
209 std::vector<float> tcSharedE;
210 if(!testClusters.empty()) {
212 if(getMatchedClusters(refCluster, testClusters, matchedClustersAndE)) {
213 std::sort(matchedClustersAndE.begin(),matchedClustersAndE.end(),gtrthan);
214 for(
const auto& tcAndE : matchedClustersAndE) {
215 tcLinks.emplace_back(*pClCont,tcAndE.first->index());
216 tcSharedE.push_back(tcAndE.second);
221 elementLinkDec(refCluster) = tcLinks;
222 ATH_MSG_VERBOSE(
"Decorate cluster " << refCluster.
index() <<
" with " << elementLinkDec(refCluster).
size() <<
" tc links");
224 return StatusCode::SUCCESS;
234 bool useLeadingCellEtaPhi,
235 bool (*gtrthan)(
const std::pair<const xAOD::CaloCluster*,float>&
pair1,
236 const std::pair<const xAOD::CaloCluster*,float>&
pair2))
const
238 std::vector<std::pair<const CaloCluster*,float> > matchedClustersAndE;
239 std::vector<ElementLink<CaloClusterContainer> > tcLinks;
240 std::vector<float> tcSharedE;
242 if(getMatchedClusters(refCluster, matchedClustersAndE, tcmap, useLeadingCellEtaPhi)) {
244 std::sort(matchedClustersAndE.begin(),matchedClustersAndE.end(),gtrthan);
245 for(
const auto& tcAndE : matchedClustersAndE) {
246 tcLinks.emplace_back(*pClCont,tcAndE.first->index());
247 tcSharedE.push_back(tcAndE.second);
251 elementLinkDec(refCluster) = tcLinks;
252 ATH_MSG_VERBOSE(
"Decorate cluster " << refCluster.
index() <<
" with " << elementLinkDec(refCluster).
size() <<
" tc links");
254 return StatusCode::SUCCESS;