Example #1
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
Example #2
0
def build_electron( do_cutflow=False, do_hists=False, filtPID=None, evalPID=None, applyCorrections=False ) :

    filt = Filter('BuildElectron')

    filt.do_cutflow = do_cutflow

    filt.cut_pt = ' > 5'
    filt.cut_abssceta       = ' <2.5 '
    # no crack for now
    #filt.cut_abssceta_crack = ' > 1.44 & < 1.57 '
    #filt.invert('cut_abssceta_crack')

    filt.cut_absdEtaIn_barrel_tight       = ' < 0.004 '
    filt.cut_absdPhiIn_barrel_tight       = ' < 0.03 '
    filt.cut_sigmaIEIE_barrel_tight       = ' < 0.01 '
    filt.cut_hovere_barrel_tight          = ' < 0.12 '
    filt.cut_d0_barrel_tight              = ' < 0.02 '
    filt.cut_z0_barrel_tight              = ' < 0.1 '
    filt.cut_eoverp_barrel_tight          = ' < 0.05 '
    filt.cut_pfIso30_barrel_tight         = ' < 0.1 '
    filt.cut_convfit_barrel_tight         = ' == 0 '
    filt.cut_misshits_barrel_tight        = ' == 0 '

    filt.cut_absdEtaIn_barrel_medium      = ' < 0.004 '
    filt.cut_absdPhiIn_barrel_medium      = ' < 0.06 '
    filt.cut_sigmaIEIE_barrel_medium      = ' < 0.01 '
    filt.cut_hovere_barrel_medium         = ' < 0.12 '
    filt.cut_d0_barrel_medium             = ' < 0.02 '
    filt.cut_z0_barrel_medium             = ' < 0.1 '
    filt.cut_eoverp_barrel_medium         = ' < 0.05 '
    filt.cut_pfIso30_barrel_medium        = ' < 0.15 '
    filt.cut_convfit_barrel_medium        = ' == 0 '
    filt.cut_misshits_barrel_medium       = ' <= 1 '

    filt.cut_absdEtaIn_barrel_loose       = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_loose       = ' < 0.15 '
    filt.cut_sigmaIEIE_barrel_loose       = ' < 0.01 '
    filt.cut_hovere_barrel_loose          = ' < 0.12 '
    filt.cut_d0_barrel_loose              = ' < 0.02 '
    filt.cut_z0_barrel_loose              = ' < 0.2 '
    filt.cut_eoverp_barrel_loose          = ' < 0.05 '
    filt.cut_pfIso30_barrel_loose         = ' < 0.15 '
    filt.cut_convfit_barrel_loose         = ' == 0 '
    filt.cut_misshits_barrel_loose        = ' <= 1 '

    filt.cut_absdEtaIn_barrel_veryloose   = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_veryloose   = ' < 0.8 '
    filt.cut_sigmaIEIE_barrel_veryloose   = ' < 0.01 '
    filt.cut_hovere_barrel_veryloose      = ' < 0.15 '
    filt.cut_d0_barrel_veryloose          = ' < 0.04 '
    filt.cut_z0_barrel_veryloose          = ' < 0.2 '
    #filt.cut_eoverp_barrel_veryloose     = ' < 0.05 ' #no cut
    filt.cut_pfIso30_barrel_veryloose     = ' < 0.1 '
    #filt.cut_convfit_barrel_veryloose    = ' == 0 ' #no cut
    #filt.cut_misshits_barrel_veryloose   = ' == 0 ' #no cut

    filt.cut_absdEtaIn_barrel_tightTrig   = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_tightTrig   = ' < 0.15 '
    filt.cut_sigmaIEIE_barrel_tightTrig   = ' < 0.01 '
    filt.cut_hovere_barrel_tightTrig      = ' < 0.12 '
    filt.cut_ecalIso30_barrel_tightTrig   = ' < 0.2 '
    filt.cut_hcalIso30_barrel_tightTrig   = ' < 0.2 '
    filt.cut_trkIso30_barrel_tightTrig    = ' < 0.2 '

    filt.cut_absdEtaIn_endcap_tight       = ' < 0.005 '
    filt.cut_absdPhiIn_endcap_tight       = ' < 0.02 '
    filt.cut_sigmaIEIE_endcap_tight       = ' < 0.03 '
    filt.cut_hovere_endcap_tight          = ' < 0.1 '
    filt.cut_d0_endcap_tight              = ' < 0.02 '
    filt.cut_z0_endcap_tight              = ' < 0.1 '
    filt.cut_eoverp_endcap_tight          = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_tight   = ' < 0.1 '
    filt.cut_pfIso30_endcap_highPt_tight  = ' < 0.15 '
    filt.cut_convfit_endcap_tight         = ' == 0 '
    filt.cut_misshits_endcap_tight        = ' == 0 '

    filt.cut_absdEtaIn_endcap_medium      = ' < 0.007 '
    filt.cut_absdPhiIn_endcap_medium      = ' < 0.03 '
    filt.cut_sigmaIEIE_endcap_medium      = ' < 0.03 '
    filt.cut_hovere_endcap_medium         = ' < 0.1 '
    filt.cut_d0_endcap_medium             = ' < 0.02 '
    filt.cut_z0_endcap_medium             = ' < 0.1 '
    filt.cut_eoverp_endcap_medium         = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_medium  = ' < 0.1 '
    filt.cut_pfIso30_endcap_highPt_medium = ' < 0.15 '
    filt.cut_convfit_endcap_medium        = ' == 0 '
    filt.cut_misshits_endcap_medium       = ' <= 1 '

    filt.cut_absdEtaIn_endcap_loose       = ' < 0.009 '
    filt.cut_absdPhiIn_endcap_loose       = ' < 0.1 '
    filt.cut_sigmaIEIE_endcap_loose       = ' < 0.03 '
    filt.cut_hovere_endcap_loose          = ' < 0.1 '
    filt.cut_d0_endcap_loose              = ' < 0.02 '
    filt.cut_z0_endcap_loose              = ' < 0.2 '
    filt.cut_eoverp_endcap_loose          = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_loose   = ' < 0.10 '
    filt.cut_pfIso30_endcap_highPt_loose  = ' < 0.15 '
    filt.cut_convfit_endcap_loose         = ' == 0 '
    filt.cut_misshits_endcap_loose        = ' <= 1 '

    filt.cut_absdEtaIn_endcap_veryloose   = ' < 0.01 '
    filt.cut_absdPhiIn_endcap_veryloose   = ' < 0.7 '
    filt.cut_sigmaIEIE_endcap_veryloose   = ' < 0.03 '
    #filt.cut_hovere_endcap_veryloose      = ' < 0.15 ' #no cut
    filt.cut_d0_endcap_veryloose          = ' < 0.04 '
    filt.cut_z0_endcap_veryloose          = ' < 0.2 '
    #filt.cut_eoverp_endcap_veryloose     = ' < 0.05 ' #no cut
    filt.cut_pfIso30_endcap_veryloose     = ' < 0.15 '
    #filt.cut_convfit_endcap_veryloose    = ' == 0 ' #no cut
    #filt.cut_misshits_endcap_veryloose   = ' == 0 ' #no cut

    filt.cut_absdEtaIn_endcap_tightTrig    = ' < 0.009 '
    filt.cut_absdPhiIn_endcap_tightTrig    = ' < 0.10 '
    filt.cut_sigmaIEIE_endcap_tightTrig    = ' < 0.03 '
    filt.cut_hovere_endcap_tightTrig       = ' < 0.1 '
    filt.cut_ecalIso30_endcap_tightTrig    = ' < 0.2 '
    filt.cut_hcalIso30_endcap_tightTrig    = ' < 0.2 '
    filt.cut_trkIso30_endcap_tightTrig     = ' < 0.2 '

    filt.cut_mva_central_lowpt_mvatrig     = ' > 0.0 '
    filt.cut_mva_crack_lowpt_mvatrig       = ' > 0.1 '
    filt.cut_mva_endcap_lowpt_mvatrig      = ' > 0.62 '
    filt.cut_mva_central_highpt_mvatrig    = ' > 0.94 '
    filt.cut_mva_crack_highpt_mvatrig      = ' > 0.85 '
    filt.cut_mva_endcap_highpt_mvatrig     = ' > 0.92 '
    
    filt.cut_relpfiso_mvatrig              = ' < 0.15 '
    filt.cut_misshits_mvatrig              = ' == 0 '
    filt.cut_convfit_mvatrig               = ' == 0 ' 

    filt.cut_mva_central_lowpt_mvanontrig  = ' > 0.47 '
    filt.cut_mva_crack_lowpt_mvanontrig    = ' > 0.004 '
    filt.cut_mva_endcap_lowpt_mvanontrig   = ' > 0.295 '
    filt.cut_mva_central_highpt_mvanontrig = ' > -0.34 '
    filt.cut_mva_crack_highpt_mvanontrig   = ' > -0.65 '
    filt.cut_mva_endcap_highpt_mvanontrig  = ' > 0.6 '
    
    filt.cut_relpfiso_mvanontrig           = ' < 0.4 '
    filt.cut_misshits_mvanontrig           = ' < 2 '
    filt.cut_sip_mvanontrig                = ' < 4' 

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

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

    if applyCorrections :
        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, 500 )
        filt.add_hist( 'cut_abseta', 50, 0, 5 )
        filt.add_hist( 'cut_abseta_crack', 50, 0, 5 )
        filt.add_hist( 'cut_absdEtaIn_barrel_tight', 100, -0.1, 0.1 )
        filt.add_hist( 'cut_absdPhiIn_barrel_tight', 100, -0.1, 0.1 )
        filt.add_hist( 'cut_sigmaIEIE_barrel_tight', 100, 0, 0.05 )
        filt.add_hist( 'cut_hovere_barrel_tight', 100, -1, 1 )
        filt.add_hist( 'cut_d0_barrel_tight', 100, -1, 1 )
        filt.add_hist( 'cut_z0_barrel_tight', 100, -1, 1 )
        filt.add_hist( 'cut_eoverp_barrel_tight', 100, 0, 1 )
        filt.add_hist( 'cut_pfIso30_barrel_tight', 100, 0, 10 )
        filt.add_hist( 'cut_convfit_barrel_tight', 2, 0, 2 )
        filt.add_hist( 'cut_misshits_barrel_tight', 10, 0, 10 )

        filt.add_hist( 'cut_mva_central_lowpt_mvatrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_crack_lowpt_mvatrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_endcap_lowpt_mvatrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_central_highpt_mvatrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_crack_highpt_mvatrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_endcap_highpt_mvatrig', 50, -1, 1 )
        
        filt.add_hist( 'cut_relpfiso_mvatrig', 50, 0, 5 )
        filt.add_hist( 'cut_misshits_mvatrig', 10, 0, 10 )
        filt.add_hist( 'cut_convfit_mvatrig', 2, 0, 1 )

        filt.add_hist( 'cut_mva_central_lowpt_mvanontrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_crack_lowpt_mvanontrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_endcap_lowpt_mvanontrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_central_highpt_mvanontrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_crack_highpt_mvanontrig', 50, -1, 1 )
        filt.add_hist( 'cut_mva_endcap_highpt_mvanontrig', 50, -1, 1 )
        
        filt.add_hist( 'cut_relpfiso_mvanontrig', 50, 0, 5 )
        filt.add_hist( 'cut_misshits_mvanontrig', 10, 0, 10 )
        filt.add_hist( 'cut_sip_mvanontrig', 50, 0, 10 )

    return filt
Example #3
0
def build_electron( do_cutflow=False, do_hists=False, filtPID=None, evalPID=None ) :

    filt = Filter('BuildElectron')

    filt.do_cutflow = do_cutflow

    filt.cut_pt = ' > 25'
    filt.cut_abssceta       = ' <2.5 '
    # no crack for now
    #filt.cut_abssceta_crack = ' > 1.44 & < 1.57 '
    #filt.invert('cut_abssceta_crack')

    filt.cut_absdEtaIn_barrel_tight       = ' < 0.004 '
    filt.cut_absdPhiIn_barrel_tight       = ' < 0.03 '
    filt.cut_sigmaIEIE_barrel_tight       = ' < 0.01 '
    filt.cut_hovere_barrel_tight          = ' < 0.12 '
    filt.cut_d0_barrel_tight              = ' < 0.02 '
    filt.cut_z0_barrel_tight              = ' < 0.1 '
    filt.cut_eoverp_barrel_tight          = ' < 0.05 '
    filt.cut_pfIso30_barrel_tight         = ' < 0.1 '
    filt.cut_convfit_barrel_tight         = ' < 0.000001 '
    filt.cut_misshits_barrel_tight        = ' == 0 '

    filt.cut_absdEtaIn_barrel_medium      = ' < 0.004 '
    filt.cut_absdPhiIn_barrel_medium      = ' < 0.06 '
    filt.cut_sigmaIEIE_barrel_medium      = ' < 0.01 '
    filt.cut_hovere_barrel_medium         = ' < 0.12 '
    filt.cut_d0_barrel_medium             = ' < 0.02 '
    filt.cut_z0_barrel_medium             = ' < 0.1 '
    filt.cut_eoverp_barrel_medium         = ' < 0.05 '
    filt.cut_pfIso30_barrel_medium        = ' < 0.15 '
    filt.cut_convfit_barrel_medium        = ' < 0.000001 '
    filt.cut_misshits_barrel_medium       = ' <= 1 '

    filt.cut_absdEtaIn_barrel_loose       = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_loose       = ' < 0.15 '
    filt.cut_sigmaIEIE_barrel_loose       = ' < 0.01 '
    filt.cut_hovere_barrel_loose          = ' < 0.12 '
    filt.cut_d0_barrel_loose              = ' < 0.02 '
    filt.cut_z0_barrel_loose              = ' < 0.2 '
    filt.cut_eoverp_barrel_loose          = ' < 0.05 '
    filt.cut_pfIso30_barrel_loose         = ' < 0.15 '
    filt.cut_convfit_barrel_loose         = ' < 0.000001 '
    filt.cut_misshits_barrel_loose        = ' <= 1 '

    filt.cut_absdEtaIn_barrel_veryloose   = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_veryloose   = ' < 0.8 '
    filt.cut_sigmaIEIE_barrel_veryloose   = ' < 0.01 '
    filt.cut_hovere_barrel_veryloose      = ' < 0.15 '
    filt.cut_d0_barrel_veryloose          = ' < 0.04 '
    filt.cut_z0_barrel_veryloose          = ' < 0.2 '
    #filt.cut_eoverp_barrel_veryloose     = ' < 0.05 ' #no cut
    filt.cut_pfIso30_barrel_veryloose     = ' < 0.1 '
    #filt.cut_convfit_barrel_veryloose    = ' < 0.000001 ' #no cut
    #filt.cut_misshits_barrel_veryloose   = ' == 0 ' #no cut

    filt.cut_absdEtaIn_barrel_tightTrig   = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_tightTrig   = ' < 0.15 '
    filt.cut_sigmaIEIE_barrel_tightTrig   = ' < 0.01 '
    filt.cut_hovere_barrel_tightTrig      = ' < 0.12 '
    filt.cut_ecalIso30_barrel_tightTrig   = ' < 0.2 '
    filt.cut_hcalIso30_barrel_tightTrig   = ' < 0.2 '
    filt.cut_trkIso30_barrel_tightTrig    = ' < 0.2 '

    filt.cut_absdEtaIn_endcap_tight       = ' < 0.005 '
    filt.cut_absdPhiIn_endcap_tight       = ' < 0.02 '
    filt.cut_sigmaIEIE_endcap_tight       = ' < 0.03 '
    filt.cut_hovere_endcap_tight          = ' < 0.1 '
    filt.cut_d0_endcap_tight              = ' < 0.02 '
    filt.cut_z0_endcap_tight              = ' < 0.1 '
    filt.cut_eoverp_endcap_tight          = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_tight   = ' < 0.1 '
    filt.cut_pfIso30_endcap_highPt_tight  = ' < 0.15 '
    filt.cut_convfit_endcap_tight         = ' < 0.000001 '
    filt.cut_misshits_endcap_tight        = ' == 0 '

    filt.cut_absdEtaIn_endcap_medium      = ' < 0.007 '
    filt.cut_absdPhiIn_endcap_medium      = ' < 0.03 '
    filt.cut_sigmaIEIE_endcap_medium      = ' < 0.03 '
    filt.cut_hovere_endcap_medium         = ' < 0.1 '
    filt.cut_d0_endcap_medium             = ' < 0.02 '
    filt.cut_z0_endcap_medium             = ' < 0.1 '
    filt.cut_eoverp_endcap_medium         = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_medium  = ' < 0.1 '
    filt.cut_pfIso30_endcap_highPt_medium = ' < 0.15 '
    filt.cut_convfit_endcap_medium        = ' < 0.000001 '
    filt.cut_misshits_endcap_medium       = ' <= 1 '

    filt.cut_absdEtaIn_endcap_loose       = ' < 0.009 '
    filt.cut_absdPhiIn_endcap_loose       = ' < 0.1 '
    filt.cut_sigmaIEIE_endcap_loose       = ' < 0.03 '
    filt.cut_hovere_endcap_loose          = ' < 0.1 '
    filt.cut_d0_endcap_loose              = ' < 0.02 '
    filt.cut_z0_endcap_loose              = ' < 0.2 '
    filt.cut_eoverp_endcap_loose          = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_loose   = ' < 0.10 '
    filt.cut_pfIso30_endcap_highPt_loose  = ' < 0.15 '
    filt.cut_convfit_endcap_loose         = ' < 0.000001 '
    filt.cut_misshits_endcap_loose        = ' <= 1 '

    filt.cut_absdEtaIn_endcap_veryloose   = ' < 0.01 '
    filt.cut_absdPhiIn_endcap_veryloose   = ' < 0.7 '
    filt.cut_sigmaIEIE_endcap_veryloose   = ' < 0.03 '
    #filt.cut_hovere_endcap_veryloose      = ' < 0.15 ' #no cut
    filt.cut_d0_endcap_veryloose          = ' < 0.04 '
    filt.cut_z0_endcap_veryloose          = ' < 0.2 '
    #filt.cut_eoverp_endcap_veryloose     = ' < 0.05 ' #no cut
    filt.cut_pfIso30_endcap_veryloose     = ' < 0.15 '
    #filt.cut_convfit_endcap_veryloose    = ' < 0.000001 ' #no cut
    #filt.cut_misshits_endcap_veryloose   = ' == 0 ' #no cut

    filt.cut_absdEtaIn_endcap_tightTrig   = ' < 0.009 '
    filt.cut_absdPhiIn_endcap_tightTrig   = ' < 0.10 '
    filt.cut_sigmaIEIE_endcap_tightTrig   = ' < 0.03 '
    filt.cut_hovere_endcap_tightTrig      = ' < 0.1 '
    filt.cut_ecalIso30_endcap_tightTrig   = ' < 0.2 '
    filt.cut_hcalIso30_endcap_tightTrig   = ' < 0.2 '
    filt.cut_trkIso30_endcap_tightTrig    = ' < 0.2 '

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

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

    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_absdEtaIn_barrel_tight', 100, -0.1, 0.1 )
        filt.add_hist( 'cut_absdPhiIn_barrel_tight', 100, -0.1, 0.1 )
        filt.add_hist( 'cut_sigmaIEIE_barrel_tight', 100, 0, 0.05 )
        filt.add_hist( 'cut_hovere_barrel_tight', 100, -1, 1 )
        filt.add_hist( 'cut_d0_barrel_tight', 100, -1, 1 )
        filt.add_hist( 'cut_z0_barrel_tight', 100, -1, 1 )
        filt.add_hist( 'cut_eoverp_barrel_tight', 100, 0, 1 )
        filt.add_hist( 'cut_pfIso30_barrel_tight', 100, 0, 10 )
        filt.add_hist( 'cut_convfit_barrel_tight', 2, 0, 2 )
        filt.add_hist( 'cut_misshits_barrel_tight', 10, 0, 10 )

    return filt
Example #4
0
def build_electron(do_cutflow=False,
                   do_hists=False,
                   filtPID=None,
                   evalPID=None,
                   applyCorrections=False):

    filt = Filter('BuildElectron')

    filt.do_cutflow = do_cutflow

    filt.cut_pt = ' > 10'
    filt.cut_abssceta = ' <2.5 '
    # no crack for now
    #filt.cut_abssceta_crack = ' > 1.44 & < 1.57 '
    #filt.invert('cut_abssceta_crack')

    filt.cut_absdEtaIn_barrel_tight = ' < 0.004 '
    filt.cut_absdPhiIn_barrel_tight = ' < 0.03 '
    filt.cut_sigmaIEIE_barrel_tight = ' < 0.01 '
    filt.cut_hovere_barrel_tight = ' < 0.12 '
    filt.cut_d0_barrel_tight = ' < 0.02 '
    filt.cut_z0_barrel_tight = ' < 0.1 '
    filt.cut_eoverp_barrel_tight = ' < 0.05 '
    filt.cut_pfIso30_barrel_tight = ' < 0.1 '
    filt.cut_convfit_barrel_tight = ' == 0 '
    filt.cut_misshits_barrel_tight = ' == 0 '

    filt.cut_absdEtaIn_barrel_medium = ' < 0.004 '
    filt.cut_absdPhiIn_barrel_medium = ' < 0.06 '
    filt.cut_sigmaIEIE_barrel_medium = ' < 0.01 '
    filt.cut_hovere_barrel_medium = ' < 0.12 '
    filt.cut_d0_barrel_medium = ' < 0.02 '
    filt.cut_z0_barrel_medium = ' < 0.1 '
    filt.cut_eoverp_barrel_medium = ' < 0.05 '
    filt.cut_pfIso30_barrel_medium = ' < 0.15 '
    filt.cut_convfit_barrel_medium = ' == 0 '
    filt.cut_misshits_barrel_medium = ' <= 1 '

    filt.cut_absdEtaIn_barrel_loose = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_loose = ' < 0.15 '
    filt.cut_sigmaIEIE_barrel_loose = ' < 0.01 '
    filt.cut_hovere_barrel_loose = ' < 0.12 '
    filt.cut_d0_barrel_loose = ' < 0.02 '
    filt.cut_z0_barrel_loose = ' < 0.2 '
    filt.cut_eoverp_barrel_loose = ' < 0.05 '
    filt.cut_pfIso30_barrel_loose = ' < 0.15 '
    filt.cut_convfit_barrel_loose = ' == 0 '
    filt.cut_misshits_barrel_loose = ' <= 1 '

    filt.cut_absdEtaIn_barrel_veryloose = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_veryloose = ' < 0.8 '
    filt.cut_sigmaIEIE_barrel_veryloose = ' < 0.01 '
    filt.cut_hovere_barrel_veryloose = ' < 0.15 '
    filt.cut_d0_barrel_veryloose = ' < 0.04 '
    filt.cut_z0_barrel_veryloose = ' < 0.2 '
    #filt.cut_eoverp_barrel_veryloose     = ' < 0.05 ' #no cut
    filt.cut_pfIso30_barrel_veryloose = ' < 0.1 '
    #filt.cut_convfit_barrel_veryloose    = ' == 0 ' #no cut
    #filt.cut_misshits_barrel_veryloose   = ' == 0 ' #no cut

    filt.cut_absdEtaIn_barrel_tightTrig = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_tightTrig = ' < 0.15 '
    filt.cut_sigmaIEIE_barrel_tightTrig = ' < 0.01 '
    filt.cut_hovere_barrel_tightTrig = ' < 0.12 '
    filt.cut_ecalIso30_barrel_tightTrig = ' < 0.2 '
    filt.cut_hcalIso30_barrel_tightTrig = ' < 0.2 '
    filt.cut_trkIso30_barrel_tightTrig = ' < 0.2 '

    filt.cut_absdEtaIn_endcap_tight = ' < 0.005 '
    filt.cut_absdPhiIn_endcap_tight = ' < 0.02 '
    filt.cut_sigmaIEIE_endcap_tight = ' < 0.03 '
    filt.cut_hovere_endcap_tight = ' < 0.1 '
    filt.cut_d0_endcap_tight = ' < 0.02 '
    filt.cut_z0_endcap_tight = ' < 0.1 '
    filt.cut_eoverp_endcap_tight = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_tight = ' < 0.1 '
    filt.cut_pfIso30_endcap_highPt_tight = ' < 0.15 '
    filt.cut_convfit_endcap_tight = ' == 0 '
    filt.cut_misshits_endcap_tight = ' == 0 '

    filt.cut_absdEtaIn_endcap_medium = ' < 0.007 '
    filt.cut_absdPhiIn_endcap_medium = ' < 0.03 '
    filt.cut_sigmaIEIE_endcap_medium = ' < 0.03 '
    filt.cut_hovere_endcap_medium = ' < 0.1 '
    filt.cut_d0_endcap_medium = ' < 0.02 '
    filt.cut_z0_endcap_medium = ' < 0.1 '
    filt.cut_eoverp_endcap_medium = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_medium = ' < 0.1 '
    filt.cut_pfIso30_endcap_highPt_medium = ' < 0.15 '
    filt.cut_convfit_endcap_medium = ' == 0 '
    filt.cut_misshits_endcap_medium = ' <= 1 '

    filt.cut_absdEtaIn_endcap_loose = ' < 0.009 '
    filt.cut_absdPhiIn_endcap_loose = ' < 0.1 '
    filt.cut_sigmaIEIE_endcap_loose = ' < 0.03 '
    filt.cut_hovere_endcap_loose = ' < 0.1 '
    filt.cut_d0_endcap_loose = ' < 0.02 '
    filt.cut_z0_endcap_loose = ' < 0.2 '
    filt.cut_eoverp_endcap_loose = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_loose = ' < 0.10 '
    filt.cut_pfIso30_endcap_highPt_loose = ' < 0.15 '
    filt.cut_convfit_endcap_loose = ' == 0 '
    filt.cut_misshits_endcap_loose = ' <= 1 '

    filt.cut_absdEtaIn_endcap_veryloose = ' < 0.01 '
    filt.cut_absdPhiIn_endcap_veryloose = ' < 0.7 '
    filt.cut_sigmaIEIE_endcap_veryloose = ' < 0.03 '
    #filt.cut_hovere_endcap_veryloose      = ' < 0.15 ' #no cut
    filt.cut_d0_endcap_veryloose = ' < 0.04 '
    filt.cut_z0_endcap_veryloose = ' < 0.2 '
    #filt.cut_eoverp_endcap_veryloose     = ' < 0.05 ' #no cut
    filt.cut_pfIso30_endcap_veryloose = ' < 0.15 '
    #filt.cut_convfit_endcap_veryloose    = ' == 0 ' #no cut
    #filt.cut_misshits_endcap_veryloose   = ' == 0 ' #no cut

    filt.cut_absdEtaIn_endcap_tightTrig = ' < 0.009 '
    filt.cut_absdPhiIn_endcap_tightTrig = ' < 0.10 '
    filt.cut_sigmaIEIE_endcap_tightTrig = ' < 0.03 '
    filt.cut_hovere_endcap_tightTrig = ' < 0.1 '
    filt.cut_ecalIso30_endcap_tightTrig = ' < 0.2 '
    filt.cut_hcalIso30_endcap_tightTrig = ' < 0.2 '
    filt.cut_trkIso30_endcap_tightTrig = ' < 0.2 '

    filt.cut_mva_central_lowpt_mvatrig = ' > 0.0 '
    filt.cut_mva_crack_lowpt_mvatrig = ' > 0.1 '
    filt.cut_mva_endcap_lowpt_mvatrig = ' > 0.62 '
    filt.cut_mva_central_highpt_mvatrig = ' > 0.94 '
    filt.cut_mva_crack_highpt_mvatrig = ' > 0.85 '
    filt.cut_mva_endcap_highpt_mvatrig = ' > 0.92 '

    filt.cut_relpfiso_mvatrig = ' < 0.15 '
    filt.cut_misshits_mvatrig = ' == 0 '
    filt.cut_convfit_mvatrig = ' == 0 '

    filt.cut_mva_central_lowpt_mvanontrig = ' > 0.47 '
    filt.cut_mva_crack_lowpt_mvanontrig = ' > 0.004 '
    filt.cut_mva_endcap_lowpt_mvanontrig = ' > 0.295 '
    filt.cut_mva_central_highpt_mvanontrig = ' > -0.34 '
    filt.cut_mva_crack_highpt_mvanontrig = ' > -0.65 '
    filt.cut_mva_endcap_highpt_mvanontrig = ' > 0.6 '

    filt.cut_relpfiso_mvanontrig = ' < 0.4 '
    filt.cut_misshits_mvanontrig = ' < 2 '
    filt.cut_sip_mvanontrig = ' < 4'

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

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

    if applyCorrections:
        workarea = os.getenv('WorkArea')
        filt.add_var('applyCorrections', 'true')
        filt.add_var(
            'correctionFile',
            '%s/TreeFilter/RecoWgg/data/scalesNewReg-May2013.csv' % workarea)
        filt.add_var(
            'linCorrectionFile',
            '%s/TreeFilter/RecoWgg/data/linearityNewReg-May2013.csv' %
            workarea)

    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_absdEtaIn_barrel_tight', 100, -0.1, 0.1)
        filt.add_hist('cut_absdPhiIn_barrel_tight', 100, -0.1, 0.1)
        filt.add_hist('cut_sigmaIEIE_barrel_tight', 100, 0, 0.05)
        filt.add_hist('cut_hovere_barrel_tight', 100, -1, 1)
        filt.add_hist('cut_d0_barrel_tight', 100, -1, 1)
        filt.add_hist('cut_z0_barrel_tight', 100, -1, 1)
        filt.add_hist('cut_eoverp_barrel_tight', 100, 0, 1)
        filt.add_hist('cut_pfIso30_barrel_tight', 100, 0, 10)
        filt.add_hist('cut_convfit_barrel_tight', 2, 0, 2)
        filt.add_hist('cut_misshits_barrel_tight', 10, 0, 10)

        filt.add_hist('cut_mva_central_lowpt_mvatrig', 50, -1, 1)
        filt.add_hist('cut_mva_crack_lowpt_mvatrig', 50, -1, 1)
        filt.add_hist('cut_mva_endcap_lowpt_mvatrig', 50, -1, 1)
        filt.add_hist('cut_mva_central_highpt_mvatrig', 50, -1, 1)
        filt.add_hist('cut_mva_crack_highpt_mvatrig', 50, -1, 1)
        filt.add_hist('cut_mva_endcap_highpt_mvatrig', 50, -1, 1)

        filt.add_hist('cut_relpfiso_mvatrig', 50, 0, 5)
        filt.add_hist('cut_misshits_mvatrig', 10, 0, 10)
        filt.add_hist('cut_convfit_mvatrig', 2, 0, 1)

        filt.add_hist('cut_mva_central_lowpt_mvanontrig', 50, -1, 1)
        filt.add_hist('cut_mva_crack_lowpt_mvanontrig', 50, -1, 1)
        filt.add_hist('cut_mva_endcap_lowpt_mvanontrig', 50, -1, 1)
        filt.add_hist('cut_mva_central_highpt_mvanontrig', 50, -1, 1)
        filt.add_hist('cut_mva_crack_highpt_mvanontrig', 50, -1, 1)
        filt.add_hist('cut_mva_endcap_highpt_mvanontrig', 50, -1, 1)

        filt.add_hist('cut_relpfiso_mvanontrig', 50, 0, 5)
        filt.add_hist('cut_misshits_mvanontrig', 10, 0, 10)
        filt.add_hist('cut_sip_mvanontrig', 50, 0, 10)

    return filt
Example #5
0
def build_electron(do_cutflow=False,
                   do_hists=False,
                   filtPID=None,
                   evalPID=None):

    filt = Filter('BuildElectron')

    filt.do_cutflow = do_cutflow

    filt.cut_pt = ' > 25'
    filt.cut_abssceta = ' <2.5 '
    # no crack for now
    #filt.cut_abssceta_crack = ' > 1.44 & < 1.57 '
    #filt.invert('cut_abssceta_crack')

    filt.cut_absdEtaIn_barrel_tight = ' < 0.004 '
    filt.cut_absdPhiIn_barrel_tight = ' < 0.03 '
    filt.cut_sigmaIEIE_barrel_tight = ' < 0.01 '
    filt.cut_hovere_barrel_tight = ' < 0.12 '
    filt.cut_d0_barrel_tight = ' < 0.02 '
    filt.cut_z0_barrel_tight = ' < 0.1 '
    filt.cut_eoverp_barrel_tight = ' < 0.05 '
    filt.cut_pfIso30_barrel_tight = ' < 0.1 '
    filt.cut_convfit_barrel_tight = ' < 0.000001 '
    filt.cut_misshits_barrel_tight = ' == 0 '

    filt.cut_absdEtaIn_barrel_medium = ' < 0.004 '
    filt.cut_absdPhiIn_barrel_medium = ' < 0.06 '
    filt.cut_sigmaIEIE_barrel_medium = ' < 0.01 '
    filt.cut_hovere_barrel_medium = ' < 0.12 '
    filt.cut_d0_barrel_medium = ' < 0.02 '
    filt.cut_z0_barrel_medium = ' < 0.1 '
    filt.cut_eoverp_barrel_medium = ' < 0.05 '
    filt.cut_pfIso30_barrel_medium = ' < 0.15 '
    filt.cut_convfit_barrel_medium = ' < 0.000001 '
    filt.cut_misshits_barrel_medium = ' <= 1 '

    filt.cut_absdEtaIn_barrel_loose = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_loose = ' < 0.15 '
    filt.cut_sigmaIEIE_barrel_loose = ' < 0.01 '
    filt.cut_hovere_barrel_loose = ' < 0.12 '
    filt.cut_d0_barrel_loose = ' < 0.02 '
    filt.cut_z0_barrel_loose = ' < 0.2 '
    filt.cut_eoverp_barrel_loose = ' < 0.05 '
    filt.cut_pfIso30_barrel_loose = ' < 0.15 '
    filt.cut_convfit_barrel_loose = ' < 0.000001 '
    filt.cut_misshits_barrel_loose = ' <= 1 '

    filt.cut_absdEtaIn_barrel_veryloose = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_veryloose = ' < 0.8 '
    filt.cut_sigmaIEIE_barrel_veryloose = ' < 0.01 '
    filt.cut_hovere_barrel_veryloose = ' < 0.15 '
    filt.cut_d0_barrel_veryloose = ' < 0.04 '
    filt.cut_z0_barrel_veryloose = ' < 0.2 '
    #filt.cut_eoverp_barrel_veryloose     = ' < 0.05 ' #no cut
    filt.cut_pfIso30_barrel_veryloose = ' < 0.1 '
    #filt.cut_convfit_barrel_veryloose    = ' < 0.000001 ' #no cut
    #filt.cut_misshits_barrel_veryloose   = ' == 0 ' #no cut

    filt.cut_absdEtaIn_barrel_tightTrig = ' < 0.007 '
    filt.cut_absdPhiIn_barrel_tightTrig = ' < 0.15 '
    filt.cut_sigmaIEIE_barrel_tightTrig = ' < 0.01 '
    filt.cut_hovere_barrel_tightTrig = ' < 0.12 '
    filt.cut_ecalIso30_barrel_tightTrig = ' < 0.2 '
    filt.cut_hcalIso30_barrel_tightTrig = ' < 0.2 '
    filt.cut_trkIso30_barrel_tightTrig = ' < 0.2 '

    filt.cut_absdEtaIn_endcap_tight = ' < 0.005 '
    filt.cut_absdPhiIn_endcap_tight = ' < 0.02 '
    filt.cut_sigmaIEIE_endcap_tight = ' < 0.03 '
    filt.cut_hovere_endcap_tight = ' < 0.1 '
    filt.cut_d0_endcap_tight = ' < 0.02 '
    filt.cut_z0_endcap_tight = ' < 0.1 '
    filt.cut_eoverp_endcap_tight = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_tight = ' < 0.1 '
    filt.cut_pfIso30_endcap_highPt_tight = ' < 0.15 '
    filt.cut_convfit_endcap_tight = ' < 0.000001 '
    filt.cut_misshits_endcap_tight = ' == 0 '

    filt.cut_absdEtaIn_endcap_medium = ' < 0.007 '
    filt.cut_absdPhiIn_endcap_medium = ' < 0.03 '
    filt.cut_sigmaIEIE_endcap_medium = ' < 0.03 '
    filt.cut_hovere_endcap_medium = ' < 0.1 '
    filt.cut_d0_endcap_medium = ' < 0.02 '
    filt.cut_z0_endcap_medium = ' < 0.1 '
    filt.cut_eoverp_endcap_medium = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_medium = ' < 0.1 '
    filt.cut_pfIso30_endcap_highPt_medium = ' < 0.15 '
    filt.cut_convfit_endcap_medium = ' < 0.000001 '
    filt.cut_misshits_endcap_medium = ' <= 1 '

    filt.cut_absdEtaIn_endcap_loose = ' < 0.009 '
    filt.cut_absdPhiIn_endcap_loose = ' < 0.1 '
    filt.cut_sigmaIEIE_endcap_loose = ' < 0.03 '
    filt.cut_hovere_endcap_loose = ' < 0.1 '
    filt.cut_d0_endcap_loose = ' < 0.02 '
    filt.cut_z0_endcap_loose = ' < 0.2 '
    filt.cut_eoverp_endcap_loose = ' < 0.05 '
    filt.cut_pfIso30_endcap_lowPt_loose = ' < 0.10 '
    filt.cut_pfIso30_endcap_highPt_loose = ' < 0.15 '
    filt.cut_convfit_endcap_loose = ' < 0.000001 '
    filt.cut_misshits_endcap_loose = ' <= 1 '

    filt.cut_absdEtaIn_endcap_veryloose = ' < 0.01 '
    filt.cut_absdPhiIn_endcap_veryloose = ' < 0.7 '
    filt.cut_sigmaIEIE_endcap_veryloose = ' < 0.03 '
    #filt.cut_hovere_endcap_veryloose      = ' < 0.15 ' #no cut
    filt.cut_d0_endcap_veryloose = ' < 0.04 '
    filt.cut_z0_endcap_veryloose = ' < 0.2 '
    #filt.cut_eoverp_endcap_veryloose     = ' < 0.05 ' #no cut
    filt.cut_pfIso30_endcap_veryloose = ' < 0.15 '
    #filt.cut_convfit_endcap_veryloose    = ' < 0.000001 ' #no cut
    #filt.cut_misshits_endcap_veryloose   = ' == 0 ' #no cut

    filt.cut_absdEtaIn_endcap_tightTrig = ' < 0.009 '
    filt.cut_absdPhiIn_endcap_tightTrig = ' < 0.10 '
    filt.cut_sigmaIEIE_endcap_tightTrig = ' < 0.03 '
    filt.cut_hovere_endcap_tightTrig = ' < 0.1 '
    filt.cut_ecalIso30_endcap_tightTrig = ' < 0.2 '
    filt.cut_hcalIso30_endcap_tightTrig = ' < 0.2 '
    filt.cut_trkIso30_endcap_tightTrig = ' < 0.2 '

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

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

    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_absdEtaIn_barrel_tight', 100, -0.1, 0.1)
        filt.add_hist('cut_absdPhiIn_barrel_tight', 100, -0.1, 0.1)
        filt.add_hist('cut_sigmaIEIE_barrel_tight', 100, 0, 0.05)
        filt.add_hist('cut_hovere_barrel_tight', 100, -1, 1)
        filt.add_hist('cut_d0_barrel_tight', 100, -1, 1)
        filt.add_hist('cut_z0_barrel_tight', 100, -1, 1)
        filt.add_hist('cut_eoverp_barrel_tight', 100, 0, 1)
        filt.add_hist('cut_pfIso30_barrel_tight', 100, 0, 10)
        filt.add_hist('cut_convfit_barrel_tight', 2, 0, 2)
        filt.add_hist('cut_misshits_barrel_tight', 10, 0, 10)

    return filt
Example #6
0
def build_electron( do_cutflow=False, do_hists=False, filtPID=None, evalPID=None, applyCorrections=False ) :

    filt = Filter('BuildElectron')

    filt.do_cutflow = do_cutflow

    # using values here
    #https://twiki.cern.ch/twiki/bin/view/CMS/CutBasedElectronIdentificationRun2
    # d0 and z0 cuts not recommeded
    # as of Dec 2016

    filt.cut_pt = ' > 10'
    filt.cut_abssceta       = ' <2.5 '
    #filt.cut_abssceta       = ' <1.479 '
    #filt.cut_abssceta       = ' >= 1.479 & < 2.5'
    # no crack for now
    #filt.cut_abssceta_crack = ' > 1.4442 & < 1.566 '
    #filt.invert('cut_abssceta_crack')
    #filt.invert('cut_abssceta')

    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         = ' < 1 '
    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        = ' < 1 '
    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         = ' < 1 '
    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     = ' < 2 '
    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         = ' < 1 '
    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        = ' <  1 '
    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         = ' <  1 '
    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     = ' < 3 '
    filt.cut_passConvVeto_endcap_veryloose = ' == 1 '


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

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

    if applyCorrections :
        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, 500 )
        filt.add_hist( 'cut_abseta', 50, 0, 5 )
        filt.add_hist( 'cut_abseta_crack', 50, 0, 5 )
        filt.add_hist( 'cut_absdEtaIn_barrel_tight', 100, -0.1, 0.1 )
        filt.add_hist( 'cut_absdPhiIn_barrel_tight', 100, -0.1, 0.1 )
        filt.add_hist( 'cut_sigmaIEIE_barrel_tight', 100, 0, 0.05 )
        filt.add_hist( 'cut_hovere_barrel_tight', 100, -1, 1 )
        filt.add_hist( 'cut_d0_barrel_tight', 100, -1, 1 )
        filt.add_hist( 'cut_z0_barrel_tight', 100, -1, 1 )
        filt.add_hist( 'cut_ooEmooP_barrel_tight', 100, 0, 1 )
        filt.add_hist( 'cut_pfIso30_barrel_tight', 100, 0, 10 )
        filt.add_hist( 'cut_passConvVeto_barrel_tight', 2, 0, 2 )
        filt.add_hist( 'cut_misshits_barrel_tight', 10, 0, 10 )

    return filt