コード例 #1
0
def getLeptonSelection(mode):
    if mode == "mumu":
        if year == 2016:
            return cutInterpreter.cutString("diMuon16")
        else:
            # slower trigger turn-on in 2017&2018
            return cutInterpreter.cutString("diMuon1718")
コード例 #2
0
        for sample in stack.samples:
            sample.normalization = 1.
            sample.reduceFiles(factor=40)
            sample.scale /= sample.normalization
            #sample.reduceFiles( to = 3 )
    if args.verySmall:
        for sample in stack.samples:
            sample.normalization = 1.
            sample.reduceFiles(to=1)
            sample.scale /= sample.normalization

    # Use some defaults
    dummyWeight_ = lambda event, sample: float(0)
    Plot.setDefaults(stack=stack,
                     weight=staticmethod(dummyWeight_),
                     selectionString=cutInterpreter.cutString(args.selection),
                     histo_class=ROOT.TH1D)

    # 1D dummy plot
    dummyPlot = Plot(
        name='ROC',
        texX='signal efficiency',
        texY='background rejection',
        attribute=lambda event, sample: 0.5 +
        index,  # yields are somehow acting weird
        binning=[1, 0, 1],
    )

    # Use some defaults
    Plot2D.setDefaults(weight=weight_,
                       selectionString=cutInterpreter.cutString(
コード例 #3
0
    if args.small:
      for sample in stack.samples:
          sample.normalization=1.
          sample.reduceFiles( factor=40 )
          sample.scale /= sample.normalization
          #sample.reduceFiles( to = 3 )
    if args.verySmall:
      for sample in stack.samples:
          sample.normalization=1.
          sample.reduceFiles( to = 1 )
          sample.scale /= sample.normalization

    # Use some defaults
    dummyWeight_ = lambda event, sample: float(0) 
    Plot.setDefaults(stack=stack, weight = staticmethod(dummyWeight_), selectionString = cutInterpreter.cutString(args.selection), histo_class=ROOT.TH1D)
    
    # 1D dummy plot
    dummyPlot = Plot(
        name = 'ROC', texX = 'signal efficiency', texY = 'background rejection',
        attribute = lambda event, sample: 0.5 + index, # yields are somehow acting weird
        binning=[1, 0, 1],
    )

    # Use some defaults
    Plot2D.setDefaults(weight = weight_, selectionString = cutInterpreter.cutString(args.selection), histo_class=ROOT.TH2D)

    ### 2D DY plots ###
    plots2D = []

    plots2D.append(Plot2D(
コード例 #4
0
ファイル: run.py プロジェクト: Lvigilante/nanoMET
        "HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL",
        "HLT_Mu17_TrkIsoVVL_TkMu8_TrkIsoVVL", "HLT_IsoMu24", "HLT_IsoTkMu24"
    ]
    jer = "Summer16_25nsV1_MC"
    METPtVar = "MET_pt_nom"
    METPhiVar = "MET_phi_nom"
    JetCollection = "Jet_pt_nom"
    vetoEtaRegion = (10., 10.)
    minimize = True
    ttbarModifier = 1
    maxSig = 25
    jetThreshold = 15
    pTdepMetSig = False

    # calculate setting
    preselection = cutInterpreter.cutString(selection)
    triggerSel = "(%s)" % "||".join(
        ["Alt$(%s,0)" % trigg for trigg in trigger])
    eventfilter = getFilterCut(2016, isData=False)
    sel = "&&".join([preselection, triggerSel, eventfilter])
    JR = JetResolution(jer)
    version = postProcessing_directory.split("/")[0]
    outfile = "results/test_tune_%s_%s_puWeight_sumPt%i_max%i_ttbar%i_%s" % (
        jer, selection, jetThreshold, maxSig, ttbarModifier, version)

    r = run(samples,
            sel,
            JR,
            outfile=outfile,
            maxN=3e5,
            METPtVar=METPtVar,
コード例 #5
0
    METPtVar = "MET_pt_nom"
    METPhiVar = "MET_phi_nom"
    JetCollection = "Jet_pt_nom"
    vetoEtaRegion = (10., 10.)

    if args.runData:
        from nanoMET.samples.nanoTuples_Run2018_17Sep2018_postProcessed import *
        samples = [DoubleMuon_Run2018]
        jer = "Autumn18_V7b_DATA"
    else:
        from nanoMET.samples.nanoTuples_Autumn18_postProcessed import *
        samples = [DY_LO_18, Top_18, diboson_18, rare_18]
        jer = "Autumn18_V7b_MC"

# calculate setting
preselection = cutInterpreter.cutString(args.selection)
triggerSel = "(%s)" % "||".join(trigger)
eventfilter = getFilterCut(args.year, isData=args.runData)
sel = "&&".join([preselection, triggerSel, eventfilter])
JR = JetResolution(jer)
version = postProcessing_directory.split("/")[0]
outfile = "results/tune_%s_%i_%s_%s_sumPt%i_max%i" % (
    "DATA" if args.runData else "MC", args.year, jer, args.selection,
    args.jetThreshold, args.maxSig)
if args.addon:
    outfile += "_" + str(args.addon)
if args.pTdependent:
    outfile += "_pTdep"
outfile += "_" + version

# run
コード例 #6
0
  stackTT   = Stack(top)

  if args.small:
    for sample in stack.samples:
        sample.normalization=1.
        sample.reduceFiles( factor=10 )
        sample.scale /= sample.normalization
        #sample.reduceFiles( to = 3 )
  if args.verySmall:
    for sample in stack.samples:
        sample.normalization=1.
        sample.reduceFiles( to = 1 )
        sample.scale /= sample.normalization

  # Use some defaults
  Plot.setDefaults(stack = stack, weight = staticmethod(weight_), selectionString = cutInterpreter.cutString(args.selection), addOverFlowBin='upper', histo_class=ROOT.TH1D)
  Plot2D.setDefaults(weight = weight_, selectionString = cutInterpreter.cutString(args.selection), histo_class=ROOT.TH2D)
  
  plots = []
  plots2D = []

  plots.append(Plot(
    name = 'yield', texX = 'yield', texY = 'Number of Events',
    attribute = lambda event, sample: 0.5 + index, # yields are somehow acting weird
    binning=[1, 0, 1],
  ))

  plots.append(Plot(
    name = 'nVtxs', texX = 'vertex multiplicity', texY = 'Number of Events',
    attribute = TreeVariable.fromString( "PV_npvsGood/I" ),
    binning=[80,0,80],
コード例 #7
0
    }
    plots = []

    if args.year == 2016 or args.year == 2018:
        ## MET_pt
        if not args.noData and (args.selectSys == 'None'
                                or args.selectSys == 'combine'):
            met_data = Plot(
                name="MET_pt_data",
                texX='E_{T}^{miss} (GeV)',
                texY='Number of Events'
                if args.normalizeBinWidth else "Number of Event / 20 GeV",
                stack=stack_data,
                attribute=TreeVariable.fromString("MET_pt_nom/F"),
                binning=[20, 0, 400],
                selectionString=cutInterpreter.cutString(args.selection),
                weight=data_weight,
            )
            plots.append(met_data)
        else:
            met_data = None

        met_mc = {}
        for sys in all_systematics:
            met_mc[sys] = Plot(
                name="MET_pt" if sys is None else "MET_pt_mc_%s" % sys,
                texX='E_{T}^{miss} (GeV)',
                texY='Number of Events'
                if args.normalizeBinWidth else "Number of Event / 20 GeV",
                stack=sys_stacks[sys],
                attribute=TreeVariable.fromString('MET_pt_nom/F')