CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/TopQuarkAnalysis/TopEventProducers/python/sequences/ttFullHadEvtBuilder_cff.py

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 
00003 #
00004 # produce ttFullHadEvent structure with all necessary ingredients,
00005 # needs ttGenEvent as input
00006 #
00007 
00008 ## std sequence to produce the ttFullHadEventHypotheses
00009 from TopQuarkAnalysis.TopEventProducers.sequences.ttFullHadEvtHypotheses_cff import *
00010 
00011 ## configure ttFullHadEventBuilder
00012 from TopQuarkAnalysis.TopEventProducers.producers.TtFullHadEvtBuilder_cfi import *
00013 
00014 ## make ttFullHadEvent
00015 makeTtFullHadEvent = cms.Sequence(makeTtFullHadHypotheses *
00016                                   ttFullHadEvent
00017                                   )
00018 
00019 
00020 ################################################################################
00021 ## helper functions
00022 ## (examples of usage can be found in the ttFullHadEvtBuilder_cfg.py)
00023 ################################################################################
00024 
00025 ## add hypotheses to the process
00026 def addTtFullHadHypotheses(process,
00027                            names
00028                            ):
00029 
00030     ## edit list of input hypotheses for the TtFullHadEventBuilder
00031     labels =  getattr(process.ttFullHadEvent, "hypotheses")
00032     for obj in range(len(names)):
00033         ## create correct label from HypoClassKey string (stripping the leading "k")
00034         ## e.g. kKinFit -> ttFullHadHypKinFit
00035         label = "ttFullHadHyp" + names[obj][1:]
00036         ## add it to the list
00037         labels.append(label)
00038     process.ttFullHadEvent.hypotheses = labels
00039 
00040     ## include hypotheses in the standard sequence
00041     sequence = getattr(process, "makeTtFullHadHypotheses")
00042     for obj in range(len(names)):
00043         ## create correct label from HypoClassKey string (stripping the leading "k")
00044         ## e.g. kKinFit -> makeHypothesis_kinFit
00045         if names[obj][1:4] == "MVA":
00046             label = "makeHypothesis_" + names[obj][1:4].lower() + names[obj][4:]
00047         else:
00048             label = "makeHypothesis_" + names[obj][1:2].lower() + names[obj][2:]
00049         ## add it to the sequence
00050         sequence += getattr(process, label)
00051 
00052 
00053 ## remove genMatch hypothesis from the process
00054 def removeTtFullHadHypGenMatch(process):
00055     process.makeTtFullHadHypotheses.remove(process.makeHypothesis_genMatch)
00056     process.ttFullHadEvent.hypotheses.remove("ttFullHadHypGenMatch")
00057 
00058 
00059 ## set a specific attribute for all hypotheses to a given value
00060 ## -> this works for "jets", "maxNJets", "jetCorrectionLevel"
00061 def setForAllTtFullHadHypotheses(process, attribute, value):
00062     modules = ["ttFullHadJetPartonMatch",
00063                "ttFullHadHypGenMatch",
00064                "kinFitTtFullHadEventHypothesis",
00065                "ttFullHadHypKinFit"]
00066     for obj in range(len(modules)):
00067         object = getattr(process, modules[obj])
00068         if hasattr(object, attribute):
00069             setattr(object, attribute, value)