CbmRoot
Loading...
Searching...
No Matches
RichGeoCreator.cxx
Go to the documentation of this file.
1/* Copyright (C) 2022-2025 UGiessen/GSI, Giessen/Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev [committer], Eoin Clerkin, Simon Neuhaus*/
4
5
6#include "RichGeoCreator.h"
7
8#include "Logger.h"
9#include "RichGeoMaterials.h"
10#include "TGeoArb8.h"
11#include "TGeoBBox.h"
12#include "TGeoBoolNode.h"
13#include "TGeoCompositeShape.h"
14#include "TGeoCone.h"
15#include "TGeoEltu.h"
16#include "TGeoMatrix.h"
17#include "TGeoSphere.h"
18#include "TGeoTube.h"
19#include "TGeoVolume.h"
20
21#include <TMath.h>
22
23#include <iostream>
24
25using namespace std;
26
27using TMath::ASin;
28using TMath::ATan;
29using TMath::Cos;
30using TMath::Sin;
31using TMath::Tan;
32const double pi = TMath::Pi();
33
35
37
39{
40 LOG(info) << "Create geometry: " << fGeoName;
41 fMaterials.Init();
42
44
45 CreateRich();
46}
47
49{
50 double cosMirRot = cos(ToRad(fMirrorRot));
51 double sinMirRot = sin(ToRad(fMirrorRot));
52 double mirRadCos = fMirrorRadius * cosMirRot;
53 double E = sin(ToRad(90. - fAccAngle - fMirrorRot)) / sin(ToRad(fAccAngle));
54 double A = (4. * E * E + 4. * E * sinMirRot + 1.) / (cosMirRot * cosMirRot);
55 double B = (2. * (2. * E + sinMirRot) / cosMirRot) * (1. - fMirrorPos / mirRadCos);
56 double C = fMirrorPos * (fMirrorPos - 2. * mirRadCos) / (mirRadCos * mirRadCos);
57 double t1 = (-B + sqrt(B * B - 4. * A * C)) / (2. * A);
58 fAlpha = ToDeg(asin(t1)); //rad
59 double sinAlpha = sin(ToRad(fAlpha));
60 double cosAlpha = cos(ToRad(fAlpha));
61 double psi = ToDeg(atan((fMirrorRadius * (sinAlpha * cosMirRot - sinMirRot * (1. - cosAlpha))) / fMirrorPos));
62 double mirRadHalf = fMirrorRadius / 2.;
63
65 fCameraOriginY = fMirrorPos * tan(ToRad(psi)) + mirRadHalf * sin(ToRad(psi + 2. * fMirrorRot))
68 fMirrorPos - mirRadHalf * cos(ToRad((psi + 2. * fMirrorRot))) - fCameraRadius * cos(ToRad(fCameraFullRotX));
70 fMirrorOriginZ = fMirrorPos - mirRadCos;
71
72 fCameraHeight = 7. * (2. * fPmtSize + fCameraGap) + 6. * fCameraGap;
73 double camRad1 = fCameraRadius - 1. - fPmtDepth;
74 fCameraTouchRadius = std::sqrt(camRad1 * camRad1 + fCameraTouchWidth * fCameraTouchWidth / 4.);
76}
77
79{
80 double pxSizeHalf = fPixelSize / 2.;
81 double pxThicknessHalf = fPixelThickness / 2.;
82 double pxSizeEdgeHalf = fPixelSizeEdge / 2.;
83 double pmtSizeHalf = fPmtSize / 2.;
84 double pmtDepthHalf = fPmtDepth / 2.;
85 TGeoMedium* medCsI = fMaterials.GetMedium("CsI");
86
87 TGeoBBox* pixelPB = new TGeoBBox("pmt_pixel_PB", pxSizeHalf, pxSizeHalf, pxThicknessHalf);
88 TGeoBBox* pixelCornerPB = new TGeoBBox("pmt_pixel_corner_PB", pxSizeEdgeHalf, pxSizeEdgeHalf, pxThicknessHalf);
89 TGeoBBox* pixelYPB = new TGeoBBox("pmt_pixel_y_PB", pxSizeHalf, pxSizeEdgeHalf, pxThicknessHalf);
90 TGeoBBox* pixelXPB = new TGeoBBox("pmt_pixel_x_PB", pxSizeEdgeHalf, pxSizeHalf, pxThicknessHalf);
91 TGeoBBox* pmtPB = new TGeoBBox("pmt_PB", pmtSizeHalf, pmtSizeHalf, pmtDepthHalf);
92
93 TGeoVolume* pixel = new TGeoVolume("pmt_pixel", pixelPB, medCsI);
94 //if (fSetVolumeColors) pixel->SetLineColor(kRed - 9);
95 TGeoVolume* pixelCorner = new TGeoVolume("pmt_pixel_corner", pixelCornerPB, medCsI);
96 //if (fSetVolumeColors) pixelCorner->SetLineColor(kRed);
97 TGeoVolume* pixelY = new TGeoVolume("pmt_pixel_y", pixelYPB, medCsI);
98 //if (fSetVolumeColors) pixelY->SetLineColor(kRed - 5);
99 TGeoVolume* pixelX = new TGeoVolume("pmt_pixel_x", pixelXPB, medCsI);
100 //if (fSetVolumeColors) pixelX->SetLineColor(kRed + 3);
101 TGeoVolume* pmt = new TGeoVolume("pmt", pmtPB, fMaterials.GetMedium("RICHgas_CO2_dis"));
102 //if (fSetVolumeColors) pmt->SetLineColor(kRed + 1);
103
104 double edgePxPos = 3. * fPixelSize + pxSizeEdgeHalf;
105 double zC = pmtDepthHalf - pxThicknessHalf;
106 int copyNum = 1;
107 for (int x = 0; x < fNofPixels; x++) {
108 double xC = (x - 3.5) * fPixelSize;
109 if (x == 0) xC = -edgePxPos;
110 if (x == 7) xC = edgePxPos;
111 bool isXEdge = (x == 0 || x == fNofPixels - 1);
112
113 for (int y = 0; y < fNofPixels; y++) {
114 double yC = (y - 3.5) * fPixelSize;
115 if (y == 0) yC = edgePxPos;
116 if (y == 7) yC = -edgePxPos;
117
118 bool isYEdge = (y == 0 || y == fNofPixels - 1);
119 TGeoVolume* curPmtPixel;
120 if (isXEdge) {
121 if (isYEdge) {
122 curPmtPixel = pixelCorner;
123 }
124 else {
125 curPmtPixel = pixelX;
126 }
127 }
128 else {
129 if (isYEdge) {
130 curPmtPixel = pixelY;
131 }
132 else {
133 curPmtPixel = pixel;
134 }
135 }
136
137 pmt->AddNode(curPmtPixel, copyNum, MakeTrans(xC, yC, zC));
138 copyNum++;
139 }
140 }
141
142 return pmt;
143}
144
145
147{
148 double pmtSizeGap = fPmtSize + fCameraGap;
149
150 TGeoVolume* pmt = CreatePmt();
151 TGeoBBox* camModulePB = new TGeoBBox("camera_module_PB", (3. * fPmtSize + 2. * fCameraGap) / 2.,
152 (2. * fPmtSize + fCameraGap) / 2., fPmtDepth / 2.);
153
154 TGeoVolume* camModule = new TGeoVolume("camera_module", camModulePB, fMaterials.GetMedium("RICHgas_CO2_dis"));
155 //if (fSetVolumeColors) camModule->SetLineColor(kRed - 1);
156 camModule->AddNode(pmt, 1, MakeTrans(-pmtSizeGap, pmtSizeGap / 2., 0.));
157 camModule->AddNode(pmt, 2, MakeTrans(0., pmtSizeGap / 2., 0.));
158 camModule->AddNode(pmt, 3, MakeTrans(pmtSizeGap, pmtSizeGap / 2., 0.));
159 camModule->AddNode(pmt, 4, MakeTrans(-pmtSizeGap, -pmtSizeGap / 2., 0.));
160 camModule->AddNode(pmt, 5, MakeTrans(0., -pmtSizeGap / 2., 0.));
161 camModule->AddNode(pmt, 6, MakeTrans(pmtSizeGap, -pmtSizeGap / 2., 0.));
162
163 return camModule;
164}
165
167{
168 double pmtSizeGap = fPmtSize + fCameraGap;
169 double pmtDepthHalf = fPmtDepth / 2.;
170 double aluFrameDepth = 0.5;
171
172 TGeoVolume* camModule = CreateCameraModule();
173
174 double dY = (7. * (2. * fPmtSize + fCameraGap) + 6. * fCameraGap) / 2.;
175 TGeoBBox* aluFramePB =
176 new TGeoBBox("alu_frame_PB", fCameraTouchWidth / 2., (14. * fPmtSize + 13. * fCameraGap) / 2., aluFrameDepth);
177 TGeoBBox* op0 = new TGeoBBox("camera_strip_PB_op0", (3. * fPmtSize + 2. * fCameraGap) / 2., dY, pmtDepthHalf);
178 TGeoBBox* op1 = new TGeoBBox("camera_strip_PB_op1", fCameraTouchWidth / 2., dY, aluFrameDepth);
179 TGeoTranslation* tr = MakeTrans(0., 0., -pmtDepthHalf - aluFrameDepth);
180 TGeoCompositeShape* camStripPB = MakeUnion("camera_strip_PB", op0, op1, nullptr, tr);
181
182 TGeoVolume* aluFrame = new TGeoVolume("alu_frame", aluFramePB, fMaterials.GetMedium("aluminium"));
183 //if (fSetVolumeColors) aluFrame->SetLineColor(kBlue - 4);
184 TGeoVolume* camStrip = new TGeoVolume("camera_strip", camStripPB, fMaterials.GetMedium("RICHgas_CO2_dis"));
185 //if (fSetVolumeColors) camStrip->SetLineColor(kOrange + 9);
186 int copyNum = 1;
187 for (int i = -6; i <= 6; i += 2) {
188 camStrip->AddNode(camModule, copyNum, MakeTrans(0., static_cast<double>(i) * pmtSizeGap, 0.));
189 copyNum++;
190 }
191 camStrip->AddNode(aluFrame, 1, MakeTrans(0., 0., -pmtDepthHalf - aluFrameDepth));
192
193 return camStrip;
194}
195
197{
198 TGeoVolume* camStrip = CreateCameraStrip();
199 double len = fCameraRadius - (fPmtDepth / 2.);
200
201 TGeoVolumeAssembly* camCont = new TGeoVolumeAssembly("camera_cont");
202 int copyNum = 1;
203 for (int i = -7; i <= 6; i++) {
204 double ang = (static_cast<double>(i) + 0.5) * fCameraSegmentAng;
205 TGeoMatrix* mat = MakeCombiTrans(len * sin(ToRad(ang)), 0., len * cos(ToRad(ang)), 0., ang, 0.);
206 camCont->AddNode(camStrip, copyNum, mat);
207 copyNum++;
208 }
209 return camCont;
210}
211
212TGeoVolumeAssembly* RichGeoCreator::CreateMirror()
213{
214 double mRadius = fMirrorRadius;
215 double mRadius2 = mRadius + fMirrorThickness;
216 double dTheta = fAlpha / 2. - fMirrorThetaGap * 3. / 4.;
217 double phi1 = -fMirrorPhiSize / 2.;
218 double phi2 = fMirrorPhiSize / 2.;
219 double mRot90 = 90. + fMirrorRot;
220 TGeoMedium* medGlass = fMaterials.GetMedium("RICHglass");
221
222 // Mirror tile type 0
223 double theta0 = mRot90 + fAlpha / 2. + fMirrorThetaGap * 3. / 4.;
224 TGeoSphere* op00 = new TGeoSphere("mirror_tile_type0_PB_op0", mRadius, mRadius2, theta0, theta0 + dTheta, phi1, phi2);
225 TGeoBBox* op01 = new TGeoBBox("mirror_tile_type0_PB_op1", 500., fRichWidth / 2., 10.);
226 TGeoTranslation* tr0 = MakeTrans(0., 0., -fMirrorOriginY - 10.);
227 TGeoCompositeShape* mType0 = MakeSubtraction("mirror_tile_type0_PB", op00, op01, nullptr, tr0);
228 TGeoVolume* mVolType0 = new TGeoVolume("mirror_tile_type0", mType0, medGlass);
229 //if (fSetVolumeColors) mVolType0->SetLineColor(kYellow + 1);
230
231 // Mirror tile type 1
232 double theta1 = mRot90 + fMirrorThetaGap / 2.;
233 TGeoSphere* mType1 = new TGeoSphere("mirror_tile_type1_PB", mRadius, mRadius2, theta1, theta1 + dTheta, phi1, phi2);
234 TGeoVolume* mVolType1 = new TGeoVolume("mirror_tile_type1", mType1, medGlass);
235 //if (fSetVolumeColors) mVolType1->SetLineColor(kYellow + 2);
236
237 // Mirror tile type 2
238 double theta2 = mRot90 - fAlpha / 2. + fMirrorThetaGap / 4.;
239 TGeoSphere* mType2 = new TGeoSphere("mirror_tile_type2_PB", mRadius, mRadius2, theta2, theta2 + dTheta, phi1, phi2);
240 TGeoVolume* mVolType2 = new TGeoVolume("mirror_tile_type2", mType2, medGlass);
241 //if (fSetVolumeColors) mVolType2->SetLineColor(kYellow + 3);
242
243 // Mirror tile type 3
244 double theta3 = mRot90 - fAlpha;
245 TGeoSphere* mType3 = new TGeoSphere("mirror_tile_type3_PB", mRadius, mRadius2, theta3, theta3 + dTheta, phi1, phi2);
246 TGeoVolume* mVolType3 = new TGeoVolume("mirror_tile_type3", mType3, medGlass);
247 //if (fSetVolumeColors) mVolType3->SetLineColor(kYellow - 1);
248
249 // Mirror tile type 4
250 double theta4 = mRot90 + fAlpha / 2. + fMirrorThetaGap * 3. / 4.;
251 TGeoSphere* op4_0 =
252 new TGeoSphere("mirror_tile_type4_PB_op0", mRadius, mRadius2, theta4, theta4 + dTheta, phi1, phi2);
253 TGeoBBox* op4_1 = new TGeoBBox("mirror_tile_type4_cutoff", 30, 40, 25);
254 TGeoCombiTrans* tr4_1 =
255 MakeCombiTrans(mRadius * Sin((theta4 + dTheta / 2) * pi / 180) * Cos((phi1 + phi2) / 2 * pi / 180),
256 mRadius * Sin((theta4 + dTheta / 2) * pi / 180) * Sin((phi1 + phi2) / 2 * pi / 180) + 15,
257 mRadius * Cos((theta4 + dTheta / 2) * pi / 180) - 22, 45, 0, 0);
258 TGeoCompositeShape* mType4 = MakeSubtraction("mirror_tile_type4_PB", op4_0, op4_1, nullptr, tr4_1);
259 TGeoVolume* mVolType4 = new TGeoVolume("mirror_tile_type4", mType4, medGlass);
260 //if (fSetVolumeColors) mVolType4->SetLineColor(kYellow - 2);
261
262 // Mirror tile type 5
263 double theta5 = mRot90 + fAlpha / 2. + fMirrorThetaGap * 3. / 4.;
264 TGeoSphere* op5_0 =
265 new TGeoSphere("mirror_tile_type5_PB_op0", mRadius, mRadius2, theta5, theta5 + dTheta, phi1, phi2);
266 TGeoBBox* op5_1 = new TGeoBBox("mirror_tile_type5_cutoff", 20, 30, 40);
267 TGeoCombiTrans* tr5_1 =
268 MakeCombiTrans(mRadius * Sin((theta5 + dTheta / 2) * pi / 180) * Cos((phi1 + phi2) / 2 * pi / 180),
269 mRadius * Sin((theta5 + dTheta / 2) * pi / 180) * Sin((phi1 + phi2) / 2 * pi / 180) - 20,
270 mRadius * Cos((theta5 + dTheta / 2) * pi / 180) - 22, 45, 0, 0);
271 TGeoCompositeShape* mType5 = MakeSubtraction("mirror_tile_type5_PB", op5_0, op5_1, nullptr, tr5_1);
272 TGeoVolume* mVolType5 = new TGeoVolume("mirror_tile_type5", mType5, medGlass);
273 //if (fSetVolumeColors) mVolType5->SetLineColor(kYellow - 3);
274
275 TGeoVolumeAssembly* mHalf = new TGeoVolumeAssembly("mirror_half");
276
277 for (int t = 0; t < 4; t++) {
278 TGeoVolume* mVol = nullptr;
279 if (t == 1) mVol = mVolType1;
280 if (t == 2) mVol = mVolType2;
281 if (t == 3) mVol = mVolType3;
282 for (int i = 0; i < 10; i++) {
283 double rotZ = (i - 4.5) * fMirrorPhiStep;
284 int copyNum = i + 1;
285 if (t == 0) {
286 mVol = mVolType0;
287 if (i == 4 || i == 5) { // special case for the 2 middle mirror tiles
288 mVol = (i == 4) ? mVolType5 : mVolType4;
289 copyNum = 1;
290 }
291 }
292 mHalf->AddNode(mVol, copyNum, MakeRot(0., 0., rotZ));
293 }
294 }
295
296 return mHalf;
297}
298
299TGeoVolumeAssembly* RichGeoCreator::CreateMirrorFixing(const string& sides)
300{
301 if (sides != "both" && sides != "left" && sides != "right" && sides != "none") {
302 cout << "unknown value " << sides << " for sides in function CreateMirrorFixing" << endl;
303 }
304 TGeoMedium* medGas = fMaterials.GetMedium("RICHgas_CO2_dis");
305 TGeoMedium* medAl = fMaterials.GetMedium("aluminium");
306 double distanceHalf = 19.414 / 2;
307
308 double widthHalf = 28.0 / 2;
309 double lengthHalf = 25.017 / 2;
310 double heightHalf = 2.8 / 2;
311 double thicknessHalf = 0.3 / 2;
312 double neckHalf = 9.884 / 2;
313 double partwidthHalf = 3.0 / 2;
314 double sidelenghtHalf = 14.009 / 2;
315 double sidewidthHalf = 2.0 / 2;
316
317 TGeoVolumeAssembly* mirrorFixing = new TGeoVolumeAssembly("mirrorfixing");
318 TGeoBBox* triangleSurrounding = new TGeoBBox("mirrorfixingtrianglesurrounding", lengthHalf, widthHalf, heightHalf);
319 TGeoVolume* triangle = new TGeoVolume("mirrorfixingtriangle", triangleSurrounding, medGas);
320
321 TGeoBBox* pbbase = new TGeoBBox(partwidthHalf, widthHalf, heightHalf);
322 TGeoBBox* pbbaseGas = new TGeoBBox(partwidthHalf - 2 * thicknessHalf, widthHalf - 3 - 1.897, heightHalf);
323 TGeoVolume* base = new TGeoVolume("base", pbbase, medAl);
324 TGeoVolume* baseGas = new TGeoVolume("baseGas", pbbaseGas, medGas);
325 base->AddNode(baseGas, 1);
326 triangle->AddNode(base, 1, MakeTrans(-lengthHalf + partwidthHalf, 0, 0));
327
328 // creating the sides of the diagonal part as thin boxes (avoid problem with the not 90degree angles)
329 double lenleg1 = sidelenghtHalf - 2 * sidewidthHalf / Sin(60 * pi / 180);
330 double lenleg2 = sidelenghtHalf + (sidewidthHalf - thicknessHalf) / Sin(60 * pi / 180) - partwidthHalf;
331 TGeoBBox* pbleg1 = new TGeoBBox(lenleg1, thicknessHalf, heightHalf);
332 TGeoBBox* pbleg2 = new TGeoBBox(lenleg2, thicknessHalf, heightHalf);
333 TGeoVolume* leg1 = new TGeoVolume("leg1", pbleg1, medAl);
334 TGeoVolume* leg2 = new TGeoVolume("leg2", pbleg2, medAl);
335 triangle->AddNode(leg1, 1,
336 MakeCombiTrans(-neckHalf + partwidthHalf - sidewidthHalf / Sin(60 * pi / 180),
337 -lenleg1 * Sin(30 * pi / 180) - thicknessHalf * Cos(30 * pi / 180), 0, 0, 0, 30));
338 triangle->AddNode(leg2, 1,
339 MakeCombiTrans(-neckHalf + partwidthHalf,
340 -2 * (sidewidthHalf - 2 * thicknessHalf) - lenleg2 * Sin(30 * pi / 180)
341 + thicknessHalf * Cos(30 * pi / 180),
342 0, 0, 0, 30));
343 triangle->AddNode(leg1, 2,
344 MakeCombiTrans(-neckHalf + partwidthHalf - sidewidthHalf / Sin(60 * pi / 180),
345 lenleg1 * Sin(30 * pi / 180) + thicknessHalf * Cos(30 * pi / 180), 0, 0, 0, -30));
346 triangle->AddNode(leg2, 2,
347 MakeCombiTrans(-neckHalf + partwidthHalf,
348 2 * (sidewidthHalf - 2 * thicknessHalf) + lenleg2 * Sin(30 * pi / 180)
349 - thicknessHalf * Cos(30 * pi / 180),
350 0, 0, 0, -30));
351
352 TGeoBBox* pbneck = new TGeoBBox(neckHalf, partwidthHalf, heightHalf);
353 TGeoBBox* pbneckGas = new TGeoBBox(neckHalf - 4.7, partwidthHalf - 2 * thicknessHalf, heightHalf);
354 TGeoVolume* neck = new TGeoVolume("neck", pbneck, medAl);
355 TGeoVolume* neckGas = new TGeoVolume("neckGas", pbneckGas, medGas);
356 neck->AddNode(neckGas, 1, MakeTrans(-2.35, 0, 0));
357 triangle->AddNode(neck, 1, MakeTrans(lengthHalf - neckHalf, 0, 0));
358
359 if (sides == "both" || sides == "right") {
360 mirrorFixing->AddNode(triangle, 1, MakeTrans(distanceHalf + lengthHalf, 0, 0));
361 }
362 if (sides == "both" || sides == "left") {
363 mirrorFixing->AddNode(triangle, 2, MakeCombiTrans(-distanceHalf - lengthHalf, 0, 0, 0, 0, 180));
364 }
365 if (sides == "left" || sides == "right") {
366 TGeoBBox* pbconnection = new TGeoBBox("connectionMirrorfixing", distanceHalf / 2, partwidthHalf, heightHalf);
367 TGeoBBox* pbconnectionGas = new TGeoBBox("connectionMirrorfixingGas", distanceHalf / 2,
368 partwidthHalf - 2 * thicknessHalf, heightHalf - 2 * thicknessHalf);
369 TGeoVolume* connection = new TGeoVolume("connectionMirrorfixing", pbconnection, medAl);
370 TGeoVolume* connectionGas = new TGeoVolume("connectionMirrorfixingGas", pbconnectionGas, medGas);
371 connection->AddNode(connectionGas, 1);
372 if (sides == "right") {
373 mirrorFixing->AddNode(connection, 1, MakeTrans(distanceHalf / 2, sidelenghtHalf + partwidthHalf, 0));
374 mirrorFixing->AddNode(connection, 2, MakeTrans(distanceHalf / 2, -sidelenghtHalf - partwidthHalf, 0));
375 }
376 else {
377 mirrorFixing->AddNode(connection, 1, MakeTrans(-distanceHalf / 2, sidelenghtHalf + partwidthHalf, 0));
378 mirrorFixing->AddNode(connection, 2, MakeTrans(-distanceHalf / 2, -sidelenghtHalf - partwidthHalf, 0));
379 }
380 }
381 else {
382 TGeoBBox* pbconnection = new TGeoBBox("connectionMirrorfixing", distanceHalf, partwidthHalf, heightHalf);
383 TGeoBBox* pbconnectionGas = new TGeoBBox("connectionMirrorfixingGas", distanceHalf,
384 partwidthHalf - 2 * thicknessHalf, heightHalf - 2 * thicknessHalf);
385 TGeoVolume* connection = new TGeoVolume("connectionMirrorfixing", pbconnection, medAl);
386 TGeoVolume* connectionGas = new TGeoVolume("connectionMirrorfixingGas", pbconnectionGas, medGas);
387 connection->AddNode(connectionGas, 1);
388 mirrorFixing->AddNode(connection, 1, MakeTrans(0, sidelenghtHalf + partwidthHalf, 0));
389 mirrorFixing->AddNode(connection, 2, MakeTrans(0, -sidelenghtHalf - partwidthHalf, 0));
390 }
391 return mirrorFixing;
392}
393
394TGeoVolume* RichGeoCreator::CreateStuds(double ypos, double lenHalf, double angle, const string& mirrorfixing)
395{
396 TGeoMedium* medGas = fMaterials.GetMedium("RICHgas_CO2_dis");
397 TGeoMedium* medAl = fMaterials.GetMedium("aluminium");
398
399 double StudsSizeHalf = 5.;
400 double StudsSizeHalfGas = 4.8;
401 double lenHalf1 = lenHalf + Tan(angle * pi / 180) * StudsSizeHalf / 2;
402 double lenHalf2 = lenHalf - Tan(angle * pi / 180) * StudsSizeHalf / 2;
403 double alpha1 = angle / 2;
404 double gaslencor = (StudsSizeHalf - StudsSizeHalfGas) * Tan(angle * pi / 180) / 2;
405
406 TGeoTrap* StudsGas =
407 new TGeoTrap("StudsGas_Trap", StudsSizeHalfGas, 0, 0, StudsSizeHalfGas, lenHalf1 - gaslencor, lenHalf2 + gaslencor,
408 alpha1, StudsSizeHalfGas, lenHalf1 - gaslencor, lenHalf2 + gaslencor, alpha1);
409 TGeoTrap* Studs = new TGeoTrap("Studs_Trap", StudsSizeHalf, 0, 0, StudsSizeHalf, lenHalf1, lenHalf2, alpha1,
410 StudsSizeHalf, lenHalf1, lenHalf2, alpha1);
411 TGeoVolume* volStudsGas = new TGeoVolume("StudsGas", StudsGas, medGas);
412 TGeoVolume* volStuds = new TGeoVolume("Studs", Studs, medAl);
413
414 volStuds->AddNode(volStudsGas, 1);
415 TGeoVolume* returnVol = new TGeoVolumeAssembly(("Stud" + std::to_string(lenHalf * 2)).c_str());
416 returnVol->AddNode(
417 volStuds, 1, MakeCombiTrans(0, ypos, lenHalf + 5 / 2, 0, 90, 0)); // the 5 is the half thickness of the pillars
418
419 double endPlatelenHalf = 7;
420 double endPlateWidthHalf = endPlatelenHalf;
421 double endPlateThicknessHalf = 0.79 / 2;
422 TGeoBBox* endPlate = new TGeoBBox("StudEndPlate", endPlatelenHalf, endPlateWidthHalf, endPlateThicknessHalf);
423 TGeoVolume* volendPlate = new TGeoVolume("StudEndPlate", endPlate, medAl);
424 returnVol->AddNode(volendPlate, 1, MakeCombiTrans(0, ypos, 2 * lenHalf + 5.0 / 2.0, -angle, 0, 0));
425
426 TGeoVolumeAssembly* mirrorFixing = CreateMirrorFixing(mirrorfixing);
427 returnVol->AddNode(mirrorFixing, 1, MakeCombiTrans(0, ypos, 2 * lenHalf + 5.0 / 2.0, -angle, 0, 0));
428
429 return returnVol;
430}
431
433{
434 TGeoMedium* medGas = fMaterials.GetMedium("RICHgas_CO2_dis");
435 TGeoMedium* medAl = fMaterials.GetMedium("aluminium");
436
437 double lenHalf = 79 / 2;
438 double widthHalf = 3.0;
439 double hightHalf = 1.25;
440 double thickness = 0.2;
441 double lendiff = widthHalf * Tan(8.5 * pi / 180);
442 double gaslencor = (thickness) * (lendiff) / (widthHalf);
443
444 TGeoTrap* PillarConnectionGas =
445 new TGeoTrap("PillarConnectionGas_Trap", hightHalf - thickness, 0, 0, widthHalf - thickness,
446 lenHalf + lendiff - gaslencor, lenHalf - lendiff + gaslencor, 0, widthHalf - thickness,
447 lenHalf + lendiff - gaslencor, lenHalf - lendiff + gaslencor, 0);
448 TGeoTrap* PillarConnection = new TGeoTrap("PillarConnection_Trap", hightHalf, 0, 0, widthHalf, lenHalf + lendiff,
449 lenHalf - lendiff, 0, widthHalf, lenHalf + lendiff, lenHalf - lendiff, 0);
450 TGeoVolume* volPillarConnectionGas = new TGeoVolume("PillarConnectionGas", PillarConnectionGas, medGas);
451 TGeoVolume* volPillarConnection = new TGeoVolume("PillarConnection", PillarConnection, medAl);
452 volPillarConnection->AddNode(volPillarConnectionGas, 1);
453 TGeoVolume* returnVol = new TGeoVolumeAssembly("PillarConnection");
454 returnVol->AddNode(volPillarConnection, 1, MakeCombiTrans(0, 0, 0, -90, 0, 0));
455 return returnVol;
456}
457
459{
460 TGeoMedium* medGas = fMaterials.GetMedium("RICHgas_CO2_dis");
461 TGeoMedium* medAl = fMaterials.GetMedium("aluminium");
462
463 TGeoBBox* pbGas = new TGeoBBox("mirror_support_pillar_gas_PB", 4.8, (fRichHeight / 2.) - 10.5, 4.8);
464 TGeoBBox* pb = new TGeoBBox("mirror_support_pillar_PB", 5., (fRichHeight / 2.) - 10.5, 5.);
465
466 TGeoVolume* volGas = new TGeoVolume("mirror_support_pillar_gas", pbGas, medGas);
467 TGeoVolume* vol = new TGeoVolume("mirror_support_pillar", pb, medAl);
468 //if (fSetVolumeColors) volGas->SetLineColor(kAzure + 5);
469 //if (fSetVolumeColors) vol->SetLineColor(kAzure + 5);
470 vol->AddNode(volGas, 1);
471
472 TGeoVolume* Stud1b = CreateStuds(16.4, 30.03 / 2., 24.2, "both");
473 TGeoVolume* Stud2b = CreateStuds(57.8, 14.86 / 2., 15.9, "both");
474 TGeoVolume* Stud3b = CreateStuds(101.05, 5.74 / 2., 7.7, "both");
475 TGeoVolume* Stud4b = CreateStuds(145.4, 2.9 / 2., -0.5, "both");
476 TGeoVolume* Stud1l = CreateStuds(16.4, 30.03 / 2., 24.2, "left");
477 TGeoVolume* Stud2l = CreateStuds(57.8, 14.86 / 2., 15.9, "left");
478 TGeoVolume* Stud3l = CreateStuds(101.05, 5.74 / 2., 7.7, "left");
479 TGeoVolume* Stud4l = CreateStuds(145.4, 2.9 / 2., -0.5, "left");
480 TGeoVolume* Stud1r = CreateStuds(16.4, 30.03 / 2., 24.2, "right");
481 TGeoVolume* Stud2r = CreateStuds(57.8, 14.86 / 2., 15.9, "right");
482 TGeoVolume* Stud3r = CreateStuds(101.05, 5.74 / 2., 7.7, "right");
483 TGeoVolume* Stud4r = CreateStuds(145.4, 2.9 / 2., -0.5, "right");
484
485 TGeoVolumeAssembly* Studs = new TGeoVolumeAssembly("Studs");
486 Studs->AddNode(Stud1b, 1, MakeCombiTrans(0, 0, -5, 0, 180, 0));
487 Studs->AddNode(Stud2b, 2, MakeCombiTrans(0, 0, -5, 0, 180, 0));
488 Studs->AddNode(Stud3b, 3, MakeCombiTrans(0, 0, -5, 0, 180, 0));
489 Studs->AddNode(Stud4b, 4, MakeCombiTrans(0, 0, -5, 0, 180, 0));
490 Studs->AddNode(Stud1b, 5, MakeCombiTrans(0, 0, -5, 0, 180, 180));
491 Studs->AddNode(Stud2b, 6, MakeCombiTrans(0, 0, -5, 0, 180, 180));
492 Studs->AddNode(Stud3b, 7, MakeCombiTrans(0, 0, -5, 0, 180, 180));
493 Studs->AddNode(Stud4b, 8, MakeCombiTrans(0, 0, -5, 0, 180, 180));
494
495 TGeoVolumeAssembly* Studs1 = new TGeoVolumeAssembly("Studs1");
496 Studs1->AddNode(Stud1r, 1, MakeCombiTrans(0, 0, -5, 0, 180, 0));
497 Studs1->AddNode(Stud2r, 2, MakeCombiTrans(0, 0, -5, 0, 180, 0));
498 Studs1->AddNode(Stud3r, 3, MakeCombiTrans(0, 0, -5, 0, 180, 0));
499 Studs1->AddNode(Stud4r, 4, MakeCombiTrans(0, 0, -5, 0, 180, 0));
500 Studs1->AddNode(Stud1l, 5, MakeCombiTrans(0, 0, -5, 0, 180, 180));
501 Studs1->AddNode(Stud2l, 6, MakeCombiTrans(0, 0, -5, 0, 180, 180));
502 Studs1->AddNode(Stud3l, 7, MakeCombiTrans(0, 0, -5, 0, 180, 180));
503 Studs1->AddNode(Stud4l, 8, MakeCombiTrans(0, 0, -5, 0, 180, 180));
504
505 TGeoVolumeAssembly* Studs6 = new TGeoVolumeAssembly("Studs6");
506 Studs6->AddNode(Stud1l, 1, MakeCombiTrans(0, 0, -5, 0, 180, 0));
507 Studs6->AddNode(Stud2l, 2, MakeCombiTrans(0, 0, -5, 0, 180, 0));
508 Studs6->AddNode(Stud3l, 3, MakeCombiTrans(0, 0, -5, 0, 180, 0));
509 Studs6->AddNode(Stud4l, 4, MakeCombiTrans(0, 0, -5, 0, 180, 0));
510 Studs6->AddNode(Stud1r, 5, MakeCombiTrans(0, 0, -5, 0, 180, 180));
511 Studs6->AddNode(Stud2r, 6, MakeCombiTrans(0, 0, -5, 0, 180, 180));
512 Studs6->AddNode(Stud3r, 7, MakeCombiTrans(0, 0, -5, 0, 180, 180));
513 Studs6->AddNode(Stud4r, 8, MakeCombiTrans(0, 0, -5, 0, 180, 180));
514
515 TGeoVolumeAssembly* Studs3 = new TGeoVolumeAssembly("Studs3");
516 Studs3->AddNode(Stud1l, 1, MakeCombiTrans(0, 0, -5, 0, 180, 0));
517 Studs3->AddNode(Stud2b, 2, MakeCombiTrans(0, 0, -5, 0, 180, 0));
518 Studs3->AddNode(Stud3b, 3, MakeCombiTrans(0, 0, -5, 0, 180, 0));
519 Studs3->AddNode(Stud4b, 4, MakeCombiTrans(0, 0, -5, 0, 180, 0));
520 Studs3->AddNode(Stud1r, 5, MakeCombiTrans(0, 0, -5, 0, 180, 180));
521 Studs3->AddNode(Stud2b, 6, MakeCombiTrans(0, 0, -5, 0, 180, 180));
522 Studs3->AddNode(Stud3b, 7, MakeCombiTrans(0, 0, -5, 0, 180, 180));
523 Studs3->AddNode(Stud4b, 8, MakeCombiTrans(0, 0, -5, 0, 180, 180));
524
525 TGeoVolumeAssembly* Studs4 = new TGeoVolumeAssembly("Studs4");
526 Studs4->AddNode(Stud1r, 1, MakeCombiTrans(0, 0, -5, 0, 180, 0));
527 Studs4->AddNode(Stud2b, 2, MakeCombiTrans(0, 0, -5, 0, 180, 0));
528 Studs4->AddNode(Stud3b, 3, MakeCombiTrans(0, 0, -5, 0, 180, 0));
529 Studs4->AddNode(Stud4b, 4, MakeCombiTrans(0, 0, -5, 0, 180, 0));
530 Studs4->AddNode(Stud1l, 5, MakeCombiTrans(0, 0, -5, 0, 180, 180));
531 Studs4->AddNode(Stud2b, 6, MakeCombiTrans(0, 0, -5, 0, 180, 180));
532 Studs4->AddNode(Stud3b, 7, MakeCombiTrans(0, 0, -5, 0, 180, 180));
533 Studs4->AddNode(Stud4b, 8, MakeCombiTrans(0, 0, -5, 0, 180, 180));
534
535 TGeoVolume* PillarConnection = CreatePillarConnection();
536
537 double dZ = 41.;
538 TGeoVolumeAssembly* pillars = new TGeoVolumeAssembly("mirror_support_pillars");
539 pillars->AddNode(vol, 1, MakeCombiTrans(210.7759 - 2.035, 0., -29.5298 + dZ - 12.4346, 0., 42., 0.));
540 pillars->AddNode(Studs1, 1, MakeCombiTrans(210.7759 - 2.035, 0., -29.5298 + dZ - 12.4346, 0., 42., 0.));
541 pillars->AddNode(PillarConnection, 1, MakeCombiTrans(170.7323, 0., -15.9069 + dZ, 0., 33.6, 0.));
542 pillars->AddNode(vol, 2, MakeCombiTrans(134.1222 - 1.3985, 0., 21.3989 + dZ - 11.2483, 0., 25.2, 0.));
543 pillars->AddNode(Studs, 1, MakeCombiTrans(134.1222 - 1.3985, 0., 21.3989 + dZ - 11.2483, 0., 25.2, 0.));
544 pillars->AddNode(PillarConnection, 2, MakeCombiTrans(89.097, 0., 23.74 + dZ, 0., 16.8, 0.));
545 pillars->AddNode(vol, 3, MakeCombiTrans(46.015 - 0.545, 0., 48. + dZ - 10.6668, 0., 8.4, 0.));
546 pillars->AddNode(Studs3, 1, MakeCombiTrans(46.015 - 0.545, 0., 48. + dZ - 10.6668, 0., 8.4, 0.));
547 pillars->AddNode(PillarConnection, 3, MakeCombiTrans(0., 38.75, 37.34 + dZ, 0., 0., 0.));
548 pillars->AddNode(PillarConnection, 4, MakeCombiTrans(0., -38.75, 37.34 + dZ, 0., 0., 0.));
549 pillars->AddNode(vol, 4, MakeCombiTrans(-46.015 + 0.545, 0., 48. + dZ - 10.6668, 0., -8.4, 0.));
550 pillars->AddNode(Studs4, 1, MakeCombiTrans(-46.015 + 0.545, 0., 48. + dZ - 10.6668, 0., -8.4, 0.));
551 pillars->AddNode(PillarConnection, 5, MakeCombiTrans(-89.097, 0., 23.74 + dZ, 0., -16.8, 0.));
552 pillars->AddNode(vol, 5, MakeCombiTrans(-134.1222 + 1.3985, 0., 21.3989 + dZ - 11.2483, 0., -25.2, 0.));
553 pillars->AddNode(Studs, 2, MakeCombiTrans(-134.1222 + 1.3985, 0., 21.3989 + dZ - 11.2483, 0., -25.2, 0.));
554 pillars->AddNode(PillarConnection, 6, MakeCombiTrans(-170.7323, 0., -15.9069 + dZ, 0., -33.6, 0.));
555 pillars->AddNode(vol, 6, MakeCombiTrans(-210.7759 + 2.035, 0., -29.5298 + dZ - 12.4346, 0., -42., 0.));
556 pillars->AddNode(Studs6, 1, MakeCombiTrans(-210.7759 + 2.035, 0., -29.5298 + dZ - 12.4346, 0., -42., 0.));
557
558 return pillars;
559}
560
561//TGeoVolumeAssembly* RichGeoCreator::CreateBeltAssembly()
562//{
563// TGeoMedium* medGas = fMaterials.GetMedium("RICHgas_CO2_dis");
564// TGeoMedium* medAl = fMaterials.GetMedium("aluminium");
565//
566// TGeoBBox* pbGas1 = new TGeoBBox("belt1_gas_PB", 1.25, 10.367, 1.167);
567// TGeoBBox* pb1 = new TGeoBBox("belt1_PB", 1.5, 10.6, 1.4);
568// TGeoVolume* volGas1 = new TGeoVolume("belt1_gas", pbGas1, medGas);
569// TGeoVolume* vol1 = new TGeoVolume("belt1", pb1, medAl);
570// //if (fSetVolumeColors) volGas1->SetLineColor(kViolet + 8);
571// //if (fSetVolumeColors) vol1->SetLineColor(kViolet + 8);
572// vol1->AddNode(volGas1, 1, MakeTrans(0., 0., 0.233));
573//
574// TGeoBBox* pbGas2 = new TGeoBBox("belt2_gas_PB", 4.7835, 1.25, 1.167);
575// TGeoBBox* pb2 = new TGeoBBox("belt2_PB", 4.9, 1.5, 1.4);
576// TGeoVolume* volGas2 = new TGeoVolume("belt2_gas", pbGas2, medGas);
577// TGeoVolume* vol2 = new TGeoVolume("belt2", pb2, medAl);
578// //if (fSetVolumeColors) volGas2->SetLineColor(kViolet + 8);
579// //if (fSetVolumeColors) vol2->SetLineColor(kViolet + 8);
580// vol2->AddNode(volGas2, 1, MakeTrans(0.1165, 0., 0.233));
581//
582// TGeoBBox* pbGas3 = new TGeoBBox("belt3_gas_PB", 11.6135, 1.25, 1.167);
583// TGeoBBox* pb3 = new TGeoBBox("belt3_PB", 11.73, 1.5, 1.4);
584// TGeoVolume* volGas3 = new TGeoVolume("belt3_gas", pbGas3, medGas);
585// TGeoVolume* vol3 = new TGeoVolume("belt3", pb3, medAl);
586// //if (fSetVolumeColors) volGas3->SetLineColor(kViolet + 8);
587// //if (fSetVolumeColors) vol3->SetLineColor(kViolet + 8);
588// vol3->AddNode(volGas3, 1, MakeTrans(0.1165, 0., 0.233));
589//
590// TGeoTrap* pbGas4 = new TGeoTrap("belt4_gas_PB", 0.7, 16.22, 90., 10.97, 1.3, 1.3, 0., 9.5, 1.3, 1.3, 0.);
591// TGeoTrap* pb4 = new TGeoTrap("belt4_PB", 0.9, 16.22, 90., 11.378, 1.4, 1.4, 0., 9.5, 1.4, 1.4, 0.);
592// TGeoVolume* volGas4 = new TGeoVolume("belt4_gas", pbGas4, medGas);
593// TGeoVolume* vol4 = new TGeoVolume("belt4", pb4, medAl);
594// //if (fSetVolumeColors) volGas4->SetLineColor(kViolet + 8);
595// //if (fSetVolumeColors) vol4->SetLineColor(kViolet + 8);
596// vol4->AddNode(volGas4, 1, MakeTrans(0.1, 0., 0.));
597//
598// TGeoVolumeAssembly* belt = new TGeoVolumeAssembly("belt");
599// belt->AddNode(vol1, 1);
600// belt->AddNode(vol2, 1, MakeTrans(-6.4, 9.1, 0.));
601// belt->AddNode(vol3, 1, MakeTrans(-13.23, -9.1, 0.));
602// belt->AddNode(vol4, 1, MakeCombiTrans(-17.567, 0.75, 0., -127., -90., -90.));
603//
604// return belt;
605//}
606
607//TGeoVolumeAssembly* RichGeoCreator::CreateMirrorSupportBelts()
608//{
609// double mRadius2 = fMirrorRadius + fMirrorThickness;
610// double mRadius3 = mRadius2 + fMirrorSupportAdd;
611// double phi1 = -fMirrorPhiSize / 2.;
612// double phi2 = fMirrorPhiSize / 2.;
613// double dTheta = fMirrorThetaSize;
614// double mRot90 = 90. + fMirrorRot;
615// double richWidthHalf = fRichWidth / 2.;
616// TGeoMedium* medGas = fMaterials.GetMedium("RICHgas_CO2_dis");
617//
618// TGeoVolumeAssembly* beltAssembly = CreateBeltAssembly();
619//
620// // Type 0
621// double theta0 = mRot90 + fAlpha / 2. + fMirrorThetaGap * 3. / 4.;
622// TGeoSphere* sphere0 = new TGeoSphere("belt_type0_PB_op0", mRadius2, mRadius3, theta0, theta0 + dTheta, phi1, phi2);
623// TGeoBBox* box0 = new TGeoBBox("belt_type0_PB_op1", 500., richWidthHalf, 10.);
624// TGeoCompositeShape* pbType0 =
625// MakeSubtraction("belt_type0_PB", sphere0, box0, nullptr, MakeTrans(0., 0., -fMirrorOriginY - 10.));
626// TGeoVolume* volType0 = new TGeoVolume("belt_type0", pbType0, medGas);
627// volType0->AddNode(beltAssembly, 1, MakeCombiTrans(275.5, -13.23, -124.7, 65., 0., -90.));
628// //if (fSetVolumeColors) volType0->SetLineColor(kGreen);
629//
630// // Type 1
631// double theta1 = mRot90 + fMirrorThetaGap / 2.;
632// TGeoSphere* pbType1 = new TGeoSphere("belt_type1_PB", mRadius2, mRadius3, theta1, theta1 + dTheta, phi1, phi2);
633// TGeoVolume* volType1 = new TGeoVolume("belt_type1", pbType1, medGas);
634// volType1->AddNode(beltAssembly, 1, MakeCombiTrans(290.4, -13.23, -84.0, 73., 0., -90.));
635// //if (fSetVolumeColors) volType1->SetLineColor(kGreen - 1);
636//
637// // Type 2
638// double theta2 = mRot90 - fAlpha / 2. + fMirrorThetaGap / 4.;
639// TGeoSphere* pbType2 = new TGeoSphere("belt_type2_PB", mRadius2, mRadius3, theta2, theta2 + dTheta, phi1, phi2);
640// TGeoVolume* volType2 = new TGeoVolume("belt_type2", pbType2, medGas);
641// volType2->AddNode(beltAssembly, 1, MakeCombiTrans(299.4, -13.23, -41.5, 82., 0., -90.));
642// //if (fSetVolumeColors) volType2->SetLineColor(kGreen - 2);
643//
644// // Type 3
645// double theta3 = mRot90 - fAlpha;
646// TGeoSphere* pbType3 = new TGeoSphere("belt_type3_PB", mRadius2, mRadius3, theta3, theta3 + dTheta, phi1, phi2);
647// TGeoVolume* volType3 = new TGeoVolume("belt_type3", pbType3, medGas);
648// volType3->AddNode(beltAssembly, 1, MakeCombiTrans(302.5, -13.23, 1.97, 91., 0., -90.));
649// //if (fSetVolumeColors) volType3->SetLineColor(kGreen - 3);
650//
651// //// Type 4
652// //double theta4 = mRot90 + fAlpha / 2. + fMirrorThetaGap * 3. / 4.;
653// //TGeoSphere* sphere4 = new TGeoSphere("belt_type4_PB_op0", mRadius2, mRadius3, theta4, theta4 + dTheta, phi1, phi2);
654// //TGeoTubeSeg* tube4 = new TGeoTubeSeg("belt_type4_PB_op1", 0., fPipeOuterRadiusExit, 400., 0., 360.);
655// //TGeoCompositeShape* sub4_1 = MakeSubtraction("belt_type4_PB_op01", sphere4, tube4, nullptr, MakeCombiTrans(0., 0., -fMirrorOriginY, 90., 0., 90. + fMirrorPhiStep * 0.5));
656// //TGeoBBox* box4 = new TGeoBBox("belt_type4_PB_op2", 500., richWidthHalf, 10.);
657// //TGeoCompositeShape* pbType4 = MakeSubtraction("belt_type4_PB", sub4_1, box4, nullptr, MakeTrans(0., 0., -fMirrorOriginY - 10.));
658// //TGeoVolume* volType4 = new TGeoVolume("belt_type4", pbType4, medGas);
659// //volType4->AddNode(beltAssembly, 1, MakeCombiTrans(281.0, 0., -113.0, 0., -66., 0.));
660// ////if (fSetVolumeColors) volType4->SetLineColor(kGreen + 1);
661// //
662// //// Type 5
663// //double theta5 = mRot90 + fAlpha / 2. + fMirrorThetaGap * 3. / 4.;
664// //TGeoSphere* sphere5 = new TGeoSphere("belt_type5_PB_op0", mRadius2, mRadius3, theta5, theta5 + dTheta, phi1, phi2);
665// //TGeoTubeSeg* tube5 = new TGeoTubeSeg("belt_type5_PB_op1", 0., fPipeOuterRadiusExit, 400., 0., 360.);
666// //TGeoCompositeShape* sub5_1 = MakeSubtraction("belt_type5_PB_op01", sphere5, tube5, nullptr, MakeCombiTrans(0., 0., -fMirrorOriginY, 90., 0., 90. - fMirrorPhiStep * 0.5));
667// //TGeoBBox* box5 = new TGeoBBox("belt_type5_PB_op2", 500., richWidthHalf, 10.);
668// //TGeoCompositeShape* pbType5 = MakeSubtraction("belt_type5_PB", sub5_1, box5, nullptr, MakeTrans(0., 0., -fMirrorOriginY - 10.));
669// //TGeoVolume* volType5 = new TGeoVolume("belt_type5", pbType5, medGas);
670// //volType5->AddNode(beltAssembly, 1, MakeCombiTrans(281., 0., -113., 0., -114., 180.));
671// ////if (fSetVolumeColors) volType5->SetLineColor(kGreen + 2);
672//
673// TGeoVolumeAssembly* contHalf = new TGeoVolumeAssembly("mirror_support_belts_half");
674// for (int t = 0; t < 4; t++) {
675// TGeoVolume* mVol = nullptr;
676// if (t == 1) mVol = volType1;
677// if (t == 2) mVol = volType2;
678// if (t == 3) mVol = volType3;
679// for (int i = 0; i < 10; i++) {
680// double rotZ = (i - 4.5) * fMirrorPhiStep;
681// int copyNum = i + 1;
682// if (t == 0) {
683// mVol = volType0;
684// if (i == 4 || i == 5) { // special case for the 2 middle belts
685// continue; //mVol = (i == 4) ? volType5 : volType4;
686// copyNum = 1;
687// }
688// }
689// contHalf->AddNode(mVol, copyNum, MakeRot(0., 0., rotZ));
690// }
691// }
692// return contHalf;
693//}
694
696{
697 TGeoMedium* medGas = fMaterials.GetMedium("RICHgas_CO2_dis");
698 TGeoMedium* medAlum = fMaterials.GetMedium("aluminium");
699
700 double frameSizeHalf = 5.;
701 double frameSizeHalfGas = 4.3;
702 double richHeightHalf = fRichHeight / 2.;
703 double richLengthHalf = fRichLength / 2.;
704 double richWidthHalf = fRichWidth / 2.;
705 double coverThickness = fRichCoveringThickness;
706
707 //double posY = richHeightHalf - coverThickness - frameSizeHalf;
708 double rotX = 90 - fCameraFullRotX;
709 double lenHalf2 = 23.2919390;
710 double lenHalf3 = 20.;
711 double lenHalf5 = richHeightHalf - Tan(rotX * pi / 180.0) * lenHalf3 * 2.0 - fRichCoveringThickness;
712 double lenHalf6 = richLengthHalf - lenHalf2 - lenHalf3 - fRichCoveringThickness - 2 * frameSizeHalf;
713 double lenHalf8 =
714 (richWidthHalf - fRichCoveringThickness - 229.3 / 2) / 2; // the 229.3 are the width of the shieldingbox
715
716 double posY = richHeightHalf - coverThickness - frameSizeHalf;
717 double posY2 = fRichEntranceHeight / 2 + fRichFlangeThickness + frameSizeHalf;
718 double posY3 = posY - Tan(rotX * pi / 180.0) * lenHalf3 * 2.0;
719 double posZ1 = -147.779439;
720 double posZ2 = posZ1 + lenHalf2 + 2 * lenHalf3;
721 double posZ3 = posZ1 + 2 * lenHalf2 + 2 * lenHalf3;
722 double posZ4 = posZ1 + fRichLength - fRichCoveringThickness;
723 double posX1 = fRichEntranceWidth / 2 + fRichFlangeThickness + frameSizeHalf;
724 double posX3 = richWidthHalf - frameSizeHalf - fRichCoveringThickness;
725 double posX2 = (posX1 + posX3) / 2;
726
727 TGeoBBox* crossingbox =
728 new TGeoBBox("crossing", frameSizeHalf, frameSizeHalf,
729 frameSizeHalf); // to cutoff parts of the frames where they would overlap each other
730
731 TGeoVolumeAssembly* mainFrame = new TGeoVolumeAssembly("mainframe");
732
733 // parts along x-axis
734 TGeoBBox* pbGas1 = new TGeoBBox("mainframe1_gas_PB", richWidthHalf - frameSizeHalf * 2 - fRichCoveringThickness,
735 frameSizeHalfGas, frameSizeHalfGas);
736 TGeoBBox* pb1 = new TGeoBBox("mainframe1_PB", richWidthHalf - frameSizeHalf * 2 - fRichCoveringThickness,
737 frameSizeHalf, frameSizeHalf);
738 TGeoVolume* volGas1 = new TGeoVolume("mainframe1_gas", pbGas1, medGas);
739 TGeoVolume* vol1 = new TGeoVolume("mainframe1", pb1, medAlum);
740 //if (fSetVolumeColors) vol1->SetLineColor(kBlue);
741 //if (fSetVolumeColors) volGas1->SetLineColor(kBlue);
742 vol1->AddNode(volGas1, 1);
743 mainFrame->AddNode(vol1, 1, MakeTrans(0, posY2, posZ1));
744 mainFrame->AddNode(vol1, 2, MakeTrans(0, -posY2, posZ1));
745 mainFrame->AddNode(vol1, 3, MakeTrans(0., posY, posZ4 - frameSizeHalf));
746 mainFrame->AddNode(vol1, 4, MakeTrans(0., posY, posZ3));
747 mainFrame->AddNode(vol1, 5, MakeTrans(0., -posY, posZ4 - frameSizeHalf));
748 mainFrame->AddNode(vol1, 6, MakeTrans(0., -posY, posZ3));
749
750 // first parts along z-axis (short)
751 TGeoBBox* pbGas2 = new TGeoBBox("mainframe2_gas_PB", frameSizeHalfGas, frameSizeHalfGas, lenHalf2 - frameSizeHalf);
752 TGeoBBox* pb2 = new TGeoBBox("mainframe2_PB", frameSizeHalf, frameSizeHalf, lenHalf2 - frameSizeHalf);
753 TGeoVolume* volGas2 = new TGeoVolume("mainframe2_gas", pbGas2, medGas);
754 TGeoVolume* vol2 = new TGeoVolume("mainframe2", pb2, medAlum);
755 //if (fSetVolumeColors) vol2->SetLineColor(kBlue + 1);
756 //if (fSetVolumeColors) volGas2->SetLineColor(kBlue + 1);
757 vol2->AddNode(volGas2, 1);
758 mainFrame->AddNode(vol2, 1, MakeTrans(-posX1, posY, posZ2 - frameSizeHalf / 2));
759 mainFrame->AddNode(vol2, 2, MakeTrans(-posX1, -posY, posZ2 - frameSizeHalf / 2));
760 mainFrame->AddNode(vol2, 3, MakeTrans(posX1, posY, posZ2 - frameSizeHalf / 2));
761 mainFrame->AddNode(vol2, 4, MakeTrans(posX1, -posY, posZ2 - frameSizeHalf / 2));
762 mainFrame->AddNode(vol2, 5, MakeTrans(posX3, posY, posZ2 - frameSizeHalf / 2));
763 mainFrame->AddNode(vol2, 6, MakeTrans(posX3, -posY, posZ2 - frameSizeHalf / 2));
764 mainFrame->AddNode(vol2, 7, MakeTrans(-posX3, posY, posZ2 - frameSizeHalf / 2));
765 mainFrame->AddNode(vol2, 8, MakeTrans(-posX3, -posY, posZ2 - frameSizeHalf / 2));
766
767 // diagonal parts (y-z)
768 //double gaslencor = (1 - frameSizeHalfGas / frameSizeHalf) * 3;
769 TGeoTrap* pbGas3 =
770 new TGeoTrap("mainframe3_gas_PB", frameSizeHalfGas, 0, 0, lenHalf3 - frameSizeHalf - coverThickness, 6.3, 9.3, rotX,
771 lenHalf3 - frameSizeHalf - coverThickness, 6.3, 9.3, rotX);
772 TGeoTrap* pb3 = new TGeoTrap("mainframe3_PB", frameSizeHalf, 0, 0, lenHalf3 - frameSizeHalf, 7, 10, rotX,
773 lenHalf3 - frameSizeHalf, 7, 10, rotX);
774 TGeoVolume* volGas3 = new TGeoVolume("mainframe3_gas", pbGas3, medGas);
775 TGeoVolume* vol3 = new TGeoVolume("mainframe3", pb3, medAlum);
776 TGeoRotation* rotup = new TGeoRotation();
777 rotup->RotateX(-90 + rotX * pi / 180);
778 rotup->RotateZ(180);
779 rotup->RotateY(90);
780 vol3->AddNode(volGas3, 1);
781 mainFrame->AddNode(vol3, 1,
782 new TGeoCombiTrans(*MakeTrans(-posX3, posY - Tan(rotX * pi / 180) * lenHalf3 + frameSizeHalf,
783 posZ1 + lenHalf3 + frameSizeHalf / 2),
784 rotup->Inverse()));
785 mainFrame->AddNode(vol3, 2,
786 new TGeoCombiTrans(*MakeTrans(-posX1, posY - Tan(rotX * pi / 180) * lenHalf3 + frameSizeHalf,
787 posZ1 + lenHalf3 + frameSizeHalf / 2),
788 rotup->Inverse()));
789 mainFrame->AddNode(vol3, 3,
790 new TGeoCombiTrans(*MakeTrans(posX1, posY - Tan(rotX * pi / 180) * lenHalf3 + frameSizeHalf,
791 posZ1 + lenHalf3 + frameSizeHalf / 2),
792 rotup->Inverse()));
793 mainFrame->AddNode(vol3, 4,
794 new TGeoCombiTrans(*MakeTrans(posX3, posY - Tan(rotX * pi / 180) * lenHalf3 + frameSizeHalf,
795 posZ1 + lenHalf3 + frameSizeHalf / 2),
796 rotup->Inverse()));
797 TGeoRotation* rotdown = new TGeoRotation();
798 rotdown->RotateX(-90 + rotX * pi / 180);
799 rotdown->RotateY(90);
800 mainFrame->AddNode(vol3, 5,
801 new TGeoCombiTrans(*MakeTrans(-posX3, -posY + Tan(rotX * pi / 180) * lenHalf3 - frameSizeHalf,
802 posZ1 + lenHalf3 + frameSizeHalf / 2),
803 rotdown->Inverse()));
804 mainFrame->AddNode(vol3, 6,
805 new TGeoCombiTrans(*MakeTrans(-posX1, -posY + Tan(rotX * pi / 180) * lenHalf3 - frameSizeHalf,
806 posZ1 + lenHalf3 + frameSizeHalf / 2),
807 rotdown->Inverse()));
808 mainFrame->AddNode(vol3, 7,
809 new TGeoCombiTrans(*MakeTrans(posX1, -posY + Tan(rotX * pi / 180) * lenHalf3 - frameSizeHalf,
810 posZ1 + lenHalf3 + frameSizeHalf / 2),
811 rotdown->Inverse()));
812 mainFrame->AddNode(vol3, 8,
813 new TGeoCombiTrans(*MakeTrans(posX3, -posY + Tan(rotX * pi / 180) * lenHalf3 - frameSizeHalf,
814 posZ1 + lenHalf3 + frameSizeHalf / 2),
815 rotdown->Inverse()));
816
817
818 // long vertical parts
819 TGeoBBox* pbGas4 =
820 new TGeoBBox("mainframe4_gas_PB", frameSizeHalfGas, richHeightHalf - coverThickness, frameSizeHalfGas);
821 TGeoBBox* pb4 = new TGeoBBox("mainframe4_PB", frameSizeHalf, richHeightHalf - coverThickness, frameSizeHalf);
822 TGeoVolume* volGas4 = new TGeoVolume("mainframe4_gas", pbGas4, medGas);
823 TGeoVolume* vol4 = new TGeoVolume("mainframe4", pb4, medAlum);
824 //if (fSetVolumeColors) vol4->SetLineColor(kBlue + 3);
825 //if (fSetVolumeColors) volGas4->SetLineColor(kBlue + 3);
826 vol4->AddNode(volGas4, 1);
827 mainFrame->AddNode(vol4, 1, MakeTrans(-posX3, 0., posZ4 - frameSizeHalf));
828 mainFrame->AddNode(vol4, 2, MakeTrans(posX3, 0., posZ4 - frameSizeHalf));
829 mainFrame->AddNode(vol4, 3, MakeTrans(-posX3, 0, posZ3));
830 mainFrame->AddNode(vol4, 4, MakeTrans(posX3, 0, posZ3));
831
832 // small vertical parts
833 double gaslencor = (frameSizeHalf - frameSizeHalfGas) / Tan((90 - rotX) * pi / 180);
834 TGeoTrap* pbGas5 =
835 new TGeoTrap("mainframe5_gas_PB", frameSizeHalfGas, 0, 0, frameSizeHalfGas,
836 lenHalf5 - 1 / Tan((90 - rotX) * pi / 180) * frameSizeHalf + gaslencor,
837 lenHalf5 + 1 / Tan((90 - rotX) * pi / 180) * frameSizeHalf - gaslencor, 0, frameSizeHalfGas,
838 lenHalf5 - 1 / Tan((90 - rotX) * pi / 180) * frameSizeHalf + gaslencor,
839 lenHalf5 + 1 / Tan((90 - rotX) * pi / 180) * frameSizeHalf - gaslencor, 0);
840 TGeoTrap* pb5 = new TGeoTrap("mainframe5_PB", frameSizeHalf, 0, 0, frameSizeHalf,
841 lenHalf5 - 1 / Tan((90 - rotX) * pi / 180) * frameSizeHalf,
842 lenHalf5 + 1 / Tan((90 - rotX) * pi / 180) * frameSizeHalf, 0, frameSizeHalf,
843 lenHalf5 - 1 / Tan((90 - rotX) * pi / 180) * frameSizeHalf,
844 lenHalf5 + 1 / Tan((90 - rotX) * pi / 180) * frameSizeHalf, 0);
845 TGeoCompositeShape* sub5_1 =
846 MakeUnion("subtraction_mainframe5", crossingbox, crossingbox, MakeTrans(posY2, 0, 0), MakeTrans(posY3, 0, 0));
847 TGeoCompositeShape* sub5 =
848 MakeUnion("subtraction_mainframe5", sub5_1, sub5_1, nullptr, MakeCombiTrans(0, 0, 0, 0, 180, 0));
849 TGeoVolume* volGas5 =
850 new TGeoVolume("mainframe5_gas", MakeSubtraction("mainframe5_gas_PB", pbGas5, sub5, nullptr, nullptr), medGas);
851 TGeoVolume* vol5 =
852 new TGeoVolume("mainframe5", MakeSubtraction("mainframe5_PB", pb5, sub5, nullptr, nullptr), medAlum);
853 vol5->AddNode(volGas5, 1);
854 mainFrame->AddNode(vol5, 1, MakeCombiTrans(-posX1, 0., posZ1, 90, 0, 90));
855 mainFrame->AddNode(vol5, 2, MakeCombiTrans(posX1, 0., posZ1, 90, 0, 90));
856 mainFrame->AddNode(vol5, 3, MakeCombiTrans(-posX3, 0., posZ1, 90, 0, 90));
857 mainFrame->AddNode(vol5, 4, MakeCombiTrans(posX3, 0., posZ1, 90, 0, 90));
858
859 // small horizontal parts
860 TGeoBBox* pbGas6 = new TGeoBBox("mainframe6_gas_PB", frameSizeHalfGas, frameSizeHalfGas, lenHalf6 - frameSizeHalf);
861 TGeoBBox* pb6 = new TGeoBBox("mainframe6_PB", frameSizeHalf, frameSizeHalf, lenHalf6 - frameSizeHalf);
862 TGeoVolume* volGas6 = new TGeoVolume("mainframe6_gas", pbGas6, medGas);
863 TGeoVolume* vol6 = new TGeoVolume("mainframe6", pb6, medAlum);
864 //if (fSetVolumeColors) vol6->SetLineColor(kBlue - 2);
865 //if (fSetVolumeColors) volGas6->SetLineColor(kBlue - 2);
866 vol6->AddNode(volGas6, 1);
867 mainFrame->AddNode(vol6, 1, MakeTrans(-posX2, posY, posZ4 - lenHalf6 - frameSizeHalf));
868 mainFrame->AddNode(vol6, 2, MakeTrans(-posX2, -posY, posZ4 - lenHalf6 - frameSizeHalf));
869 mainFrame->AddNode(vol6, 3, MakeTrans(posX2, posY, posZ4 - lenHalf6 - frameSizeHalf));
870 mainFrame->AddNode(vol6, 4, MakeTrans(posX2, -posY, posZ4 - lenHalf6 - frameSizeHalf));
871 mainFrame->AddNode(vol6, 5, MakeTrans(-posX1, posY, posZ4 - lenHalf6 - frameSizeHalf));
872 mainFrame->AddNode(vol6, 6, MakeTrans(-posX1, -posY, posZ4 - lenHalf6 - frameSizeHalf));
873 mainFrame->AddNode(vol6, 7, MakeTrans(posX1, posY, posZ4 - lenHalf6 - frameSizeHalf));
874 mainFrame->AddNode(vol6, 8, MakeTrans(posX1, -posY, posZ4 - lenHalf6 - frameSizeHalf));
875 mainFrame->AddNode(vol6, 9, MakeTrans(0., posY, posZ4 - lenHalf6 - frameSizeHalf));
876 mainFrame->AddNode(vol6, 10, MakeTrans(0., -posY, posZ4 - lenHalf6 - frameSizeHalf));
877 mainFrame->AddNode(vol6, 11, MakeTrans(posX3, posY2, posZ4 - lenHalf6 - frameSizeHalf));
878 mainFrame->AddNode(vol6, 12, MakeTrans(posX3, -posY2, posZ4 - lenHalf6 - frameSizeHalf));
879 mainFrame->AddNode(vol6, 13, MakeTrans(-posX3, posY2, posZ4 - lenHalf6 - frameSizeHalf));
880 mainFrame->AddNode(vol6, 14, MakeTrans(-posX3, -posY2, posZ4 - lenHalf6 - frameSizeHalf));
881 mainFrame->AddNode(vol6, 15, MakeTrans(-posX3, posY, posZ4 - lenHalf6 - frameSizeHalf));
882 mainFrame->AddNode(vol6, 16, MakeTrans(-posX3, -posY, posZ4 - lenHalf6 - frameSizeHalf));
883 mainFrame->AddNode(vol6, 17, MakeTrans(posX3, posY, posZ4 - lenHalf6 - frameSizeHalf));
884 mainFrame->AddNode(vol6, 18, MakeTrans(posX3, -posY, posZ4 - lenHalf6 - frameSizeHalf));
885
886
887 // first parts along z-axis (long)
888 TGeoBBox* pbGas7 = new TGeoBBox("mainframe7_gas_PB", frameSizeHalfGas, frameSizeHalfGas, lenHalf2 + lenHalf3);
889 TGeoBBox* pb7 = new TGeoBBox("mainframe7_PB", frameSizeHalf, frameSizeHalf, lenHalf2 + lenHalf3);
890 TGeoVolume* volGas7 = new TGeoVolume("mainframe7_gas", pbGas7, medGas);
891 TGeoVolume* vol7 = new TGeoVolume("mainframe7", pb7, medAlum);
892 vol7->AddNode(volGas7, 1);
893 mainFrame->AddNode(vol7, 1, MakeTrans(posX3, posY2, posZ2 - lenHalf3 - frameSizeHalf));
894 mainFrame->AddNode(vol7, 2, MakeTrans(posX3, -posY2, posZ2 - lenHalf3 - frameSizeHalf));
895 mainFrame->AddNode(vol7, 3, MakeTrans(-posX3, posY2, posZ2 - lenHalf3 - frameSizeHalf));
896 mainFrame->AddNode(vol7, 4, MakeTrans(-posX3, -posY2, posZ2 - lenHalf3 - frameSizeHalf));
897
898 // left & right of shieldingbox along x-axis
899 TGeoBBox* pbGas8 = new TGeoBBox("mainframe8_gas_PB", lenHalf8, frameSizeHalfGas, frameSizeHalfGas);
900 TGeoBBox* pb8 = new TGeoBBox("mainframe8_PB", lenHalf8, frameSizeHalf, frameSizeHalf);
901 TGeoVolume* volGas8 = new TGeoVolume("mainframe8_gas", pbGas8, medGas);
902 TGeoVolume* vol8 = new TGeoVolume("mainframe8", pb8, medAlum);
903 vol8->AddNode(volGas8, 1);
904 mainFrame->AddNode(vol8, 1, MakeTrans(posX3 - lenHalf8 + frameSizeHalf, posY3, posZ1));
905 mainFrame->AddNode(vol8, 2, MakeTrans(-posX3 + lenHalf8 - frameSizeHalf, posY3, posZ1));
906 mainFrame->AddNode(vol8, 3, MakeTrans(posX3 - lenHalf8 + frameSizeHalf, -posY3, posZ1));
907 mainFrame->AddNode(vol8, 4, MakeTrans(-posX3 + lenHalf8 - frameSizeHalf, -posY3, posZ1));
908
909 return mainFrame;
910}
911
913{
914 double richLenHalf = fRichLength / 2.;
915 double richWidthHalf = fRichWidth / 2.;
916 double richHeightHalf = fRichHeight / 2.;
917
918 double x1 = richWidthHalf - fRichCoveringThickness;
920 double z1 = fRichAddZ / 2. - fRichCoveringThickness / 2. + fRichEntranceThickness / 2.;
921 double y2 = (richHeightHalf + fRichEntranceHeight / 2.) / 2.;
922 double z2 = -richLenHalf - fRichAddZ / 2. + fRichCoveringThickness;
923
924 TGeoBBox* op0 = new TGeoBBox("rich_gas_PB_op0", x1, richHeightHalf - fRichCoveringThickness, richLenHalf + 2);
925 TGeoBBox* op1 = new TGeoBBox("rich_gas_PB_op1", x1, y1, z1);
926 TGeoCompositeShape* op01 = MakeUnion("rich_gas_PB_op01", op0, op1, nullptr, MakeTrans(0., y2, z2));
927 //TGeoBBox* op2 = new TGeoBBox("rich_gas_PB_op2", x1, y1, z1);
928 TGeoCompositeShape* op012 = MakeUnion("rich_gas_PB_op012", op01, op1, nullptr, MakeTrans(0., -y2, z2));
929
930 TGeoConeSeg* op3 = new TGeoConeSeg("rich_gas_PB_op3", fPipeLength / 2., 0., fPipeOuterRadiusEntrance, 0.,
931 fPipeOuterRadiusExit, 0., 360.);
932 TGeoCompositeShape* gasPB = MakeSubtraction("rich_gas_PB", op012, op3, nullptr, nullptr);
933 TGeoVolume* gas = new TGeoVolume("rich_gas", gasPB, fMaterials.GetMedium("RICHgas_CO2_dis"));
934 //if (fSetVolumeColors) gas->SetLineColor(kYellow - 10);
935 return gas;
936}
937
939{
940 double y1 = (fRichHeight / 2. + fRichEntranceHeight / 2.) / 2.;
941 double z1 = -fRichLength / 2. - fRichAddZ / 2.;
942 double y2 = (fRichHeight - fRichEntranceHeight) / 4.;
943
944 TGeoBBox* op0 = new TGeoBBox("rich_cont_PB_op0", fRichWidth / 2., fRichHeight / 2., fRichLength / 2. + 2);
945 TGeoBBox* op1 = new TGeoBBox("rich_cont_PB_op1", fRichWidth / 2., y2, fRichAddZ / 2.);
946 TGeoCompositeShape* op01 = MakeUnion("rich_cont_PB_op01", op0, op1, nullptr, MakeTrans(0., y1, z1));
947 //TGeoBBox* op2 = new TGeoBBox("rich_cont_PB_op2", fRichWidth / 2., y2, fRichAddZ / 2.);
948 TGeoCompositeShape* pb = MakeUnion("rich_cont_PB", op01, op1, nullptr, MakeTrans(0., -y1, z1));
949 TGeoConeSeg* pipePB =
950 new TGeoConeSeg("rich_pipe_subtract", fPipeLength / 2., 0, fPipeOuterRadiusEntrance - fPipeThicknessEntrance, 0,
952 TGeoCompositeShape* pb2 = MakeSubtraction("rich_cont_PB2", pb, pipePB, nullptr, nullptr);
953 TGeoVolume* richCont = new TGeoVolume("rich_cont", pb2, fMaterials.GetMedium("aluminium"));
954 //if (fSetVolumeColors) richCont->SetLineColor(kBlue - 10);
955 return richCont;
956}
957
959{
960 TGeoBBox* op0 = new TGeoBBox("sens_plane_PB_op0", 170., 170., 0.05);
961 TGeoConeSeg* op1 = new TGeoConeSeg("sens_plane_PB_op1", fPipeLength / 2., 0., fPipeOuterRadiusEntrance, 0.,
962 fPipeOuterRadiusExit, 0., 360.);
963 TGeoTranslation* tr = MakeTrans(0., 0., (-fSensPlaneZ + (fRichExitThickness - fRichEntranceThickness) / 2.));
964 TGeoCompositeShape* sensPlanePB = MakeSubtraction("sens_plane_PB", op0, op1, nullptr, tr);
965 TGeoVolume* sensPlane = new TGeoVolume("sens_plane", sensPlanePB, fMaterials.GetMedium("RICHgas_CO2_dis+"));
966 //if (fSetVolumeColors) sensPlane->SetLineColor(kRed - 8);
967 return sensPlane;
968}
969
971{
972 double richLenHalf = fRichLength / 2.;
973
974 TGeoBBox* op_flange = new TGeoBBox("rich_entrance_PB_flange_op0", fRichEntranceWidth / 2. + fRichFlangeThickness,
976 TGeoBBox* op1_flange =
977 new TGeoBBox("rich_entrance_PB_flange_op1", fRichEntranceWidth / 2., fRichEntranceHeight / 2., 2.);
978 TGeoBBox* op0 = new TGeoBBox("rich_entrance_PB_op0", fRichEntranceWidth / 2., fRichEntranceHeight / 2.,
980 TGeoConeSeg* op1 = new TGeoConeSeg("rich_entrance_PB_op1", fPipeLength / 2., 0., fPipeOuterRadiusEntrance, 0.,
981 fPipeOuterRadiusExit, 0., 360.);
982 TGeoTranslation* tr = MakeTrans(0., 0., richLenHalf - fRichEntranceThickness / 2. - fRichCoveringThickness);
983 TGeoCompositeShape* pb_flange = MakeSubtraction("rich_entrance_PB_flange", op_flange, op1_flange, nullptr, nullptr);
984 TGeoCompositeShape* pb_foil = MakeSubtraction("rich_entrance_PB", op0, op1, nullptr, tr);
985 TGeoCompositeShape* pb = MakeSubtraction("rich_entrance", op_flange, op1, nullptr, tr);
986 TGeoVolume* entrance = new TGeoVolume("rich_entrance", pb, fMaterials.GetMedium("RICHgas_CO2_dis"));
987 TGeoVolume* entrance_flange = new TGeoVolume("rich_entrance_flange", pb_flange, fMaterials.GetMedium("aluminium"));
988 TGeoVolume* entrance_foil = new TGeoVolume("rich_entrance_foil", pb_foil, fMaterials.GetMedium("kapton"));
989 entrance->AddNode(entrance_foil, 1);
990 entrance->AddNode(entrance_flange, 1);
991 //if (fSetVolumeColors) entrance->SetLineColor(kGreen - 5);
992 return entrance;
993}
994
996{
997 double richLenHalf = fRichLength / 2.;
998
999 TGeoBBox* op_flange = new TGeoBBox("rich_exit_PB_flange_op0", fRichExitWidth / 2. + fRichFlangeThickness,
1001 TGeoBBox* op1_flange = new TGeoBBox("rich_exit_PB_flange_op1", fRichExitWidth / 2., fRichExitHeight / 2., 2.);
1002 TGeoBBox* op0 = new TGeoBBox("rich_exit_PB_op0", fRichExitWidth / 2., fRichExitHeight / 2., fRichExitThickness / 2.);
1003 TGeoConeSeg* op1 = new TGeoConeSeg("rich_exit_PB_op1", fPipeLength / 2., 0., fPipeOuterRadiusEntrance, 0.,
1004 fPipeOuterRadiusExit, 0., 360.);
1005 TGeoTranslation* tr = MakeTrans(0., 0., -richLenHalf + fRichExitThickness / 2.);
1006 TGeoCompositeShape* pb_flange = MakeSubtraction("rich_exit_PB_flange", op_flange, op1_flange, nullptr, nullptr);
1007 TGeoCompositeShape* pb_innerpart = MakeSubtraction("rich_exit_PB_innerpart", op0, op1, nullptr, tr);
1008 TGeoCompositeShape* pb = MakeSubtraction("rich_exit_PB", op_flange, op1, nullptr, tr);
1009 TGeoVolume* exit = new TGeoVolume("rich_exit", pb, fMaterials.GetMedium("RICHgas_CO2_dis"));
1010 TGeoVolume* exit_flange = new TGeoVolume("rich_exit_flange", pb_flange, fMaterials.GetMedium("aluminium"));
1011 TGeoVolume* exit_innerpart =
1012 new TGeoVolume("rich_exit_innerpart", pb_innerpart, fMaterials.GetMedium("Polycarbonat"));
1013 exit->AddNode(exit_innerpart, 1, MakeTrans(0, 0, 0));
1014 exit->AddNode(exit_flange, 1);
1015 //if (fSetVolumeColors) exit->SetLineColor(kGreen - 5);
1016 return exit;
1017}
1018
1019TGeoVolume* RichGeoCreator::CreatePipe() // now used for the beampipe tunnel
1020{
1021 double pipeLenHalf = fPipeLength / 2;
1022 TGeoConeSeg* pipePB = new TGeoConeSeg("rich_pipe_PB", pipeLenHalf, fPipeOuterRadiusEntrance - fPipeThicknessEntrance,
1024 fPipeOuterRadiusExit, 0., 360.);
1025 TGeoVolume* pipe = new TGeoVolume("rich_pipe", pipePB, fMaterials.GetMedium("carbon"));
1026 //if (fSetVolumeColors) pipe->SetLineColor(kSpring + 4);
1027 return pipe;
1028}
1029
1031{
1032 TGeoTubeSeg* pipeCylVacPB = new TGeoTubeSeg(
1033 "rich_cyl_pipe_vac_PB", 0., fPipeOuterRadiusEntrance - fPipeThicknessEntrance, fPipeCylPartLen / 2., 0., 360.);
1034 TGeoTubeSeg* pipeCylPB =
1035 new TGeoTubeSeg("rich_cyl_pipe_PB", 0., fPipeOuterRadiusEntrance, fPipeCylPartLen / 2., 0., 360.);
1036 TGeoVolume* pipeCylVac = new TGeoVolume("rich_cyl_pipe_vac", pipeCylVacPB, fMaterials.GetMedium("vacuum"));
1037 TGeoVolume* pipeCyl = new TGeoVolume("rich_cyl_pipe", pipeCylPB, fMaterials.GetMedium("aluminium"));
1038 //if (fSetVolumeColors) pipeCylVac->SetLineColor(kSpring + 5);
1039 //if (fSetVolumeColors) pipeCyl->SetLineColor(kSpring + 4);
1040 pipeCyl->AddNode(pipeCylVac, 1);
1041 return pipeCyl;
1042}
1043
1045{
1046 double richLenHalf = fRichLength / 2.;
1047
1048 TGeoVolume* rich_gas = CreateGas();
1049
1050 TGeoVolumeAssembly* camCont = CreateCameraContainer();
1051 double camY = fCameraOriginY + fCameraShiftY;
1052 double camZ = -fRichOrigZ - richLenHalf + fCameraOriginZ + fCameraShiftZ;
1053 rich_gas->AddNode(camCont, 1, MakeCombiTrans(0., camY, camZ, fCameraFullRotX, 0., 0.));
1054 rich_gas->AddNode(camCont, 2, MakeCombiTrans(0., -camY, camZ, -fCameraFullRotX, 0., 0.));
1055
1056 double mirrorZ = -fRichOrigZ - richLenHalf + fMirrorOriginZ;
1057 //double beltsGapZ = 0.5; // cm
1058
1059 TGeoVolumeAssembly* mirrorHalf = CreateMirror();
1060 rich_gas->AddNode(mirrorHalf, 1, MakeCombiTrans(0., fMirrorOriginY + fMirrorGapY / 2., mirrorZ, 0., -90., -90.));
1061 rich_gas->AddNode(mirrorHalf, 2, MakeCombiTrans(0., -fMirrorOriginY - fMirrorGapY / 2., mirrorZ, 0., -90., 90.));
1062
1063 //TGeoVolumeAssembly* belts_half_container = CreateMirrorSupportBelts();
1064
1065 //rich_gas->AddNode(belts_half_container, 1,
1066 // MakeCombiTrans(0., fMirrorOriginY + fMirrorGapY, mirrorZ + beltsGapZ, 0., -90., -90.));
1067 //rich_gas->AddNode(belts_half_container, 2,
1068 // MakeCombiTrans(0., -fMirrorOriginY - fMirrorGapY, mirrorZ + beltsGapZ, 0., -90., 90.));
1069
1070 TGeoVolumeAssembly* pillars = CreateMirrorSupportPillars();
1071 rich_gas->AddNode(pillars, 1);
1072
1073 TGeoVolume* sensPlane = CreateSensitivePlane();
1074 rich_gas->AddNode(sensPlane, 1, MakeTrans(0., 0., fSensPlaneZ));
1075
1076 TGeoVolumeAssembly* mainFrame = CreateMainFrame();
1077 rich_gas->AddNode(mainFrame, 1, MakeTrans(0., 0., 38.541939));
1078
1079 if (fAddShieldingBox) {
1080 TGeoVolumeAssembly* shieldingBox = CreateShieldingBox();
1081 double shieldingBoxZ = -(fRichEntranceThickness - fRichExitThickness / 2. + fRichOrigZ + richLenHalf);
1082 rich_gas->AddNode(shieldingBox, 1, MakeTrans(0., 0., shieldingBoxZ));
1083 rich_gas->AddNode(shieldingBox, 2, MakeCombiTrans(0., 0., shieldingBoxZ, 0., 0., 180.));
1084 }
1085
1086 rich_gas->AddNode(CreateRichEntrance(), 1, MakeTrans(0., 0., -richLenHalf + fRichEntranceThickness / 2.));
1087 rich_gas->AddNode(CreateRichExit(), 1, MakeTrans(0., 0., richLenHalf - fRichExitThickness / 2));
1088
1089 TGeoVolume* richCont = CreateRichContainer();
1090 richCont->AddNode(rich_gas, 1, MakeTrans(0., 0., 0));
1091 richCont->AddNode(CreatePipe(), 1);
1092
1093 TGeoVolumeAssembly* rich = new TGeoVolumeAssembly(fGeoName.c_str());
1094 rich->AddNode(richCont, 1, MakeTrans(0., 0., -40. + fRichOrigZ + richLenHalf));
1095 // This pipe segment is removed to be compatible with new beam pipe.
1096 // See https://git.cbm.gsi.de/CbmSoft/cbmroot_geometry/-/merge_requests/184
1097 //rich->AddNode(CreatePipeCyl(), 1, MakeTrans(0., 0., -40. + fRichOrigZ - fPipeCylPartLen / 2.));
1098
1099 //TGeoVolume* top = new TGeoVolumeAssembly(fGeoName.c_str());
1100
1101 gGeoManager->SetTopVolume(rich);
1102 //top->AddNode(rich, 1);
1103 gGeoManager->CloseGeometry();
1104 gGeoManager->CheckOverlaps(0.0001);
1105 gGeoManager->PrintOverlaps();
1106 gGeoManager->Test();
1107
1108 string outputFile = fGeoName + ".geo.root";
1109 rich->Export((outputFile + "?reproducible").c_str());
1110 LOG(info) << "Geometry file: " << outputFile;
1111
1112 //rich->Draw("ogl");
1113 gGeoManager->SetVisLevel(7);
1114}
1115
1117{
1118 // When converting GDML to root please look https://root.cern.ch/root/html520/src/TGDMLParse.cxx.htm
1119 // Shielding box is created using a number of boolean operations with shapes
1120 // All next shape is marked with increased number in name box1 to box 15
1121
1122 TGeoEltu* box1 = new TGeoEltu("box1", 183.0, 183.0, 70);
1123 TGeoBBox* box2 = new TGeoBBox("box2", 229.3 / 2., 73.879 / 2., 113.3 / 2.);
1124 TGeoCompositeShape* box3 = MakeIntersection("box3", box1, box2, nullptr, MakeTrans(0., 146.068, -4.65));
1125
1126 TGeoBBox* box4 = new TGeoBBox("box4", 227.3 / 2., 71.937 / 2., 102.0 / 2.);
1127 TGeoCompositeShape* box5 = MakeSubtraction("box5", box3, box4, nullptr, MakeTrans(0., 147.097, 0.));
1128
1129 TGeoEltu* box6 = new TGeoEltu("box6", 172.0, 172.0, 6);
1130 TGeoCompositeShape* box7 = MakeSubtraction("box7", box5, box6, nullptr, MakeTrans(0., 0., -58));
1131
1132 TGeoBBox* box8 = new TGeoBBox("box8", 75.0 / 2., 222.422 / 2., 104.0 / 2.);
1133 TGeoCompositeShape* box9 = MakeSubtraction("box9", box7, box8, nullptr, MakeTrans(0., -0.082, 0.));
1134
1135 TGeoBBox* box10 = new TGeoBBox("box10", 145.0 / 2., 10.3 / 2., 11.0 / 2.);
1136 TGeoCompositeShape* box11 =
1137 MakeSubtraction("box11", box9, box10, nullptr, MakeCombiTrans(-61.152, 177.274, -56.15, 0., 0., 31.27));
1138
1139 //TGeoBBox* box12 = new TGeoBBox("box12", 145.0 / 2., 10.3 / 2., 11.0 / 2.);
1140 TGeoCompositeShape* box13 =
1141 MakeSubtraction("box13", box11, box10, nullptr, MakeCombiTrans(61.152, 177.274, -56.15, 0., 0., -31.27));
1142
1143 TGeoBBox* box14 = new TGeoBBox("box14", 145.0 / 2., 10.3 / 2., 16.0 / 2.);
1144 TGeoCompositeShape* box15 =
1145 MakeSubtraction("box15", box13, box14, nullptr, MakeCombiTrans(0., 181.2639, -59.75, -41.3565, 0., 0.));
1146
1147 TGeoVolume* shBox = new TGeoVolume("shielding_box_part", box15, fMaterials.GetMedium("iron"));
1148 //if (fSetVolumeColors) shBox->SetLineColor(kBlue + 4);
1149
1150 // Wing part
1151 TGeoBBox* wing1 = new TGeoBBox("wing1", 117.0 / 2., 8.9571 / 2., 13.7221 / 2.);
1152 TGeoBBox* wing2 = new TGeoBBox("wing2", 117.0 / 2., 9.0 / 2., 13.7221 / 2.);
1153 TGeoCompositeShape* wing3 =
1154 MakeSubtraction("wing3", wing1, wing2, nullptr, MakeCombiTrans(49.9989, 0., 3.206, 0., 18.90578, 0.));
1155
1156 //TGeoBBox* wing4 = new TGeoBBox("wing4", 117.0 / 2., 8.9571 / 2., 13.7221 / 2.);
1157 TGeoCompositeShape* wing5 =
1158 MakeSubtraction("wing5", wing3, wing2, nullptr, MakeCombiTrans(-49.9989, 0., 3.206, 0., -18.90578, 0.));
1159
1160 TGeoVolume* wing = new TGeoVolume("shieling_wing", wing5, fMaterials.GetMedium("iron"));
1161 //if (fSetVolumeColors) wing->SetLineColor(kBlue - 1);
1162
1163 TGeoVolumeAssembly* shBoxFinal = new TGeoVolumeAssembly("shielding_box");
1164 shBoxFinal->AddNode(shBox, 1, MakeCombiTrans(0., 240.7246, 79.4162, 68.06551, 0., -180.0));
1165 shBoxFinal->AddNode(wing, 1, MakeCombiTrans(0., 118.30, 225.1717, -26.70901, 0., 0.));
1166
1167 return shBoxFinal;
1168}
1169
1170TGeoCompositeShape* RichGeoCreator::MakeSubtraction(const string& name, TGeoShape* left, TGeoShape* right,
1171 TGeoMatrix* lmat, TGeoMatrix* rmat)
1172{
1173 return new TGeoCompositeShape(name.c_str(), new TGeoSubtraction(left, right, lmat, rmat));
1174}
1175
1176TGeoCompositeShape* RichGeoCreator::MakeUnion(const string& name, TGeoShape* left, TGeoShape* right, TGeoMatrix* lmat,
1177 TGeoMatrix* rmat)
1178{
1179 return new TGeoCompositeShape(name.c_str(), new TGeoUnion(left, right, lmat, rmat));
1180}
1181
1182TGeoCompositeShape* RichGeoCreator::MakeIntersection(const string& name, TGeoShape* left, TGeoShape* right,
1183 TGeoMatrix* lmat, TGeoMatrix* rmat)
1184{
1185 return new TGeoCompositeShape(name.c_str(), new TGeoIntersection(left, right, lmat, rmat));
1186}
1187
1188
1189TGeoCombiTrans* RichGeoCreator::MakeCombiTrans(double dx, double dy, double dz, double rotX, double rotY, double rotZ)
1190{
1191 // Note that rotX, rotY, rotZ should be provided as in GDML and in deg.
1192 // The rotation is done with oposite sign of rot(XYZ), first - Z, second - Y, third - X
1193 // Creation of TGeoCombiTrans is done with rot->Inverse()
1194 TGeoTranslation* tr = MakeTrans(dx, dy, dz);
1195 TGeoRotation* rot = new TGeoRotation();
1196 if (rotZ != 0.) rot->RotateZ(-rotZ);
1197 if (rotY != 0.) rot->RotateY(-rotY);
1198 if (rotX != 0.) rot->RotateX(-rotX);
1199 return new TGeoCombiTrans(*tr, rot->Inverse());
1200}
1201
1202TGeoTranslation* RichGeoCreator::MakeTrans(double dx, double dy, double dz) { return new TGeoTranslation(dx, dy, dz); }
1203
1204TGeoRotation* RichGeoCreator::MakeRot(double rotX, double rotY, double rotZ)
1205{
1206 TGeoRotation* rot = new TGeoRotation();
1207 if (rotZ != 0.) rot->RotateZ(-rotZ);
1208 if (rotY != 0.) rot->RotateY(-rotY);
1209 if (rotX != 0.) rot->RotateX(-rotX);
1210 return rot;
1211}
1212
ClassImp(CbmConverterManager)
friend fvec sqrt(const fvec &a)
friend fvec cos(const fvec &a)
friend fvec sin(const fvec &a)
const double pi
Some class A.
Some class B.
Some class C.
double fPipeOuterRadiusEntrance
TGeoRotation * MakeRot(double rotX, double rotY, double rotZ)
TGeoTranslation * MakeTrans(double dx, double dy, double dz)
double fRichEntranceWidth
double fPipeThicknessEntrance
TGeoVolumeAssembly * CreateCameraContainer()
TGeoVolumeAssembly * CreateMainFrame()
TGeoCompositeShape * MakeIntersection(const std::string &name, TGeoShape *left, TGeoShape *right, TGeoMatrix *lmat=nullptr, TGeoMatrix *rmat=nullptr)
TGeoVolume * CreateSensitivePlane()
TGeoVolume * CreatePillarConnection()
TGeoVolume * CreateRichEntrance()
std::string fGeoName
TGeoCompositeShape * MakeSubtraction(const std::string &name, TGeoShape *left, TGeoShape *right, TGeoMatrix *lmat=nullptr, TGeoMatrix *rmat=nullptr)
TGeoVolume * CreateStuds(double zpos, double lenHalf, double angle, const std::string &mirrorfixing="both")
TGeoCombiTrans * MakeCombiTrans(double dx, double dy, double dz, double rotX, double rotY, double rotZ)
double fPipeOuterRadiusExit
TGeoVolumeAssembly * CreateShieldingBox()
TGeoVolume * CreatePmt()
double fCameraTouchRadius
double fRichFlangeThickness
TGeoVolume * CreateCameraModule()
double fPipeThicknessExit
TGeoVolume * CreateGas()
TGeoVolume * CreateRichExit()
TGeoVolumeAssembly * CreateMirrorSupportPillars()
double fMirrorThickness
TGeoVolume * CreatePipeCyl()
double ToRad(double deg)
double fRichCoveringThickness
RichGeoMaterials fMaterials
TGeoVolumeAssembly * CreateMirrorFixing(const std::string &sides="both")
TGeoVolumeAssembly * CreateMirror()
double ToDeg(double rad)
TGeoVolume * CreatePipe()
TGeoVolume * CreateCameraStrip()
double fRichExitThickness
double fRichEntranceHeight
virtual ~RichGeoCreator()
TGeoCompositeShape * MakeUnion(const std::string &name, TGeoShape *left, TGeoShape *right, TGeoMatrix *lmat=nullptr, TGeoMatrix *rmat=nullptr)
double fRichEntranceThickness
TGeoVolume * CreateRichContainer()
Hash for CbmL1LinkKey.