Belle II Software development
GeoServiceMaterialCreator.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#ifndef GEOSERVICEMATERIALCREATOR_H
10#define GEOSERVICEMATERIALCREATOR_H
11
12#include <geometry/CreatorBase.h>
13
14#include <framework/logging/Logger.h>
15#include <framework/database/DBObjPtr.h>
16#include <framework/database/DBImportObjPtr.h>
17#include <framework/database/IntervalOfValidity.h>
18
19#include <structure/dbobjects/ServiceGapsMaterialsPar.h>
20
21class G4Material;
22
23namespace Belle2 {
29 namespace structure {
30
33 private:
36
38 void createGeometry(const ServiceGapsMaterialsPar& parameters, G4LogicalVolume& topVolume, geometry::GeometryTypes type);
39
41 void createBEAST2Material(const ServiceGapsMaterialsPar& parameters, G4LogicalVolume*& logical_gap);
42
44 void createTube(const double rmin, const double rmax,
45 const double SPhi, const double DPhi,
46 const double thick, const double posZ,
47 G4Material* med, const std::string& name, G4LogicalVolume*& top);
48
50 void createCone(const double rmin1, const double rmax1,
51 const double rmin2, const double rmax2,
52 const double thick, const double SPhi, const double DPhi, const double posz,
53 G4Material* med, const std::string& name, G4LogicalVolume*& top);
54
55 public:
58
59
62 virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
63 {
65 createGeometry(config, topVolume, type);
66 }
67
70 virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
71 {
73 importObj.construct(createConfiguration(content));
74 importObj.import(iov);
75 }
76
78 virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
79 {
81 if (!dbObj) {
82 // Check that we found the object and if not report the problem
83 B2FATAL("No configuration for " << name << " found.");
84 }
85 createGeometry(*dbObj, topVolume, type);
86 }
87
88 private:
89
91 G4Material* m_defaultMaterial {0};
92
93
94 };
95 } // namespace structure
97} //namespace Belle2
98
99#endif /* GEOSERVICEMATERIALCREATOR_H */
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 Class for services materials geometry.
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:28
The creator for the Service Material geometry of the Belle II detector.
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Create the configuration objects and save them in the Database.
GeoServiceMaterialCreator()=default
Default constructor is sufficient in this case.
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 r...
ServiceGapsMaterialsPar createConfiguration(const GearDir &param)
Create a parameter object from the Gearbox XML parameters.
void createTube(const double rmin, const double rmax, const double SPhi, const double DPhi, const double thick, const double posZ, G4Material *med, const std::string &name, G4LogicalVolume *&top)
Create G4Tube.
void createGeometry(const ServiceGapsMaterialsPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
void createBEAST2Material(const ServiceGapsMaterialsPar &parameters, G4LogicalVolume *&logical_gap)
Create BEAST2 Material between CDC and ECL from a parameter object.
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
void createCone(const double rmin1, const double rmax1, const double rmin2, const double rmax2, const double thick, const double SPhi, const double DPhi, const double posz, G4Material *med, const std::string &name, G4LogicalVolume *&top)
Create G4Cone.
G4Material * m_defaultMaterial
Default Material, inherited from topVolume.
GeometryTypes
Flag indiciating the type of geometry to be used.
Abstract base class for different kinds of events.