'HLT2Topo4BodyTOS' ] cut = '(%s > 0) && (%s > 0 || %s > 0 || %s > 0) ' % ( tlist[0], tlist[1], tlist[2], tlist[3]) cut += '&& BDTG > 0.5 ' # Get dataset: DsPi and DsK time.setBins(150) dsetlist = [] weights = [] for mode, pidcut in [('DsPi', 'PIDK < 0'), ('DsK', 'PIDK > 10')]: # Get tree rfile = get_file('data/smalltree-really-new-MC-pre-PID-%s.root' % mode, 'read') ftree = get_object('ftree', rfile) print 'Reading from file: %s' % rfile.GetName() cutstr = cut + ' && ' + pidcut if pidcut.find(' -5') > 0: wt = 'wt0' scale = 1 elif pidcut.find(' 0') > 0: wt = 'wt1' scale = 1 elif pidcut.find(' 5') > 0: wt = 'wt2' scale = 1 elif pidcut.find(' 10') > 0: wt = 'wt3'
'HLT2Topo4BodyTOS' ] cut = '(%s > 0) && (%s > 0 || %s > 0 || %s > 0) ' % (tlist[0], tlist[1], tlist[2], tlist[3]) cut += '&& BDTG > 0.5 ' # Get dataset: DsPi and DsK time.setBins(150) dsetlist = [] weights = [] for mode, pidcut in [('DsPi', 'PIDK < 0'), ('DsK', 'PIDK > 10')]: # Get tree rfile = get_file('data/smalltree-really-new-MC-pre-PID-%s.root' % mode, 'read') ftree = get_object('ftree', rfile) print 'Reading from file: %s' % rfile.GetName() cutstr = cut + ' && ' + pidcut if pidcut.find(' -5') > 0: wt = 'wt0' scale = 1 elif pidcut.find(' 0') > 0: wt = 'wt1' scale = 1 elif pidcut.find(' 5') > 0: wt = 'wt2' scale = 1 elif pidcut.find(' 10') > 0: wt = 'wt3'
axes.set_ylim(0.5, 1.5) # Dump ratio histogram to ROOT file xbins = numpy.linspace(tfloor, tceil, nbins + 1) haccratio = TH1D('haccratio_%s' % accfntype1, 'Acceptance ratio %s' % accfntype1, nbins, xbins) haccratio.SetXTitle('B decay time (ps)') haccratio.SetYTitle('%s/%s acceptance ratio mean' % (mode1, mode2)) for i, mean in enumerate(means): if i < nbins: haccratio.SetBinContent(i+1, mean) haccratio.SetBinError(i+1, varis[i]) rfile1 = get_file(fname1, 'read') hist1 = get_object('hdataset_%s' % mode1, rfile1) rfile2 = get_file(fname2, 'read') hist2 = get_object('hdataset_%s' % mode2, rfile2) hratio = hist1.Clone('hdataset_ratio') hratio.Divide(hist2) if doPrint: plt.savefig('plots/acceptance-ratio-%s-mean-rms.png' % accfntype1) plt.savefig('plots/acceptance-ratio-%s-mean-rms.pdf' % accfntype1) print 'Printed: plots/acceptance-ratio-%s-mean-rms.{png,pdf}' % accfntype1 # save acceptance ratio as ROOT histogram rfile = TFile('data/acceptance-ratio-hists-%s.root' % constoffset1, 'update') haccratio.SetDirectory(rfile)
axes.set_xlim(tfloor, tceil) axes.set_ylim(0.5, 1.5) # Dump ratio histogram to ROOT file xbins = numpy.linspace(tfloor, tceil, nbins + 1) haccratio = TH1D("haccratio_%s" % accfntype1, "Acceptance ratio %s" % accfntype1, nbins, xbins) haccratio.SetXTitle("B decay time (ps)") haccratio.SetYTitle("%s/%s acceptance ratio mean" % (mode1, mode2)) for i, mean in enumerate(means): if i < nbins: haccratio.SetBinContent(i + 1, mean) haccratio.SetBinError(i + 1, varis[i]) rfile1 = get_file(fname1, "read") hist1 = get_object("hdataset_%s" % mode1, rfile1) rfile2 = get_file(fname2, "read") hist2 = get_object("hdataset_%s" % mode2, rfile2) hratio = hist1.Clone("hdataset_ratio") hratio.Divide(hist2) if doPrint: plt.savefig("plots/acceptance-ratio-%s-mean-rms.png" % accfntype1) plt.savefig("plots/acceptance-ratio-%s-mean-rms.pdf" % accfntype1) print "Printed: plots/acceptance-ratio-%s-mean-rms.{png,pdf}" % accfntype1 # save acceptance ratio as ROOT histogram rfile = TFile("data/acceptance-ratio-hists-%s.root" % constoffset1, "update") haccratio.SetDirectory(rfile)