#include <KDTreeLinkerPSEcal.h>
Public Member Functions | |
void | buildTree () |
void | clear () |
void | insertFieldClusterElt (reco::PFBlockElement *ecalCluster) |
void | insertTargetElt (reco::PFBlockElement *psCluster) |
KDTreeLinkerPSEcal () | |
void | searchLinks () |
void | updatePFBlockEltWithLinks () |
~KDTreeLinkerPSEcal () | |
Private Member Functions | |
void | buildTree (const RecHitSet &rechitsSet, KDTreeLinkerAlgo &tree) |
Private Attributes | |
BlockEltSet | fieldClusterSet_ |
const double | ps1ToEcal_ |
const double | ps2ToEcal_ |
RecHit2BlockEltMap | rechit2ClusterLinks_ |
RecHitSet | rechitsNegSet_ |
RecHitSet | rechitsPosSet_ |
const double | resPSlength_ |
const double | resPSpitch_ |
BlockElt2BlockEltMap | target2ClusterLinks_ |
BlockEltSet | targetSet_ |
KDTreeLinkerAlgo | treeNeg_ |
KDTreeLinkerAlgo | treePos_ |
Definition at line 12 of file KDTreeLinkerPSEcal.h.
KDTreeLinkerPSEcal::KDTreeLinkerPSEcal | ( | ) |
Definition at line 6 of file KDTreeLinkerPSEcal.cc.
: KDTreeLinkerBase(), resPSpitch_ (0.19), resPSlength_ (6.1), ps1ToEcal_ (1.072), ps2ToEcal_ (1.057) {}
KDTreeLinkerPSEcal::~KDTreeLinkerPSEcal | ( | ) |
void KDTreeLinkerPSEcal::buildTree | ( | ) | [virtual] |
Implements KDTreeLinkerBase.
Definition at line 68 of file KDTreeLinkerPSEcal.cc.
References rechitsNegSet_, rechitsPosSet_, treeNeg_, and treePos_.
void KDTreeLinkerPSEcal::buildTree | ( | const RecHitSet & | rechitsSet, |
KDTreeLinkerAlgo & | tree | ||
) | [private] |
Definition at line 75 of file KDTreeLinkerPSEcal.cc.
References KDTreeLinkerAlgo< DATA >::build(), and reco::PFRecHit::position().
{ // List of pseudo-rechits that will be used to create the KDTree std::vector<KDTreeNodeInfo> eltList; // Filling of this eltList for(RecHitSet::const_iterator it = rechitsSet.begin(); it != rechitsSet.end(); it++) { const reco::PFRecHit* rh = *it; const math::XYZPoint& posxyz = rh->position(); KDTreeNodeInfo rhinfo (rh, posxyz.X(), posxyz.Y()); eltList.push_back(rhinfo); } // xmin-xmax, ymain-ymax KDTreeBox region(-150., 150., -150., 150.); // We may now build the KDTree tree.build(eltList, region); }
void KDTreeLinkerPSEcal::clear | ( | void | ) | [virtual] |
Implements KDTreeLinkerBase.
Definition at line 230 of file KDTreeLinkerPSEcal.cc.
References KDTreeLinkerAlgo< DATA >::clear(), fieldClusterSet_, rechit2ClusterLinks_, rechitsNegSet_, rechitsPosSet_, target2ClusterLinks_, targetSet_, treeNeg_, and treePos_.
Referenced by ~KDTreeLinkerPSEcal().
{ targetSet_.clear(); fieldClusterSet_.clear(); rechitsNegSet_.clear(); rechitsPosSet_.clear(); rechit2ClusterLinks_.clear(); target2ClusterLinks_.clear(); treeNeg_.clear(); treePos_.clear(); }
void KDTreeLinkerPSEcal::insertFieldClusterElt | ( | reco::PFBlockElement * | ecalCluster | ) | [virtual] |
Implements KDTreeLinkerBase.
Definition at line 35 of file KDTreeLinkerPSEcal.cc.
References reco::PFBlockElement::clusterRef(), PFLayer::ECAL_ENDCAP, fieldClusterSet_, funct::fract(), edm::Ref< C, T, F >::isNull(), rechit2ClusterLinks_, rechitsNegSet_, and rechitsPosSet_.
Referenced by PFBlockAlgo::setInput().
{ reco::PFClusterRef clusterref = ecalCluster->clusterRef(); if (clusterref->layer() != PFLayer::ECAL_ENDCAP) return; const std::vector<reco::PFRecHitFraction> &fraction = clusterref->recHitFractions(); // We create a list of cluster fieldClusterSet_.insert(ecalCluster); double clusterz = clusterref->position().Z(); RecHitSet& rechitsSet = (clusterz < 0) ? rechitsNegSet_ : rechitsPosSet_; for(size_t rhit = 0; rhit < fraction.size(); ++rhit) { const reco::PFRecHitRef& rh = fraction[rhit].recHitRef(); double fract = fraction[rhit].fraction(); if ((rh.isNull()) || (fract < 1E-4)) continue; const reco::PFRecHit& rechit = *rh; // We save the links rechit to Clusters rechit2ClusterLinks_[&rechit].insert(ecalCluster); // We create a liste of rechits rechitsSet.insert(&rechit); } }
void KDTreeLinkerPSEcal::insertTargetElt | ( | reco::PFBlockElement * | psCluster | ) | [virtual] |
Implements KDTreeLinkerBase.
Definition at line 21 of file KDTreeLinkerPSEcal.cc.
References reco::PFBlockElement::clusterRef(), and targetSet_.
Referenced by PFBlockAlgo::setInput().
{ reco::PFClusterRef clusterref = psCluster->clusterRef(); // This test is more or less done in PFBlockAlgo.h. In others cases, it should be switch on. // if (!((clusterref->layer() == PFLayer::PS1) || // (clusterref->layer() == PFLayer::PS2))) // return; targetSet_.insert(psCluster); }
void KDTreeLinkerPSEcal::searchLinks | ( | ) | [virtual] |
Implements KDTreeLinkerBase.
Definition at line 100 of file KDTreeLinkerPSEcal.cc.
References KDTreeLinkerBase::getCristalXYMaxSize(), reco::PFCluster::layer(), reco::CaloCluster::position(), reco::PFCluster::positionREP(), PFLayer::PS1, ps1ToEcal_, ps2ToEcal_, rechit2ClusterLinks_, resPSlength_, resPSpitch_, run_regression::ret, KDTreeLinkerAlgo< DATA >::search(), target2ClusterLinks_, targetSet_, treeNeg_, treePos_, x, and detailsBasic3DVector::y.
{ // Must of the code has been taken from LinkByRecHit.cc // We iterate over the PS clusters. for(BlockEltSet::iterator it = targetSet_.begin(); it != targetSet_.end(); it++) { (*it)->setIsValidMultilinks(true); reco::PFClusterRef clusterPSRef = (*it)->clusterRef(); const reco::PFCluster& clusterPS = *clusterPSRef; // PS cluster position, extrapolated to ECAL double zPS = clusterPS.position().Z(); double xPS = clusterPS.position().X(); double yPS = clusterPS.position().Y(); double etaPS = fabs(clusterPS.positionREP().eta()); double deltaX = 0.; double deltaY = 0.; double xPSonEcal = xPS; double yPSonEcal = yPS; if (clusterPS.layer() == PFLayer::PS1) { // PS1 // vertical strips, measure x with pitch precision deltaX = resPSpitch_; deltaY = resPSlength_; xPSonEcal *= ps1ToEcal_; yPSonEcal *= ps1ToEcal_; } else { // PS2 // horizontal strips, measure y with pitch precision deltaY = resPSpitch_; deltaX = resPSlength_; xPSonEcal *= ps2ToEcal_; yPSonEcal *= ps2ToEcal_; } // Estimate the maximal envelope in phi/eta that will be used to find rechit candidates. // Same envelope for cap et barrel rechits. double maxEcalRadius = getCristalXYMaxSize() / 2.; // The inflation factor includes the approximate projection from Preshower to ECAL double inflation = 2.4 - (etaPS-1.6); double rangeX = maxEcalRadius * (1 + (0.05 + 1.0 / maxEcalRadius * deltaX / 2.)) * inflation; double rangeY = maxEcalRadius * (1 + (0.05 + 1.0 / maxEcalRadius * deltaY / 2.)) * inflation; // We search for all candidate recHits, ie all recHits contained in the maximal size envelope. std::vector<KDTreeNodeInfo> recHits; KDTreeBox trackBox(xPSonEcal - rangeX, xPSonEcal + rangeX, yPSonEcal - rangeY, yPSonEcal + rangeY); if (zPS < 0) treeNeg_.search(trackBox, recHits); else treePos_.search(trackBox, recHits); for(std::vector<KDTreeNodeInfo>::const_iterator rhit = recHits.begin(); rhit != recHits.end(); ++rhit) { const std::vector< math::XYZPoint >& corners = rhit->ptr->getCornersXYZ(); if(corners.size() != 4) continue; // Find all clusters associated to given rechit RecHit2BlockEltMap::iterator ret = rechit2ClusterLinks_.find(rhit->ptr); for(BlockEltSet::const_iterator clusterIt = ret->second.begin(); clusterIt != ret->second.end(); clusterIt++) { reco::PFClusterRef clusterref = (*clusterIt)->clusterRef(); double clusterz = clusterref->position().Z(); const math::XYZPoint& posxyz = rhit->ptr->position() * zPS / clusterz; double x[5]; double y[5]; for ( unsigned jc=0; jc<4; ++jc ) { math::XYZPoint cornerpos = corners[jc] * zPS / clusterz; x[jc] = cornerpos.X() + (cornerpos.X()-posxyz.X()) * (0.05 +1.0/fabs((cornerpos.X()-posxyz.X()))*deltaX/2.); y[jc] = cornerpos.Y() + (cornerpos.Y()-posxyz.Y()) * (0.05 +1.0/fabs((cornerpos.Y()-posxyz.Y()))*deltaY/2.); } x[4] = x[0]; y[4] = y[0]; bool isinside = TMath::IsInside(xPS, yPS, 5,x,y); // Check if the track and the cluster are linked if( isinside ) target2ClusterLinks_[*it].insert(*clusterIt); } } } }
void KDTreeLinkerPSEcal::updatePFBlockEltWithLinks | ( | ) | [virtual] |
Implements KDTreeLinkerBase.
Definition at line 207 of file KDTreeLinkerPSEcal.cc.
References reco::PFMultiLinksTC::linkedClusters, and target2ClusterLinks_.
{ //TODO YG : Check if cluster positionREP() is valid ? // Here we save in each track the list of phi/eta values of linked clusters. for (BlockElt2BlockEltMap::iterator it = target2ClusterLinks_.begin(); it != target2ClusterLinks_.end(); ++it) { reco::PFMultiLinksTC multitracks(true); for (BlockEltSet::iterator jt = it->second.begin(); jt != it->second.end(); ++jt) { double clusterPhi = (*jt)->clusterRef()->positionREP().Phi(); double clusterEta = (*jt)->clusterRef()->positionREP().Eta(); multitracks.linkedClusters.push_back(std::make_pair(clusterPhi, clusterEta)); } it->first->setMultilinks(multitracks); } }
Definition at line 56 of file KDTreeLinkerPSEcal.h.
Referenced by clear(), and insertFieldClusterElt().
const double KDTreeLinkerPSEcal::ps1ToEcal_ [private] |
Definition at line 51 of file KDTreeLinkerPSEcal.h.
Referenced by searchLinks().
const double KDTreeLinkerPSEcal::ps2ToEcal_ [private] |
Definition at line 52 of file KDTreeLinkerPSEcal.h.
Referenced by searchLinks().
Definition at line 67 of file KDTreeLinkerPSEcal.h.
Referenced by clear(), insertFieldClusterElt(), and searchLinks().
RecHitSet KDTreeLinkerPSEcal::rechitsNegSet_ [private] |
Definition at line 60 of file KDTreeLinkerPSEcal.h.
Referenced by buildTree(), clear(), and insertFieldClusterElt().
RecHitSet KDTreeLinkerPSEcal::rechitsPosSet_ [private] |
Definition at line 61 of file KDTreeLinkerPSEcal.h.
Referenced by buildTree(), clear(), and insertFieldClusterElt().
const double KDTreeLinkerPSEcal::resPSlength_ [private] |
Definition at line 50 of file KDTreeLinkerPSEcal.h.
Referenced by searchLinks().
const double KDTreeLinkerPSEcal::resPSpitch_ [private] |
Definition at line 49 of file KDTreeLinkerPSEcal.h.
Referenced by searchLinks().
Definition at line 64 of file KDTreeLinkerPSEcal.h.
Referenced by clear(), searchLinks(), and updatePFBlockEltWithLinks().
BlockEltSet KDTreeLinkerPSEcal::targetSet_ [private] |
Definition at line 55 of file KDTreeLinkerPSEcal.h.
Referenced by clear(), insertTargetElt(), and searchLinks().
KDTreeLinkerAlgo KDTreeLinkerPSEcal::treeNeg_ [private] |
Definition at line 70 of file KDTreeLinkerPSEcal.h.
Referenced by buildTree(), clear(), and searchLinks().
KDTreeLinkerAlgo KDTreeLinkerPSEcal::treePos_ [private] |
Definition at line 71 of file KDTreeLinkerPSEcal.h.
Referenced by buildTree(), clear(), and searchLinks().