Bug Summary

File:beast/pindiode/geometry/src/PindiodeCreator.cc
Warning:line 347, column 15
Value stored to 'detID2' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -O3 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name PindiodeCreator.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/data/b2soft/buildbot/development/build -fcoverage-compilation-dir=/data/b2soft/buildbot/development/build -resource-dir /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/lib/clang/21 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++ -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++/x86_64-redhat-linux -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++/backward -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/python3.12 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/CLHEP -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/Geant4 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/root -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/belle_legacy -I include/ -D _PACKAGE_="beast" -D G4UI_USE_TCSH -D RaveDllExport= -D HAS_SQLITE -D HAS_CALLGRIND -I include -I /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/libxml2 -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++ -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++/x86_64-redhat-linux -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++/backward -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-missing-braces -Wno-unused-command-line-argument -std=c++20 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /scan_build/2026-05-31-004316-385593-1 -x c++ beast/pindiode/geometry/src/PindiodeCreator.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <beast/pindiode/geometry/PindiodeCreator.h>
10#include <beast/pindiode/simulation/SensitiveDetector.h>
11
12#include <geometry/Materials.h>
13#include <geometry/CreatorFactory.h>
14#include <framework/gearbox/GearDir.h>
15#include <framework/logging/Logger.h>
16
17#include <TMath.h>
18
19#include <cmath>
20
21#include <G4LogicalVolume.hh>
22#include <G4PVPlacement.hh>
23
24//Shapes
25#include <G4Box.hh>
26#include "G4SubtractionSolid.hh"
27#include <G4UserLimits.hh>
28#include "G4Tubs.hh"
29
30//Visualization
31#include "G4Colour.hh"
32#include <G4VisAttributes.hh>
33
34using namespace std;
35
36namespace Belle2 {
37
38 /** Namespace to encapsulate code needed for simulation and reconstrucion of the PINDIODE detector */
39 namespace pindiode {
40
41 // Register the creator
42 /** Creator creates the PINDIODE geometry */
43 geometry::CreatorFactory<PindiodeCreator> PindiodeFactory("PINDIODECreator");
44
45 PindiodeCreator::PindiodeCreator(): m_sensitive(0)
46 {
47 //m_sensitive = new SensitiveDetector();
48 }
49
50 PindiodeCreator::~PindiodeCreator()
51 {
52 if (m_sensitive) delete m_sensitive;
53 }
54
55 void PindiodeCreator::create(const GearDir& content, G4LogicalVolume& topVolume, geometry::GeometryTypes /* type */)
56 {
57
58 m_sensitive = new SensitiveDetector();
59
60 //Visualization Attributes
61 //G4VisAttributes *invis = new G4VisAttributes(G4Colour(1,1,1));
62 //invis->SetColor(0,0,0,0);
63 //invis->SetForceWireframe(true);
64 //invis->SetVisibility(false);
65 G4VisAttributes* red = new G4VisAttributes(G4Colour(1, 0, 0));
66 red->SetForceAuxEdgeVisible(true);
67 //G4VisAttributes *redwire = new G4VisAttributes(G4Colour(1,0,0));
68 //redwire->SetForceAuxEdgeVisible(true);
69 //redwire->SetForceWireframe(true);
70 G4VisAttributes* green = new G4VisAttributes(G4Colour(0, 1, 0));
71 green->SetForceAuxEdgeVisible(true);
72 //G4VisAttributes *blue = new G4VisAttributes(G4Colour(0,0,1));
73 //blue->SetForceAuxEdgeVisible(true);
74 //G4VisAttributes *white = new G4VisAttributes(G4Colour(1,1,1));
75 //white->SetForceAuxEdgeVisible(true);
76 G4VisAttributes* gray = new G4VisAttributes(G4Colour(.5, .5, .5));
77 gray->SetForceAuxEdgeVisible(true);
78 G4VisAttributes* yellow = new G4VisAttributes(G4Colour(1, 1, 0));
79 yellow->SetForceAuxEdgeVisible(true);
80 //G4VisAttributes *cyan = new G4VisAttributes(G4Colour(0,1,1));
81 //cyan->SetForceAuxEdgeVisible(true);
82 //G4VisAttributes *magenta = new G4VisAttributes(G4Colour(1,0,1));
83 //magenta->SetForceAuxEdgeVisible(true);
84 //G4VisAttributes *brown = new G4VisAttributes(G4Colour(.5,.5,0));
85 //brown->SetForceAuxEdgeVisible(true);
86 //G4VisAttributes *orange = new G4VisAttributes(G4Colour(1,2,0));
87 //orange->SetForceAuxEdgeVisible(true);
88 //G4VisAttributes* coppercolor = new G4VisAttributes(G4Colour(218. / 255., 138. / 255., 103. / 255.));
89 //coppercolor->SetForceAuxEdgeVisible(true);
90
91 //lets get the stepsize parameter with a default value of 5 µm
92 double stepSize = content.getLength("stepSize", 5 * CLHEP::um);
93 /*
94 //no get the array. Notice that the default framework unit is cm, so the
95 //values will be automatically converted
96 vector<double> bar = content.getArray("bar");
97 B2INFO("Contents of bar: ");
98 for (double value : bar) {
99 B2INFO("value: " << value);
100 }
101 */
102
103 //Lets loop over all the Active nodes
104 for (const GearDir& activeParams : content.getNodes("Active")) {
105
106 int phase = activeParams.getInt("phase");
107 G4double dx_pins = activeParams.getLength("dx_pins") / 2.*CLHEP::cm;
108 G4double dy_pins = activeParams.getLength("dy_pins") / 2.*CLHEP::cm;
109 G4double dz_pins = activeParams.getLength("dz_pins") / 2.*CLHEP::cm;
110 //Positioned PIN diodes
111 double x_pos[100];
112 double y_pos[100];
113 double z_pos[100];
114 double thetaX[100];
115 double thetaZ[100];
116 double thetaY[100];
117 double ch_wAu[100];
118 double ch_woAu[100];
119 double phi[100];
120 double r[100];
121 //int dimr_pin = 0;
122 if (phase == 1) {
123 int dimwAu = 0;
124 for (int wAu : activeParams.getArray("Ch_wAu", {0})) {
125 ch_wAu[dimwAu] = wAu;
126 dimwAu++;
127 }
128 int dimwoAu = 0;
129 for (int woAu : activeParams.getArray("Ch_woAu", {0})) {
130 ch_woAu[dimwoAu] = woAu;
131 dimwoAu++;
132 }
133 int dimx = 0;
134 for (double x : activeParams.getArray("x", {0})) {
135 x *= CLHEP::cm;
136 x_pos[dimx] = x;
137 dimx++;
138 }
139 int dimy = 0;
140 for (double y : activeParams.getArray("y", {0})) {
141 y *= CLHEP::cm;
142 y_pos[dimy] = y;
143 r[dimy] = sqrt(x_pos[dimy] * x_pos[dimy] + y_pos[dimy] * y_pos[dimy]);
144 double Phi = 0;
145 if (x_pos[dimy] >= 0) Phi = TMath::ASin(y_pos[dimy] / r[dimy]) * TMath::RadToDeg();
146 else Phi = -TMath::ASin(y_pos[dimy] / r[dimy]) * TMath::RadToDeg() + 180.;
147 //else if (x_pos[dimy] < 0) Phi = -TMath::ASin(y_pos[dimy] / r[dimy]) * TMath::RadToDeg() + 180.;
148 phi[dimy] = Phi * CLHEP::deg - 90. * CLHEP::deg;
149 dimy++;
150 }
151 int dimThetaX = 0;
152 for (double ThetaX : activeParams.getArray("ThetaX", {0})) {
153 thetaX[dimThetaX] = ThetaX;
154 dimThetaX++;
155 }
156 int dimThetaY = 0;
157 for (double ThetaY : activeParams.getArray("ThetaY", {0})) {
158 thetaY[dimThetaY] = ThetaY;
159 dimThetaY++;
160 }
161 }
162 int dimPhi = 0;
163 if (phase == 2) {
164 for (int i = 0; i < 100; i++) {
165 x_pos[i] = 0;
166 y_pos[i] = 0;
167 z_pos[i] = 0;
168 }
169 for (double Phi : activeParams.getArray("Phi", {0})) {
170 phi[dimPhi] = Phi - 90. * CLHEP::deg;
171 dimPhi++;
172 }
173 int dimr_pin = 0;
174 for (double r_pin : activeParams.getArray("r_pin", {0})) {
175 r_pin *= CLHEP::cm;
176 r[dimr_pin] = r_pin;
177 dimr_pin++;
178 }
179 }
180 int dimz = 0;
181 for (double z : activeParams.getArray("z", {0})) {
182 z *= CLHEP::cm;
183 z_pos[dimz] = z;
184 dimz++;
185 }
186 int dimThetaZ = 0;
187 for (double ThetaZ : activeParams.getArray("ThetaZ", {0})) {
188 thetaZ[dimThetaZ] = ThetaZ;
189 dimThetaZ++;
190 }
191
192 //inch to cm
193 G4double InchtoCm = 2.54 * CLHEP::cm;
194
195 //Create Air Box
196 G4double dz_airbox = 0.563 / 2. * InchtoCm;
197 G4double dx_airbox = 1. / 2. * InchtoCm;
198 G4double dy_airbox = 0.315 / 2. * InchtoCm;
199 /*
200 G4double dz_airbox_e = 0.1 / 2. * CLHEP::cm;
201 G4double dx_airbox_e = 0.1 / 2. * CLHEP::cm;
202 G4double dy_airbox_e = 0.1 / 2. * CLHEP::cm;
203 G4VSolid* s_airbox = new G4Box("s_airbox", dx_airbox + dx_airbox_e, dy_airbox + dy_airbox_e, dz_airbox + dz_airbox_e);
204 G4LogicalVolume* l_airbox = new G4LogicalVolume(s_airbox, G4Material::GetMaterial("G4_AIR"), "l_airbox");
205 for (int i = 0; i < dimz; i++) {
206 if (phase == 1) {
207 G4RotationMatrix* pRot = new G4RotationMatrix();
208 pRot->rotateX(thetaX[i]);
209 pRot->rotateY(thetaY[i]);
210 pRot->rotateZ(thetaZ[i]);
211 new G4PVPlacement(pRot, G4ThreeVector(x_pos[i], y_pos[i], z_pos[i]), l_airbox, TString::Format("p_airbox_%d", i).Data(), &topVolume,
212 false, 0);
213 } else if (phase == 2) {
214 G4Transform3D transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]);
215 new G4PVPlacement(transform, l_airbox, TString::Format("p_pin_airbox_%d", i).Data(), &topVolume, false, 0);
216 }
217 }
218 */
219 //Create PIN diode base box
220 G4double dz_base = 0.5 / 2. * InchtoCm;
221 G4double dx_base = dx_airbox;
222 G4double dy_base = 0.25 / 2. * InchtoCm;
223 G4VSolid* s_base = new G4Box("s_base", dx_base, dy_base, dz_base);
224
225 G4double ir_hole = 0.;
226 G4double or_hole = 5. / 2.*CLHEP::mm;
227 G4double h_hole = 0.382 / 2. * InchtoCm;
228 G4double sA_hole = 0.*CLHEP::deg;
229 G4double spA_hole = 360.*CLHEP::deg;
230 G4VSolid* s_hole = new G4Tubs("s_hole", ir_hole, or_hole, h_hole, sA_hole, spA_hole);
231 G4double x_pos_hole = dx_base - 0.315 * InchtoCm;
232 G4double y_pos_hole = (0.187 - 0.250 / 2.) * InchtoCm;
233 G4double z_pos_hole = -(0.5 - 0.382) * InchtoCm;
234 s_base = new G4SubtractionSolid("s_base_hole1", s_base, s_hole, 0, G4ThreeVector(x_pos_hole, y_pos_hole, z_pos_hole));
235 s_base = new G4SubtractionSolid("s_base_hole2", s_base, s_hole, 0, G4ThreeVector(-x_pos_hole, y_pos_hole, z_pos_hole));
236 /*s_base = new G4SubtractionSolid("s_base_hole1", s_base, s_hole, 0, G4ThreeVector((0.5 - 0.315)*InchtoCm,
237 (0.187 - 0.250 / 2.)*InchtoCm, -(0.5 - 0.382)*InchtoCm));
238 s_base = new G4SubtractionSolid("s_base_hole2", s_base, s_hole, 0, G4ThreeVector(-(0.5 - 0.315)*InchtoCm,
239 (0.187 - 0.250 / 2.)*InchtoCm, -(0.5 - 0.382)*InchtoCm));*/
240 const double iTheta[4] = {0, 90, 180, 270};
241 G4LogicalVolume* l_base = new G4LogicalVolume(s_base, G4Material::GetMaterial("Al6061"), "l_base");
242 l_base->SetVisAttributes(yellow);
243 G4Transform3D transform;
244 for (int i = 0; i < dimz; i++) {
245 if (phase == 1) {
246 transform = G4Translate3D(x_pos[i], y_pos[i],
247 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]);
248 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]);
249 new G4PVPlacement(transform, l_base, TString::Format("p_pin_base_%d", i).Data(), &topVolume, false, 0);
250 B2INFO("PIN base-" << (int)i / 4 << "-" << iTheta[i - ((int)i / 4) * 4] << " placed at: " << transform.getTranslation() << " mm ")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "beast")) { { LogVariableStream varStream
; varStream << "PIN base-" << (int)i / 4 <<
"-" << iTheta[i - ((int)i / 4) * 4] << " placed at: "
<< transform.getTranslation() << " mm "; Belle2::
LogSystem::Instance().sendMessage(Belle2::LogMessage(Belle2::
LogConfig::c_Info, std::move(varStream), "beast", __PRETTY_FUNCTION__
, "beast/pindiode/geometry/src/PindiodeCreator.cc", 250, 0));
}; } } while(false)
;
251 }
252 }
253 /*
254 for (int i = 0; i < dimz; i++) {
255 new G4PVPlacement(0, G4ThreeVector(0, dy_base - dy_airbox, dz_airbox - dz_base), l_base, TString::Format("p_base_%d", i).Data(),
256 l_airbox, false, 0);
257 }
258 */
259 //Create diode cover
260 G4double dz_cover1 = dz_airbox;
261 G4double dx_cover1 = dx_airbox;
262 G4double dy_cover1 = dy_airbox - dy_base;
263 G4VSolid* s_cover1 = new G4Box("s_cover1", dx_cover1, dy_cover1, dz_cover1);
264
265 G4double dx_shole = (0.563 - 0.406) / 2. * InchtoCm;
266 G4VSolid* s_shole = new G4Box("s_shole", dx_shole, dy_cover1, dx_shole);
267 G4double x_pos_cover_hole = dx_base - 0.392 * InchtoCm + dx_shole;
268 //G4double y_pos_cover_hole = 0;
269 G4double z_pos_cover_hole = dz_airbox - 0.406 * InchtoCm + dx_shole;
270 s_cover1 = new G4SubtractionSolid("s_cover1_hole1", s_cover1, s_shole, 0, G4ThreeVector(x_pos_cover_hole, 0, z_pos_cover_hole));
271 s_cover1 = new G4SubtractionSolid("s_cover1_hole2", s_cover1, s_shole, 0, G4ThreeVector(-x_pos_cover_hole, 0, z_pos_cover_hole));
272 /*
273 s_cover1 = new G4SubtractionSolid("s_cover1_hole1", s_cover1, s_shole, 0, G4ThreeVector((0.5 - 0.392)*InchtoCm + dx_shole, 0,
274 (0.563 / 2. - 0.406)*InchtoCm + dx_shole));
275 s_cover1 = new G4SubtractionSolid("s_cover1_hole2", s_cover1, s_shole, 0, G4ThreeVector(-(0.5 - 0.392)*InchtoCm - dx_shole, 0,
276 (0.563 / 2. - 0.406)*InchtoCm + dx_shole));
277 */
278 G4LogicalVolume* l_cover1 = new G4LogicalVolume(s_cover1, G4Material::GetMaterial("Al6061"), "l_cover1");
279 l_cover1->SetVisAttributes(yellow);
280 for (int i = 0; i < dimz; i++) {
281 if (phase == 1) {
282 transform = G4Translate3D(x_pos[i], y_pos[i],
283 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
284 G4Translate3D(0., dy_base + dy_cover1, (dz_cover1 - dz_base) - dy_cover1 * 2.);
285 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
286 // G4Translate3D(0., dy_base + dy_cover1, (dz_cover1 - dz_base) - dy_cover1 * 2.);
287 new G4PVPlacement(transform, l_cover1, TString::Format("p_pin_cover1_%d", i).Data(), &topVolume, false, 0);
288 }
289 }
290 /*
291 for (int i = 0; i < dimz; i++) {
292 new G4PVPlacement(0, G4ThreeVector(0, dy_airbox_e / 2. + dy_airbox - dy_cover1, 0), l_cover1, TString::Format("p_cover1_%d",
293 i).Data(), l_airbox,
294 false, 0);
295 }
296 */
297 G4double dz_cover2 = dz_airbox - dz_base;
298 G4double dx_cover2 = dx_airbox;
299 G4double dy_cover2 = dy_base;
300 G4VSolid* s_cover2 = new G4Box("s_cover2", dx_cover2, dy_cover2, dz_cover2);
301 G4LogicalVolume* l_cover2 = new G4LogicalVolume(s_cover2, G4Material::GetMaterial("Al6061"), "l_cover2");
302 l_cover2->SetVisAttributes(yellow);
303 for (int i = 0; i < dimz; i++) {
304 if (phase == 1) {
305 transform = G4Translate3D(x_pos[i], y_pos[i],
306 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
307 G4Translate3D(0., -2.*dy_cover1, - dz_base - dz_cover2);
308 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
309 //G4Translate3D(0., -2.*dy_cover1, - dz_base - dz_cover2);
310 new G4PVPlacement(transform, l_cover2, TString::Format("p_pin_cover2_%d", i).Data(), &topVolume, false, 0);
311 }
312 }
313 /*
314 for (int i = 0; i < dimz; i++) {
315 new G4PVPlacement(0, G4ThreeVector(0, dy_cover2 - dy_airbox, dz_cover2 - dz_airbox - dz_airbox_e / 2.), l_cover2,
316 TString::Format("p_cover2_%d",
317 i).Data(), l_airbox, false, 0);
318 }
319 */
320 //Create PIN plastic substrate
321 /*
322 h_hole = 0.6 / 2.*CLHEP::cm;
323 sA_hole = 0.*deg;
324 spA_hole = 180.*deg;
325 G4VSolid* s_pinsubtrate = new G4Tubs("s_pinsubtrate", ir_hole, or_hole, h_hole, sA_hole, spA_hole);
326 G4LogicalVolume* l_pinsubtrate = new G4LogicalVolume(s_pinsubtrate, geometry::Materials::get("G4_POLYSTYRENE"), "l_pinsubtrate");
327 transform = G4RotateZ3D(phi) * G4Translate3D(0, r, z) * G4RotateX3D(-M_PI / 2 - thetaZ) *
328 G4Translate3D((0.5 - 0.315) * InchtoCm, (0.187 - 0.250 / 2.) * InchtoCm, -(0.5 - 0.382) * InchtoCm) * G4RotateZ3D(360.0);
329 new G4PVPlacement(transform, l_pinsubtrate, "p_pinsubtrate_1", &topVolume, false, 0);
330 transform = G4RotateZ3D(phi) * G4Translate3D(0, r, z) * G4RotateX3D(-M_PI / 2 - thetaZ) *
331 G4Translate3D(-(0.5 - 0.315) * InchtoCm, (0.187 - 0.250 / 2.) * InchtoCm, -(0.5 - 0.382) * InchtoCm) * G4RotateZ3D(360.0);
332 new G4PVPlacement(transform, l_pinsubtrate, "p_pinsubtrate_2", &topVolume, false, 0);
333 */
334
335 //Sensitive area
336 G4double dx_pin = dx_pins;
337 G4double dz_pin = dz_pins;
338 G4double dy_pin = dy_pins;
339
340 G4VSolid* s_pin = new G4Box("s_pin", dx_pin, dy_pin, dz_pin);
341 G4LogicalVolume* l_pin = new G4LogicalVolume(s_pin, geometry::Materials::get("G4_SILICON_DIOXIDE"), "l_pin", 0, m_sensitive);
342 l_pin->SetVisAttributes(yellow);
343 l_pin->SetUserLimits(new G4UserLimits(stepSize));
344 int detID = 0;
345 for (int i = 0; i < dimz; i++) {
346 int detID1 = 2 * i;
347 int detID2 = 2 * i + 1;
Value stored to 'detID2' during its initialization is never read
348 /*if (phase == 1) {
349 detID1 = ch_wAu[i];
350 detID2 = ch_woAu[i];
351 }*/
352 if (phase == 1) {
353
354 detID1 = ch_wAu[i];
355 detID2 = ch_woAu[i];
356
357 transform = G4Translate3D(x_pos[i], y_pos[i],
358 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
359 G4Translate3D((0.5 - 0.392) * InchtoCm + dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
360 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - 0. - dz_pin);
361 /*
362 if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
363 G4Translate3D((0.5 - 0.392) * InchtoCm + dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
364 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - 0. - dz_pin);
365 */
366 new G4PVPlacement(transform, l_pin, TString::Format("p_pin_1_%d", i).Data(), &topVolume, false, detID1);
367 B2INFO("With Au PIN-" << detID1 << " placed at: " << transform.getTranslation() << " mm")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "beast")) { { LogVariableStream varStream
; varStream << "With Au PIN-" << detID1 << " placed at: "
<< transform.getTranslation() << " mm"; Belle2::
LogSystem::Instance().sendMessage(Belle2::LogMessage(Belle2::
LogConfig::c_Info, std::move(varStream), "beast", __PRETTY_FUNCTION__
, "beast/pindiode/geometry/src/PindiodeCreator.cc", 367, 0));
}; } } while(false)
;
368
369 transform = G4Translate3D(x_pos[i], y_pos[i],
370 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
371 G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
372 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
373 new G4PVPlacement(transform, l_pin, TString::Format("p_pin_2_%d", i).Data(), &topVolume, false, detID2);
374 B2INFO(" PIN-" << detID2 << " placed at: " << transform.getTranslation() << " mm")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "beast")) { { LogVariableStream varStream
; varStream << " PIN-" << detID2 << " placed at: "
<< transform.getTranslation() << " mm"; Belle2::
LogSystem::Instance().sendMessage(Belle2::LogMessage(Belle2::
LogConfig::c_Info, std::move(varStream), "beast", __PRETTY_FUNCTION__
, "beast/pindiode/geometry/src/PindiodeCreator.cc", 374, 0));
}; } } while(false)
;
375 }
376 /*if (phase == 1) {
377 transform = G4Translate3D(x_pos[i], y_pos[i],
378 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
379 G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
380 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
381 new G4PVPlacement(transform, l_pin, TString::Format("p_pin_2_%d", i).Data(), &topVolume, false, detID2);
382 B2INFO(" PIN-" << detID2 << " placed at: " << transform.getTranslation() << " mm");
383 }*/
384 /*
385 if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
386 G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
387 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
388 */
389
390 if (phase == 2) {
391 for (int j = 0; j < dimPhi; j++) {
392 transform = G4RotateZ3D(phi[j]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI3.14159265358979323846 / 2 - thetaZ[j]);
393 new G4PVPlacement(transform, l_pin, TString::Format("p_pin_%d", i).Data(), &topVolume, false, detID);
394 B2INFO("PIN-" << detID << " placed at: " << transform.getTranslation() << " mm")do { if (Belle2::LogSystem::Instance().isLevelEnabled(Belle2::
LogConfig::c_Info, 0, "beast")) { { LogVariableStream varStream
; varStream << "PIN-" << detID << " placed at: "
<< transform.getTranslation() << " mm"; Belle2::
LogSystem::Instance().sendMessage(Belle2::LogMessage(Belle2::
LogConfig::c_Info, std::move(varStream), "beast", __PRETTY_FUNCTION__
, "beast/pindiode/geometry/src/PindiodeCreator.cc", 394, 0));
}; } } while(false)
;
395 detID ++;
396 }
397 }
398 }
399 /*
400 for (int i = 0; i < dimz; i++) {
401
402 int detID1 = 2 * i;
403 int detID2 = 2 * i + 1;
404 if (phase == 1) {
405 detID1 = ch_wAu[i];
406 detID2 = ch_woAu[i];
407 }
408
409 new G4PVPlacement(0, G4ThreeVector((0.5 - 0.392) * InchtoCm + dx_shole,
410 (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
411 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - 0. - dz_pin)
412 , l_pin, TString::Format("p_pin_1_%d", i).Data(), l_airbox, false, detID1);
413 new G4PVPlacement(0, G4ThreeVector(-(0.5 - 0.392) * InchtoCm - dx_shole,
414 (0.187 - 0.250 / 2.) * InchtoCm + dy_pin,
415 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin)
416 , l_pin, TString::Format("p_pin_2_%d", i).Data(), l_airbox, false, detID2);
417
418 new G4PVPlacement(0, G4ThreeVector(x_pos_cover_hole,
419 y_pos_hole + dy_pin,
420 z_pos_cover_hole + dx_shole - dz_pin)
421 , l_pin, TString::Format("p_pin_1_%d", i).Data(), l_airbox, false, detID1);
422 new G4PVPlacement(0, G4ThreeVector(-x_pos_cover_hole,
423 y_pos_hole + dy_pin,
424 z_pos_cover_hole + dx_shole - dz_pin)
425 , l_pin, TString::Format("p_pin_2_%d", i).Data(), l_airbox, false, detID2);
426 }
427 */
428 G4double dx_layer = 2.65 / 2.*CLHEP::mm;
429 G4double dz_layer = 2.65 / 2.*CLHEP::mm;
430 G4double dy_layer1 = 0.01 / 2.*CLHEP::mm;
431 G4VSolid* s_layer1 = new G4Box("s_layer1", dx_layer, dy_layer1, dz_layer);
432 G4LogicalVolume* l_layer1 = new G4LogicalVolume(s_layer1, geometry::Materials::get("G4_Au"), "l_layer1");
433 l_layer1->SetVisAttributes(red);
434 for (int i = 0; i < dimz; i++) {
435 if (phase == 1) {
436 transform = G4Translate3D(x_pos[i], y_pos[i],
437 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
438 G4Translate3D((0.5 - 0.392) * InchtoCm + dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_layer1 + 2.* dy_pin,
439 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
440 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
441 //G4Translate3D((0.5 - 0.392) * InchtoCm + dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_layer1 + 2.* dy_pin,
442 //(0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
443 new G4PVPlacement(transform, l_layer1, TString::Format("p_pin_layer1_%d", i).Data(), &topVolume, false, 0);
444 }
445 }
446 /*
447 for (int i = 0; i < dimz; i++) {
448
449 new G4PVPlacement(0, G4ThreeVector((0.5 - 0.392) * InchtoCm + dx_shole,
450 (0.187 - 0.250 / 2.) * InchtoCm + dy_layer1 + 2.* dy_pin,
451 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin),
452 l_layer1, TString::Format("p_layer1_%d", i).Data(), l_airbox, false, 0);
453
454 new G4PVPlacement(0, G4ThreeVector(x_pos_cover_hole,
455 y_pos_hole + dy_layer1 + 2.* dy_pin,
456 z_pos_cover_hole + dx_shole - dz_pin),
457 l_layer1, TString::Format("p_layer1_%d", i).Data(), l_airbox, false, 1);
458 }
459 */
460 G4double dy_layer2 = 0.001 / 2.*InchtoCm;
461 G4VSolid* s_layer2 = new G4Box("s_layer1", dx_layer, dy_layer2, dz_layer);
462 G4LogicalVolume* l_layer2 = new G4LogicalVolume(s_layer2, geometry::Materials::get("Al"), "l_layer2");
463 l_layer2->SetVisAttributes(green);
464 for (int i = 0; i < dimz; i++) {
465 if (phase == 1) {
466 transform = G4Translate3D(x_pos[i], y_pos[i],
467 z_pos[i]) * G4RotateX3D(thetaX[i]) * G4RotateY3D(thetaY[i]) * G4RotateZ3D(thetaZ[i]) *
468 G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_layer2 + 2. * dy_pin,
469 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
470 //if (phase == 2) transform = G4RotateZ3D(phi[i]) * G4Translate3D(0, r[i], z_pos[i]) * G4RotateX3D(-M_PI / 2 - thetaZ[i]) *
471 //G4Translate3D(-(0.5 - 0.392) * InchtoCm - dx_shole, (0.187 - 0.250 / 2.) * InchtoCm + dy_layer2 + 2. * dy_pin,
472 //(0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin);
473 new G4PVPlacement(transform, l_layer2, TString::Format("p_pin_layer2_%d", i).Data(), &topVolume, false, 0);
474 }
475 }
476 /*
477 for (int i = 0; i < dimz; i++) {
478
479 new G4PVPlacement(0, G4ThreeVector(-(0.5 - 0.392) * InchtoCm - dx_shole,
480 (0.187 - 0.250 / 2.) * InchtoCm + dy_layer2 + 2. * dy_pin,
481 (0.563 / 2. - 0.406) * InchtoCm + dx_shole * 2 - dz_pin),
482 l_layer2, TString::Format("p_layer2_%d", i).Data(), l_airbox, false, 0);
483
484 new G4PVPlacement(0, G4ThreeVector(-x_pos_cover_hole,
485 y_pos_hole + dy_layer2 + 2. * dy_pin,
486 z_pos_cover_hole + dx_shole - dz_pin),
487 l_layer2, TString::Format("p_layer2_%d", i).Data(), l_airbox, false, 1);
488 }
489 */
490 }
491 }
492 } // pindiode namespace
493} // Belle2 namespace