CMS 3D CMS Logo

Classes | Functions
Utils Namespace Reference

Classes

class  LoadPrerequisiteSource
 

Functions

def addMonitoring (process)
 
def dictIO (options, args)
 
def dqmIOSource (args)
 
def dqmSeq (args, default)
 
def gtNameAndConnect (globalTag, args)
 
def harvestingMode (process, datasetName, args, rANDl=True)
 
def nanoFlavours (flavours)
 
def setupPPSDirectSim (process)
 
def setupPPSDirectSimAOD (process)
 
def setupPPSDirectSimMiniAOD (process)
 
def stepALCAPRODUCER (skims)
 
def stepSKIMPRODUCER (PhysicsSkims)
 
def validateProcess (process)
 

Detailed Description

_Utils_

Module containing some utility tools

Function Documentation

◆ addMonitoring()

def Utils.addMonitoring (   process)
_addMonitoring_

Add the monitoring services to the process provided
in order to write out performance summaries to the framework job report

Definition at line 38 of file Utils.py.

Referenced by Reco.Reco.expressProcessing(), Impl.AlCaPPS_Run3.AlCaPPS_Run3.expressProcessing(), Impl.AlCaNano.AlCaNano.expressProcessing(), Impl.AlCa.AlCa.expressProcessing(), and Reco.Reco.promptReco().

38 def addMonitoring(process):
39  """
40  _addMonitoring_
41 
42  Add the monitoring services to the process provided
43  in order to write out performance summaries to the framework job report
44  """
45  import FWCore.ParameterSet.Config as cms
46 
47  process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck",
48  jobReportOutputOnly = cms.untracked.bool(True)
49  )
50  process.Timing = cms.Service("Timing",
51  summaryOnly = cms.untracked.bool(True)
52  )
53 
54  return process
55 
56 
def addMonitoring(process)
Definition: Utils.py:38

◆ dictIO()

def Utils.dictIO (   options,
  args 
)

Definition at line 121 of file Utils.py.

References TriggerAnalyzer.__str__(), and join().

Referenced by Reco.Reco.expressProcessing(), Impl.DataScouting.DataScouting.promptReco(), Impl.AlCa.AlCa.promptReco(), Impl.AlCaNano.AlCaNano.promptReco(), Impl.AlCaPPS_Run3.AlCaPPS_Run3.promptReco(), Reco.Reco.promptReco(), and Reco.Reco.visualizationProcessing().

121 def dictIO(options,args):
122  if 'outputs' in args:
123  options.outputDefinition = args['outputs'].__str__()
124  else:
125  writeTiers = args.get('writeTiers', [])
126  options.eventcontent = ','.join(writeTiers)
127  options.datatier = ','.join(writeTiers)
128 
def dictIO(options, args)
Definition: Utils.py:121
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ dqmIOSource()

def Utils.dqmIOSource (   args)

Definition at line 103 of file Utils.py.

Referenced by Impl.DataScouting.DataScouting.dqmHarvesting(), Impl.AlCa.AlCa.dqmHarvesting(), Impl.AlCaNano.AlCaNano.dqmHarvesting(), Impl.AlCaPPS_Run3.AlCaPPS_Run3.dqmHarvesting(), and Reco.Reco.dqmHarvesting().

103 def dqmIOSource(args):
104  import FWCore.ParameterSet.Config as cms
105  if args.get('newDQMIO', False):
106  return cms.Source("DQMRootSource",
107  fileNames = cms.untracked(cms.vstring())
108  )
109  else:
110  return cms.Source("PoolSource",
111  fileNames = cms.untracked(cms.vstring())
112  )
113 
def dqmIOSource(args)
Definition: Utils.py:103

◆ dqmSeq()

def Utils.dqmSeq (   args,
  default 
)

Definition at line 129 of file Utils.py.

References join().

Referenced by Impl.DataScouting.DataScouting.dqmHarvesting(), Reco.Reco.dqmHarvesting(), Reco.Reco.expressProcessing(), and Reco.Reco.promptReco().

129 def dqmSeq(args,default):
130  if 'dqmSeq' in args and len(args['dqmSeq'])!=0:
131  return ':'+('+'.join(args['dqmSeq']))
132  else:
133  return default
134 
def dqmSeq(args, default)
Definition: Utils.py:129
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ gtNameAndConnect()

def Utils.gtNameAndConnect (   globalTag,
  args 
)

◆ harvestingMode()

def Utils.harvestingMode (   process,
  datasetName,
  args,
  rANDl = True 
)

Definition at line 114 of file Utils.py.

Referenced by Impl.DataScouting.DataScouting.dqmHarvesting(), Impl.AlCa.AlCa.dqmHarvesting(), Impl.AlCaNano.AlCaNano.dqmHarvesting(), Impl.AlCaPPS_Run3.AlCaPPS_Run3.dqmHarvesting(), and Reco.Reco.dqmHarvesting().

114 def harvestingMode(process, datasetName, args,rANDl=True):
115  import FWCore.ParameterSet.Config as cms
116  if rANDl and (not args.get('newDQMIO', False)):
117  process.source.processingMode = cms.untracked.string('RunsAndLumis')
118  process.dqmSaver.workflow = datasetName
119  process.dqmSaver.saveByLumiSection = 1
120 
def harvestingMode(process, datasetName, args, rANDl=True)
Definition: Utils.py:114

◆ nanoFlavours()

def Utils.nanoFlavours (   flavours)
_nanoFlavours_

Creates and returns the configuration string for the NANO flavours
from the list of flavors to be run.

Definition at line 135 of file Utils.py.

References join().

Referenced by Reco.Reco.promptReco().

135 def nanoFlavours(flavours):
136  """
137  _nanoFlavours_
138 
139  Creates and returns the configuration string for the NANO flavours
140  from the list of flavors to be run.
141 
142  """
143 
144  step = ''
145  if len(flavours) >0 :
146  step = ':'+('+'.join(flavours))
147  return step
148 
def nanoFlavours(flavours)
Definition: Utils.py:135
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ setupPPSDirectSim()

def Utils.setupPPSDirectSim (   process)

Definition at line 3 of file Utils.py.

References matching_cff.matchDirectSimOutputs().

Referenced by setupPPSDirectSimAOD(), and setupPPSDirectSimMiniAOD().

3 def setupPPSDirectSim(process):
4  process.load('SimPPS.Configuration.directSimPPS_cff')
5  process.load('RecoPPS.Configuration.recoCTPPS_cff')
6  if not hasattr(process, 'RandomNumberGeneratorService'):
7  process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService")
8  if not hasattr(process.RandomNumberGeneratorService, 'beamDivergenceVtxGenerator'):
9  process.RandomNumberGeneratorService.beamDivergenceVtxGenerator = cms.PSet(initialSeed = cms.untracked.uint32(3849))
10  if not hasattr(process.RandomNumberGeneratorService, 'ppsDirectProtonSimulation'):
11  process.RandomNumberGeneratorService.ppsDirectProtonSimulation = cms.PSet(initialSeed = cms.untracked.uint32(4981))
12  process.ppsDirectSim = cms.Path(process.directSimPPS * process.recoDirectSimPPS)
13  process.schedule.append(process.ppsDirectSim)
14 
15  from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputs
16  matchDirectSimOutputs(process)
17  return process
18 
def setupPPSDirectSim(process)
Definition: Utils.py:3
def matchDirectSimOutputs(process, AOD=False, miniAOD=False)
Definition: matching_cff.py:3

◆ setupPPSDirectSimAOD()

def Utils.setupPPSDirectSimAOD (   process)

Definition at line 19 of file Utils.py.

References matching_cff.matchDirectSimOutputsAOD(), and setupPPSDirectSim().

19 def setupPPSDirectSimAOD(process):
20  setupPPSDirectSim(process)
21  from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputsAOD
23  return process
24 
def setupPPSDirectSim(process)
Definition: Utils.py:3
def matchDirectSimOutputsAOD(process)
Definition: matching_cff.py:15
def setupPPSDirectSimAOD(process)
Definition: Utils.py:19

◆ setupPPSDirectSimMiniAOD()

def Utils.setupPPSDirectSimMiniAOD (   process)

Definition at line 25 of file Utils.py.

References matching_cff.matchDirectSimOutputsMiniAOD(), and setupPPSDirectSim().

25 def setupPPSDirectSimMiniAOD(process):
26  setupPPSDirectSim(process)
27  from SimPPS.DirectSimProducer.matching_cff import matchDirectSimOutputsMiniAOD
29  return process
30 
def setupPPSDirectSim(process)
Definition: Utils.py:3
def setupPPSDirectSimMiniAOD(process)
Definition: Utils.py:25
def matchDirectSimOutputsMiniAOD(process)
Definition: matching_cff.py:24

◆ stepALCAPRODUCER()

def Utils.stepALCAPRODUCER (   skims)
_stepALCAPRODUCER_

Creates and returns the configuration string for the ALCAPRODUCER step
starting from the list of AlcaReco path to be run.

Definition at line 9 of file Utils.py.

References join().

Referenced by Reco.Reco.expressProcessing(), Impl.AlCaPPS_Run3.AlCaPPS_Run3.expressProcessing(), Impl.AlCaNano.AlCaNano.expressProcessing(), Impl.AlCa.AlCa.expressProcessing(), Impl.AlCa.AlCa.promptReco(), Impl.AlCaNano.AlCaNano.promptReco(), Impl.AlCaPPS_Run3.AlCaPPS_Run3.promptReco(), and Reco.Reco.promptReco().

9 def stepALCAPRODUCER(skims):
10  """
11  _stepALCAPRODUCER_
12 
13  Creates and returns the configuration string for the ALCAPRODUCER step
14  starting from the list of AlcaReco path to be run.
15 
16  """
17 
18  step = ''
19  if len(skims) >0:
20  step = ',ALCAPRODUCER:'+('+'.join(skims))
21  return step
22 
23 
def stepALCAPRODUCER(skims)
Definition: Utils.py:9
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ stepSKIMPRODUCER()

def Utils.stepSKIMPRODUCER (   PhysicsSkims)
_stepSKIMPRODUCER_

Creates and returns the configuration string for the SKIM step
starting from the list of skims to be run.

Definition at line 24 of file Utils.py.

References join().

Referenced by Reco.Reco.promptReco().

24 def stepSKIMPRODUCER(PhysicsSkims):
25  """
26  _stepSKIMPRODUCER_
27 
28  Creates and returns the configuration string for the SKIM step
29  starting from the list of skims to be run.
30 
31  """
32 
33  step = ''
34  if len(PhysicsSkims) >0 :
35  step = ',SKIM:'+('+'.join(PhysicsSkims))
36  return step
37 
def stepSKIMPRODUCER(PhysicsSkims)
Definition: Utils.py:24
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

◆ validateProcess()

def Utils.validateProcess (   process)
_validateProcess_

Check attributes of process are appropriate for production
This method returns nothing but will throw a RuntimeError for any issues it finds
likely to cause problems in the production system

Definition at line 57 of file Utils.py.

References relativeConstraints.keys.

57 def validateProcess(process):
58  """
59  _validateProcess_
60 
61  Check attributes of process are appropriate for production
62  This method returns nothing but will throw a RuntimeError for any issues it finds
63  likely to cause problems in the production system
64 
65  """
66 
67  schedule=process.schedule_()
68  paths=process.paths_()
69  endpaths=process.endpaths_()
70 
71  # check output mods are in paths and have appropriate settings
72  for outputModName in process.outputModules_().keys():
73  outputMod = getattr(process, outputModName)
74  if not hasattr(outputMod, 'dataset'):
75  msg = "Process contains output module without dataset PSET: %s \n" % outputModName
76  msg += " You need to add this PSET to this module to set dataTier and filterName\n"
77  raise RuntimeError(msg)
78  ds=getattr(outputMod,'dataset')
79  if not hasattr(ds, "dataTier"):
80  msg = "Process contains output module without dataTier parameter: %s \n" % outputModName
81  msg += " You need to add an untracked parameter to the dataset PSET of this module to set dataTier\n"
82  raise RuntimeError(msg)
83 
84  # check module in path or whatever (not sure of exact syntax for endpath)
85  omRun=False
86 
87  if schedule==None:
88  for path in paths:
89  if outputModName in getattr(process,path).moduleNames():
90  omRun=True
91  for path in endpaths:
92  if outputModName in getattr(process,path).moduleNames():
93  omRun=True
94  else:
95  for path in schedule:
96  if outputModName in path.moduleNames():
97  omRun=True
98  if omRun==False:
99  msg = "Output Module %s not in endPath" % outputModName
100  raise RuntimeError(msg)
101 
102 
def validateProcess(process)
Definition: Utils.py:57