Go to the documentation of this file.00001 #include "../interface/AsymPow.h"
00002
00003 #include <cmath>
00004 #include <cassert>
00005 #include <cstdio>
00006
00007 AsymPow::AsymPow(const char *name, const char *title, RooAbsReal &kappaLow, RooAbsReal &kappaHigh, RooAbsReal &theta) :
00008 RooAbsReal(name,title),
00009 kappaLow_("kappaLow","Base for theta < 0", this, kappaLow),
00010 kappaHigh_("kappaHigh","Base for theta > 0", this, kappaHigh),
00011 theta_("theta", "Exponent (unit gaussian)", this, theta)
00012 { }
00013
00014 AsymPow::~AsymPow() {}
00015
00016 TObject *AsymPow::clone(const char *newname) const
00017 {
00018
00019 return new AsymPow(newname, this->GetTitle(),
00020 const_cast<RooAbsReal &>(kappaLow_.arg()),
00021 const_cast<RooAbsReal &>(kappaHigh_.arg()),
00022 const_cast<RooAbsReal &>(theta_.arg()));
00023 }
00024
00025 Double_t AsymPow::evaluate() const {
00026 Double_t x = theta_;
00027 return exp(logKappaForX(x) * x);
00028 }
00029
00030 Double_t AsymPow::logKappaForX(Double_t x) const {
00031 #if 0
00032
00033 return (x >= 0 ? log(kappaHigh_) : - log(kappaLow_));
00034 #else
00035 if (fabs(x) >= 0.5) return (x >= 0 ? log(kappaHigh_) : - log(kappaLow_));
00036
00037
00038
00039
00040
00041
00042
00043
00044 double logKhi = log(kappaHigh_);
00045 double logKlo = -log(kappaLow_);
00046 double avg = 0.5*(logKhi + logKlo), halfdiff = 0.5*(logKhi - logKlo);
00047 double twox = x+x, twox2 = twox*twox;
00048 double alpha = 0.125 * twox * (twox2 * (3*twox2 - 10.) + 15.);
00049 double ret = avg + alpha*halfdiff;
00050
00051 return ret;
00052 #endif
00053 }
00054
00055 ClassImp(AsymPow)