|
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 | runProphecy (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 | output_events_file_name (self) |
| Get output file name. More...
|
|
def | output_events_file_name (self, value) |
| Set output file name. More...
|
|
def | prophecy_directory (self) |
| Get Prophecy directory. 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'] |
|
| __logger = Logging.logging.getLogger('ProphecyControl') |
| Setup athena-compatible logger. More...
|
|
string | _prophecy_executable = 'Prophecy4f' |
| This must be defined by each derived class - don't change it in the jobOptions! For rel 21.6, no longer need to set explicit path because prophecy4f is in $PATH. More...
|
|
Definition at line 5 of file ProphecyPowhegDefault.py.
◆ __init__()
def python.ProphecyPowhegDefault.ProphecyPowhegDefault.__init__ |
( |
|
self, |
|
|
|
runArgs = None , |
|
|
|
opts = None |
|
) |
| |
◆ add_parameter()
def python.ProphecyConfig.ProphecyConfig.add_parameter |
( |
|
self, |
|
|
|
configurable_name, |
|
|
|
value, |
|
|
|
desc = '' , |
|
|
|
parameter = None |
|
) |
| |
|
inherited |
Register configurable parameter.
Definition at line 147 of file ProphecyConfig.py.
148 def add_parameter( self, configurable_name, value, desc='', parameter=None ) :
149 setattr( self, configurable_name, value )
150 prophecy_parameter = parameter
if parameter
is not None else configurable_name
151 self.configurable_parameters[prophecy_parameter] = ( configurable_name, desc )
◆ add_parameter_set()
def python.ProphecyConfig.ProphecyConfig.add_parameter_set |
( |
|
self, |
|
|
|
parameter_set, |
|
|
** |
kwargs |
|
) |
| |
|
inherited |
◆ configurable_parameters()
def python.ProphecyConfig.ProphecyConfig.configurable_parameters |
( |
|
self | ) |
|
|
inherited |
Get dictionary of configurable parameters.
Definition at line 207 of file ProphecyConfig.py.
208 def configurable_parameters(self) :
209 return self.__configurable_parameters
◆ emit_heartbeat()
def python.ProphecyConfig.ProphecyConfig.emit_heartbeat |
( |
|
self, |
|
|
|
duration |
|
) |
| |
|
inherited |
Output a heartbeat message.
Definition at line 159 of file ProphecyConfig.py.
160 def emit_heartbeat(self, duration) :
161 message =
'Heartbeat: Prophecy generation has been running for {0} in total'.
format( RepeatingTimer.human_readable_time_interval(duration) )
162 self.logger.
info( message )
163 with open(
'{0}/eventLoopHeartBeat.txt'.
format( self.__run_directory ),
'w' )
as f : f.write( message )
◆ fix_parameter()
def python.ProphecyConfig.ProphecyConfig.fix_parameter |
( |
|
self, |
|
|
|
parameter, |
|
|
|
value = None , |
|
|
|
desc = '' |
|
) |
| |
|
inherited |
Register non-configurable parameter.
Definition at line 165 of file ProphecyConfig.py.
166 def fix_parameter( self, parameter, value=None, desc='' ) :
168 if value
is None : value = getattr( self, parameter )
170 for prophecy_parameter, configurable_name_tuple
in self.configurable_parameters.
items() :
172 if parameter == configurable_name_tuple[0] :
173 parameter, desc = prophecy_parameter, configurable_name_tuple[1]
174 self.configurable_parameters.pop(prophecy_parameter)
176 self.fixed_parameters.
append( (parameter, value, desc) )
◆ fixed_parameters()
def python.ProphecyConfig.ProphecyConfig.fixed_parameters |
( |
|
self | ) |
|
|
inherited |
Get list of non-configurable parameters.
Definition at line 213 of file ProphecyConfig.py.
214 def fixed_parameters(self) :
215 return self.__fixed_parameters
◆ generate()
def python.ProphecyConfig.ProphecyConfig.generate |
( |
|
self, |
|
|
|
filter_name = '' , |
|
|
|
filter_args = '' |
|
) |
| |
|
inherited |
Run normal event generation.
Definition at line 52 of file ProphecyConfig.py.
53 def generate( self, filter_name='', filter_args='' ) :
54 self.generateRunCard()
◆ generateEvents()
def python.ProphecyConfig.ProphecyConfig.generateEvents |
( |
|
self | ) |
|
|
inherited |
Run normal event generation.
Definition at line 91 of file ProphecyConfig.py.
94 time_start = time.time()
95 self.logger.
info(
'Starting Prophecy LHEF event generation at {0}'.
format( time.ctime( time_start ) ) )
98 heartbeat = HeartbeatTimer(600.,
"{}/eventLoopHeartBeat.txt".
format(self.__run_directory))
99 heartbeat.setName(
"heartbeat thread")
100 heartbeat.daemon =
True
104 self.logger.
info(
'Removing old Prophecy LHE files' )
106 os.remove(
'plot*.lhe plot*.ev*ts' )
112 if not os.path.exists(
'UNWEIGHTEDEVENTS'):
113 os.makedirs(
'UNWEIGHTEDEVENTS')
114 self.logger.
info(
'Created directory UNWEIGHTEDEVENTS' )
117 self.running_process = []
125 generation_end = time.time()
126 elapsed_time = generation_end - time_start
127 self.logger.
info(
'Running nominal Prophecy took {0} for {1} events => {2:6.3f} Hz'.
format( HeartbeatTimer.readable_duration(elapsed_time), self.nEvents, self.nEvents / elapsed_time ) )
129 self.logger.
info(
'Removing Prophecy born LHE file' )
131 os.remove(
'plot_unweighted_born.lhe' )
137 os.rename(
'UNWEIGHTEDEVENTS/plot_unweighted.lhe', self.output_events_file_name )
138 self.logger.
info(
'Moved plot_unweighted.lhe to {0}'.
format(self.output_events_file_name) )
140 self.logger.warning(
'No output LHEF file found! Probably because the Prophecy process was killed before finishing.' )
143 self.logger.
info(
'Finished at {0}'.
format( time.asctime() ) )
◆ generateRunCard()
def python.ProphecyConfig.ProphecyConfig.generateRunCard |
( |
|
self | ) |
|
|
inherited |
Initialise runcard with generic options.
Definition at line 57 of file ProphecyConfig.py.
58 def generateRunCard(self) :
61 for run_card_decorator
in self.run_card_decorators :
62 if hasattr( run_card_decorator,
'finalise' ) : run_card_decorator.finalise()
65 self.logger.
info(
'** User configurable parameters for this process **' )
66 self.logger.
info(
': Configurable parameter : Current value : Description' )
67 for value_tuple
in sorted( self.configurable_parameters.
values(), key=
lambda x: x[0].lower() ) :
68 self.logger.
info(
': {0:<22} : {1:>17} : {2}'.
format( value_tuple[0], getattr(self, value_tuple[0]), value_tuple[1] ) )
71 [ self.fix_parameter( parameter=value_tuple[0], desc=value_tuple[1] )
for value_tuple
in self.configurable_parameters.
values() ]
74 self.logger.
info(
'Writing Prophecy runcard to {0}'.
format( self.run_card_path ) )
75 with open( self.run_card_path,
'w' )
as f :
76 for parameter_tuple
in sorted( self.fixed_parameters, key=
lambda x: x[0].lower() ) :
77 name, value, desc = parameter_tuple
79 if isinstance(value,list) :
81 self.__enable_reweighting =
True
82 output_line =
'{0:<30}! {1}'.
format(
'{0}={1}'.
format( name, value ), desc )
83 f.write(
'{0}\n'.
format(output_line) )
84 self.logger.
info(
'Wrote {0}'.
format( output_line ) )
87 self.logger.
info(
'Using executable: {0}'.
format( self._prophecy_executable ) )
88 self.logger.
info(
'Number of events and weight events: {0} {1}.'.
format( self.nEvents, self.nEvents_weighted ) )
◆ logger()
def python.ProphecyConfig.ProphecyConfig.logger |
( |
|
self | ) |
|
|
inherited |
◆ output_events_file_name() [1/2]
def python.ProphecyConfig.ProphecyConfig.output_events_file_name |
( |
|
self | ) |
|
|
inherited |
Get output file name.
Definition at line 225 of file ProphecyConfig.py.
227 return self.__output_events_file_name
◆ output_events_file_name() [2/2]
def python.ProphecyConfig.ProphecyConfig.output_events_file_name |
( |
|
self, |
|
|
|
value |
|
) |
| |
|
inherited |
Set output file name.
Definition at line 230 of file ProphecyConfig.py.
230 @output_events_file_name.setter
232 self.__output_events_file_name = value
◆ prophecy_directory()
def python.ProphecyConfig.ProphecyConfig.prophecy_directory |
( |
|
self | ) |
|
|
inherited |
Get Prophecy directory.
Definition at line 236 of file ProphecyConfig.py.
237 def prophecy_directory(self) :
238 return self.__prophecy_directory
◆ run_card_decorators()
def python.ProphecyConfig.ProphecyConfig.run_card_decorators |
( |
|
self | ) |
|
|
inherited |
Get list of enabled run card decorators.
Definition at line 242 of file ProphecyConfig.py.
243 def run_card_decorators(self) :
244 return self.__run_card_decorators
◆ run_card_path()
def python.ProphecyConfig.ProphecyConfig.run_card_path |
( |
|
self | ) |
|
|
inherited |
Get full path to runcard.
Definition at line 248 of file ProphecyConfig.py.
249 def run_card_path(self) :
250 return '{0}/prophecy.input'.
format( self.run_directory )
◆ run_directory()
def python.ProphecyConfig.ProphecyConfig.run_directory |
( |
|
self | ) |
|
|
inherited |
Get run directory.
Definition at line 201 of file ProphecyConfig.py.
202 def run_directory(self) :
203 return self.__run_directory
◆ runProphecy()
def python.ProphecyConfig.ProphecyConfig.runProphecy |
( |
|
configurator | ) |
|
|
inherited |
Definition at line 177 of file ProphecyConfig.py.
178 def runProphecy(configurator) :
179 configurator.running_process.append(subprocess.Popen( [configurator._prophecy_executable,
''], stdout=subprocess.PIPE, stdin=
open(configurator.run_card_path), stderr=subprocess.STDOUT ) )
181 while configurator.running_process :
183 for process
in configurator.running_process :
185 output = process.stdout.readline().rstrip()
186 if len(output) == 0 :
break
187 configurator.logger.info(
'{0}'.
format(output) )
188 if process.poll()
is not None :
190 process.stdout.flush()
192 output = process.stdout.readline().rstrip()
193 if len(output) == 0 :
break
194 configurator.logger.info(
'{0}'.
format(output) )
196 process.stdout.close()
197 configurator.running_process.remove( process )
198 configurator.logger.info(
'Prophecy finished - all done.' )
◆ __configurable_parameters
python.ProphecyConfig.ProphecyConfig.__configurable_parameters |
|
privateinherited |
◆ __enable_reweighting
python.ProphecyConfig.ProphecyConfig.__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 80 of file ProphecyConfig.py.
◆ __fixed_parameters
python.ProphecyConfig.ProphecyConfig.__fixed_parameters |
|
privateinherited |
◆ __logger
python.ProphecyConfig.ProphecyConfig.__logger = Logging.logging.getLogger('ProphecyControl') |
|
staticprivateinherited |
◆ __output_events_file_name
python.ProphecyConfig.ProphecyConfig.__output_events_file_name |
|
privateinherited |
This needs to be set so that Generate_trf finds an appropriate file format for showering.
Definition at line 25 of file ProphecyConfig.py.
◆ __run_card_decorators
python.ProphecyConfig.ProphecyConfig.__run_card_decorators |
|
privateinherited |
◆ __run_directory
python.ProphecyConfig.ProphecyConfig.__run_directory = os.environ['PWD'] |
|
staticprivateinherited |
◆ _prophecy_executable
string python.ProphecyConfig.ProphecyConfig._prophecy_executable = 'Prophecy4f' |
|
staticprivateinherited |
This must be defined by each derived class - don't change it in the jobOptions! For rel 21.6, no longer need to set explicit path because prophecy4f is in $PATH.
Definition at line 20 of file ProphecyConfig.py.
◆ nEvents
python.ProphecyConfig.ProphecyConfig.nEvents |
|
inherited |
Add universal functionality.
Initialise values from runArgs
Definition at line 41 of file ProphecyConfig.py.
◆ nEvents_weighted
python.ProphecyConfig.ProphecyConfig.nEvents_weighted |
|
inherited |
◆ random_seed
python.ProphecyConfig.ProphecyConfig.random_seed |
|
inherited |
◆ running_process
python.ProphecyConfig.ProphecyConfig.running_process |
|
inherited |
Initialise timer.
Setup heartbeat thread Remove any existing .lhe files to avoid repeated events The following is only needed for newer installation of prophecy?? RDS 2019/07 Create dirs UNWEIGHTEDEVENTS and HISTUNWEIGHTED Initialise generation process tracker
Definition at line 116 of file ProphecyConfig.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)