CMS 3D CMS Logo

genvalidTools.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 #function to switch to an external weight producer for an analyzer in the validation chain
4 def useExternalWeight(process, analyzerName, vWeightProducerTags):
5  analyzer = getattr(process,analyzerName)
6  if analyzer != None:
7  print "Changing weight in "+analyzerName
8  analyzer.UseWeightFromHepMC = cms.bool(False)
9  analyzer.genEventInfos = vWeightProducerTags
10  setattr(process, analyzerName, analyzer)
11 
12 #function to switch to an external weight producer for all analyzers in the validation chain
13 def useExternalWeightForValidation(process, vWeightProducerTags):
14  useExternalWeight(process, "basicGenParticleValidation", vWeightProducerTags)
15  useExternalWeight(process, "mbueAndqcdValidation", vWeightProducerTags)
16  useExternalWeight(process, "basicHepMCValidation", vWeightProducerTags)
17  useExternalWeight(process, "drellYanEleValidation", vWeightProducerTags)
18  useExternalWeight(process, "drellYanMuoValidation", vWeightProducerTags)
19  useExternalWeight(process, "wMinusEleValidation", vWeightProducerTags)
20  useExternalWeight(process, "wPlusEleValidation", vWeightProducerTags)
21  useExternalWeight(process, "wMinusMuoValidation", vWeightProducerTags)
22  useExternalWeight(process, "wPlusMuoValidation", vWeightProducerTags)
23  useExternalWeight(process, "tauValidation", vWeightProducerTags)
24  useExternalWeight(process, "duplicationChecker", vWeightProducerTags)
25 
26 #function to switch to an alternative gen source (default is "generator") for an analyzer in the validation chain
27 def switchGenSource(process, analyzerName, source):
28  analyzer = getattr(process,analyzerName)
29  if analyzer != None:
30  print "Changing inputSource in "+analyzerName
31  analyzer.hepmcCollection = source
32  setattr(process, analyzerName, analyzer)
33 
34 #function to switch to an alternative gen source (default is "generator") for all analyzers in the validation chain
35 def switchGenSourceForValidation(process, source):
36  process.genParticles.src = 'lhe2HepMCConverter'
37  switchGenSource(process, "basicGenParticleValidation", source)
38  switchGenSource(process, "mbueAndqcdValidation", source)
39  switchGenSource(process, "basicHepMCValidation", source)
40  switchGenSource(process, "drellYanEleValidation", source)
41  switchGenSource(process, "drellYanMuoValidation", source)
42  switchGenSource(process, "wMinusEleValidation", source)
43  switchGenSource(process, "wPlusEleValidation", source)
44  switchGenSource(process, "wMinusMuoValidation", source)
45  switchGenSource(process, "wPlusMuoValidation", source)
46  switchGenSource(process, "tauValidation", source)
47  switchGenSource(process, "duplicationChecker", source)
def useExternalWeight(process, analyzerName, vWeightProducerTags)
Definition: genvalidTools.py:4
def useExternalWeightForValidation(process, vWeightProducerTags)
def switchGenSource(process, analyzerName, source)
def switchGenSourceForValidation(process, source)