Belle II Software  release-05-02-19
GeoServiceMaterialCreator.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Yu Hu and Torben Ferber *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #ifndef GEOSERVICEMATERIALCREATOR_H
12 #define GEOSERVICEMATERIALCREATOR_H
13 
14 #include <geometry/CreatorBase.h>
15 
16 #include <framework/logging/Logger.h>
17 #include <framework/database/DBObjPtr.h>
18 #include <framework/database/DBImportObjPtr.h>
19 #include <framework/database/IntervalOfValidity.h>
20 
21 #include <structure/dbobjects/ServiceGapsMaterialsPar.h>
22 
23 class G4Material;
24 
25 namespace Belle2 {
31  namespace structure {
32 
35  private:
38 
40  void createGeometry(const ServiceGapsMaterialsPar& parameters, G4LogicalVolume& topVolume, geometry::GeometryTypes type);
41 
43  void createBEAST2Material(const ServiceGapsMaterialsPar& parameters, G4LogicalVolume*& logical_gap);
44 
46  void createTube(const double rmin, const double rmax,
47  const double SPhi, const double DPhi,
48  const double thick, const double posZ,
49  G4Material* med, const std::string& name, G4LogicalVolume*& top);
50 
52  void createCone(const double rmin1, const double rmax1,
53  const double rmin2, const double rmax2,
54  const double thick, const double SPhi, const double DPhi, const double posz,
55  G4Material* med, const std::string& name, G4LogicalVolume*& top);
56 
57  public:
59  GeoServiceMaterialCreator() = default;
60 
61 
64  virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
65  {
67  createGeometry(config, topVolume, type);
68  }
69 
72  virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
73  {
75  importObj.construct(createConfiguration(content));
76  importObj.import(iov);
77  }
78 
80  virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
81  {
83  if (!dbObj) {
84  // Check that we found the object and if not report the problem
85  B2FATAL("No configuration for " << name << " found.");
86  }
87  createGeometry(*dbObj, topVolume, type);
88  }
89 
90  private:
91 
93  G4Material* m_defaultMaterial {0};
94 
95 
96  };
97  } // namespace structure
99 } //namespace Belle2
100 
101 #endif /* GEOSERVICEMATERIALCREATOR_H */
Belle2::IntervalOfValidity
A class that describes the interval of experiments/runs for which an object in the database is valid.
Definition: IntervalOfValidity.h:35
Belle2::structure::GeoServiceMaterialCreator::GeoServiceMaterialCreator
GeoServiceMaterialCreator()=default
Default constructor is sufficient in this case.
Belle2::structure::GeoServiceMaterialCreator::create
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...
Definition: GeoServiceMaterialCreator.h:64
Belle2::structure::GeoServiceMaterialCreator::m_defaultMaterial
G4Material * m_defaultMaterial
Default Material, inherited from topVolume.
Definition: GeoServiceMaterialCreator.h:93
Belle2::ServiceGapsMaterialsPar
The Class for services materials geometry.
Definition: ServiceGapsMaterialsPar.h:279
Belle2::DBImportObjPtr::construct
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
Definition: DBImportObjPtr.h:57
Belle2::DBImportBase::import
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:38
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::structure::GeoServiceMaterialCreator::createFromDB
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
Definition: GeoServiceMaterialCreator.h:80
Belle2::structure::GeoServiceMaterialCreator::createConfiguration
ServiceGapsMaterialsPar createConfiguration(const GearDir &param)
Create a parameter object from the Gearbox XML parameters.
Definition: GeoServiceMaterialCreator.cc:44
Belle2::structure::GeoServiceMaterialCreator::createCone
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.
Definition: GeoServiceMaterialCreator.cc:399
Belle2::structure::GeoServiceMaterialCreator::createGeometry
void createGeometry(const ServiceGapsMaterialsPar &parameters, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create the geometry from a parameter object.
Definition: GeoServiceMaterialCreator.cc:152
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::GearDir
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:41
Belle2::DBImportObjPtr
Class for importing a single object to the database.
Definition: DBImportObjPtr.h:33
Belle2::structure::GeoServiceMaterialCreator::createTube
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.
Definition: GeoServiceMaterialCreator.cc:386
Belle2::structure::GeoServiceMaterialCreator::createPayloads
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
Create the configuration objects and save them in the Database.
Definition: GeoServiceMaterialCreator.h:72
Belle2::geometry::CreatorBase
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:31
Belle2::structure::GeoServiceMaterialCreator::createBEAST2Material
void createBEAST2Material(const ServiceGapsMaterialsPar &parameters, G4LogicalVolume *&logical_gap)
Create BEAST2 Material between CDC and ECL from a parameter object.
Belle2::geometry::GeometryTypes
GeometryTypes
Flag indiciating the type of geometry to be used.
Definition: GeometryManager.h:39
Belle2::structure::GeoServiceMaterialCreator
The creator for the Service Material geometry of the Belle II detector.
Definition: GeoServiceMaterialCreator.h:34