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) {
259 double clusterphi = hcalElt->clusterRef()->positionREP().phi();
260 double clustereta = hcalElt->clusterRef()->positionREP().eta();
261 multitracks.
linkedClusters.push_back(std::make_pair(clusterphi, clustereta));
278 double dRHCALEx = 0.;
283 dRHCALEx = tkAtHCALEx.
position().R();
286 std::vector<double> vDist;
290 for (
const auto& hcalElt : hcalEltSet) {
291 double clusterphi = hcalElt->clusterRef()->positionREP().phi();
292 double clustereta = hcalElt->clusterRef()->positionREP().eta();
303 if (dRHCALEx < tkAtHCALEnt.
position().R()) {
306 <<
"Special case of linking with track hitting HCAL and looping back in the tracker ";
309 clustereta, clusterphi, tkreppos.Eta() + 0.1 * dHEta, tkreppos.Phi() + 0.1 * dHPhi);
313 vDist.push_back(dist);
318 const BlockEltSet::iterator hcalEltIt =
std::next(hcalEltSet.begin(),
i);
319 double clusterphi = (*hcalEltIt)->clusterRef()->positionREP().phi();
320 double clustereta = (*hcalEltIt)->clusterRef()->positionREP().eta();
321 multitracks.
linkedClusters.push_back(std::make_pair(clusterphi, clustereta));
325 (*hcalEltIt)->setIsValidMultilinks(
true,
_targetType);
333 trackElt->setMultilinks(multitracks,
_fieldType);