7 #include "Math/GenVector/VectorUtil.h"
10 #include "vdt/vdtMath.h"
13 #include <unordered_map>
28 const std::vector<bool>&,
49 unsigned int to()
const {
return to_; }
64 const std::vector<double>&,
65 const std::vector<double>&);
66 std::vector<ClusterLink>
prune(std::vector<ClusterLink>&, std::vector<bool>& linkedClusters);
70 std::vector<bool>& mask,
72 const std::vector<ClusterLink>&
links);
81 if (conf.
exists(
"allCellsPositionCalc")) {
92 const std::vector<bool>& seedable,
94 std::vector<double> etaRMS2(input.size(), 0.0);
95 std::vector<double> phiRMS2(input.size(), 0.0);
105 auto&&
links =
link(input, etaRMS2, phiRMS2);
109 std::vector<bool> mask(input.size(),
false);
110 std::vector<bool> linked(input.size(),
false);
120 for (
unsigned int i = 0;
i < input.size(); ++
i) {
126 output.push_back(input[i]);
137 output.push_back(cluster);
143 std::vector<double>& etaRMS2,
144 std::vector<double>& phiRMS2) {
147 for (
unsigned int i = 0;
i < clusters.size(); ++
i) {
153 auto const&
h = *
frac.recHitRef();
154 auto const&
rep =
h.positionREP();
155 etaSum += (
frac.fraction() *
h.energy()) *
std::abs(
rep.eta() - crep.eta());
160 etaRMS2[
i] *= etaRMS2[
i];
162 phiRMS2[
i] *= phiRMS2[
i];
168 std::vector<ClusterLink>
links;
170 for (
unsigned int i = 0;
i < clusters.size(); ++
i)
171 for (
unsigned int j = 0;
j < clusters.size(); ++
j) {
179 auto dz = (
static_cast<int>(cluster2.
depth()) - static_cast<int>(cluster1.
depth()));
188 auto deta = crep1.eta() - crep2.eta();
189 deta = deta * deta / (etaRMS2[
i] + etaRMS2[
j]);
190 auto dphi =
deltaPhi(crep1.phi(), crep2.phi());
191 dphi = dphi * dphi / (phiRMS2[
i] + phiRMS2[
j]);
203 std::vector<bool>& linkedClusters) {
204 std::vector<ClusterLink> goodLinks;
205 std::vector<bool> mask(links.size(),
false);
209 for (
unsigned int i = 0;
i < links.size() - 1; ++
i) {
212 for (
unsigned int j = i + 1;
j < links.size(); ++
j) {
219 if (link1.
to() == link2.
to()) {
221 if (link1.
dZ() < link2.
dZ()) {
223 }
else if (link1.
dZ() > link2.
dZ()) {
226 if (link1.
dR() < link2.
dR()) {
228 }
else if (link1.
dR() > link2.
dR()) {
242 for (
unsigned int i = 0;
i < links.size(); ++
i) {
245 goodLinks.push_back(links[i]);
246 linkedClusters[links[
i].from()] =
true;
247 linkedClusters[links[
i].to()] =
true;
260 e1 =
fraction.recHitRef()->energy();
266 e2 =
fraction.recHitRef()->energy();
275 std::vector<bool>& mask,
277 const std::vector<ClusterLink>&
links) {
278 for (
const auto&
link : links) {
281 if (!mask[
link.from()]) {
283 mask[
link.from()] =
true;
286 if (!mask[
link.to()]) {
288 mask[
link.to()] =
true;
294 if (!mask[
link.to()]) {
296 mask[
link.to()] =
true;
299 if (!mask[
link.from()]) {
301 mask[
link.from()] =
true;
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
B2DGPF & operator=(const B2DGPF &)=delete
std::vector< ClusterLink > prune(std::vector< ClusterLink > &, std::vector< bool > &linkedClusters)
static std::string const input
void setSeed(const DetId &id)
unsigned int from() const
std::unique_ptr< PFCPositionCalculatorBase > _allCellsPosCalc
void absorbCluster(reco::PFCluster &, const reco::PFCluster &)
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
void update(const edm::EventSetup &es) override
PFMultiDepthClusterizer(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
DetId seed() const
return DetId of seed
ParameterSet const & getParameterSet(std::string const &) const
T getParameter(std::string const &) const
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
~PFMultiDepthClusterizer() override=default
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects
#define DEFINE_EDM_PLUGIN(factory, type, name)
ClusterLink(unsigned int i, unsigned int j, double DR, int DZ, double energy)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void buildClusters(const reco::PFClusterCollection &, const std::vector< bool > &, reco::PFClusterCollection &outclus) override
Power< A, B >::type pow(const A &a, const B &b)
*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
PFMultiDepthClusterizer B2DGPF
void expandCluster(reco::PFCluster &, unsigned int point, std::vector< bool > &mask, const reco::PFClusterCollection &, const std::vector< ClusterLink > &links)
double depth() const
cluster depth