|
def | __init__ (self, runArgs=None, opts=None) |
|
def | generate (self, filter_name='', filter_args='') |
| Run normal event generation. More...
|
|
def | generateRunCard (self) |
| Initialise runcard with generic options. More...
|
|
def | generateEvents (self) |
| Run normal event generation. More...
|
|
def | add_parameter (self, configurable_name, value, desc='', parameter=None) |
| Register configurable parameter. More...
|
|
def | add_parameter_set (self, parameter_set, **kwargs) |
| Alias to DecoratorFactory.decorate. More...
|
|
def | emit_heartbeat (self, duration) |
| Output a heartbeat message. More...
|
|
def | fix_parameter (self, parameter, value=None, desc='') |
| Register non-configurable parameter. More...
|
|
def | runHto4l (configurator) |
|
def | run_directory (self) |
| Get run directory. More...
|
|
def | configurable_parameters (self) |
| Get dictionary of configurable parameters. More...
|
|
def | fixed_parameters (self) |
| Get list of non-configurable parameters. More...
|
|
def | logger (self) |
| Get handle to logger. More...
|
|
def | run_card_decorators (self) |
| Get list of enabled run card decorators. More...
|
|
def | run_card_path (self) |
| Get full path to runcard. More...
|
|
|
| __run_directory = os.environ['PWD'] |
| Set up run directory and path to Hto4l. More...
|
|
| __logger = Logging.logging.getLogger('Hto4lControl') |
| Setup athena-compatible logger. More...
|
|
string | _hto4l_executable = 'Hto4l' |
| This must be defined by each derived class - don't change it in the jobOptions! _hto4l_executable = __hto4l_directory + '/Hto4l/Hto4l-v2.0/Hto4l' for local copy of Hto4l use: _hto4l_executable = __hto4l_directory + '/runGrid/Hto4l' For the lcg version of Hto4l use: _hto4l_executable = __hto4l_directory + '/Hto4l'. More...
|
|
Definition at line 5 of file Hto4lPowhegDefault.py.
◆ __init__()
def python.Hto4lPowhegDefault.Hto4lPowhegDefault.__init__ |
( |
|
self, |
|
|
|
runArgs = None , |
|
|
|
opts = None |
|
) |
| |
◆ add_parameter()
def python.Hto4lConfig.Hto4lConfig.add_parameter |
( |
|
self, |
|
|
|
configurable_name, |
|
|
|
value, |
|
|
|
desc = '' , |
|
|
|
parameter = None |
|
) |
| |
|
inherited |
Register configurable parameter.
Definition at line 149 of file Hto4lConfig.py.
149 def add_parameter( self, configurable_name, value, desc='', parameter=None ) :
150 setattr( self, configurable_name, value )
151 hto4l_parameter = parameter
if parameter
is not None else configurable_name
152 self.configurable_parameters[hto4l_parameter] = ( configurable_name, desc )
◆ add_parameter_set()
def python.Hto4lConfig.Hto4lConfig.add_parameter_set |
( |
|
self, |
|
|
|
parameter_set, |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
◆ configurable_parameters()
def python.Hto4lConfig.Hto4lConfig.configurable_parameters |
( |
|
self | ) |
|
|
inherited |
Get dictionary of configurable parameters.
Definition at line 210 of file Hto4lConfig.py.
210 def configurable_parameters(self) :
211 return self.__configurable_parameters
◆ emit_heartbeat()
def python.Hto4lConfig.Hto4lConfig.emit_heartbeat |
( |
|
self, |
|
|
|
duration |
|
) |
| |
|
inherited |
Output a heartbeat message.
Definition at line 161 of file Hto4lConfig.py.
161 def emit_heartbeat(self, duration) :
162 message =
'Heartbeat: Hto4l generation has been running for {0} in total'.
format( RepeatingTimer.human_readable_time_interval(duration) )
163 self.logger.
info( message )
164 with open(
'{0}/eventLoopHeartBeat.txt'.
format( self.__run_directory ),
'w' )
as f : f.write( message )
◆ fix_parameter()
def python.Hto4lConfig.Hto4lConfig.fix_parameter |
( |
|
self, |
|
|
|
parameter, |
|
|
|
value = None , |
|
|
|
desc = '' |
|
) |
| |
|
inherited |
Register non-configurable parameter.
Definition at line 168 of file Hto4lConfig.py.
168 def fix_parameter( self, parameter, value=None, desc='' ) :
170 if value
is None : value = getattr( self, parameter )
172 for hto4l_parameter, configurable_name_tuple
in self.configurable_parameters.
items() :
174 if parameter == configurable_name_tuple[0] :
175 parameter, desc = hto4l_parameter, configurable_name_tuple[1]
176 self.configurable_parameters.pop(hto4l_parameter)
178 self.fixed_parameters.
append( (parameter, value, desc) )
◆ fixed_parameters()
def python.Hto4lConfig.Hto4lConfig.fixed_parameters |
( |
|
self | ) |
|
|
inherited |
Get list of non-configurable parameters.
Definition at line 216 of file Hto4lConfig.py.
216 def fixed_parameters(self) :
217 return self.__fixed_parameters
◆ generate()
def python.Hto4lConfig.Hto4lConfig.generate |
( |
|
self, |
|
|
|
filter_name = '' , |
|
|
|
filter_args = '' |
|
) |
| |
|
inherited |
Run normal event generation.
Definition at line 62 of file Hto4lConfig.py.
62 def generate( self, filter_name='', filter_args='' ) :
63 self.generateRunCard()
◆ generateEvents()
def python.Hto4lConfig.Hto4lConfig.generateEvents |
( |
|
self | ) |
|
|
inherited |
Run normal event generation.
Definition at line 104 of file Hto4lConfig.py.
106 time_start = time.time()
107 self.logger.
info(
'Starting Hto4l LHEF event generation at {0}'.
format( time.ctime( time_start ) ) )
108 self.logger.
info(
'Number of events: {0}.'.
format( self.nEvents ) )
111 heartbeat = HeartbeatTimer(600.,
"{}/eventLoopHeartBeat.txt".
format(self.__run_directory))
112 heartbeat.setName(
"heartbeat thread")
113 heartbeat.daemon =
True
118 self.running_process = []
126 generation_end = time.time()
127 elapsed_time = generation_end - time_start
128 self.logger.
info(
'Running nominal Hto4l took {0} for {1} events => {2:6.3f} Hz'.
format( HeartbeatTimer.readable_duration(elapsed_time), self.nEvents, self.nEvents / elapsed_time ) )
144 self.logger.
info(
'Finished at {0}'.
format( time.asctime() ) )
◆ generateRunCard()
def python.Hto4lConfig.Hto4lConfig.generateRunCard |
( |
|
self | ) |
|
|
inherited |
Initialise runcard with generic options.
Definition at line 67 of file Hto4lConfig.py.
67 def generateRunCard(self) :
70 for run_card_decorator
in self.run_card_decorators :
71 if hasattr( run_card_decorator,
'finalise' ) : run_card_decorator.finalise()
74 self.logger.
info(
'** User configurable parameters for this process **' )
75 self.logger.
info(
': Configurable parameter : Current value : Description' )
78 for value_tuple
in self.configurable_parameters.
values() :
79 self.logger.
info(
': {0:<22} : {1:>17} : {2}'.
format( value_tuple[0], getattr(self, value_tuple[0]), value_tuple[1] ) )
82 [ self.fix_parameter( parameter=value_tuple[0], desc=value_tuple[1] )
for value_tuple
in self.configurable_parameters.
values() ]
85 self.logger.
info(
'Writing Hto4l runcard to {0}'.
format( self.run_card_path ) )
86 with open( self.run_card_path,
'w' )
as f :
88 for parameter_tuple
in self.fixed_parameters :
89 name, value, desc = parameter_tuple
91 if isinstance(value,list) :
93 self.__enable_reweighting =
True
95 output_line =
'{0:<30}! {1}'.
format(
'{0}'.
format( value ), desc )
96 f.write(
'{0}\n'.
format(output_line) )
97 self.logger.
info(
'Wrote {0}'.
format( output_line ) )
100 self.logger.
info(
'Using executable: {0}'.
format( self._hto4l_executable ) )
◆ logger()
def python.Hto4lConfig.Hto4lConfig.logger |
( |
|
self | ) |
|
|
inherited |
◆ run_card_decorators()
def python.Hto4lConfig.Hto4lConfig.run_card_decorators |
( |
|
self | ) |
|
|
inherited |
Get list of enabled run card decorators.
Definition at line 232 of file Hto4lConfig.py.
232 def run_card_decorators(self) :
233 return self.__run_card_decorators
◆ run_card_path()
def python.Hto4lConfig.Hto4lConfig.run_card_path |
( |
|
self | ) |
|
|
inherited |
Get full path to runcard.
Definition at line 238 of file Hto4lConfig.py.
238 def run_card_path(self) :
239 return '{0}/hto4l.input'.
format( self.run_directory )
◆ run_directory()
def python.Hto4lConfig.Hto4lConfig.run_directory |
( |
|
self | ) |
|
|
inherited |
Get run directory.
Definition at line 204 of file Hto4lConfig.py.
204 def run_directory(self) :
205 return self.__run_directory
◆ runHto4l()
def python.Hto4lConfig.Hto4lConfig.runHto4l |
( |
|
configurator | ) |
|
|
inherited |
Definition at line 180 of file Hto4lConfig.py.
180 def runHto4l(configurator) :
181 configurator.running_process.append(subprocess.Popen( [configurator._hto4l_executable,
''], stdout=subprocess.PIPE, stdin=
open(configurator.run_card_path), stderr=subprocess.STDOUT ) )
183 while configurator.running_process :
185 for process
in configurator.running_process :
187 output = process.stdout.readline().rstrip()
188 if len(output) == 0 :
break
189 configurator.logger.info(
'{0}'.
format(output) )
190 if process.poll()
is not None :
192 process.stdout.flush()
194 output = process.stdout.readline().rstrip()
195 if len(output) == 0 :
break
196 configurator.logger.info(
'{0}'.
format(output) )
198 process.stdout.close()
199 configurator.running_process.remove( process )
200 configurator.logger.info(
'Hto4l finished - all done.' )
◆ __configurable_parameters
python.Hto4lConfig.Hto4lConfig.__configurable_parameters |
|
privateinherited |
◆ __enable_reweighting
python.Hto4lConfig.Hto4lConfig.__enable_reweighting |
|
privateinherited |
Finalise registered decorators.
Print list of configurable parameters for users Add configurable parameters to fixed list Write out final runcard
Definition at line 93 of file Hto4lConfig.py.
◆ __fixed_parameters
python.Hto4lConfig.Hto4lConfig.__fixed_parameters |
|
privateinherited |
Set up lists of parameters and decorators.
Definition at line 41 of file Hto4lConfig.py.
◆ __logger
python.Hto4lConfig.Hto4lConfig.__logger = Logging.logging.getLogger('Hto4lControl') |
|
staticprivateinherited |
◆ __output_events_file_name
python.Hto4lConfig.Hto4lConfig.__output_events_file_name |
|
privateinherited |
This needs to be set so that Generate_trf finds an appropriate file format for showering.
Definition at line 38 of file Hto4lConfig.py.
◆ __run_card_decorators
python.Hto4lConfig.Hto4lConfig.__run_card_decorators |
|
privateinherited |
◆ __run_directory
python.Hto4lConfig.Hto4lConfig.__run_directory = os.environ['PWD'] |
|
staticprivateinherited |
Set up run directory and path to Hto4l.
Definition at line 14 of file Hto4lConfig.py.
◆ _hto4l_executable
string python.Hto4lConfig.Hto4lConfig._hto4l_executable = 'Hto4l' |
|
staticprivateinherited |
This must be defined by each derived class - don't change it in the jobOptions! _hto4l_executable = __hto4l_directory + '/Hto4l/Hto4l-v2.0/Hto4l' for local copy of Hto4l use: _hto4l_executable = __hto4l_directory + '/runGrid/Hto4l' For the lcg version of Hto4l use: _hto4l_executable = __hto4l_directory + '/Hto4l'.
Definition at line 33 of file Hto4lConfig.py.
◆ nEvents
python.Hto4lConfig.Hto4lConfig.nEvents |
|
inherited |
Add universal functionality.
Initialise values from runArgs
Definition at line 55 of file Hto4lConfig.py.
◆ random_seed
python.Hto4lConfig.Hto4lConfig.random_seed |
|
inherited |
◆ running_process
python.Hto4lConfig.Hto4lConfig.running_process |
|
inherited |
Initialise timer.
Initialise generation process tracker
Definition at line 118 of file Hto4lConfig.py.
The documentation for this class was generated from the following file:
def generate(process_dir='PROC_mssm_0', grid_pack=False, gridpack_compile=False, extlhapath=None, required_accuracy=0.01, runArgs=None, bias_module=None, requirePMGSettings=False)