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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
import FWCore.ParameterSet.Config as cms
from PhysicsTools.PatAlgos.patInputFiles_cff import filesRelValTTbarPileUpGENSIMRECO
import Utilities.General.cmssw_das_client as cmssw_das_client
#from pdb import set_trace

######
#
# Ideally to be used, unfortunately sample is not at CERN
#
# from PhysicsTools.PatAlgos.tools.cmsswVersionTools import pickRelValInputFiles
# filesRelValTTbarPileUpGENSIMRECO = cms.untracked.vstring(
#    pickRelValInputFiles( cmsswVersion  = 'CMSSW_9_2_3'
#                          , relVal        = 'RelValTTbar_13'
#                          , globalTag     = 'PUpmx25ns_92X_upgrade2017_realistic_v2_earlyBS2017'
#                          , dataTier      = 'GEN-SIM-RECO'
#                          , maxVersions   = 1
#                          , numberOfFiles = 1
#                          , useDAS        = True
#                          )
#    )

def add_rawRelVals(process):   
   query='dataset file=%s' % process.source.fileNames[0]
   dataset = cmssw_das_client.get_data(query, limit = 0)
   if not dataset:
      raise RuntimeError(
         'Das returned no dataset parent of the input file: %s \n'
         'The parenthood is needed to add RAW secondary input files' % process.source.fileNames[0]
         )
   raw_dataset = dataset['data'][0]['dataset'][0]['name'].replace('GEN-SIM-RECO','GEN-SIM-DIGI-RAW-HLTDEBUG')
   raw_files = cmssw_das_client.get_data('file dataset=%s' % raw_dataset, limit=0)['data']
   
   if not raw_files:
      raise RuntimeError('No files found belonging to the GEN-SIM-DIGI-RAW-HLTDEBUG sample!')

   #convert from unicode into normal string since vstring does not pick it up
   raw_files = [str(i) for i in raw_files]
   process.source.secondaryFileNames = cms.untracked.vstring(*raw_files)
   return process

process = cms.Process('JustATest')
process.load('Configuration.StandardSequences.MagneticField_cff')
process.load("Configuration.Geometry.GeometryRecoDB_cff")
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
from Configuration.AlCa.GlobalTag import GlobalTag
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2017_realistic')

process.load('FWCore.MessageService.MessageLogger_cfi')
process.load('Configuration.StandardSequences.Services_cff')
process.TFileService = cms.Service( 
   "TFileService",
   fileName = cms.string( 'FIXME' ),
   closeFileFast = cms.untracked.bool(True)  
   ) 

## Maximal Number of Events
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) )
process.source = cms.Source (
    "PoolSource",
    fileNames = filesRelValTTbarPileUpGENSIMRECO
    )

process.options   = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
process.MessageLogger.cerr.FwkReport.reportEvery = 1

process.options = cms.untracked.PSet(
    Rethrow = cms.untracked.vstring('OtherCMS', 
        'StdException', 
        'Unknown', 
        'BadAlloc', 
        'BadExceptionType', 
        'ProductNotFound', 
        'DictionaryNotFound', 
        'InsertFailure', 
        'Configuration', 
        'LogicError', 
        'UnimplementedFeature', 
        'InvalidReference', 
        'NullPointerError', 
        'NoProductSpecified', 
        'EventTimeout', 
        'EventCorruption', 
        'ScheduleExecutionFailure', 
        'EventProcessorFailure', 
        'FileInPathError', 
        'FileOpenError', 
        'FileReadError', 
        'FatalRootError', 
        'MismatchedInputFiles', 
        'ProductDoesNotSupportViews', 
        'ProductDoesNotSupportPtr', 
        'NotFound')
)