Hello, I am trying to use RooFit to do a mass lifetime combined fitting. Since the lifetime is distorted by the impact parameter significance cuts, an acceptance function is added. I guess here is where the problem from. My codes worked in ROOT 5.12/00e, but after I moved to the latest one, v5.18/00, it failed (also failed in v5.17/**, but not checked again), I mean, the fitting result of tau is wrong (0.761 ± 0.012, the input value is 0.46, and the value returned by 5.12 is 0.479±0.007). The required ASCII file and the visualizations returned by v5.12 and v5.18 (would be produced by the code) are also attached to save the running time.
Did I do something silly? Thank you very much for any help you will give me.
Hereafter is the code.
void SignalFit(){
gSystem->Load("libRooFit");
using namespace RooFit;
RooRealVar *m = new RooRealVar( "m","invariant mass" , 6100., 6700., "MeV/c^{2}");
RooRealVar *sm = new RooRealVar("sm","mass resolution", 0., 100., "MeV/c^{2}");
RooRealVar *t = new RooRealVar( "t","proper time", 0., 5.0, "ps" );
RooRealVar *st = new RooRealVar("st","time resolution", 0., 0.08, "ps" );
RooDataSet* data = RooDataSet::read("asciiData.file", RooArgList(*m, *sm, *t, *st) );
RooPlot* tframe = t->frame();
data->plotOn(tframe);
tframe->Draw();
// the set of observables...
RooArgSet* observables = new RooArgSet(*m,*sm,*t,*st);
//Define the PDF
//--------------------------------------------------------------------------------
//Mass
RooRealVar *SigMass = new RooRealVar("SigMass","Signal mass", 6400, 6100, 6700, "MeV/c^{2}" );
RooRealVar *MassResScale = new RooRealVar("MassResScale", "mass resolution scale",1.0, 0.1, 3.0 );
RooFormulaVar *SigMassRes = new RooFormulaVar("SigMassRes", "Sig mass resolution",
"(@0*@1)", RooArgList(*MassResScale,*sm) );
RooAbsPdf *SigMassPdf = new RooGaussian("SigMassPdf","MassPDF of signal",*m,*SigMass,*SigMassRes);
//
//...propertime distributions
//=================================================================================
//Scale factor of Resolutions
RooRealVar *TauResScale = new RooRealVar("TauResScale","time resolution scale",0.9936, 0.1, 3);
//
//Singal
//------------------------------------------------
RooRealVar *SigTau = new RooRealVar("SigTau","Signal lifetime",0.10,0.001,10.0,"ps");
RooRealVar *SigTauResBias = new RooRealVar("SigTauResBias","bias scale",0,-5,5);
RooResolutionModel *SigTauRes = new RooGaussModel("SigTauRes","gauss resolution model",*t,
*SigTauResBias,*TauResScale,*st,*st);
RooAbsPdf *SigTauPdf = new RooDecay("SigTauPdf","unbiased proper time PDF",*t,
*SigTau,*SigTauRes,RooDecay::SingleSided);
// Take into account acceptance
// signal acceptance model
RooRealVar *Acc_a = new RooRealVar("Acc_a","acceptance a", 3.189 );
RooRealVar *Acc_n = new RooRealVar("Acc_n","acceptance n", 3.14 );
RooRealVar *Acc_c = new RooRealVar("Acc_c","acceptance c", 0.1515 );
RooAbsReal *Acc = new RooFormulaVar("Acc","(@0>0)*@3*(@1*@0)**@2/( 1+(@1*@0)**@2 )", RooArgList(*t,*Acc_a,*Acc_n,*Acc_c) );
RooAbsPdf *SigTauAccPdf = new RooEffProd("SigTauAccPdf","biased proper time PDF", *SigTauPdf, *Acc);
// product: unconditional
RooAbsPdf *SigPdf = new RooProdPdf("SigPdf" ,"signal PDF", RooArgList(*SigMassPdf, *SigTauAccPdf) );
SigTauResBias->setConstant(kTRUE);
TauResScale->setConstant(kTRUE);
// fitting
RooFitResult *s = SigPdf->fitTo(*data,Minos(false),Strategy(1),Save(true),Verbose(true));
s->Print("v");
// make plots
TCanvas *c = new TCanvas();
c->Divide(1,2);
RooPlot *p1 = m->frame(Bins(100),Title("invariant mass"));
data->plotOn(p1);
SigPdf->plotOn(p1,ProjWData(*sm,*data));
c->cd(1);
p1->Draw();
RooPlot *p2 = t->frame(Bins(100),Title("proper time"));
data->plotOn( p2 );
SigPdf->plotOn( p2, ProjWData(*st,*data) );
c->cd(2);
p2->Draw();
}
ForLocateProblem.tar.gz (95.6 KB)