Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split up GEM and ME0 customizations #13963

Merged
merged 15 commits into from Apr 30, 2016
7 changes: 5 additions & 2 deletions Configuration/StandardSequences/python/Eras.py
Expand Up @@ -20,6 +20,7 @@ def __init__(self):
# converted to run2_common (i.e. a search and replace of "stage1L1Trigger" to
# "run2_common" over the whole python tree). In practice, I don't think it's worth
# it, and this also gives the flexibilty to take it out easily.
self.run3_GEM = cms.Modifier()

# Phase 2 sub-eras for stable features
self.phase2_common = cms.Modifier()
Expand Down Expand Up @@ -59,9 +60,11 @@ def __init__(self):
self.Run2_2016 = cms.ModifierChain( self.run2_common, self.run2_25ns_specific, self.stage2L1Trigger, self.run2_HF_2016 )
self.Run2_2017 = cms.ModifierChain( self.Run2_2016, self.phase1Pixel, self.trackingPhase1 )
# Scenarios further afield.
# Run3 includes the GE1/1 upgrade
self.Run3 = cms.ModifierChain( self.Run2_2017,self.run3_GEM )
# Phase2 is everything for the 2023 (2026?) detector that works so far in this release.
# include phase 1 stuff until phase 2 tracking is fully defined....
self.Phase2 = cms.ModifierChain( self.phase2_common, self.phase2_tracker, self.phase2_hgcal, self.phase2_muon )
self.Phase2 = cms.ModifierChain( self.phase2_common, self.phase2_tracker, self.phase2_hgcal, self.phase2_muon, self.run3_GEM )
# Phase2dev is everything for the 2023 (2026?) detector that is still in development.
self.Phase2dev = cms.ModifierChain( self.Phase2, self.phase2dev_common, self.phase2dev_tracker, self.phase2dev_hgcal, self.phase2dev_muon )

Expand All @@ -81,7 +84,7 @@ def __init__(self):
self.run2_50ns_specific, self.run2_HI_specific,
self.stage1L1Trigger, self.fastSim,
self.run2_HF_2016, self.stage2L1Trigger,
self.phase1Pixel,
self.phase1Pixel, self.run3_GEM,
self.phase2_common, self.phase2_tracker,
self.phase2_hgcal, self.phase2_muon,
self.phase2dev_common, self.phase2dev_tracker,
Expand Down
16 changes: 6 additions & 10 deletions IOMC/RandomEngine/python/IOMC_cff.py
Expand Up @@ -169,15 +169,11 @@

randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer")

def _modifyRandomNumberGeneratorServiceForPhase2( object ):
object.simMuonGEMDigis = cms.PSet(
initialSeed = cms.untracked.uint32(1234567),
engineName = cms.untracked.string('HepJamesRandom')
)
object.simMuonME0Digis = cms.PSet(
from Configuration.StandardSequences.Eras import eras
eras.run3_GEM.toModify(RandomNumberGeneratorService, simMuonGEMDigis = cms.PSet(
initialSeed = cms.untracked.uint32(1234567),
engineName = cms.untracked.string('HepJamesRandom')
)
engineName = cms.untracked.string('HepJamesRandom')) )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize that simMuonGEMDigis does not already exist in RandomNumberGeneratorService. Becuase it does not exist you can't use a dictionary and instead must declare a new PSet

eras.run3_GEM.toModify(RandomNumberGeneratorService, simMuonGEMDigis = cms.PSet(
                                         initialSeed = cms.untracked.uint32(1234567),
                                         engineName = cms.untracked.string('HepJamesRandom')) )


from Configuration.StandardSequences.Eras import eras
eras.phase2_muon.toModify( RandomNumberGeneratorService, func=_modifyRandomNumberGeneratorServiceForPhase2 )
eras.phase2_muon.toModify(RandomNumberGeneratorService, simMuonME0Digis = cms.PSet(
initialSeed = cms.untracked.uint32(1234567),
engineName = cms.untracked.string('HepJamesRandom')) )
Expand Up @@ -28,13 +28,11 @@
'keep *_cscSegments_*_*',
'keep *_rpcRecHits_*_*')
)

def _modifyRecoLocalMuonEventContentForPhase2( object ):
object.outputCommands.append('keep *_gemRecHits_*_*')
object.outputCommands.append('keep *_me0RecHits_*_*')
object.outputCommands.append('keep *_me0Segments_*_*')

from Configuration.StandardSequences.Eras import eras
eras.phase2_muon.toModify( RecoLocalMuonFEVT, func=_modifyRecoLocalMuonEventContentForPhase2 )
eras.phase2_muon.toModify( RecoLocalMuonRECO, func=_modifyRecoLocalMuonEventContentForPhase2 )
eras.phase2_muon.toModify( RecoLocalMuonAOD, func=_modifyRecoLocalMuonEventContentForPhase2 )
def _updateOutput( era, outputPSets, commands):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the next PR... this should just get moved to normal cff that manage the event content. If the collections are not produced, they won't be part of the event content
@dildick

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidlange6 Which file is that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its in fact this same one.. RecoLocalMuon/Configuration/python/RecoLocalMuon_EventContent_cff.py - we hopefully can avoid era statements in the event content

On Apr 29, 2016, at 4:19 PM, Sven Dildick notifications@github.com wrote:

In RecoLocalMuon/Configuration/python/RecoLocalMuon_EventContent_cff.py:

from Configuration.StandardSequences.Eras import eras
-eras.phase2_muon.toModify( RecoLocalMuonFEVT, func=_modifyRecoLocalMuonEventContentForPhase2 )
-eras.phase2_muon.toModify( RecoLocalMuonRECO, func=_modifyRecoLocalMuonEventContentForPhase2 )
-eras.phase2_muon.toModify( RecoLocalMuonAOD, func=_modifyRecoLocalMuonEventContentForPhase2 )
+def _updateOutput( era, outputPSets, commands):

@davidlange6 Which file is that?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

for o in outputPSets:
era.toModify( o, outputCommands = o.outputCommands + commands )

_outputs = [RecoLocalMuonFEVT, RecoLocalMuonRECO, RecoLocalMuonAOD]
_updateOutput( eras.run3_GEM, _outputs, ['keep *_gemRecHits_*_*'] )
_updateOutput(eras.phase2_muon, _outputs, ['keep *_me0RecHits_*_*', 'keep *_me0Segments_*_*'])
16 changes: 10 additions & 6 deletions RecoLocalMuon/Configuration/python/RecoLocalMuon_cff.py
Expand Up @@ -37,11 +37,15 @@
# DT, CSC and RPC together (correct sequence for the standard path)
muonlocalreco = cms.Sequence(dtlocalreco+csclocalreco+rpcRecHits)

def _modifyRecoLocalMuonForPhase2( theProcess ):
theProcess.load("RecoLocalMuon.GEMRecHit.gemRecHits_cfi")
theProcess.load("RecoLocalMuon.GEMRecHit.me0LocalReco_cff")
theProcess.muonlocalreco += theProcess.gemRecHits
theProcess.muonlocalreco += theProcess.me0LocalReco
from RecoLocalMuon.GEMRecHit.gemRecHits_cfi import *
from RecoLocalMuon.GEMRecHit.me0LocalReco_cff import *

_run3_muonlocalreco = muonlocalreco.copy()
_run3_muonlocalreco += gemRecHits

_phase2_muonlocalreco = _run3_muonlocalreco.copy()
_phase2_muonlocalreco += me0LocalReco

from Configuration.StandardSequences.Eras import eras
modifyConfigurationStandardSequencesRecoLocalMuonForPhase2_ = eras.phase2_muon.makeProcessModifier( _modifyRecoLocalMuonForPhase2 )
eras.run3_GEM.toReplaceWith( muonlocalreco , _run3_muonlocalreco )
eras.phase2_muon.toReplaceWith( muonlocalreco , _phase2_muonlocalreco )
Copy link
Contributor Author

@dildick dildick Apr 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dr15Jones could it be that this line is interfering with

from RecoMuon.MuonIdentification.me0MuonReco_cff import me0MuonReco
_phase2_muonGlobalReco = muonGlobalReco.copy()
_phase2_muonGlobalReco += me0MuonReco
eras.phase2_muon.toReplaceWith( muonGlobalReco, _phase2_muonGlobalReco )

If so, what is the recommended way to fix it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it requires doing

from RecoMuon.MuonIdentification.me0MuonReco_cff import *

in order to guarantee that all modules being used by me0MuonReco are loaded into the Process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this is fixed. I will some local integration tests to be sure.

35 changes: 20 additions & 15 deletions RecoMuon/Configuration/python/RecoMuonPPonly_cff.py
Expand Up @@ -84,19 +84,24 @@

########################################################

def _modifyRecoMuonPPonlyForPhase2( object ):
object.STATrajBuilderParameters.FilterParameters.EnableGEMMeasurement = cms.bool(True)
object.STATrajBuilderParameters.BWFilterParameters.EnableGEMMeasurement = cms.bool(True)
object.STATrajBuilderParameters.FilterParameters.EnableME0Measurement = cms.bool(True)
object.STATrajBuilderParameters.BWFilterParameters.EnableME0Measurement = cms.bool(True)

from Configuration.StandardSequences.Eras import eras
eras.phase2_muon.toModify( standAloneMuons, func=_modifyRecoMuonPPonlyForPhase2 )
eras.phase2_muon.toModify( refittedStandAloneMuons, func=_modifyRecoMuonPPonlyForPhase2 )

def _modifyRecoMuonPPonlyForPhase2_addME0Muon( theProcess ):
theProcess.load("RecoMuon.MuonIdentification.me0MuonReco_cff")
theProcess.muonGlobalReco += theProcess.me0MuonReco

modifyConfigurationStandardSequencesRecoMuonPPonlyPhase2_ = eras.phase2_muon.makeProcessModifier( _modifyRecoMuonPPonlyForPhase2_addME0Muon )

_enableGEMMeasurement = dict( EnableGEMMeasurement = cms.bool(True) )
eras.run3_GEM.toModify( standAloneMuons, STATrajBuilderParameters = dict(
FilterParameters = _enableGEMMeasurement,
BWFilterParameters = _enableGEMMeasurement ) )
eras.run3_GEM.toModify( refittedStandAloneMuons, STATrajBuilderParameters = dict(
FilterParameters = _enableGEMMeasurement,
BWFilterParameters = _enableGEMMeasurement ) )

_enableME0Measurement = dict( EnableME0Measurement = cms.bool(True) )
eras.phase2_muon.toModify( standAloneMuons, STATrajBuilderParameters = dict(
FilterParameters = _enableME0Measurement,
BWFilterParameters = _enableME0Measurement ) )
eras.phase2_muon.toModify( refittedStandAloneMuons, STATrajBuilderParameters = dict(
FilterParameters = _enableME0Measurement,
BWFilterParameters = _enableME0Measurement ) )

from RecoMuon.MuonIdentification.me0MuonReco_cff import *
_phase2_muonGlobalReco = muonGlobalReco.copy()
_phase2_muonGlobalReco += me0MuonReco
eras.phase2_muon.toReplaceWith( muonGlobalReco, _phase2_muonGlobalReco )
18 changes: 12 additions & 6 deletions SimGeneral/MixingModule/python/mixObjects_cfi.py
Expand Up @@ -222,11 +222,18 @@
from SimCalorimetry.HGCalSimProducers.hgcalDigitizer_cfi import hgceeDigitizer, hgchebackDigitizer, hgchefrontDigitizer

from Configuration.StandardSequences.Eras import eras
eras.run3_GEM.toModify( theMixObjects,
mixSH = dict(
input = theMixObjects.mixSH.input + [ cms.InputTag("g4SimHits","MuonGEMHits") ],
subdets = theMixObjects.mixSH.subdets + [ 'MuonGEMHits' ],
crossingFrames = theMixObjects.mixSH.crossingFrames + [ 'MuonGEMHits' ]
)
)
eras.phase2_muon.toModify( theMixObjects,
mixSH = dict(
input = theMixObjects.mixSH.input + [ cms.InputTag("g4SimHits","MuonGEMHits"), cms.InputTag("g4SimHits","MuonME0Hits") ],
subdets = theMixObjects.mixSH.subdets + [ 'MuonGEMHits', 'MuonME0Hits' ],
crossingFrames = theMixObjects.mixSH.crossingFrames + [ 'MuonGEMHits', 'MuonME0Hits' ]
mixSH = dict(
input = theMixObjects.mixSH.input + [ cms.InputTag("g4SimHits","MuonME0Hits") ],
subdets = theMixObjects.mixSH.subdets + [ 'MuonME0Hits' ],
crossingFrames = theMixObjects.mixSH.crossingFrames + [ 'MuonME0Hits' ]
)
)
eras.phase2_hgcal.toModify( theMixObjects,
Expand All @@ -237,6 +244,5 @@
subdets = theMixObjects.mixCH.subdets + [ hgceeDigitizer.hitCollection.value(),
hgchebackDigitizer.hitCollection.value(),
hgchefrontDigitizer.hitCollection.value() ]
)

)
)
10 changes: 5 additions & 5 deletions SimGeneral/MixingModule/python/trackingTruthProducer_cfi.py
Expand Up @@ -51,9 +51,9 @@
trackingParticles.simTrackCollection = cms.InputTag('famosSimHits')
trackingParticles.simVertexCollection = cms.InputTag('famosSimHits')

def _modifyTrackingParticlesForPhase2( object ):
object.simHitCollections.muon.append(cms.InputTag("g4SimHits","MuonGEMHits"))
object.simHitCollections.muon.append(cms.InputTag("g4SimHits","MuonME0Hits"))

from Configuration.StandardSequences.Eras import eras
eras.phase2_muon.toModify( trackingParticles, func=_modifyTrackingParticlesForPhase2 )
eras.run3_GEM.toModify(trackingParticles, simHitCollections = dict(
muon = trackingParticles.simHitCollections.muon+[cms.InputTag("g4SimHits","MuonGEMHits")]))

eras.phase2_muon.toModify( trackingParticles, simHitCollections = dict(
muon = trackingParticles.simHitCollections.muon+[cms.InputTag("g4SimHits","MuonME0Hits")]))
Expand Up @@ -58,9 +58,9 @@

trackingParticleSelection = cms.Sequence(mergedtruth)

def _modifyTrackingParticleSelectionForPhase2( object ):
object.simHitCollections.muon.append('g4SimHitsMuonGEMHits')
object.simHitCollections.muon.append('g4SimHitsMuonME0Hits')

from Configuration.StandardSequences.Eras import eras
eras.phase2_muon.toModify( trackingParticleSelection, func=_modifyTrackingParticleSelectionForPhase2 )
eras.run3_GEM.toModify(trackingParticleSelection, simHitCollections = dict(
muon = trackingParticleSelection.simHitCollections.muon+["g4SimHitsMuonGEMHits"]))

eras.phase2_muon.toModify( trackingParticleSelection, simHitCollections = dict(
muon = trackingParticleSelection.simHitCollections.muon+["g4SimHitsMuonME0Hits"]))
15 changes: 4 additions & 11 deletions SimMuon/Configuration/python/SimMuon_EventContent_cff.py
Expand Up @@ -39,15 +39,8 @@
outputCommands = cms.untracked.vstring()
)

def _modifySimMuonEventContentFEVTDEBUGForPhase2( object ):
object.outputCommands.append('keep *_simMuonGEMDigis_*_*')
object.outputCommands.append('keep *_simMuonGEMPadDigis_*_*')
object.outputCommands.append('keep *_simMuonME0Digis_*_*')

def _modifySimMuonEventContentRAWRECOForPhase2( object ):
object.outputCommands.append('keep StripDigiSimLinkedmDetSetVector_simMuonGEMDigis_*_*')

from Configuration.StandardSequences.Eras import eras
eras.phase2_muon.toModify( SimMuonFEVTDEBUG, func=_modifySimMuonEventContentFEVTDEBUGForPhase2 )
eras.phase2_muon.toModify( SimMuonRAW, func=_modifySimMuonEventContentRAWRECOForPhase2 )
eras.phase2_muon.toModify( SimMuonRECO, func=_modifySimMuonEventContentRAWRECOForPhase2 )
eras.run3_GEM.toModify( SimMuonFEVTDEBUG, outputCommands = SimMuonFEVTDEBUG.outputCommands + ['keep *_simMuonGEMDigis_*_*', 'keep *_simMuonGEMPadDigis_*_*'] )
eras.run3_GEM.toModify( SimMuonRAW, outputCommands = SimMuonRAW.outputCommands + ['keep StripDigiSimLinkedmDetSetVector_simMuonGEMDigis_*_*'] )
eras.run3_GEM.toModify( SimMuonRECO, outputCommands = SimMuonRECO.outputCommands + ['keep StripDigiSimLinkedmDetSetVector_simMuonGEMDigis_*_*'] )
eras.phase2_muon.toModify( SimMuonFEVTDEBUG, outputCommands = SimMuonFEVTDEBUG.outputCommands + ['keep *_simMuonME0Digis_*_*'] )
7 changes: 5 additions & 2 deletions SimMuon/Configuration/python/SimMuon_cff.py
Expand Up @@ -19,8 +19,10 @@
from SimMuon.GEMDigitizer.muonGEMDigi_cff import *
from SimMuon.GEMDigitizer.muonME0DigisPreReco_cfi import *

_phase2_muonDigi = muonDigi.copy()
_phase2_muonDigi += muonGEMDigi
_run3_muonDigi = muonDigi.copy()
_run3_muonDigi += muonGEMDigi

_phase2_muonDigi = _run3_muonDigi.copy()
_phase2_muonDigi += simMuonME0Digis

def _modifySimMuonForPhase2( theProcess ):
Expand All @@ -41,5 +43,6 @@ def _modifySimMuonForPhase2( theProcess ):
theProcess.rpcphase2recovery_esprefer = cms.ESPrefer("PoolDBESSource","rpcphase2recovery_essource")

from Configuration.StandardSequences.Eras import eras
eras.run3_GEM.toReplaceWith( muonDigi, _run3_muonDigi )
eras.phase2_muon.toReplaceWith( muonDigi, _phase2_muonDigi )
modifyConfigurationStandardSequencesSimMuonPhase2_ = eras.phase2_muon.makeProcessModifier( _modifySimMuonForPhase2 )
2 changes: 1 addition & 1 deletion SimMuon/MCTruth/python/MuonAssociatorByHits_cfi.py
Expand Up @@ -140,4 +140,4 @@
)

from Configuration.StandardSequences.Eras import eras
eras.phase2_muon.toModify( muonAssociatorByHits, useGEMs = cms.bool(True) )
eras.run3_GEM.toModify( muonAssociatorByHits, useGEMs = cms.bool(True) )
16 changes: 10 additions & 6 deletions Validation/Configuration/python/globalValidation_cff.py
Expand Up @@ -120,11 +120,15 @@
)
globalValidationTrackingOnly = cms.Sequence()

def _modifyGlobalValidationForPhase2( theProcess ):
theProcess.load('Validation.Configuration.gemSimValid_cff')
theProcess.load('Validation.Configuration.me0SimValid_cff')
theProcess.globalValidation += theProcess.gemSimValid
theProcess.globalValidation += theProcess.me0SimValid
from Validation.Configuration.gemSimValid_cff import *
from Validation.Configuration.me0SimValid_cff import *

_run3_globalValidation = globalValidation.copy()
_run3_globalValidation += gemSimValid

_phase2_globalValidation = _run3_globalValidation.copy()
_phase2_globalValidation += me0SimValid

from Configuration.StandardSequences.Eras import eras
modifyConfigurationStandardSequencesGlobalValidationForPhase2_ = eras.phase2_muon.makeProcessModifier( _modifyGlobalValidationForPhase2 )
eras.run3_GEM.toReplaceWith( globalValidation, _run3_globalValidation )
eras.phase2_muon.toReplaceWith( globalValidation, _phase2_globalValidation )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dr15Jones is this the most practical way of dealing with modifications of the same thing by a "sequence" of modifiers?
Here we have Phase2 = (phase2_muon, run3_GEM)
and both of them modify the same globalValidation by replacing it with something else. Is it guaranteed that phase2_muon is executed first and takes out the original globalValidation object so that the run3_GEM doesn't do anything with it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order is guaranteed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarification (and my education), in case both run3_GEM and phase2_muon sub-eras are active, the order of actions is

  • run3_GEM replaces globalValidation with _run3_globalValidation
  • phase2_muon replaces globalValidation with _phase2_globalValidation

right? (I'm mainly confused by @slava77's "phase2_muon is executed first")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is we had another from of toReplaceWith which takes a callable object. If the era is chosen, the sequence would be cloned then the clone passed to the callable object and finally the replace would occur based on the output of the callable object. That way eras could properly chain toReplaceWith. E.g.

def _run3_globalValidation(seq):
   global gemSimValid
   return seq+gemSimValid

def _phase2_globalValidation(seq):
   global gemSimValid
   seq = seq.copyAndExclude([gemSimValid])
   return seq+ me0SimValid

eras.run3_GEM.toReplaceWith( globalValidation, transform=_run3_globalValidation )
eras.phase2_muon.toReplaceWith(globalValidation, transform=_phase2_globalValidation)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makortel The order is the other way around. @slava77 had Phase2 = (phase2_muon, run3_GEM) so phase2_muon gets run first then run3_GEM would be run. However that would do the opposite of what @slava77 said. Instead the changes done by phase2_muon would be lost so globalValidation would only contain the changed done by run3_GEM and it would look like phase2_muon never did anything to globalValidation.

This also means that if one ran phase2_muon without also running run3_GEM then globalValidation would still contain gemSimValid!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dr15Jones Now I'm confused even more. Has the implementation of cms.Modifier changed recently (doesn't look so)?

Here is my understanding of the (current) internals of the era system. The fact that Phase2 ModifierChain is (essentially) (phase2_muon, run3_GEM) means only that the sub-eras are activated (their __chosen member is set to True) in that order, and this has nothing to do with the execution order of various toModify() and toReplaceWith() calls (which both seem to still do their magic immediately). Therefore I'd expect the order of applied modifications to be dictated by the order of toModify() and toReplaceWith() calls in the code. In the code above, this order is run3_GEM first, then phase2_muon. In case both being active, I'd expect the globalValidation to be the _phase2_ one.

It also looks to me that the intention is to have in

  • run3_GEM default globalValidation + gemSimValid
  • phase2_muon default globalValidation + gemSimValid + me0SimValid

To me it looks like the configuration above would do what is expected. But maybe I've missed some detail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@makortel You are right and I am wrong. I was thinking about how ProcessModifiers are activated which are done via a delay. You are correct that all other modifications are done in the order they appear in the python configuration fragment files. Sorry for the confusion.
[This is another reason I do not like using ProcessModifiers]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I think my proposal about Modifier.toReplaceWith(obj, transform = ) would allow avoiding the need to know the order of operations since one could just do

def _run3_globalValidation(seq):
   global gemSimValid
   return seq+gemSimValid

def _phase2_globalValidation(seq):
   global me0SimValid
   return seq+ me0SimValid

eras.run3_GEM.toReplaceWith( globalValidation, transform=_run3_globalValidation )
eras.phase2_muon.toReplaceWith(globalValidation, transform=_phase2_globalValidation)

and the end result of both run3_GEM and phase2_muon being used would be globalValidation+gemSimValid+me0SimValid

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Dr15Jones - that would be my preference in terms of simplicity, ease of use, and correct handling of multiple customizations. I'm curious, though, why this syntax for toReplaceWith is desirable while toModify(...,func=...) is discouraged...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kpedro88 good catch! I had forgotten about the other syntax for toModify. Thinking about it I see

  1. toModify can not be used to remove the sequence from the process while a toReplaceWith could
  2. when writing a function passed to toModify you have to be careful to never call = since that does not change the object that was passed in and instead just changes what object the variable points to. E.g.
def _func(seq):
   seq = seq+ foo

eras.bar.toModify( fii, _func)

would not actually change fii since the _func just changed the assignment of seq and didn't modify the object referred to by fii.

24 changes: 14 additions & 10 deletions Validation/Configuration/python/postValidation_cff.py
Expand Up @@ -73,15 +73,19 @@
electronPostValidationSequenceMiniAOD
)

def _modifyPostValidationForPhase2( theProcess ):
theProcess.load('Validation.MuonGEMHits.PostProcessor_cff')
theProcess.load('Validation.MuonGEMDigis.PostProcessor_cff')
theProcess.load('Validation.MuonGEMRecHits.PostProcessor_cff')
theProcess.load('Validation.HGCalValidation.HGCalPostProcessor_cff')
theProcess.postValidation += theProcess.MuonGEMHitsPostProcessors
theProcess.postValidation += theProcess.MuonGEMDigisPostProcessors
theProcess.postValidation += theProcess.MuonGEMRecHitsPostProcessors
theProcess.postValidation += theProcess.hgcalPostProcessor
from Validation.MuonGEMHits.PostProcessor_cff import *
from Validation.MuonGEMDigis.PostProcessor_cff import *
from Validation.MuonGEMRecHits.PostProcessor_cff import *
from Validation.HGCalValidation.HGCalPostProcessor_cff import *

_run3_postValidation = postValidation.copy()
_run3_postValidation += MuonGEMHitsPostProcessors
_run3_postValidation += MuonGEMDigisPostProcessors
_run3_postValidation += MuonGEMRecHitsPostProcessors

_phase2_postValidation = _run3_postValidation.copy()
_phase2_postValidation += hgcalPostProcessor

from Configuration.StandardSequences.Eras import eras
modifyConfigurationStandardSequencesPostValidationForPhase2_ = eras.phase2_muon.makeProcessModifier( _modifyPostValidationForPhase2 )
eras.run3_GEM.toReplaceWith( postValidation, _run3_postValidation )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kpedro88 - also for the future - none of this should be on the post validation sequence - as nothing here depends on hlt - it can be on the prevalidation sequence.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidlange6 postValidation is harvesting, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err- sorry - yes - never mind me.

eras.phase2_hgcal.toReplaceWith( postValidation, _phase2_postValidation )
2 changes: 1 addition & 1 deletion Validation/RecoMuon/python/MuonTrackValidator_cfi.py
Expand Up @@ -115,4 +115,4 @@
)

from Configuration.StandardSequences.Eras import eras
eras.phase2_muon.toModify( muonTrackValidator, useGEMs = cms.bool(True) )
eras.run3_GEM.toModify( muonTrackValidator, useGEMs = cms.bool(True) )