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<reco::PFRecHit const*>> eltList;
69 for(RecHitSet::const_iterator it =
rechitsSet_.begin();
75 eltList.push_back(rh1);
80 double phi = rh1.dim[1] - 2 *
M_PI;
82 eltList.push_back(rh2);
86 double phi = rh1.dim[1] + 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<reco::PFRecHit const*> recHits;
140 KDTreeBox trackBox(tracketa-range, tracketa+range, trackphi-range, trackphi+range);
144 for(
auto const&
recHit : recHits) {
146 const auto & cornersxyz =
recHit->getCornersXYZ();
147 const auto & posxyz =
recHit->position();
148 const auto &rhrep =
recHit->positionREP();
149 const auto & corners =
recHit->getCornersREP();
151 double rhsizeeta = fabs(corners[3].
eta() - corners[1].
eta());
152 double rhsizephi = fabs(corners[3].
phi() - corners[1].
phi());
153 if ( rhsizephi >
M_PI ) rhsizephi = 2.*
M_PI - rhsizephi;
155 double deta = fabs(rhrep.eta() - tracketa);
156 double dphi = fabs(rhrep.phi() - trackphi);
157 if ( dphi >
M_PI ) dphi = 2.*
M_PI - dphi;
162 for(BlockEltSet::const_iterator clusterIt = ret->second.begin();
163 clusterIt != ret->second.end(); clusterIt++) {
166 double clusterz = clusterref->position().z();
167 int fracsNbr = clusterref->recHitFractions().size();
171 if (fabs(trackz) > 300.)
continue;
173 double _rhsizeeta = rhsizeeta * (2.00 + 1.0 / (fracsNbr *
std::min(1.,trackPt/2.)));
174 double _rhsizephi = rhsizephi * (2.00 + 1.0 / (fracsNbr *
std::min(1.,trackPt/2.)));
177 if(deta < (_rhsizeeta / 2.) && dphi < (_rhsizephi / 2.))
184 if (fabs(trackz) < 300.)
continue;
185 if (trackz * clusterz < 0.)
continue;
189 for (
unsigned jc=0; jc<4; ++jc ) {
190 auto cornerposxyz = cornersxyz[jc];
191 x[3-jc] = cornerposxyz.x() + (cornerposxyz.x()-posxyz.x())
192 * (1.00+0.50/fracsNbr /
std::min(1.,trackPt/2.));
193 y[3-jc] = cornerposxyz.y() + (cornerposxyz.y()-posxyz.y())
194 * (1.00+0.50/fracsNbr /
std::min(1.,trackPt/2.));
200 bool isinside = TMath::IsInside(trackx,
223 for (BlockEltSet::iterator jt = it->second.begin();
224 jt != it->second.end(); ++jt) {
226 double clusterphi = (*jt)->clusterRef()->positionREP().phi();
227 double clustereta = (*jt)->clusterRef()->positionREP().eta();
229 multitracks.
linkedClusters.push_back(std::make_pair(clusterphi, clustereta));
232 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...)
float cristalPhiEtaMaxSize_
virtual const PFClusterRef & clusterRef() const
const math::XYZPoint & position() const
cartesian position (x, y, z)
void searchLinks() override
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
void search(const KDTreeBox &searchBox, std::vector< DATA > &resRecHitList)
const Fraction< n, m >::type & fract()
virtual const PFRecTrackRef & trackRefPF() const
bool isNull() const
Checks for null.
void build(std::vector< KDTreeNodeInfo< DATA > > &eltList, const KDTreeBox ®ion)
const math::XYZTLorentzVector & momentum() const
4-momenta quadrivector
bool isValid() const
is this point valid ?
~KDTreeLinkerTrackEcal() override
BlockEltSet fieldClusterSet_
RecHit2BlockEltMap rechit2ClusterLinks_
BlockElt2BlockEltMap target2ClusterLinks_
KDTreeLinkerAlgo< reco::PFRecHit const * > tree_
#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