Old TOF library: removing
[u/mrichter/AliRoot.git] / FMD / AliFMDRing.cxx
CommitLineData
4347b38f 1/**************************************************************************
c4bcfd14 2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
4347b38f 3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
c4bcfd14 18//__________________________________________________________________
4347b38f 19//
20// Utility class to help implement collection of FMD modules into
21// rings. This is used by AliFMDSubDetector and AliFMD.
22//
23// The AliFMD object owns the AliFMDRing objects, and the
24// AliFMDSubDetector objects reference these. That is, the AliFMDRing
25// objects are share amoung the AliFMDSubDetector objects.
26//
27// Latest changes by Christian Holm Christensen
28//
4347b38f 29#ifndef ALIFMDRING_H
30# include "AliFMDRing.h"
31#endif
32#ifndef ALILOG_H
33# include "AliLog.h"
34#endif
35#ifndef ROOT_TMath
36# include <TMath.h>
37#endif
38#ifndef ROOT_TH2
39# include <TH2.h>
40#endif
41#ifndef ROOT_TVirtualMC
42# include <TVirtualMC.h>
43#endif
44#ifndef ROOT_TVector2
45# include <TVector2.h>
46#endif
47#ifndef ROOT_TBrowser
48# include <TBrowser.h>
49#endif
50#ifndef ROOT_TString
51# include <TString.h>
52#endif
53#ifndef ROOT_TArc
54# include <TArc.h>
55#endif
56#ifndef ROOT_TObjArray
57# include <TObjArray.h>
58#endif
59#ifndef ROOT_TXTRU
60# include <TXTRU.h>
61#endif
62#ifndef ROOT_TNode
63# include <TNode.h>
64#endif
65#ifndef ROOT_TRotMatrix
66# include <TRotMatrix.h>
67#endif
68#ifndef ROOT_TList
69# include <TList.h>
70#endif
71#ifndef __IOSTREAM__
72# include <iostream>
73#endif
7c09877a 74#include <math.h>
4347b38f 75
c4bcfd14 76const Char_t* AliFMDRing::fgkRingFormat = "FRG%c";
77const Char_t* AliFMDRing::fgkVirtualFormat = "FV%c%c";
78const Char_t* AliFMDRing::fgkActiveFormat = "FAC%c";
79const Char_t* AliFMDRing::fgkSectorFormat = "FSE%c";
80const Char_t* AliFMDRing::fgkStripFormat = "FST%c";
81const Char_t* AliFMDRing::fgkPrintboardFormat = "FP%c%c";
42403906 82
83
84//____________________________________________________________________
4347b38f 85ClassImp(AliFMDRing);
86
87//____________________________________________________________________
4347b38f 88AliFMDRing::AliFMDRing(Char_t id, Bool_t detailed)
89 : fId(id),
90 fDetailed(detailed),
c4bcfd14 91 fActiveId(0),
92 fPrintboardBottomId(0),
93 fPrintboardTopId(0),
94 fRingId(0),
95 fSectionId(0),
96 fStripId(0),
97 fVirtualBackId(0),
98 fVirtualFrontId(0),
99 fBondingWidth(0),
4347b38f 100 fWaferRadius(0),
101 fSiThickness(0),
102 fLowR(0),
103 fHighR(0),
104 fTheta(0),
105 fNStrips(0),
c4bcfd14 106 fRingDepth(0),
107 fLegRadius(0),
108 fLegLength(0),
109 fLegOffset(0),
110 fModuleSpacing(0),
111 fPrintboardThickness(0),
4347b38f 112 fShape(0),
113 fRotMatricies(0)
42403906 114{
115 // Construct a alifmdring.
116 //
117 // id Id of the ring (either 'i' or 'o').
c4bcfd14 118 // detailed Whether the strips are made or not.
119 //
120}
121
122//____________________________________________________________________
123AliFMDRing::AliFMDRing(const AliFMDRing& other)
124 : TObject(other),
125 fId(other.fId),
126 fDetailed(other.fDetailed),
127 fActiveId(other.fActiveId),
128 fPrintboardBottomId(other.fPrintboardBottomId),
129 fPrintboardTopId(other.fPrintboardTopId),
130 fRingId(other.fRingId),
131 fSectionId(other.fSectionId),
132 fStripId(other.fStripId),
133 fVirtualBackId(other.fVirtualBackId),
134 fVirtualFrontId(other.fVirtualFrontId),
135 fBondingWidth(other.fBondingWidth),
136 fWaferRadius(other.fWaferRadius),
137 fSiThickness(other.fSiThickness),
138 fLowR(other.fLowR),
139 fHighR(other.fHighR),
140 fTheta(other.fTheta),
141 fNStrips(other.fNStrips),
142 fRingDepth(other.fRingDepth),
143 fLegRadius(other.fLegRadius),
144 fLegLength(other.fLegLength),
145 fLegOffset(other.fLegOffset),
146 fModuleSpacing(other.fModuleSpacing),
147 fPrintboardThickness(other.fPrintboardThickness),
148 fRotations(other.fRotations),
149 fShape(other.fShape),
150 fRotMatricies(other.fRotMatricies)
151{
152 // Copy constructor of a AliFMDRing.
153}
154
155//____________________________________________________________________
156AliFMDRing&
157AliFMDRing::operator=(const AliFMDRing& other)
158{
159 // Assignment operator
160 //
161 fId = other.fId;
162 fDetailed = other.fDetailed;
163 fActiveId = other.fActiveId;
164 fPrintboardBottomId = other.fPrintboardBottomId;
165 fPrintboardTopId = other.fPrintboardTopId;
166 fRingId = other.fRingId;
167 fSectionId = other.fSectionId;
168 fStripId = other.fStripId;
169 fVirtualBackId = other.fVirtualBackId;
170 fVirtualFrontId = other.fVirtualFrontId;
171 fBondingWidth = other.fBondingWidth;
172 fWaferRadius = other.fWaferRadius;
173 fSiThickness = other.fSiThickness;
174 fLowR = other.fLowR;
175 fHighR = other.fHighR;
176 fTheta = other.fTheta;
177 fNStrips = other.fNStrips;
178 fRingDepth = other.fRingDepth;
179 fLegRadius = other.fLegRadius;
180 fLegLength = other.fLegLength;
181 fLegOffset = other.fLegOffset;
182 fModuleSpacing = other.fModuleSpacing;
183 fPrintboardThickness = other.fPrintboardThickness;
184 fRotations = other.fRotations;
185 if (other.fShape) {
186 if (other.fShape->IsA() == TXTRU::Class())
187 ((TXTRU*)other.fShape)->Copy(*fShape);
188 else
189 fShape = 0;
190 }
191 if (other.fRotMatricies) {
192 Int_t n = other.fRotMatricies->GetEntries();
193 if (!fRotMatricies) fRotMatricies = new TObjArray(n);
194 else fRotMatricies->Expand(n);
195 TIter next(other.fRotMatricies);
196 TObject* o = 0;
197 while ((o = next())) fRotMatricies->Add(o);
198 }
199 return *this;
42403906 200}
201
c4bcfd14 202
4347b38f 203
204//____________________________________________________________________
205void
206AliFMDRing::Init()
207{
208 // Initialize the ring object.
209 // DebugGuard guard("AliFMDRing::Init");
210 AliDebug(10, "AliFMDRing::Init");
211 fPolygon.Clear();
212 SetupCoordinates();
213}
214
215//____________________________________________________________________
216AliFMDRing::~AliFMDRing()
217{
42403906 218 // Destructor - deletes shape and rotation matricies
4347b38f 219 if (fShape) delete fShape;
220 if (fRotMatricies) delete fRotMatricies;
221}
222
223
224//____________________________________________________________________
225void
226AliFMDRing::Browse(TBrowser* /* b */)
227{
228 // DebugGuard guard("AliFMDRing::Browse");
229 AliDebug(10, "AliFMDRing::Browse");
230}
231
232
233//____________________________________________________________________
234void
235AliFMDRing::SetupCoordinates()
236{
237 // Calculates the parameters of the polygon shape.
238 //
239 // DebugGuard guard("AliFMDRing::SetupCoordinates");
240 AliDebug(10, "AliFMDRing::SetupCoordinates");
241 // Get out immediately if we have already done all this
242 if (fPolygon.GetNVerticies() > 1) return;
243
c4bcfd14 244 double tanTheta = TMath::Tan(fTheta * TMath::Pi() / 180.);
245 double tanTheta2 = TMath::Power(tanTheta,2);
4347b38f 246 double r2 = TMath::Power(fWaferRadius,2);
c4bcfd14 247 double yA = tanTheta * fLowR;
4347b38f 248 double lr2 = TMath::Power(fLowR, 2);
249 double hr2 = TMath::Power(fHighR,2);
c4bcfd14 250 double xD = fLowR + TMath::Sqrt(r2 - tanTheta2 * lr2);
251 double xD2 = TMath::Power(xD,2);
252 //double xD_2 = fLowR - TMath::Sqrt(r2 - tanTheta2 * lr2);
253 double yB = sqrt(r2 - hr2 + 2 * fHighR * xD - xD2);
254 double xC = ((xD + TMath::Sqrt(-tanTheta2 * xD2 + r2
255 + r2 * tanTheta2))
256 / (1 + tanTheta2));
257 double yC = tanTheta * xC;
258
259 fPolygon.AddVertex(fLowR, -yA);
260 fPolygon.AddVertex(xC, -yC);
261 fPolygon.AddVertex(fHighR, -yB);
262 fPolygon.AddVertex(fHighR, yB);
263 fPolygon.AddVertex(xC, yC);
264 fPolygon.AddVertex(fLowR, yA);
4347b38f 265}
266
267//____________________________________________________________________
268bool
269AliFMDRing::IsWithin(size_t moduleNo, double x, double y) const
270{
271 // Checks if a point (x,y) is inside the module with number moduleNo
272 //
273 // DebugGuard guard("AliFMDRing::IsWithin");
274 AliDebug(10, "AliFMDRing::IsWithin");
275 bool ret = false;
276 double r2 = x * x + y * y;
277 if (r2 < fHighR * fHighR && r2 > fLowR * fLowR) {
278 // double point_angle = TMath::ATan2(y, x);
279 // int n_modules = 360 / Int_t(fTheta * 2);
280 double m_angle = (.5 + moduleNo) * 2 * fTheta;
281 double m_radians = TMath::Pi() * m_angle / 180.;
282
283 // Rotate the point.
284 double xr = x * TMath::Cos(-m_radians) - y * TMath::Sin(-m_radians);
285 double yr = x * TMath::Sin(-m_radians) + y * TMath::Cos(-m_radians);
286
287 ret = fPolygon.Contains(xr,yr);
288 }
289 return ret;
290}
291
292
293
294
295//____________________________________________________________________
296void
297AliFMDRing::Draw(Option_t* option) const
298{
299 // Draw a the shape of the ring into a 2D histogram. Useful for
300 // superimposing the actual shape of the ring onto a scatter plot of
301 // hits in the detector.
302 //
303 // DebugGuard guard("AliFMDRing::Draw");
304 AliDebug(10, "AliFMDRing::Draw");
305 // The unrotated coordinates of the polygon verticies
306 if (fPolygon.GetNVerticies() < 1) return;
307
308 TVector2 v[6];
309 for (size_t i = 0; i < fPolygon.GetNVerticies(); i++)
310 v[i] = fPolygon.GetVertex(i);
311
312 Int_t nModules = 360 / Int_t(fTheta * 2);
313 Double_t dTheta = fTheta * 2;
314
315 TString opt(option);
316 if (opt.Contains("B", TString::kIgnoreCase)) {
317 opt.Remove(opt.Index("B", 1, TString::kIgnoreCase),1);
318 TH1* null = new TH2F("null", "Null",
319 100, -fHighR * 1.1, fHighR * 1.1,
320 100, -fHighR * 1.1, fHighR * 1.1);
321 null->SetStats(0);
322 null->Draw(opt.Data());
323 }
324
325 for (int i = 0; i < nModules; i++) {
326 Double_t theta = (i + .5) * dTheta;
327 AliFMDPolygon p;
328 for (int j = 0; j < 6; j++) {
329 TVector2 vr(v[j].Rotate(TMath::Pi() * theta / 180.));
330 if (!p.AddVertex(vr.X(),vr.Y())) {
331 // std::cerr << "Draw of polygon " << i << " failed" << std::endl;
332 break;
333 }
334 }
335 p.Draw(opt.Data(), Form("MOD%c_%d", fId, i));
336 }
337 if (opt.Contains("0", TString::kIgnoreCase)) {
338 TArc* arcH = new TArc(0,0, fHighR);
339 arcH->SetLineStyle(2);
340 arcH->SetLineColor(4);
341 arcH->Draw();
342
343 TArc* arcL = new TArc(0,0, fLowR);
344 arcL->SetLineStyle(2);
345 arcL->SetLineColor(4);
346 arcL->Draw();
347 }
348}
349
350//____________________________________________________________________
351void
352AliFMDRing::SetupGeometry(Int_t vacuumId, Int_t siId, Int_t pcbId,
353 Int_t pbRotId, Int_t idRotId)
354{
355 // Setup the geometry of the ring. It defines the volumes
356 // RNGI or RNGO which can later be positioned in a sub-detector
357 // volume.
358 //
359 // The hieracy of the RNGx volume is
360 //
42403906 361 // FRGx // Ring volume
362 // FVFx // Container of hybrid + legs
363 // FACx // Active volume (si sensor approx)
364 // FSEx // Section division
365 // FSTx // Strip division
366 // FPTx // Print board (bottom)
367 // FPBx // Print board (top)
368 // FLL // Support leg (long version)
369 // FVBx // Container of hybrid + legs
370 // FACx // Active volume (si sensor approx)
371 // FSEx // Section division
372 // FSTx // Strip division
373 // FPTx // Print board (bottom)
374 // FPBx // Print board (top)
375 // FSL // Support leg (long version)
4347b38f 376 //
377 // Parameters:
378 //
379 // vacuumId Medium of inactive virtual volumes
380 // siId Medium of Silicon sensor (active)
381 // pcbId Medium of print boards
382 // pbRotId Print board rotation matrix
383 // idRotId Identity rotation matrix
384 //
385 // DebugGuard guard("AliFMDRing::SetupGeometry");
386 AliDebug(10, "AliFMDRing::SetupGeometry");
387
388 const TVector2& bCorner = fPolygon.GetVertex(3); // Third corner
389 const TVector2& aCorner = fPolygon.GetVertex(5); // First corner
390 const TVector2& cCorner = fPolygon.GetVertex(4); // Second corner
391 TString name;
392 TString name2;
393 Double_t dStrip = (bCorner.Mod() - aCorner.Mod()) / fNStrips;
394 Double_t stripOff = aCorner.Mod();
395 Double_t rmin = fLowR;
396 Double_t rmax = bCorner.Mod();
397 Double_t pars[10];
398 fRingDepth = (fSiThickness
399 + fPrintboardThickness
400 + fLegLength
401 + fModuleSpacing);
402
403 // Ring virtual volume
404 pars[0] = rmin;
c4bcfd14 405 pars[1] = rmax;
4347b38f 406 pars[2] = fRingDepth / 2;
c4bcfd14 407 name = Form(fgkRingFormat, fId);
4347b38f 408 fRingId = gMC->Gsvolu(name.Data(), "TUBE", vacuumId, pars, 3);
409
410 // Virtual volume for modules with long legs
411 pars[1] = rmax;
412 pars[3] = -fTheta;
413 pars[4] = fTheta;
c4bcfd14 414 name = Form(fgkVirtualFormat, 'F', fId);
4347b38f 415 fVirtualFrontId = gMC->Gsvolu(name.Data(), "TUBS", vacuumId, pars, 5);
416
417 // Virtual volume for modules with long legs
418 pars[2] = (fRingDepth - fModuleSpacing) / 2;
c4bcfd14 419 name = Form(fgkVirtualFormat, 'B', fId);
4347b38f 420 fVirtualBackId = gMC->Gsvolu(name.Data(), "TUBS", vacuumId, pars, 5);
421
422 // Virtual mother volume for silicon
423 pars[2] = fSiThickness/2;
424 name2 = name;
c4bcfd14 425 name = Form(fgkActiveFormat, fId);
4347b38f 426 fActiveId = gMC->Gsvolu(name.Data(), "TUBS", vacuumId , pars, 5);
427
428 if (fDetailed) {
429 // Virtual sector volumes
430 name2 = name;
c4bcfd14 431 name = Form(fgkSectorFormat, fId);
4347b38f 432 gMC->Gsdvn2(name.Data(), name2.Data(), 2, 2, -fTheta, vacuumId);
433 fSectionId = gMC->VolId(name.Data());
434
435 // Active strip volumes
436 name2 = name;
c4bcfd14 437 name = Form(fgkStripFormat, fId);
42403906 438 gMC->Gsdvt2(name.Data(), name2.Data(), dStrip, 1,stripOff, siId, fNStrips);
4347b38f 439 fStripId = gMC->VolId(name.Data());
440 }
441
442 // Print-board on back of module
443 pars[4] = TMath::Tan(TMath::Pi() * fTheta / 180) * fBondingWidth;
444 // Top of the print board
445 pars[0] = cCorner.Y() - pars[4];
446 pars[1] = bCorner.Y() - pars[4];
447 pars[2] = fPrintboardThickness / 2; // PCB half thickness
448 pars[3] = (bCorner.X() - cCorner.X()) / 2;
c4bcfd14 449 name = Form(fgkPrintboardFormat, 'T', fId);
4347b38f 450 fPrintboardTopId = gMC->Gsvolu(name.Data(), "TRD1", pcbId, pars, 4);
451
452 // Bottom of the print board
453 pars[0] = aCorner.Y() - pars[4];
454 pars[1] = cCorner.Y() - pars[4];
455 pars[3] = (cCorner.X() - aCorner.X()) / 2;
c4bcfd14 456 name = Form(fgkPrintboardFormat, 'B', fId);
4347b38f 457 fPrintboardBottomId = gMC->Gsvolu(name.Data(), "TRD1", pcbId, pars, 4);
458
459 // Define rotation matricies
460 Int_t nModules = 360 / Int_t(fTheta * 2);
461 Double_t dTheta = fTheta * 2;
462 fRotations.Set(nModules);
463 for (int i = 0; i < nModules; i++) {
464 Double_t theta = (i + .5) * dTheta;
465 Int_t idrot = 0;
466 // Rotation matrix for virtual module volumes
467 gMC->Matrix(idrot, 90, theta, 90, fmod(90 + theta, 360), 0, 0);
468 fRotations[i] = idrot;
469 }
470
471
472 // Int_t nModules = 360 / Int_t(fTheta * 2);
473 // Double_t dTheta = fTheta * 2;
474 Double_t pbTopL = (bCorner.X() - cCorner.X());
475 Double_t pbBotL = (cCorner.X() - aCorner.X());
476 Double_t yoffset = ((TMath::Tan(TMath::Pi() * fTheta / 180)
477 * fBondingWidth));
478
479 for (int i = 0; i < nModules; i++) {
c4bcfd14 480 TString name2 = Form(fgkRingFormat, fId);
4347b38f 481
482 Int_t id = i;
483 // Double_t theta = (i + .5) * dTheta;
484 Bool_t isFront = (i % 2 == 1);
485 Double_t dz = 0;
486 Double_t w = fRingDepth - (isFront ? 0 : fModuleSpacing);
487
488 // Place virtual module volume
c4bcfd14 489 name = Form(fgkVirtualFormat, (isFront ? 'F' : 'B'), fId);
4347b38f 490 dz = (w - fRingDepth) / 2;
491 gMC->Gspos(name.Data(), id, name2.Data(), 0., 0., dz,fRotations[i]);
492
493 // We only need to place the children once, they are copied when
494 // we place the other virtual volumes.
495 if (i > 1) continue;
496 name2 = name;
497
498 // Place active silicon wafer - this is put so that the front of
499 // the silicon is on the edge of the virtual volume.
c4bcfd14 500 name = Form(fgkActiveFormat, fId);
4347b38f 501 dz = (w - fSiThickness) / 2;
502 gMC->Gspos(name.Data(), id, name2.Data(),0.,0.,dz,idRotId);
503
504 // Place print board. This is put immediately behind the silicon
c4bcfd14 505 name = Form(fgkPrintboardFormat, 'T', fId);
4347b38f 506 dz = w / 2 - fSiThickness - fPrintboardThickness / 2;
507 gMC->Gspos(name.Data(), id, name2.Data(),
508 fLowR + pbBotL + pbTopL / 2, 0, dz, pbRotId, "ONLY");
c4bcfd14 509 name = Form(fgkPrintboardFormat, 'B', fId);
4347b38f 510 gMC->Gspos(name.Data(), id, name2.Data(),
511 fLowR + pbBotL / 2, 0, dz, pbRotId, "ONLY");
512
513 // Support legs
514 // This is put immediately behind the pringboard.
515 dz = (w / 2 - fSiThickness - fPrintboardThickness
516 - (fLegLength + (isFront ? fModuleSpacing : 0)) /2);
42403906 517 name = (isFront ? "FLL" : "FSL");
4347b38f 518 gMC->Gspos(name.Data(), id*10 + 1, name2.Data(),
519 aCorner.X() + fLegOffset + fLegRadius, 0., dz, idRotId, "");
520 Double_t y = cCorner.Y() - yoffset - fLegOffset - fLegRadius;
521 gMC->Gspos(name.Data(),id*10+2,name2.Data(),cCorner.X(), y,dz,idRotId,"");
c4bcfd14 522 gMC->Gspos(name.Data(),id*10+3,name2.Data(),cCorner.X(), -y,dz,idRotId,"");
4347b38f 523 }
524}
525//____________________________________________________________________
526void
527AliFMDRing::Geometry(const char* mother, Int_t baseId, Double_t z,
528 Int_t /* pbRotId */, Int_t idRotId)
529{
530 // Positions a RNGx volume inside a mother.
531 //
532 // Parameters
533 //
534 // mother Mother volume to position the RNGx volume in
535 // baseId Base copy number
536 // z Z coordinate where the front of the active silicon
537 // should be in the mother volume, so we need to
538 // subtract half the ring width.
539 // idRotId Identity rotation matrix
540 //
541 // DebugGuard guard("AliFMDRing::Geometry");
542 AliDebug(10, "AliFMDRing::Geometry");
543 TString name;
544 Double_t offsetZ = (fSiThickness
545 + fPrintboardThickness
546 + fLegLength + fModuleSpacing) / 2;
c4bcfd14 547 name = Form(fgkRingFormat, fId);
4347b38f 548 gMC->Gspos(name.Data(), baseId, mother, 0., 0., z - offsetZ, idRotId, "");
549}
550
551//____________________________________________________________________
552void
553AliFMDRing::SimpleGeometry(TList* nodes,
554 TNode* mother,
555 Int_t colour,
556 Double_t z,
557 Int_t n)
558{
559 // Make a simple geometry of the ring for event display.
560 //
561 // The simple geometry is made from ROOT TNode and TShape objects.
562 // Note, that we cache the TShape and TRotMatrix objects used for
563 // this.
564 //
565 // Parameters
566 //
567 // nodes List of nodes to register all create nodes in
568 // mother Mother node to put the ring in.
569 // colour Colour of the nodes
570 // z Z position of the node in the mother volume
571 // n Detector number
572 //
573 // DebugGuard guard("AliFMDRing::SimpleGeometry");
574 AliDebug(10, "AliFMDRing::SimpleGeometry");
575 SetupCoordinates();
576
577 // If the shape hasn't been defined yet, we define it here.
578 if (!fShape) {
c4bcfd14 579 TString name(Form(fgkActiveFormat, fId));
4347b38f 580 TString title(Form("Shape of modules in %c Rings", fId));
581 Int_t n = fPolygon.GetNVerticies();
582 TXTRU* shape = new TXTRU(name.Data(), title.Data(), "void", n, 2);
583 for (Int_t i = 0; i < n; i++) {
584 const TVector2& v = fPolygon.GetVertex(i);
585 shape->DefineVertex(i, v.X(), v.Y());
586 }
587 shape->DefineSection(0, - fSiThickness / 2, 1, 0, 0);
588 shape->DefineSection(1, + fSiThickness / 2, 1, 0, 0);
589 fShape = shape;
590 fShape->SetLineColor(colour);
591 }
592
593 Int_t nModules = 360 / Int_t(fTheta * 2);
594 Double_t dTheta = fTheta * 2;
595
596 // If the roation matricies hasn't been defined yet, we do so here
597 if (!fRotMatricies) {
598 fRotMatricies = new TObjArray(nModules);
599 for (int i = 0; i < nModules; i++) {
600 Double_t theta = (i + .5) * dTheta;
601 TString name(Form("FMD_ring_%c_rot", fId));
602 TString title(Form("FMD Ring %c Rotation", fId));
603 TRotMatrix* rot =
604 new TRotMatrix(name.Data(), title.Data(),
605 90, theta, 90, fmod(90 + theta, 360), 0, 0);
606 fRotMatricies->AddAt(rot, i);
607 }
608 }
609
610 Double_t offsetZ = (fSiThickness
611 + fPrintboardThickness
612 + fLegLength + fModuleSpacing) / 2;
613
614 // Make all the nodes
615 for (int i = 0; i < nModules; i++) {
616 Bool_t isFront = (i % 2 == 1);
617 mother->cd();
618 TRotMatrix* rot = static_cast<TRotMatrix*>(fRotMatricies->At(i));
42403906 619 TString name(Form("FAC%c_%d_%d", fId, n, i));
4347b38f 620 TString title(Form("Active FMD%d volume in %c Ring", n, fId));
621 TNode* node = new TNode(name.Data(), title.Data(), fShape,
622 0, 0,
623 z - offsetZ + (isFront ? fModuleSpacing : 0),
624 rot);
625 node->SetLineColor(colour);
626 nodes->Add(node);
627 }
628}
629
630
631
632//____________________________________________________________________
633void
634AliFMDRing::Gsatt()
635{
636 // Set drawing attributes for the RING
637 //
638 // DebugGuard guard("AliFMDRing::Gsatt");
639 AliDebug(10, "AliFMDRing::Gsatt");
640 TString name;
c4bcfd14 641 name = Form(fgkRingFormat,fId);
4347b38f 642 gMC->Gsatt(name.Data(), "SEEN", 0);
643
c4bcfd14 644 name = Form(fgkVirtualFormat, 'T', fId);
4347b38f 645 gMC->Gsatt(name.Data(), "SEEN", 0);
646
c4bcfd14 647 name = Form(fgkVirtualFormat, 'B', fId);
4347b38f 648 gMC->Gsatt(name.Data(), "SEEN", 0);
649
c4bcfd14 650 name = Form(fgkActiveFormat,fId);
4347b38f 651 gMC->Gsatt(name.Data(), "SEEN", 1);
652
c4bcfd14 653 name = Form(fgkPrintboardFormat, 'T', fId);
4347b38f 654 gMC->Gsatt(name.Data(), "SEEN", 1);
655
c4bcfd14 656 name = Form(fgkPrintboardFormat, 'B',fId);
4347b38f 657 gMC->Gsatt(name.Data(), "SEEN", 1);
658}
659
660//
661// EOF
662//