CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ttFullHadEvtBuilder_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 #
4 # produce ttFullHadEvent structure with all necessary ingredients,
5 # needs ttGenEvent as input
6 #
7 
8 ## std sequence to produce the ttFullHadEventHypotheses
10 
11 ## configure ttFullHadEventBuilder
13 
14 ### make ttFullHadEvent
15 makeTtFullHadEventTask = cms.Task(
16  makeTtFullHadHypothesesTask,
17  ttFullHadEvent
18 )
19 #makeTtFullHadEvent = cms.Sequence(makeTtFullHadEventTask)
20 
21 ################################################################################
22 ## helper functions
23 ## (examples of usage can be found in the ttFullHadEvtBuilder_cfg.py)
24 ################################################################################
25 
26 ## add hypotheses to the process
27 def addTtFullHadHypotheses(process,
28  names
29  ):
30 
31  ## edit list of input hypotheses for the TtFullHadEventBuilder
32  labels = getattr(process.ttFullHadEvent, "hypotheses")
33  for obj in range(len(names)):
34  ## create correct label from HypoClassKey string (stripping the leading "k")
35  ## e.g. kKinFit -> ttFullHadHypKinFit
36  label = "ttFullHadHyp" + names[obj][1:]
37  ## add it to the list
38  labels.append(label)
39  process.ttFullHadEvent.hypotheses = labels
40 
41  ### include hypotheses in the standard sequence
42  #sequence = getattr(process, "makeTtFullHadHypotheses")
43  #for obj in range(len(names)):
44  ### create correct label from HypoClassKey string (stripping the leading "k")
45  ### e.g. kKinFit -> makeHypothesis_kinFit
46  #if names[obj][1:4] == "MVA":
47  #label = "makeHypothesis_" + names[obj][1:4].lower() + names[obj][4:]
48  #else:
49  #label = "makeHypothesis_" + names[obj][1:2].lower() + names[obj][2:]
50  ### add it to the sequence
51  #sequence += getattr(process, label)
52 
53 
54 ## remove genMatch hypothesis from the process
56  #process.makeTtFullHadHypotheses.remove(process.makeHypothesis_genMatch)
57  process.ttFullHadEvent.hypotheses.remove("ttFullHadHypGenMatch")
58 
59 
60 ## set a specific attribute for all hypotheses to a given value
61 ## -> this works for "jets", "maxNJets", "jetCorrectionLevel"
62 def setForAllTtFullHadHypotheses(process, attribute, value):
63  modules = ["ttFullHadJetPartonMatch",
64  "ttFullHadHypGenMatch",
65  "kinFitTtFullHadEventHypothesis",
66  "ttFullHadHypKinFit"]
67  for obj in range(len(modules)):
68  object = getattr(process, modules[obj])
69  if hasattr(object, attribute):
70  setattr(object, attribute, value)
def setForAllTtFullHadHypotheses
set a specific attribute for all hypotheses to a given value -> this works for "jets", "maxNJets", "jetCorrectionLevel"
const uint16_t range(const Frame &aFrame)
std sequence to produce the ttFullHadEventHypotheses
def addTtFullHadHypotheses
helper functions (examples of usage can be found in the ttFullHadEvtBuilder_cfg.py) ...
configure ttFullHadEventBuilder
def removeTtFullHadHypGenMatch
remove genMatch hypothesis from the process