33def make_clusters (mgr, ccc, hashes, ctx):
34 clc = ROOT.xAOD.CaloClusterContainer()
35 clc_store = ROOT.xAOD.CaloClusterAuxContainer()
36 clc.setStore (clc_store)
37 cellLinks = ROOT.CaloClusterCellLinkContainer()
38 ids = ROOT.vector(ROOT.IdentifierHash)()
39
40 for i in range(2):
41 cl = ROOT.xAOD.CaloCluster()
42 clc.push_back (cl)
43 ROOT.SetOwnership (cl, False)
44 eta = 0.5 - i
45 phi = 1
46 cl.setEta (eta)
47 cl.setPhi (phi)
48 cl.setClusterSize (ROOT.xAOD.CaloCluster.SW_37ele)
49 links = ROOT.CaloClusterCellLink (ccc)
50 cl.addCellLink (links)
51 ROOT.SetOwnership (links, False)
52
53 mgr.cellsInZone (eta - 0.05, eta + 0.05, phi - 0.05, phi + 0.05, ids)
54 for hash in ids:
55 elt = mgr.get_element (hash)
56 s = elt.getSampling()
57 if s == 0 or s == 2:
58 idx = ccc.findIndex (hash)
59 if idx < 0:
60 print ("??? Can't find cell with hash ", hash)
61 else:
62 hashes.add (hash.value())
63 cl.addCell (idx, 1)
64 cl.setLink(cellLinks, ctx)
65
66 return (clc, clc_store, cellLinks)
67
68