[RooFit] Why such conditional Pdf would bias the signal frac


I am trying to do a combined mass-lifetime fitting using the event-by-event errors both for the mass and the lifetime. If I just use the one for the lifetime, there is no problem, but if I use both, the signal fraction would be biased by 54% (you could find it in the attached tar.gz), which I do not understand at all. I don’t know whether I did something wrong in the construction of the conditional Pdfs. Hereafter is the codes, and all the required file is tared in the attachments.

And I am still using root 5.12, which is free of the problem in

I haven’t tried the latest version (mentioned by Wouter) for some technical problem. But I think it is not the version issue, right?

One more question, if I just want to do the generation with one acceptance, and fitting with anther one, I just need to change this line and the following line accordingly.

RooAbsPdf *SigTauAccPdf = new RooEffProd("SigTauAccPdf", "biased proper time PDF", *SigTauPdf, *Acc);

I do not need to construct all the other Pdfs, right? You know, I don’t know whether it would cause some problem of normalization by sharing all the other parts.

Thank you very much.

[code]void evtByEvt(){
using namespace RooFit;

// define variables and observables

RooRealVar *m = new RooRealVar( “m”, “invariant mass” , 6100., 6700., “MeV/c^{2}”);
RooRealVar *sm = new RooRealVar(“sm”, “mass resolution”, 0.1e-20, 60., “MeV/c^{2}”);
RooRealVar *t = new RooRealVar( “t”, “proper time” , 0.1e-20, 5.0, “ps” );
RooRealVar *st = new RooRealVar(“st”, “time resolution”, 0.1e-20, 0.08, “ps” );

RooArgSet* observables = new RooArgSet( *m, *sm, *t, st);
ConObsVars = new RooArgSet( *sm, *st );

// read and check its status of signal
// siginal tau resolution
RooDataSet *SigTauErrData = RooDataSet::read(“PT5GeVSigTauResFb.file”, RooArgList(*st) );
RooKeysPdf *SigTauErrPdf = new RooKeysPdf(“SigTauErrPdf”, “Sig Tau ErrPdf”, *st , *SigTauErrData ) ;

// read in the mass resolutions
RooDataSet *SigMassErrData = RooDataSet::read(“PT5GeVSigMassResFb.file”, RooArgList( *sm ) );
RooKeysPdf *SigMassErrPdf = new RooKeysPdf( “SigMassErrPdf”, “Sig mass res Model”, *sm, *SigMassErrData );

// read and check its status of background
// bkg tau and tauRes
RooDataSet *BkgTauData = RooDataSet::read(“PT5GeVBkgTauData.file”, RooArgList( *t ) );
RooDataSet *BkgTauErrData = RooDataSet::read(“PT5GeVBkgTauResFb.file”, RooArgList( *st ) );

RooKeysPdf *BkgTauPdf = new RooKeysPdf(“BkgTauPdf”, “Bkg Tau Pdf”, *t , *BkgTauData );
RooKeysPdf *BkgTauErrPdf = new RooKeysPdf(“BkgTauErrPdf”, “Bkg Tau ErrPdf”, *st , *BkgTauErrData );

// bkg mass res
RooDataSet *BkgMassErrData = RooDataSet::read(“PT5GeVBkgMassResFb.file”, RooArgList( *sm ) );
RooKeysPdf *BkgMassErrPdf = new RooKeysPdf( “SigMassErrPdf”, “Sig mass res Model”, *sm, *BkgMassErrData );

// PDFs
// signal mass
RooRealVar *SigMass = new RooRealVar(“SigMass”, “SigMass” , 6400, 6100, 6700, “MeV/c^{2}” );

RooRealVar *SigMassSF = new RooRealVar(“SigMassSF” , “SigMassSF” , 1.0 );

RooRealVar *SigMassResSF = new RooRealVar(“S_{m}” , “SigMassResSF”, 1.35, 0.1, 3.0 );

RooAbsPdf *SigMassPdf = new RooGaussModel(“SigMassPdf”,“SigMassPdf”, *m, *SigMass,*sm, *SigMassSF, *SigMassResSF );

/// bkg mass
RooRealVar *BkgMassSlope = new RooRealVar(“Sl_{bkg}”,“Slope of mass bkg”, -9.7e-05, -1.0, 1.0 );
RooAbsPdf *BkgMassPdf = new RooPolynomial(“BkgMassPdf”,“BkgMassPdf”,*m,*BkgMassSlope);

//…propertime distributions
//Scale factor of Resolutions
RooRealVar *TauResScale = new RooRealVar(“TauResScale”,“time resolution scale”, 1.21 );

RooRealVar *SigTau = new RooRealVar(“SigTau”,“Signal lifetime”,0.46, 0.001,10.0,“ps”);
RooRealVar *SigTauResBias = new RooRealVar(“SigTauResBias”,“bias scale”, 0. );
RooResolutionModel *SigTauRes = new RooGaussModel(“SigTauRes”,“gauss resolution model”,*t,

RooAbsPdf *SigTauPdf = new RooDecay(“SigTauPdf”,“unbiased proper time PDF”,*t,

// Take into account acceptance
// signal acceptance model
RooRealVar *Acc_a = new RooRealVar(“Acc_a”,“acceptance a”, 3.474 );
RooRealVar *Acc_n = new RooRealVar(“Acc_n”,“acceptance n”, 3.066 );
RooRealVar *Acc_c = new RooRealVar(“Acc_c”,“acceptance c”, 0.1473 );

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);

/// combined Pdf
RooAbsPdf *SigConPdf = new RooProdPdf(“SigConPdf”, “Sig Con Pdf”,
RooArgList(*SigMassErrPdf, *SigTauErrPdf),
Conditional(RooArgList(*SigMassPdf), RooArgList(*m) ),
Conditional(RooArgList(*SigTauAccPdf), RooArgList(*t) ) );

RooAbsPdf *BkgConPdf = new RooProdPdf(“BkgConPdf”, “Bkg Con Pdf”,
RooArgList( *BkgMassErrPdf, *BkgTauErrPdf ) ,
Conditional(RooArgList(*BkgMassPdf), RooArgList(*m) ),
Conditional(RooArgList(*BkgTauPdf) , RooArgList(*t) ) );

RooRealVar *FracSig = new RooRealVar(“f_{sig}”,“fraction of signal”, 0.11, 0, 1.0);

RooAbsPdf *ConPdf = new RooAddPdf(“ConPdf”,“ConPDF”,
RooArgList(*SigConPdf, *BkgConPdf),
RooArgList(*FracSig) );

// toy Monte Carlo study


RooMCStudy *mgr = new RooMCStudy(*ConPdf, *observables, FitModel(*ConPdf), ConditionalObservables( *ConObsVars ),
FitOptions( InitialHesse(true), Minos(false), Strategy(1), Save(false) ) );
mgr->generateAndFit( 1000, 2808 ) ;
ForLocateProblem.tar.gz (140 KB)


I’ll have a look at this. However I am at a workshop till Wednesday,
so it might take a few days.