Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:41

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 
0004 """
0005 Important note to developers: the random number services of the GEM and
0006 ME0 digi modules are no longer initialized in this file. Instead, they
0007 are automically initialized through the --era (Run3, Phase2) command.
0008 In case cmsRun or cmsDriver crashes because of RandomNumberGeneratorSerivce,
0009 you may have forgotten to specify the correct era!
0010 
0011  --Sven Dildick
0012 """
0013 
0014 
0015 # Customize process.mix to be used for running muon (DT, CSC, RPC) digi only.
0016 #  - remove non-muon digitizers that are now run as part of mixing process
0017 #  - delete all the digitizers' aliases.
0018 #  - drop unnecessary mixObjects
0019 def customize_mix_muon_only(process):
0020     process.mix.digitizers = digitizers = cms.PSet()
0021     digi_aliases = [n for n in process.aliases.keys() if 'Digi' in n]
0022     for a in digi_aliases: process.__delattr__(a)
0023     from SimGeneral.MixingModule.mixObjects_cfi import theMixObjects
0024     process.mix.mixObjects = theMixObjects
0025     process.mix.mixObjects.mixCH = cms.PSet()
0026     process.mix.mixObjects.mixSH.crossingFrames = cms.untracked.vstring(
0027         'MuonCSCHits',
0028         'MuonDTHits',
0029         'MuonRPCHits'
0030     )
0031     process.mix.mixObjects.mixSH.input = cms.VInputTag(
0032         cms.InputTag("g4SimHits","MuonCSCHits"),
0033         cms.InputTag("g4SimHits","MuonDTHits"),
0034         cms.InputTag("g4SimHits","MuonRPCHits")
0035     )
0036     process.mix.mixObjects.mixSH.subdets = cms.vstring(
0037         'MuonCSCHits',
0038         'MuonDTHits',
0039         'MuonRPCHits'
0040     )
0041     return process
0042 
0043 
0044 # customize process.mix by appending GEM SimHit collection definitions to mix.mixObjects.mixSH
0045 def customize_mix_addGEM(process):
0046     process.mix.mixObjects.mixSH.crossingFrames.append('MuonGEMHits')
0047     process.mix.mixObjects.mixSH.input.append(cms.InputTag("g4SimHits","MuonGEMHits"))
0048     process.mix.mixObjects.mixSH.subdets.append('MuonGEMHits')
0049     return process
0050 
0051 
0052 # customize process.mix by appending ME0 SimHit collection definitions to mix.mixObjects.mixSH
0053 def customize_mix_addME0(process):
0054     process.mix.mixObjects.mixSH.crossingFrames.append('MuonME0Hits')
0055     process.mix.mixObjects.mixSH.input.append(cms.InputTag("g4SimHits","MuonME0Hits"))
0056     process.mix.mixObjects.mixSH.subdets.append('MuonME0Hits')
0057     return process
0058 
0059 
0060 ## load the digitizer and pad producer
0061 def load_GEM_digitizers(process):
0062     process.load('SimMuon.GEMDigitizer.muonGEMDigi_cff')
0063     return process
0064 
0065 
0066 ## load the digitizer and pad producer
0067 def load_ME0_digitizers(process):
0068     process.load('SimMuon.GEMDigitizer.muonME0Digi_cff')
0069     return process
0070 
0071 
0072 # Customize process.mix to be used for running muon (DT, CSC, RPC + GEM) digi only.
0073 #  - first do such customization for (DT, CSC, RPC)
0074 #  - append GEM SimHit collection definitions to mix.mixObjects.mixSH
0075 def customize_mix_addGEM_muon_only(process):
0076     process = customize_mix_muon_only(process)
0077     process = customize_mix_addGEM(process)
0078     return process
0079 
0080 
0081 # Customize process.mix to be used for running muon (DT, CSC, RPC + ME0) digi only.
0082 #  - first do such customization for (DT, CSC, RPC)
0083 #  - append ME0 SimHit collection definitions to mix.mixObjects.mixSH
0084 def customize_mix_addME0_muon_only(process):
0085     process = customize_mix_muon_only(process)
0086     process = customize_mix_addME0(process)
0087     return process
0088 
0089 
0090 # Customize process.mix to be used for running muon (DT, CSC, RPC, GEM, ME0) digi only.
0091 #  - first do such customization for (DT, CSC, RPC)
0092 #  - append GEM SimHit collection definitions to mix.mixObjects.mixSH
0093 #  - append ME0 SimHit collection definitions to mix.mixObjects.mixSH
0094 def customize_mix_addGEM_addME0_muon_only(process):
0095     process = customize_mix_muon_only(process)
0096     process = customize_mix_addGEM(process)
0097     process = customize_mix_addME0(process)
0098     return process
0099 
0100 
0101 # customize the digitization sequence pdigi to only digitize GEM
0102 def customize_digi_addGEM_gem_only(process):
0103     process = load_GEM_digitizers(process)
0104     process = customize_mix_addGEM_muon_only(process)
0105     process.pdigi = cms.Sequence(
0106         cms.SequencePlaceholder("randomEngineStateProducer")*
0107         cms.SequencePlaceholder("mix")*
0108         process.muonGEMDigi
0109     )
0110     process = append_GEMDigi_event(process)
0111     return process
0112 
0113 
0114 # customize the digitization sequence pdigi to only digitize ME0
0115 def customize_digi_addME0_me0_only(process):
0116     process = load_ME0_digitizers(process)
0117     process = customize_mix_addME0_muon_only(process)
0118     process.pdigi = cms.Sequence(
0119         cms.SequencePlaceholder("randomEngineStateProducer")*
0120         cms.SequencePlaceholder("mix")*
0121         process.muonME0Digi
0122     )
0123     process = append_ME0Digi_event(process)
0124     return process
0125 
0126 
0127 # customize the digitization sequence pdigi to only digitize GEM, ME0
0128 def customize_digi_addGEM_addME0_gem_me0_only(process):
0129     process = load_GEM_digitizers(process)
0130     process = load_ME0_digitizers(process)
0131     process = customize_mix_addGEM_addME0_muon_only(process)
0132     process.pdigi = cms.Sequence(
0133         cms.SequencePlaceholder("randomEngineStateProducer")*
0134         cms.SequencePlaceholder("mix")*
0135         process.muonGEMDigi*
0136         process.muonME0Digi
0137     )
0138     process = append_GEMDigi_event(process)
0139     return process
0140 
0141 
0142 # customize the digitization sequence pdigi to only digitize DT+CSC+RPC+GEM
0143 def customize_digi_addGEM_muon_only(process):
0144     process = load_GEM_digitizers(process)
0145     process = customize_mix_addGEM_muon_only(process)
0146     process.muonDigi = cms.Sequence(
0147         process.simMuonCSCDigis +
0148         process.simMuonDTDigis +
0149         process.simMuonRPCDigis +
0150         process.muonGEMDigi
0151     )
0152     process.pdigi = cms.Sequence(
0153         cms.SequencePlaceholder("randomEngineStateProducer")*
0154         cms.SequencePlaceholder("mix")*
0155         process.muonDigi
0156     )
0157     process = append_GEMDigi_event(process)
0158     return process
0159 
0160 
0161 # customize the digitization sequence pdigi to only digitize DT+CSC+RPC+GEM+ME0
0162 def customize_digi_addGEM_addME0_muon_only(process):
0163     process = load_GEM_digitizers(process)
0164     process = load_ME0_digitizers(process)
0165     process = customize_mix_addGEM_addME0_muon_only(process)
0166     process.muonDigi = cms.Sequence(
0167         process.simMuonCSCDigis +
0168         process.simMuonDTDigis +
0169         process.simMuonRPCDigis +
0170         process.muonGEMDigi +
0171         process.muonME0Digi
0172     )
0173     process.pdigi = cms.Sequence(
0174         cms.SequencePlaceholder("randomEngineStateProducer")*
0175         cms.SequencePlaceholder("mix")*
0176         process.muonDigi
0177     )
0178     process = append_GEMDigi_event(process)
0179     return process
0180 
0181 
0182 # customize the full digitization sequence pdigi by adding GEMs
0183 def customize_digi_addGEM(process):
0184     process = load_GEM_digitizers(process)
0185     process = customize_mix_addGEM(process)
0186     process.doAllDigi = cms.Sequence(
0187         process.calDigi +
0188         process.muonDigi +
0189         process.muonGEMDigi
0190     )
0191     process.pdigi = cms.Sequence(
0192         cms.SequencePlaceholder("randomEngineStateProducer")*
0193         cms.SequencePlaceholder("mix")*
0194         process.doAllDigi*
0195         process.addPileupInfo
0196     )
0197     process = append_GEMDigi_event(process)
0198     return process
0199 
0200 
0201 # customize the full digitization sequence pdigi by adding GEMs
0202 def customize_digi_addGEM_addME0(process):
0203     process = load_GEM_digitizers(process)
0204     process = load_ME0_digitizers(process)
0205     process = customize_mix_addGEM(process)
0206     process = customize_mix_addME0(process)
0207     process.doAllDigi = cms.Sequence(
0208         process.calDigi +
0209         process.muonDigi +
0210         process.muonGEMDigi +
0211         process.muonME0Digi
0212     )
0213     process.pdigi = cms.Sequence(
0214         cms.SequencePlaceholder("randomEngineStateProducer")*
0215         cms.SequencePlaceholder("mix")*
0216         process.doAllDigi*
0217         process.addPileupInfo
0218     )
0219     process = append_GEMDigi_event(process)
0220     return process
0221 
0222 
0223 # insert the GEMDigi and GEMPadDigi collection to the event
0224 def append_GEMDigi_event(process):
0225     alist=['AODSIM','RECOSIM','FEVTSIM','FEVTDEBUG','FEVTDEBUGHLT','RECODEBUG','RAWRECOSIMHLT','RAWRECODEBUGHLT']
0226     for a in alist:
0227         b=a+'output'
0228         if hasattr(process,b):
0229             getattr(process,b).outputCommands.extend(['keep *_g4SimHits_Muon*_*', 'keep *_*Muon*_*_*'])
0230 
0231     return process
0232 
0233 # Customizations for the background
0234 def customize_digi_noGEMbkg(process):
0235     process.simMuonGEMDigis.doBkgNoise = False
0236     return process
0237 
0238 def customize_digi_noGEMsafety(process):
0239     process.simMuonGEMDigis.rateFact = 1
0240     return process
0241 
0242 # Customizations for the background (to be updated once the realistic digi is in place)
0243 def customize_digi_noME0bkg(process):
0244     process.simMuonME0PseudoDigis.simulateElectronBkg = False
0245     process.simMuonME0PseudoDigis.simulateNeutralBkg = False
0246     return process
0247 
0248 def customize_digi_noME0safety(process):
0249     process.simMuonME0PseudoDigis.rateFact = 1
0250     return process
0251 
0252 # Customizations for the background
0253 def customize_digi_noRPCbkg(process):
0254     process.simMuonRPCDigis.doBkgNoise = False
0255     return process
0256 
0257 # adding re-digi costumisation - to be used for dedicated trigger studies
0258 def customise_rpcRedigi(process):
0259     process.load('Configuration.StandardSequences.Digi_cff')
0260     process.simMuonRPCReDigis = process.simMuonRPCDigis.clone()
0261     process.simMuonRPCReDigis.digiModelConfig = process.simMuonRPCDigis.digiModelConfig.clone(
0262         IRPC_time_resolution = cms.double(1.5),
0263         IRPC_electronics_jitter = cms.double(0.1),
0264     )
0265     process.simMuonRPCReDigis.digiIRPCModelConfig = process.simMuonRPCReDigis.digiModelConfig.clone(
0266         IRPC_time_resolution = cms.double(1.0),
0267         do_Y_coordinate = cms.bool(True),
0268     )
0269     process.simMuonRPCReDigis.digiModel = cms.string('RPCSimModelTiming')
0270     process.RandomNumberGeneratorService.simMuonRPCReDigis = cms.PSet(
0271         initialSeed = cms.untracked.uint32(13579),
0272         engineName = cms.untracked.string('TRandom3')
0273     )
0274     process.rpcRecHits.rpcDigiLabel = cms.InputTag("simMuonRPCReDigis")
0275     process.validationMuonRPCDigis.rpcDigiTag = cms.untracked.InputTag("simMuonRPCReDigis")
0276     process.reconstruction_step.replace(
0277         process.rpcRecHits,
0278         cms.Sequence(process.simMuonRPCReDigis+process.rpcRecHits)
0279     )
0280     return process