CMS 3D CMS Logo

shallowTree_test_template.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from PhysicsTools.PatAlgos.patInputFiles_cff import filesRelValTTbarPileUpGENSIMRECO
3 import Utilities.General.cmssw_das_client as cmssw_das_client
4 #from pdb import set_trace
5 
6 ######
7 #
8 # Ideally to be used, unfortunately sample is not at CERN
9 #
10 # from PhysicsTools.PatAlgos.tools.cmsswVersionTools import pickRelValInputFiles
11 # filesRelValTTbarPileUpGENSIMRECO = cms.untracked.vstring(
12 # pickRelValInputFiles( cmsswVersion = 'CMSSW_9_2_3'
13 # , relVal = 'RelValTTbar_13'
14 # , globalTag = 'PUpmx25ns_92X_upgrade2017_realistic_v2_earlyBS2017'
15 # , dataTier = 'GEN-SIM-RECO'
16 # , maxVersions = 1
17 # , numberOfFiles = 1
18 # , useDAS = True
19 # )
20 # )
21 
22 def add_rawRelVals(process):
23  query='dataset file=%s' % process.source.fileNames[0]
24  dataset = cmssw_das_client.get_data(query, limit = 0)
25  if not dataset:
26  raise RuntimeError(
27  'Das returned no dataset parent of the input file: %s \n'
28  'The parenthood is needed to add RAW secondary input files' % process.source.fileNames[0]
29  )
30  raw_dataset = dataset['data'][0]['dataset'][0]['name'].replace('GEN-SIM-RECO','GEN-SIM-DIGI-RAW-HLTDEBUG')
31  raw_files = cmssw_das_client.get_data('file dataset=%s' % raw_dataset, limit=0)['data']
32 
33  if not raw_files:
34  raise RuntimeError('No files found belonging to the GEN-SIM-DIGI-RAW-HLTDEBUG sample!')
35 
36  #convert from unicode into normal string since vstring does not pick it up
37  raw_files = [str(i) for i in raw_files]
38  process.source.secondaryFileNames = cms.untracked.vstring(*raw_files)
39  return process
40 
41 process = cms.Process('JustATest')
42 process.load('Configuration/StandardSequences/MagneticField_AutoFromDBCurrent_cff')
43 process.load("Configuration.Geometry.GeometryRecoDB_cff")
44 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
45 from Configuration.AlCa.GlobalTag import GlobalTag
46 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2017_realistic')
47 
48 process.load('FWCore.MessageService.MessageLogger_cfi')
49 process.load('Configuration.StandardSequences.Services_cff')
50 process.TFileService = cms.Service(
51  "TFileService",
52  fileName = cms.string( 'FIXME' ),
53  closeFileFast = cms.untracked.bool(True)
54  )
55 
56 ## Maximal Number of Events
57 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) )
58 process.source = cms.Source (
59  "PoolSource",
60  fileNames = filesRelValTTbarPileUpGENSIMRECO
61  )
62 
63 process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
64 process.MessageLogger.cerr.FwkReport.reportEvery = 1
65 
66 process.options = cms.untracked.PSet(
67  Rethrow = cms.untracked.vstring('OtherCMS',
68  'StdException',
69  'Unknown',
70  'BadAlloc',
71  'BadExceptionType',
72  'ProductNotFound',
73  'DictionaryNotFound',
74  'InsertFailure',
75  'Configuration',
76  'LogicError',
77  'UnimplementedFeature',
78  'InvalidReference',
79  'NullPointerError',
80  'NoProductSpecified',
81  'EventTimeout',
82  'EventCorruption',
83  'ScheduleExecutionFailure',
84  'EventProcessorFailure',
85  'FileInPathError',
86  'FileOpenError',
87  'FileReadError',
88  'FatalRootError',
89  'MismatchedInputFiles',
90  'ProductDoesNotSupportViews',
91  'ProductDoesNotSupportPtr',
92  'NotFound')
93 )
def add_rawRelVals(process)
Ideally to be used, unfortunately sample is not at CERN.
def replace(string, replacements)
def get_data(query, limit=None, threshold=None, idx=None, host=None, cmd=None)