18def egammaCluster (egamma, allSamplings = False, fwdEVars = False):
19 ClusterAssoc = SimpleAssociation \
20 (egamma,
22 ClusterAssoc.defineBlock \
24 prefix = 'cl_',
25 WriteE = True,
26 WriteM = False)
27 ClusterAssoc.defineBlock (
28 2, 'ClusterTime',
30 Vars = ['time'],
31 prefix = 'cl_')
32
33 ClusterAssoc.defineBlock \
34 (2, 'PositionInCalo',
35
37 prefix = 'cl_')
38 ClusterAssoc.defineBlock \
39 (2, 'Position0InCalo',
40
42 prefix = 'cl_',
43 FillSeedCoordinates=True)
44 ClusterAssoc.defineBlock \
45 (2, 'Samplings',
46
48
49 if allSamplings:
50 ClusterAssoc.defineBlock \
51 (2, 'AllSamplings',
52
54 EmHadEnergies = False,
55 SamplingEnergies = True)
56 if fwdEVars:
57 ClusterAssoc.defineBlock (
58 1, 'FwdEVars',
60 Vars = ['firstEdens = FIRST_ENG_DENS < float: 0',
61 'cellmaxfrac = ENG_FRAC_MAX < float: 0',
62 'longitudinal = LONGITUDINAL < float: 0',
63 'secondlambda = SECOND_LAMBDA < float: 0',
64 'lateral = LATERAL < float: 0',
65 'secondR = SECOND_R < float: 0',
66 'centerlambda = CENTER_LAMBDA < float: 0',
67 ])
68
69
70
71 Cells = ContainedVectorMultiAssociation (
72 ClusterAssoc,
73
75 "cell_",
76 99,
77 blockname = 'ClusterCells')
78 Cells.defineBlock (4, 'CellKinematics',
80 WriteE = True, WriteM = False)
81 Cells.defineBlock (4, 'CellRawPosition',
82
84 Cells.defineBlock (5, 'CellDetail1',
85
87 SaveCellQuality=True,
88 SaveTimeInfo=True,
89 SaveDetInfo=True,
90 SaveCellGain=True,
91 SaveBadCellStatus=False,
92 SaveId =False,
93 SavePositionInfo=False,
94 )
95 cellDetail2 = \
96 Cells.defineBlock (6, 'CellDetail2',
97
99 SaveCellQuality=False,
100 SaveTimeInfo=False,
101 SaveDetInfo=False,
102 SaveCellGain=False,
103 SaveBadCellStatus=True,
104 SaveId =True,
105 SavePositionInfo=True,
106 )
107 def _cellDetail2Hook (c, flags, acc, *args, **kw):
108 from CaloBadChannelTool.CaloBadChanToolConfig import CaloBadChanToolCfg
109 c.BadChannelTool = acc.popToolsAndMerge (CaloBadChanToolCfg (flags))
110 return
111 cellDetail2.defineHook (_cellDetail2Hook)
112
113 return ClusterAssoc