Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit PFMultiLinksTC to store refs #34385

Merged
merged 3 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DataFormats/ParticleFlowReco/interface/PFBlockElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace reco {
else
return false; // no multilinks_ for the specified type
}
const PFMultilinksType& getMultilinks(Type type) const { return multilinks_.at(type).linkedClusters; }
const PFMultilinksType& getMultilinks(Type type) const { return multilinks_.at(type).linkedPFObjects; }
// ! Glowinski & Gouzevitch

/// do we have a valid time information
Expand Down
13 changes: 11 additions & 2 deletions DataFormats/ParticleFlowReco/interface/PFMultilinksTC.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@
// Done by Glowinski & Gouzevitch

#include <vector>
#include "DataFormats/ParticleFlowReco/interface/PFRecTrackFwd.h"
#include "DataFormats/ParticleFlowReco/interface/PFClusterFwd.h"

namespace reco {

/// \brief Abstract This class is used by the KDTree Track / Ecal Cluster
/// linker to store all found links.
///
typedef std::vector<std::pair<double, double> > PFMultilinksType;
struct PFMultilink {
PFMultilink(const reco::PFClusterRef& clusterref) : trackRef(), clusterRef(clusterref) {}
PFMultilink(const reco::PFRecTrackRef& trackref) : trackRef(trackref), clusterRef() {}
reco::PFRecTrackRef trackRef;
reco::PFClusterRef clusterRef;
};
/// collection of PFSuperCluster objects
typedef std::vector<PFMultilink> PFMultilinksType;
class PFMultiLinksTC {
public:
bool isValid;
PFMultilinksType linkedClusters;
PFMultilinksType linkedPFObjects;

public:
PFMultiLinksTC(bool isvalid = false) : isValid(isvalid) {}
Expand Down
2 changes: 1 addition & 1 deletion DataFormats/ParticleFlowReco/src/classes_def_2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
<!-- // Glowinski & Gouzevitch -->
<class name="reco::PFMultiLinksTC">
<field name="isValid" transient="true"/>
<field name="linkedClusters" transient="true"/>
<field name="linkedPFObjects" transient="true"/>
</class>

<class name="std::vector<reco::RecoPFClusterRefCandidate>"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,8 @@ void KDTreeLinkerPSEcal::updatePFBlockEltWithLinks() {
reco::PFMultiLinksTC multitracks(true);

for (const auto &ecalElt : ecalEltSet) {
double clusterphi = ecalElt->clusterRef()->positionREP().phi();
double clustereta = ecalElt->clusterRef()->positionREP().eta();

multitracks.linkedClusters.push_back(std::make_pair(clusterphi, clustereta));
reco::PFMultilink multiLink(ecalElt->clusterRef());
multitracks.linkedPFObjects.push_back(multiLink);

// We set the multilinks flag of the ECAL element (for links to PS) to true. It will allow us to
// use it in an optimized way in prefilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,9 @@ void KDTreeLinkerTrackEcal::updatePFBlockEltWithLinks() {

for (const auto &trackElt : trackEltSet) {
const reco::PFRecTrackRef &trackref = trackElt->trackRefPF();
const reco::PFTrajectoryPoint &atECAL = trackref->extrapolatedPoint(reco::PFTrajectoryPoint::ECALShowerMax);
double tracketa = atECAL.positionREP().eta();
double trackphi = atECAL.positionREP().phi();

multitracks.linkedClusters.push_back(std::make_pair(trackphi, tracketa));
reco::PFMultilink multiLink(trackref);
multitracks.linkedPFObjects.push_back(multiLink);

// We set the multilinks flag of the track (for links to ECAL) to true. It will allow us to
// use it in an optimized way in prefilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ void KDTreeLinkerTrackHcal::updatePFBlockEltWithLinks() {
// No restriction on the number of HCAL links per track or isLinkedToDisplacedVertex
if (nMaxHcalLinksPerTrack_ < 0. || trackElt->isLinkedToDisplacedVertex()) {
for (const auto& hcalElt : hcalEltSet) {
double clusterphi = hcalElt->clusterRef()->positionREP().phi();
double clustereta = hcalElt->clusterRef()->positionREP().eta();
multitracks.linkedClusters.push_back(std::make_pair(clusterphi, clustereta));
reco::PFMultilink multiLink(hcalElt->clusterRef());
multitracks.linkedPFObjects.push_back(multiLink);

// We set the multilinks flag of the track (for links to ECAL) to true. It will allow us to
// use it in an optimized way in prefilter
Expand Down Expand Up @@ -316,15 +315,13 @@ void KDTreeLinkerTrackHcal::updatePFBlockEltWithLinks() {
// Fill multitracks
for (auto i : sort_indexes(vDist)) {
const BlockEltSet::iterator hcalEltIt = std::next(hcalEltSet.begin(), i);
double clusterphi = (*hcalEltIt)->clusterRef()->positionREP().phi();
double clustereta = (*hcalEltIt)->clusterRef()->positionREP().eta();
multitracks.linkedClusters.push_back(std::make_pair(clusterphi, clustereta));

reco::PFMultilink multiLink((*hcalEltIt)->clusterRef());
multitracks.linkedPFObjects.push_back(multiLink);
// We set the multilinks flag of the track (for links to ECAL) to true. It will allow us to
// use it in an optimized way in prefilter
(*hcalEltIt)->setIsValidMultilinks(true, _targetType);

if (multitracks.linkedClusters.size() >= (unsigned)nMaxHcalLinksPerTrack_)
if (multitracks.linkedPFObjects.size() >= (unsigned)nMaxHcalLinksPerTrack_)
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,13 @@ double PreshowerAndECALLinker::testLink(const reco::PFBlockElement* elem1, const
// Glowinski & Gouzevitch
if (useKDTree_ && pselem->isMultilinksValide(ecalelem->type())) { // KDTree algo
const reco::PFMultilinksType& multilinks = pselem->getMultilinks(ecalelem->type());
const reco::PFCluster::REPPoint& ecalreppos = ecalref->positionREP();
const math::XYZPoint& ecalxyzpos = ecalref->position();
const math::XYZPoint& psxyzpos = psref->position();
const double ecalPhi = ecalreppos.Phi();
const double ecalEta = ecalreppos.Eta();

// Check if the link PS/Ecal exist
reco::PFMultilinksType::const_iterator mlit = multilinks.begin();
for (; mlit != multilinks.end(); ++mlit)
if ((mlit->first == ecalPhi) && (mlit->second == ecalEta))
if (mlit->clusterRef == ecalref)
break;

// If the link exist, we fill dist and linktest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ double TrackAndECALLinker::testLink(const reco::PFBlockElement* elem1, const rec
const reco::PFMultilinksType& multilinks = ecalelem->getMultilinks(tkelem->type());
const double tracketa = tkAtECAL.positionREP().Eta();
const double trackphi = tkAtECAL.positionREP().Phi();

// Check if the link Track/Ecal exist
reco::PFMultilinksType::const_iterator mlit = multilinks.begin();
for (; mlit != multilinks.end(); ++mlit)
if ((mlit->first == trackphi) && (mlit->second == tracketa))
if (mlit->trackRef == trackref)
break;

// If the link exist, we fill dist and linktest.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,34 +93,32 @@ double TrackAndHCALLinker::testLink(const reco::PFBlockElement* elem1, const rec
// Glowinski & Gouzevitch
if (useKDTree_ && tkelem->isMultilinksValide(hcalelem->type())) { //KDTree Algo
const reco::PFMultilinksType& multilinks = tkelem->getMultilinks(hcalelem->type());
const double hcalphi = hcalreppos.Phi();
const double hcaleta = hcalreppos.Eta();

// Check if the link Track/Hcal exist
reco::PFMultilinksType::const_iterator mlit = multilinks.begin();
for (; mlit != multilinks.end(); ++mlit)
if ((mlit->first == hcalphi) && (mlit->second == hcaleta))
if (mlit->clusterRef == clusterref)
break;

// If the link exist, we fill dist and linktest.

if (mlit != multilinks.end()) {
// when checkExit_ is false
if (!checkExit_) {
dist = LinkByRecHit::computeDist(hcaleta, hcalphi, tkreppos.Eta(), tkreppos.Phi());
dist = LinkByRecHit::computeDist(hcalreppos.Eta(), hcalreppos.Phi(), tkreppos.Eta(), tkreppos.Phi());
}
// when checkExit_ is true
else {
//special case ! A looper can exit the barrel inwards and hit the endcap
//In this case calculate the distance based on the first crossing since
//the looper will probably never make it to the endcap
if (dRHCALEx < tkAtHCALEnt.position().R()) {
dist = LinkByRecHit::computeDist(hcaleta, hcalphi, tkreppos.Eta(), tkreppos.Phi());
dist = LinkByRecHit::computeDist(hcalreppos.Eta(), hcalreppos.Phi(), tkreppos.Eta(), tkreppos.Phi());
edm::LogWarning("TrackHCALLinker ")
<< "Special case of linking with track hitting HCAL and looping back in the tracker ";
} else {
dist =
LinkByRecHit::computeDist(hcaleta, hcalphi, tkreppos.Eta() + 0.1 * dHEta, tkreppos.Phi() + 0.1 * dHPhi);
dist = LinkByRecHit::computeDist(
hcalreppos.Eta(), hcalreppos.Phi(), tkreppos.Eta() + 0.1 * dHEta, tkreppos.Phi() + 0.1 * dHPhi);
}
} // checkExit_
} // multilinks
Expand Down