def cmsrun(self, cfg_file, **kwargs): """ Specifically runs a cmsRun command. Expects a python file, and other keyword arguments are parsed as "keyword=value". The key "inputFiles" is treated differently: A list is expected, and every item is added as "inputFiles=item". The key "outputFile" is also treated differently: The passed string is formatted with keys "proc_id", "cluster_id", and "datestr" for convenience. """ cmd = ["cmsRun", cfg_file] if "inputFiles" in kwargs: inputFiles = kwargs.pop("inputFiles") if qondor.utils.is_string(inputFiles): inputFiles = [inputFiles] for inputFile in inputFiles: cmd.append("inputFiles=" + inputFile) if "outputFile" in kwargs: outputFile = kwargs.pop("outputFile") cmd.append( "outputFile=" + outputFile.format( proc_id=qondor.get_proc_id(), cluster_id=qondor.get_cluster_id(), datestr=time.strftime("%b%d"), ) ) cmd.extend(["{0}={1}".format(k, v) for k, v in kwargs.items()]) self.run_command(cmd)
#$ njobs 300 #$ endset #$ set #$ mz 150 #$ max_events 75000 #$ njobs 500 #$ endset import qondor, seutils, svjqondor, os.path as osp cmssw = qondor.init_cmssw() mz = int(qondor.get_var('mz')) max_events = int(qondor.get_var('max_events')) offset = 2000 # apply an offset to the part to generate new events part = qondor.get_proc_id( ) + 1 + offset # proc_id starts at 0, runSVJ expects starting at 1 physics = { 'year': 2018, 'mz': mz, 'mdark': 20., 'rinv': 0.3, 'boost': 1000., } svjqondor.download_mg_tarball(dst=osp.join(cmssw.cmssw_src, 'SVJ/Production/test'), **physics) expected_outfile = svjqondor.run_step_cmd(cmssw, inpre='step0_GRIDPACK',
mz = int(qondor.get_var('mz')) # CMSSW files with ~18k events are hard to manage # Run in blocks of 400 max_events, ~200 evts net per output entries_per_file = 400 n_blocks = 40 physics = { 'year' : 2018, 'mz' : mz, 'mdark' : 20., 'rinv' : 0.3, 'boost' : 0., } svjqondor.download_mg_tarball(dst=osp.join(cmssw.cmssw_src, 'SVJ/Production/test'), **physics) ijob = qondor.get_proc_id() + 1000 for i_block in range(n_blocks): part_for_svj = 100*ijob + i_block # Also need to ensure uniqueness per block expected_outfile = svjqondor.run_step_cmd( cmssw, inpre='step0_GRIDPACK', outpre='step1_LHE-GEN', part=part_for_svj, max_events=entries_per_file, **physics ) seutils.cp( expected_outfile, 'root://cmseos.fnal.gov//store/user/lpcsusyhad/SVJ2017/boosted/gen/nohtcut_{date}_mz{mz}/{part}_{i_block}.root' .format(date=qondor.get_submission_time().strftime('%b%d'), mz=mz, part=part, i_block=i_block) )
import os.path as osp, argparse, re import qondor, seutils, svjqondor, uuid seutils.debug() cmssw = qondor.init_cmssw() mz = int(qondor.get_var('mz')) max_events = 10000 # runSVJ wants maxEvents to be passed, just set it large enough physics = { 'year': 2018, 'mz': mz, 'mdark': 20., 'rinv': 0.3, 'boost': 0., } part = qondor.get_proc_id() + 1 for i_rootfile, rootfile in enumerate(qondor.get_item()): # Ensure unique part name per rootfile across jobs; Not sure if necessary for SIM>MINIAOD svjpart = 1000 * part + i_rootfile qondor.logger.info('Job %s: Processing %s', qondor.get_proc_id(), rootfile) extended_physics = dict(physics, part=svjpart, max_events=max_events) expected_infile = osp.join( cmssw.cmssw_src, 'SVJ/Production/test', svjqondor.formatted_filename('step1_LHE-GEN', **extended_physics)) seutils.cp(rootfile, expected_infile) svjqondor.run_step_cmd(cmssw,
import qondor, seutils cmssw = qondor.init_cmssw() cmssw.run_commands([ 'cd TreeMaker/Production/test', 'cmsRun runMakeTreeFromMiniAOD_cfg.py' ' numevents=-1' ' outfile=outfile' ' scenario=Autumn18sig' ' lostlepton=0' ' doZinv=0' ' systematics=0' ' deepAK8=0' ' deepDoubleB=0' ' doPDFs=0' ' nestedVectors=False' ' debugjets=1' ' splitLevel=99' + (' dump=1' if args.dump else '') + (' inputFiles=' + ','.join(qondor.get_item())) ]) expected_outfile = osp.join(cmssw.cmssw_src, 'TreeMaker/Production/test', 'outfile_RA2AnalysisTree.root') seutils.cp( expected_outfile, 'root://cmseos.fnal.gov//store/user/lpcsusyhad/SVJ2017/boosted/treemaker/ht1000_nonested_{date}_mz{mz}/{part}.root' .format(date=qondor.get_submission_time().strftime('%b%d'), mz=qondor.get_var('mz'), part=qondor.get_proc_id()))
parser = argparse.ArgumentParser() parser.add_argument('--dump', action='store_true') args = parser.parse_args() import qondor, seutils cmssw = qondor.init_cmssw() cmssw.run_commands([ 'cd TreeMaker/Production/test', 'cmsRun runMakeTreeFromMiniAOD_cfg.py' ' numevents=-1' ' outfile=outfile' ' scenario=Autumn18sig' ' lostlepton=0' ' doZinv=0' ' systematics=0' ' deepAK8=0' ' deepDoubleB=0' ' doPDFs=0' ' nestedVectors=False ' ' debugjets=1 ' + (' dump=1' if args.dump else '') + (' inputFiles=' + ','.join(qondor.get_item())) ]) expected_outfile = osp.join(cmssw.cmssw_src, 'TreeMaker/Production/test', 'outfile_RA2AnalysisTree.root') seutils.cp( expected_outfile, 'root://cmseos.fnal.gov//store/user/klijnsma/semivis/treemakerht1000_nonested/mz{0}_{1}.root' .format(qondor.get_var('mz'), qondor.get_proc_id()))
# $ endset # $ set # $ mz 250 # $ endset #$ set #$ mz 150 #$ endset import qondor, seutils, svjqondor, os.path as osp cmssw = qondor.init_cmssw() mz = int(qondor.get_var('mz')) # Rate is about 40 evts/h entries_per_file = 640 series = 8000 part_for_svj = qondor.get_proc_id() + series physics = { 'year': 2018, 'mz': mz, 'mdark': 20., 'rinv': 0.3, 'boost': 0., } svjqondor.download_mg_tarball(dst=osp.join(cmssw.cmssw_src, 'SVJ/Production/test'), **physics) gen_outfile = svjqondor.run_step_cmd(cmssw, inpre='step0_GRIDPACK', outpre='step1_LHE-GEN',
# # $ items b=20 ls(root://cmseos.fnal.gov//store/user/lpcsusyhad/SVJ2017/boosted/miniaod/nohtcutfromscratch_Aug25_mz650/5*.root) # #$ endset import qondor, seutils, os.path as osp cmssw = qondor.init_cmssw() cmssw.run_commands([ 'cd TreeMaker/Production/test', 'cmsRun runMakeTreeFromMiniAOD_cfg.py' ' numevents=-1' ' outfile=outfile' ' scenario=Autumn18sig' ' lostlepton=0' ' doZinv=0' ' systematics=0' ' deepAK8=0' ' deepDoubleB=0' ' doPDFs=0' ' nestedVectors=False' ' debugjets=1' ' splitLevel=99' + (' inputFiles=' + ','.join(qondor.get_item())) ]) expected_outfile = osp.join(cmssw.cmssw_src, 'TreeMaker/Production/test', 'outfile_RA2AnalysisTree.root') seutils.cp( expected_outfile, 'root://cmseos.fnal.gov//store/user/lpcsusyhad/SVJ2017/boosted/treemaker/nohtcutfromscratch_{date}_mz{mz}_epf640_series8000/{part}.root' .format(date=qondor.get_submission_time().strftime('%b%d'), mz=qondor.get_var('mz'), part=qondor.get_proc_id()), )