12 #include <TGeometry.h> 51 Ring(
double rL,
double rH,
double theta,
double waferR,
52 double siThick,
double staggering)
53 : fStaggering(staggering),
61 double tan_theta = tan(fAngle * TMath::Pi() / 180.);
62 double tan_theta2 = pow(tan_theta,2);
63 double r2 = pow(fRadius,2);
64 double ir2 = pow(fInnerRadius,2);
65 double or2 = pow(fOuterRadius,2);
66 double y_A = tan_theta * fInnerRadius;
67 double x_D = fInnerRadius + sqrt(r2 - tan_theta2 * ir2);
68 double x_D2 = pow(x_D,2);
69 double y_B = sqrt(r2 - or2 + 2 * fOuterRadius * x_D - x_D2);
70 double x_C = ((x_D + sqrt(-tan_theta2 * x_D2
71 + r2 * (1 + tan_theta2)))
73 double y_C = tan_theta * x_C;
75 fVerticies[0] =
point_t(fInnerRadius, y_A);
76 fVerticies[1] =
point_t(x_C, y_C);
77 fVerticies[2] =
point_t(fOuterRadius, y_B);
78 fVerticies[3] =
point_t(fOuterRadius, -y_B);
79 fVerticies[4] =
point_t(x_C, -y_C);
80 fVerticies[5] =
point_t(fInnerRadius, -y_A);
91 std::cout <<
"Creating Module shape" << std::flush;
92 TXTRU* moduleShape =
new TXTRU(
"Module",
"Module",
"", 6, 2);
93 for (Int_t i = 0; i < 6; i++) {
94 std::cout <<
"." << std::flush;
98 moduleShape->DefineSection(0, -fThickness/2, 1, 0, 0);
99 moduleShape->DefineSection(1, fThickness/2, 1, 0, 0);
100 std::cout << std::endl;
101 return (TShape*)moduleShape;
107 std::cout <<
"Creating Ring node for " << name << std::flush;
108 double bredth = fStaggering + fThickness;
109 TShape* ringShape =
new TTUBE(Form(
"%sShape", name),
"Ring Shape",
111 fOuterRadius,bredth/2);
112 TNode* ringNode =
new TNode(Form(
"%sNode", name),
"Ring Node",
113 ringShape, 0, 0, z+bredth/2, 0);
114 TShape* moduleShape = CreateShape();
115 Int_t n = Int_t(360 / 2 / fAngle);
116 for (Int_t i = 0; i < n; i++) {
117 std::cout <<
"." << std::flush;
119 Double_t theta = 2 * fAngle * i;
120 Double_t z = -(bredth+fThickness)/2+(i%2?0:fStaggering);
121 TRotMatrix* rot =
new TRotMatrix(Form(
"%sRotation%02d", name, i),
122 "Rotation", 90, theta, 90,
123 fmod(90 + theta, 360), 0, 0);
124 TNode* moduleNode =
new TNode(Form(
"%sModule%02d", name, i),
125 "Module", moduleShape, 0, 0, z,
127 moduleNode->SetFillColor(2);
128 moduleNode->SetLineColor(2);
129 moduleNode->SetLineWidth(2);
131 std::cout << std::endl;
132 ringNode->SetVisibility(0);
161 : fInner(inner), fInnerZ(iZ), fOuter(outer), fOuterZ(oZ)
168 if (fInner) fInner->CreateRing(
"inner", fInnerZ);
169 if (fOuter) fOuter->CreateRing(
"outer", fOuterZ);
193 :
Detector(inner, -62.8,outer, -75.2)
210 double zdist = fConeL - 2 * fBackDz - 2 * fNoseDz;
211 double tdist = fBackRh - fNoseRh;
212 double alpha = tdist / zdist;
214 z = fNoseZ - fConeL / 2;
215 TPCON* fmd3Shape =
new TPCON(
"fmd3Shape",
"FMD 3 Shape",
"", 0, 360, 7);
219 fmd3Shape->DefineSection(0, x - z, rl, rh);
220 x = fNoseZ-2*fNoseDz;
221 fmd3Shape->DefineSection(1, x - z, rl, rh);
222 x = fInnerZ - fInner->fStaggering - fInner->fThickness;
223 rl = fInner->fInnerRadius;
224 rh = fNoseRh + alpha * TMath::Abs(x-fNoseZ + 2 * fNoseDz);
225 fmd3Shape->DefineSection(2, x - z, rl, rh);
227 rl = fOuter->fInnerRadius;
229 fmd3Shape->DefineSection(3, x - z, rl, rh);
230 x = fNoseZ - zdist - 2 * fNoseDz;
231 rl = fOuter->fInnerRadius;
233 fmd3Shape->DefineSection(4, x - z, rl, rh);
234 x = fNoseZ - zdist - 2 * fNoseDz;
235 rl = fOuter->fInnerRadius;
237 fmd3Shape->DefineSection(5, x - z, rl, rh);
239 rl = fOuter->fInnerRadius;
241 fmd3Shape->DefineSection(6, x - z, rl, rh);
243 TNode* fmd3Node =
new TNode(
"fmd3Node",
"FMD3 Node", fmd3Shape,0,0,z,0);
244 fmd3Node->SetLineColor(11);
245 fmd3Node->SetFillColor(11);
246 fmd3Node->SetVisibility(1);
248 if (fInner) fInner->CreateRing(
"inner", fInnerZ-z);
250 if (fOuter) fOuter->CreateRing(
"outer", fOuterZ-z);
252 CreateSupport(fNoseZ - z);
258 TShape* noseShape =
new TTUBE(
"noseShape",
"Nose Shape",
"",
259 fNoseRl, fNoseRh, fNoseDz);
260 TNode* noseNode =
new TNode(
"noseNode",
"noseNode", noseShape,
261 0, 0, noseZ - fNoseDz, 0);
262 noseNode->SetLineColor(0);
263 double zdist = fConeL - 2 * fBackDz - 2 * fNoseDz;
264 double tdist = fBackRh - fNoseRh;
265 double beamL = TMath::Sqrt(zdist * zdist + tdist * tdist);
266 double theta = -TMath::ATan2(tdist, zdist);
267 TShape* backShape =
new TTUBE(
"backShape",
"Back Shape",
"",
268 fBackRl, fBackRh, fBackDz);
269 TNode* backNode =
new TNode(
"backNode",
"backNode", backShape,
270 0, 0, noseZ-2*fNoseDz-zdist-fBackDz, 0);
271 backNode->SetLineColor(0);
272 TShape* beamShape =
new TBRIK(
"beamShape",
"beamShape",
"",
273 fBeamDz, fBeamW / 2 , beamL / 2);
275 Double_t r = fNoseRl + tdist / 2;
276 for (Int_t i = 0; i < n; i++) {
277 Double_t phi = 360. / n * i;
278 Double_t t = 180. * theta / TMath::Pi();
279 TRotMatrix* beamRotation =
new TRotMatrix(Form(
"beamRotation%d", i),
280 Form(
"beamRotation%d", i),
281 180-t,phi,90,90+phi,t,phi);
282 TNode* beamNode =
new TNode(Form(
"beamNode%d", i),
283 Form(
"beamNode%d", i), beamShape,
284 r * TMath::Cos(phi / 180 * TMath::Pi()),
285 r * TMath::Sin(phi / 180 * TMath::Pi()),
286 noseZ-2*fNoseDz-zdist/2, beamRotation);
287 beamNode->SetLineColor(0);
289 Double_t flangel = (fFlangeR - fBackRh) / 2;
290 TShape* flangeShape =
new TBRIK(
"flangeShape",
"FlangeShape",
"",
291 flangel, fBeamW / 2, fBackDz);
293 r = fBackRh + flangel;
294 for (Int_t i = 0; i < n; i++) {
295 Double_t phi = 360. / n * i + 180. / n;
296 TRotMatrix* flangeRotation =
new TRotMatrix(Form(
"flangeRotation%d", i),
297 Form(
"Flange Rotation %d",i),
298 90,phi,90,90+phi,0,0);
299 TNode* flangeNode =
new TNode(Form(
"flangeNode%d", i),
300 Form(
"flangeNode%d", i),
302 r * TMath::Cos(phi / 180 * TMath::Pi()),
303 r * TMath::Sin(phi / 180 * TMath::Pi()),
304 noseZ-2*fNoseDz-zdist-fBackDz,
306 flangeNode->SetLineColor(0);
344 TGeometry* geometry =
new TGeometry(
"geometry",
"geometry");
345 TShape* topShape =
new TBRIK(
"topShape",
"topShape",
"", 40, 40, 150);
346 TNode* topNode =
new TNode(
"topNode",
"topNode", topShape, 0, 0, 0, 0);
347 topNode->SetVisibility(0);
350 Ring inner( 4.3, 17.2, 18, 13.4 / 2, .03, 1);
351 Ring outer(15.6, 28.0, 9, 13.4 / 2, .03, 1);
352 FMD3 fmd3(&inner, &outer);
355 TCanvas* c =
new TCanvas(
"c",
"c", 800, 800);
void CreateSupport(double noseZ)
TNode * CreateRing(const char *name, double z)
virtual void CreateSupport(double)
Ring(double rL, double rH, double theta, double waferR, double siThick, double staggering)
virtual void CreateRings()
FMD3(Ring *inner, Ring *outer)
std::vector< point_t > points_t
FMD3 simple node geometry.
point_t(double x=0, double y=0)
Detector(Ring *inner, double iZ, Ring *outer=0, double oZ=0)
void NodeGeometry()
Create a node geometry.