38 void clear()
override;
74 trajectoryLayerEntranceString_(conf.getParameter<
std::
string>(
"trajectoryLayerEntrance")),
75 trajectoryLayerExitString_(conf.getParameter<
std::
string>(
"trajectoryLayerExit")),
76 nMaxHcalLinksPerTrack_(conf.getParameter<
int>(
"nMaxHcalLinksPerTrack")) {
110 const std::vector<reco::PFRecHitFraction>&
fraction = clusterref->recHitFractions();
114 for (
size_t rhit = 0; rhit <
fraction.size(); ++rhit) {
133 std::vector<KDTreeNodeInfo<reco::PFRecHit const*, 2>> eltList;
140 eltList.push_back(rh1);
145 float phi = rh1.dims[1] - 2 *
M_PI;
147 eltList.push_back(rh2);
151 float phi = rh1.dims[1] + 2 *
M_PI;
153 eltList.push_back(rh3);
189 dHphi = dHphi - 2. *
M_PI;
190 else if (dHphi < -
M_PI)
191 dHphi = dHphi + 2. *
M_PI;
194 float tracketa = atHCAL.
positionREP().eta() + 0.1 * dHeta;
195 float trackphi = atHCAL.
positionREP().phi() + 0.1 * dHphi;
198 trackphi -= 2 *
M_PI;
199 else if (trackphi < -
M_PI)
200 trackphi += 2 *
M_PI;
204 double inflation = 1.;
209 std::vector<reco::PFRecHit const*>
recHits;
210 KDTreeBox trackBox(tracketa - rangeeta, tracketa + rangeeta, trackphi - rangephi, trackphi + rangephi);
215 const auto& rhrep =
recHit->positionREP();
216 const auto& corners =
recHit->getCornersREP();
218 double rhsizeeta = fabs(corners[3].
eta() - corners[1].
eta());
219 double rhsizephi = fabs(corners[3].
phi() - corners[1].
phi());
220 if (rhsizephi >
M_PI)
221 rhsizephi = 2. *
M_PI - rhsizephi;
223 double deta = fabs(rhrep.eta() - tracketa);
224 double dphi = fabs(rhrep.phi() - trackphi);
226 dphi = 2. *
M_PI - dphi;
231 for (BlockEltSet::iterator clusterIt =
ret->second.begin(); clusterIt !=
ret->second.end(); clusterIt++) {
233 int fracsNbr = clusterref->recHitFractions().size();
235 double _rhsizeeta = rhsizeeta * (1.5 + 0.5 / fracsNbr) + 0.2 * fabs(dHeta);
236 double _rhsizephi = rhsizephi * (1.5 + 0.5 / fracsNbr) + 0.2 * fabs(dHphi);
239 if (deta < (_rhsizeeta / 2.) && dphi < (_rhsizephi / 2.))
251 const auto& trackElt = it->first;
252 const auto& hcalEltSet = it->second;
257 if (nMaxHcalLinksPerTrack_ < 0. || trackElt->isLinkedToDisplacedVertex()) {
258 for (
const auto& hcalElt : hcalEltSet) {
277 double dRHCALEx = 0.;
282 dRHCALEx = tkAtHCALEx.
position().R();
285 std::vector<double> vDist;
289 for (
const auto& hcalElt : hcalEltSet) {
290 double clusterphi = hcalElt->clusterRef()->positionREP().phi();
291 double clustereta = hcalElt->clusterRef()->positionREP().eta();
302 if (dRHCALEx < tkAtHCALEnt.
position().R()) {
305 <<
"Special case of linking with track hitting HCAL and looping back in the tracker ";
308 clustereta, clusterphi, tkreppos.Eta() + 0.1 * dHEta, tkreppos.Phi() + 0.1 * dHPhi);
312 vDist.push_back(dist);
317 const BlockEltSet::iterator hcalEltIt =
std::next(hcalEltSet.begin(),
i);
322 (*hcalEltIt)->setIsValidMultilinks(
true,
_targetType);
330 trackElt->setMultilinks(multitracks,
_fieldType);
constexpr double deltaPhi(double phi1, double phi2)
~KDTreeLinkerTrackHcal() override
std::set< reco::PFBlockElement * > BlockEltSet
Abstract base class for a PFBlock element (track, cluster...)
reco::PFTrajectoryPoint::LayerType trajectoryLayerEntrance_
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
static double computeDist(double eta1, double phi1, double eta2, double phi2, bool etaPhi=true)
computes a chisquare
float cristalPhiEtaMaxSize_
void search(const KDTreeBox< DIM > &searchBox, std::vector< DATA > &resRecHitList)
reco::PFBlockElement::Type _fieldType
ret
prodAgent to be discontinued
BlockElt2BlockEltMap target2ClusterLinks_
std::map< const reco::PFRecHit *, BlockEltSet > RecHit2BlockEltMap
static std::vector< size_t > sort_indexes(const std::vector< T > &v)
std::map< reco::PFBlockElement *, BlockEltSet > BlockElt2BlockEltMap
KDTreeLinkerTrackHcal(const edm::ParameterSet &conf)
KDTreeLinkerAlgo< reco::PFRecHit const * > tree_
bool isValid() const
is this point valid ?
std::string trajectoryLayerEntranceString_
void searchLinks() override
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
RecHit2BlockEltMap rechit2ClusterLinks_
float phi() const
momentum azimuthal angle
void updatePFBlockEltWithLinks() override
void buildTree() override
virtual const PFClusterRef & clusterRef() const
Abstract This class is used by the KDTree Track / Ecal Cluster linker to store all found links...
std::set< const reco::PFRecHit * > RecHitSet
const Fraction< n, m >::type & fract()
bool isNull() const
Checks for null.
static LayerType layerTypeByName(const std::string &name)
void build(std::vector< KDTreeNodeInfo< DATA, DIM > > &eltList, const KDTreeBox< DIM > ®ion)
BlockEltSet fieldClusterSet_
const math::XYZPoint & position() const
cartesian position (x, y, z)
void insertTargetElt(reco::PFBlockElement *track) override
PFMultilinksType linkedPFObjects
int nMaxHcalLinksPerTrack_
reco::PFTrajectoryPoint::LayerType trajectoryLayerExit_
void insertFieldClusterElt(reco::PFBlockElement *hcalCluster) override
float eta() const
momentum pseudorapidity
reco::PFBlockElement::Type _targetType
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
#define DEFINE_EDM_PLUGIN(factory, type, name)
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
Log< level::Warning, false > LogWarning
LayerType
Define the different layers where the track can be propagated.
std::string trajectoryLayerExitString_