1 import FWCore.ParameterSet.Config
as cms
2 def OVar(valtype, compression=None, doc=None, mcOnly=False,precision=-1):
3 """ Create a PSet for a variable in the tree (without specifying how it is computed)
5 valtype is the type of the value (float, int, bool, or a string that the table producer understands),
6 compression is not currently used,
7 doc is a docstring, that will be passed to the table producer,
8 mcOnly can be set to True for variables that exist only in MC samples and not in data ones.
10 if valtype == float: valtype =
"float"
11 elif valtype == int: valtype =
"int"
12 elif valtype == bool: valtype =
"bool"
14 type = cms.string(valtype),
15 compression = cms.string(compression
if compression
else "none"),
16 doc = cms.string(doc
if doc
else expr),
17 mcOnly = cms.bool(mcOnly),
18 precision=cms.string(precision)
if type(precision)==str
else cms.int32(precision)
20 def Var(expr, valtype, compression=None, doc=None, mcOnly=False,precision=-1):
21 """Create a PSet for a variable computed with the string parser
23 expr is the expression to evaluate to compute the variable
24 (in case of bools, it's a cut and not a function)
26 see OVar above for all the other arguments
28 return OVar(valtype, compression=compression, doc=(doc
if doc
else expr), mcOnly=mcOnly,precision=precision).
clone(
29 expr = cms.string(expr))
31 def ExtVar(tag, valtype, compression=None, doc=None, mcOnly=False,precision=-1):
32 """Create a PSet for a variable read from the event
34 tag is the InputTag to the variable.
36 see OVar in common_cff for all the other arguments
38 return OVar(valtype, compression=compression,precision=precision, doc=(doc
if doc
else tag.encode()), mcOnly=mcOnly).
clone(
39 src = tag
if isinstance(tag, cms.InputTag)
else cms.InputTag(tag),
44 pt =
Var(
"pt", float, precision=-1),
45 phi =
Var(
"phi", float, precision=12),
47 P3Vars = cms.PSet(PTVars,
48 eta =
Var(
"eta", float,precision=12),
50 P4Vars = cms.PSet(P3Vars,
51 mass =
Var(
"mass", float,precision=10),
53 CandVars = cms.PSet(P4Vars,
54 pdgId =
Var(
"pdgId", int, doc=
"PDG code assigned by the event reconstruction (not by MC truth)"),
55 charge =
Var(
"charge", int, doc=
"electric charge"),
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)