def __init__(self, iEv): super(PapasEvent, self).__init__(iEv) Identifier.reset() self.collections = dict() self.history = dict()
def test_1(self): Identifier.reset() event = Event(distance) sim = Simulator(event) event = sim.event pfblocker = PFBlockBuilder(event, event.history.keys(), distance) event.blocks = pfblocker.blocks #event.history = pfblocker.history ##test block splitting #blockids = [] #unlink=[] #for b in event.blocks.itervalues(): #ids=b.element_uniqueids #if len(ids)==3 : #print ids[0], ids[2] #unlink.append(b.edges[Edge.make_key(ids[0], ids[2])]) #unlink.append(b.edges[Edge.make_key(ids[0], ids[1])]) #print unlink #splitter=BlockSplitter(b,unlink,event.history) #print splitter.blocks #blocksplitter=BlockSplitter() rec = Reconstructor(event) # What is connected to HCAL 202 node? # (1) via history_nodes # (2) via reconstructed node links # (3) Give me all blocks with one track: # (4) Give me all simulation particles attached to each reconstructed particle nodeid = 202 nodeuid = sim.UID(nodeid) #(1) what is connected to the the HCAL CLUSTER ids = [] BFS = BreadthFirstSearchIterative(event.history[nodeuid], "undirected") for n in BFS.result: ids.append(n.get_value()) #1b WHAT BLOCK Does it belong to x = None for uid in ids: if Identifier.is_block( uid) and event.blocks[uid].short_info() == "E1H1T1": x = event.blocks[uid] #1c #check that the block contains the expected list of suspects pids = [] for n in x.element_uniqueids: pids.append(n) ids = sorted(pids) expected_ids = sorted( [sim.UID(2), sim.UID(102), sim.UID(202), sim.UID(302)]) self.assertEqual(ids, expected_ids) #(2) use edge nodes to see what is connected ids = [] BFS = BreadthFirstSearchIterative(pfblocker.nodes[nodeuid], "undirected") for n in BFS.result: ids.append(n.get_value()) expected_ids = sorted( [sim.UID(2), sim.UID(102), sim.UID(202), sim.UID(302)]) self.assertEqual(sorted(ids), expected_ids) #(3) Give me all simulation particles attached to each reconstructed particle for rp in event.reconstructed_particles: ids = [] BFS = BreadthFirstSearchIterative(event.history[rp], "parents") for n in BFS.result: z = n.get_value()
def test_1(self): Identifier.reset() event = Event(distance) sim = Simulator(event) event=sim.event pfblocker = PFBlockBuilder(event, event.history.keys(), distance) event.blocks = pfblocker.blocks #event.history = pfblocker.history ##test block splitting #blockids = [] #unlink=[] #for b in event.blocks.itervalues(): #ids=b.element_uniqueids #if len(ids)==3 : #print ids[0], ids[2] #unlink.append(b.edges[Edge.make_key(ids[0], ids[2])]) #unlink.append(b.edges[Edge.make_key(ids[0], ids[1])]) #print unlink #splitter=BlockSplitter(b,unlink,event.history) #print splitter.blocks #blocksplitter=BlockSplitter() rec = Reconstructor(event) # What is connected to HCAL 202 node? # (1) via history_nodes # (2) via reconstructed node links # (3) Give me all blocks with one track: # (4) Give me all simulation particles attached to each reconstructed particle nodeid = 202 nodeuid = sim.UID(nodeid) #(1) what is connected to the the HCAL CLUSTER ids = [] BFS = BreadthFirstSearchIterative(event.history[nodeuid],"undirected") for n in BFS.result : ids.append(n.get_value()) #1b WHAT BLOCK Does it belong to x = None for uid in ids: if Identifier.is_block(uid) and event.blocks[uid].short_info()== "E1H1T1": x = event.blocks[uid] #1c #check that the block contains the expected list of suspects pids = [] for n in x.element_uniqueids: pids.append(n) ids = sorted(pids) expected_ids = sorted([sim.UID(2), sim.UID(102),sim.UID(202), sim.UID(302)]) self.assertEqual(ids,expected_ids ) #(2) use edge nodes to see what is connected ids = [] BFS = BreadthFirstSearchIterative(pfblocker.nodes[nodeuid],"undirected") for n in BFS.result : ids.append(n.get_value()) expected_ids = sorted([sim.UID(2), sim.UID(102),sim.UID(202),sim.UID(302)]) self.assertEqual(sorted(ids), expected_ids) #(3) Give me all simulation particles attached to each reconstructed particle for rp in event.reconstructed_particles : ids=[] BFS = BreadthFirstSearchIterative(event.history[rp],"parents") for n in BFS.result : z=n.get_value()