Belle II Software development
CDCLayerConstraints Class Reference
Inheritance diagram for CDCLayerConstraints:
Constraints

Public Member Functions

 __init__ (self, filename='cdc-constraints.txt', rigid=True, twist=True, z_offset=False, r_scale=False, z_scale=False)
 
 generate (self)
 
 configure_collector (self, collector)
 

Public Attributes

 rigid = rigid
 6D CDC constraints
 
 twist = twist
 CDC twist constraint.
 
 z_offset = z_offset
 Constraint for z-offset.
 
 r_scale = r_scale
 Constraint for r-scale.
 
 z_scale = z_scale
 Constraint for z-scale.
 
 filename = filename
 File name.
 

Static Public Attributes

list cdc
 CDC geometry hard-code -> TODO.
 
list parameter
 layer parameters
 

Detailed Description

Various constraints for CDC layers

(Code from Claus Kleinwort)

Definition at line 173 of file constraints.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
filename = 'cdc-constraints.txt',
rigid = True,
twist = True,
z_offset = False,
r_scale = False,
z_scale = False )
filename : str
  Filename with constraints (probably generated later)
rigid : bool
  5D CDC constraints: x+y+rot + dx+dy
twist : bool
  CDC twist constraint: drot
z_offset : bool
  Constraint for Z-offset
r_scale : bool
  Constraint for R-scale
z_scale : bool
  Constraint for Z-scale

Definition at line 195 of file constraints.py.

195 def __init__(self, filename='cdc-constraints.txt', rigid=True, twist=True, z_offset=False, r_scale=False, z_scale=False):
196 """
197 filename : str
198 Filename with constraints (probably generated later)
199 rigid : bool
200 5D CDC constraints: x+y+rot + dx+dy
201 twist : bool
202 CDC twist constraint: drot
203 z_offset : bool
204 Constraint for Z-offset
205 r_scale : bool
206 Constraint for R-scale
207 z_scale : bool
208 Constraint for Z-scale
209 """
210 super().__init__(filename)
211
212 self.rigid = rigid
213
214 self.twist = twist
215
216 self.z_offset = z_offset
217
218 self.r_scale = r_scale
219
220 self.z_scale = z_scale
221

Member Function Documentation

◆ configure_collector()

configure_collector ( self,
collector )
inherited
Can be overridden be child classes to pass additional configuration to the
MillepedeCollector (activated by the use of the constraints)

Reimplemented in CDCWireConstraints, and VXDHierarchyConstraints.

Definition at line 83 of file constraints.py.

83 def configure_collector(self, collector):
84 """
85 Can be overridden be child classes to pass additional configuration to the
86 MillepedeCollector (activated by the use of the constraints)
87 """
88 pass
89
90

◆ generate()

generate ( self)
Generate constraints from CDC geometry

Reimplemented from Constraints.

Definition at line 222 of file constraints.py.

222 def generate(self):
223 """Generate constraints from CDC geometry
224 """
225 print("Generating constraints for CDC layers...")
226
227 def cdc_layer_label(layer, param):
228 wire = 511
229 wireid = Belle2.WireID(layer, wire).getEWire()
230 label = Belle2.GlobalLabel()
231 label.construct(Belle2.CDCAlignment.getGlobalUniqueID(), wireid, param)
232 return label.label()
233
234 def cmp(a, b):
235 return (a > b) - (a < b)
236
237 consts = []
238
239 parameters = self.parameter
240
241 for par in parameters:
242 nTot = 0
243 for sl in self.cdc:
244 nlyr = sl[1]
245 for lyr in range(nlyr):
246 nTot += nlyr
247 nLayer = nTot
248
249 if self.rigid:
250 # all layers
251 for par in self.parameter:
252 if par[0] == 16:
253 continue
254 const = Constraint()
255
256 nTot = 0
257 for sl in self.cdc:
258 nlyr = sl[1]
259 for lyr in range(nlyr):
260 label = cdc_layer_label(nTot + lyr, par[0])
261 const.add(label, 1.0)
262 nTot += nlyr
263
264 consts.append(const)
265
266 if self.twist:
267 # all layers
268 for par in self.parameter:
269 if par[0] != 16:
270 continue
271 const = Constraint()
272
273 nTot = 0
274 for sl in self.cdc:
275 nlyr = sl[1]
276 for lyr in range(nlyr):
277 label = cdc_layer_label(nTot + lyr, par[0])
278 const.add(label, 1.0)
279 nTot += nlyr
280
281 # f.write('\n')
282 consts.append(const)
283
284 if self.z_offset:
285 # stereo layers (Z offset)
286 par = self.parameter[2]
287 const = Constraint()
288
289 nTot = 0
290 for sl in self.cdc:
291 nlyr = sl[1]
292 rInner = sl[3]
293 rOuter = sl[4]
294 stereo = sl[5]
295 if stereo != 0.:
296 dr = (rOuter - rInner) / (nlyr - 1)
297 rWire = rInner
298 for lyr in range(nlyr):
299 label = cdc_layer_label(nTot + lyr, par[0])
300 const.add(label, stereo * rWire)
301 rWire += dr
302 nTot += nlyr
303
304 # f.write('\n')
305 consts.append(const)
306
307 if self.r_scale:
308 # all layers 2nd
309 for par in self.parameter[:2]:
310 const = Constraint()
311
312 nTot = 0
313 for sl in self.cdc:
314 nlyr = sl[1]
315 for lyr in range(nlyr):
316 label = cdc_layer_label(nTot + lyr, par[0])
317 der = cmp(2. * float(nTot + lyr) + 0.5, float(nLayer))
318 const.add(label, der)
319 nTot += nlyr
320
321 consts.append(const)
322
323 if self.z_scale:
324 # stereo layers (Z -scale)
325 par = self.parameter[5]
326 const = Constraint()
327 nTot = 0
328 for sl in self.cdc:
329 nlyr = sl[1]
330 stereo = sl[5]
331 if stereo != 0.:
332 for lyr in range(nlyr):
333 label = cdc_layer_label(nTot + lyr, par[0])
334 const.add(label, stereo)
335 nTot += nlyr
336
337 # f.write('\n')
338 consts.append(const)
339
340 return consts
341
342
static unsigned short getGlobalUniqueID()
Get global unique id.
Class to convert to/from global labels for Millepede II to/from detector & parameter identificators.
Definition GlobalLabel.h:41
Class to identify a wire inside the CDC.
Definition WireID.h:34

Member Data Documentation

◆ cdc

list cdc
static
Initial value:
= [['A1', 8, 160, 16.80, 23.80, 0., -35.9, 67.9],
['U2', 6, 160, 25.70, 34.80, 0.068, -51.4, 98.6],
['A3', 6, 192, 36.52, 45.57, 0., -57.5, 132.9],
['V4', 6, 224, 47.69, 56.69, -0.060, -59.6, 144.7],
['A5', 6, 256, 58.41, 67.41, 0., -61.8, 146.8],
['U6', 6, 288, 69.53, 78.53, 0.064, -63.9, 148.9],
['A7', 6, 320, 80.25, 89.25, 0., -66.0, 151.0],
['V8', 6, 352, 91.37, 100.37, -0.072, -68.2, 153.2],
['A9', 6, 384, 102.00, 111.14, 0., -70.2, 155.3]]

CDC geometry hard-code -> TODO.

Definition at line 181 of file constraints.py.

◆ filename

filename = filename
inherited

File name.

Definition at line 72 of file constraints.py.

◆ parameter

list parameter
static
Initial value:
= [(1, 'x-offset bwd'), (2, 'y-offset bwd'), (6, 'z-rotation bwd'),
(11, 'x-offset fwd-bwd'), (12, 'y-offset fwd-bwd'), (16, 'z-rotation fwd-bwd')]

layer parameters

Definition at line 192 of file constraints.py.

◆ r_scale

r_scale = r_scale

Constraint for r-scale.

Definition at line 218 of file constraints.py.

◆ rigid

rigid = rigid

6D CDC constraints

Definition at line 212 of file constraints.py.

◆ twist

twist = twist

CDC twist constraint.

Definition at line 214 of file constraints.py.

◆ z_offset

z_offset = z_offset

Constraint for z-offset.

Definition at line 216 of file constraints.py.

◆ z_scale

z_scale = z_scale

Constraint for z-scale.

Definition at line 220 of file constraints.py.


The documentation for this class was generated from the following file: