selectedComponents = [yt_tWZ_filter]
    # test new MC
    #GluGluToZZTo2e2mu.files = ['root://cms-xrd-global.cern.ch//store/mc/RunIISummer16MiniAODv2/GluGluToContinToZZTo2e2mu_13TeV_MCFM701_pythia8/MINIAODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/70000/A669DB9C-B8BD-E611-B462-001E67E33C60.root']
    #selectedComponents = [GluGluToZZTo2e2mu]

    #selectedComponents = [ttZ0j_ll]
    #selectedComponents = [WZTo3LNu]
    #selectedComponents = [JetHT_Run2016B_03Feb2017_v2]
    for comp in selectedComponents:
        comp.files = comp.files[:1]
        print comp.files
        comp.splitFactor = 10

from CMGTools.TTHAnalysis.tools.EOSEventsWithDownload import EOSEventsWithDownload
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
event_class = Events
if getHeppyOption("fetch"):
  event_class = EOSEventsWithDownload

preprocessorFile = "$CMSSW_BASE/python/CMGTools/StopsDilepton/preprocessor/runBTaggingSlimPreprocessor_cfg.py"
from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
preprocessor = CmsswPreprocessor(preprocessorFile)
jetAna.jetCol = 'selectedUpdatedPatJets'

config = cfg.Config( components = selectedComponents,
                     sequence = sequence,
                     services = [],
                     preprocessor=preprocessor, 
                     events_class = event_class)

# the following two lines are just for automatic testing
# they are not needed for running on your own samples
from PhysicsTools.Heppy.utils.miniAodFiles import miniAodFiles
testfiles = miniAodFiles()

sample = cfg.Component(
    #specify the file you want to run on
    #    files = ["/scratch/arizzi/Hbb/CMSSW_7_2_2_patch2/src/VHbbAnalysis/Heppy/test/ZLL-8A345C56-6665-E411-9C25-1CC1DE04DF20.root"],
    files=testfiles,
    name="SingleSample",
    isMC=False,
    isEmbed=False)

from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
preprocessor = CmsswPreprocessor("makeAK5Jets.py")

# the following is declared in case this cfg is used in input to the heppy.py script
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
selectedComponents = [sample]
config = cfg.Config(
    components=selectedComponents,
    sequence=sequence,
    services=[output_service],
    preprocessor=
    preprocessor,  #this would run cmsRun makeAK5Jets.py before running Heppy
    events_class=Events)

# and the following runs the process directly if running as with python filename.py
if __name__ == '__main__':
    from PhysicsTools.HeppyCore.framework.looper import Looper
###################################################
###            SET BATCH OR LOCAL               ###
###################################################
if not production:
    cache = True
    comp = data_tau[0]
    selectedComponents = [comp]
    comp.splitFactor = 2
    comp.fineSplitFactor = 1
    comp.files = comp.files[:2]

preprocessor = None
if cmssw:
    sequence.append(fileCleaner)
    preprocessor = CmsswPreprocessor(
        "$CMSSW_BASE/src/CMGTools/H2TauTau/prod/h2TauTauMiniAOD_ditau_data_cfg.py",
        addOrigAsSecondary=False)

# the following is declared in case this cfg is used in input to the
# heppy.py script
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
config = cfg.Config(components=selectedComponents,
                    sequence=sequence,
                    services=[],
                    preprocessor=preprocessor,
                    events_class=Events)

printComps(config.components, True)


def modCfgForPlot(config):
示例#4
0
###################################################
###            SET BATCH OR LOCAL               ###
###################################################
if not production:
    comp = data_list[0] if data else sync_list[0]
    # comp = SMS
    # comp = samples_susy[1]
    selectedComponents = [comp]
    comp.splitFactor = 4
    comp.fineSplitFactor = 1
    # comp.files = comp.files[13:20]

preprocessor = None
if cmssw:
    sequence.append(fileCleaner)
    cfg_name = "$CMSSW_BASE/src/CMGTools/H2TauTau/prod/h2TauTauMiniAOD_ditau_data_cfg.py" if data else "$CMSSW_BASE/src/CMGTools/H2TauTau/prod/h2TauTauMiniAOD_ditau_cfg.py"
    preprocessor = CmsswPreprocessor(cfg_name, addOrigAsSecondary=False)

# the following is declared in case this cfg is used in input to the
# heppy.py script
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events

config = cfg.Config(components=selectedComponents,
                    sequence=sequence,
                    services=outputService,
                    preprocessor=preprocessor,
                    events_class=Events)

printComps(config.components, True)
示例#5
0
# This is a dirty way of 'emulating' parallel sequences which are not possible in CMGTools,
# but it's a toad to swallow
for ii in range(len(sequence)):
    if sequence[ii].class_object.__module__ == HNLAnalyzer.__module__:
        sequence[ii].pass_through = True

###################################################
###            PREPROCESSOR                     ###
###################################################
prefetch = True
recompute_deepjet = True
if recompute_deepjet:
    fname = os.environ[
        'CMSSW_BASE'] + '/src/CMGTools/HNL/python/prod/cmg/update_deepjet_and_ele_id_data2016_cmg_cfg.py'
    preprocessor = CmsswPreprocessor(fname,
                                     prefetch=prefetch,
                                     addOrigAsSecondary=False)
    EOSEventsWithDownload.aggressive = 2  # always fetch if running on Wigner
    EOSEventsWithDownload.long_cache = getHeppyOption('long_cache', False)
    prefetch = False
    sequence.append(fileCleaner)
else:
    preprocessor = None

# temporarily copy remote files using xrd
# event_class = EOSEventsWithDownload if prefetch else Events
event_class = EOSEventsWithDownload
if prefetch:
    EOSEventsWithDownload.aggressive = 2  # always fetch if running on Wigner
    EOSEventsWithDownload.long_cache = getHeppyOption('long_cache', False)
示例#6
0
    splitFactor=1)

sampleDM_bb_M1000 = cfg.Component(
    ### DM_bb_M1000
    files=samples['DM_bb_M1000']['files'],
    name="DM_bb_M1000",
    isMC=True,
    isEmbed=False,
    splitFactor=1)

##############################
### FWLITE                 ###
##############################
from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor

preprocessor = CmsswPreprocessor("tagFatJets.py")

from PhysicsTools.HeppyCore.framework.eventsfwlite import Events

#### TEST (LOCAL)
#selectedComponents = [sampleTest]

#### FULL QCD
#selectedComponents = [sampleQCD_HT100To250,sampleQCD_HT250To500,sampleQCD_HT500To1000,sampleQCD_HT1000ToInf]

#### FULL DYJetsToLL
#selectedComponents = [sampleDYJetsToLL_M50_HT100to200,sampleDYJetsToLL_M50_HT200to400,sampleDYJetsToLL_M50_HT400to600,sampleDYJetsToLL_M50_HT600toInf]

#### FULL GJets
#selectedComponents = [sampleGJets_HT100to200,sampleGJets_HT200to400,sampleGJets_HT400to600,sampleGJets_HT600toInf]
示例#7
0
    else:
      GT= 'MCRUN2_74_V9A'
    if removeResiduals: extraArgs.append('--removeResiduals')
    if doAK4PFCHSchargedJets: extraArgs.append('--addReclusterTrackJetsAK4')
    args = ['python',
      os.path.expandvars('$CMSSW_BASE/python/CMGTools/ObjectStudies/corMETMiniAOD_cfgCreator.py'),\
      '--GT='+GT,
      '--outputFile='+preprocessorFile,
      '--jecDBFile='+jecDBFile,
      '--jecEra='+jecEra
      ] + extraArgs
    #print "Making pre-processorfile:"
    #print " ".join(args)
    subprocess.call(args)
    from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
    preprocessor = CmsswPreprocessor(preprocessorFile,prefetch=True) # prefetching input file for preprocessor


#-------- HOW TO RUN -----------

from PhysicsTools.HeppyCore.framework.heppy_loop import getHeppyOption
test = getHeppyOption('test')
if test == '1':
    comp = DYJetsToLL_M50_50ns
    comp.files = comp.files[:1]
    print comp.files
    comp.splitFactor = 1
    if not getHeppyOption('single'):
        comp.fineSplitFactor = 4
    selectedComponents = [ comp ]
elif test == '125':
示例#8
0
    #print "Making pre-processorfile:"
    #print " ".join(args)
    subprocess.call(args)
    staticname = tempfile.tempdir + "/MET_preproc_%s_%s_%s_%s.py" % (
        jecEra, GT, "nores" if removeResiduals else "",
        "AK4PFCHSchargedJets" if doAK4PFCHSchargedJets else "")
    import filecmp
    if os.path.isfile(staticname) and filecmp.cmp(tpath, staticname):
        os.system("rm %s" % tpath)
    else:
        os.system("mv %s %s" % (tpath, staticname))
    preprocessorFile = staticname
    print 'Using preprocessor file: %s' % preprocessorFile
    from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
    preprocessor = CmsswPreprocessor(
        preprocessorFile,
        prefetch=True)  # prefetching input file for preprocessor

#-------- HOW TO RUN -----------

test = getHeppyOption('test')
if test == '1':
    comp = selectedComponents[0]
    comp.files = comp.files[:1]
    comp.splitFactor = 1
    comp.fineSplitFactor = 1
    selectedComponents = [comp]
elif test == '2':
    for comp in selectedComponents:
        comp.files = comp.files[:1]
        comp.splitFactor = 1
示例#9
0
    sequence.remove(ttHHTSkimmer)
    sequence.remove(ttHSTSkimmer)
    sequence.remove(eventFlagsAna)
## output histogram
outputService = []
from PhysicsTools.HeppyCore.framework.services.tfile import TFileService
output_service = cfg.Service(
    TFileService,
    'outputfile',
    name="outputfile",
    fname='treeProducerSusySingleLepton/tree.root',
    #fname='susyCounter/counts.root',
    option='recreate')
outputService.append(output_service)

from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
preprocessor = None
if cmssw:
    fname = "$CMSSW_BASE/src/CMGTools/SUSYAnalysis/cfg/runBTaggingSlimPreprocessor_cfg.py"
    jetAna.jetCol = 'selectedUpdatedPatJets'
    #    fname = "$CMSSW_BASE/src/CMGTools/SUSYAnalysis/cfg/MetType1_jec_Spring16_25nsV6_MC.py"
    preprocessor = CmsswPreprocessor(fname)  #, addOrigAsSecondary=False)

print "running"
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
config = cfg.Config(components=selectedComponents,
                    sequence=sequence,
                    services=outputService,
                    preprocessor=preprocessor,
                    events_class=Events)
示例#10
0
sequence.insert(sequence.index(VHbb), btagana)

# Add Information on generator level hadronic tau decays
if sample.isMC:
    from VHbbAnalysis.Heppy.TauGenJetAnalyzer import TauGenJetAnalyzer
    TauGenJet = cfg.Analyzer(
        verbose=False,
        class_object=TauGenJetAnalyzer,
    )
    sequence.insert(sequence.index(VHbb), TauGenJet)

    treeProducer.collections["tauGenJets"] = NTupleCollection(
        "GenHadTaus",
        genTauJetType,
        15,
        help="Generator level hadronic tau decays")

# Run Everything
preprocessor = CmsswPreprocessor("combined_cmssw.py",
                                 options={"isMC": sample.isMC})
config.preprocessor = preprocessor
if __name__ == '__main__':
    from PhysicsTools.HeppyCore.framework.looper import Looper
    looper = Looper('Loop', config, nPrint=1, nEvents=300)
    import time
    import cProfile
    p = cProfile.Profile(time.clock)
    p.runcall(looper.loop)
    p.print_stats()
    looper.write()
    sequence.insert(0, eventSelector)

###################################################
###            SET BATCH OR LOCAL               ###
###################################################
if not production:
  cache                = True
#   comp                 = my_connect.mc_dict['HiggsGGH125']
  comp                 = DYJetsToLL_M50
  selectedComponents   = [comp]
  comp.splitFactor     = 1
  comp.fineSplitFactor = 1
  comp.files           = comp.files[:1]

from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
preprocessor = CmsswPreprocessor("$CMSSW_BASE/src/CMGTools/H2TauTau/prod/h2TauTauMiniAOD_cfg.py")

# the following is declared in case this cfg is used in input to the
# heppy.py script
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
config = cfg.Config( components   = selectedComponents,
                     sequence     = sequence          ,
                     services     = []                ,
                     preprocessor = preprocessor      ,
                     events_class = Events
                     )

printComps(config.components, True)

def modCfgForPlot(config):
  config.components = []
elif test == "express":
    selectedComponents = [ MuEG_740p9 ]
    comp = selectedComponents[0]
    comp.files = [ 'root://eoscms//eos/cms/store/express/Run2015A/ExpressPhysics/FEVT/Express-v1/000/246/908/00000/04B152E7-DE09-E511-8B18-02163E011D4A.root' ]
    comp.name  = 'ExpressPhysics'
    comp.triggers = []
    comp.json     = None
    jetAna.recalibrateJets = False 
    jetAna.smearJets       = False 
    ttHLepSkim.minLeptons = 0
    sequence.remove(jsonAna)
    # preprocessor cfg to be created with
    #    cmsDriver.py miniAOD-data -s PAT --data --runUnscheduled --eventcontent MINIAOD --conditions GR_P_V56 --no_exec
    #    sed -i 's/process.MINIAODoutput_step/process.endpath/' miniAOD-data_PAT.py
    from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
    preprocessor = CmsswPreprocessor("miniAOD-data_PAT.py")

## output histogram
outputService=[]
from PhysicsTools.HeppyCore.framework.services.tfile import TFileService
output_service = cfg.Service(
    TFileService,
    'outputfile',
    name="outputfile",
    fname='treeProducerSusyMultilepton/tree.root',
    option='recreate'
    )    
outputService.append(output_service)

# the following is declared in case this cfg is used in input to the heppy.py script
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
    genTreeProducer, fileCleaner
])

selectedComponents = samples

if not production:
    cache = True
    comp = selectedComponents[0]
    selectedComponents = [comp]
    comp.splitFactor = 1
    comp.fineSplitFactor = 1
    # comp.files = comp.files[:1]

from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
preprocessor = CmsswPreprocessor(
    "$CMSSW_BASE/src/CMGTools/H2TauTau/prod/puppiOnMiniAOD_cfg.py",
    addOrigAsSecondary=False)

# the following is declared in case this cfg is used in input to the
# heppy.py script
from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
config = cfg.Config(
    components=selectedComponents,
    sequence=sequence,
    services=[],
    preprocessor=preprocessor,
    events_class=Events,
)

printComps(config.components, True)
      '--jecDBFile='+jecDBFile,
      '--jecEra='+jecEra
      ] + extraArgs
    #print "Making pre-processorfile:"
    #print " ".join(args)
    subprocess.call(args)
    staticname=tempfile.tempdir+"/MET_preproc_%s_%s_%s_%s.py"%(jecEra,GT,"nores" if removeResiduals else "","") #"AK4PFCHSchargedJets" if doAK4PFCHSchargedJets else "")
    import filecmp
    if os.path.isfile(staticname) and filecmp.cmp(tpath,staticname):
        os.system("rm %s"%tpath)
    else:
        os.system("mv %s %s"%(tpath,staticname))
    preprocessorFile=staticname
    print 'Using preprocessor file: %s'%preprocessorFile
    from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
    preprocessor = CmsswPreprocessor(preprocessorFile,prefetch=True) # prefetching input file for preprocessor


#-------- HOW TO RUN -----------

test = getHeppyOption('test')
if test == '1':
    comp = selectedComponents[0]
    comp.files = comp.files[:1]
    comp.splitFactor = 1
    comp.fineSplitFactor = 1
    selectedComponents = [ comp ]
elif test == '2':
    for comp in selectedComponents:
        comp.files = comp.files[:1]
        comp.splitFactor = 1
                             option='recreate')
outputService.append(output_service)

from CMGTools.HToZZ4L.tools.configTools import printSummary
printSummary(selectedComponents)

from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
extraArgs = []
if comp.isData:
    extraArgs.append('--isData')
    GT = myDataGlobalTag
else:
    GT = myMCGlobalTag

preprocessorFile = "$CMSSW_BASE/tmp/MetType1_fixEE2017_%s.py" % (GT)
preprocessor = CmsswPreprocessor(preprocessorFile)

from PhysicsTools.HeppyCore.framework.eventsfwlite import Events
from CMGTools.TTHAnalysis.tools.EOSEventsWithDownload import EOSEventsWithDownload
event_class = EOSEventsWithDownload if not preprocessor else Events
EOSEventsWithDownload.aggressive = 2  # always fetch if running on Wigner

if getHeppyOption("nofetch") or getHeppyOption("isCrab"):
    event_class = Events
    if preprocessor: preprocessor.prefetch = False

# -------------------- Running pre-processor
import subprocess
args = ['python',
        os.path.expandvars(os.environ['CMSSW_BASE']+'/python/CMGTools/ObjectStudies/corMETMiniAOD_cfgCreator.py'),\
        '--GT='+'null',
示例#16
0
#selectedComponents = [sample['SYNCH_ADDMonojet'],]
#selectedComponents = [sample['SYNCH_TTBar'],]
#selectedComponents = [sample['SYNCH_DYJetsToLL'],]
#selectedComponents = [sample['SYNCH_WJetsToLNu'],]
#selectedComponents = [sample['SYNCH_RSGravitonToGaGa'],]
#selectedComponents = [sample['SYNCH_ADDMonojet'],sample['SYNCH_TTBar'],sample['SYNCH_DYJetsToLL'],sample['SYNCH_WJetsToLNu'],sample['SYNCH_RSGravitonToGaGa'],]

#selectedComponents = [testDataCompontent,]
#filterAnalyzer.processName = 'RECO'
#TriggerMatchAnalyzer.processName = 'PAT'

#selectedComponents = [testMCCompontent,]
#TriggerMatchAnalyzer.processName = 'PAT'

from PhysicsTools.Heppy.utils.cmsswPreprocessor import CmsswPreprocessor
preprocessor = CmsswPreprocessor("preprocessor.py")

config = cfg.Config(
    components=selectedComponents,
    sequence=sequence,
    services=[output_service],
    #preprocessor = preprocessor,
    events_class=Events)

##############################
### LOOPER                 ###
##############################
# and the following runs the process directly if running as with python filename.py
if __name__ == '__main__':
    from PhysicsTools.HeppyCore.framework.looper import Looper
    looper = Looper(