Exemple #1
0
     sigDataHist = w.data('%s_%s' % (box, model))
     sigPdf = rt.RooHistPdf('%s_sig' % box, '%s_sig' % box,
                            rt.RooArgSet(th1x), sigDataHist)
     rootTools.Utils.importToWS(w, sigPdf)
     w.factory('mu[1]')
     w.var('mu').setConstant(False)
     w.var('mu').setMin(0)
     w.var('mu').setVal(0.2)  # initial value close to zero
     w.factory('Ntot_sig_%s_In[%f]' % (box, sigDataHist.sumEntries()))
     w.factory(
         'expr::Ntot_sig_%s("mu*Ntot_sig_%s_In",mu,Ntot_sig_%s_In)' %
         (box, box, box))
     w.factory('SUM::extSpBPdf(Ntot_sig_%s*%s_sig,Ntot_bkg_%s*%s_bkg)' %
               (box, box, box, box))
     w.factory('SUM::extSigPdf(Ntot_sig_%s*%s_sig)' % (box, box))
     frSpB = BinnedFit.binnedFit(w.pdf('extSpBPdf'), w.data('data_obs'))
     condCovMatrix = frSpB.conditionalCovarianceMatrix(
         rt.RooArgList(w.var('Ntot_bkg_%s' % box), w.var('p1_%s' % box),
                       w.var('p2_%s' % box), w.var('p3_%s' % box)))
     w.var('mu').setConstant(True)
     frSpB_muFixed = BinnedFit.binnedFit(w.pdf('extSpBPdf'),
                                         w.data('data_obs'))
     covMatrix = frSpB_muFixed.covarianceMatrix()
     condCovMatrix.Print("V")
     covMatrix.Print("V")
     frIn.Print('V')
     frSpB.Print('v')
     frSpB_muFixed.Print('v')
 if options.deco:
     deco = rt.PdfDiagonalizer("deco_%s" % box, w, frSpB_muFixed)
     bkgs_deco = []
     w.var(p.GetName()).setVal(p.getVal())
     w.var(p.GetName()).setError(p.getError())
 
 if options.deco or options.refit:
     sigDataHist = w.data('%s_%s'%(box,model))
     sigPdf = rt.RooHistPdf('%s_sig'%box,'%s_sig'%box,rt.RooArgSet(th1x), sigDataHist)
     rootTools.Utils.importToWS(w,sigPdf)
     w.factory('mu[1]')
     w.var('mu').setConstant(False)
     w.var('mu').setMin(0)
     w.var('mu').setVal(0.2) # initial value close to zero
     w.factory('Ntot_sig_%s_In[%f]'%(box,sigDataHist.sumEntries()))
     w.factory('expr::Ntot_sig_%s("mu*Ntot_sig_%s_In",mu,Ntot_sig_%s_In)'%(box,box,box))
     w.factory('SUM::extSpBPdf(Ntot_sig_%s*%s_sig,Ntot_bkg_%s*%s_bkg)'%(box,box,box,box))
     w.factory('SUM::extSigPdf(Ntot_sig_%s*%s_sig)'%(box,box))
     frSpB = BinnedFit.binnedFit(w.pdf('extSpBPdf'), w.data('data_obs'))
     condCovMatrix = frSpB.conditionalCovarianceMatrix(rt.RooArgList(w.var('Ntot_bkg_%s'%box),w.var('p1_%s'%box),w.var('p2_%s'%box),w.var('p3_%s'%box)))
     w.var('mu').setConstant(True)
     frSpB_muFixed = BinnedFit.binnedFit(w.pdf('extSpBPdf'), w.data('data_obs'))
     covMatrix = frSpB_muFixed.covarianceMatrix()
     condCovMatrix.Print("V")
     covMatrix.Print("V")
     frIn.Print('V')
     frSpB.Print('v')
     frSpB_muFixed.Print('v')
 if options.deco:
     deco = rt.PdfDiagonalizer("deco_%s"%box,w,frSpB_muFixed)
     bkgs_deco = []
     for bkg in bkgs:
         pdf_deco = deco.diagonalize(w.pdf('%s_%s'%(box,bkg)))
         pdf_deco.SetName('%s_%s_deco'%(box,bkg))