Esempio n. 1
0
 def eff(x, y, color, rebin=1):
     x = RebinView.rebin(x, mu_pt_binning)
     y = RebinView.rebin(y, mu_pt_binning)
     x = round_to_ints(x)
     y = round_to_ints(y)
     graph = ROOT.TGraphAsymmErrors(y, x)
     graph.SetMarkerColor(color)
     return graph
Esempio n. 2
0
 def rebin_view(x):
     ''' Make a view which rebins histograms '''
     binning = None
     if ',' in args.rebin:
         binning = tuple(int(x) for x in args.rebin.split(','))
     else:
         binning = int(args.rebin)
     return RebinView(x, binning)
        if args.rebin:
            binning = eval(args.rebin)
            if isinstance(binning, float) or isinstance(binning, int):
                newbinning = int(binning)
            elif isinstance(binning, list) and isinstance(
                    binning[0], float) or isinstance(binning[0], int):
                newbinning = tuple(float(x) for x in binning)
            elif isinstance(binning, list) and isinstance(binning[0], list):
                # print   args.rebin
                #print binning[0]
                binningx = tuple(float(x) for x in binning[0])
                #print binningx
                binningy = tuple(float(x) for x in binning[1])
                newbinning = tuple([binningx, binningy])

        input_view = RebinView(input_view, newbinning)

    #from math import *
    #log.info("Getting histograms")
    #from pdb import set_trace; set_trace()
    pass_histo = input_view.Get(args.num)
    all_histo = input_view.Get(args.denom)
    all_histo_fine_bin = None
    if args.fineBinnedDen:
        all_histo_finebin = input_view.Get(args.fineBinnedDen)
        all_histo_finebin.Smooth(1, "k5a")
#
#    clone = pass_histo.Clone('cazzoneso')
#    clone.Divide(all_histo)
#    canvas = ROOT.TCanvas("asdf", "asdf", 800, 600)
#    projectionsy = bins_projectionsY(clone)
Esempio n. 4
0
 def norm(x):
     x.Scale(1.0/x.Integral())
     x = RebinView.rebin(x, mu_pt_binning)
     return x
Esempio n. 5
0
 def rebin_view(x):
     ''' Make a view which rebins histograms '''
     binning = None
     binning = eval(args.rebin)
     return RebinView(x, binning)
Esempio n. 6
0
 def rebin_view(x, rebin):
     ''' Make a view which rebins histograms '''
     output = RebinView(x, rebin)
     return output
Esempio n. 7
0
    import rootpy.io as io
    #from FinalStateAnalysis.Utilities.rootbindings import ROOT
    import ROOT
    #ROOT.gSystem.Load("libFinalStateAnalysisStatTools")

    # Build view of input histograms
    log.info("Merging input files")
    input_view = views.SumView(*[io.open(x) for x in args.input])

    if args.rebin and args.rebin > 1:
        binning = None
        if ',' in args.rebin:
            binning = tuple(int(x) for x in args.rebin.split(','))
        else:
            binning = int(args.rebin)
        input_view = RebinView(input_view, binning)

    log.info("Getting histograms")
    pass_histo = input_view.Get(args.num)
    all_histo = input_view.Get(args.denom)

    #make slice if necessary
    if args.slice: #maybe a check if is 2d would be a good thing
        log.info("Slicing! Slice #%s" % args.slice)
        #project
        pass_histo_px = asrootpy( pass_histo.ProjectionX('pass_histo_px', args.slice, args.slice, "e") )
        all_histo_px  = asrootpy( all_histo.ProjectionX('all_histo_px', args.slice, args.slice, "e") )

        #get rootpy plotting stuff
        pass_histo_px.decorate( **pass_histo.decorators )
        all_histo_px.decorate( **all_histo.decorators   )
Esempio n. 8
0
 def preprocess(view):
     ret = view
     if project and project_axis:
         ret = ProjectionView(ret, project_axis, project)
     return RebinView( ret, rebin )