CMS 3D CMS Logo

EquidistantSequence.cc
Go to the documentation of this file.
1 #include <cmath>
3 
5 
6 namespace npstat {
8  const double maxScale,
9  const unsigned nScales)
10  : std::vector<double>() {
11  switch (nScales) {
12  case 0:
13  break;
14 
15  case 1: {
16  this->reserve(nScales);
17  const double sc = (minScale == maxScale ? minScale : (minScale + maxScale) / 2.0);
18  push_back(sc);
19  } break;
20 
21  default: {
22  this->reserve(nScales);
23  const double step = (maxScale - minScale) / (nScales - 1);
24  push_back(minScale);
25  for (unsigned i = 1; i < nScales - 1; ++i)
26  push_back(minScale + i * step);
27  push_back(maxScale);
28  } break;
29  }
30  }
31 
32  EquidistantInLogSpace::EquidistantInLogSpace(const double minScale, const double maxScale, const unsigned nScales)
33  : std::vector<double>() {
34  if (nScales)
35  if (!(minScale > 0.0 && maxScale > 0.0))
37  "In npstat::EquidistantInLogSpace constructor: "
38  "minimum and maximum scales must be positive");
39  switch (nScales) {
40  case 0:
41  break;
42 
43  case 1: {
44  this->reserve(nScales);
45  const double sc = (minScale == maxScale ? minScale : sqrt(minScale * maxScale));
46  push_back(sc);
47  } break;
48 
49  default: {
50  this->reserve(nScales);
51  const double logmax = log(maxScale);
52  const double logmin = log(minScale);
53  const double logstep = (logmax - logmin) / (nScales - 1);
54  push_back(minScale);
55  for (unsigned i = 1; i < nScales - 1; ++i)
56  push_back(exp(logmin + i * logstep));
57  push_back(maxScale);
58  } break;
59  }
60  }
61 } // namespace npstat
mps_fire.i
i
Definition: mps_fire.py:355
fftjetcommon_cfi.nScales
nScales
Definition: fftjetcommon_cfi.py:111
EquidistantSequence.h
Equidistant sequences of points in either linear or log space.
step
step
Definition: StallMonitor.cc:94
fftjetcommon_cfi.maxScale
maxScale
Definition: fftjetcommon_cfi.py:110
npstat
Definition: AbsArrayProjector.h:14
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
npstat::EquidistantInLinearSpace::EquidistantInLinearSpace
EquidistantInLinearSpace()=delete
npstat::NpstatInvalidArgument
Definition: NpstatException.h:38
fftjetcommon_cfi.minScale
minScale
Definition: fftjetcommon_cfi.py:109
std
Definition: JetResolutionObject.h:76
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
npstat::EquidistantInLogSpace::EquidistantInLogSpace
EquidistantInLogSpace()=delete
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
NpstatException.h
Exceptions for the npstat namespace.