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 for par in self.parameter:
240 nTot = 0
241 for sl in self.cdc:
242 nlyr = sl[1]
243 for lyr in range(nlyr):
244 nTot += nlyr
245 nLayer = nTot
246
247 if self.rigid:
248 # all layers
249 for par in self.parameter:
250 if par[0] == 16:
251 continue
252 const = Constraint()
253
254 nTot = 0
255 for sl in self.cdc:
256 nlyr = sl[1]
257 for lyr in range(nlyr):
258 label = cdc_layer_label(nTot + lyr, par[0])
259 const.add(label, 1.0)
260 nTot += nlyr
261
262 consts.append(const)
263
264 if self.twist:
265 # all layers
266 for par in self.parameter:
267 if par[0] != 16:
268 continue
269 const = Constraint()
270
271 nTot = 0
272 for sl in self.cdc:
273 nlyr = sl[1]
274 for lyr in range(nlyr):
275 label = cdc_layer_label(nTot + lyr, par[0])
276 const.add(label, 1.0)
277 nTot += nlyr
278
279 # f.write('\n')
280 consts.append(const)
281
282 if self.z_offset:
283 # stereo layers (Z offset)
284 par = self.parameter[2]
285 const = Constraint()
286
287 nTot = 0
288 for sl in self.cdc:
289 nlyr = sl[1]
290 rInner = sl[3]
291 rOuter = sl[4]
292 stereo = sl[5]
293 if stereo != 0.:
294 dr = (rOuter - rInner) / (nlyr - 1)
295 rWire = rInner
296 for lyr in range(nlyr):
297 label = cdc_layer_label(nTot + lyr, par[0])
298 const.add(label, stereo * rWire)
299 rWire += dr
300 nTot += nlyr
301
302 # f.write('\n')
303 consts.append(const)
304
305 if self.r_scale:
306 # all layers 2nd
307 for par in self.parameter[:2]:
308 const = Constraint()
309
310 nTot = 0
311 for sl in self.cdc:
312 nlyr = sl[1]
313 for lyr in range(nlyr):
314 label = cdc_layer_label(nTot + lyr, par[0])
315 der = cmp(2. * float(nTot + lyr) + 0.5, float(nLayer))
316 const.add(label, der)
317 nTot += nlyr
318
319 consts.append(const)
320
321 if self.z_scale:
322 # stereo layers (Z -scale)
323 par = self.parameter[5]
324 const = Constraint()
325 nTot = 0
326 for sl in self.cdc:
327 nlyr = sl[1]
328 stereo = sl[5]
329 if stereo != 0.:
330 for lyr in range(nlyr):
331 label = cdc_layer_label(nTot + lyr, par[0])
332 const.add(label, stereo)
333 nTot += nlyr
334
335 # f.write('\n')
336 consts.append(const)
337
338 return consts
339
340
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: