CMS 3D CMS Logo

VertexWeighter.cc
Go to the documentation of this file.
2 #include <vector>
3 #include <cmath>
5 
7  : m_sigma_init(1.), m_mean_init(0.), m_sigma_final(1.), m_usemain(false), m_dummy(true) {}
8 
9 VertexWeighter::VertexWeighter(const double& sigma_init,
10  const double& mean_init,
11  const double& sigma_final,
12  const bool& usemainvtx)
13  : m_sigma_init(sigma_init),
14  m_mean_init(mean_init),
15  m_sigma_final(sigma_final),
16  m_usemain(usemainvtx),
17  m_dummy(false) {}
18 
20  : m_sigma_init(iConfig.getParameter<double>("initSigma")),
21  m_mean_init(iConfig.getParameter<double>("initMean")),
22  m_sigma_final(iConfig.getParameter<double>("finalSigma")),
23  m_usemain(iConfig.getParameter<bool>("useMainVertex")),
24  m_dummy(false) {}
25 
26 const double VertexWeighter::weight(const std::vector<float>& zpositions, const float& zmain) const {
27  double final_weight = 1.;
28 
29  if (!m_dummy) {
30  for (std::vector<float>::const_iterator zpos = zpositions.begin(); zpos != zpositions.end(); ++zpos) {
31  final_weight *= (m_sigma_init / m_sigma_final) * exp(-pow((*zpos - m_mean_init), 2) / 2. *
32  (1. / pow(m_sigma_final, 2) - 1. / pow(m_sigma_init, 2)));
33  }
34 
35  if (m_usemain) {
36  final_weight *= (m_sigma_init / m_sigma_final) * exp(-pow((zmain - m_mean_init), 2) / 2. *
37  (1. / pow(m_sigma_final, 2) - 1. / pow(m_sigma_init, 2)));
38  }
39  }
40 
41  return final_weight;
42 }
electrons_cff.bool
bool
Definition: electrons_cff.py:366
funct::false
false
Definition: Factorize.h:29
VertexWeighter::m_dummy
const bool m_dummy
Definition: VertexWeighter.h:23
VertexWeighter.h
VertexWeighter::VertexWeighter
VertexWeighter()
Definition: VertexWeighter.cc:6
funct::true
true
Definition: Factorize.h:173
VertexWeighter::m_sigma_init
const double m_sigma_init
Definition: VertexWeighter.h:19
edm::ParameterSet
Definition: ParameterSet.h:47
VertexWeighter::m_sigma_final
const double m_sigma_final
Definition: VertexWeighter.h:21
VertexWeighter::m_mean_init
const double m_mean_init
Definition: VertexWeighter.h:20
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
ParameterSet.h
VertexWeighter::m_usemain
const bool m_usemain
Definition: VertexWeighter.h:22
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
VertexWeighter::weight
const double weight(const std::vector< float > &zpositions, const float &zmain) const
Definition: VertexWeighter.cc:26