Ejemplo n.º 1
0
def submitProduction(tag,
                     lfnDirBase,
                     dataset,
                     isData,
                     cfg,
                     workDir,
                     lumiMask,
                     era='era2017',
                     submit=False):

    from TopLJets2015.TopAnalysis.EraConfig import getEraConfiguration
    globalTag, jecTag, jecDB = getEraConfiguration(era=era,
                                                   isData=bool(isData))

    os.system("rm -rvf %s/*%s* " % (workDir, tag))
    crabConfigFile = workDir + '/' + tag + '_cfg.py'
    config_file = open(crabConfigFile, 'w')
    config_file.write('from WMCore.Configuration import Configuration\n')
    config_file.write('import os\n')
    config_file.write('config = Configuration()\n')
    config_file.write('\n')
    config_file.write('config.section_("General")\n')
    config_file.write('config.General.requestName = "%s"\n' % tag)
    config_file.write('config.General.workArea = "%s"\n' % workDir)
    config_file.write('config.General.transferOutputs=True\n')
    #config_file.write('config.General.transferLogs=True\n')
    config_file.write('\n')
    config_file.write('config.section_("JobType")\n')
    config_file.write('config.JobType.pluginName = "Analysis"\n')
    config_file.write('config.JobType.psetName = "' + cfg + '"\n')
    config_file.write(
        'config.JobType.disableAutomaticOutputCollection = False\n')
    config_file.write(
        'config.JobType.pyCfgParams = [\'runOnData=%s\',\'era=%s\']\n' %
        (bool(isData), era))

    config_file.write('config.JobType.inputFiles = [\'%s\']\n' % (jecDB))
    config_file.write('\n')
    config_file.write('config.section_("Data")\n')
    config_file.write('config.Data.inputDataset = "%s"\n' % dataset)
    config_file.write('config.Data.inputDBS = "global"\n')
    if isData:
        config_file.write('config.Data.splitting = "LumiBased"\n')
        config_file.write('config.Data.unitsPerJob = 100\n')
        config_file.write('config.Data.lumiMask = \'%s\'\n' % lumiMask)
    else:
        config_file.write('config.Data.splitting = "FileBased"\n')
        config_file.write('config.Data.unitsPerJob = 4\n')
    config_file.write('config.Data.ignoreLocality = False\n')
    config_file.write('config.Data.publication = False\n')
    config_file.write('config.Data.outLFNDirBase = \"%s\"\n' % lfnDirBase)
    config_file.write('\n')
    config_file.write('config.section_("Site")\n')
    config_file.write('config.Site.storageSite = "T2_CH_CERN"\n')
    config_file.close()

    if submit:
        os.system(
            'alias crab=\'/cvmfs/cms.cern.ch/crab3/crab-env-bootstrap.sh\' && crab submit -c %s'
            % crabConfigFile)
Ejemplo n.º 2
0
                 VarParsing.varType.bool, 'save PF candidates')
options.register('applyFilt', True, VarParsing.multiplicity.singleton,
                 VarParsing.varType.bool, 'save PF candidates')
options.parseArguments()

#start process
if options.runProtonFastSim:
    from Configuration.StandardSequences.Eras import eras
    process = cms.Process("MiniAnalysis", eras.ctpps_2016)
else:
    process = cms.Process("MiniAnalysis")

#get the configuration to apply
from TopLJets2015.TopAnalysis.EraConfig import getEraConfiguration

globalTag, jecTag, jecDB, jerTag, jerDB = getEraConfiguration(
    era=options.era, isData=options.runOnData)

# Load the standard set of configuration modules
process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi")
process.load('Configuration.StandardSequences.Services_cff')
process.load('Configuration.StandardSequences.GeometryDB_cff')
process.load('Configuration.StandardSequences.MagneticField_38T_cff')

#EGM customization
from TopLJets2015.TopAnalysis.customizeEGM_cff import customizeEGM

customizeEGM(process=process, era=options.era)

# global tag
process.load(
    'Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
Ejemplo n.º 3
0
def submitProduction(tag,
                     lfnDirBase,
                     dataset,
                     isData,
                     cfg,
                     workDir,
                     lumiMask,
                     era='era2017',
                     submit=False,
                     addParents=False):

    from TopLJets2015.TopAnalysis.EraConfig import getEraConfiguration
    globalTag, jecTag, jecDB, jerTag, jerDB = getEraConfiguration(
        era=era, isData=bool(isData))

    isZeroBias = True if 'ZeroBias' in dataset else False

    #cmssw=os.environ['CMSSW_BASE']+'/src'
    os.system("rm -rvf %s/*%s* " % (workDir, tag))
    crabConfigFile = workDir + '/' + tag + '_cfg.py'
    config_file = open(crabConfigFile, 'w')
    config_file.write('from WMCore.Configuration import Configuration\n')
    config_file.write('import os\n')
    config_file.write('config = Configuration()\n')
    config_file.write('\n')
    config_file.write('config.section_("General")\n')
    config_file.write('config.General.requestName = "%s"\n' % tag)
    config_file.write('config.General.workArea = "%s"\n' % workDir)
    config_file.write('config.General.transferOutputs=True\n')
    #config_file.write('config.General.transferLogs=True\n')
    config_file.write('\n')
    config_file.write('config.section_("JobType")\n')
    config_file.write('config.JobType.pluginName = "Analysis"\n')
    config_file.write('config.JobType.psetName = "' + cfg + '"\n')
    config_file.write(
        'config.JobType.disableAutomaticOutputCollection = False\n')
    if isZeroBias:
        print 'This is a ZeroBias sample will save everything...'
        config_file.write(
            'config.JobType.pyCfgParams = [\'applyFilt=False\', \'runOnData=%s\',\'era=%s\']\n'
            % (bool(isData), era))
    else:
        config_file.write(
            'config.JobType.pyCfgParams = [\'runOnData=%s\',\'era=%s\']\n' %
            (bool(isData), era))

    #config_file.write('config.JobType.inputFiles = [\'{0}/{1}\',\'{0}/{2}\',\'{0}/muoncorr_db.txt\',\'{0}/jecUncSources.txt\']\n'.format(cmssw,jecDB,jerDB))
    config_file.write(
        'config.JobType.inputFiles = [\'{0}\',\'{1}\',\'muoncorr_db.txt\',\'jecUncSources.txt\',\'qg_db.db\']\n'
        .format(jecDB, jerDB))
    config_file.write('\n')
    config_file.write('config.section_("Data")\n')
    config_file.write('config.Data.inputDataset = "%s"\n' % dataset)
    config_file.write('config.Data.inputDBS = "global"\n')
    config_file.write('config.Data.useParent = %s\n' % bool(addParents))
    if isData:
        config_file.write('config.Data.splitting = "Automatic"\n')
        #config_file.write('config.Data.splitting = "LumiBased"\n')
        #config_file.write('config.Data.unitsPerJob = 100\n')
        config_file.write('config.Data.lumiMask = \'%s\'\n' % lumiMask)
    else:
        config_file.write('config.Data.splitting = "FileBased"\n')
        config_file.write('config.Data.unitsPerJob = 4\n')

    config_file.write('config.Data.ignoreLocality = False\n')
    config_file.write('config.Data.publication = False\n')
    config_file.write('config.Data.outLFNDirBase = \"%s\"\n' % lfnDirBase)
    config_file.write('\n')
    config_file.write('config.section_("Site")\n')
    config_file.write('config.Site.storageSite = "T2_CH_CERN"\n')
    config_file.close()

    if submit:
        os.system(
            'alias crab=\'/cvmfs/cms.cern.ch/crab3/crab-env-bootstrap.sh\' && crab submit -c %s'
            % crabConfigFile)