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> etaRMS(input.size(),0.0);
41 std::vector<double> phiRMS(input.size(),0.0);
53 std::vector<ClusterLink>
links =
link(input,etaRMS,phiRMS);
59 std::vector<bool> mask(input.size(),
false);
60 std::vector<bool> linked(input.size(),
false);
63 std::vector<ClusterLink> prunedLinks;
65 prunedLinks =
prune(links,linked);
74 for (
unsigned int i=0;
i<input.size();++
i) {
80 output.push_back(input[i]);
92 output.push_back(cluster);
106 for(
unsigned int i=0;
i<clusters.size();++
i ) {
108 etaSum=0.0;phiSum=0.0;
110 etaSum +=
frac.fraction()*
frac.recHitRef()->energy()*fabs(
frac.recHitRef()->position().Eta() -cluster.
position().Eta() );
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) {
135 float dz = (cluster2.
depth() - cluster1.
depth());
138 if (dz<0.0 || fabs(dz)<0.2)
154 prune(std::vector<ClusterLink>&
links,std::vector<bool>& linkedClusters) {
155 std::vector<ClusterLink> goodLinks ;
156 std::vector<bool> mask(links.size(),
false);
158 for (
unsigned int i=0;
i<links.size()-1;++
i) {
161 for (
unsigned int j=i+1;
j<links.size();++
j) {
169 if (link1.
to() == link2.
to()) {
171 if (link1.
dZ() < link2.
dZ()) {
174 else if (link1.
dZ() > link2.
dZ()) {
177 else if (fabs(link1.
dZ()-link2.
dZ())<0.2) {
178 if (link1.
dR()<link2.
dR()) {
181 else if (link1.
dR()>link2.
dR()) {
197 for (
unsigned int i=0;
i<links.size();++
i) {
200 goodLinks.push_back(links[i]);
201 linkedClusters[links[
i].from()]=
true;
202 linkedClusters[links[
i].to()]=
true;
219 if (fraction.recHitRef()->detId() == main.
seed()) {
220 e1=fraction.recHitRef()->energy();
225 if (fraction.recHitRef()->detId() == added.
seed()) {
226 e2=fraction.recHitRef()->energy();
238 for (
const auto&
link : links) {
241 if (!mask[
link.from()]) {
243 mask[
link.from()] =
true;
246 if (!mask[
link.to()]) {
248 mask[
link.to()]=
true;
254 if (!mask[
link.to()]) {
256 mask[
link.to()] =
true;
259 if (!mask[
link.from()]) {
261 mask[
link.from()]=
true;
T getParameter(std::string const &) const
void calculateShowerShapes(const reco::PFClusterCollection &, std::vector< double > &, std::vector< double > &)
const math::XYZPoint & position() const
cluster centroid position
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void buildClusters(const reco::PFClusterCollection &, const std::vector< bool > &, reco::PFClusterCollection &outclus)
std::vector< ClusterLink > prune(std::vector< ClusterLink > &, std::vector< bool > &linkedClusters)
static std::string const input
void setSeed(const DetId &id)
int main(int argc, char **argv)
std::unique_ptr< PFCPositionCalculatorBase > _allCellsPosCalc
void absorbCluster(reco::PFCluster &, const reco::PFCluster &)
PFMultiDepthClusterizer(const edm::ParameterSet &conf)
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
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