CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
VertexWeighter Class Reference

#include <VertexWeighter.h>

Public Member Functions

 VertexWeighter ()
 
 VertexWeighter (const double &sigma_init, const double &mean_init, const double &sigma_final, const bool &usemainvtx)
 
 VertexWeighter (const edm::ParameterSet &iConfig)
 
const double weight (const std::vector< float > &zpositions, const float &zmain) const
 

Private Attributes

const bool m_dummy
 
const double m_mean_init
 
const double m_sigma_final
 
const double m_sigma_init
 
const bool m_usemain
 

Detailed Description

Definition at line 10 of file VertexWeighter.h.

Constructor & Destructor Documentation

◆ VertexWeighter() [1/3]

VertexWeighter::VertexWeighter ( )

Definition at line 6 of file VertexWeighter.cc.

7  : m_sigma_init(1.), m_mean_init(0.), m_sigma_final(1.), m_usemain(false), m_dummy(true) {}
const bool m_dummy
const bool m_usemain
const double m_sigma_init
const double m_mean_init
const double m_sigma_final

◆ VertexWeighter() [2/3]

VertexWeighter::VertexWeighter ( const double &  sigma_init,
const double &  mean_init,
const double &  sigma_final,
const bool &  usemainvtx 
)

Definition at line 9 of file VertexWeighter.cc.

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) {}
const bool m_dummy
const bool m_usemain
const double m_sigma_init
const double m_mean_init
const double m_sigma_final

◆ VertexWeighter() [3/3]

VertexWeighter::VertexWeighter ( const edm::ParameterSet iConfig)

Definition at line 19 of file VertexWeighter.cc.

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) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const bool m_dummy
const bool m_usemain
const double m_sigma_init
const double m_mean_init
const double m_sigma_final

Member Function Documentation

◆ weight()

const double VertexWeighter::weight ( const std::vector< float > &  zpositions,
const float &  zmain 
) const

Definition at line 26 of file VertexWeighter.cc.

References JetChargeProducer_cfi::exp, m_dummy, m_mean_init, m_sigma_final, m_sigma_init, m_usemain, and funct::pow().

Referenced by MCVerticesWeight::filter().

26  {
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 }
const bool m_dummy
const bool m_usemain
const double m_sigma_init
const double m_mean_init
const double m_sigma_final
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

Member Data Documentation

◆ m_dummy

const bool VertexWeighter::m_dummy
private

Definition at line 23 of file VertexWeighter.h.

Referenced by weight().

◆ m_mean_init

const double VertexWeighter::m_mean_init
private

Definition at line 20 of file VertexWeighter.h.

Referenced by weight().

◆ m_sigma_final

const double VertexWeighter::m_sigma_final
private

Definition at line 21 of file VertexWeighter.h.

Referenced by weight().

◆ m_sigma_init

const double VertexWeighter::m_sigma_init
private

Definition at line 19 of file VertexWeighter.h.

Referenced by weight().

◆ m_usemain

const bool VertexWeighter::m_usemain
private

Definition at line 22 of file VertexWeighter.h.

Referenced by weight().