예제 #1
0
cmds = []
for year in years:
    for flavour in flavours:
        for process in processes:
            # retrieve the correct samplelist
            samplelist = os.path.join(
                samplelistdirectory,
                'samples_closureTest_' + process + '_' + year + '.txt')
            # make the command
            command = './fillMCClosureTest {} {} {} {} {} {} {} {}'.format(
                isMCFR, use_mt, process, year, flavour, sampledirectory,
                samplelist, istestrun)
            cmds.append(command)

# loop over commands and submit jobs
if (runmode == 'qsub' or runmode == 'local'):
    for cmd in cmds:
        script_name = 'qsub_fillMCClosureTest.sh'
        with open(script_name, 'w') as script:
            initializeJobScript(script)
            script.write('cd {}\n'.format(cwd))
            script.write(cmd + '\n')
        if runmode == 'qsub': submitQsubJob(script_name)
        else: os.system('bash ' + script_name)

elif (runmode == 'condor'):
    ct.submitCommandsAsCondorCluster('cjob_fillMCClosureTest',
                                     cmds,
                                     docmsenv=True,
                                     cmssw_version='CMSSW_10_2_25')
예제 #2
0
    samplelist = os.path.join(samplelistdirectory,
                              'samples_fakeratemeasurement_' + year + '.txt')
    # check number of samples
    nsamples = 0
    with open(samplelist) as sf:
        for sl in sf:
            if not sl[0] == '#': nsamples += 1
    print('found ' + str(nsamples) + ' samples for ' + year)
    # loop over samples
    for i in range(nsamples):
        if (testrun and i != 0): continue
        command = './fillPrescaleMeasurement {} {} {} {} {}'.format(
            year, sampledirectory, samplelist, i, testrun)
        cmds.append(command)

# loop over commands and submit jobs
if (runmode == 'qsub' or runmode == 'local'):
    for cmd in cmds:
        script_name = 'qjob_fillPrescaleMeasurement.sh'
        with open(script_name, 'w') as script:
            initializeJobScript(script)
            script.write('cd {}\n'.format(cwd))
            script.write(cmd + '\n')
        if runmode == 'qsub': submitQsubJob(script_name)
        else: os.system('bash ' + script_name)

if (runmode == 'condor'):
    ct.submitCommandsAsCondorCluster('cjob_fillPrescaleMeasurement',
                                     cmds,
                                     cmssw_version=CMSSW_VERSION)
예제 #3
0
                              'samples_fakeratemeasurement_' + year + '.txt')
    # check number of samples
    nsamples = 0
    with open(samplelist) as sf:
        for sl in sf:
            if not sl[0] == '#': nsamples += 1
    print('found ' + str(nsamples) + ' samples for ' + year)
    # loop over samples
    for i in range(nsamples):
        if (testrun and i != 0): continue
        command = './fillPrescaleMeasurement {} {} {} {} {}'.format(
            year, sampledirectory, samplelist, i, testrun)
        cmds.append(command)

# loop over commands and submit jobs
if (runmode == 'qsub' or runmode == 'local'):
    for cmd in cmds:
        script_name = 'qjob_fillPrescaleMeasurement.sh'
        with open(script_name, 'w') as script:
            initializeJobScript(script)
            script.write('cd {}\n'.format(cwd))
            script.write(cmd + '\n')
        if runmode == 'qsub': submitQsubJob(script_name)
        else: os.system('bash ' + script_name)

if (runmode == 'condor'):
    ct.submitCommandsAsCondorCluster('cjob_fillPrescaleMeasurement',
                                     cmds,
                                     docmsenv=True,
                                     cmssw_version='CMSSW_10_2_25')
# (see also below in loop to set the correct sample list name per flavour/year!)
sampledirectory = '/pnfs/iihe/cms/store/user/wverbeke/ntuples_ewkino_chargeflips'

# check if executable exists
exe = './fillDataChargeFlipMeasurement'
if not os.path.exists(exe):
    raise Exception(
        'ERROR: executable {} does not seem to exist...'.format(exe))

# loop over years and flavours
cwd = os.getcwd()
cmds = []
for year in years:
    for flavour in flavours:
        samplelist = os.path.join(samplelistdirectory,
                                  'samples_chargeFlips_MC_' + year +
                                  '.txt')  # which sample lists to use?
        # make the command and add it to the list
        command = '{} {} {} {} {} {}'.format(exe, flavour, year, samplelist,
                                             sampledirectory, nentries)
        cmds.append(command)

# submit the commands as jobs
if (runmode == 'local'):
    for cmd in cmds:
        os.system(cmd)
elif (runmode == 'condor'):
    ct.submitCommandsAsCondorCluster('cjob_fillDataChargeFlipMeasurement',
                                     cmds,
                                     cmssw_version=CMSSW_VERSION)
예제 #5
0
    for leptonmva in sorted(mvadict.keys()):
	for flavour in sorted(mvadict[leptonmva].keys()):
	    for wpname in sorted(mvadict[leptonmva][flavour].keys()):
		wpvalue = mvadict[leptonmva][flavour][wpname]
		# loop over samples
		for i in range(samplecounter):
		    # make the command
		    command = exe +' {} {} {} {} {} {} {} {}'.format(
				flavour, year, leptonmva, wpname, wpvalue,
                                sampledirectory, samplelist, i)
		    commands.append(command)
		    print('added job for year "{}",'.format(year)
			    +' lepton MVA "{}",'.format(leptonmva)
			    +' flavour "{}",'.format(flavour)
			    +' working point "{}" ({})'.format(wpname, wpvalue)
			    +' sample {}/{}'.format(i+1,samplecounter))
		    # run local or submit using qsub
		    if( runmode=='local' or runmode=='qsub' ):
			script_name = 'qjob_fillConeCorrectionFactor.sh'
			with open(script_name,'w') as script:
			    initializeJobScript(script, cmssw_version='CMSSW_10_6_29')
			    script.write('cd {}\n'.format(cwd))
			    script.write(command+'\n')
			if runmode=='qsub': submitQsubJob(script_name)
			elif runmode=='local': os.system('bash '+script_name)

# submit using condor
if runmode=='condor':
    ct.submitCommandsAsCondorCluster('cjob_fillConeCorrectionFactor', commands,
                                     cmssw_version=CMSSW_VERSION)
예제 #6
0
cwd = os.getcwd()
cmds = []
for year in years:
    for flavour in flavours:
        for process in processes:
            # retrieve the correct samplelist
            samplelist = os.path.join(
                samplelistdirectory,
                'samples_closureTest_' + process + '_' + year + '.txt')
            # make the command
            command = './fillMCClosureTest {} {} {} {} {} {} {} {}'.format(
                isMCFR, use_mt, process, year, flavour, sampledirectory,
                samplelist, istestrun)
            cmds.append(command)

# loop over commands and submit jobs
if (runmode == 'qsub' or runmode == 'local'):
    for cmd in cmds:
        script_name = 'qsub_fillMCClosureTest.sh'
        with open(script_name, 'w') as script:
            initializeJobScript(script)
            script.write('cd {}\n'.format(cwd))
            script.write(cmd + '\n')
        if runmode == 'qsub': submitQsubJob(script_name)
        else: os.system('bash ' + script_name)

elif (runmode == 'condor'):
    ct.submitCommandsAsCondorCluster('cjob_fillMCClosureTest',
                                     cmds,
                                     cmssw_version=CMSSW_VERSION)