#include "RooFit.h"
#include "Riostream.h"
#include "Riostream.h"
#include "RooDecay.h"
#include "RooRealVar.h"
#include "RooRandom.h"
ClassImp(RooDecay)
;
RooDecay::RooDecay(const char *name, const char *title,
RooRealVar& t, RooAbsReal& tau,
const RooResolutionModel& model, DecayType type) :
RooAbsAnaConvPdf(name,title,model,t),
_t("t","time",this,t),
_tau("tau","decay time",this,tau),
_type(type)
{
switch(type) {
case SingleSided:
_basisExp = declareBasis("exp(-@0/@1)",tau) ;
break ;
case Flipped:
_basisExp = declareBasis("exp(@0/@1)",tau) ;
break ;
case DoubleSided:
_basisExp = declareBasis("exp(-abs(@0)/@1)",tau) ;
break ;
}
}
RooDecay::RooDecay(const RooDecay& other, const char* name) :
RooAbsAnaConvPdf(other,name),
_t("t",this,other._t),
_tau("tau",this,other._tau),
_type(other._type),
_basisExp(other._basisExp)
{
}
RooDecay::~RooDecay()
{
}
Double_t RooDecay::coefficient(Int_t ) const
{
return 1 ;
}
Int_t RooDecay::getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t ) const
{
if (matchArgs(directVars,generateVars,_t)) return 1 ;
return 0 ;
}
void RooDecay::generateEvent(Int_t code)
{
assert(code==1) ;
while(1) {
Double_t rand = RooRandom::uniform() ;
Double_t tval(0) ;
switch(_type) {
case SingleSided:
tval = -_tau*log(rand);
break ;
case Flipped:
tval= +_tau*log(rand);
break ;
case DoubleSided:
tval = (rand<=0.5) ? -_tau*log(2*rand) : +_tau*log(2*(rand-0.5)) ;
break ;
}
if (tval<_t.max() && tval>_t.min()) {
_t = tval ;
break ;
}
}
}
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.