def run_delphes(self, delphes_directory, delphes_card, initial_command=None, log_file=None): """ Runs the fast detector simulation Delphes on all HepMC samples added so far for which it hasn't been run yet. Parameters ---------- delphes_directory : str Path to the Delphes directory. delphes_card : str Path to a Delphes card. initial_command : str or None, optional Initial bash commands that have to be executed before Delphes is run (e.g. to load the correct virtual environment). Default value: None. log_file : str or None, optional Path to log file in which the Delphes output is saved. Default value: None. Returns ------- None """ if log_file is None: log_file = "./logs/delphes.log" for i, (delphes_filename, hepmc_filename) in enumerate( zip(self.delphes_sample_filenames, self.hepmc_sample_filenames)): if delphes_filename is not None and os.path.isfile( delphes_filename): logger.debug("Delphes already run for event sample %s", hepmc_filename) continue elif delphes_filename is not None: logger.debug( "Given Delphes file %s does not exist, running Delphes again on HepMC sample at %s", delphes_filename, hepmc_filename, ) else: logger.info("Running Delphes on HepMC sample at %s", hepmc_filename) delphes_sample_filename = run_delphes( delphes_directory, delphes_card, hepmc_filename, initial_command=initial_command, log_file=log_file) self.delphes_sample_filenames[i] = delphes_sample_filename
def run_delphes(self, delphes_directory, delphes_card, initial_command=None, log_file=None): """ Runs the fast detector simulation on all HepMC samples added so far. Parameters ---------- delphes_directory : str Path to the Delphes directory. delphes_card : str Path to a Delphes card. initial_command : str or None, optional Initial bash commands that have to be executed before Delphes is run (e.g. to load the correct virtual environment). Default value: None. log_file : str or None, optional Path to log file in which the Delphes output is saved. Default value: None. Returns ------- None """ if log_file is None: log_file = "./logs/delphes.log" for hepmc_sample_filename in self.hepmc_sample_filenames: logging.info("Running Delphes (%s) on event sample at %s", delphes_directory, hepmc_sample_filename) delphes_sample_filename = run_delphes( delphes_directory, delphes_card, hepmc_sample_filename, initial_command=initial_command, log_file=log_file, ) self.delphes_sample_filenames.append(delphes_sample_filename)