Belle II Software development
BeamabortCreator.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <geometry/CreatorBase.h>
12#include <framework/gearbox/GearDir.h>
13#include <framework/logging/Logger.h>
14#include <framework/database/DBObjPtr.h>
15#include <framework/database/DBImportObjPtr.h>
16#include <framework/database/IntervalOfValidity.h>
17#include <beast/beamabort/dbobjects/BeamabortGeo.h>
18
19class G4LogicalVolume;
20
21namespace Belle2 {
27 namespace beamabort {
28
31 private:
34 {
35 BeamabortGeo BeamabortGeoConfig;
36 BeamabortGeoConfig.initialize(param);
37 return BeamabortGeoConfig;
38 }
39
45 void createGeometry(G4LogicalVolume& topVolume, geometry::GeometryTypes type);
46
47 public:
52
56 virtual ~BeamabortCreator();
65 virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
66 {
68
69 // override geometry configuration from the DB
71
72 createGeometry(topVolume, type);
73 }
74
76 virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
77 {
79 importObj.construct(createConfiguration(content));
80 importObj.import(iov);
81 }
82
84 virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
85 {
87 if (!dbObj) {
88 // Check that we found the object and if not report the problem
89 B2FATAL("No configuration for " << name << " found.");
90 }
91 m_config = *dbObj;
92 createGeometry(topVolume, type);
93 }
94
95 protected:
97 };
98
99 }
101}
Geometry parameters of Beamabort.
Definition: BeamabortGeo.h:27
void initialize(const GearDir &content)
Initialize from the gearbox (xml file)
Definition: BeamabortGeo.cc:13
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:36
Class for importing a single object to the database.
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:31
A class that describes the interval of experiments/runs for which an object in the database is valid.
The creator for the BEAMABORT geometry.
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
creates DB payload for BeamabortGeo class
void createGeometry(G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create detector geometry.
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creates the ROOT Objects for the BeamPipe geometry.
BeamabortGeo m_config
geometry parameters object
BeamabortGeo createConfiguration(const GearDir &param)
Reads beamabort geometry parameters from the xml files and createst DB class BeamabortGeo.
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:28
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:26
void addConstantOverride(const std::string &name, TObject *obj, bool oneRun=false)
Add constant override payload.
Definition: DBStore.cc:202
GeometryTypes
Flag indicating the type of geometry to be used.
Abstract base class for different kinds of events.