Belle II Software  release-05-01-25
GeoBeamPipeCreator.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Luka Santelj *
7  * *
8  * *
9  * This software is provided "as is" without any warranty. *
10  **************************************************************************/
11 
12 #pragma once
13 
14 #include <geometry/CreatorBase.h>
15 #include <framework/gearbox/GearDir.h>
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 #include <ir/dbobjects/BeamPipeGeo.h>
21 #include <string>
22 #include <vector>
23 
24 class G4LogicalVolume;
25 
26 namespace Belle2 {
31  namespace ir {
32  class SensitiveDetector;
33 
36 
37  private:
40  {
41  BeamPipeGeo BeamPipeGeoConfig;
42  BeamPipeGeoConfig.initialize(param);
43  return BeamPipeGeoConfig;
44  }
45 
47  void createGeometry(G4LogicalVolume& topVolume, geometry::GeometryTypes type);
48 
49 
50  public:
51 
54 
56  virtual ~GeoBeamPipeCreator();
57 
64  virtual void create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
65  {
66  m_config = createConfiguration(content);
67 
68  // override geometry configuration from the DB
70 
71  createGeometry(topVolume, type);
72  }
73 
75  virtual void createPayloads(const GearDir& content, const IntervalOfValidity& iov) override
76  {
78  importObj.construct(createConfiguration(content));
79  importObj.import(iov);
80  }
81 
83  virtual void createFromDB(const std::string& name, G4LogicalVolume& topVolume, geometry::GeometryTypes type) override
84  {
86  if (!dbObj) {
87  // Check that we found the object and if not report the problem
88  B2FATAL("No configuration for " << name << " found.");
89  }
90  m_config = *dbObj;
91  createGeometry(topVolume, type);
92  }
93 
94  protected:
96  std::vector<SensitiveDetector*> m_sensitive;
97 
99  };
100 
101  }
103 }
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::ir::GeoBeamPipeCreator
The creator for the BeamPipe geometry of the Belle II detector.
Definition: GeoBeamPipeCreator.h:35
Belle2::ir::GeoBeamPipeCreator::createPayloads
virtual void createPayloads(const GearDir &content, const IntervalOfValidity &iov) override
creates DB payload for BeamPipeGeo class
Definition: GeoBeamPipeCreator.h:75
Belle2::DBStore::addConstantOverride
void addConstantOverride(const std::string &name, TObject *obj, bool oneRun=false)
Add constant override payload.
Definition: DBStore.cc:204
Belle2::ir::GeoBeamPipeCreator::createFromDB
virtual void createFromDB(const std::string &name, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Create the geometry from the Database.
Definition: GeoBeamPipeCreator.h:83
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::ir::GeoBeamPipeCreator::~GeoBeamPipeCreator
virtual ~GeoBeamPipeCreator()
The destructor of the GeoBeamPipeCreator class.
Definition: GeoBeamPipeCreator.cc:64
Belle2::ir::GeoBeamPipeCreator::createConfiguration
BeamPipeGeo createConfiguration(const GearDir &param)
Reads IR geometry parameters from the xml files and createst DB class BeamPipeGeo.
Definition: GeoBeamPipeCreator.h:39
Belle2::BeamPipeGeo::initialize
void initialize(const GearDir &content)
Initialze from the gearbox (xml file)
Definition: BeamPipeGeo.cc:17
Belle2::DBObjPtr
Class for accessing objects in the database.
Definition: DBObjPtr.h:31
Belle2::ir::GeoBeamPipeCreator::createGeometry
void createGeometry(G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create detector geometry.
Definition: GeoBeamPipeCreator.cc:73
Belle2::ir::GeoBeamPipeCreator::create
virtual void create(const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
Creates the ROOT Objects for the BeamPipe geometry.
Definition: GeoBeamPipeCreator.h:64
Belle2::ir::GeoBeamPipeCreator::m_config
BeamPipeGeo m_config
geometry parameters object
Definition: GeoBeamPipeCreator.h:98
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::DBStore::Instance
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:36
Belle2::BeamPipeGeo
Geometry parameters of BeamPipe.
Definition: BeamPipeGeo.h:33
Belle2::ir::GeoBeamPipeCreator::m_sensitive
std::vector< SensitiveDetector * > m_sensitive
Sensitive detector.
Definition: GeoBeamPipeCreator.h:96
Belle2::geometry::CreatorBase
Pure virtual base class for all geometry creators.
Definition: CreatorBase.h:31
Belle2::PXD::SensitiveDetector
VXD::SensitiveDetector< PXDSimHit, PXDTrueHit > SensitiveDetector
The PXD Sensitive Detector class.
Definition: SensitiveDetector.h:36
Belle2::ir::GeoBeamPipeCreator::GeoBeamPipeCreator
GeoBeamPipeCreator()
Constructor of the GeoBeamPipeCreator class.
Definition: GeoBeamPipeCreator.cc:60
Belle2::geometry::GeometryTypes
GeometryTypes
Flag indiciating the type of geometry to be used.
Definition: GeometryManager.h:39