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);