4 Provides a service manager preconfigured with SBND service providers.
6 A `ServiceManager` object bridges the access to the service providers.
7 In the most straightforward cases, getting a service provider is as simple as
8 calling `ServiceManager(providerName)` with the name of the service as string
9 (e.g. `larProp = ServiceManager('LArProperties')`).
13 If this module is executed as a script, the service manager is loaded and a
14 python interactive session is started. The main code also show how to override
15 the service manager setup by choosing a different service configuration.
18 __all__ = [
'ServiceManager',
'geometry', ]
48 DefaultConfigPath =
"simulationservices_sbnd.fcl"
49 DefaultServiceTable =
"sbnd_simulation_services"
56 If `serviceTable` is not `None`, a new configuration is created with the
57 service table as `serviceTable`, and `configPath` is included in that
58 configuration (presumably to define `serviceTable`). In this case, if
59 `configPath` is `None`, "simulationservices_sbnd.fcl" is included.
61 If both `configPath` and `serviceTable` are `None`, the configuration is
62 created as above, using "sbnd_simulation_services" as `serviceTable`.
64 Finally, if only `serviceTable` is `None`, the configuration file in
65 `configPath` is included directly, and it is assumed that it already
66 properly defines a `services` table.
68 return DefaultConfigPath, DefaultServiceTable
74 configFile=SBNDserviceManagerClass.DefaultConfigPath,
75 serviceTable=SBNDserviceManagerClass.DefaultServiceTable,
80 """Prepares for SBND service provider access in python/Gallery."""
111 if __name__ ==
"__main__":
118 Parser = argparse.ArgumentParser(
120 "Starts a python interactive session with `ServiceManager` available."
123 Parser.add_argument(
"--config",
"-c", dest=
"configPath",
124 help=
"configuration file path (must define `services` or host serviceTable below)"
126 Parser.add_argument(
"--servicetable",
"-T", dest=
"serviceTable",
127 help=
"name of the FHiCL table where all services are configured")
129 args = Parser.parse_args()
131 if args.configPath
is not None:
132 ServiceManager.setConfiguration(args.configPath, args.serviceTable)
136 from ROOTutils
import ROOT
143 code.interact(local=dict(globals(), **locals()))
def loadSBNDgeometry
Geometry.