Belle II Software development
QcsmonitorCreator Class Reference

The creator for the QCSMONITOR geometry. More...

#include <QcsmonitorCreator.h>

Inheritance diagram for QcsmonitorCreator:
CreatorBase

Public Member Functions

 QcsmonitorCreator ()
 Constructor.
 
virtual ~QcsmonitorCreator ()
 Destructor.
 
virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
 Creation of the detector geometry from Gearbox (XML).
 
 BELLE2_DEFINE_EXCEPTION (DBNotImplemented, "Cannot create geometry from Database.")
 Exception that will be thrown in createFromDB if member is not yet implemented by creator.
 
virtual void createFromDB (const std::string &name, G4LogicalVolume &topVolume, GeometryTypes type)
 Function to create the geometry from the Database.
 
virtual void createPayloads (const GearDir &content, const IntervalOfValidity &iov)
 Function to create the geometry database.
 

Protected Attributes

SensitiveDetectorm_sensitive
 SensitiveDetector QCSMONITOR.
 

Detailed Description

The creator for the QCSMONITOR geometry.

Definition at line 27 of file QcsmonitorCreator.h.

Constructor & Destructor Documentation

◆ QcsmonitorCreator()

Constructor.

Definition at line 48 of file QcsmonitorCreator.cc.

48 : m_sensitive(0)
49 {
50 //m_sensitive = new SensitiveDetector();
51 }
SensitiveDetector * m_sensitive
SensitiveDetector QCSMONITOR.

◆ ~QcsmonitorCreator()

~QcsmonitorCreator ( )
virtual

Destructor.

Definition at line 53 of file QcsmonitorCreator.cc.

54 {
55 if (m_sensitive) delete m_sensitive;
56 }

Member Function Documentation

◆ create()

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

Creation of the detector geometry from Gearbox (XML).

Parameters
[in]contentXML data directory.
[in]topVolumeGeant world volume.
[in]typeGeometry type.

Implements CreatorBase.

Definition at line 58 of file QcsmonitorCreator.cc.

59 {
60
62
63 //lets get the stepsize parameter with a default value of 5 µm
64 double stepSize = content.getLength("stepSize", 5 * CLHEP::um);
65
66 G4VisAttributes* red = new G4VisAttributes(G4Colour(1, 0, 0));
67 red->SetForceAuxEdgeVisible(true);
68 G4VisAttributes* green = new G4VisAttributes(G4Colour(0, 1, 0));
69 green->SetForceAuxEdgeVisible(true);
70 G4VisAttributes* gray = new G4VisAttributes(G4Colour(.5, .5, .5));
71 gray->SetForceAuxEdgeVisible(true);
72 G4VisAttributes* coppercolor = new G4VisAttributes(G4Colour(218. / 255., 138. / 255., 103. / 255.));
73 coppercolor->SetForceAuxEdgeVisible(true);
74
75 //Lets loop over all the Active nodes
76 BOOST_FOREACH(const GearDir & activeParams, content.getNodes("Active")) {
77 int phase = activeParams.getInt("phase");
78 G4double dx_scint = activeParams.getLength("dx_scint") / 2.*CLHEP::cm;
79 G4double dy_scint = activeParams.getLength("dy_scint") / 2.*CLHEP::cm;
80 G4double dz_scint = activeParams.getLength("dz_scint") / 2.*CLHEP::cm;
81 double thetaZ = activeParams.getAngle("ThetaZ");
82 G4VSolid* s_scint = new G4Box("s_scint", dx_scint, dy_scint, dz_scint);
83 G4LogicalVolume* l_scint = new G4LogicalVolume(s_scint, geometry::Materials::get("G4_POLYSTYRENE"), "l_scint", 0, m_sensitive);
84 l_scint->SetVisAttributes(green);
85 //Lets limit the Geant4 stepsize inside the volume
86 l_scint->SetUserLimits(new G4UserLimits(stepSize));
87 double x_pos[100];
88 double y_pos[100];
89 double z_pos[100];
90 double r_pos[100];
91 int dim = 0;
92 if (phase == 1) {
93 dim = 0;
94 for (double x : activeParams.getArray("x", {0})) {
95 x *= CLHEP::cm;
96 x_pos[dim] = x;
97 dim++;
98 }
99 dim = 0;
100 for (double y : activeParams.getArray("y", {0})) {
101 y *= CLHEP::cm;
102 y_pos[dim] = y;
103 dim++;
104 }
105 }
106 dim = 0;
107 for (double z : activeParams.getArray("z", {0})) {
108 z *= CLHEP::cm;
109 z_pos[dim] = z;
110 //cout << "QCSS z " << z << " zpos " << z_pos[dim] << endl;
111 if (phase == 1) {
112 r_pos[dim] = sqrt(x_pos[dim] * x_pos[dim] + y_pos[dim] * y_pos[dim]);
113 }
114 dim++;
115 }
116 //if (phase == 1) dim = 1;
117 if (phase == 2) {
118 dim = 0;
119 for (double r : activeParams.getArray("r", {0})) {
120 r *= CLHEP::cm;
121 r_pos[dim] = r + dz_scint;
122 dim++;
123 }
124 for (int i = 0; i < 100; i++) {
125 x_pos[i] = 0;
126 y_pos[i] = 0;
127 //x_off[i] = 0;
128 //y_off[i] = 0;
129 }
130 }
131 int detID = 0;
132 G4Transform3D transform;
133 for (double phi : activeParams.getArray("Phi", {M_PI / 2})) {
134 //phi *= CLHEP::deg;
135 for (int i = 0; i < dim; i++) {
136 if (phase == 2) {
137 transform = G4RotateZ3D(phi - M_PI / 2) * G4Translate3D(0, r_pos[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ);
138 //cout << "phase 2" << endl;
139 }
140 if (phase == 1) {
141 transform = G4Translate3D(x_pos[i], y_pos[i], z_pos[i]) * G4RotateZ3D(phi) * G4RotateX3D(thetaZ);
142 //cout << "phase 1" << endl;
143 }
144 //cout << "QCS r " << r_pos[i] << " width " << dz_scint << " z " << z_pos[i] << " phi " << phi << " x " << x_pos[i] << " y " <<
145 // y_pos[i] << endl;
146 new G4PVPlacement(transform, l_scint, TString::Format("p_scint_%d", detID).Data(), &topVolume, false, detID);
147 B2INFO("QCSS-" << detID << " placed at: " << transform.getTranslation() << " mm ");
148 //cout << " Nb of detector " << detID << endl;
149 detID++;
150 }
151 }
152 }
153 }
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:63
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
VXD::SensitiveDetector< PXDSimHit, PXDTrueHit > SensitiveDetector
The PXD Sensitive Detector class.

◆ createFromDB()

void createFromDB ( const std::string &  name,
G4LogicalVolume &  topVolume,
GeometryTypes  type 
)
virtualinherited

Function to create the geometry from the Database.

Parameters
namename of the component in the database, could be used to disambiguate multiple components created with the same creator
topVolumeTop volume in which the geometry has to be placed
typeType of geometry to be build

Reimplemented in GeoMagneticField, GeoARICHCreator, BeamabortCreator, GeoCDCCreator, GeoCDCCreatorReducedCDC, GeoECLCreator, MyDBCreator, GeoBeamPipeCreator, GeoCryostatCreator, GeoFarBeamLineCreator, GeoBKLMCreator, GeoEKLMCreator, GeoKLMCreator, GeoPXDCreator, GeoCOILCreator, GeoServiceMaterialCreator, GeoSTRCreator, GeoSVDCreator, GeoTOPCreator, GeoHeavyMetalShieldCreator, and GeoVXDServiceCreator.

Definition at line 17 of file CreatorBase.cc.

18 {
19 //Do nothing but raise exception that we don't do anything
20 throw DBNotImplemented();
21 }

◆ createPayloads()

void createPayloads ( const GearDir content,
const IntervalOfValidity iov 
)
virtualinherited

Function to create the geometry database.

This function should be implemented to convert Gearbox parameters to one ore more database payloads

Parameters
contentGearDir pointing to the parameters which should be used for construction
iovinterval of validity to use when generating payloads

Reimplemented in GeoARICHCreator, BeamabortCreator, GeoCDCCreator, GeoCDCCreatorReducedCDC, GeoECLCreator, GeoMagneticField, MyDBCreator, GeoBeamPipeCreator, GeoCryostatCreator, GeoFarBeamLineCreator, GeoBKLMCreator, GeoEKLMCreator, GeoKLMCreator, GeoPXDCreator, GeoCOILCreator, GeoServiceMaterialCreator, GeoSTRCreator, GeoSVDCreator, GeoTOPCreator, GeoHeavyMetalShieldCreator, and GeoVXDServiceCreator.

Definition at line 24 of file CreatorBase.cc.

24{}

Member Data Documentation

◆ m_sensitive

SensitiveDetector* m_sensitive
protected

SensitiveDetector QCSMONITOR.

Definition at line 46 of file QcsmonitorCreator.h.


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