CMS 3D CMS Logo

Namespaces | Classes | Functions | Variables
Utilities Namespace Reference

Namespaces

 ReleaseScripts
 

Classes

class  TestModuleCommand
 

Functions

def _build_options (args)
 
def cleanUnscheduled (proc)
 
def convertToSingleModuleEndPaths (process)
 
def convertToUnscheduled (proc)
 
def createTaskWithAllProducersAndFilters (process)
 
def getHltConfiguration (menu, args)
 
def ignoreAllFiltersOnPath (path)
 
def loadHltConfiguration (process, menu, args)
 
def moduleLabelsInSequences (sequences)
 
def modulesInSequences (sequences)
 

Variables

 __lastCallUnary
 
 _levelInTasks
 
 onTask
 
 operator
 

Function Documentation

def Utilities._build_options (   args)
private

Definition at line 6 of file Utilities.py.

Referenced by getHltConfiguration(), and loadHltConfiguration().

6 def _build_options(**args):
7  options = _options.HLTProcessOptions()
8  for key, val in args.iteritems():
9  setattr(options, key, val)
10  return options
11 
12 
def _build_options(args)
Definition: Utilities.py:6
def Utilities.cleanUnscheduled (   proc)

Definition at line 77 of file Utilities.py.

References cmsPerfStripChart.dict, and list().

Referenced by convertToUnscheduled().

77 def cleanUnscheduled(proc):
78  import FWCore.ParameterSet.Config as cms
79 
80  pathsAndEndPaths = dict(proc.paths)
81  pathsAndEndPaths.update( dict(proc.endpaths) )
82 
83  #have to get them now since switching them after the
84  # paths have been changed gives null labels
85  if proc.schedule:
86  pathNamesInScheduled = [p.label_() for p in proc.schedule]
87  else:
88  pathNamesInScheduled = False
89 
90  def getUnqualifiedName(name):
91  if name[0] in set(['!','-']):
92  return name[1:]
93  return name
94 
95  def getQualifiedModule(name,proc):
96  unqual_name = getUnqualifiedName(name)
97  p=getattr(proc,unqual_name)
98  if unqual_name != name:
99  if name[0] == '!':
100  p = ~p
101  elif name[0] == '-':
102  p = cms.ignore(p)
103  return p
104 
105  # Loop over paths
106  # On each path we move EDProducers and EDFilters that
107  # are ignored to Tasks
108  producerList = list()
109  for pName, originalPath in pathsAndEndPaths.iteritems():
110  producerList[:] = []
111  qualified_names = []
112  v = cms.DecoratedNodeNamePlusVisitor(qualified_names)
113  originalPath.visit(v)
114  remaining =[]
115 
116  for n in qualified_names:
117  unqual_name = getUnqualifiedName(n)
118  mod = getattr(proc,unqual_name)
119 
120  #remove EDProducer's and EDFilter's which are set to ignore
121  if not (isinstance(mod, cms.EDProducer) or
122  (n[0] =='-' and isinstance(mod, cms.EDFilter)) ):
123  remaining.append(n)
124  else:
125  producerList.append(mod)
126 
127  taskList = []
128  if v.leavesOnTasks():
129  taskList.append(cms.Task(*(v.leavesOnTasks())))
130  if (producerList):
131  taskList.append(cms.Task(*producerList))
132 
133  if remaining:
134  p = getQualifiedModule(remaining[0],proc)
135  for m in remaining[1:]:
136  p+=getQualifiedModule(m,proc)
137  setattr(proc,pName,type(getattr(proc,pName))(p))
138  else:
139  setattr(proc,pName,type(getattr(proc,pName))())
140 
141  newPath = getattr(proc,pName)
142  if (taskList):
143  newPath.associate(*taskList)
144 
145  # If there is a schedule then it needs to point at
146  # the new Path objects
147  if proc.schedule:
148  listOfTasks = list(proc.schedule._tasks)
149  proc.schedule = cms.Schedule([getattr(proc,p) for p in pathNamesInScheduled])
150  proc.schedule.associate(*listOfTasks)
151  return proc
152 
153 
def cleanUnscheduled(proc)
Definition: Utilities.py:77
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def Utilities.convertToSingleModuleEndPaths (   process)
Remove the EndPaths in the Process with more than one module
and replace with new EndPaths each with only one module.

Definition at line 171 of file Utilities.py.

Referenced by Utilities.TestModuleCommand.testConvertToSingleModuleEndPaths().

172  """Remove the EndPaths in the Process with more than one module
173  and replace with new EndPaths each with only one module.
174  """
175  import FWCore.ParameterSet.Config as cms
176  toRemove =[]
177  added = []
178  for n,ep in process.endpaths_().iteritems():
179  tsks = []
180  ep.visit(cms.TaskVisitor(tsks))
181 
182  names = ep.moduleNames()
183  if 1 == len(names):
184  continue
185  toRemove.append(n)
186  for m in names:
187  epName = m+"_endpath"
188  setattr(process,epName,cms.EndPath(getattr(process,m),*tsks))
189  added.append(epName)
190 
191  s = process.schedule_()
192  if s:
193  pathNames = [p.label_() for p in s]
194  for rName in toRemove:
195  pathNames.remove(rName)
196  for n in added:
197  pathNames.append(n)
198  newS = cms.Schedule(*[getattr(process,n) for n in pathNames])
199  if s._tasks:
200  newS.associate(*s._tasks)
201  process.setSchedule_(newS)
202 
203  for r in toRemove:
204  delattr(process,r)
205 
206 
def convertToSingleModuleEndPaths(process)
Definition: Utilities.py:171
def Utilities.convertToUnscheduled (   proc)

Definition at line 45 of file Utilities.py.

References cleanUnscheduled().

Referenced by ConfigBuilder.ConfigBuilder.prepare(), Utilities.TestModuleCommand.testNoSchedule(), and Utilities.TestModuleCommand.testWithSchedule().

46  import FWCore.ParameterSet.Config as cms
47  """Given a 'Process', convert the python configuration from scheduled execution to unscheduled. This is done by
48  1. Pulling EDProducers off Path and EndPath Sequences and putting them on an associated Task.
49  2. Pulling EDFilters whose filter results are ignored off Path and EndPath Sequences and putting
50  them on an associated Task.
51  3. Fixing up the Schedule if needed
52  """
53  # Warning: It is not always possible to convert a configuration
54  # where EDProducers are all run on Paths to an unscheduled
55  # configuration by modifying only the python configuration.
56  # There is more than one kind of pathological condition
57  # that can cause this conversion to produce a configuration
58  # that gives different results than the original configuration
59  # when run under cmsRun. One should view the converted configuration
60  # as a thing which needs to be validated. It is possible for there
61  # to be pathologies that cannot be resolved by modifying only the
62  # python configuration and may require redesign inside the C++ code
63  # of the modules and redesign of the logic. For example,
64  # an EDAnalyzer might try to get a product and check if the
65  # returned handle isValid. Then it could behave differently
66  # depending on whether or not the product was present.
67  # The behavior when the product is not present could
68  # be meaningful and important. In the unscheduled case,
69  # the EDProducer will always run and the product could
70  # always be there.
71 
72  proc.resolve()
73 
74  proc=cleanUnscheduled(proc)
75  return proc
76 
def cleanUnscheduled(proc)
Definition: Utilities.py:77
def convertToUnscheduled(proc)
Definition: Utilities.py:45
def Utilities.createTaskWithAllProducersAndFilters (   process)

Definition at line 165 of file Utilities.py.

Referenced by Utilities.TestModuleCommand.testCreateTaskWithAllProducersAndFilters().

166  from FWCore.ParameterSet.Config import Task
167  l = [ p for p in process.producers.itervalues()]
168  l.extend( (f for f in process.filters.itervalues()) )
169  return Task(*l)
170 
def createTaskWithAllProducersAndFilters(process)
Definition: Utilities.py:165
def Utilities.getHltConfiguration (   menu,
  args 
)

Definition at line 13 of file Utilities.py.

References _build_options(), and FrontierConditions_GlobalTag_cff.dump.

13 def getHltConfiguration(menu, **args):
14  args['menu'] = menu
15  args['fragment'] = False
16  options = _build_options(**args)
17 
18  hlt = _imp.new_module('hlt')
19  exec(_confdb.HLTProcess(options).dump(), globals(), hlt.__dict__)
20  return hlt.process
21 
22 
def _build_options(args)
Definition: Utilities.py:6
def getHltConfiguration(menu, args)
Definition: Utilities.py:13
def Utilities.ignoreAllFiltersOnPath (   path)
Given a 'Path', find all EDFilters and wrap them in 'cms.ignore'

Definition at line 1 of file Utilities.py.

References resolutioncreator_cfi.object.

2  """Given a 'Path', find all EDFilters and wrap them in 'cms.ignore'
3  """
4  import FWCore.ParameterSet.Config as cms
5  from FWCore.ParameterSet.SequenceTypes import _MutatingSequenceVisitor, _UnarySequenceOperator
6 
7  class IgnoreFilters(object):
8  def __init__(self):
9  self.__lastCallUnary = False
10  self.onTask = False
11  def __call__(self, obj):
12  if self.onTask:
13  return obj
14  elif isinstance(obj,_UnarySequenceOperator):
15  self.__lastCallUnary = True
16  elif obj.isLeaf() and isinstance(obj, cms.EDFilter) and not self.__lastCallUnary:
17  return cms.ignore(obj)
18  else:
19  self.__lastCallUnary = False
20  return obj
21  class IgnoreFiltersVisitor(_MutatingSequenceVisitor):
22  def __init__(self):
23  self.operator = IgnoreFilters()
24  self._levelInTasks = 0
25  super(type(self),self).__init__(self.operator)
26  def enter(self,visitee):
27  if isinstance(visitee, cms.Task):
28  self._levelInTasks += 1
29  self.operator.onTask = (self._levelInTasks > 0)
30  super(IgnoreFiltersVisitor,self).enter(visitee)
31  def leave(self,visitee):
32  if self._levelInTasks > 0:
33  if isinstance(visitee, cms.Task):
34  self._levelInTasks -= 1
35  super(IgnoreFiltersVisitor,self).leave(visitee)
36 
37  mutator = IgnoreFiltersVisitor()
38  path.visit(mutator)
39  if mutator._didApply():
40  path._seq = mutator.result(path)[0]
41  path._tasks.clear()
42  path.associate(*mutator.result(path)[1])
43  return path
44 
def ignoreAllFiltersOnPath(path)
Definition: Utilities.py:1
def Utilities.loadHltConfiguration (   process,
  menu,
  args 
)

Definition at line 23 of file Utilities.py.

References _build_options(), and FrontierConditions_GlobalTag_cff.dump.

23 def loadHltConfiguration(process, menu, **args):
24  args['menu'] = menu
25  args['fragment'] = True
26  options = _build_options(**args)
27 
28  hlt = _imp.new_module('hlt')
29  exec(_confdb.HLTProcess(options).dump(), globals(), hlt.__dict__)
30  process.extend( hlt )
31 
32 
def _build_options(args)
Definition: Utilities.py:6
def loadHltConfiguration(process, menu, args)
Definition: Utilities.py:23
def Utilities.moduleLabelsInSequences (   sequences)

Definition at line 162 of file Utilities.py.

References modulesInSequences().

162 def moduleLabelsInSequences(* sequences):
163  return [module.label() for module in modulesInSequences(* sequences)]
164 
def moduleLabelsInSequences(sequences)
Definition: Utilities.py:162
def modulesInSequences(sequences)
Definition: Utilities.py:154
def Utilities.modulesInSequences (   sequences)

Definition at line 154 of file Utilities.py.

Referenced by moduleLabelsInSequences().

154 def modulesInSequences(* sequences):
155  from FWCore.ParameterSet.SequenceTypes import ModuleNodeVisitor
156  modules = []
157  for sequence in sequences:
158  sequence.visit(ModuleNodeVisitor(modules))
159  return modules
160 
161 
def modulesInSequences(sequences)
Definition: Utilities.py:154

Variable Documentation

Utilities.__lastCallUnary
private

Definition at line 9 of file Utilities.py.

Utilities._levelInTasks
private

Definition at line 24 of file Utilities.py.

Utilities.onTask

Definition at line 10 of file Utilities.py.

Utilities.operator

Definition at line 23 of file Utilities.py.

Referenced by AlcaBeamMonitorClient.AlcaBeamMonitorClient(), SiStripCalibLorentzAngle.algoBeginJob(), SiStripGainFromCalibTree.algoEndJob(), edm::debugging_allocator< T >.allocate(), DetIdSelectorTest.analyze(), BeamConditionsMonitor.BeamConditionsMonitor(), BeamMonitor.BeamMonitor(), BeamMonitorBx.BeamMonitorBx(), BeamSpotProblemMonitor.BeamSpotProblemMonitor(), PFDQMEventSelector.beginJob(), DQMMessageLoggerClient.beginJob(), GenericBenchmarkAnalyzer.beginJob(), PFTester.beginJob(), DQMSourceExample.beginJob(), DQMFEDIntegrityClient.beginJob(), DQMOfflineHLTEventInfoClient.beginJob(), LaserDQM.beginJob(), DQMLumiMonitor.beginJob(), PixelVTXMonitor.beginJob(), DQMClientExample.beginJob(), SimplePhotonAnalyzer.beginJob(), APVValidationPlots.beginJob(), StripValidationPlots.beginJob(), TestSuite.beginJob(), SiPixelDQMRocLevelAnalyzer.beginJob(), DQMDaqInfo.beginJob(), FourVectorHLT.beginJob(), MuonAlignment.beginJob(), DQMStoreStats.beginJob(), ESIntegrityTask.beginLuminosityBlock(), DQMEDAnalyzer.beginRun(), SiStripLAProfileBooker.beginRun(), SiStripCommissioningSource.beginRun(), DTSegment2DQuality.beginRun(), DTSegment2DSLPhiQuality.beginRun(), DTSegment4DQuality.beginRun(), DTRecHitQuality.beginRun(), thread_unsafe::DQMEDAnalyzer.beginRun(), TrackingTruthValid.bookHistograms(), SiStripDigiValid.bookHistograms(), SiPixelDigiValid.bookHistograms(), TrackerHitAnalyzer.bookHistograms(), TkConvValidator.bookHistograms(), SiPixelTrackingRecHitsValid.bookHistograms(), SiStripCondObjBuilderFromDb.buildAnalysisRelatedObjects(), ConversionPostprocessing.ConversionPostprocessing(), ConverterTester.ConverterTester(), SiStripCommissioningOfflineDbClient.createHistos(), SiStripActionExecutor.createTkInfoFile(), CSCDCCUnpacker.CSCDCCUnpacker(), edm::debugging_allocator< T >.deallocate(), TrackerOfflineValidation::DirectoryWrapper.DirectoryWrapper(), DQMDcsInfoClient.DQMDcsInfoClient(), DQMGenericClient.dqmEndJob(), DQMFileReader.DQMFileReader(), DTnoiseDBValidation.DTnoiseDBValidation(), DTRecHitClients.DTRecHitClients(), DTt0DBValidation.DTt0DBValidation(), EcalBarrelMonitorDbModule.EcalBarrelMonitorDbModule(), EcalBarrelSimHitsValidation.EcalBarrelSimHitsValidation(), EcalEndcapSimHitsValidation.EcalEndcapSimHitsValidation(), EcalPreshowerSimHitsValidation.EcalPreshowerSimHitsValidation(), EcalSimHitsValidation.EcalSimHitsValidation(), EDMtoMEConverter.EDMtoMEConverter(), EgHLTOfflineSummaryClient.EgHLTOfflineSummaryClient(), DQMEDHarvester.endJob(), HarvestingAnalyzer.endJob(), DQMEDHarvester.endLuminosityBlock(), DT4DSegmentClients.endLuminosityBlock(), DT2DSegmentClients.endLuminosityBlock(), DQMEDAnalyzer.endLuminosityBlockSummary(), DQMRivetClient.endRun(), DQMGenericTnPClient.endRun(), ESIntegrityTask.endRun(), SiStripClassToMonitorCondData.endRun(), SiStripMonitorCondData.endRun(), OccupancyPlots.endRun(), DQMEDAnalyzer.endRunSummary(), ESDaqInfoTask.ESDaqInfoTask(), ESDataCertificationTask.ESDataCertificationTask(), ESDcsInfoTask.ESDcsInfoTask(), FedRawDataInputSource.FedRawDataInputSource(), SiStripQualityDQM.fillGrandSummaryMEs(), FourVectorHLT.FourVectorHLT(), GenFilterEfficiencyProducer.GenFilterEfficiencyProducer(), FWEvePtr< T >.get(), SiStripCablingDQM.getActiveDetIds(), ValidHitPairFilter.getCloseDets(), ClusterShapeTrackFilter.getGlobalPoss(), GlobalHitsProdHistStripper.GlobalHitsProdHistStripper(), GlobalMuonMatchAnalyzer.GlobalMuonMatchAnalyzer(), HLTInclusiveVBFClient.HLTInclusiveVBFClient(), HLTOverallSummary.HLTOverallSummary(), HLTPrescaler.HLTPrescaler(), HLTPrescaleRecorder.HLTPrescaleRecorder(), HLTScalersClient.HLTScalersClient(), DQMFEDIntegrityClient.initialize(), DQMSourceExample.initialize(), DQMOfflineHLTEventInfoClient.initialize(), DQMClientExample.initialize(), SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy.initializeDQMHistograms(), L1ScalersClient.L1ScalersClient(), cond::persistency::PayloadProxy< cond::persistency::KeyList >.loadPayload(), TkHistoMap.loadServices(), SiStripFedCablingBuilderFromDb.make(), MEtoEDMConverter.MEtoEDMConverter(), MEtoMEComparitor.MEtoMEComparitor(), MonitorElementsDb.MonitorElementsDb(), MonitorLTC.MonitorLTC(), MuIsoValidation.MuIsoValidation(), MuonKinVsEtaAnalyzer.MuonKinVsEtaAnalyzer(), MuonTrackAnalyzer.MuonTrackAnalyzer(), MuonTrackResidualAnalyzer.MuonTrackResidualAnalyzer(), MuonTrackValidatorBase.MuonTrackValidatorBase(), NoiseTask.NoiseTask(), PVSelector.operator()(), RunLumiSelector.operator()(), PVObjectSelector.operator()(), ElectronVPlusJetsIDSelectionFunctor.operator()(), PFElectronSelector.operator()(), PFMuonSelector.operator()(), funct::RootIntegrator.operator()(), MuonVPlusJetsIDSelectionFunctor.operator()(), JetIDSelectionFunctor.operator()(), PFJetIDSelectionFunctor.operator()(), SimpleCutBasedElectronIDSelectionFunctor.operator()(), de_rank< T >.operator()(), Indexed< T >.operator+(), EncodedTruthId.operator<(), EncodedTruthId.operator==(), PedsOnlyTask.PedsOnlyTask(), PFJetBenchmarkAnalyzer.PFJetBenchmarkAnalyzer(), PFMETBenchmarkAnalyzer.PFMETBenchmarkAnalyzer(), PFTauElecRejectionBenchmarkAnalyzer.PFTauElecRejectionBenchmarkAnalyzer(), PhotonPostprocessing.PhotonPostprocessing(), evf::FastMonitoringService.preBeginJob(), SiStripBadModuleFedErrESSource.produce(), PSMonitor.PSMonitor(), BuildTrackerMapPlugin.read(), recoBSVTagInfoValidationAnalyzer.recoBSVTagInfoValidationAnalyzer(), RecoMuonValidator.RecoMuonValidator(), SiStripCondObjBuilderFromDb.retrieveNumberAPVPairs(), RivetAnalyzer.RivetAnalyzer(), WPlusJetsEventSelector.scaleJets(), SiStripCondObjBuilderFromDb.setValuesApvLatency(), SiPixelFolderOrganizer.SiPixelFolderOrganizer(), SiStripAnalyser.SiStripAnalyser(), SiStripCertificationInfo.SiStripCertificationInfo(), SiStripCorrelateBadStripAndNoise.SiStripCorrelateBadStripAndNoise(), SiStripCorrelateNoise.SiStripCorrelateNoise(), SiStripDaqInfo.SiStripDaqInfo(), SiStripFolderOrganizer.SiStripFolderOrganizer(), SiStripGainFromCalibTree.SiStripGainFromCalibTree(), SiStripGainFromData.SiStripGainFromData(), SiStripMonitorFilter.SiStripMonitorFilter(), SiStripMonitorHLT.SiStripMonitorHLT(), SiStripOfflineDQM.SiStripOfflineDQM(), SiStripPlotGain.SiStripPlotGain(), SiStripQualityChecker.SiStripQualityChecker(), SiStripQualityHotStripIdentifierRoot.SiStripQualityHotStripIdentifierRoot(), SiStripTrackerMapCreator.SiStripTrackerMapCreator(), StatisticsFilter.StatisticsFilter(), TkLayerMap.TkLayerMap(), TrackEfficiencyMonitor.TrackEfficiencyMonitor(), TrackerOfflineValidationSummary.TrackerOfflineValidationSummary(), TSCBLBuilderWithPropagator.TSCBLBuilderWithPropagator(), Clusterizer1D< reco::Track >.~Clusterizer1D(), DivisiveClusterizer1D< T >.~DivisiveClusterizer1D(), pixeltemp::DivisiveClusterizer1D< T >.~DivisiveClusterizer1D(), TrackHitsFilter.~TrackHitsFilter(), TSCBLBuilderWithPropagator.~TSCBLBuilderWithPropagator(), and TSCPBuilderNoMaterial.~TSCPBuilderNoMaterial().