Belle II Software  release-08-01-10
ClawCreator Class Reference

The creator for the CLAW geometry. More...

#include <ClawCreator.h>

Inheritance diagram for ClawCreator:
Collaboration diagram for ClawCreator:

Public Member Functions

 ClawCreator ()
 Constructor.
 
virtual ~ClawCreator ()
 Destructor.
 
virtual void create (const GearDir &content, G4LogicalVolume &topVolume, geometry::GeometryTypes type)
 Creation of the detector geometry from Gearbox (XML). 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 27 of file ClawCreator.h.

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

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

Definition at line 24 of file CreatorBase.cc.


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