def test_setupLogging(self): Logging.setupLogging('WARNING', 'testname') self.assertNotEqual(sys.stdout, sys.__stdout__) self.assertNotEqual(sys.stderr, sys.__stderr__)
return False if __name__ == "__main__": # material = 'iron_scint_bars' material = sys.argv[1] name = "range_test_%s" % material run = 0 random.seed() config_class = Configuration.DEFAULT(name, run) Configuration.GLOBAL_CONFIG = config_class.get_configuration_dict() Logging.setupLogging("DEBUG", name) log = logging.getLogger("root").getChild("simulate") # make shorter variable name for us config = config_class.get_configuration_dict() log.info("Using the following configuration:") log.info(config) rand_engine = G4.Ranlux64Engine() HepRandom.setTheEngine(rand_engine) seed = config["seed"] if seed == 0: seed = random.randint(1, 65536) log.warning("Using random seed %d", seed) else:
Logging.addLogLevelOptionToArgs(parser) # adds --log_level Configuration.populate_args(parser) parser.add_argument('--name', '-n', help='DB in CouchDB for output', type=str, required=True) parser.add_argument('--run', '-r', help='run number', type=int, required=True) args = parser.parse_args() config_class = Configuration.DEFAULT(args.name, args.run, overload=vars(args)) Configuration.GLOBAL_CONFIG = config_class.get_configuration_dict() Logging.setupLogging(args.log_level, args.name) log = logging.getLogger('root').getChild('simulate') log.debug('Commandline args: %s', str(args)) random.seed() # make shorter variable name for us config = config_class.get_configuration_dict() log.info('Using the following configuration:') log.info(config) rand_engine = G4.Ranlux64Engine() HepRandom.setTheEngine(rand_engine) seed = config['seed'] if seed == 0:
return False if __name__ == "__main__": #material = 'iron_scint_bars' material = sys.argv[1] name = 'range_test_%s' % material run = 0 random.seed() config_class = Configuration.DEFAULT(name, run) Configuration.GLOBAL_CONFIG = config_class.get_configuration_dict() Logging.setupLogging('DEBUG', name) log = logging.getLogger('root').getChild('simulate') # make shorter variable name for us config = config_class.get_configuration_dict() log.info('Using the following configuration:') log.info(config) rand_engine = G4.Ranlux64Engine() HepRandom.setTheEngine(rand_engine) seed = config['seed'] if seed == 0: seed = random.randint(1, 65536) log.warning('Using random seed %d', seed) else:
return True return False if __name__ == "__main__": #material = 'iron_scint_bars' material = sys.argv[1] name = 'range_test_%s' % material run = 0 random.seed() config_class = Configuration.DEFAULT(name, run) Configuration.GLOBAL_CONFIG = config_class.get_configuration_dict() Logging.setupLogging('DEBUG', name) log = logging.getLogger('root').getChild('simulate') # make shorter variable name for us config = config_class.get_configuration_dict() log.info('Using the following configuration:') log.info(config) rand_engine = G4.Ranlux64Engine() HepRandom.setTheEngine(rand_engine) seed = config['seed'] if seed == 0: seed = random.randint(1, 65536) log.warning('Using random seed %d', seed) else: