1
2
3
4
5
6
7 import logging,sys,os
8 logger = logging.getLogger('py3')
9
10
11 logger.info("loading icecube.icetray")
12 try:
13 import icecube.icetray as icetray
14 from icecube.icetray import *
15 except:
16 logger.warn("icecube.icetray not found")
17 logger.info("loading icetray")
18 try:
19 import icetray
20 from icetray import *
21 except:
22 logger.warn("icetray not found")
23 logger.info("loading ithon")
24 try:
25 import ithon as icetray
26 from ithon import *
27 except:
28 logger.warn("ithon not found")
29 logger.info("loading libithon")
30 try:
31 import libithon as icetray
32 from libithon import *
33 except:
34 logger.fatal("!!!!Could not load icetray environment!!! Aborting.")
35 sys.exit(2)
36
37
38
39 NaN = float('NaN')
40 Inf = float('inf')
41
43 try:
44 icetray.load(filename)
45 except:
46 print """\n***\n*** Failed to load library. (%s)\n*** %s\n***\n""" % (sys.exc_info()[0], sys.exc_info()[1])
47 sys.exit(1)
48
50 return icetray.OMKey(string,omnum)
51
54 self.last_added = None
55 self.the_tray = icetray.I3Tray()
56
61
66
70
72 if len(args) == 4:
73 self.the_tray.ConnectBoxes(args[0], args[1], args[2], args[3])
74 elif len(args) == 3:
75 self.the_tray.ConnectBoxes(args[0], args[1], args[2])
76 else:
77 print 'Wrong number of arguments', len(args), 'to ConnectBoxes'
78
80 for pair in args:
81 print self.last_added +': ', pair[0], '=', pair[1]
82 self.the_tray.SetParameter(self.last_added, pair[0], pair[1])
83 return self
84
86 if len(args) == 2:
87 args[0].the_tray.Execute(args[1])
88 else:
89 args[0].the_tray.Execute()
90
92 return self.the_tray.Usage()
93
96
97
98
100 """
101 Parse I3Units
102 @param pvalue: parameter (double)
103 @param punit: optional parameter I3Unit (string)
104 """
105 if punit and globals().has_key(punit):
106 return globals()[punit](pvalue)
107 elif not punit == None and not punit == 'None':
108 try:
109 return pvalue * eval("I3Units.%s" % punit)
110 except:
111 logger.error('Cannot parse unit "%s"' % punit)
112 return pvalue
113 else:
114 return pvalue
115