CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/Validation/EventGenerator/python/genvalidTools.py

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 
00003 #function to switch to an external weight producer for an analyzer in the validation chain
00004 def useExternalWeight(process, analyzerName, vWeightProducerTags):
00005   analyzer = getattr(process,analyzerName)
00006   if analyzer != None:
00007     print "Changing weight in "+analyzerName
00008     analyzer.UseWeightFromHepMC = cms.bool(False)
00009     analyzer.genEventInfos = vWeightProducerTags
00010     setattr(process, analyzerName, analyzer)
00011 
00012 #function to switch to an external weight producer for all analyzers in the validation chain
00013 def useExternalWeightForValidation(process, vWeightProducerTags):
00014   useExternalWeight(process, "basicGenParticleValidation", vWeightProducerTags)
00015   useExternalWeight(process, "mbueAndqcdValidation", vWeightProducerTags)
00016   useExternalWeight(process, "basicHepMCValidation", vWeightProducerTags)
00017   useExternalWeight(process, "drellYanEleValidation", vWeightProducerTags)
00018   useExternalWeight(process, "drellYanMuoValidation", vWeightProducerTags)
00019   useExternalWeight(process, "wMinusEleValidation", vWeightProducerTags)
00020   useExternalWeight(process, "wPlusEleValidation", vWeightProducerTags)
00021   useExternalWeight(process, "wMinusMuoValidation", vWeightProducerTags)
00022   useExternalWeight(process, "wPlusMuoValidation", vWeightProducerTags)
00023   useExternalWeight(process, "tauValidation", vWeightProducerTags)
00024   useExternalWeight(process, "duplicationChecker", vWeightProducerTags)
00025  
00026 #function to switch to an alternative gen source (default is "generator") for an analyzer in the validation chain
00027 def switchGenSource(process, analyzerName, source):
00028   analyzer = getattr(process,analyzerName)
00029   if analyzer != None:
00030     print "Changing inputSource in "+analyzerName
00031     analyzer.hepmcCollection = source
00032     setattr(process, analyzerName, analyzer)
00033 
00034 #function to switch to an alternative gen source (default is "generator") for all analyzers in the validation chain
00035 def switchGenSourceForValidation(process, source):
00036   process.genParticles.src = 'lhe2HepMCConverter'
00037   switchGenSource(process, "basicGenParticleValidation", source)
00038   switchGenSource(process, "mbueAndqcdValidation", source)
00039   switchGenSource(process, "basicHepMCValidation", source)
00040   switchGenSource(process, "drellYanEleValidation", source)
00041   switchGenSource(process, "drellYanMuoValidation", source)
00042   switchGenSource(process, "wMinusEleValidation", source)
00043   switchGenSource(process, "wPlusEleValidation", source)
00044   switchGenSource(process, "wMinusMuoValidation", source)
00045   switchGenSource(process, "wPlusMuoValidation", source)
00046   switchGenSource(process, "tauValidation", source)
00047   switchGenSource(process, "duplicationChecker", source)