20 return StatusCode::SUCCESS;
25 ATH_MSG_DEBUG(
"Starting PFOChargedCreatorAlgorithm::execute");
28 ATH_CHECK(chargedFlowElementContainerWriteHandle.
record(std::make_unique<xAOD::FlowElementContainer>(),std::make_unique<xAOD::FlowElementAuxContainer>()));
32 for (
const auto *
const thisEflowCaloObject : *eflowCaloObjectContainerReadHandle)
createChargedFlowElements(*thisEflowCaloObject,
true,chargedFlowElementContainerWriteHandle);
34 std::sort(chargedFlowElementContainerWriteHandle->
begin(), chargedFlowElementContainerWriteHandle->
end(), [] (
const xAOD::FlowElement* flowElement1,
const xAOD::FlowElement* flowElement2) {return flowElement1->pt()>flowElement2->pt();});
36 return StatusCode::SUCCESS;
43 for (
unsigned int iTrack = 0; iTrack < energyFlowCaloObject.
nTracks(); ++iTrack) {
52 chargedFlowElementContainerWriteHandle->
push_back(thisFE);
53 thisFE->
setSignalType(xAOD::FlowElement::SignalType::ChargedPFlow);
59 std::vector<ElementLink<xAOD::IParticleContainer> > vecIParticleTrackLinkContainer;
60 vecIParticleTrackLinkContainer.push_back(theIParticleTrackLink);
67 std::pair<double,double> etaPhi(0.0,0.0);
95 ATH_MSG_DEBUG(
"Created charged PFO with E, pt, eta and phi of " << thisFE->
e() <<
", " << thisFE->
pt() <<
", " << thisFE->
eta() <<
" and " << thisFE->
phi());
99 accTracksExpectedEnergyDeposit(*thisFE) = efRecTrack->
getEExpect();
110 std::vector<std::pair<eflowTrackClusterLink*,std::pair<float,float> > > trackClusterLinkPairs = energyFlowCaloObject.
efRecLink();
112 ATH_MSG_DEBUG(
"Have got " << trackClusterLinkPairs.size() <<
" trackClusterLinkPairs");
114 std::vector<eflowTrackClusterLink*> thisTracks_trackClusterLinks = efRecTrack->
getClusterMatches();
116 ATH_MSG_DEBUG(
"Have got " << thisTracks_trackClusterLinks.size() <<
" cluster matches");
122 std::vector<eflowTrackClusterLink*> thisTracks_trackClusterLinksSubtracted;
125 std::vector<std::pair<ElementLink<xAOD::CaloClusterContainer>,
double> > vectorClusterToSubtractedEnergies;
127 for (
auto& trackClusterLink : thisTracks_trackClusterLinks){
128 for (
auto& trackClusterLinkPair : trackClusterLinkPairs){
131 if (!
m_eOverPMode && trackClusterLinkPair.first == trackClusterLink && !std::isnan(trackClusterLinkPair.second.first)) {
132 thisTracks_trackClusterLinksSubtracted.push_back(trackClusterLink);
136 ATH_MSG_DEBUG(
"Will add cluster with E, ratio and absolute subtracted energy " << (*theOriginalClusterLink)->e() <<
", " << trackClusterLinkPair.second.first <<
", " << trackClusterLinkPair.second.second);
137 if (theSisterClusterLink.
isValid()) vectorClusterToSubtractedEnergies.emplace_back(std::pair(theSisterClusterLink,trackClusterLinkPair.second.second));
138 else vectorClusterToSubtractedEnergies.emplace_back(std::pair(theOriginalClusterLink,trackClusterLinkPair.second.second));
140 else if (
m_eOverPMode && trackClusterLinkPair.first == trackClusterLink){
141 thisTracks_trackClusterLinksSubtracted.push_back(trackClusterLink);
145 ATH_MSG_DEBUG(
"Will add cluster with E, ratio and absolute subtracted energy " << (*theOriginalClusterLink)->e() <<
", " << 1.0 <<
", " << 0.0);
146 if (theSisterClusterLink.
isValid()) vectorClusterToSubtractedEnergies.emplace_back(theSisterClusterLink,0.0);
147 else vectorClusterToSubtractedEnergies.emplace_back(theOriginalClusterLink,0.0);
153 std::sort(vectorClusterToSubtractedEnergies.begin(),vectorClusterToSubtractedEnergies.end(), [](
auto const&
a,
auto const&
b){return a.second > b.second;});
155 std::vector<ElementLink<xAOD::IParticleContainer> > theClusters;
156 std::vector<float> theClusterWeights;
157 for (
auto thePair : vectorClusterToSubtractedEnergies){
159 theClusters.push_back(theIParticleTrackLink);
160 theClusterWeights.push_back(thePair.second);
177 accIsRecovered(*thisFE) = efRecTrack->
isRecovered();
186 accPull15(*thisFE) = efRecTrack->
getpull15();