![]() |
![]() |
#include <ProcessNormalization.h>
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 (const ProcessNormalization &other, const char *newname=0) | |
ProcessNormalization (const char *name, const char *title, RooAbsReal &nominal) | |
ProcessNormalization (const char *name, const char *title, double nominal=1) | |
ProcessNormalization () | |
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_ |
Definition at line 17 of file ProcessNormalization.h.
ProcessNormalization::ProcessNormalization | ( | ) | [inline] |
ProcessNormalization::ProcessNormalization | ( | const char * | name, |
const char * | title, | ||
double | nominal = 1 |
||
) |
Definition at line 7 of file ProcessNormalization.cc.
: RooAbsReal(name,title), nominalValue_(nominal), thetaList_("thetaList","List of nuisances for symmetric kappas", this), asymmThetaList_("asymmThetaList","List of nuisances for asymmetric kappas", this), otherFactorList_("otherFactorList","Other multiplicative terms", this) { }
ProcessNormalization::ProcessNormalization | ( | const char * | name, |
const char * | title, | ||
RooAbsReal & | nominal | ||
) |
Definition at line 16 of file ProcessNormalization.cc.
References otherFactorList_.
: RooAbsReal(name,title), nominalValue_(1.0), thetaList_("thetaList", "List of nuisances for symmetric kappas", this), asymmThetaList_("asymmThetaList", "List of nuisances for asymmetric kappas", this), otherFactorList_("otherFactorList", "Other multiplicative terms", this) { otherFactorList_.add(nominal); }
ProcessNormalization::ProcessNormalization | ( | const ProcessNormalization & | other, |
const char * | newname = 0 |
||
) |
Definition at line 26 of file ProcessNormalization.cc.
: RooAbsReal(other, newname ? newname : other.GetName()), nominalValue_(other.nominalValue_), logKappa_(other.logKappa_), thetaList_("thetaList", this, other.thetaList_), logAsymmKappa_(other.logAsymmKappa_), asymmThetaList_("asymmThetaList", this, other.asymmThetaList_), otherFactorList_("otherFactorList", this, other.otherFactorList_) { }
ProcessNormalization::~ProcessNormalization | ( | ) |
Definition at line 37 of file ProcessNormalization.cc.
{}
void ProcessNormalization::addAsymmLogNormal | ( | double | kappaLo, |
double | kappaHi, | ||
RooAbsReal & | theta | ||
) |
Definition at line 46 of file ProcessNormalization.cc.
References addLogNormal(), asymmThetaList_, alignCSCRings::e, funct::log(), and logAsymmKappa_.
{ if (fabs(kappaLo*kappaHi - 1) < 1e-5) { addLogNormal(kappaHi, theta); } else { logAsymmKappa_.push_back(std::make_pair(std::log(kappaLo), std::log(kappaHi))); asymmThetaList_.add(theta); } }
void ProcessNormalization::addLogNormal | ( | double | kappa, |
RooAbsReal & | theta | ||
) |
Definition at line 39 of file ProcessNormalization.cc.
References funct::log(), logKappa_, and thetaList_.
Referenced by addAsymmLogNormal().
{ if (kappa != 0.0 && kappa != 1.0) { logKappa_.push_back(std::log(kappa)); thetaList_.add(theta); } }
void ProcessNormalization::addOtherFactor | ( | RooAbsReal & | factor | ) |
Definition at line 55 of file ProcessNormalization.cc.
References otherFactorList_.
{ otherFactorList_.add(factor); }
TObject* ProcessNormalization::clone | ( | const char * | newname | ) | const [inline] |
Definition at line 25 of file ProcessNormalization.h.
References ProcessNormalization().
{ return new ProcessNormalization(*this, newname); }
void ProcessNormalization::dump | ( | void | ) | const |
Definition at line 106 of file ProcessNormalization.cc.
References gather_cfg::cout, funct::exp(), first, i, logAsymmKappa_, logKappa_, nominalValue_, otherFactorList_, edm::second(), and thetaList_.
{ std::cout << "Dumping ProcessNormalization " << GetName() << " @ " << (void*)this << std::endl; std::cout << "\tnominal value: " << nominalValue_ << std::endl; std::cout << "\tlog-normals (" << logKappa_.size() << "):" << std::endl; for (unsigned int i = 0; i < logKappa_.size(); ++i) { std::cout << "\t\t kappa = " << exp(logKappa_[i]) << ", logKappa = " << logKappa_[i] << ", theta = " << thetaList_.at(i)->GetName() << " = " << ((RooAbsReal*)thetaList_.at(i))->getVal() << std::endl; } std::cout << "\tasymm log-normals (" << logAsymmKappa_.size() << "):" << std::endl; for (unsigned int i = 0; i < logAsymmKappa_.size(); ++i) { std::cout << "\t\t kappaLo = " << exp(logAsymmKappa_[i].first) << ", logKappaLo = " << logAsymmKappa_[i].first << ", kappaHi = " << exp(logAsymmKappa_[i].second) << ", logKappaHi = " << logAsymmKappa_[i].second << ", theta = " << thetaList_.at(i)->GetName() << " = " << ((RooAbsReal*)thetaList_.at(i))->getVal() << std::endl; } std::cout << "\tother terms (" << otherFactorList_.getSize() << "):" << std::endl; for (int i = 0; i < otherFactorList_.getSize(); ++i) { std::cout << "\t\t term " << otherFactorList_.at(i)->GetName() << " (class " << otherFactorList_.at(i)->ClassName() << "), value = " << ((RooAbsReal*)otherFactorList_.at(i))->getVal() << std::endl; } std::cout << std::endl; }
Double_t ProcessNormalization::evaluate | ( | ) | const [protected] |
Definition at line 59 of file ProcessNormalization.cc.
References asymmThetaList_, funct::exp(), logAsymmKappa_, logKappa_, logKappaForX(), nominalValue_, otherFactorList_, theta(), thetaList_, and x.
{ double logVal = 0.0; if (!logKappa_.empty()) { RooLinkedListIter iterTheta = thetaList_.iterator(); std::vector<double>::const_iterator logKappa = logKappa_.begin(); for (RooAbsReal *theta = (RooAbsReal*) iterTheta.Next(); theta != 0; theta = (RooAbsReal*) iterTheta.Next(), ++logKappa) { logVal += theta->getVal() * (*logKappa); } } if (!logAsymmKappa_.empty()) { RooLinkedListIter iterTheta = asymmThetaList_.iterator(); std::vector<std::pair<double,double> >::const_iterator logKappas = logAsymmKappa_.begin(); for (RooAbsReal *theta = (RooAbsReal*) iterTheta.Next(); theta != 0; theta = (RooAbsReal*) iterTheta.Next(), ++logKappas) { double x = theta->getVal(); logVal += x * logKappaForX(x, *logKappas); } } double norm = nominalValue_; if (logVal) norm *= std::exp(logVal); if (otherFactorList_.getSize()) { RooLinkedListIter iterOther = otherFactorList_.iterator(); for (RooAbsReal *fact = (RooAbsReal*) iterOther.Next(); fact != 0; fact = (RooAbsReal*) iterOther.Next()) { norm *= fact->getVal(); } } return norm; }
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 x.
Referenced by evaluate().
{ if (fabs(x) >= 0.5) return (x >= 0 ? logKappas.second : -logKappas.first); // interpolate between log(kappaHigh) and -log(kappaLow) // logKappa(x) = avg + halfdiff * h(2x) // where h(x) is the 3th order polynomial // h(x) = (3 x^5 - 10 x^3 + 15 x)/8; // chosen so that h(x) satisfies the following: // h (+/-1) = +/-1 // h'(+/-1) = 0 // h"(+/-1) = 0 double logKhi = logKappas.second; double logKlo = -logKappas.first; double avg = 0.5*(logKhi + logKlo), halfdiff = 0.5*(logKhi - logKlo); double twox = x+x, twox2 = twox*twox; double alpha = 0.125 * twox * (twox2 * (3*twox2 - 10.) + 15.); double ret = avg + alpha*halfdiff; return ret; }
void ProcessNormalization::setNominalValue | ( | double | nominal | ) | [inline] |
Definition at line 27 of file ProcessNormalization.h.
References nominalValue_.
{ nominalValue_ = nominal; }
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().