Belle II Software development
BeamabortCreator Class Reference

The creator for the BEAMABORT geometry. More...

#include <BeamabortCreator.h>

Inheritance diagram for BeamabortCreator:
CreatorBase

Public Member Functions

 BeamabortCreator ()
 Constructor.
 
virtual ~BeamabortCreator ()
 Destructor.
 
virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type) override
 Creates the ROOT Objects for the BeamPipe geometry.
 
virtual void createPayloads (const GearDir &content, const IntervalOfValidity &iov) override
 creates DB payload for BeamabortGeo class
 
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.
 

Protected Attributes

BeamabortGeo m_config
 geometry parameters object
 

Private Member Functions

BeamabortGeo createConfiguration (const GearDir &param)
 Reads beamabort geometry parameters from the xml files and createst DB class BeamabortGeo.
 
void createGeometry (G4LogicalVolume &topVolume, geometry::GeometryTypes type)
 Create detector geometry.
 

Detailed Description

The creator for the BEAMABORT geometry.

Definition at line 30 of file BeamabortCreator.h.

Constructor & Destructor Documentation

◆ BeamabortCreator()

Constructor.

Definition at line 47 of file BeamabortCreator.cc.

48 {}

◆ ~BeamabortCreator()

~BeamabortCreator ( )
virtual

Destructor.

Definition at line 50 of file BeamabortCreator.cc.

51 {}

Member Function Documentation

◆ create()

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

Creates the ROOT Objects for the BeamPipe geometry.

Parameters
contentA reference to the content part of the parameter description, which should to be used to create the ROOT objects.
topVolumeGeant4 logical top volume.
typeGeometry type.

Implements CreatorBase.

Definition at line 65 of file BeamabortCreator.h.

66 {
68
69 // override geometry configuration from the DB
70 DBStore::Instance().addConstantOverride("BeamabortGeo", new BeamabortGeo(m_config));
71
72 createGeometry(topVolume, type);
73 }
void createGeometry(G4LogicalVolume &topVolume, geometry::GeometryTypes type)
Create detector 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.
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

◆ createConfiguration()

BeamabortGeo createConfiguration ( const GearDir param)
inlineprivate

Reads beamabort geometry parameters from the xml files and createst DB class BeamabortGeo.

Definition at line 33 of file BeamabortCreator.h.

34 {
35 BeamabortGeo BeamabortGeoConfig;
36 BeamabortGeoConfig.initialize(param);
37 return BeamabortGeoConfig;
38 }

◆ 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 84 of file BeamabortCreator.h.

85 {
86 DBObjPtr<BeamabortGeo> dbObj;
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 }

◆ createGeometry()

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

Create detector geometry.

Parameters
topVolumeGeant4 logical top volume.
typeGeometry type.

Definition at line 53 of file BeamabortCreator.cc.

54 {
55 //get parameters from .xml file
56 std::string prep = "Active.";
57
58 B2INFO("BeamabortCreator phase3");
59 //Visualization Attributes
60 G4VisAttributes* orange = new G4VisAttributes(G4Colour(1, 2, 0));
61 orange->SetForceAuxEdgeVisible(true);
62 G4VisAttributes* magenta = new G4VisAttributes(G4Colour(1, 0, 1));
63 magenta->SetForceAuxEdgeVisible(true);
64 //lets get the stepsize parameter with a default value of 5 µm
65 double stepSize = m_config.getParameter("stepSize", 5 * CLHEP::um);
66
67 //Lets loop over all the Active nodes
68 int phase = m_config.getParameter(prep + "phase");
69 //Positioned Diamonds
70 std::vector<double> x_pos;
71 std::vector<double> y_pos;
72 std::vector<double> z_pos;
73 std::vector<double> phi;
74 std::vector<double> thetaX;
75 std::vector<double> thetaY;
76 std::vector<double> thetaZ;
77 std::vector<double> svdAngle;
78 std::vector<double> r;
79 std::vector<double> deltaX;
80 unsigned int dimz = 0;
81
82 for (double z : m_config.getParArray(prep + "z", {0})) {
83 z *= CLHEP::cm;
84 z_pos.push_back(z);
85 dimz++;
86 }
87
88 for (double ThetaZ : m_config.getParArray(prep + "ThetaZ", {0})) {
89 thetaZ.push_back(ThetaZ);
90 }
91
92 if (thetaZ.size() != dimz) { B2ERROR("Diamond data not consistent (i.e. not same number of all position parameters)"); return;}
93
94 if (phase == 2 || phase == 3) {
95
96 for (double Phi : m_config.getParArray(prep + "Phi", {0})) {
97 phi.push_back(Phi);
98 }
99
100 for (double r_dia : m_config.getParArray(prep + "r_dia", {0})) {
101 r_dia *= CLHEP::cm;
102 r.push_back(r_dia);
103 }
104 for (double dX : m_config.getParArray(prep + "deltaX", {0})) {
105 dX *= CLHEP::cm;
106 deltaX.push_back(dX);
107 }
108 for (double addAngle : m_config.getParArray(prep + "addAngle", {0})) {
109 svdAngle.push_back(addAngle);
110 }
111 if (phi.size() != dimz || r.size() != dimz || deltaX.size() != dimz || svdAngle.size() != dimz) { B2ERROR("Diamond data not consistent (i.e. not same number of all position parameters)"); return;}
112 }
113 if (phase == 1) {
114 for (double x : m_config.getParArray(prep + "x", {0})) {
115 x *= CLHEP::cm;
116 x_pos.push_back(x);
117 }
118 for (double y : m_config.getParArray(prep + "y", {0})) {
119 y *= CLHEP::cm;
120 y_pos.push_back(y);
121 }
122
123 for (double ThetaX : m_config.getParArray(prep + "ThetaX", {0})) {
124 thetaX.push_back(ThetaX);
125 }
126 for (double ThetaY : m_config.getParArray(prep + "ThetaY", {0})) {
127 thetaY.push_back(ThetaY);
128 }
129 if (x_pos.size() != dimz || y_pos.size() != dimz || thetaX.size() != dimz || thetaY.size() != dimz) { B2ERROR("Diamond data not consistent (i.e. not same number of all position parameters)"); return;}
130 }
131
132 //create beamabort package
133 G4double dx_opa = 12. / 2. * CLHEP::mm;
134 G4double dy_opa = 18. / 2. * CLHEP::mm;
135 G4double dz_opa = 3.1 / 2. * CLHEP::mm;
136 G4VSolid* s_pa = new G4Box("s_opa", dx_opa, dy_opa, dz_opa);
137 G4double dx_ipa = 6. / 2. * CLHEP::mm;
138 G4double dy_ipa = 6. / 2. * CLHEP::mm;
139 G4double dz_ipa = 5.6 / 2. * CLHEP::mm;
140 G4VSolid* s_ipa = new G4Box("s_ipa", dx_ipa, dy_ipa, dz_ipa);
141 s_pa = new G4SubtractionSolid("s_pa", s_pa, s_ipa, 0, G4ThreeVector(0., 4.0, 0.));
142 G4LogicalVolume* l_pa = new G4LogicalVolume(s_pa, G4Material::GetMaterial("Al6061"), "l_pa");
143 l_pa->SetVisAttributes(magenta);
144 G4Transform3D transform;
145 for (unsigned int i = 0; i < dimz; i++) {
146 B2INFO("DIA-" << i << "RotateZ3D phi: " << phi[i]);
147
148 if (phase == 1) {
149 transform = G4Translate3D(x_pos[i], y_pos[i], z_pos[i]) * G4RotateX3D(thetaX[i]) *
150 G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]);
151 } else if (phase == 2 || phase == 3) {
152 transform = G4Translate3D(deltaX[i], 0, 0) * G4RotateZ3D(phi[i]) *
153 G4Translate3D(r[i], 0, z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
154 G4RotateZ3D(svdAngle[i]) * G4RotateY3D(M_PI / 2);
155 }
156 new G4PVPlacement(transform, l_pa, TString::Format("p_dia_pa_%d", i).Data(), &topVolume, false, 0);
157 B2INFO("DIA-" << i << " placed at: " << transform.getTranslation() << " mm ");
158 }
159
160 //create beamabort volumes
161 G4double dx_ba = 4.5 / 2. * CLHEP::mm;
162 G4double dy_ba = 4.5 / 2. * CLHEP::mm;
163 G4double dz_ba = 0.5 / 2. * CLHEP::mm;
164 G4Box* s_BEAMABORT = new G4Box("s_BEAMABORT", dx_ba, dy_ba, dz_ba);
165 G4LogicalVolume* l_BEAMABORT = new G4LogicalVolume(s_BEAMABORT, geometry::Materials::get("Diamond"), "l_BEAMABORT");
166 l_BEAMABORT->SetVisAttributes(orange);
167
168 //Lets limit the Geant4 stepsize inside the volume
169 l_BEAMABORT->SetUserLimits(new G4UserLimits(stepSize));
170 l_BEAMABORT->SetVisAttributes(orange);
171
172 // make the volume sensitive if the beam background study flag is enabled
173 if (m_config.getParameter("BeamBackgroundStudy")) l_BEAMABORT->SetSensitiveDetector(new SensitiveDetector());
174
175 for (unsigned int i = 0; i < dimz; i++) {
176
177 if (phase == 1)
178 transform = G4Translate3D(x_pos[i], y_pos[i],
179 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]);
180 if (phase == 2 || phase == 3)
181 transform = G4Translate3D(deltaX[i], 0, 0) * G4RotateZ3D(phi[i]) *
182 G4Translate3D(r[i], 0, z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
183 G4RotateZ3D(svdAngle[i]) * G4RotateY3D(M_PI / 2) * G4Translate3D(0, 4.2, 0);
184
185 new G4PVPlacement(transform, l_BEAMABORT, TString::Format("p_dia_%d", i).Data(), &topVolume, false, i);
186
187 B2INFO("DIA-sensitive volume-" << i << " placed at: " << transform.getTranslation() << " mm "
188 << " at phi angle = " << phi[i] << " at theta angle = "
189 << thetaZ[i]);
190 B2INFO("DIA-sensitive volume-" << i << " G4RotateZ3D of: phi= " << phi[i] << " G4RotateX3D = "
191 << (-M_PI / 2 - thetaZ[i]));
192 }
193 }
std::vector< double > getParArray(const std::string &name) const
Get parameter value array.
Definition: BeamabortGeo.h:64
double getParameter(const std::string &name) const
Get parameter value.
Definition: BeamabortGeo.h:41
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:63
VXD::SensitiveDetector< PXDSimHit, PXDTrueHit > SensitiveDetector
The PXD Sensitive Detector class.

◆ createPayloads()

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

creates DB payload for BeamabortGeo class

Reimplemented from CreatorBase.

Definition at line 76 of file BeamabortCreator.h.

77 {
78 DBImportObjPtr<BeamabortGeo> importObj;
79 importObj.construct(createConfiguration(content));
80 importObj.import(iov);
81 }

Member Data Documentation

◆ m_config

BeamabortGeo m_config
protected

geometry parameters object

Definition at line 96 of file BeamabortCreator.h.


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