1 """! alignment utilities"""
5 """! Put beamspot constraints on all parameters regardless of floating """
6 s =
'\n!Beamspot constraints\n'
7 for d
in [
'u',
'v',
'w']:
8 PEDE.logger.debug(
'd=', d)
10 for iAxial
in range(2):
12 PEDE.logger.debug(
'iAx=', iAxial)
13 for p, name
in utils.paramMap.iteritems():
14 PEDE.logger.debug(
'look at ', name,
' ', p)
15 if utils.getModuleNrFromDeName(name) != 0:
17 if (utils.isAxial(name)
and iAxial == 0)
or (
not utils.isAxial(name)
and iAxial == 1):
19 if utils.getDir(p) == d
and utils.getType(p) == t:
20 PEDE.logger.debug(
'found one', name,
' ', p)
22 PEDE.logger.debug(
'ACTIVATE')
23 s +=
'Constraint 0.\n'
24 s +=
'%s %.1f\n' % (p, 1.0)
27 PEDE.logger.debug(
'ADD')
28 s +=
'%s %.1f\n' % (p, -1.0)
33 """! put beamspot constraints onto floating parameters"""
34 s =
'\n!Beamspot constraints\n'
43 if (
'98' or '99')
in line:
44 parNum = int(line.split()[0])
45 isFloat = float(line.split()[2])
48 if (parNum < 20000
and written1 == 0):
49 s +=
'Constraint 0.\n'
50 s +=
'%s %.1f\n' % (parNum, 1.0)
51 s +=
'%s %.1f\n' % (parNum+10000, -1.0)
52 s +=
'Constraint 0.\n'
53 s +=
'%s %.1f\n' % (parNum+1, 1.0)
54 s +=
'%s %.1f\n' % (parNum+1+10000, -1.0)
64 elif (parNum > 20000
and written1 == 0):
65 s +=
'Constraint 0.\n'
66 s +=
'%s %.1f\n' % (parNum, -1.0)
67 s +=
'%s %.1f\n' % (parNum-10000, 1.0)
68 s +=
'Constraint 0.\n'
69 s +=
'%s %.1f\n' % (parNum+1, -1.0)
70 s +=
'%s %.1f\n' % (parNum+1-10000, 1.0)
83 if (parNum < 20000
and written2 == 0):
84 s +=
'Constraint 0.\n'
85 s +=
'%s %.1f\n' % (parNum, 1.0)
86 s +=
'%s %.1f\n' % (parNum+10000, -1.0)
87 s +=
'Constraint 0.\n'
88 s +=
'%s %.1f\n' % (parNum+1, 1.0)
89 s +=
'%s %.1f\n' % (parNum+1+10000, -1.0)
99 elif (parNum > 20000
and written2 == 0):
100 s +=
'Constraint 0.\n'
101 s +=
'%s %.1f\n' % (parNum, -1.0)
102 s +=
'%s %.1f\n' % (parNum-10000, 1.0)
103 s +=
'Constraint 0.\n'
104 s +=
'%s %.1f\n' % (parNum+1, -1.0)
105 s +=
'%s %.1f\n' % (parNum+1-10000, 1.0)
118 if (parNum < 20000
and written3 == 0):
119 s +=
'Constraint 0.\n'
120 s +=
'%s %.1f\n' % (parNum, 1.0)
121 s +=
'%s %.1f\n' % (parNum+10000, -1.0)
122 s +=
'Constraint 0.\n'
123 s +=
'%s %.1f\n' % (parNum+1, 1.0)
124 s +=
'%s %.1f\n' % (parNum+1+10000, -1.0)
134 elif (parNum > 20000
and written3 == 0):
135 s +=
'Constraint 0.\n'
136 s +=
'%s %.1f\n' % (parNum, -1.0)
137 s +=
'%s %.1f\n' % (parNum-10000, 1.0)
138 s +=
'Constraint 0.\n'
139 s +=
'%s %.1f\n' % (parNum+1, -1.0)
140 s +=
'%s %.1f\n' % (parNum+1-10000, 1.0)
152 if (parNum < 20000
and written4 == 0):
153 s +=
'Constraint 0.\n'
154 s +=
'%s %.1f\n' % (parNum, 1.0)
155 s +=
'%s %.1f\n' % (parNum+10000, -1.0)
156 s +=
'Constraint 0.\n'
157 s +=
'%s %.1f\n' % (parNum+1, 1.0)
158 s +=
'%s %.1f\n' % (parNum+1+10000, -1.0)
168 elif (parNum > 20000
and written4 == 0):
169 s +=
'Constraint 0.\n'
170 s +=
'%s %.1f\n' % (parNum, -1.0)
171 s +=
'%s %.1f\n' % (parNum-10000, 1.0)
172 s +=
'Constraint 0.\n'
173 s +=
'%s %.1f\n' % (parNum+1, -1.0)
174 s +=
'%s %.1f\n' % (parNum+1-10000, 1.0)
187 if (parNum < 20000
and written5 == 0):
188 s +=
'Constraint 0.\n'
189 s +=
'%s %.1f\n' % (parNum, 1.0)
190 s +=
'%s %.1f\n' % (parNum+10000, -1.0)
191 s +=
'Constraint 0.\n'
192 s +=
'%s %.1f\n' % (parNum+1, 1.0)
193 s +=
'%s %.1f\n' % (parNum+1+10000, -1.0)
203 elif (parNum > 20000
and written5 == 0):
204 s +=
'Constraint 0.\n'
205 s +=
'%s %.1f\n' % (parNum, -1.0)
206 s +=
'%s %.1f\n' % (parNum-10000, 1.0)
207 s +=
'Constraint 0.\n'
208 s +=
'%s %.1f\n' % (parNum+1, -1.0)
209 s +=
'%s %.1f\n' % (parNum+1-10000, 1.0)
222 if (parNum < 20000
and written6 == 0):
223 s +=
'Constraint 0.\n'
224 s +=
'%s %.1f\n' % (parNum, 1.0)
225 s +=
'%s %.1f\n' % (parNum+10000, -1.0)
226 s +=
'Constraint 0.\n'
227 s +=
'%s %.1f\n' % (parNum+1, 1.0)
228 s +=
'%s %.1f\n' % (parNum+1+10000, -1.0)
238 elif (parNum > 20000
and written6 == 0):
239 s +=
'Constraint 0.\n'
240 s +=
'%s %.1f\n' % (parNum, -1.0)
241 s +=
'%s %.1f\n' % (parNum-10000, 1.0)
242 s +=
'Constraint 0.\n'
243 s +=
'%s %.1f\n' % (parNum+1, -1.0)
244 s +=
'%s %.1f\n' % (parNum+1-10000, -1.0)
def getBeamspotConstraints(parMap)
Put beamspot constraints on all parameters regardless of floating.
def getBeamspotConstraintsFloatingOnly(pars)
put beamspot constraints onto floating parameters