10 "KDTreeTrackAndECALLinker");
41 const std::vector<reco::PFRecHitFraction> &
fraction = clusterref->recHitFractions();
45 for(
size_t rhit = 0; rhit < fraction.size(); ++rhit) {
47 double fract = fraction[rhit].fraction();
49 if ((rh.
isNull()) || (fract < 1E-4))
66 std::vector<KDTreeNodeInfo> eltList;
69 for(RecHitSet::const_iterator it =
rechitsSet_.begin();
75 eltList.push_back(rh1);
80 double phi = rh1.dim2 - 2 *
M_PI;
82 eltList.push_back(rh2);
86 double phi = rh1.dim2 + 2 *
M_PI;
88 eltList.push_back(rh3);
97 KDTreeBox region(-3.0, 3.0, phimin, phimax);
109 for(BlockEltSet::iterator it =
targetSet_.begin();
116 (*it)->setIsValidMultilinks(
true);
122 if( ! atECAL.
isValid() )
continue;
130 double trackx = atECAL.
position().X();
131 double tracky = atECAL.
position().Y();
132 double trackz = atECAL.
position().Z();
139 std::vector<KDTreeNodeInfo> recHits;
140 KDTreeBox trackBox(tracketa-range, tracketa+range, trackphi-range, trackphi+range);
144 for(std::vector<KDTreeNodeInfo>::const_iterator rhit = recHits.begin();
145 rhit != recHits.end(); ++rhit) {
147 const auto & cornersxyz = rhit->ptr->getCornersXYZ();
148 const auto & posxyz = rhit->ptr->position();
149 const auto &rhrep = rhit->ptr->positionREP();
150 const auto & corners = rhit->ptr->getCornersREP();
152 double rhsizeeta = fabs(corners[3].
eta() - corners[1].
eta());
153 double rhsizephi = fabs(corners[3].
phi() - corners[1].
phi());
154 if ( rhsizephi >
M_PI ) rhsizephi = 2.*
M_PI - rhsizephi;
156 double deta = fabs(rhrep.eta() - tracketa);
157 double dphi = fabs(rhrep.phi() - trackphi);
158 if ( dphi >
M_PI ) dphi = 2.*
M_PI - dphi;
163 for(BlockEltSet::const_iterator clusterIt = ret->second.begin();
164 clusterIt != ret->second.end(); clusterIt++) {
167 double clusterz = clusterref->position().z();
168 int fracsNbr = clusterref->recHitFractions().size();
172 if (fabs(trackz) > 300.)
continue;
174 double _rhsizeeta = rhsizeeta * (2.00 + 1.0 / (fracsNbr *
std::min(1.,trackPt/2.)));
175 double _rhsizephi = rhsizephi * (2.00 + 1.0 / (fracsNbr *
std::min(1.,trackPt/2.)));
178 if(deta < (_rhsizeeta / 2.) && dphi < (_rhsizephi / 2.))
185 if (fabs(trackz) < 300.)
continue;
186 if (trackz * clusterz < 0.)
continue;
190 for (
unsigned jc=0; jc<4; ++jc ) {
191 auto cornerposxyz = cornersxyz[jc];
192 x[3-jc] = cornerposxyz.x() + (cornerposxyz.x()-posxyz.x())
193 * (1.00+0.50/fracsNbr /
std::min(1.,trackPt/2.));
194 y[3-jc] = cornerposxyz.y() + (cornerposxyz.y()-posxyz.y())
195 * (1.00+0.50/fracsNbr /
std::min(1.,trackPt/2.));
201 bool isinside = TMath::IsInside(trackx,
224 for (BlockEltSet::iterator jt = it->second.begin();
225 jt != it->second.end(); ++jt) {
227 double clusterphi = (*jt)->clusterRef()->positionREP().phi();
228 double clustereta = (*jt)->clusterRef()->positionREP().eta();
230 multitracks.
linkedClusters.push_back(std::make_pair(clusterphi, clustereta));
233 it->first->setMultilinks(multitracks);
float phi() const
momentum azimuthal angle
const REPPoint & positionREP() const
trajectory position in (rho, eta, phi) base
void insertTargetElt(reco::PFBlockElement *track) override
Abstract base class for a PFBlock element (track, cluster...)
void build(std::vector< KDTreeNodeInfoT< DATA, DIM > > &eltList, const KDTreeBoxT< DIM > ®ion)
virtual const PFClusterRef & clusterRef() const
const math::XYZPoint & position() const
cartesian position (x, y, z)
void searchLinks() override
void search(const KDTreeBoxT< DIM > &searchBox, std::vector< KDTreeNodeInfoT< DATA, DIM > > &resRecHitList)
void buildTree() override
void insertFieldClusterElt(reco::PFBlockElement *ecalCluster) override
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Point of closest approach from beam axis (initial point in the case of PFSimParticle) ...
PFMultilinksType linkedClusters
void updatePFBlockEltWithLinks() override
const Fraction< n, m >::type & fract()
virtual const PFRecTrackRef & trackRefPF() const
bool isNull() const
Checks for null.
const math::XYZTLorentzVector & momentum() const
4-momenta quadrivector
bool isValid() const
is this point valid ?
~KDTreeLinkerTrackEcal() override
BlockEltSet fieldClusterSet_
float getCristalPhiEtaMaxSize() const
RecHit2BlockEltMap rechit2ClusterLinks_
BlockElt2BlockEltMap target2ClusterLinks_
#define DEFINE_EDM_PLUGIN(factory, type, name)
A PFTrack holds several trajectory points, which basically contain the position and momentum of a tra...
float eta() const
momentum pseudorapidity
float getPhiOffset() const