def make_and_store_track(self, ptc): '''creates a new track, adds it into the true_tracks collection and updates the history information''' track = Track(ptc.p3(), ptc.q(), ptc.path, index=len(self.true_tracks)) pdebugger.info(" ".join(("Made", track.__str__()))) self.true_tracks[track.uniqueid] = track self.update_history(ptc.uniqueid, track.uniqueid) ptc.set_track(track) return track
def test_layerfan(self): c1 = Cluster(10, TVector3(1, 0, 0), 1., 'ecal_in') c2 = Cluster(20, TVector3(1, 0, 0), 1., 'hcal_in') p3 = c1.position.Unit()*100. p4 = TLorentzVector() p4.SetVectM(p3, 1.) path = StraightLine(p4, TVector3(0,0,0)) charge = 1. tr = Track(p3, charge, path) tr.path.points['ecal_in'] = c1.position tr.path.points['hcal_in'] = c2.position elems = [c1, c2, tr] for ele in elems: link_type, link_ok, distance = ruler(ele, ele) if ele!=tr: self.assertTrue(link_ok) elif ele==tr: self.assertFalse(link_ok) #ecal hcal no longer linked to match c++ so have adjusted test accordingly link_type, link_ok, distance = ruler(c2, c1) self.assertFalse(link_ok) self.assertEqual(link_type, None) link_type, link_ok, distance = ruler(tr, c1) self.assertTrue(link_ok) link_type, link_ok, distance = ruler(tr, c2) self.assertTrue(link_ok)