CMS 3D CMS Logo

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