CMS 3D CMS Logo

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