CMS 3D CMS Logo

Functions

pf_01_customize_HLT Namespace Reference

Functions

def customise

Function Documentation

def pf_01_customize_HLT::customise (   process)

Definition at line 6 of file pf_01_customize_HLT.py.

00007                       :
00008  
00009    
00010   
00011   process._Process__name="HLT2"
00012   process.TFileService = cms.Service("TFileService",  fileName = cms.string("histo_simulation.root")          )
00013 
00014   # Add the production filter sequence to all paths so that the empty event
00015   # filter is actually applied and events with no HepMC product are skipped.
00016   # Also add process.pgen for the generation_step which is not inserted by
00017   # cmsDriver for some reason.
00018   for path in process.paths: 
00019     if path != 'generation_step':
00020       getattr(process,path)._seq = process.ProductionFilterSequence*getattr(process,path)._seq
00021     else:
00022       getattr(process,path)._seq = getattr(process,path)._seq*cms.Sequence(process.pgen)
00023 
00024   try:
00025           outputModule = process.output
00026   except:
00027     pass
00028   try:
00029           outputModule = getattr(process,str(getattr(process,list(process.endpaths)[-1])))
00030   except:
00031     pass
00032 
00033   print "Changing eventcontent to RAW+AODSIM + misc. "
00034   outputModule.outputCommands = cms.untracked.vstring("drop *")
00035   outputModule.outputCommands.extend(process.RAWEventContent.outputCommands )
00036   outputModule.outputCommands.extend(process.AODSIMEventContent.outputCommands )
00037 
00038   keepMC = cms.untracked.vstring("keep *_*_zMusExtracted_*",
00039                                  "keep *_*_zmmCands_*",
00040                                  "keep *_removedInputMuons_*_*",
00041                                  "keep *_generator_*_*",
00042                                  "keep *_PhotonIDProd_*_*",
00043                                  "keep *_photons_*_*",
00044                                  "keep *_photonCore_*_*",
00045                                  "keep *_genParticles_*_*",
00046                                  "keep *_particleFlow_*_*",
00047   )
00048   outputModule.outputCommands.extend(keepMC)
00049 
00050   # getRid of second "drop *"
00051   index = 0
00052   for item in outputModule.outputCommands[:]:
00053     if item == "drop *" and index != 0:
00054       #print index," ",outputModule.outputCommands[index]
00055       del outputModule.outputCommands[index]
00056       index -= 1
00057     index += 1  
00058 
00059 
00060   hltProcessName = "HLT"        #"REDIGI38X"
00061   # the following block can be used for more efficient processing by replacing the HLT variable below automatically
00062   try:
00063     hltProcessName = __HLT__
00064   except:
00065     pass
00066         
00067   try:
00068     process.dimuonsHLTFilter.TriggerResultsTag.processName = hltProcessName
00069     process.goodZToMuMuAtLeast1HLT.TrigTag.processName = hltProcessName
00070     process.goodZToMuMuAtLeast1HLT.triggerEvent.processName = hltProcessName
00071     process.hltTrigReport,HLTriggerResults.processName = hltProcessName
00072   except:
00073     pass
00074 
00075   process.VtxSmeared = cms.EDProducer("FlatEvtVtxGenerator", 
00076     MaxZ = cms.double(0.0),
00077     MaxX = cms.double(0.0),
00078     MaxY = cms.double(0.0),
00079     MinX = cms.double(0.0),
00080     MinY = cms.double(0.0),
00081     MinZ = cms.double(0.0),
00082     TimeOffset = cms.double(0.0),
00083     src = cms.InputTag("generator")
00084   )
00085 
00086   import FWCore.ParameterSet.VarParsing as VarParsing
00087   options = VarParsing.VarParsing ('analysis')
00088   options.register ('mdtau',
00089                     0, # default value
00090                     VarParsing.VarParsing.multiplicity.singleton,
00091                     VarParsing.VarParsing.varType.int,         
00092                     "mdtau value for tauola")
00093 
00094   options.register ('useJson',
00095                     0, # default value, false
00096                     VarParsing.VarParsing.multiplicity.singleton,
00097                     VarParsing.VarParsing.varType.int,         
00098                     "should I enable json usage?")
00099 
00100   options.register ('overrideBeamSpot',
00101                     0, # default value, false
00102                     VarParsing.VarParsing.multiplicity.singleton,
00103                     VarParsing.VarParsing.varType.int,         
00104                     "should I override beamspot in globaltag?")
00105 
00106   # Set this to REDIGI311X for Spring11 MC:
00107   # (not actually used in this step but we define it so that both config files
00108   # can be called with the same arguments):
00109   options.register ('primaryProcess',
00110                     'RECO', # default value
00111                     VarParsing.VarParsing.multiplicity.singleton,
00112                     VarParsing.VarParsing.varType.string,
00113                     "original processName")
00114 
00115   # Workaround so that edmConfigHash does not fail with this config file.
00116   # cf. https://hypernews.cern.ch/HyperNews/CMS/get/crabFeedback/3852/1/1/1/1/1.html
00117   import sys
00118   if hasattr(sys, "argv") == True:
00119     options.parseArguments()
00120 
00121   print "Setting mdtau to ", options.mdtau
00122   process.generator.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau 
00123   process.newSource.ZTauTau.TauolaOptions.InputCards.mdtau = options.mdtau
00124   process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau 
00125   process.newSource.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = options.mdtau 
00126 
00127   print "options.overrideBeamSpot", options.overrideBeamSpot
00128   if options.overrideBeamSpot != 0:
00129     bs = cms.string("BeamSpotObjects_2009_LumiBased_SigmaZ_v18_offline") # 41x data PR gt
00130     #bs = cms.string("BeamSpotObjects_2009_LumiBased_v17_offline") # 38x data gt
00131     #bs = cms.string("BeamSpotObjects_2009_v14_offline") # 36x data gt
00132     #  tag = cms.string("Early10TeVCollision_3p8cm_31X_v1_mc_START"), # 35 default
00133     #  tag = cms.string("Realistic900GeVCollisions_10cm_STARTUP_v1_mc"), # 36 default
00134     process.GlobalTag.toGet = cms.VPSet(
00135       cms.PSet(record = cms.string("BeamSpotObjectsRcd"),
00136            tag = bs,
00137            connect = cms.untracked.string("frontier://FrontierProd/CMS_COND_31X_BEAMSPOT")
00138       )
00139     )
00140     print "BeamSpot in globaltag set to ", bs 
00141   else:
00142     print "BeamSpot in globaltag not changed"
00143 
00144   if options.useJson !=  0:
00145     print "Enabling json usage"
00146     import PhysicsTools.PythonAnalysis.LumiList as LumiList
00147     import FWCore.ParameterSet.Types as CfgTypes
00148     myLumis = LumiList.LumiList(filename = 'my.json').getCMSSWString().split(',')
00149     process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange())
00150     process.source.lumisToProcess.extend(myLumis)
00151 
00152   try:
00153     process.newSource.ZTauTau.minVisibleTransverseMomentum = cms.untracked.double(__MINVISPT__)
00154     process.generator.ZTauTau.minVisibleTransverseMomentum = cms.untracked.double(__MINVISPT__)
00155   except:
00156     pass
00157   try:
00158     process.generator.ZTauTau.TauolaOptions.InputCards.mdtau = __MDTAU__
00159     process.generator.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = __MDTAU__
00160     process.newSource.ZTauTau.TauolaOptions.InputCards.mdtau = __MDTAU__
00161     process.newSource.ParticleGun.ExternalDecays.Tauola.InputCards.mdtau = __MDTAU__
00162   except:
00163     pass
00164 
00165   try:
00166     process.generator.ZTauTau.transformationMode = cms.untracked.int32(__TRANSFORMATIONMODE__)
00167     process.generator.ZTauTau.transformationMode = cms.untracked.int32(__TRANSFORMATIONMODE__)
00168   except:
00169     pass
00170 
00171   return(process)