示例#1
0
def make_final_mumu(alg_list, args):

    mu_pt = args.get('mu_pt', ' > 25 ')
    ph_id = args.get('ph_id', 'vid_medium')

    # order should be muon, electron, photon, jet
    alg_list.append(filter_muon(mu_pt, do_cutflow=True, do_hists=True))
    alg_list.append(filter_electron(do_cutflow=True, do_hists=True))
    alg_list.append(filter_photon(do_cutflow=True, do_hists=True,
                                  id_cut=ph_id))
    alg_list.append(filter_jet())

    filter_trig = filter_trigger()
    filter_trig.cut_bits = ' == 9 | == 10 '
    alg_list.append(filter_trig)

    filtermet = filter_met()
    # run the met filter, save the flags but do not filter out events
    #filtermet.cut_metfilter_bits = ' ==1 & ==2 & ==7 & == 10 & ==12 & ==100 & ==101'
    alg_list.append(filtermet)

    filter_event = Filter('FilterEvent')
    filter_event.cut_mu_n = ' == 2 '
    filter_event.do_cutflow = True
    filter_event.add_var('evalCutflow', "true")
    filter_event.evalCutflow = True

    alg_list.append(filter_event)

    alg_list.append(Filter('MakePhotonCountVars'))
    alg_list.append(Filter('BuildEventVars'))
    alg_list.append(build_truth(args))
示例#2
0
文件: Conf.py 项目: jkunkle/usercode
def make_final_mugjj( alg_list, args) :

    mu_pt = args.get( 'mu_pt', ' > 25 ' )
    ph_pt = args.get( 'ph_pt', ' > 15 ' )

    # order should be muon, electron, photon, jet
    alg_list.append( filter_muon( mu_pt ) )
    alg_list.append( filter_electron( ph_pt ) )
    alg_list.append( filter_photon( ) )
    alg_list.append( filter_jet( ) )

    filter_event = Filter('FilterEvent')
    filter_event.cut_mu_n  = ' == 1 '
    filter_event.cut_ph_n  = ' == 1 '
    filter_event.cut_jet_n = ' > 1 '
    filter_event.cut_trig_Mu24_IsoORIsoTk = ' == True '

    alg_list.append( filter_event )

    alg_list.append( Filter( 'BuildEventVars' ) )
    alg_list.append( Filter( 'BuildTruth' ) )

    filter_blind = Filter( 'FilterBlind' )
    filter_blind.cut_abs_dijet_m_from_z = ' < 15 ' 

    filter_blind.add_var( 'isData', args.get('isData', ' == False' ) )
    alg_list.append( filter_blind )
示例#3
0
def make_final_mu(alg_list, args):

    el_pt = args.get('el_pt', ' > 10 ')
    mu_pt = args.get('mu_pt', ' > 10 ')
    ph_pt = args.get('ph_pt', ' > 15 ')
    muphtrig = args.get('muphtrig', 'False')
    phot_vars = args.get('phot_vars', ' False ')
    phot_id = args.get('phot_id', 'medium')
    ph_eta = args.get('ph_eta', None)
    sec_lep_veto = args.get('sec_lep_veto', 'True')
    unblind = args.get('unblind', 'False')
    invertIso = args.get('invertIso', False)

    # order should be muon, electron, photon, jet
    alg_list.append(filter_muon(mu_pt, invertIso=invertIso))
    alg_list.append(filter_electron(el_pt))
    alg_list.append(filter_photon(ph_pt, id_cut=phot_id, ieta_cut=ph_eta))
    alg_list.append(filter_jet())

    filter_trig = filter_trigger()
    filter_trig.cut_bits = ' == 23 | == 31 '
    alg_list.append(filter_trig)

    filter_event = Filter('FilterEvent')
    filter_event.cut_mu_n = ' == 1 '
    filter_event.cut_mu_pt30_n = ' == 1 '

    alg_list.append(filter_event)

    alg_list.append(Filter('MakePhotonCountVars'))
    event_vars = Filter('BuildEventVars')
    event_vars.add_var('year', theyear)
    alg_list.append(event_vars)
    alg_list.append(build_truth(args))
示例#4
0
def make_final_elgjj( alg_list, args) :

    el_pt = args.get( 'el_pt', ' > 25 ' )
    ph_pt = args.get( 'ph_pt', ' > 15 ' )

    # order should be muon, electron, photon, jet
    alg_list.append( filter_muon( ) )
    alg_list.append( filter_electron(el_pt ) )
    alg_list.append( filter_photon( ph_pt ) )
    alg_list.append( filter_jet( ) )

    filter_event = Filter('FilterEvent')
    filter_event.cut_el_n = ' == 1 '
    filter_event.cut_ph_n = ' == 1 '
    filter_event.cut_jet_n = ' > 1 '
    filter_event.cut_trig_Ele27_eta2p1_tight = ' == True '

    alg_list.append( filter_event )

    alg_list.append( Filter( 'BuildEventVars' ) )

    filter_blind = Filter( 'FilterBlind' )
    filter_blind.cut_abs_dijet_m_from_z = ' < 15 ' 

    filter_blind.add_var( 'isData', args.get('isData', ' == False' ) )
    alg_list.append( filter_blind )
示例#5
0
def build_photon( do_cutflow=False, do_hists=False, filtPID=None, evalPID=None ) :

    filt = Filter('BuildPhoton')

    filt.do_cutflow = do_cutflow

    filt.cut_hovere12_barrel_mva_presel_smallr9      = ' < 0.075 '
    filt.cut_hcalIsoEtCorr_barrel_mva_presel_smallr9 = ' < 4 '
    filt.cut_trkIsoEtCorr_barrel_mva_presel_smallr9  = ' < 4 '
    filt.cut_hovere12_barrel_mva_presel_larger9      = ' < 0.082 '
    filt.cut_hcalIsoEtCorr_barrel_mva_presel_larger9 = ' < 50 '
    filt.cut_trkIsoEtCorr_barrel_mva_presel_larger9  = ' < 50 '
    filt.cut_sigmaIEIE_barrel_mva_presel             = ' < 0.014 '
    filt.cut_chgpfIso_barrel_mva_presel              = ' < 4 '

    filt.cut_hovere12_endcap_mva_presel_smallr9      = ' < 0.075 '
    filt.cut_hcalIsoEtCorr_endcap_mva_presel_smallr9 = ' < 4 '
    filt.cut_trkIsoEtCorr_endcap_mva_presel_smallr9  = ' < 4 '
    filt.cut_hovere12_endcap_mva_presel_larger9      = ' < 0.075 '
    filt.cut_hcalIsoEtCorr_endcap_mva_presel_larger9 = ' < 50 '
    filt.cut_trkIsoEtCorr_endcap_mva_presel_larger9  = ' < 50 '
    filt.cut_sigmaIEIE_endcap_mva_presel             = ' < 0.034 '
    filt.cut_chgpfIso_endcap_mva_presel              = ' < 4 '

    if filtPID is not None :
        setattr(filt, 'cut_pid_%s' %filtPID, ' == True' )

    if evalPID is not None :
        filt.add_var( 'evalPID', evalPID )

    filt.add_var( 'TMVAWeightsFileEB', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights/photonMVAEB_BDT.weights.xml' )
    filt.add_var( 'TMVAWeightsFileEE', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights/photonMVAEE_BDT.weights.xml' )

    #filt.cut_ph_el_dr = ' > 0.2 '

    if do_hists :
        filt.add_hist( 'cut_pt', 100, 0, 500 )
        filt.add_hist( 'cut_abseta', 50, 0, 5 )
        filt.add_hist( 'cut_abseta_crack', 50, 0, 5 )
        filt.add_hist( 'cut_hovere', 50, 0, 0.1 )
        filt.add_hist( 'cut_eveto', 2, 0, 2 )
        filt.add_hist( 'cut_sigmaIEIE_barrel_medium', 50, 0, 0.05 )
        filt.add_hist( 'cut_chIsoCorr_barrel_medium', 50, 0, 5 )
        filt.add_hist( 'cut_neuIsoCorr_barrel_medium', 50, 0, 5 )
        filt.add_hist( 'cut_phoIsoCorr_barrel_medium', 50, 0, 5 )
        filt.add_hist( 'cut_sigmaIEIE_endcap_medium', 50, 0, 0.05 )
        filt.add_hist( 'cut_chIsoCorr_endcap_medium', 50, 0, 5 )
        filt.add_hist( 'cut_neuIsoCorr_endcap_medium', 50, 0, 5 )
        filt.add_hist( 'cut_phoIsoCorr_endcap_medium', 50, 0, 5 )

        filt.add_hist( 'cut_sigmaIEIE_barrel_loose', 50, 0, 0.05 )
        filt.add_hist( 'cut_chIsoCorr_barrel_loose', 50, 0, 5 )
        filt.add_hist( 'cut_neuIsoCorr_barrel_loose', 100, -5, 5 )
        filt.add_hist( 'cut_phoIsoCorr_barrel_loose', 50, 0, 5 )
        filt.add_hist( 'cut_sigmaIEIE_endcap_loose', 50, 0, 0.05 )
        filt.add_hist( 'cut_chIsoCorr_endcap_loose', 50, 0, 5 )
        filt.add_hist( 'cut_neuIsoCorr_endcap_loose', 100, -5, 5 )
        filt.add_hist( 'cut_phoIsoCorr_endcap_loose', 50, 0, 5 )

    return filt
示例#6
0
def make_final_elel(alg_list, args):

    el_pt = args.get('el_pt', ' > 25 ')

    # order should be muon, electron, photon, jet
    alg_list.append(filter_muon(do_cutflow=True, do_hists=True))
    alg_list.append(filter_electron(el_pt, do_cutflow=True, do_hists=True))
    alg_list.append(filter_photon(do_cutflow=True, do_hists=True))
    alg_list.append(filter_jet())

    filter_trig = filter_trigger()
    filter_trig.cut_bits = ' == 58 | == 109 '
    alg_list.append(filter_trig)

    filtermet = filter_met()
    # run the met filter, save the flags but do not filter out events
    #filtermet.cut_metfilter_bits = ' ==1 & ==2 & ==7 & == 10 & ==12 & ==100 & ==101'
    alg_list.append(filtermet)

    filter_event = Filter('FilterEvent')
    filter_event.cut_el_n = ' == 2 '
    filter_event.do_cutflow = True
    filter_event.add_var('evalCutflow', "true")

    alg_list.append(filter_event)

    alg_list.append(Filter('MakePhotonCountVars'))
    event_vars = Filter('BuildEventVars')
    event_vars.add_var('year', theyear)
    alg_list.append(event_vars)
    alg_list.append(build_truth(args))
示例#7
0
def filter_muon( mu_pt = ' > 25 ', do_cutflow=False, apply_corrections=False, do_hists=False, evalPID='tight' ) :
    """
       Muon ID cuts
       https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideMuonIdRun2
    """

    workarea = os.getenv('WorkArea')
    base_path = '%s/TreeFilter/RecoResonance/data' %workarea

    filt = Filter('FilterMuon')

    if do_cutflow :
        filt.do_cutflow = True
        filt.add_var('evalPID', evalPID )

    filt.cut_pt           = mu_pt
    filt.cut_eta          = ' < 2.4'
    #filt.cut_tight        = ' == True '
    filt.cut_id_Tight     = '==True'
    filt.cut_pfiso_tight  = ' < 0.15 '
    filt.cut_trkiso_tight = ' < 0.05 '

    filt.add_var( 'triggerMatchBits', '9' )
    filt.add_var( 'FilePathRochester', '%s/roccor.Run2.v3/RoccoR2018.txt' %base_path )

    filt.cut_isPf_loose         = ' == True '
    filt.cut_isGlobalOrTk_loose = ' == True '

    filt.cut_isGlobal_tight   = ' == True '
    filt.cut_isPF_tight       = ' == True '
    filt.cut_abseta_tight     = ' < 2.4'
    filt.cut_chi2_tight       = ' < 10'
    filt.cut_nMuonHits_tight  = ' > 0 '
    filt.cut_nStations_tight  = ' > 1'
    filt.cut_nTrkLayers_tight = ' > 5 '
    filt.cut_nPixelHits_tight = ' > 0'
    filt.cut_d0_tight         = ' < 0.2'
    filt.cut_z0_tight         = ' < 0.5'
    filt.cut_corriso_tight    = ' < 0.25'
    filt.cut_trkiso_tight     = ' < 0.05 '

    if apply_corrections :
        filt.add_var( 'apply_corrections', 'true' )

        workarea = os.getenv('WorkArea')
        filt.add_var( 'path', '%s/TreeFilter/RecoWgg/data/MuScleFitCorrector_v4_3/MuScleFit_2012_MC_53X_smearReReco.txt' %workarea )

    if do_hists :
        filt.add_hist( 'cut_pt', 100, 0, 200 )
        filt.add_hist( 'cut_eta', 60, -1, 5 )
        filt.add_hist( 'cut_chi2_tight', 50, 0, 50 )
        filt.add_hist( 'cut_nTrkLayers_tight', 20, 0, 20 )
        filt.add_hist( 'cut_nStations_tight', 5, 0, 5 )
        filt.add_hist( 'cut_nPixelHits_tight', 20, 0, 20 )
        filt.add_hist( 'cut_d0_tight', 100, -0.05, 0.05 )
        filt.add_hist( 'cut_z0_tight', 100, -0.05, 0.05 )
        filt.add_hist( 'cut_trkiso_tight', 50, 0, 0.5 )
        filt.add_hist( 'cut_corriso_tight', 50, 0, 0.5 )

    return filt
示例#8
0
def config_analysis( alg_list, args ) :
    """ Configure analysis modules. Order is preserved """

    nom_inv = args['type']

    filter_photon = Filter('FilterPhoton')

    if nom_inv == 'inv' :
        setattr( filter_photon, 'cut_ph_%s' %args['eveto'] , True )
    elif nom_inv == 'nom' :
        setattr( filter_photon, 'cut_ph_%s' %args['eveto'] , False )

    alg_list.append(filter_photon)

    filter_event = Filter('FilterEvent')

    filter_event.add_var( 'eveto', args['eveto'] )
    filter_event.add_var( 'type', args['type'] )

    filter_event.cut_Nph = args['nph']
    filter_event.cut_ph_pt = ' > %s & < %s ' %( args['ptmin'],  args['ptmax'] )
    filter_event.cut_abs_ph_eta = ' > %s & < %s ' %( args['etamin'],  args['etamax'] )
    filter_event.cut_save_max = ' < 15000 '

    alg_list.append( filter_event )
示例#9
0
def config_analysis( alg_list, args ) :

    isData = args.pop('isData', False)

    print 'isData = ', isData

    if str(isData) =='true' :
        workarea = os.getenv('WorkArea')
        dq_filter = Filter( 'FilterDataQuality' )
        dq_filter.add_var( 'jsonFile', '%s/TreeFilter/RecoPhoton15/data/Cert_271036-284044_13TeV_23Sep2016ReReco_Collisions16_JSON.txt' %workarea)
        alg_list.append( dq_filter )

    alg_list.append( build_truth( args ) )

    alg_list.append( build_electron( do_cutflow=False, do_hists=False, evalPID=None, applyCorrections=False ) )
    #alg_list.append( build_electron( do_cutflow=True, do_hists=False, evalPID='medium', applyCorrections=False ) )

    alg_list.append( build_muon( do_cutflow=False, do_hists=False, evalPID=None, applyCorrections=False ) )
    #alg_list.append( build_muon( do_cutflow=True, do_hists=False, evalPID='tight', applyCorrections=False ) )

    alg_list.append( build_photon( do_cutflow=False, do_hists=False, evalPID=None, doEVeto=False, applyCorrections=False ) )
    #alg_list.append( build_photon( do_cutflow=True, do_hists=True, evalPID='medium', doEVeto=False, applyCorrections=False ) )

    alg_list.append( build_jet( do_cutflow=False, do_hists=False ) )

    alg_list.append( Filter('BuildMET') )

    alg_list.append( weight_event(args) )

    alg_list.append( Filter( 'BuildTriggerBits' ) )
示例#10
0
def make_nominal_unblind_noEleVeto( alg_list, args ) :
    
    filter_photon = Filter( 'FilterPhoton' )
    filter_photon.cut_ph_medium = ' == True '
    alg_list.append(filter_photon)

    filter_muon = Filter( 'FilterMuon' )
    filter_muon.cut_mu_pt = ' > 10 '
    alg_list.append(filter_muon)

    filter_event = Filter('FilterEvent')
    filter_event.cut_nPh = ' > 1 '

    alg_list.append( filter_event )

    blind_pt = args.get('blind_pt', None )
    if blind_pt == 'None' :
        blind_pt = None

    if blind_pt is not None :
        isData = args.pop('isData', 'False')
        filter_blind = Filter( 'FilterBlind' )
        filter_blind.cut_ph_pt_lead = ' < %d ' %int(blind_pt)
        filter_blind.add_var( 'isData', isData )
        alg_list.append(filter_blind)
示例#11
0
def make_nominal_unbzrej( alg_list, args ) :

    filter_photon = Filter( 'FilterPhoton' )
    filter_photon.cut_ph_medium = ' == True '
    alg_list.append(filter_photon)

    filter_muon = Filter( 'FilterMuon' )
    filter_muon.cut_mu_pt = ' > 10 '
    alg_list.append(filter_muon)

    filter_event = Filter('FilterEvent')
    filter_event.cut_nPh = ' > 1 '

    filter_event.cut_hasPixSeed_leadph12 = ' == False '
    filter_event.cut_hasPixSeed_sublph12 = ' == False '

    alg_list.append( filter_event )

    isData = args.pop('isData', 'False')
    filter_blind = Filter( 'FilterBlind' )
    filter_blind.add_var( 'isData', isData )
    filter_blind.cut_m_lepphph= ' > 86.2 & < 96.2  '
    filter_blind.cut_m_lepph1= ' > 86.2 & < 96.2  '
    filter_blind.cut_m_lepph2= ' > 86.2 & < 96.2  '
    alg_list.append(filter_blind)
示例#12
0
def filter_jet( jet_pt = ' > 30 ', jet_eta = '< 2.4', do_hists=False ) :

    filt = Filter( 'FilterJet' )

    filt.cut_pt = jet_pt
    #filt.cut_abseta = ' < 4.5 '
    filt.cut_eta = jet_eta
    filt.cut_loose = ' == True '

    filt.cut_muon_dr    = ' > 0.4 '
    filt.cut_electron_dr    = ' > 0.4 '
    filt.cut_photon_dr    = ' > 0.4 '

    filt.cut_jet_nhf_central_loose = ' < 0.99 '
    filt.cut_jet_nemf_central_loose = ' < 0.99 '
    filt.cut_jet_nconst_central_loose = ' > 1'
    filt.cut_jet_nhf_central_tight = ' < 0.90 '
    filt.cut_jet_nemf_central_tight = ' < 0.90 '
    filt.cut_jet_nconst_central_tight = ' > 1'
    filt.cut_jet_nhf_central_tightlep = ' < 0.9 '
    filt.cut_jet_nemf_central_tightlep = ' < 0.9 '
    filt.cut_jet_nconst_central_tightlep = '> 1 '
    filt.cut_jet_muf_central_tightlep = '< 0.8 '
    filt.cut_jet_chf_central_loose = ' > 0'
    filt.cut_jet_cmult_central_loose = ' > 0 '
    filt.cut_jet_cemf_central_loose = ' < 0.99 '
    filt.cut_jet_chf_central_tight = ' > 0 '
    filt.cut_jet_cmult_central_tight = ' > 0'
    filt.cut_jet_cemf_central_tight = ' < 0.99 '
    filt.cut_jet_chf_central_tightlep = ' > 0'
    filt.cut_jet_cmult_central_tightlep = ' > 0'
    filt.cut_jet_cemf_central_tightlep = ' < 0.90'
    filt.cut_jet_nhf_transition_loose = ' > 0.01 '
    filt.cut_jet_nemf_transition_loose = ' < 0.98 '
    filt.cut_jet_nmult_transition_loose = ' > 2 '
    filt.cut_jet_nhf_transition_tight = ' > 0.01 '
    filt.cut_jet_nemf_transition_tight = ' < 0.98 '
    filt.cut_jet_nmult_transition_tight = ' > 2 '
    filt.cut_jet_nemf_forward_loose = ' < 0.90 '
    filt.cut_jet_nmult_forward_loose = '> 10 '
    filt.cut_jet_nemf_forward_tight = ' < 0.90 '
    filt.cut_jet_nmult_forward_tight = ' > 10 '

    #filt.cut_jet_el_dr = ' > 0.4 '
    #filt.cut_jet_ph_dr = ' > 0.4 '

    filt.cut_jet_CSV_Loose = ' > 0.5426 '
    filt.cut_jet_CSV_Medium = ' > 0.8484 '
    filt.cut_jet_CSV_Tight = ' > 0.9535 '
    filt.cut_jet_DeepJet_Loose = ' > 0.0614 '
    filt.cut_jet_DeepJet_Medium = ' > 0.3093 '
    filt.cut_jet_DeepJet_Tight = ' > 0.7221 '
    filt.add_var('evalBTagID', "medium" )

    if do_hists :
        filt.add_hist( 'cut_pt', 100, 0, 500 )
        filt.add_hist( 'cut_abseta', 50, 0, 5 )

    return filt
示例#13
0
def make_final_mu( alg_list, args ) :

    loose = args.get('loose', False )
    print 'loose = ', loose

    notrig = args.get('notrig', False )
    print 'notrig = ', notrig

    mtvar = args.get('mt_var', 'mt_lep_met')
    print 'mtvar = ', mtvar

    mtcut = args.get('mtcut', ' > 40')
    print 'mtcut = ', mtcut

    filter_photon = Filter( 'FilterPhoton' )
    filter_photon.cut_ph_medium = ' == True '
    if not loose :
        filter_photon.cut_ph_pt = ' > 15 '
    alg_list.append(filter_photon)

    if not loose :
        filter_muon = Filter( 'FilterMuon' )
        filter_muon.cut_mu_pt = ' > 10 '
        alg_list.append(filter_muon)

        filter_ele = Filter( 'FilterElectron' )
        filter_ele.cut_el_pt = ' > 10 '
        alg_list.append(filter_ele)

    filter_event = Filter('FilterEvent')
    filter_event.cut_nPh = ' == 2 '
    filter_event.cut_nMu = ' == 1 '
    filter_event.cut_nEl = ' == 0 '

    if not notrig :
        filter_event.cut_nMuTrig = ' > 0 '

    filter_event.cut_dr_lep_ph1 = ' > 0.4 '
    filter_event.cut_dr_lep_ph2 = ' > 0.4 '
    filter_event.cut_dr_ph1_ph2 = ' > 0.4 '

    if not loose :
        # remove diphoton mass cut
        #filter_event.cut_mgg = ' > 15 '
        setattr( filter_event, 'cut_%s' %mtvar, mtcut )

    alg_list.append( filter_event )

    blind_pt = args.get('blind_pt', None )
    if blind_pt == 'None' :
        blind_pt = None

    if blind_pt is not None :
        isData = args.pop('isData', 'False')
        filter_blind = Filter( 'FilterBlind' )
        filter_blind.cut_ph_pt_lead = ' < %d ' %int(blind_pt)
        filter_blind.add_var( 'isData', isData )
        alg_list.append(filter_blind)
示例#14
0
def config_analysis(alg_list):
    """ Configure analysis modules. Order is preserved """

    filt = Filter('AddEventWeight')
    filt.cut_elpasstrig_n = ' > 0 '
    filt.cut_el_n = ' > 1 '
    filt.add_var('sample_key', 'DYJetsToLL')

    alg_list.append(filt)
示例#15
0
文件: Conf.py 项目: sachikot/usercode
def get_pileup_sf(options):

    base_path = "%s/TreeFilter/ApplyScaleFactors/data" % _workarea

    pileup_sf = Filter("AddPileupSF")
    pileup_sf.add_var("DataFilePath", "%s/Data_Pileup_2012_ReReco-600bins.root" % base_path)
    pileup_sf.add_var("MCFilePath", options["PUDistMCFile"])

    return pileup_sf
示例#16
0
def get_pileup_sf(options) :

    base_path = '%s/TreeFilter/ApplyScaleFactors/data' %_workarea

    pileup_sf = Filter( 'AddPileupSF' )
    pileup_sf.add_var( 'DataFilePath', '%s/Data_Pileup_2012_ReReco-600bins.root' % base_path)
    pileup_sf.add_var( 'MCFilePath', options['PUDistMCFile'] )

    return pileup_sf
示例#17
0
def weight_event( args ) :

    filt = Filter( 'WeightEvent' )

    filt_str = args.get( 'ApplyNLOWeight', 'false' )

    filt.add_var( 'ApplyNLOWeight', filt_str )

    return filt
示例#18
0
文件: Conf.py 项目: sachikot/usercode
def get_electron_sf(options):

    base_path = "%s/TreeFilter/ApplyScaleFactors/data" % _workarea

    electron_sf = Filter("AddElectronSF")

    electron_sf.add_var("FilePathTrig", "%s/electrons_scale_factors.root" % base_path)

    return electron_sf
示例#19
0
def make_final_elg( alg_list, args) :

    mu_pt = args.get( 'mu_pt', ' > 10 ' )
    el_pt = args.get( 'el_pt', ' > 10 ' )
    ph_pt = args.get( 'ph_pt', ' > 15 ' )
    phot_vars = args.get( 'phot_vars', 'False' )
    phot_id = args.get( 'phot_id', 'medium' )
    ph_eta = args.get( 'ph_eta', None )
    sec_lep_veto = args.get( 'sec_lep_veto', 'True' )
    unblind = args.get( 'unblind', 'False' )
    eleVeto = args.get('eleVeto', 'None' )
    eleOlap = args.get('eleOlap', 'True' )


    # order should be muon, electron, photon, jet
    alg_list.append( filter_muon(mu_pt , do_cutflow=True, do_hists=True ))
    alg_list.append( filter_electron(el_pt ,do_cutflow=True, do_hists=True) )
    alg_list.append( filter_photon( ph_pt, id_cut=phot_id, ieta_cut=ph_eta,ele_veto=eleVeto, ele_olap=eleOlap, do_cutflow=True, do_hists=True  ) )
    alg_list.append( filter_jet( ) )

    filter_trig = filter_trigger(do_cutflow=True)
    filter_trig.cut_bits = ' == 26'
    alg_list.append( filter_trig )

    #filtermet = filter_met()
    #filtermet.cut_metfilter_bits = ' ==1 & ==2 & ==7 & == 10 & ==12 & ==100 & ==101'
    #alg_list.append( filtermet )

    filter_event = Filter('FilterEvent')
    filter_event.do_cutflow = True
    filter_event.add_var('evalCutflow', "true")
    filter_event.evalCutflow = True
    if eleOlap == 'False' :
        filter_event.cut_el_pt30_n = ' > 0 '
        filter_event.cut_ph_n = ' > 0 '
    else :
        filter_event.cut_el_pt30_n = ' == 1 '
        filter_event.cut_ph_n = ' > 0 '
        if sec_lep_veto != 'False' :
            filter_event.cut_el_n = ' == 1 '
            filter_event.cut_mu_n = ' == 0 '

    alg_list.append( filter_event )

    if phot_vars == 'True' :
        alg_list.append( Filter( 'MakePhotonCountVars' ) )

    alg_list.append( Filter( 'BuildEventVars' ) )
    alg_list.append( build_truth(args) )

    if unblind is not 'True' :
        filter_blind = Filter( 'FilterBlind' )
        #filter_blind.cut_mt_lep_met_ph = ' < 100 '
        filter_blind.cut_mt_res = ' < 100 '

        filter_blind.add_var( 'isData', args.get('isData', ' == False' ) )
        alg_list.append( filter_blind )
示例#20
0
文件: Conf.py 项目: cranelli/usercode
def get_electron_sf() :

    base_path = '%s/TreeFilter/ApplyScaleFactors/data' %_workarea

    electron_sf = Filter( 'AddElectronSF' )

    electron_sf.add_var( 'FilePathTrig', '%s/electrons_scale_factors.root' %base_path )

    return electron_sf
示例#21
0
文件: Conf.py 项目: cranelli/usercode
def get_pileup_sf(options) :

    base_path = '%s/TreeFilter/ApplyScaleFactors/data' %_workarea

    pileup_sf = Filter( 'AddPileupSF' )
    pileup_sf.add_var( 'DataFilePath', '%s/Data_Pileup_2012_ReReco-600bins.root' % base_path)
    pileup_sf.add_var( 'MCFilePath', options['PUDistMCFile'] )

    return pileup_sf
示例#22
0
文件: Conf.py 项目: jkunkle/usercode
def config_analysis( alg_list, args ) :
    """ Configure analysis modules. Order is preserved """

    print args

    add_weight = Filter('AddCrossSectionWeight')

    add_weight.add_var('weight' , args['weight'] )

    alg_list.append( add_weight )
示例#23
0
文件: Conf.py 项目: jkunkle/usercode
def filter_muon( mu_pt = ' > 25 ', do_cutflow=False, do_hists=False ) :

    filt = Filter('FilterMuon')

    filt.cut_pt           = mu_pt
    filt.cut_eta       = ' < 2.5'
    filt.cut_tight       = ' == True '
    filt.add_var( 'triggerBits', '23,31' )

    return filt
示例#24
0
def add_Z_event_weight() :

    filt = Filter('ApplyPUBiasWeight')

    #filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/UpdateFinalTree/data/EFakeGammaScaleFactorPt.root' )
    filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/UpdateFinalTree/data/PUBiasVtxWt.root' )
    #filt.add_var( 'hist_name', 'pt')
    #filt.add_var( 'sample_key', 'DYJetsToLL' )

    return filt
示例#25
0
def get_electron_sf(options):

    base_path = '%s/TreeFilter/ApplyScaleFactors/data' % _workarea

    electron_sf = Filter('AddElectronSF')

    electron_sf.add_var('FilePathTrig',
                        '%s/electrons_scale_factors.root' % base_path)

    return electron_sf
示例#26
0
def config_analysis( alg_list ) :
    """ Configure analysis modules. Order is preserved """

    filt = Filter('AddEventWeight')
    filt.cut_elpasstrig_n = ' > 0 '
    filt.cut_el_n = ' > 1 '
    filt.add_var( 'sample_key', 'DYJetsToLL' )


    alg_list.append(filt)
示例#27
0
def filter_trigger(do_cutflow = False) :

    filter_trigger = Filter('FilterTrigger')
    if do_cutflow: filter_trigger.do_cutflow = True

    # this will store branches for only these triggers
    filter_trigger.add_var( 'triggerBits', '9:HLT_IsoMu24,26:HLT_Ele32_WPTight_Gsf,10:HLT_IsoMu27,48:HLT_Photon200,27:HLT_Ele32_WPTight_Gsf_L1DoubleEG')
    # this will store branches for all triggers found in the provided tree
    filter_trigger.add_var( 'AuxTreeName', 'UMDNTuple/TrigInfoTree' )

    return filter_trigger
示例#28
0
def filter_trigger(do_cutflow = False) :

    filter_trigger = Filter('FilterTrigger')
    if do_cutflow: filter_trigger.do_cutflow = True

    # this will store branches for only these triggers
    filter_trigger.add_var( 'triggerBits', '23:HLT_IsoMu24,31:HLT_IsoTkMu24,58:HLT_Ele27_WPTight_Gsf,60:HLT_Ele27_eta2p1_WPTight_Gsf,109:HLT_Photon175' )
    # this will store branches for all triggers found in the provided tree
    filter_trigger.add_var( 'AuxTreeName', 'UMDNTuple/TrigInfoTree' )

    return filter_trigger
示例#29
0
def add_Z_event_weight():

    filt = Filter('ApplyPUBiasWeight')

    #filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/UpdateFinalTree/data/EFakeGammaScaleFactorPt.root' )
    filt.add_var(
        'root_file',
        '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/UpdateFinalTree/data/PUBiasVtxWt.root'
    )
    #filt.add_var( 'hist_name', 'pt')
    #filt.add_var( 'sample_key', 'DYJetsToLL' )

    return filt
示例#30
0
文件: Conf.py 项目: jkunkle/usercode
def filter_electron( el_pt = ' > 25 ', do_cutflow=False, do_hists=False ) :

    filt = Filter('FilterElectron')

    filt.cut_pt         = el_pt
    filt.cut_eta        = ' < 2.5'
    #filt.cut_tight     = ' == True '
    filt.cut_vid_medium     = ' == True '
    filt.cut_muon_dr    = ' > 0.4 '

    filt.add_var( 'triggerBits', '10' )

    return filt
示例#31
0
def build_photon( do_cutflow=False, do_hists=False, filtPID=None, evalPID=None ) :

    filt = Filter('BuildPhoton')

    filt.add_var( 'TMVAWeightsFileEB11W', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights/photonMVAWtrainEB_BDT.weights.xml' )
    filt.add_var( 'TMVAWeightsFileEE11W', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights/photonMVAWtrainEE_BDT.weights.xml' )
    #filt.add_var( 'TMVAWeightsFileEB5', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights/photonMVAEB_BDT.weights.xml' )
    #filt.add_var( 'TMVAWeightsFileEE5', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights/photonMVAEE_BDT.weights.xml' )
    #filt.add_var( 'TMVAWeightsFileEB6', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights_6var_v1/photonMVAEB_BDT.weights.xml' )
    #filt.add_var( 'TMVAWeightsFileEE6', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights_6var_v1/photonMVAEE_BDT.weights.xml' )
    #filt.add_var( 'TMVAWeightsFileEB11', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights_11var_v1/photonMVAEB_BDT.weights.xml' )
    #filt.add_var( 'TMVAWeightsFileEE11', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights_11var_v1/photonMVAEE_BDT.weights.xml' )

    return filt
示例#32
0
def make_nofilt(alg_list, args):

    pass_lepton = args.get('pass_lepton', 'False')
    if pass_lepton == 'True':
        alg_list.append(filter_muon(mu_pt=' > 10 '))
        alg_list.append(filter_electron(el_pt=' > 10 '))

    alg_list.append(filter_photon(ph_pt=' > 15 ', id_cut='medium'))

    alg_list.append(filter_trigger())
    alg_list.append(filter_met())

    event_vars = Filter('BuildEventVars')
    event_vars.add_var('year', theyear)
    alg_list.append(event_vars)
    alg_list.append(Filter('BuildTruth'))
示例#33
0
def apply_wpt_kneg( alg_list, args ) :
    
    truewpt_bound_lo = args.get('truewpt_bound_lo', 0. )
    truewpt_bound_hi = args.get('truewpt_bound_hi', 13000. )
    truewpt_kneg_lo  = args.get('truewpt_kneg_lo',  1. )
    truewpt_kneg_hi  = args.get('truewpt_kneg_hi',  1. )

    if (truewpt_kneg_lo != 1. or 
        truewpt_kneg_hi != 1.):

        filter_event = Filter('ApplyTrueWPtKNeg')
        filter_event.add_var( 'truewpt_bound_lo', truewpt_bound_lo )
        filter_event.add_var( 'truewpt_bound_hi', truewpt_bound_hi )
        filter_event.add_var( 'truewpt_kneg_lo',  truewpt_kneg_lo  )
        filter_event.add_var( 'truewpt_kneg_hi',  truewpt_kneg_hi  )

        alg_list.append( filter_event )
示例#34
0
文件: Conf.py 项目: jkunkle/usercode
def config_analysis( alg_list, args ) :
    """ Configure analysis modules. Order is preserved """

    # run on the function provided through
    # the args
    for s in inspect.getmembers(sys.modules[__name__]) :
        if s[0] == args['function'] :
            print '*********************************'
            print 'RUN %s' %( args['function'] )
            print '*********************************'
            s[1]( alg_list, args )

    apply_pu_weight = Filter('ApplyPUWeight')
    apply_pu_weight.add_var( 'HistPath','/home/jkunkle/usercode/Analysis/TreeFilter/FilterResonance/data/MyDataPileupHistogram.root')
    apply_pu_weight.add_var( 'HistName','pileup')

    alg_list.append(apply_pu_weight)
示例#35
0
文件: Conf.py 项目: jkunkle/usercode
def make_final_mug( alg_list, args) :

    el_pt = args.get( 'el_pt', ' > 10 ' )
    mu_pt = args.get( 'mu_pt', ' > 10 ' )
    ph_pt = args.get( 'ph_pt', ' > 15 ' )
    muphtrig = args.get( 'muphtrig', 'False' )
    phot_vars = args.get( 'phot_vars', ' False ' )
    phot_id = args.get( 'phot_id', 'medium' )
    ph_eta = args.get( 'ph_eta', None )
    sec_lep_veto = args.get( 'sec_lep_veto', 'True' )
    unblind = args.get( 'unblind', 'False' )

    # order should be muon, electron, photon, jet
    alg_list.append( filter_muon( mu_pt ) )
    alg_list.append( filter_electron( el_pt ) )
    alg_list.append( filter_photon( ph_pt, id_cut=phot_id, ieta_cut=ph_eta ) )
    alg_list.append( filter_jet( ) )

    filter_event = Filter('FilterEvent')
    filter_event.cut_ph_n = ' > 0 '
    
    if muphtrig == 'True' :
        filter_event.cut_mu_pt20_n = ' == 1 '
        filter_event.cut_trig_Mu17_Photon30 = ' == True '
    else :
        filter_event.cut_mu_pt30_n = ' == 1 '
        filter_event.cut_trig_Mu24_IsoORIsoTk = ' == True '

    if sec_lep_veto is not 'False' :
        filter_event.cut_mu_n = ' == 1 '
        filter_event.cut_el_n = ' == 0 '

    alg_list.append( filter_event )

    if phot_vars == 'True' :
        alg_list.append( Filter( 'MakePhotonCountVars' ) )
    alg_list.append( Filter( 'BuildEventVars' ) )
    alg_list.append( Filter( 'BuildTruth' ) )

    if unblind is not 'True' :
        filter_blind = Filter( 'FilterBlind' )
        filter_blind.cut_ph_pt_lead = ' < 50 ' 

        filter_blind.add_var( 'isData', args.get('isData', ' == False' ) )
        alg_list.append( filter_blind )
示例#36
0
def config_analysis(alg_list):
    """ Configure analysis modules. Order is preserved """

    # for complicated configurations, define a function
    # that returns the Filter object and append it to the
    # alg list.  Otherwise you can directly append
    # a Filter object to the list
    # There is no restriction on the naming or inputs to these funtions

    eval = Filter('EvalMVA')

    eval.add_var(
        'TMVAWeightsFileEl',
        '/afs/cern.ch/work/j/jkunkle/private/CMS/MVATrainingZRej2EleVeto_2014_06_19/weights/ZRejElChMVA7VarsVTUniform_BDT.weights.xml'
    )
    #eval.add_var( 'TMVAWeightsFileMu', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights/ZRejMuChMVA7VarsNom_BDT.weights.xml' )

    alg_list.append(eval)
示例#37
0
def config_analysis(alg_list):
    """ Configure analysis modules. Order is preserved """

    # for complicated configurations, define a function
    # that returns the Filter object and append it to the
    # alg list.  Otherwise you can directly append
    # a Filter object to the list
    # There is no restriction on the naming or inputs to these funtions

    eval = Filter("EvalMVA")

    eval.add_var(
        "TMVAWeightsFileEl",
        "/afs/cern.ch/work/j/jkunkle/private/CMS/MVATrainingZRej2EleVeto_2014_06_19/weights/ZRejElChMVA7VarsVTUniform_BDT.weights.xml",
    )
    # eval.add_var( 'TMVAWeightsFileMu', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/TrainPhotonMVA/weights/ZRejMuChMVA7VarsNom_BDT.weights.xml' )

    alg_list.append(eval)
示例#38
0
文件: Conf.py 项目: lgray/usercode
def config_analysis( alg_list ) :
    """ Configure analysis modules. Order is preserved """

    filt = Filter('AddEventWeight')
    #filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/ApplyElToPhFF/data/ElToPhFF.root' )
    #filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/ApplyElToPhFF/data/ElToPhFFNoMassCut.root' )
    #filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/ApplyElToPhFF/data/ElToPhFFNoMassCut2Conv.root' )
    #filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/ApplyElToPhFF/data/ElToPhFFNoMassCut0Conv.root' )
    filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/ApplyElToPhFF/data/ElToPhFFNoMassCut.root ' )
    #filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/usercode/Analysis/TreeFilter/ApplyElToPhFF/data/ElToPhFFOneBin.root' )
    filt.add_var( 'hist_name_norm', 'norm')
    filt.add_var( 'hist_name_pt', 'pt')
    filt.add_var( 'hist_name_eta', 'eta')
    #filt.add_var( 'hist_name_pteta', 'pteta')
    filt.add_var( 'sample_key', 'DYJetsToLL' )
    #filt.add_var( 'nconv', '0' )

    alg_list.append(filt)
示例#39
0
def get_bjet_sf(options):

    base_path = '%s/TreeFilter/ApplyScaleFactors/data/' % _workarea

    bjet_sf = Filter('AddBJetSF')
    bjet_sf.add_var('FilePath', '%s/DeepJet_102XSF_WP_V1.csv' % base_path)
    bjet_sf.add_var('HistPath', '%s/2018/btageff2018mu.root' % base_path)
    bjet_sf.add_var('HistLJetEff', "heffl")
    bjet_sf.add_var('HistBJetEff', "heffb")
    bjet_sf.add_var('HistCJetEff', "heffc")

    return bjet_sf
示例#40
0
def weight_event( args ) :

    filt = Filter( 'WeightEvent' )

    filt_str = args.get( 'ApplyNLOWeight', 'false' )

    filt.add_var( 'ApplyNLOWeight', filt_str )

    if 'sampleFile' in args :

        workarea = os.getenv('WorkArea')
        filt.add_var( 'sample_file', args['sampleFile'])
        filt.add_var( 'data_file', '%s/TreeFilter/RecoPhoton15/data/MyDataPileupHistogram.root' %workarea )
        filt.add_var( 'sample_hist', 'pileup_true' )
        filt.add_var('data_hist', 'pileup')
    else :
        print 'weight_event requires as a command line argument like --moduleArgs " { \'sampleFile\' : \'/path/histograms.root\'} "'

    return filt
示例#41
0
def weight_event( args ) :

    filt = Filter( 'WeightEvent' )

    filt_str = args.get( 'ApplyNLOWeight', 'false' )

    filt.add_var( 'ApplyNLOWeight', filt_str )

    if 'sampleFile' in args :

        workarea = os.getenv('WorkArea')
        filt.add_var( 'sample_file', args['sampleFile'])
        filt.add_var( 'data_file', '%s/TreeFilter/RecoResonance/data/DataPileupHistogram2018.root' %workarea )
        filt.add_var( 'sample_hist', 'pileup_true' )
        filt.add_var('data_hist', 'pileup')
    else :
        print 'weight_event requires as a command line argument like --moduleArgs " { \'sampleFile\' : \'/path/histograms.root\'} "'

    return filt
示例#42
0
文件: Conf.py 项目: jkunkle/usercode
def get_muon_sf(options):

    base_path = "%s/TreeFilter/ApplyScaleFactors/data" % _workarea

    muon_sf = Filter("AddMuonSF")

    muon_sf.add_var("FilePathTrig", "%s/SingleMuonTriggerEfficiencies_eta2p1_Run2012ABCD_v5trees.root" % base_path)
    muon_sf.add_var("FilePathDiTrig", "%s/triggerSummary_mumu_rereco198fb.root" % base_path)

    muon_sf.add_var("FilePathIso", "%s/MuonEfficiencies_ISO_Run_2012ReReco_53X.root" % base_path)
    muon_sf.add_var("FilePathId", "%s/MuonEfficiencies_Run2012ReReco_53X.root" % base_path)

    return muon_sf
示例#43
0
文件: Conf.py 项目: jkunkle/usercode
def config_analysis( alg_list, args ) :
    """ Configure analysis modules. Order is preserved """

    if 'xsFile' not in args :
        print 'A command line argument like --moduleArgs " { \'xsFile\' : \'/afs/cern.ch/user/j/jkunkle/usercode/Plotting/cross_sections/wgamgam.py\'} " is required'
        sys.exit(-1)
    if 'xsKey' not in args :
        print 'A command line argument like --moduleArgs " { \'xsKey\' : \'DYJetsToLL\'} " is required'
        sys.exit(-1)

    file = args['xsFile']
    if not os.path.isfile( file ) :
        print 'Could not locate cross section file.  No values will be loaded.'
        sys.exit(-1)

    ofile = open( file )
    xsdict = eval( ofile.read() )

    sample = args['xsKey']

    values = xsdict.get(sample, None)

    if values is None  :
        print 'Sample %s does not have an entry in the cross section file' %sample
        sys.exit(-1)

    lumi_sample_den = values['cross_section']*values['gen_eff']*values['k_factor']
    if lumi_sample_den == 0 :
        print 'Cannot calculate cross section for %s.' %sample
        sys.exit(-1)
    else :
        lumi_sample = values['n_evt']/float(lumi_sample_den)


    add_weight = Filter('AddWeight')

    print str( lumi_sample )

    add_weight.add_var( 'EffectiveLumi', str( lumi_sample ) )

    alg_list.append( add_weight )
示例#44
0
def build_muon(do_cutflow=False, do_hists=False, applyCorrections=False):

    filt = Filter('BuildMuon')

    filt.do_cutflow = do_cutflow

    filt.cut_isGlobal = ' == True '
    filt.cut_isPF = ' == True '
    filt.cut_pt = ' > 10 '
    filt.cut_abseta = ' < 2.5'
    filt.cut_chi2 = ' < 10'
    filt.cut_nTrkLayers = ' > 8 '
    filt.cut_nStations = ' > 1'
    filt.cut_nPixelHits = ' > 0'
    filt.cut_d0 = ' < 0.2'
    filt.cut_z0 = ' < 0.5'
    #filt.cut_trkiso     = ' < 0.1 '
    filt.cut_corriso = ' < 0.2'

    if applyCorrections:
        filt.add_var('applyCorrections', 'true')

        workarea = os.getenv('WorkArea')
        filt.add_var(
            'path',
            '%s/TreeFilter/RecoWgg/data/MuScleFitCorrector_v4_3/MuScleFit_2012_MC_53X_smearReReco.txt'
            % workarea)

    if do_hists:
        filt.add_hist('cut_pt', 100, 0, 500)
        filt.add_hist('cut_abseta', 50, 0, 5)
        filt.add_hist('cut_chi2', 50, 0, 50)
        filt.add_hist('cut_nTrkLayers', 20, 0, 20)
        filt.add_hist('cut_nStations', 5, 0, 5)
        filt.add_hist('cut_nPixelHits', 20, 0, 20)
        filt.add_hist('cut_d0', 100, -0.05, 0.05)
        filt.add_hist('cut_z0', 100, -0.05, 0.05)
        filt.add_hist('cut_trkiso', 50, 0, 0.5)
        filt.add_hist('cut_corriso', 50, 0, 0.5)

    return filt
示例#45
0
def config_analysis( alg_list, args ) :
    """ Configure analysis modules. Order is preserved """

    # lepton and photon filters must be run 
    # before the jet filter
    alg_list.append( get_muon_filter( ptcut=10 ) )
    alg_list.append( get_electron_filter( ptcut=10 ) )
    #alg_list.append( get_electron_filter( 'mvaNonTrig', ptcut=10 ) )
    #alg_list.append( get_electron_filter( 'tightTrig' ) )
    #alg_list.append( get_electron_filter( None ) )
    #alg_list.append( get_photon_filter( 'looseNoSIEIE', ptcut=15 ) )
    #alg_list.append( get_photon_filter( id='medium', eVeto=None, ptcut=15, sort_by_id=True ) )
    #alg_list.append( get_photon_filter( id=None, eVeto='hasPixSeed', ptcut=15 ) )
    #alg_list.append( get_photon_filter( id='medium', eVeto='hasPixSeed', ptcut=15, sort_by_id=True) )
    #alg_list.append( get_photon_filter( id=None, eVeto=None, ptcut=15, sort_by_id=True, doElOlapRm=True ) )
    alg_list.append( get_photon_filter( id=None, eVeto=None, ptcut=15, sort_by_id=True, doElOlapRm=False, doTrigElOlapRm=True ) )
    alg_list.append( get_jet_filter(do_hists=False) )
    #print 'SAVING Medium PHOTONS, WITH ELE OLAP'
    print 'SAVING NOID PHOTONS, WITH ELE OLAP'
    print 'SAVING MVA ELECTRONS'

    
    alg_list.append( Filter( 'CalcEventVars' ) )
    alg_list.append( Filter( 'BuildTruth' ) )

    isData = args.pop('isData', 'False')

    filter_event = Filter('FilterEvent')
    for cut, val in args.iteritems() :
        setattr(filter_event, cut, val)

    alg_list.append( filter_event )

    filter_blind = Filter( 'FilterBlind' )
    filter_blind.cut_ph_pt_lead = ' < 40 '
    #filter_blind.cut_nPhPassMedium = ' < 2 '
    #filter_blind.cut_m_lepphph= ' > 86.2 & < 96.2  '
    #filter_blind.cut_m_lepph1= ' > 86.2 & < 96.2  '
    #filter_blind.cut_m_lepph2= ' > 86.2 & < 96.2  '
    filter_blind.add_var( 'isData', isData )
示例#46
0
文件: Conf.py 项目: cranelli/usercode
def config_analysis( alg_list, args ) :
    """ Configure analysis modules. Order is preserved """

    filt = Filter('AddEventWeight')
    filt.cut_elpasstrig_n = ' > 0 '
    filt.cut_el_n = ' == 1 '
    filt.cut_ph_n = ' == 2 '

    if args['DoLeadWeight'] == True :
        filt.cut_ph_leadPixSeed = ' == 1 '
    if args['DoLeadWeight'] == False :
        filt.cut_ph_leadPixSeed = ' == 0 '
    if args['DoSublWeight'] == True :
        filt.cut_ph_leadPixSeed = ' == 1 '
    if args['DoSublWeight'] == False :
        filt.cut_ph_leadPixSeed = ' == 0 '

    
    filt.add_var( 'root_file', '/afs/cern.ch/user/j/jkunkle/Plots/WggPlots_2014_08_18/ElectronFakeFitsRatio/results.root' )
    filt.add_var( 'hist_name', 'ff')

    alg_list.append(filt)
示例#47
0
def build_muon( do_cutflow=False, do_hists=False, applyCorrections=False ) :

    filt = Filter('BuildMuon')

    filt.do_cutflow = do_cutflow

    filt.cut_isGlobal   = ' == True '
    filt.cut_isPF       = ' == True '
    filt.cut_pt         = ' > 10 '
    filt.cut_abseta     = ' < 2.5'
    filt.cut_chi2       = ' < 10'
    filt.cut_nTrkLayers = ' > 8 ' 
    filt.cut_nStations  = ' > 1'
    filt.cut_nPixelHits = ' > 0'
    filt.cut_d0         = ' < 0.2'
    filt.cut_z0         = ' < 0.5'
    #filt.cut_trkiso     = ' < 0.1 '
    filt.cut_corriso    = ' < 0.2'

    if applyCorrections :
        filt.add_var( 'applyCorrections', 'true' )

        workarea = os.getenv('WorkArea')
        filt.add_var( 'path', '%s/TreeFilter/RecoWgg/data/MuScleFitCorrector_v4_3/MuScleFit_2012_MC_53X_smearReReco.txt' %workarea )

    if do_hists :
        filt.add_hist( 'cut_pt', 100, 0, 500 )
        filt.add_hist( 'cut_abseta', 50, 0, 5 )
        filt.add_hist( 'cut_chi2', 50, 0, 50 )
        filt.add_hist( 'cut_nTrkLayers', 20, 0, 20 )
        filt.add_hist( 'cut_nStations', 5, 0, 5 )
        filt.add_hist( 'cut_nPixelHits', 20, 0, 20 )
        filt.add_hist( 'cut_d0', 100, -0.05, 0.05 )
        filt.add_hist( 'cut_z0', 100, -0.05, 0.05 )
        filt.add_hist( 'cut_trkiso', 50, 0, 0.5 )
        filt.add_hist( 'cut_corriso', 50, 0, 0.5 )

    return filt
示例#48
0
def make_final_muel(alg_list, args):

    mu_pt = args.get('mu_pt', ' > 25 ')
    el_pt = args.get('el_pt', ' > 25 ')

    # order should be muon, electron, photon, jet
    alg_list.append(filter_muon(mu_pt))
    alg_list.append(filter_electron(el_pt))
    alg_list.append(filter_photon())
    alg_list.append(filter_jet())
    alg_list.append(filter_trigger())

    filter_event = Filter('FilterEvent')
    filter_event.cut_mu_n = ' == 1 '
    filter_event.cut_el_n = ' == 1 '

    alg_list.append(filter_event)

    #alg_list.append( Filter( 'MakePhotonCountVars' ) )
    event_vars = Filter('BuildEventVars')
    event_vars.add_var('year', theyear)
    alg_list.append(event_vars)
    alg_list.append(build_truth(args))
示例#49
0
def config_analysis( alg_list ) :
    """ Configure analysis modules. Order is preserved """

    
    # for complicated configurations, define a function
    # that returns the Filter object and append it to the
    # alg list.  Otherwise you can directly append 
    # a Filter object to the list

    #----------------------
    # For ISR sample
    #----------------------
    #Sample Zg : lumi_sample = 41403.726747, scale = 0.468557
    #Sample Wgg_FSR : lumi_sample = 545608.695652, scale = 0.035557
    #Sample DYJetsToLL : lumi_sample = 8693.344750, scale = 2.231592
    #Sample WAA_ISR : lumi_sample = 3135768.025078, scale = 0.006187

    weight = Filter('WeightEvent')
    #weight.add_var( 'Weight', '0.468557') #Zg
    #weight.add_var( 'Weight', '2.231592') #DYJetsToLL
    weight.add_var( 'Weight', '0.035557') #Wgg_FSR
    #weight.add_var( 'Weight', '0.006187') #WAA_ISR

    alg_list.append( weight )


    filt_phot = Filter( 'FilterPhoton' )
    filt_phot.cut_ph_pt = ' > 15 '
    filt_phot.cut_ph_medium = ' == True '
    #filt_phot.cut_ph_hasPixSeed = ' == False '

    #alg_list.append(filt_phot ) 

    alg_list.append( filter_event( nPhPassEleVeto=2 ) )

    alg_list.append(Filter('CalcVars') )
示例#50
0
文件: Conf.py 项目: sachikot/usercode
def config_analysis(alg_list, args):
    """ Configure analysis modules. Order is preserved """

    filt = Filter('AddEventWeight')
    filt.cut_elpasstrig_n = ' > 0 '
    filt.cut_el_n = ' == 1 '
    filt.cut_ph_n = ' == 2 '

    if args['DoLeadWeight'] == True:
        filt.cut_ph_leadPixSeed = ' == 1 '
    if args['DoLeadWeight'] == False:
        filt.cut_ph_leadPixSeed = ' == 0 '
    if args['DoSublWeight'] == True:
        filt.cut_ph_leadPixSeed = ' == 1 '
    if args['DoSublWeight'] == False:
        filt.cut_ph_leadPixSeed = ' == 0 '

    filt.add_var(
        'root_file',
        '/afs/cern.ch/user/j/jkunkle/Plots/WggPlots_2014_08_18/ElectronFakeFitsRatio/results.root'
    )
    filt.add_var('hist_name', 'ff')

    alg_list.append(filt)
示例#51
0
def weight_event( args ) :

    filt = Filter( 'WeightEvent' )

    if 'sampleFile' not in args :
        print 'weight_event requires as a command line argument like --moduleArgs " { \'sampleFile\' : \'/path/histograms.root\'} "'
        sys.exit(-1)

    sample_hist = 'ggNtuplizer/hPUTrue'
    if 'sample_hist' in args :
        sample_hist = args['sampleHist']
    
    workarea = os.getenv('WorkArea')

    filt.add_var('sample_file', args['sampleFile'])
    filt.add_var('data_file', '%s/TreeFilter/RecoWgg/data/run2012ABCD_pileup_true.root' %workarea )
    filt.add_var('sample_hist', sample_hist)
    filt.add_var('data_hist', 'pileup')

    return filt
示例#52
0
def get_photon_sf(options):

    base_path = '%s/TreeFilter/ApplyScaleFactors/data' % _workarea

    photon_sf = Filter('AddPhotonSF')

    photon_sf.add_var(
        'FilePathId',
        '%s/Photon_ID_CSEV_SF_Jan22rereco_Full2012_S10_MC_V01.root' %
        base_path)
    photon_sf.add_var('FilePathEveto', '%s/hist_sf_eveto_nom.root' % base_path)
    photon_sf.add_var('FilePathEvetoHighPt',
                      '%s/hist_sf_eveto_highpt.root' % base_path)

    return photon_sf
示例#53
0
def filter_jet(jet_pt=' > 30 ', jet_eta='< 2.4', do_hists=False):

    filt = Filter('FilterJet')

    filt.cut_pt = jet_pt
    #filt.cut_abseta = ' < 4.5 '
    filt.cut_eta = jet_eta
    #filt.cut_loose = ' == True '
    filt.cut_tight = ' == True '

    filt.cut_muon_dr = ' > 0.4 '
    filt.cut_electron_dr = ' > 0.4 '
    filt.cut_photon_dr = ' > 0.4 '

    # From https://twiki.cern.ch/twiki/bin/view/CMS/JetID13TeVRun2016
    # For -2.7 <= eta <= 2.7
    # loose
    filt.cut_jet_nhf_central_loose = ' < 0.99 '
    filt.cut_jet_nemf_central_loose = ' < 0.99 '
    filt.cut_jet_nconst_central_loose = ' > 1'
    # tight
    filt.cut_jet_nhf_central_tight = ' < 0.90 '
    filt.cut_jet_nemf_central_tight = ' < 0.90 '
    filt.cut_jet_nconst_central_tight = ' > 1'
    # tightlep
    filt.cut_jet_nhf_central_tightlep = ' < 0.9 '
    filt.cut_jet_nemf_central_tightlep = ' < 0.9 '
    filt.cut_jet_nconst_central_tightlep = '> 1 '
    filt.cut_jet_muf_central_tightlep = '< 0.8 '
    # For -2.4 <= eta <= 2.4 in addition apply
    filt.cut_jet_chf_central_loose = ' > 0'
    filt.cut_jet_cmult_central_loose = ' > 0 '
    filt.cut_jet_cemf_central_loose = ' < 0.99 '
    filt.cut_jet_chf_central_tight = ' > 0 '
    filt.cut_jet_cmult_central_tight = ' > 0'
    filt.cut_jet_cemf_central_tight = ' < 0.99 '
    filt.cut_jet_chf_central_tightlep = ' > 0'
    filt.cut_jet_cmult_central_tightlep = ' > 0'
    filt.cut_jet_cemf_central_tightlep = ' < 0.90'

    # For 2.7 < abs(eta) <= 3.0
    filt.cut_jet_nhf_transition_loose = ' > 0.01 '
    filt.cut_jet_nemf_transition_loose = ' < 0.98 '
    filt.cut_jet_nmult_transition_loose = ' > 2 '
    filt.cut_jet_nhf_transition_tight = ' > 0.01 '
    filt.cut_jet_nemf_transition_tight = ' < 0.98 '
    filt.cut_jet_nmult_transition_tight = ' > 2 '
    # For abs(eta) > 3.0
    filt.cut_jet_nemf_forward_loose = ' < 0.90 '
    filt.cut_jet_nmult_forward_loose = '> 10 '
    filt.cut_jet_nemf_forward_tight = ' < 0.90 '
    filt.cut_jet_nmult_forward_tight = ' > 10 '

    #filt.cut_jet_el_dr = ' > 0.4 '
    #filt.cut_jet_ph_dr = ' > 0.4 '

    filt.cut_jet_CSV_Loose = ' > 0.5426 '
    filt.cut_jet_CSV_Medium = ' > 0.8484 '
    filt.cut_jet_CSV_Tight = ' > 0.9535 '
    filt.cut_jet_DeepJet_Loose = ' > 0.0614 '
    filt.cut_jet_DeepJet_Medium = ' > 0.3093 '
    filt.cut_jet_DeepJet_Tight = ' > 0.7221 '
    filt.add_var('evalBTagID', "medium")

    if do_hists:
        filt.add_hist('cut_pt', 100, 0, 500)
        filt.add_hist('cut_abseta', 50, 0, 5)

    return filt
示例#54
0
def filter_electron(el_pt=' > 25 ',
                    do_cutflow=False,
                    do_hists=False,
                    apply_corrections=False,
                    evalPID='medium',
                    invertIso=False):

    filt = Filter('FilterElectron')

    filt.cut_pt = el_pt
    filt.cut_eta = ' < 2.5'
    filt.cut_abssceta = ' <2.5 '

    #filt.cut_tight     = ' == True '
    #filt.cut_medium     = ' == True '
    #filt.cut_vid_tight     = ' == True '
    filt.cut_vid_medium = ' == True '
    filt.cut_muon_dr = ' > 0.4 '
    filt.add_var('triggerMatchBits', '58,109')
    filt.cut_d0_barrel = ' < 0.05 '
    filt.cut_d0_endcap = ' < 0.10 '
    filt.cut_dz_barrel = ' < 0.10 '
    filt.cut_dz_endcap = ' < 0.20 '
    filt.cut_hovere_94x = ' == True'
    filt.cut_isorho_94x = ' == True'

    ### 94X V2 PID cuts ###
    filt.cut_sigmaIEIE_barrel_tight = ' < 0.0104 '
    filt.cut_absdEtaIn_barrel_tight = ' < 0.00255 '
    filt.cut_absdPhiIn_barrel_tight = ' < 0.022 '
    filt.cut_hovere_barrel_tight = ' < 0.026'
    filt.cut_isoRho_barrel_tight = ' < 0.0287 '
    filt.cut_ooEmooP_barrel_tight = ' < 0.0159 '
    filt.cut_misshits_barrel_tight = ' < 2 '
    filt.cut_passConvVeto_barrel_tight = ' == 1 '

    filt.cut_sigmaIEIE_barrel_medium = ' < 0.0106 '
    filt.cut_absdEtaIn_barrel_medium = ' < 0.0032 '
    filt.cut_absdPhiIn_barrel_medium = ' < 0.0547 '
    filt.cut_hovere_barrel_medium = ' < 0.046 '
    filt.cut_isoRho_barrel_medium = ' < 0.0478 '
    filt.cut_ooEmooP_barrel_medium = ' < 0.184 '
    filt.cut_misshits_barrel_medium = ' < 2 '
    filt.cut_passConvVeto_barrel_medium = ' == 1 '

    filt.cut_sigmaIEIE_barrel_loose = ' < 0.0112 '
    filt.cut_absdEtaIn_barrel_loose = ' < 0.00377 '
    filt.cut_absdPhiIn_barrel_loose = ' < 0.0884 '
    filt.cut_hovere_barrel_loose = ' < 0.05 '
    filt.cut_isoRho_barrel_loose = ' < 0.112 '
    filt.cut_ooEmooP_barrel_loose = ' < 0.193 '
    filt.cut_misshits_barrel_loose = ' < 2 '
    filt.cut_passConvVeto_barrel_loose = ' == 1 '

    filt.cut_sigmaIEIE_barrel_veryloose = ' < 0.0126 '
    filt.cut_absdEtaIn_barrel_veryloose = ' < 0.00463 '
    filt.cut_absdPhiIn_barrel_veryloose = ' < 0.148 '
    filt.cut_hovere_barrel_veryloose = ' < 0.05 '
    filt.cut_isoRho_barrel_veryloose = ' < 0.198 '
    filt.cut_ooEmooP_barrel_veryloose = ' < 0.209 '
    filt.cut_misshits_barrel_veryloose = ' < 3 '
    filt.cut_passConvVeto_barrel_veryloose = ' == 1 '

    filt.cut_sigmaIEIE_endcap_tight = ' < 0.0353 '
    filt.cut_absdEtaIn_endcap_tight = ' < 0.00501 '
    filt.cut_absdPhiIn_endcap_tight = ' < 0.0236 '
    filt.cut_hovere_endcap_tight = ' < 0.0188'
    filt.cut_isoRho_endcap_tight = ' < 0.0445 '
    filt.cut_ooEmooP_endcap_tight = ' < 0.0197 '
    filt.cut_misshits_endcap_tight = ' < 2 '
    filt.cut_passConvVeto_endcap_tight = ' == 1 '

    filt.cut_sigmaIEIE_endcap_medium = ' < 0.0387 '
    filt.cut_absdEtaIn_endcap_medium = ' < 0.00632 '
    filt.cut_absdPhiIn_endcap_medium = ' < 0.0394 '
    filt.cut_hovere_endcap_medium = ' < 0.0275 '
    filt.cut_isoRho_endcap_medium = ' < 0.0658 '
    filt.cut_ooEmooP_endcap_medium = ' < 0.0721 '
    filt.cut_misshits_endcap_medium = ' <  2 '
    filt.cut_passConvVeto_endcap_medium = ' == 1 '

    filt.cut_sigmaIEIE_endcap_loose = ' < 0.0425 '
    filt.cut_absdEtaIn_endcap_loose = ' < 0.00674 '
    filt.cut_absdPhiIn_endcap_loose = ' < 0.169 '
    filt.cut_hovere_endcap_loose = ' < 0.0441 '
    filt.cut_isoRho_endcap_loose = ' < 0.108 '
    filt.cut_ooEmooP_endcap_loose = ' < 0.111 '
    filt.cut_misshits_endcap_loose = ' <  2 '
    filt.cut_passConvVeto_endcap_loose = ' == 1 '

    filt.cut_sigmaIEIE_endcap_veryloose = ' < 0.0457 '
    filt.cut_absdEtaIn_endcap_veryloose = ' < 0.00814 '
    filt.cut_absdPhiIn_endcap_veryloose = ' < 0.19 '
    filt.cut_hovere_endcap_veryloose = ' < 0.05 '
    filt.cut_isoRho_endcap_veryloose = ' < 0.203 '
    filt.cut_ooEmooP_endcap_veryloose = ' < 0.132 '
    filt.cut_misshits_endcap_veryloose = ' < 4 '
    filt.cut_passConvVeto_endcap_veryloose = ' == 1 '

    if invertIso:
        for key, var in vars(filt).items():
            if 'iso' in key:
                print('Inverting iso', key, var)
                filt.invert(key)


#    ### 80X VID cuts ###
#    filt.cut_sigmaIEIE_barrel_tight        = ' < 0.00998 '
#    filt.cut_absdEtaIn_barrel_tight        = ' < 0.00308 '
#    filt.cut_absdPhiIn_barrel_tight        = ' < 0.0816 '
#    filt.cut_hovere_barrel_tight           = ' < 0.0414 '
#    filt.cut_isoRho_barrel_tight           = ' < 0.0588 '
#    filt.cut_ooEmooP_barrel_tight          = ' < 0.0129 '
#    #filt.cut_d0_barrel_tight               = ' < 0.0111 '
#    #filt.cut_z0_barrel_tight               = ' < 0.0466 '
#    filt.cut_misshits_barrel_tight         = ' < 2 '
#    filt.cut_passConvVeto_barrel_tight     = ' == 1 '
#
#    filt.cut_sigmaIEIE_barrel_medium       = ' < 0.00998 '
#    filt.cut_absdEtaIn_barrel_medium       = ' < 0.00311 '
#    filt.cut_absdPhiIn_barrel_medium       = ' < 0.103 '
#    filt.cut_hovere_barrel_medium          = ' < 0.253 '
#    filt.cut_isoRho_barrel_medium          = ' < 0.0695 '
#    filt.cut_ooEmooP_barrel_medium         = ' < 0.134 '
#    #filt.cut_d0_barrel_medium              = ' < 0.0118 '
#    #filt.cut_z0_barrel_medium              = ' < 0.373 '
#    filt.cut_misshits_barrel_medium        = ' < 2 '
#    filt.cut_passConvVeto_barrel_medium    = ' == 1 '
#
#    filt.cut_sigmaIEIE_barrel_loose        = ' < 0.011 '
#    filt.cut_absdEtaIn_barrel_loose        = ' < 0.00477 '
#    filt.cut_absdPhiIn_barrel_loose        = ' < 0.222 '
#    filt.cut_hovere_barrel_loose           = ' < 0.298 '
#    filt.cut_isoRho_barrel_loose           = ' < 0.0994 '
#    filt.cut_ooEmooP_barrel_loose          = ' < 0.241 '
#    #filt.cut_d0_barrel_loose               = ' < 0.0261 '
#    #filt.cut_z0_barrel_loose               = ' < 0.41 '
#    filt.cut_misshits_barrel_loose         = ' < 2 '
#    filt.cut_passConvVeto_barrel_loose     = ' == 1 '
#
#    filt.cut_sigmaIEIE_barrel_veryloose    = ' < 0.0115 '
#    filt.cut_absdEtaIn_barrel_veryloose    = ' < 0.00749 '
#    filt.cut_absdPhiIn_barrel_veryloose    = ' < 0.228 '
#    filt.cut_hovere_barrel_veryloose       = ' < 0.356 '
#    filt.cut_isoRho_barrel_veryloose       = ' < 0.175 '
#    filt.cut_ooEmooP_barrel_veryloose      = ' < 0.299 '
#    #filt.cut_d0_barrel_veryloose           = ' < 0.0564 '
#    #filt.cut_z0_barrel_veryloose           = ' < 0.472 '
#    filt.cut_misshits_barrel_veryloose     = ' < 3 '
#    filt.cut_passConvVeto_barrel_veryloose = ' == 1 '
#
#    filt.cut_sigmaIEIE_endcap_tight        = ' < 0.0292 '
#    filt.cut_absdEtaIn_endcap_tight        = ' < 0.00605 '
#    filt.cut_absdPhiIn_endcap_tight        = ' < 0.0394 '
#    filt.cut_hovere_endcap_tight           = ' < 0.0641 '
#    filt.cut_isoRho_endcap_tight           = ' < 0.0571 '
#    filt.cut_ooEmooP_endcap_tight          = ' < 0.0129 '
#    #filt.cut_d0_endcap_tight               = ' < 0.0351 '
#    #filt.cut_z0_endcap_tight               = ' < 0.417 '
#    filt.cut_misshits_endcap_tight         = ' < 2 '
#    filt.cut_passConvVeto_endcap_tight     = ' == 1 '
#
#    filt.cut_sigmaIEIE_endcap_medium       = ' < 0.0298 '
#    filt.cut_absdEtaIn_endcap_medium       = ' < 0.00609 '
#    filt.cut_absdPhiIn_endcap_medium       = ' < 0.045 '
#    filt.cut_hovere_endcap_medium          = ' < 0.0878 '
#    filt.cut_isoRho_endcap_medium          = ' < 0.0821 '
#    filt.cut_ooEmooP_endcap_medium         = ' < 0.13 '
#    #filt.cut_d0_endcap_medium              = ' < 0.0739 '
#    #filt.cut_z0_endcap_medium              = ' < 0.602 '
#    filt.cut_misshits_endcap_medium        = ' <  2 '
#    filt.cut_passConvVeto_endcap_medium    = ' == 1 '
#
#    filt.cut_sigmaIEIE_endcap_loose        = ' < 0.0314 '
#    filt.cut_absdEtaIn_endcap_loose        = ' < 0.00868 '
#    filt.cut_absdPhiIn_endcap_loose        = ' < 0.213 '
#    filt.cut_hovere_endcap_loose           = ' < 0.101 '
#    filt.cut_isoRho_endcap_loose           = ' < 0.107 '
#    filt.cut_ooEmooP_endcap_loose          = ' < 0.14 '
#    #filt.cut_d0_endcap_loose               = ' < 0.118 '
#    #filt.cut_z0_endcap_loose               = ' < 0.822 '
#    filt.cut_misshits_endcap_loose         = ' <  2 '
#    filt.cut_passConvVeto_endcap_loose     = ' == 1 '
#
#    filt.cut_sigmaIEIE_endcap_veryloose    = ' < 0.037 '
#    filt.cut_absdEtaIn_endcap_veryloose    = ' < 0.00895 '
#    filt.cut_absdPhiIn_endcap_veryloose    = ' < 0.213 '
#    filt.cut_hovere_endcap_veryloose       = ' < 0.211 '
#    filt.cut_isoRho_endcap_veryloose       = ' < 0.159 '
#    filt.cut_ooEmooP_endcap_veryloose      = ' < 0.15 '
#    #filt.cut_d0_endcap_veryloose           = ' < 0.222 '
#    #filt.cut_z0_endcap_veryloose           = ' < 0.921 '
#    filt.cut_misshits_endcap_veryloose     = ' < 4 '
#    filt.cut_passConvVeto_endcap_veryloose = ' == 1 '

    if do_cutflow:
        filt.do_cutflow = True
        filt.add_var('evalPID', evalPID)

    if apply_corrections:
        workarea = os.getenv('WorkArea')
        filt.add_var('applyCorrections', 'true')
        filt.add_var(
            'correctionFile',
            '%s/TreeFilter/RecoWgg/data/step2-invMass_SC-loose-Et_20-trigger-noPF-HggRunEtaR9.dat'
            % workarea)
        filt.add_var(
            'smearingFile',
            '%s/TreeFilter/RecoWgg/data/outFile-step4-invMass_SC-loose-Et_20-trigger-noPF-HggRunEtaR9-smearEle.dat'
            % workarea)

    if do_hists:
        filt.add_hist('cut_pt', 100, 0, 200)
        filt.add_hist('cut_eta', 50, 0, 5)
        filt.add_hist('cut_abssceta', 50, 0, 5)
        filt.add_hist('cut_abseta_crack', 50, 0, 5)
        filt.add_hist('cut_absdEtaIn_barrel_medium', 100, -0.1, 0.1)
        filt.add_hist('cut_absdPhiIn_barrel_medium', 100, -0.1, 0.1)
        filt.add_hist('cut_sigmaIEIE_barrel_medium', 100, 0, 0.05)
        filt.add_hist('cut_hovere_barrel_medium', 100, -1, 1)
        filt.add_hist('cut_d0_barrel_medium', 100, -1, 1)
        filt.add_hist('cut_z0_barrel_medium', 100, -1, 1)
        filt.add_hist('cut_ooEmooP_barrel_medium', 100, 0, 1)
        filt.add_hist('cut_pfIso30_barrel_medium', 100, 0, 10)
        filt.add_hist('cut_passConvVeto_barrel_medium', 2, 0, 2)
        filt.add_hist('cut_misshits_barrel_medium', 10, 0, 10)

    return filt