Esempio n. 1
0
#gauss10.plotOn(xframe7, RooFit.Normalization( data3.sumEntries() , RooAbsReal.NumEvent) , RooFit.Range("left_gaussian_range"))
gauss10.plotOn(xframe7, RooFit.Normalization( 500 , RooAbsReal.NumEvent) , RooFit.Range("left_gaussian_range"))


#gauss11.plotOn(xframe7,RooFit.Normalization( data3_half.sumEntries() , RooAbsReal.NumEvent), RooFit.LineColor(RooFit.kRed))
#gauss11.plotOn(xframe7,RooFit.Normalization( data3_half.sumEntries() , RooAbsReal.NumEvent), RooFit.Range("left_gaussian_range"), RooFit.LineColor(RooFit.kRed))

#gauss11_ext.plotOn(xframe7,RooFit.Normalization( nGauss11.getVal() , RooAbsReal.NumEvent), RooFit.LineColor(RooFit.kRed))
#gauss11_ext.plotOn(xframe7,RooFit.Normalization( 1.0 , RooAbsReal.RelativeExpected ), RooFit.LineColor(RooFit.kRed))
#gauss11_ext.plotOn(xframe7,RooFit.Normalization( 1.0 , RooAbsReal.RelativeExpected ), RooFit.LineColor(RooFit.kRed),RooFit.DrawOption("F"), RooFit.FillColor(RooFit.kRed), RooFit.FillStyle(1001) )

# try to fix the fill color problem

xArg = RooArgSet(x)

iLeft = gauss11_ext.createIntegral(xArg, RooFit.NormSet(xArg), RooFit.Range("left_gaussian_range"))
iTotal = gauss11_ext.createIntegral(xArg, RooFit.NormSet(xArg), RooFit.Range("whole_range"))

print "with NormSet"
print "iLeft: ", iLeft.getVal()
print "iTotal: ", iTotal.getVal()

#iLeft = gauss11_ext.createIntegral(xArg, RooFit.Range("left_gaussian_range"))
#iTotal = gauss11_ext.createIntegral(xArg, RooFit.Range("whole_range"))

#print "without NormSet"
#print "iLeft: ", iLeft.getVal()
#print "iTotal: ", iTotal.getVal()

n_total_evaluate = nGauss11.getVal() / iLeft.getVal()
print "n_total_evaluate: ", n_total_evaluate
Esempio n. 2
0
mass_var = multipdf.getVariables().first()
mass_var.setRange("HiggsMassWindow5",120,130)
mass_var.setRange("HiggsMassWindow2",123,127)
mass_var.setRange("HiggsMassWindow10",115,135)
mass_var.setRange("WholeRange",100,180)
frame = mass_var.frame()
option = "AL"
pdf_information = {}

multipdf.plotOn( frame )
for pdf_index in range(0,multipdf.getNumPdfs()):
    pdf_ = multipdf.getPdf( pdf_index )
    print pdf_.GetName() + "_Normalized" , pdf_.GetTitle()
    pdf = RooExtendPdf( pdf_.GetName() + "_Normalized" , pdf_.GetTitle() , pdf_ , norm )
    pdf.plotOn( frame , RooFit.DrawOption(option) , RooFit.LineColor( colors[pdf_index] ) , RooFit.LineStyle(0) , RooFit.LineWidth(3) , RooFit.Range("WholeRange") )
    totalInt = pdf.createIntegral( RooArgSet(mass_var) ,RooFit.Range("WholeRange"))
    #totalInt.Print() , RooFit.NormSet( RooArgSet(mass_var) ),
    fracInt5 = pdf.createIntegral( RooArgSet(mass_var) ,RooFit.Range("HiggsMassWindow5"))
    fracInt2 = pdf.createIntegral( RooArgSet(mass_var) ,RooFit.Range("HiggsMassWindow2"))
    fracInt10 = pdf.createIntegral( RooArgSet(mass_var) ,RooFit.Range("HiggsMassWindow10"))
    #fracInt.Print()
    if "A" in option :
        option = "L"
    pdf_information[ pdf_index ] = { "name":pdf.GetName() , "pdf":pdf , "ratio5":fracInt5.getVal()/totalInt.getVal(), "ratio2":fracInt2.getVal()/totalInt.getVal(), "ratio10":fracInt10.getVal()/totalInt.getVal() }

doSig = False
if len(sys.argv) > 3 :
    fsigName = sys.argv[2]
    fsig = TFile.Open( fsigName )
    sigPdf = fsig.Get( sys.argv[3] )
    doSig = True