-
Notifications
You must be signed in to change notification settings - Fork 9
/
BargerPropagator.py
123 lines (84 loc) · 3.7 KB
/
BargerPropagator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#
# This is a simple interface to the BargerPropagator class
# There is no fanciness, and blatant disregard for the
# use of default arguments on the C++ side
#
import ctypes as c
lib = c.cdll.LoadLibrary('libThreeProb.so')
#lib = c.cdll.LoadLibrary('/disk/usr3/raw/Development/atmpd-trunk/src/analysis/Prob3++/libThreeProb.so')
# constructor (This returns a pointer. This is necessary for 64 bit machines.
# The default return type is a 32 bin integer.)
lib.propagator_new.restype = c.c_void_p
# set_mns
lib.set_mns.argtypes = [c.c_void_p,
c.c_double, c.c_double , c.c_double , c.c_double ,
c.c_double, c.c_double , c.c_double ,
c.c_bool , c.c_int
]
# propagate
lib.propagate.argtypes = [c.c_void_p, c.c_int ]
# propagate_linear
lib.propagate_linear.argtypes = [c.c_void_p, c.c_int , c.c_double , c.c_double ]
# get_prob
lib.get_prob.restype = c.c_double
lib.get_prob.argtypes = [c.c_void_p , c.c_int , c.c_int ]
# define_path
lib.define_path.argtypes = [c.c_void_p , c.c_double , c.c_double , c.c_bool ]
# use_mass_eigenstates
lib.use_mass_eigenstates.argtypes = [c.c_void_p , c.c_bool ]
# set_warning_suppression
lib.set_warning_suppression.argtypes = [c.c_void_p , c.c_bool ]
# set_one_mass_scale_mode
lib.set_one_mass_scale_mode.argtypes = [c.c_void_p , c.c_bool ]
# set_density_conversion
lib.set_density_conversion.argtypes = [c.c_void_p , c.c_double ]
# get_path_length
lib.get_path_length.restype = c.c_double
lib.get_path_length.argtypes = [c.c_void_p ]
# set_path_length
lib.set_path_length.argtypes = [c.c_void_p, c.c_double ]
# set_energy
lib.set_energy.argtypes = [c.c_void_p, c.c_double ]
# set_air_path_length
lib.set_air_path_length.argtypes = [c.c_void_p, c.c_double ]
# get_vacuum_prob
lib.get_vacuum_prob.restype = c.c_double
lib.get_vacuum_prob.argtypes = [c.c_void_p , c.c_int , c.c_int , c.c_double, c.c_double ]
# set_default_octant
lib.set_default_octant.argtypes = [c.c_void_p, c.c_int , c.c_int ]
class BargerPropagator(object):
def __init__(self):
self.obj = lib.propagator_new()
def SetMNS(self, x12, x13, x23, m21, mAtm, delta, energy, ks, nutype):
lib.set_mns( self.obj, x12, x13, x23, m21, mAtm, delta, energy, ks, nutype )
def DefinePath ( self , cz, ProdHeight, kSetProfile ):
lib.define_path ( self.obj , cz, ProdHeight, kSetProfile )
def propagate( self, nu ):
lib.propagate( self.obj , nu )
def propagateLinear( self, nu, path, density ):
lib.propagate_linear( self.obj , nu , path, density )
def GetProb( self , nuIn, nuOut ):
return lib.get_prob( self.obj , nuIn, nuOut )
def UseMassEigenstates( self, x ):
lib.use_mass_eigenstates(self.obj , x )
def SetWarningSuppression( self, x ):
lib.set_warning_suppression(self.obj , x )
def SetOneMassScaleMode( self, x ):
lib.set_one_mass_scale_mode(self.obj, x )
def SetDensityConversion( self, x):
lib.set_density_conversion( self.obj , x )
# The following functions are for expert use
# please be careful and check BargerPropagator.h
# for more information
def GetPathLength( self ):
return lib.get_path_length( self.obj )
def SetPathLength( self, x ):
lib.set_path_length( self.obj , x )
def SetEnergy( self, x ):
lib.set_energy( self.obj , x )
def SetAirPathLength( self, x ):
lib.set_air_path_length( self.obj , x )
def GetVacuumProb( self, nuin, nuout, energy , path ):
return lib.get_vacuum_prob( self.obj, nuin, nuout, energy, path )
def SetDefaultOctant( self, x , y ):
lib.set_default_octant( self.obj , x , y)