46 ATH_MSG_ERROR(
"Failed to get TrackPositionProvider for cluster preselection!");
47 return StatusCode::FAILURE;
55 return StatusCode::SUCCESS;
60 const EventContext& ctx,
65 if (!
data.caloObjects) {
66 ATH_MSG_ERROR(
"PFData::caloObjects is null; caller must set it before invoking the matching tool");
67 return StatusCode::FAILURE;
80 data.clusters.clear();
84 ATH_MSG_DEBUG(
"This event has " <<
data.tracks.size() <<
" tracks " <<
data.clusters.size() <<
" clusters ");
92 else data.nMatches = numMatches;
95 return StatusCode::SUCCESS;
101 unsigned int nMatches(0);
104 const unsigned int nCaloObj =
data.caloObjects->size();
107 for (
auto *thisEfRecTrack :
data.tracks)
110 if (!thisEfRecTrack->hasBin()) {
111 std::unique_ptr<eflowCaloObject> thisEflowCaloObject = std::make_unique<eflowCaloObject>();
112 thisEflowCaloObject->addTrack(thisEfRecTrack);
113 data.caloObjects->push_back(std::move(thisEflowCaloObject));
117 if (msgLvl(MSG::DEBUG))
120 ATH_MSG_DEBUG(
"Matching track with e,pt, eta and phi " << track->e() <<
", " << track->pt() <<
", " << track->eta() <<
" and " << track->phi());
123 std::vector<eflowTrackClusterLink*> bestClusters;
124 std::vector<float> deltaRPrime;
132 for (
auto &matchpair : bestClusters_02)
135 float distancesq = matchpair.second;
137 if (distancesq < 0.15 * 0.15)
141 thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink,
"cone_015");
143 thisEfRecTrack->addAlternativeClusterMatch(trackClusterLink,
"cone_02");
148 for (
auto thePair : matchedClusters) {
150 if (
m_addCPData) deltaRPrime.push_back(std::sqrt(thePair.second));
154 const std::vector<eflowTrackClusterLink*>* matchedClusters_02 = thisEfRecTrack->getAlternativeClusterMatches(
"cone_02");
155 if (!matchedClusters_02)
continue;
156 else bestClusters = *matchedClusters_02;
159 if (bestClusters.empty())
continue;
161 if (msgLvl(MSG::DEBUG))
163 for (
auto *thisClusterLink : bestClusters ) {
165 ATH_MSG_DEBUG(
"Matched this track to cluster with e,pt, eta and phi " << thisCluster->
e() <<
", " << thisCluster->
pt() <<
", " << thisCluster->
eta() <<
" and " << thisCluster->
phi());
172 unsigned int linkIndex = 0;
173 for (
auto *trkClusLink : bestClusters){
179 if (std::find(
data.clusters.begin(),
data.clusters.end(), trkClusLink->getCluster()) ==
data.clusters.end()) {
186 thisEfRecTrack->addClusterMatch(trackClusterLink);
188 thisEfRecTrack->addDeltaRPrime(deltaRPrime[linkIndex]);
196 std::vector<eflowRecCluster *> clusters(
data.clusters.begin(),
data.clusters.end());
199 ATH_MSG_DEBUG(
"Created " << nCaloObjects <<
" eflowCaloObjects.");
200 if (msgLvl(MSG::DEBUG)){
201 for (
auto thisEFlowCaloObject : *(
data.caloObjects)){
202 ATH_MSG_DEBUG(
"This eflowCaloObject has " << thisEFlowCaloObject->nTracks() <<
" tracks and " << thisEFlowCaloObject->nClusters() <<
" clusters ");
203 for (
unsigned int count = 0;
count < thisEFlowCaloObject->nTracks();
count++){
205 ATH_MSG_DEBUG(
"Have track with e, pt, eta and phi of " << thisTrack->
e() <<
", " << thisTrack->
pt() <<
", " << thisTrack->
eta() <<
" and " << thisTrack->
phi());
207 for (
unsigned int count = 0;
count < thisEFlowCaloObject->nClusters();
count++){
209 ATH_MSG_DEBUG(
"Have cluster with e, pt, eta and phi of " << thisCluster->
e() <<
", " << thisCluster->
pt() <<
", " << thisCluster->
eta() <<
" and " << thisCluster->
phi());
215 else return nCaloObj;
220 std::stringstream result;
221 result <<
" track with E, eta and phi "<< track->e() <<
", " << track->eta() <<
" and " << track->phi();
226 std::stringstream result;
227 result <<
" cluster with E, eta and phi of " << cluster->
e() <<
", " << cluster->
eta() <<
" and " << cluster->
phi();
233 for (
const auto *thisEFRecCluster : recClusterVector){
234 if (thisEFRecCluster->getTrackMatches().empty()) {
238 std::vector<eflowTrackClusterLink*> theTrackLinks = thisEFRecCluster->getTrackMatches();
239 for (
auto *thisTrack : theTrackLinks){
#define ATH_CHECK
Evaluate an expression and check for errors.
char data[hepevt_bytes_allocation_ATLAS]
Handle class for reading a decoration on an object.
static void fillClustersToRecover(PFData &data)
static std::unique_ptr< IPositionProvider > Get(const std::string &positionType)
static void fillTracksToRecover(PFData &data)
static unsigned int makeTrkCluCaloObjects(eflowRecTrackContainer *eflowTrackContainer, eflowRecClusterContainer *eflowClusterContainer, eflowCaloObjectContainer *caloObjectContainer)
Inherits from eflowEEtaBinBase.
This class extends the information about a xAOD::CaloCluster.
void addTrackMatch(eflowTrackClusterLink *trackMatch)
xAOD::CaloCluster * getCluster()
Stores pointers to an eflowRecTrack and an eflowRecCluster.
static eflowTrackClusterLink * getInstance(eflowRecTrack *track, eflowRecCluster *cluster, const EventContext &ctx)
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters).
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .).
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.
static std::string release
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version: