56 std::string prep =
"Active.";
58 B2INFO(
"BeamabortCreator phase3");
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);
65 double stepSize =
m_config.getParameter(
"stepSize", 5 * CLHEP::um);
68 int phase =
m_config.getParameter(prep +
"phase");
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;
82 for (
double z :
m_config.getParArray(prep +
"z", {0})) {
88 for (
double ThetaZ :
m_config.getParArray(prep +
"ThetaZ", {0})) {
89 thetaZ.push_back(ThetaZ);
92 if (thetaZ.size() != dimz) { B2ERROR(
"Diamond data not consistent (i.e. not same number of all position parameters)");
return;}
94 if (phase == 2 || phase == 3) {
96 for (
double Phi :
m_config.getParArray(prep +
"Phi", {0})) {
100 for (
double r_dia :
m_config.getParArray(prep +
"r_dia", {0})) {
104 for (
double dX :
m_config.getParArray(prep +
"deltaX", {0})) {
106 deltaX.push_back(dX);
108 for (
double addAngle :
m_config.getParArray(prep +
"addAngle", {0})) {
109 svdAngle.push_back(addAngle);
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;}
114 for (
double x :
m_config.getParArray(prep +
"x", {0})) {
118 for (
double y :
m_config.getParArray(prep +
"y", {0})) {
123 for (
double ThetaX :
m_config.getParArray(prep +
"ThetaX", {0})) {
124 thetaX.push_back(ThetaX);
126 for (
double ThetaY :
m_config.getParArray(prep +
"ThetaY", {0})) {
127 thetaY.push_back(ThetaY);
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;}
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]);
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);
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 ");
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);
169 l_BEAMABORT->SetUserLimits(
new G4UserLimits(stepSize));
170 l_BEAMABORT->SetVisAttributes(orange);
175 for (
unsigned int i = 0; i < dimz; i++) {
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);
185 new G4PVPlacement(transform, l_BEAMABORT, TString::Format(
"p_dia_%d", i).Data(), &topVolume,
false, i);
187 B2INFO(
"DIA-sensitive volume-" << i <<
" placed at: " << transform.getTranslation() <<
" mm "
188 <<
" at phi angle = " << phi[i] <<
" at theta angle = "
190 B2INFO(
"DIA-sensitive volume-" << i <<
" G4RotateZ3D of: phi= " << phi[i] <<
" G4RotateX3D = "
191 << (-M_PI / 2 - thetaZ[i]));