CMS 3D CMS Logo

FsmwModeFinder3d.cc
Go to the documentation of this file.
3 
4 #include <cmath>
5 #include <cassert>
6 
10 FsmwModeFinder3d::FsmwModeFinder3d(float fraction, float weightExp, float cutoff, int no_w_a)
11  : theFraction(fraction), theWeightExponent(weightExp), theCutoff(cutoff), theNoWeightsAbove(no_w_a) {
12  assert(theFraction > 0. && theFraction < 1.);
13 }
14 
15 GlobalPoint FsmwModeFinder3d::operator()(const std::vector<PointAndDistance>& values) const {
16  typedef Cluster1D<void> SimpleCluster;
17  std::vector<SimpleCluster> vx, vy, vz;
18  vx.reserve(values.size() - 1);
19  vy.reserve(values.size() - 1);
20  vz.reserve(values.size() - 1);
21  std::vector<const void*> emptyvec;
22 
23  for (std::vector<PointAndDistance>::const_iterator i = values.begin(); i != values.end(); ++i) {
24  float weight = 1.;
25  if (static_cast<int>(values.size()) < theNoWeightsAbove) {
26  // compute weights if we have fewer than theNoWeightsAbove
27  // data points
28  weight = pow(theCutoff + 10000 * i->second, theWeightExponent);
29  };
30 
31  SimpleCluster tmp_x(Measurement1D(i->first.x(), 1.0), emptyvec, weight);
32  SimpleCluster tmp_y(Measurement1D(i->first.y(), 1.0), emptyvec, weight);
33  SimpleCluster tmp_z(Measurement1D(i->first.z(), 1.0), emptyvec, weight);
34  vx.push_back(tmp_x);
35  vy.push_back(tmp_y);
36  vz.push_back(tmp_z);
37  };
38 
40  std::vector<SimpleCluster> cresx = algo(vx).first;
41  std::vector<SimpleCluster> cresy = algo(vy).first;
42  std::vector<SimpleCluster> cresz = algo(vz).first;
43  assert(!cresx.empty() && !cresy.empty() && !cresz.empty());
44 
46  cresx.begin()->position().value(), cresy.begin()->position().value(), cresz.begin()->position().value());
47  return ret;
48 }
49 
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:543
FsmwModeFinder3d::theFraction
float theFraction
Definition: FsmwModeFinder3d.h:34
Measurement1D
Definition: Measurement1D.h:11
mps_fire.i
i
Definition: mps_fire.py:428
Cluster1D
Definition: Cluster1D.h:13
FsmwModeFinder3d::operator()
GlobalPoint operator()(const std::vector< PointAndDistance > &) const override
Definition: FsmwModeFinder3d.cc:15
mps_merge.weight
weight
Definition: mps_merge.py:88
FsmwModeFinder3d.h
cms::cuda::assert
assert(be >=bs)
cmsdt::algo
algo
Definition: constants.h:171
HLT_FULL_cff.fraction
fraction
Definition: HLT_FULL_cff.py:52823
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
FsmwModeFinder3d::theWeightExponent
float theWeightExponent
Definition: FsmwModeFinder3d.h:35
Point3DBase< float, GlobalTag >
FsmwClusterizer1D
Definition: FsmwClusterizer1D.h:17
FsmwModeFinder3d::theNoWeightsAbove
int theNoWeightsAbove
Definition: FsmwModeFinder3d.h:37
FsmwModeFinder3d::FsmwModeFinder3d
FsmwModeFinder3d(float fraction=.5, float weightExponent=-2., float cutoff=10, int no_weights_above=10)
Definition: FsmwModeFinder3d.cc:10
FsmwModeFinder3d::theCutoff
float theCutoff
Definition: FsmwModeFinder3d.h:36
EcalSCDynamicDPhiParametersESProducer_cfi.cutoff
cutoff
Definition: EcalSCDynamicDPhiParametersESProducer_cfi.py:15
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
FsmwModeFinder3d::clone
FsmwModeFinder3d * clone() const override
Definition: FsmwModeFinder3d.cc:50
FsmwClusterizer1D.h
weight
Definition: weight.py:1
FsmwModeFinder3d
Definition: FsmwModeFinder3d.h:12