Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
import FWCore.ParameterSet.Config as cms
from   FWCore.PythonUtilities.LumiList import LumiList
from   os import environ
from   os.path import exists, join

def findFileInPath(theFile):
    for s in environ["CMSSW_SEARCH_PATH"].split(":"):
        attempt = join(s,theFile)
        if exists(attempt):
            return attempt                                                 
    return None

#--------------------------------------------------
#   Pick a set of events
#   defined by a set of run:luminositysection
#--------------------------------------------------

muon_json_2012_pickEvents = cms.EDFilter(
    "PickEvents",

    # chose between two definitions for the selection:
    #    run/lumiSection -based with input from a json file (what THIS example does)
    #    run/event -based with input from a json file (the historical PickEvents)

    IsRunLsBased  = cms.bool(True),

    # the file listrunev is unused, in this example
    RunEventList = cms.untracked.string('DPGAnalysis/Skims/data/listrunev'),

    # the format of the json.txt file is the one of the CMS certification ("Compact list" according to LumiList)
    LuminositySectionsBlockRange = LumiList(findFileInPath("DPGAnalysis/Skims/data/Cert_190456-208686_8TeV_22Jan2013ReReco_Collisions12_JSON_MuonPhys.txt")).getVLuminosityBlockRange()

    
    )

muon_json_2012 = cms.Sequence( muon_json_2012_pickEvents )