6 #include "Math/GenVector/VectorUtil.h" 8 #include "vdt/vdtMath.h" 20 if( conf.
exists(
"allCellsPositionCalc") ) {
37 const std::vector<bool>& seedable,
40 std::vector<double> etaRMS2(input.size(),0.0);
41 std::vector<double> phiRMS2(input.size(),0.0);
53 auto && links =
link(input,etaRMS2,phiRMS2);
59 std::vector<bool>
mask(input.size(),
false);
60 std::vector<bool> linked(input.size(),
false);
63 auto && prunedLinks =
prune(links,linked);
72 for (
unsigned int i=0;
i<input.size();++
i) {
78 output.push_back(input[i]);
90 output.push_back(cluster);
102 for(
unsigned int i=0;
i<clusters.size();++
i ) {
104 double etaSum=0.0;
double phiSum=0.0;
107 auto const &
h = *
frac.recHitRef();
108 auto const &
rep =
h.positionREP();
114 etaRMS2[
i]*= etaRMS2[
i];
116 phiRMS2[
i]*=phiRMS2[
i];
125 std::vector<ClusterLink> links;
127 for (
unsigned int i=0;
i<clusters.size();++
i)
128 for (
unsigned int j=0;j<clusters.size();++j) {
142 auto deta = crep1.eta()-crep2.eta();
143 deta = deta*deta/(etaRMS2[
i]+etaRMS2[j]);
144 auto dphi =
deltaPhi(crep1.phi(),crep2.phi());
145 dphi = dphi*dphi/(phiRMS2[
i]+phiRMS2[j]);
157 prune(std::vector<ClusterLink>& links,std::vector<bool>& linkedClusters) {
158 std::vector<ClusterLink> goodLinks ;
159 std::vector<bool>
mask(links.size(),
false);
160 if (links.empty())
return goodLinks;
162 for (
unsigned int i=0;
i<links.size()-1;++
i) {
165 for (
unsigned int j=i+1;j<links.size();++j) {
172 if (link1.
to() == link2.
to()) {
174 if (link1.
dZ() < link2.
dZ()) {
177 else if (link1.
dZ() > link2.
dZ()) {
180 else if (fabs(link1.
dZ()-link2.
dZ())<0.2) {
181 if (link1.
dR()<link2.
dR()) {
184 else if (link1.
dR()>link2.
dR()) {
200 for (
unsigned int i=0;
i<links.size();++
i) {
203 goodLinks.push_back(links[i]);
204 linkedClusters[links[
i].from()]=
true;
205 linkedClusters[links[
i].to()]=
true;
241 for (
const auto&
link : links) {
244 if (!mask[
link.from()]) {
246 mask[
link.from()] =
true;
249 if (!mask[
link.to()]) {
251 mask[
link.to()]=
true;
257 if (!mask[
link.to()]) {
259 mask[
link.to()] =
true;
262 if (!mask[
link.from()]) {
264 mask[
link.from()]=
true;
T getParameter(std::string const &) const
void calculateShowerShapes(const reco::PFClusterCollection &, std::vector< double > &, std::vector< double > &)
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< ClusterLink > prune(std::vector< ClusterLink > &, std::vector< bool > &linkedClusters)
static std::string const input
void setSeed(const DetId &id)
std::unique_ptr< PFCPositionCalculatorBase > _allCellsPosCalc
void absorbCluster(reco::PFCluster &, const reco::PFCluster &)
PFMultiDepthClusterizer(const edm::ParameterSet &conf)
const REPPoint & positionREP() const
cluster position: rho, eta, phi
Abs< T >::type abs(const T &t)
std::vector< ClusterLink > link(const reco::PFClusterCollection &, const std::vector< double > &, const std::vector< double > &)
double energy() const
cluster energy
DetId seed() const
return DetId of seed
ParameterSet const & getParameterSet(std::string const &) const
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
void buildClusters(const reco::PFClusterCollection &, const std::vector< bool > &, reco::PFClusterCollection &outclus) override
Power< A, B >::type pow(const A &a, const B &b)
T get(const Candidate &c)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
void expandCluster(reco::PFCluster &, unsigned int point, std::vector< bool > &mask, const reco::PFClusterCollection &, const std::vector< ClusterLink > &links)
double depth() const
cluster depth