Belle II Software  release-05-02-19
DownloadableDatabase Class Reference

Public Member Functions

def __init__ (self, command_argument)
 
def set_database (self)
 
def get_all_cuts (self)
 

Private Attributes

 _database
 the specified databases
 
 _experiment
 the experiment number, default (= latest) is 99999
 
 _run
 the run number, default (= latest) is 99999
 

Detailed Description

Helper class to translate the user-specified database(s) into parameters for basf2

Definition at line 24 of file cli.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  command_argument 
)
Init the stored databases and exp/run from the specified command argument

Definition at line 27 of file cli.py.

27  def __init__(self, command_argument):
28  """Init the stored databases and exp/run from the specified command argument"""
29 
30  self._database = []
31 
32  self._experiment = 99999
33 
34  self._run = 99999
35 
36  # If given, use the experiment run from the command_argument
37  split_argument = command_argument.split(":")
38  if len(split_argument) == 2:
39  command_argument, exp_run = split_argument
40 
41  if exp_run != "latest":
42  try:
43  self._experiment, self._run = map(int, exp_run.split("/"))
44  except BaseException:
45  raise argparse.ArgumentTypeError(
46  f"Do not understand the exp/run argument '{exp_run}'")
47 
48  elif len(split_argument) != 1:
49  raise argparse.ArgumentTypeError(
50  f"Do not understand the database argument '{command_argument}'")
51 
52  # Now split up the databases
53  self._database = command_argument.split(",")
54 
55  # However make sure we have them in the correct format
56  def normalize(database):
57  # In case a local file is specified we can just use it directly
58  if os.path.exists(database):
59  if os.path.basename(database) != "database.txt":
60  database = os.path.join(database, "database.txt")
61 
62  return database
63 
64  self._database = list(map(normalize, self._database))
65 

Member Function Documentation

◆ get_all_cuts()

def get_all_cuts (   self)
Get all cuts stored in the database(s)
and sort them according to base_identifier, cut_identifier.

Definition at line 89 of file cli.py.

◆ set_database()

def set_database (   self)
Set the basf2 database chain according to the specified databases.
Before that, clean up and invalidate everything from th database.

The distinction between file databases and global databases is done
via the fact of a file/folder with this name exists or not.

Definition at line 66 of file cli.py.


The documentation for this class was generated from the following file: