def add_sihih_shifted_histos(process):
    process.sihihShiftPath = cms.Path()
    cut_token = pho_cuts.cuts["sihihEB"]
    for shift_int in xrange(900, 1050, 2):

        # prepare tokens 
        shift           = (shift_int - 1000) * 0.00001
        shift_id        = "TemplateSihihShift%04d" % shift_int
        shift_cut       = list(cut_token)
        shift_cut[4]    = ("%.5f + " % shift) + shift_cut[4]
        shift_cut[5]    = ("%.5f + " % shift) + shift_cut[5]

        # n - 1 Plot takes input from existing n-1 filter
        real_tmplt      = pho_cuts.make_histo_analyzer("PhotonsSihihreal", shift_cut)
        fake_tmplt      = pho_cuts.make_histo_analyzer("PhotonsSihihfake", shift_cut)
        fakeGamma_tmplt = pho_cuts.make_histo_analyzer("PhotonsSihihfakeGamma", shift_cut)

        # add to process and to path
        setattr(process, shift_id+"real",       real_tmplt)
        setattr(process, shift_id+"fake",       fake_tmplt)
        setattr(process, shift_id+"fakeGamma",  fakeGamma_tmplt)
        process.sihihShiftPath *= real_tmplt
        process.sihihShiftPath *= fake_tmplt
        process.sihihShiftPath *= fakeGamma_tmplt
photonsWithSihihCut = cms.EDFilter("PATPhotonSelector",
    src = cms.InputTag("photonInputDummy"),
#    cut = cms.string("sigmaIetaIeta<0.011"),
    cut = cms.string(""),
    filter = cms.bool(False)
)

photonsWithChHadIsoCut = cms.EDFilter("PATPhotonSelector",
    src = cms.InputTag("photonInputDummy"),
#    cut = cms.string("max(chargedHadronIso - (userFloat('kt6pf_rho')*userFloat('EA_charged')), 0.) < 0.7"),
    cut = cms.string(""),
    filter = cms.bool(False)
)

photonSigTemplateSihih = make_histo_analyzer(
    "photonsWithSihihCut",
    cuts["chargedHadronIsoEB"]
)

photonSigTemplateChHadIso = make_histo_analyzer(
    "photonsWithChHadIsoCut",
    cuts["sihihEB"]
)

signalTemplateSequence = cms.Sequence(
    photonInputDummy
    * photonsWithSihihCut
    * photonsWithChHadIsoCut
    * photonSigTemplateSihih
    * photonSigTemplateChHadIso
)
_template_input_collection = "Nm1FiltsihihEB"

# Take only one photon per event (photons are pt-ordered)
firstPhotonForSihih = cms.EDProducer("FirstPhotonPicker",
    src = cms.InputTag(_template_input_collection)
)
_template_input_collection = "firstPhotonForSihih"

PhotonsSihih = cms.EDFilter("PATPhotonSelector",
    src = cms.InputTag(_template_input_collection),
    cut = cms.string(""),
    filter = cms.bool(False)
)

TemplateSihih = pho_cuts.make_histo_analyzer(
    "PhotonsSihih",
    pho_cuts.cuts["sihihEB"]
)

TemplatePathSihih = cms.Path(
    firstPhotonForSihih
    * PhotonsSihih
    * TemplateSihih
)


################################################# sihih templates (only mc) ###

# Filters
PhotonsSihihreal = cms.EDFilter("PATPhotonSelector",
    src = cms.InputTag(_template_input_collection),
    cut = cms.string(real),
示例#4
0

from MyPackage.TtGamma8TeV.cff_photonIDCuts import make_histo_analyzer
import FWCore.ParameterSet.Config as cms

JetAnaChEmFrac = make_histo_analyzer(
    "selectedPatJetsForAnalysis20",
    ("", 0., 1.1, 80,
     "Jets: neutralEmEnergyFraction", "neutralEmEnergyFraction"),
)

JetAnaChHadFrac = make_histo_analyzer(
    "selectedPatJetsForAnalysis20",
    ("", 0., 1.1, 80,
     "Jets: neutralHadronEnergyFraction","neutralHadronEnergyFraction"),
)

AnalysisJets = cms.EDFilter("PATJetSelector",
    src = cms.InputTag("selectedPatJetsForAnalysis20"),
    cut = cms.string("neutralEmEnergyFraction < 0.75"),
    filter = cms.bool(False)
)

jetSequence = cms.Sequence(
    JetAnaChEmFrac *
    JetAnaChHadFrac *
    AnalysisJets
)