00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "Riostream.h"
00025 #include "TMath.h"
00026
00027 #include "RooFitCore/RooAbsReal.hh"
00028 #include "RooFitCore/RooRealVar.hh"
00029
00030
00031 #include "RooRarFit/RooThreshold.hh"
00032
00033 ClassImp(RooThreshold)
00034
00035
00036 RooThreshold::RooThreshold(const char *name, const char *title,
00037 RooAbsReal& _x, RooAbsReal& _m0,
00038 RooAbsReal& _power, const RooArgList& _coeffs) :
00039 RooAbsPdf(name,title),
00040 x("x","Dependent",this,_x),
00041 m0("mean","Mean",this,_m0),
00042 power("power","power",this,_power),
00043 coeffs("coeffs","coeffs",this)
00044 {
00045
00046 TIterator* coefIter = _coeffs.createIterator() ;
00047 RooAbsArg* coef(0) ;
00048 while ((coef = (RooAbsArg*)coefIter->Next())) {
00049 if (!dynamic_cast<RooAbsReal*>(coef)) {
00050 cout << "RooTheshold::ctor(" << GetName() << ") ERROR: coefficient " << coef->GetName()
00051 << " is not of type RooAbsReal" << endl ;
00052 assert(0) ;
00053 }
00054 coeffs.add(*coef) ;
00055 }
00056 delete coefIter ;
00057 }
00058
00059
00060 RooThreshold::RooThreshold(const RooThreshold& other,
00061 const char* name) :
00062 RooAbsPdf(other,name),
00063 x("x",this,other.x),
00064 m0("m0",this,other.m0),
00065 power("power",this,other.power),
00066 coeffs("coeffs",this, other.coeffs)
00067 {
00068 }
00069
00070
00071 Double_t RooThreshold::evaluate() const
00072 {
00073
00074
00075 if (x<m0) {return(0);}
00076 Double_t result(0);
00077
00078
00079 TIterator* iter = coeffs.createIterator() ;
00080 RooRealVar* coef(0) ;
00081 Int_t n(0);
00082 while ((coef = (RooRealVar*) iter->Next())) {
00083 n++;
00084 result += coef->getVal() * TMath::Power(x,n);
00085 }
00086 delete iter ;
00087
00088 result = TMath::Exp(result) * TMath::Power(x-m0,power);
00089
00090
00091 return(result);
00092 }
00093