CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
ProcessNormalization Class Reference

#include <ProcessNormalization.h>

Inheritance diagram for ProcessNormalization:

Public Member Functions

void addAsymmLogNormal (double kappaLo, double kappaHi, RooAbsReal &theta)
 
void addLogNormal (double kappa, RooAbsReal &theta)
 
void addOtherFactor (RooAbsReal &factor)
 
TObject * clone (const char *newname) const
 
void dump () const
 
 ProcessNormalization ()
 
 ProcessNormalization (const char *name, const char *title, double nominal=1)
 
 ProcessNormalization (const char *name, const char *title, RooAbsReal &nominal)
 
 ProcessNormalization (const ProcessNormalization &other, const char *newname=0)
 
void setNominalValue (double nominal)
 
 ~ProcessNormalization ()
 

Protected Member Functions

Double_t evaluate () const
 

Private Member Functions

Double_t logKappaForX (double x, const std::pair< double, double > &logKappas) const
 

Private Attributes

RooListProxy asymmThetaList_
 
std::vector< std::pair< double,
double > > 
logAsymmKappa_
 
std::vector< double > logKappa_
 
double nominalValue_
 
RooListProxy otherFactorList_
 
RooListProxy thetaList_
 

Detailed Description

Definition at line 17 of file ProcessNormalization.h.

Constructor & Destructor Documentation

ProcessNormalization::ProcessNormalization ( )
inline

Definition at line 19 of file ProcessNormalization.h.

Referenced by clone().

ProcessNormalization::ProcessNormalization ( const char *  name,
const char *  title,
double  nominal = 1 
)

Definition at line 7 of file ProcessNormalization.cc.

7  :
8  RooAbsReal(name,title),
9  nominalValue_(nominal),
10  thetaList_("thetaList","List of nuisances for symmetric kappas", this),
11  asymmThetaList_("asymmThetaList","List of nuisances for asymmetric kappas", this),
12  otherFactorList_("otherFactorList","Other multiplicative terms", this)
13 {
14 }
ProcessNormalization::ProcessNormalization ( const char *  name,
const char *  title,
RooAbsReal &  nominal 
)

Definition at line 16 of file ProcessNormalization.cc.

References otherFactorList_.

16  :
17  RooAbsReal(name,title),
18  nominalValue_(1.0),
19  thetaList_("thetaList", "List of nuisances for symmetric kappas", this),
20  asymmThetaList_("asymmThetaList", "List of nuisances for asymmetric kappas", this),
21  otherFactorList_("otherFactorList", "Other multiplicative terms", this)
22 {
23  otherFactorList_.add(nominal);
24 }
ProcessNormalization::ProcessNormalization ( const ProcessNormalization other,
const char *  newname = 0 
)

Definition at line 26 of file ProcessNormalization.cc.

26  :
27  RooAbsReal(other, newname ? newname : other.GetName()),
29  logKappa_(other.logKappa_),
30  thetaList_("thetaList", this, other.thetaList_),
32  asymmThetaList_("asymmThetaList", this, other.asymmThetaList_),
33  otherFactorList_("otherFactorList", this, other.otherFactorList_)
34 {
35 }
std::vector< double > logKappa_
std::vector< std::pair< double, double > > logAsymmKappa_
ProcessNormalization::~ProcessNormalization ( )

Definition at line 37 of file ProcessNormalization.cc.

37 {}

Member Function Documentation

void ProcessNormalization::addAsymmLogNormal ( double  kappaLo,
double  kappaHi,
RooAbsReal &  theta 
)

Definition at line 46 of file ProcessNormalization.cc.

References addLogNormal(), asymmThetaList_, alignCSCRings::e, create_public_lumi_plots::log, and logAsymmKappa_.

46  {
47  if (fabs(kappaLo*kappaHi - 1) < 1e-5) {
48  addLogNormal(kappaHi, theta);
49  } else {
50  logAsymmKappa_.push_back(std::make_pair(std::log(kappaLo), std::log(kappaHi)));
52  }
53 }
void addLogNormal(double kappa, RooAbsReal &theta)
Geom::Theta< T > theta() const
std::vector< std::pair< double, double > > logAsymmKappa_
void ProcessNormalization::addLogNormal ( double  kappa,
RooAbsReal &  theta 
)

Definition at line 39 of file ProcessNormalization.cc.

References create_public_lumi_plots::log, logKappa_, and thetaList_.

Referenced by addAsymmLogNormal().

39  {
40  if (kappa != 0.0 && kappa != 1.0) {
41  logKappa_.push_back(std::log(kappa));
42  thetaList_.add(theta);
43  }
44 }
Geom::Theta< T > theta() const
std::vector< double > logKappa_
void ProcessNormalization::addOtherFactor ( RooAbsReal &  factor)

Definition at line 55 of file ProcessNormalization.cc.

References otherFactorList_.

55  {
56  otherFactorList_.add(factor);
57 }
TObject* ProcessNormalization::clone ( const char *  newname) const
inline

Definition at line 25 of file ProcessNormalization.h.

References ProcessNormalization().

25 { return new ProcessNormalization(*this, newname); }
void ProcessNormalization::dump ( void  ) const

Definition at line 106 of file ProcessNormalization.cc.

References gather_cfg::cout, create_public_lumi_plots::exp, first, i, logAsymmKappa_, logKappa_, nominalValue_, otherFactorList_, edm::second(), and thetaList_.

106  {
107  std::cout << "Dumping ProcessNormalization " << GetName() << " @ " << (void*)this << std::endl;
108  std::cout << "\tnominal value: " << nominalValue_ << std::endl;
109  std::cout << "\tlog-normals (" << logKappa_.size() << "):" << std::endl;
110  for (unsigned int i = 0; i < logKappa_.size(); ++i) {
111  std::cout << "\t\t kappa = " << exp(logKappa_[i]) << ", logKappa = " << logKappa_[i] <<
112  ", theta = " << thetaList_.at(i)->GetName() << " = " << ((RooAbsReal*)thetaList_.at(i))->getVal() << std::endl;
113  }
114  std::cout << "\tasymm log-normals (" << logAsymmKappa_.size() << "):" << std::endl;
115  for (unsigned int i = 0; i < logAsymmKappa_.size(); ++i) {
116  std::cout << "\t\t kappaLo = " << exp(logAsymmKappa_[i].first) << ", logKappaLo = " << logAsymmKappa_[i].first <<
117  ", kappaHi = " << exp(logAsymmKappa_[i].second) << ", logKappaHi = " << logAsymmKappa_[i].second <<
118  ", theta = " << thetaList_.at(i)->GetName() << " = " << ((RooAbsReal*)thetaList_.at(i))->getVal() << std::endl;
119  }
120  std::cout << "\tother terms (" << otherFactorList_.getSize() << "):" << std::endl;
121  for (int i = 0; i < otherFactorList_.getSize(); ++i) {
122  std::cout << "\t\t term " << otherFactorList_.at(i)->GetName() <<
123  " (class " << otherFactorList_.at(i)->ClassName() <<
124  "), value = " << ((RooAbsReal*)otherFactorList_.at(i))->getVal() << std::endl;
125  }
126  std::cout << std::endl;
127 }
int i
Definition: DBlmapReader.cc:9
U second(std::pair< T, U > const &p)
std::vector< double > logKappa_
bool first
Definition: L1TdeRCT.cc:94
std::vector< std::pair< double, double > > logAsymmKappa_
tuple cout
Definition: gather_cfg.py:121
Double_t ProcessNormalization::evaluate ( ) const
protected

Definition at line 59 of file ProcessNormalization.cc.

References asymmThetaList_, create_public_lumi_plots::exp, logAsymmKappa_, logKappa_, logKappaForX(), nominalValue_, otherFactorList_, theta(), thetaList_, and vdt::x.

59  {
60  double logVal = 0.0;
61  if (!logKappa_.empty()) {
62  RooLinkedListIter iterTheta = thetaList_.iterator();
63  std::vector<double>::const_iterator logKappa = logKappa_.begin();
64  for (RooAbsReal *theta = (RooAbsReal*) iterTheta.Next(); theta != 0; theta = (RooAbsReal*) iterTheta.Next(), ++logKappa) {
65  logVal += theta->getVal() * (*logKappa);
66  }
67  }
68  if (!logAsymmKappa_.empty()) {
69  RooLinkedListIter iterTheta = asymmThetaList_.iterator();
70  std::vector<std::pair<double,double> >::const_iterator logKappas = logAsymmKappa_.begin();
71  for (RooAbsReal *theta = (RooAbsReal*) iterTheta.Next(); theta != 0; theta = (RooAbsReal*) iterTheta.Next(), ++logKappas) {
72  double x = theta->getVal();
73  logVal += x * logKappaForX(x, *logKappas);
74  }
75  }
76  double norm = nominalValue_;
77  if (logVal) norm *= std::exp(logVal);
78  if (otherFactorList_.getSize()) {
79  RooLinkedListIter iterOther = otherFactorList_.iterator();
80  for (RooAbsReal *fact = (RooAbsReal*) iterOther.Next(); fact != 0; fact = (RooAbsReal*) iterOther.Next()) {
81  norm *= fact->getVal();
82  }
83  }
84  return norm;
85 }
Double_t logKappaForX(double x, const std::pair< double, double > &logKappas) const
Geom::Theta< T > theta() const
std::vector< double > logKappa_
std::vector< std::pair< double, double > > logAsymmKappa_
x
Definition: VDTMath.h:216
Double_t ProcessNormalization::logKappaForX ( double  x,
const std::pair< double, double > &  logKappas 
) const
private

Definition at line 87 of file ProcessNormalization.cc.

References alpha, run_regression::ret, and vdt::x.

Referenced by evaluate().

87  {
88  if (fabs(x) >= 0.5) return (x >= 0 ? logKappas.second : -logKappas.first);
89  // interpolate between log(kappaHigh) and -log(kappaLow)
90  // logKappa(x) = avg + halfdiff * h(2x)
91  // where h(x) is the 3th order polynomial
92  // h(x) = (3 x^5 - 10 x^3 + 15 x)/8;
93  // chosen so that h(x) satisfies the following:
94  // h (+/-1) = +/-1
95  // h'(+/-1) = 0
96  // h"(+/-1) = 0
97  double logKhi = logKappas.second;
98  double logKlo = -logKappas.first;
99  double avg = 0.5*(logKhi + logKlo), halfdiff = 0.5*(logKhi - logKlo);
100  double twox = x+x, twox2 = twox*twox;
101  double alpha = 0.125 * twox * (twox2 * (3*twox2 - 10.) + 15.);
102  double ret = avg + alpha*halfdiff;
103  return ret;
104 }
float alpha
Definition: AMPTWrapper.h:95
x
Definition: VDTMath.h:216
void ProcessNormalization::setNominalValue ( double  nominal)
inline

Definition at line 27 of file ProcessNormalization.h.

References nominalValue_.

27 { nominalValue_ = nominal; }

Member Data Documentation

RooListProxy ProcessNormalization::asymmThetaList_
private

Definition at line 41 of file ProcessNormalization.h.

Referenced by addAsymmLogNormal(), and evaluate().

std::vector<std::pair<double,double> > ProcessNormalization::logAsymmKappa_
private

Definition at line 40 of file ProcessNormalization.h.

Referenced by addAsymmLogNormal(), dump(), and evaluate().

std::vector<double> ProcessNormalization::logKappa_
private

Definition at line 38 of file ProcessNormalization.h.

Referenced by addLogNormal(), dump(), and evaluate().

double ProcessNormalization::nominalValue_
private

Definition at line 37 of file ProcessNormalization.h.

Referenced by dump(), evaluate(), and setNominalValue().

RooListProxy ProcessNormalization::otherFactorList_
private

Definition at line 42 of file ProcessNormalization.h.

Referenced by addOtherFactor(), dump(), evaluate(), and ProcessNormalization().

RooListProxy ProcessNormalization::thetaList_
private

Definition at line 39 of file ProcessNormalization.h.

Referenced by addLogNormal(), dump(), and evaluate().