126 unsigned int nClusters = thisEflowCaloObject.
nClusters();
127 unsigned int nTrackMatches = thisEflowCaloObject.
nTracks();
129 ATH_MSG_DEBUG(
"Have got an eflowCaloObject with " << nClusters <<
" clusters and " << nTrackMatches <<
" track matches");
131 if (msgLevel(MSG::DEBUG)){
132 for (
unsigned int iTrack = 0; iTrack < nTrackMatches; ++iTrack){
142 if (nTrackMatches < 1)
return;
150 if (
isEOverPFail(expectedEnergy, expectedSigma, clusterEnergy))
return;
153 const std::vector<std::pair<eflowTrackClusterLink *, std::pair<float, float>>> &matchedTrackList = thisEflowCaloObject.
efRecLink();
155 ATH_MSG_DEBUG(
"Matched Track List has size " << matchedTrackList.size());
157 if (msgLevel(MSG::DEBUG))
159 for (
unsigned int iTrack = 0; iTrack < nTrackMatches; ++iTrack)
162 ATH_MSG_DEBUG(
"eflowCaloObject has track match with E, pt and eta " << thisTrack->
e() <<
", " << thisTrack->
pt() <<
" and " << thisTrack->
eta());
166 ATH_MSG_DEBUG(
"About to perform subtraction for this eflowCaloObject");
168 bool wasAnnihilated =
false;
173 if (
canAnnihilate(expectedEnergy, expectedSigma, clusterEnergy)){
175 wasAnnihilated =
true;
177 std::vector<std::pair<xAOD::CaloCluster *, bool>> clusterList;
178 std::map<xAOD::CaloCluster *, double> clusterEnergyMap;
179 unsigned nCluster = thisEflowCaloObject.
nClusters();
180 for (
unsigned iCluster = 0; iCluster < nCluster; ++iCluster){
184 ATH_MSG_DEBUG(
"We are going to annihilate. ExpectedEnergy, expectedSigma and clusterEnergy are " << expectedEnergy <<
", " << expectedSigma <<
" and " << clusterEnergy);
185 if (msgLevel(MSG::DEBUG))
186 for (
auto thisPair : clusterList)
187 ATH_MSG_DEBUG(
"Annihilating cluster with E and eta " << thisPair.first->e() <<
" and " << thisPair.first->eta());
196 if (msgLevel(MSG::DEBUG))
197 for (
auto thisPair : clusterList)
198 ATH_MSG_DEBUG(
"Have Annihilated cluster with E and eta " << thisPair.first->e() <<
" and " << thisPair.first->eta());
201 for (
unsigned iTrack = 0; iTrack < thisEflowCaloObject.
nTracks(); ++iTrack){
202 eflowRecTrack *thisEfRecTrack = (matchedTrackList[iTrack].first)->getTrack();
210 for (
unsigned iTrack = 0; iTrack < thisEflowCaloObject.
nTracks(); ++iTrack){
217 if (!thisEfRecTrack->
hasBin())
continue;
223 ATH_MSG_DEBUG(
"Am not in dense environment for this eflowCaloObject");
226 std::vector<eflowRecCluster *> matchedClusters;
227 const std::vector<eflowTrackClusterLink *>& links = thisEfRecTrack->
getClusterMatches();
228 matchedClusters.reserve(links.size());
229 for (
auto* thisEFlowTrackClusterLink : links)
230 matchedClusters.push_back(thisEFlowTrackClusterLink->getCluster());
233 matchedClusters.end(),
236 if (msgLvl(MSG::DEBUG)) {
237 for (
auto* thisClus : matchedClusters)
239 "Haved matched cluster "
240 << thisClus->getCluster()->index() <<
" with e,pt, eta and phi of "
241 << thisClus->getCluster()->e() <<
", "
242 << thisClus->getCluster()->pt() <<
", "
243 << thisClus->getCluster()->eta() <<
" and "
244 << thisClus->getCluster()->phi() <<
" will be subtracted");
248 std::vector<std::pair<xAOD::CaloCluster *, bool>> clusterSubtractionList;
249 clusterSubtractionList.reserve(matchedClusters.size());
250 std::map<xAOD::CaloCluster *, double> clusterEnergyMap;
251 for (
auto *thisEFlowRecCluster : matchedClusters){
253 clusterSubtractionList.emplace_back(thisCluster,
false);
254 clusterEnergyMap[thisCluster] = thisCluster->
e();
257 ATH_MSG_DEBUG(
"Have filled clusterSubtractionList for this eflowCaloObject");
259 unsigned int trackIndex = thisEfRecTrack->
getTrack()->index();
262 auto sumClusEnergy = [](
double accumulator, std::pair<xAOD::CaloCluster *, bool> thisPair){
return accumulator += thisPair.first->e();};
263 double totalClusterEnergy = std::accumulate(clusterSubtractionList.begin(),clusterSubtractionList.end(),0.0,sumClusEnergy);
268 if (msgLevel(MSG::DEBUG))
269 for (
auto thisPair : clusterSubtractionList)
270 ATH_MSG_DEBUG(
"Annihilating cluster with E and eta " << thisPair.first->e() <<
" and " << thisPair.first->eta());
278 std::vector<std::pair<float, float>> clusterSubtractedEnergyRatios;
280 m_pfSubtractionStatusSetter.markSubtractionStatus(clusterSubtractionList, clusterSubtractedEnergyRatios, thisEflowCaloObject, trackIndex);
289 totalClusterEnergy = std::accumulate(clusterSubtractionList.begin(),clusterSubtractionList.end(),0.0,sumClusEnergy);
294 if (msgLevel(MSG::DEBUG))
295 for (
auto thisPair : clusterSubtractionList){
296 ATH_MSG_DEBUG(
"Annihilating remnant cluster with E and eta " << thisPair.first->e() <<
" and " << thisPair.first->eta());
300 std::vector<std::pair<float, float>> clusterSubtractedEnergyRatios;
302 m_pfSubtractionStatusSetter.markSubtractionStatus(clusterSubtractionList, clusterSubtractedEnergyRatios, thisEflowCaloObject, trackIndex);
306 std::vector<std::pair<float, float>> clusterSubtractedEnergyRatios;
308 m_pfSubtractionStatusSetter.markSubtractionStatus(clusterSubtractionList, clusterSubtractedEnergyRatios, thisEflowCaloObject, trackIndex);
313 ATH_MSG_DEBUG(
"Have subtracted charged shower for this eflowRecTrack");
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
virtual double e() const override final
The total energy of the particle.