20 return StatusCode::FAILURE;
23 std::map<unsigned int, double> truthIDTruePtMap;
26 for (
const auto *thisCaloCell : *theCellLinks){
37 std::map<Identifier,std::vector<const CaloCalibrationHit*> >::const_iterator identifierToCaloHitMapIterator = identifierToCaloHitMap.find(cellID);
38 if (identifierToCaloHitMap.end() == identifierToCaloHitMapIterator)
continue;
39 std::vector<const CaloCalibrationHit*> theseCalibrationHits = (*identifierToCaloHitMapIterator).second;
41 for (
const auto *thisCalibrationHit : theseCalibrationHits){
42 int truthID = thisCalibrationHit->particleUID();
43 double thisCalHitTruthEnergy = thisCalibrationHit->energyEM() + thisCalibrationHit->energyNonEM();
44 if (
true ==
m_fullTruthEnergy) thisCalHitTruthEnergy += (thisCalibrationHit->energyEscaped() + thisCalibrationHit->energyInvisible());
46 auto iterator = truthIDTruePtMap.find(truthID);
47 if (
iterator != truthIDTruePtMap.end()) truthIDTruePtMap[truthID] += thisCalHitTruthEnergy;
48 else truthIDTruePtMap[truthID] = thisCalHitTruthEnergy;
55 std::vector<std::pair<unsigned int, double > > truthIDTruePtPairs;
57 truthIDTruePtPairs.reserve(truthIDTruePtMap.size());
58 for (
const auto& thisEntry : truthIDTruePtMap) truthIDTruePtPairs.emplace_back(thisEntry);
61 std::sort(truthIDTruePtPairs.begin(),truthIDTruePtPairs.end(),[]( std::pair<unsigned int, double>
a, std::pair<unsigned int, double>
b) ->
bool {return a.second > b.second;} );
64 if (numTruthParticles > truthIDTruePtPairs.size()) numTruthParticles = truthIDTruePtPairs.size();
67 for (
const auto& thisPair : truthIDTrueCalHitEnergy)
ATH_MSG_DEBUG(
"Truncated loop 2: truthID and true energy are " << thisPair.first <<
" and " << thisPair.second <<
" for cluster with e, eta of " << theCaloCluster.
e() <<
" and " << theCaloCluster.
eta() );
69 return StatusCode::SUCCESS;