6 #include "Math/GenVector/VectorUtil.h"
8 #include "vdt/vdtMath.h"
13 #define LOGVERB(x) edm::LogVerbatim(x)
14 #define LOGWARN(x) edm::LogWarning(x)
15 #define LOGERR(x) edm::LogError(x)
16 #define LOGDRESSED(x) edm::LogInfo(x)
18 #define LOGVERB(x) LogTrace(x)
19 #define LOGWARN(x) edm::LogWarning(x)
20 #define LOGERR(x) edm::LogError(x)
21 #define LOGDRESSED(x) LogDebug(x)
26 _maxIterations(conf.getParameter<unsigned>(
"maxIterations")),
27 _stoppingTolerance(conf.getParameter<double>(
"stoppingTolerance")),
28 _showerSigma2(
std::
pow(conf.getParameter<double>(
"showerSigma"), 2.0)),
29 _excludeOtherSeeds(conf.getParameter<
bool>(
"excludeOtherSeeds")),
30 _minFracTot(conf.getParameter<double>(
"minFracTot")),
42 const std::vector<edm::ParameterSet>&
thresholds = conf.getParameterSetVector(
"recHitEnergyNorms");
47 std::vector<double> rhE_norm;
50 depths =
pset.getParameter<std::vector<int> >(
"depths");
51 rhE_norm =
pset.getParameter<std::vector<double> >(
"recHitEnergyNorm");
54 rhE_norm.push_back(
pset.getParameter<
double>(
"recHitEnergyNorm"));
57 if (rhE_norm.size() !=
depths.size()) {
59 <<
"PFlowClusterizerThreshold mismatch with the numbers of depths";
62 auto entry = _layerMap.find(det);
63 if (
entry == _layerMap.end()) {
64 throw cms::Exception(
"InvalidDetectorLayer") <<
"Detector layer : " << det <<
" is not in the list of recognized"
65 <<
" detector layers!";
67 _recHitEnergyNorms.emplace(_layerMap.find(det)->second, std::make_pair(
depths, rhE_norm));
70 if (conf.exists(
"allCellsPositionCalc")) {
76 if (conf.exists(
"positionCalcForConvergence")) {
84 const std::vector<bool>& seedable,
87 for (
const auto& topocluster :
input) {
88 clustersInTopo.clear();
90 const unsigned tolScal =
std::pow(
std::max(1.0, clustersInTopo.size() - 1.0), 2.0);
91 growPFClusters(topocluster, seedable, tolScal, 0, tolScal, clustersInTopo);
107 for (
auto& clusterout : clustersInTopo) {
114 const std::vector<bool>& seedable,
117 for (
const auto& rhf : recHitFractions) {
118 if (!seedable[rhf.recHitRef().key()])
123 current.
setSeed(rhf.recHitRef()->detId());
133 const std::vector<bool>& seedable,
134 const unsigned toleranceScaling,
139 LOGDRESSED(
"Basic2DGenericPFlowClusterizer:growAndStabilizePFClusters")
140 <<
"reached " <<
_maxIterations <<
" iterations, terminated position "
141 <<
"fit with diff = " <<
diff;
146 std::vector<reco::PFCluster::REPPoint> clus_prev_pos;
149 clus_prev_pos.emplace_back(repp.rho(), repp.eta(), repp.phi());
157 cluster.resetHitsAndFractions();
160 std::vector<double> dist2,
frac;
164 int cell_layer = (
int)refhit->layer();
177 for (
unsigned int j = 0;
j < recHitEnergyNormDepthPair.second.size(); ++
j) {
178 int depth = recHitEnergyNormDepthPair.first[
j];
191 dist2.emplace_back(d2);
193 LOGDRESSED(
"Basic2DGenericPFlowClusterizer:growAndStabilizePFClusters")
194 <<
"Warning! :: pfcluster-topocell distance is too large! d= " << d2;
226 if (dist2[
i] < 100.0 ||
frac[
i] > 0.9999) {
250 clus_prev_pos.clear();