Hi, G Ganis,
Thanks for response !
Here, I’ve attached three pieces of codes.
The “template code[1]” is the one produced by “f104_classfactory.C” automatically.
The “my code[2]” apparently is my model.
The “My scripts[3]” is the script i’m going to run.
The script I’m running for this analysis is in [3] .
Every time, after running [3], [2] has been modified to [1].
Hopefully, I’ve explained clearly enough … 
Any comments ?
[1] template code :
/*****************************************************************************
* Project: RooFit *
* *
* This code was autogenerated by RooClassFactory *
*****************************************************************************/
// Your description goes here...
#include "Riostream.h"
#include "QfPdf.h"
#include "RooAbsReal.h"
#include "RooAbsCategory.h"
#include <math.h>
#include "TMath.h"
ClassImp(QfPdf)
QfPdf::QfPdf(const char *name, const char *title,
RooAbsReal& _x,
RooAbsReal& _A,
RooAbsReal& _B) :
RooAbsPdf(name,title),
x("x","x",this,_x),
A("A","A",this,_A),
B("B","B",this,_B)
{
}
QfPdf::QfPdf(const QfPdf& other, const char* name) :
RooAbsPdf(other,name),
x("x",this,other.x),
A("A",this,other.A),
B("B",this,other.B)
{
}
Double_t QfPdf::evaluate() const
{
// ENTER EXPRESSION IN TERMS OF VARIABLE ARGUMENTS HERE
return 1.0 ;
}
[2] My code.
/*****************************************************************************
* Project: RooFit *
* *
* This code was autogenerated by RooClassFactory *
*****************************************************************************/
// Your description goes here...
#include "Riostream.h"
#include "QfPdf.h"
#include "RooAbsReal.h"
#include "RooAbsCategory.h"
#include <math.h>
#include "TMath.h"
ClassImp(QfPdf)
QfPdf::QfPdf(const char *name, const char *title,
RooAbsReal& _x,
RooAbsReal& _A,
RooAbsReal& _B) :
RooAbsPdf(name,title),
x("x","x",this,_x),
A("A","A",this,_A),
B("B","B",this,_B)
{
}
QfPdf::QfPdf(const QfPdf& other, const char* name) :
RooAbsPdf(other,name),
x("x",this,other.x),
A("A",this,other.A),
B("B",this,other.B)
{
}
Double_t QfPdf::evaluate() const
{
Double_t ER = x[0];
Double_t SiZ = 14; //Z of Silicon.
Double_t SiA = 28; //A of Silicon.
Double_t epsln = 11.5 * ER * TMath::Power(SiZ, -7/3);
Double_t gfunction = 3 * TMath::Power(epsln,0.15) + 0.7 * TMath::Power(epsln,0.6) + epsln;
Double_t kappa = 0.133 * TMath::Power(SiZ,2/3) / TMath::Sqrt(SiA);
Double_t QF = kappa * gfunction / (1 + kappa * gfunction);
Double_t ED = ER * QF ;
return ED + A + B;
}
My scripts[3]
void GausExpModel(int nsig = 100, // number of signal events
int nbkg = 10 ) // number of background events
{
RooWorkspace w("w");
RooClassFactory::makePdf("BkgLinearPdf","x,A,B") ;
RooClassFactory::makePdf("OOnePdf","x,A,B") ;
RooClassFactory::makePdf("QfPdf","x,A,B") ;
#ifdef __CINT__
gROOT->ProcessLineSync(".x BkgLinearPdf.cxx+") ;
gROOT->ProcessLineSync(".x OOnePdf.cxx+") ;
gROOT->ProcessLineSync(".x QfPdf.cxx+") ;
#endif
w.factory("BkgLinearPdf:bkg_pdf(x[0,10], a[2.5,2.0,3.0], b[-0.0125,-0.025,0])");
w.factory("OOnePdf:oone_pdf(x, mass[2], sigma[0.5])");
w.factory("QfPdf:qf_pdf(x, kev[1], sigkev[0.3])");
.......