Belle II Software  release-05-01-25
ClawCreator Class Reference

The creator for the CLAW geometry. More...

#include <ClawCreator.h>

Inheritance diagram for ClawCreator:
Collaboration diagram for ClawCreator:

Public Member Functions

virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
 Function to actually create the geometry, has to be overridden by derived classes. More...
 
 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. More...
 
virtual void createPayloads (const GearDir &content, const IntervalOfValidity &iov)
 Function to create the geometry database. More...
 

Protected Attributes

SensitiveDetectorm_sensitive
 SensitiveDetector CLAW.
 

Detailed Description

The creator for the CLAW geometry.

Definition at line 29 of file ClawCreator.h.

Member Function Documentation

◆ create()

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

Function to actually create the geometry, has to be overridden by derived classes.

Parameters
contentGearDir pointing to the parameters which should be used for construction
topVolumeTop volume in which the geometry has to be placed
typeType of geometry to be build

Implements CreatorBase.

Definition at line 60 of file ClawCreator.cc.

61  {
62  //lets get the stepsize parameter with a default value of 5 µm
63  double stepSize = content.getLength("stepSize", 5 * CLHEP::um);
64 
65  G4VisAttributes* red = new G4VisAttributes(G4Colour(1, 0, 0));
66  red->SetForceAuxEdgeVisible(true);
67  G4VisAttributes* green = new G4VisAttributes(G4Colour(0, 1, 0));
68  green->SetForceAuxEdgeVisible(true);
69  G4VisAttributes* gray = new G4VisAttributes(G4Colour(.5, .5, .5));
70  gray->SetForceAuxEdgeVisible(true);
71 
72  G4VisAttributes* coppercolor = new G4VisAttributes(G4Colour(218. / 255., 138. / 255., 103. / 255.));
73  coppercolor->SetForceAuxEdgeVisible(true);
74 
75  int detID = 0;
76  //Lets loop over all the Active nodes
77  BOOST_FOREACH(const GearDir & activeParams, content.getNodes("Active")) {
78  /*
79  double x_pos[100];
80  double y_pos[100];
81  double x_off[100];
82  double y_off[100];
83  double z_pos[100];
84  double phi[100];
85  double thetaZ[100];
86  double r[100];
87  int dimx = 0;
88  int dimy = 0;
89  int dimx_offset = 0;
90  int dimy_offset = 0;
91  int dimz = 0;
92  int dimr_dia = 0;
93  for (double x_offset : activeParams.getArray("x_offset", {0})) {
94  x_offset *= CLHEP::cm;
95  x_off[dimx_offset] = x_offset;
96  dimx_offset++;
97  }
98  for (double y_offset : activeParams.getArray("y_offset", {0})) {
99  y_offset *= CLHEP::cm;
100  y_off[dimy_offset] = y_offset;
101  dimy_offset++;
102  }
103  for (double x : activeParams.getArray("x", {0})) {
104  x *= CLHEP::cm;
105  x_pos[dimx] = x + x_off[dimx];
106  dimx++;
107  }
108  for (double y : activeParams.getArray("y", {0})) {
109  y *= CLHEP::cm;
110  y_pos[dimy] = y + y_off[dimy];
111  dimy++;
112  }
113  for (double z : activeParams.getArray("z", {0})) {
114  z *= CLHEP::cm;
115  z_pos[dimz] = z;
116  if (dimx != 0 && dimy != 0)
117  r[dimz] = sqrt(x_pos[dimz] * x_pos[dimz] + y_pos[dimz] * y_pos[dimz]);
118  dimz++;
119  }
120  int dimPhi = 0;
121  for (double Phi : activeParams.getArray("Phi", {0})) {
122  phi[dimPhi] = Phi;
123  dimPhi++;
124  }
125  int dimThetaZ = 0;
126  for (double ThetaZ : activeParams.getArray("ThetaZ", {0})) {
127  thetaZ[dimThetaZ] = ThetaZ;
128  dimThetaZ++;
129  }
130  if (dimx == 0 && dimy == 0) {
131  for (double r_dia : activeParams.getArray("r_dia", {0})) {
132  r_dia *= CLHEP::cm;
133  r[dimr_dia] = r_dia;
134  dimr_dia++;
135  }
136  }
137  */
138  int Nscint = activeParams.getInt("Nscint");
139  G4double x = activeParams.getLength("x") * CLHEP::cm;
140  G4double y = activeParams.getLength("y") * CLHEP::cm;
141  G4double z = activeParams.getLength("z_claw") * CLHEP::cm;
142  /*G4double r = 0;
143  if (x == 0 && y == 0)
144  r = activeParams.getLength("r_claw") * CLHEP::cm;
145  else
146  r = sqrt(x * x + y * y);*/
147  //G4double phi = activeParams.getAngle("Phi");
148  //G4double thetaZ = activeParams.getAngle("ThetaZ");
149  G4double dx_board = activeParams.getLength("dx_board") / 2.*CLHEP::cm;
150  G4double dy_board = activeParams.getLength("dy_board") / 2.*CLHEP::cm;
151  G4double dz_board = activeParams.getLength("dz_board") / 2.*CLHEP::cm;
152  G4double dz_Culayer = activeParams.getLength("dz_Culayer") / 2.*CLHEP::cm;
153  G4double dx_scint = activeParams.getLength("dx_scint") / 2.*CLHEP::cm;
154  G4double dy_scint = activeParams.getLength("dy_scint") / 2.*CLHEP::cm;
155  G4double dz_scint = activeParams.getLength("dz_scint") / 2.*CLHEP::cm;
156  G4double Al_width = activeParams.getLength("Al_width") / 2.*CLHEP::cm;
157  G4double dx_Al = dx_scint + Al_width;
158  G4double dy_Al = dy_scint + Al_width;
159  G4double dz_Al = dz_scint + Al_width;
160  G4double dx_air = dx_Al;
161  G4double dy_air = dy_Al * Nscint;
162  G4double dz_air = dz_board + 2. * dz_Culayer + dz_Al;
163  //cout << " dx sol 1 " << dx_air << " sol 2 " << dx_board << endl;
164  //cout << " dy sol 1 " << dy_air << " sol 2 " << dy_board << endl;
165 
166  //create air volume engloging ladder + scintillator + Al foil
167  G4Box* s_air = new G4Box("s_air", dx_air, dy_air, dz_air);
168  G4LogicalVolume* l_air = new G4LogicalVolume(s_air, geometry::Materials::get("G4_AIR"), "l_air");
169 
170 
171  //create claw G10 board
172  G4Box* s_board = new G4Box("s_board", dx_board, dy_board, dz_board);
173  G4LogicalVolume* l_board = new G4LogicalVolume(s_board, geometry::Materials::get("G10"), "l_board");
174  l_board->SetVisAttributes(green);
175 
176  G4double r_board = dz_air - 2. * dz_Culayer - dz_board;
177 
178  //create copper layer on each side of the G10 board
179  G4Box* s_Culayer = new G4Box("s_Culayer", dx_board, dy_board, dz_Culayer);
180  G4LogicalVolume* l_Culayer = new G4LogicalVolume(s_Culayer, geometry::Materials::get("Cu"), "l_Culayer");
181  l_Culayer->SetVisAttributes(coppercolor);
182 
183  G4double r_Culayer_bot = r_board - dz_board - dz_Culayer;
184  G4double r_Culayer_top = r_board + dz_board + dz_Culayer;
185  //cout << " cu bot sol 1 " << r_Culayer_bot << " sol 2 " << -dz_air + dz_Culayer<< endl;
186 
187  //create scintillator and Al foil around it
188  G4VSolid* s_scint = new G4Box("s_scint", dx_scint, dy_scint, dz_scint);
189  G4VSolid* s_Al = new G4Box("s_Al", dx_Al, dy_Al, dz_Al);
190  s_Al = new G4SubtractionSolid("s_Al", s_Al, s_scint, 0, G4ThreeVector(0, 0, 0));
191  G4LogicalVolume* l_Al = new G4LogicalVolume(s_Al, geometry::Materials::get("Al"), "l_Al");
192  l_Al->SetVisAttributes(gray);
193 
194  G4LogicalVolume* l_scint = new G4LogicalVolume(s_scint, geometry::Materials::get("G4_POLYSTYRENE"), "l_scint", 0, m_sensitive);
195  l_scint->SetVisAttributes(red);
196  //Lets limit the Geant4 stepsize inside the volume
197  l_scint->SetUserLimits(new G4UserLimits(stepSize));
198 
199  G4double r_Al = r_Culayer_bot - dz_Culayer - dz_Al;
200  //cout << " dz_air " << dz_air << " x2 " << 2. * dz_air << " r_Al " << r_Al << " tot " << r_Al + dz_Al << " sol3 " << r_Culayer_top + dz_Culayer + dz_Al << endl;
201  double z_0 = -dy_air + dy_Al;
202 
203  //for(int i = 0; i < dimz; i++) {
204 
205  //G4Transform3D transform = G4RotateZ3D(-M_PI / 2 + phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]);
206  //G4Transform3D transform = G4RotateZ3D(-M_PI / 2 + phi) * G4Translate3D(0, r, z) * G4RotateX3D(-M_PI / 2 - thetaZ);
207  G4Transform3D transform = G4Translate3D(x, y, z);
208  new G4PVPlacement(transform, l_air, "p_air", &topVolume, false, 1);
209  new G4PVPlacement(0, G4ThreeVector(0, 0, r_board), l_board, "p_board", l_air, false, 1);
210  new G4PVPlacement(0, G4ThreeVector(0, 0, r_Culayer_bot), l_Culayer, "p_Culayer_bot", l_air, false, 1);
211  new G4PVPlacement(0, G4ThreeVector(0, 0, r_Culayer_top), l_Culayer, "p_Culayer_top", l_air, false, 1);
212 
213  for (int j = 0; j < Nscint; j++) {
214  double i_z = z_0 + j * 2. * dy_Al;
215 
216  new G4PVPlacement(0, G4ThreeVector(0, i_z, r_Al), l_Al, "p_Al", l_air, false, 1);
217  new G4PVPlacement(0, G4ThreeVector(0, i_z, r_Al), l_scint, "p_scint", l_air, false, detID);
218  B2INFO("Phase1-CLAWS-" << detID << " placed at: " << transform.getTranslation() << " mm");
219  detID++;
220  //}
221  }
222  }
223  }

◆ 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 GeoEKLMCreator, GeoFarBeamLineCreator, GeoCryostatCreator, MyDBCreator, GeoARICHCreator, GeoBeamPipeCreator, GeoServiceMaterialCreator, GeoBKLMCreator, GeoPXDCreator, GeoSVDCreator, GeoTOPCreator, GeoSTRCreator, GeoHeavyMetalShieldCreator, GeoCDCCreator, GeoCOILCreator, GeoVXDServiceCreator, GeoKLMCreator, GeoECLCreator, and GeoMagneticField.

Definition at line 27 of file CreatorBase.cc.

◆ 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 GeoEKLMCreator, GeoFarBeamLineCreator, GeoCryostatCreator, MyDBCreator, GeoARICHCreator, GeoTOPCreator, GeoCDCCreator, GeoBeamPipeCreator, GeoServiceMaterialCreator, GeoMagneticField, GeoBKLMCreator, GeoKLMCreator, GeoECLCreator, GeoPXDCreator, GeoSVDCreator, GeoSTRCreator, GeoCOILCreator, GeoHeavyMetalShieldCreator, and GeoVXDServiceCreator.

Definition at line 34 of file CreatorBase.cc.


The documentation for this class was generated from the following files:
Belle2::geometry::Materials::get
static G4Material * get(const std::string &name)
Find given material.
Definition: Materials.h:65
Belle2::claw::ClawCreator::m_sensitive
SensitiveDetector * m_sensitive
SensitiveDetector CLAW.
Definition: ClawCreator.h:36