57 {
60
61
63 if (cutoutson && !vcutdef.empty()) {
64 Cutout *
cut =
nullptr;
65 GeoShape *cutoutShape = nullptr;
66 GeoTrf::Transform3D cutTrans{GeoTrf::Transform3D::Identity()};
67 for (
unsigned i = 0;
i < vcutdef.size();
i++) {
70 cutTrans = GeoTrf::Translate3D(0.0,
cut->dx, -
length / 2 +
cut->dy +
cut->lengthY / 2.);
71 strd = &(strd->subtract((*cutoutShape) << cutTrans));
72 }
73 }
74
75 const GeoMaterial *mtrd = matManager.
getMaterial(
"std::G10");
76 GeoLogVol *ltrd =
new GeoLogVol(
logVolName, strd, mtrd);
77 GeoFullPhysVol *ptrd = new GeoFullPhysVol(ltrd);
78
79 if (minimalgeo == 1)
80 return ptrd;
81
84 ptrd->add(new GeoSerialIdentifier(0));
85
86 int igl = 0;
87 int iSenLyr = 0;
88
89
90 for (
int i = 0;
i <
t->nlayers;
i++) {
91 double widthActive;
92 double longWidthActive;
93 double lengthActive;
94
95 if (
t->materials[i] ==
"muo::TGCGas") {
96
97 igl++;
99 ptrd->add(new GeoIdentifierTag(igl));
100
101 widthActive =
width - (
t->frame_ab) * 2;
102 longWidthActive =
longWidth - (
t->frame_ab) * 2;
103 lengthActive =
length - (
t->frame_h) * 2;
104
105 const GeoShape *sGasVolume =
new GeoTrd(
t->tck[i] / 2,
t->tck[i] / 2, widthActive / 2, longWidthActive / 2, lengthActive / 2);
106
107 if (
t->widthWireSupport != 0. &&
t->radiusButton != 0.) {
108
109
110
111
112 GeoTrd *strdsup =
new GeoTrd(
t->tck[i] / 2,
t->tck[i] / 2,
t->widthWireSupport / 2,
t->widthWireSupport / 2, lengthActive / 2 - 0.1 * Gaudi::Units::mm);
113
114 GeoTube *stubesup =
new GeoTube(0.,
t->radiusButton,
t->tck[i] / 2. + 0.005 * Gaudi::Units::mm);
115 GeoTrf::RotateY3D rotY(M_PI_2 * Gaudi::Units::rad);
116
117 int iymin =
int(-(widthActive / 2. + lengthActive *
tan(
t->angleTilt) -
t->widthWireSupport / 2. +
t->offsetWireSupport[iSenLyr]) /
t->distanceWireSupport);
118 int iymax =
int((widthActive / 2. + lengthActive *
tan(
t->angleTilt) -
t->widthWireSupport / 2. -
t->offsetWireSupport[iSenLyr]) /
t->distanceWireSupport);
119
120 for (int isup = iymin; isup <= iymax; isup++) {
121
123 if (
t->offsetWireSupport[iSenLyr] +
t->distanceWireSupport * isup > 0.) {
125 }
else if (
t->offsetWireSupport[iSenLyr] +
t->distanceWireSupport * isup == 0.) {
127 }
128 GeoTrf::RotateX3D rotX(
sign *
t->angleTilt);
129 GeoTrf::Translate3D vtransWS(0.,
t->offsetWireSupport[iSenLyr] +
t->distanceWireSupport * isup + lengthActive / 2. *
tan(
sign *
t->angleTilt), 0.);
130
131 sGasVolume = &(sGasVolume->subtract((*strdsup) << GeoTrf::Transform3D(vtransWS * rotX)));
132
133
134 int izmin, izmax;
135 izmax =
int((lengthActive / 2. -
t->radiusButton) / (
t->pitchButton[1] / 2.));
136 izmin = -izmax;
137
138 int nBS = 0;
139 double yposCentre[2], angleTiltButton[2];
140 if (isup < iymax) {
141 double yLongBase, yShortBase;
142 yLongBase =
143 ((
t->offsetWireSupport[iSenLyr] +
t->distanceWireSupport * (isup + 1)) + (
t->offsetWireSupport[iSenLyr] +
t->distanceWireSupport * isup)) / 2.;
144 if (
t->offsetWireSupport[iSenLyr] +
t->distanceWireSupport * (isup + 1) < 0.) {
145 yShortBase = yLongBase + lengthActive *
tan(
t->angleTilt);
146 }
else if (
t->offsetWireSupport[iSenLyr] +
t->distanceWireSupport * (isup) > 0.) {
147 yShortBase = yLongBase + lengthActive *
tan(-
t->angleTilt);
148 } else {
149 yShortBase = yLongBase;
150 }
151
152 nBS = 1;
153 yposCentre[0] = yLongBase;
154 angleTiltButton[0] =
atan((yShortBase - yLongBase) / lengthActive);
155
156 } else if (isup == iymax) {
157
158 if (
name ==
"TGC01" ||
name ==
"TGC06" ||
name ==
"TGC12") {
159 for (int iside = 0; iside < 2; iside++) {
160 int isupy;
161 if (iside == 0) {
162 isupy = iymin - 1;
164 } else {
165 isupy = iymax + 1;
167 }
168 double lengthWireSupportEx;
169 lengthWireSupportEx = lengthActive / (longWidthActive / 2. - widthActive / 2.) *
170 (longWidthActive / 2. - fabs(
t->distanceWireSupport * isupy +
t->offsetWireSupport[iSenLyr]));
171 GeoTrd *strdsupex =
new GeoTrd(
t->tck[i] / 2,
t->tck[i] / 2,
t->widthWireSupport / 2,
t->widthWireSupport / 2,
172 lengthWireSupportEx / 2 - 0.1 * Gaudi::Units::mm);
173 GeoTrf::Translate3D vtrans(0.,
t->offsetWireSupport[iSenLyr] +
t->distanceWireSupport * isupy + lengthActive / 2. *
tan(
sign *
t->angleTilt),
174 (lengthActive - lengthWireSupportEx) / 2.);
175
176 sGasVolume = &(sGasVolume->subtract((*strdsupex) << GeoTrf::Transform3D(vtrans * rotX)));
177 }
178 }
179
180
181 double widthLeftTrd = (
t->distanceWireSupport * iymin +
t->offsetWireSupport[iSenLyr] + lengthActive *
tan(
t->angleTilt)) - (-widthActive / 2.);
182 if (widthLeftTrd > 8. * Gaudi::Units::cm) {
183 double yLongBase;
184 if ((
name ==
"TGC01" ||
name ==
"TGC06" ||
name ==
"TGC12") &&
185 t->distanceWireSupport * (iymin - 1) +
t->offsetWireSupport[iSenLyr] > -longWidthActive / 2.) {
186 yLongBase = ((
t->distanceWireSupport * (iymin - 1) +
t->offsetWireSupport[iSenLyr]) +
187 (
t->distanceWireSupport * iymin +
t->offsetWireSupport[iSenLyr])) /
188 2.;
189 } else {
190 yLongBase = ((
t->distanceWireSupport * iymin +
t->offsetWireSupport[iSenLyr]) + (-longWidthActive / 2.)) / 2.;
191 }
192 double yShortBase =
193 ((
t->distanceWireSupport * iymin +
t->offsetWireSupport[iSenLyr] + lengthActive *
tan(
t->angleTilt)) + (-widthActive / 2.)) / 2.;
194 yposCentre[nBS] = yLongBase;
195 angleTiltButton[nBS] =
atan((yShortBase - yLongBase) / lengthActive);
196 nBS++;
197 }
198
199 double widthRightTrd = widthActive / 2. - (
t->distanceWireSupport * iymax +
t->offsetWireSupport[iSenLyr] + lengthActive *
tan(-
t->angleTilt));
200
201 if (widthRightTrd > 8. * Gaudi::Units::cm) {
202 double yLongBase;
203 if ((
name ==
"TGC01" ||
name ==
"TGC06" ||
name ==
"TGC12") &&
204 t->distanceWireSupport * (iymax + 1) +
t->offsetWireSupport[iSenLyr] < longWidthActive / 2.) {
205 yLongBase = ((
t->distanceWireSupport * (iymax + 1) +
t->offsetWireSupport[iSenLyr]) +
206 (
t->distanceWireSupport * iymax +
t->offsetWireSupport[iSenLyr])) /
207 2.;
208 } else {
209 yLongBase = ((
t->distanceWireSupport * iymax +
t->offsetWireSupport[iSenLyr]) + longWidthActive / 2.) / 2.;
210 }
211 double yShortBase = ((
t->distanceWireSupport * iymax +
t->offsetWireSupport[iSenLyr] + lengthActive *
tan(-
t->angleTilt)) + widthActive / 2.) / 2.;
212 yposCentre[nBS] = yLongBase;
213 angleTiltButton[nBS] =
atan((yShortBase - yLongBase) / lengthActive);
214 nBS++;
215 }
216
217 if (nBS == 0) {
218 break;
219 }
220 }
221 for (int iBS = 0; iBS < nBS; iBS++) {
222 for (int isupz = izmin; isupz <= izmax; isupz++) {
223 double yposleft = yposCentre[iBS] -
t->pitchButton[0] / 2. + (lengthActive / 2. -
t->pitchButton[1] / 2. * isupz) *
tan(angleTiltButton[iBS]);
224 GeoTrf::Translate3D vtransBS(0., yposleft +
t->pitchButton[0] * std::abs(isupz % 2),
t->pitchButton[1] / 2. * isupz);
225 sGasVolume = &(sGasVolume->subtract((*stubesup) << GeoTrf::Transform3D(vtransBS * rotY)));
226 }
227 }
228 }
229 }
230
231 if (cutoutson && !vcutdef.empty()) {
232
233
234 Cutout *
cut =
nullptr;
235 GeoShape *cutoutShape = nullptr;
236 GeoTrf::Transform3D cutTrans{GeoTrf::Transform3D::Identity()};
237 for (
unsigned i = 0;
i < vcutdef.size();
i++) {
239 cutoutShape =
new GeoTrd(
thickness / 2. + 1.,
thickness / 2. + 1.,
cut->widthXs / 2. +
t->frame_ab / 2.,
cut->widthXl / 2. +
t->frame_ab / 2.,
240 cut->lengthY / 2. +
t->frame_h / 2.);
241 cutTrans = GeoTrf::Translate3D(0.0,
cut->dx, -
length / 2 +
cut->dy +
cut->lengthY / 2.);
242 sGasVolume = &(sGasVolume->subtract((*cutoutShape) << cutTrans));
243 }
244 }
245
246 GeoLogVol *ltrdtmp =
new GeoLogVol(
t->materials[i], sGasVolume, matManager.
getMaterial(
t->materials[i]));
247 GeoPhysVol *ptrdtmp = new GeoPhysVol(ltrdtmp);
248 GeoNameTag *ntrdtmp =
new GeoNameTag(
name +
t->materials[i]);
249 GeoTransform *ttrdtmp =
new GeoTransform(GeoTrf::TranslateX3D(newpos + (
t->tck[i] / 2)));
250
251
252
254 ptrd->add(ntrdtmp);
255 ptrd->add(ttrdtmp);
256 ptrd->add(ptrdtmp);
257 }
258
259 iSenLyr++;
260
261 }
else if (
t->materials[i] !=
"std:G10") {
262
263
265 if (cutoutson && !vcutdef.empty()) {
266 Cutout *
cut =
nullptr;
267 GeoShape *cutoutShape = nullptr;
268 GeoTrf::Transform3D cutTrans{GeoTrf::Transform3D::Identity()};
269 for (
unsigned i = 0;
i < vcutdef.size();
i++) {
272 cutTrans = GeoTrf::Translate3D(0.0,
cut->dx, -
length / 2 +
cut->dy +
cut->lengthY / 2.);
273 strdtmp = &(strdtmp->subtract((*cutoutShape) << cutTrans));
274 }
275 }
276 GeoLogVol *ltrdtmp =
new GeoLogVol(
t->materials[i], strdtmp, matManager.
getMaterial(
t->materials[i]));
277 GeoPhysVol *ptrdtmp = new GeoPhysVol(ltrdtmp);
278 GeoNameTag *ntrdtmp =
new GeoNameTag(
name +
t->materials[i]);
279 GeoTransform *ttrdtmp =
new GeoTransform(GeoTrf::TranslateX3D(newpos + (
t->tck[i] / 2)));
280
282 ptrd->add(ntrdtmp);
283 ptrd->add(ttrdtmp);
284 ptrd->add(ptrdtmp);
285 }
286 }
287
289 }
290
291 return ptrd;
292 }
Technology * GetTechnology(const std::string &name)
virtual const GeoMaterial * getMaterial(const std::string &name)=0
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.