1 """! running pede from in hps-mc jobs"""
8 from ._parameter
import Parameter
9 from ._pattern
import Pattern
10 from ._util
import getBeamspotConstraintsFloatingOnly
14 """! Run pede minimizer over input bin files for alignment
31 super().
__init__(
'pede', command=
'pede', **kwargs)
34 self.
loggerlogger.info(f
'Parameter Map: {self.param_map}')
35 parameters = Parameter.parse_map_file(self.
param_mapparam_map)
38 self.
loggerlogger.info(f
'Loading previous fit: {self.previous_fit}')
40 destination=parameters,
46 patterns = list(map(Pattern, self.
to_floatto_float))
47 for parameter
in parameters.values():
48 if any(pattern.match(parameter)
for pattern
in patterns):
49 self.
loggerlogger.debug(f
'Floating parameter {parameter}')
53 pede_steering_file =
'pede-steer.txt'
54 with open(pede_steering_file,
'w')
as psf:
57 for ipf
in self.
inputsinputs:
62 self.
loggerlogger.info(f
'Adding constraint file {self.constraint_file}')
64 psf.write(
'!Constraint file\n')
65 psf.write(constraint_file+
'\n')
68 psf.write(
'\nParameter\n')
69 for i, p
in parameters.items():
70 psf.write(p.pede_format() +
'\n')
74 self.
loggerlogger.info(
'Applying survey constraints')
75 self.
loggerlogger.warn(
'UNTESTED - not sure if this is correct (Tom E)')
77 psf.write(
'\n!Survey constraints tu\n')
78 for p, name
in param_map.items():
79 if p.module_number() == 0
and p.direction == 1
and p.trans_rot == 1:
80 psf.write(
'\nMeasurement 0.0 %.3f\n' % survey_meas_tu)
81 psf.write(
'%s 1.0\n' & p)
86 self.
loggerlogger.error(
'Beamspot constraints not implemented!')
92 self.
loggerlogger.info(f
'Appending minimization settings from {self.pede_minimization}')
98 return pede_steering_file
102 parameters = Parameter.parse_pede_res(
'millepede.res', skip_nonfloat=
True)
103 self.
loggerlogger.info(
'Deduced Parameters')
104 for i, p
in parameters.items():
106 self.
loggerlogger.info(f
' {p}')
113 return [
'param_map',
'pede_minimization']
116 return [
'subito',
'constraint_file',
'previous_fit',
'beamspot_constraints',
'survey_constraints']
125 """pre-run initialization"""
129 """post-run de-initialization"""
Run pede minimizer over input bin files for alignment.
def required_config(self)
Return a list of required configuration settings.
def required_parameters(self)
Return a list of required parameters.
def optional_parameters(self)
Return a list of optional parameters.
def _print_pede_res(self)
def __init__(self, **kwargs)
def _write_pede_steering_file(self)
def cmd_args(self)
Return the command arguments of this component.
Base class for components in a job.
def getBeamspotConstraintsFloatingOnly(pars)
put beamspot constraints onto floating parameters