Project

General

Profile

Bug #1832 » test_tof_sp.py

Rogers, Chris, 16 March 2016 09:32

 
1
import unittest
2
import ROOT 
3
import libMausCpp
4

    
5
class TestMapCppGlobalTrackFit(unittest.TestCase):
6

    
7
    def test_tof_space_points(self):
8
        space_point_list = []
9
        print "Setting tof space points"
10
        for station, z in enumerate([4000., 12000., 22000.]):
11
            tof_sp = ROOT.MAUS.TOFSpacePoint()
12
            tof_sp.SetStation(station)
13
            tof_sp.SetGlobalPosX(z*0.01)
14
            tof_sp.SetGlobalPosY(z*0.02)
15
            tof_sp.SetGlobalPosZ(z)
16
            tof_sp.SetTime(z*0.001)
17
            space_point_list.append(tof_sp)
18
            print "     ", tof_sp, tof_sp.GetTime(), tof_sp.GetGlobalPosX(), tof_sp.GetGlobalPosY(), tof_sp.GetGlobalPosZ()
19
        tof_space_point = ROOT.MAUS.TOFEventSpacePoint()
20

    
21
        sp_array = tof_space_point.GetTOF0SpacePointArray()
22
        sp_array.push_back(space_point_list[0])
23
        tof_space_point.SetTOF0SpacePointArray(sp_array)
24

    
25
        sp_array = tof_space_point.GetTOF1SpacePointArray()
26
        sp_array.push_back(space_point_list[1])
27
        tof_space_point.SetTOF1SpacePointArray(sp_array)
28

    
29
        sp_array = tof_space_point.GetTOF2SpacePointArray()
30
        sp_array.push_back(space_point_list[2])
31
        tof_space_point.SetTOF2SpacePointArray(sp_array)
32

    
33
        print "Getting tof space points - first"
34
        tof_ev_sp = tof_space_point
35
        tof0 = tof_space_point.GetTOF0SpacePointArray()[0]
36
        print "     ", tof0, tof0.GetTime(), tof0.GetGlobalPosX(), tof0.GetGlobalPosY(), tof0.GetGlobalPosZ()
37
        tof1 = tof_space_point.GetTOF1SpacePointArray()[0]
38
        print "     ", tof1, tof1.GetTime(), tof1.GetGlobalPosX(), tof1.GetGlobalPosY(), tof1.GetGlobalPosZ()
39
        tof2 = tof_space_point.GetTOF2SpacePointArray()[0]
40
        print "     ", tof2, tof2.GetTime(), tof2.GetGlobalPosX(), tof2.GetGlobalPosY(), tof2.GetGlobalPosZ()
41
        print "Getting tof space points - second"
42
        print "     ", tof0, tof0.GetTime(), tof0.GetGlobalPosX(), tof0.GetGlobalPosY(), tof0.GetGlobalPosZ()
43
        print "Getting tof space points - third"
44
        for j, tof_sp in enumerate([tof0, tof1, tof2]):
45
            print "     ", tof_sp, tof_sp.GetTime(), tof_sp.GetGlobalPosX(), tof_sp.GetGlobalPosY(), tof_sp.GetGlobalPosZ()
46

    
47
if __name__ == "__main__":
48
    unittest.main()
49
    raw_input()
50

    
(2-2/5)