Belle II Software development
MyDBCreator Class Reference

Very simple Creator class which actually does not do anything but shows how creators should implement loading the geometry from database. More...

Inheritance diagram for MyDBCreator:
CreatorBase

Public Member Functions

virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 The old create member: create the configuration object(s) on the fly and call the geometry creation routine.
 
virtual void createPayloads (const GearDir &content, const IntervalOfValidity &iov) override
 Create the configuration objects and save them in the Database.
 
virtual void createFromDB (const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 Create the geometry from the Database.
 
 BELLE2_DEFINE_EXCEPTION (DBNotImplemented, "Cannot create geometry from Database.")
 Exception that will be thrown in createFromDB if member is not yet implemented by creator.
 

Private Member Functions

MyDBPayloadClass createConfiguration (const GearDir &param)
 Create a parameter object from the Gearbox XML parameters.
 
void createGeometry (const MyDBPayloadClass &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
 Create the geometry from a parameter object.
 

Detailed Description

Very simple Creator class which actually does not do anything but shows how creators should implement loading the geometry from database.

Definition at line 57 of file DBCreatorExample.cc.

Member Function Documentation

◆ create()

virtual void create ( const GearDir content,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
inlineoverridevirtual

The old create member: create the configuration object(s) on the fly and call the geometry creation routine.

If more than one object is needed adjust accordingly

Implements CreatorBase.

Definition at line 71 of file DBCreatorExample.cc.

72 {
73 MyDBPayloadClass config = createConfiguration(content);
74 createGeometry(config, topVolume, type);
75 }
void createGeometry(const MyDBPayloadClass &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
MyDBPayloadClass createConfiguration(const GearDir &param)
Create a parameter object from the Gearbox XML parameters.

◆ createConfiguration()

MyDBPayloadClass createConfiguration ( const GearDir param)
private

Create a parameter object from the Gearbox XML parameters.

If more than one object is created these could be assigned to members or you could return a tuple.

◆ createFromDB()

virtual void createFromDB ( const std::string &  name,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
inlineoverridevirtual

Create the geometry from the Database.

Reimplemented from CreatorBase.

Definition at line 87 of file DBCreatorExample.cc.

88 {
89 DBObjPtr<MyDBPayloadClass> dbObj;
90 if (!dbObj) {
91 // Check that we found the object and if not report the problem
92 B2FATAL("No configuration for " << name << " found.");
93 }
94 createGeometry(*dbObj, topVolume, type);
95 }

◆ createGeometry()

void createGeometry ( const MyDBPayloadClass parameters,
G4LogicalVolume &  topVolume,
geometry::GeometryTypes  type 
)
private

Create the geometry from a parameter object.

If more than one object is needed these could instead be taken from member variables or the number of parameters could be increased.

◆ createPayloads()

virtual void createPayloads ( const GearDir content,
const IntervalOfValidity iov 
)
inlineoverridevirtual

Create the configuration objects and save them in the Database.

If more than one object is needed adjust accordingly

Reimplemented from CreatorBase.

Definition at line 79 of file DBCreatorExample.cc.

80 {
81 DBImportObjPtr<MyDBPayloadClass> importObj;
82 importObj.construct(createConfiguration(content));
83 importObj.import(iov);
84 }

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