]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv11GeometrySPD.cxx
Updated materials in geometry (M. Sitta)
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySPD.cxx
CommitLineData
db486a6e 1/**************************************************************************
59da35b6 2 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
db486a6e 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 **************************************************************************/
592651e2 15//
db486a6e 16// This class Defines the Geometry for the ITS services and support cones
d0048cec 17// outside of the central volume (except for the Central support
54c9a3d9 18// cylinders). Other classes define the rest of the ITS, specifically the
19// SSD support cone, the SSD Support central cylinder, the SDD support cone,
20// the SDD support central cylinder, the SPD Thermal Shield, The supports
db486a6e 21// and cable trays on both the RB26 (muon dump) and RB24 sides, and all of
592651e2 22// the cabling from the ladders/stave ends out past the TPC.
23//
54c9a3d9 24// Here is the calling sequence associated with this file
25// SPDSector(TGeoVolume *moth,TGeoManager *mgr)
26// -----CarbonFiberSector(TGeoVolume *moth,Double_t &xAAtubeCenter0,
27// Double_t &yAAtubeCenter0,TGeoManager *mgr)
28// -----2* SPDsectorShape(Int_t n,const Double_t *xc,const Double_t *yc,
29// | const Double_t *r,const Double_t *ths,
30// | const Double_t *the,Int_t npr,Int_t &m,
31// | Double_t **xp,Double_t **yp)
32// -----StavesInSector(TGeoVolume *moth,TGeoManager *mgr)
33// -----3* CreaeStave(Int_t layer,TArrayD &sizes,Bool_t addClips,
34// | TGeoManager *mgr)
35// | -----2* CreateHalfStave(Boot_t isRight,Int_t layer,
36// | Int_t idxCentral,Int_t idxSide,
37// | TArrayD &sizes,Bool_t addClips,
38// | TGeoManager *mgr)
39// | -----CreateGrondingFoil(Bool_t isRight,TArrayD &sizes,
40// | | TGeoManager *mgr)
41// | | -----4* CreateGroundingFoilSingle(Int_t type,
42// | | TArrayD &sizes,
43// | | TGeoManger *mgr)
44// | |----CreateLadder(Int_t layer, TArrayD &sizes,
45// | | TGeoManager *mgr)
46// | |----CreateMCM(Bool_t isRight,TArrayD &sizes,
47// | | TGeoManger *mgr)
48// | |----CreatePixelBus(Bool_t isRight,TArrayD &sizes,
49// | | TGeoManager *mgr)
50// | -----CreateClip(TArrayD &sizes,TGeoManager *mgr)
51// |----GetSectorMountingPoints(Int_t index,Double_t &x0,
52// | Double_t &y0,Double_t &x1,
53// | Double_t y1)
54// -----3* ParallelPosition(Double_t dist1,Double_t dist2,
55// Double_t phi,Double_t &x,Double_t &y)
56//
57// Obsoleate or presently unused routines are: setAddStave(Bool_t *mask),
58// CreatePixelBusAndExtensions(...) which calles CreateExtender(...).
db486a6e 59
543b7370 60/* $Id$ */
592651e2 61
4098f5dd 62
db486a6e 63// General Root includes
64#include <Riostream.h>
65#include <TMath.h>
66#include <TLatex.h>
67#include <TCanvas.h>
68#include <TPolyLine.h>
297369a1 69#include <TPolyMarker.h>
bc3498f4 70
db486a6e 71// Root Geometry includes
f7a1cc68 72#include <TGeoCompositeShape.h>
db486a6e 73#include <TGeoEltu.h>
f7a1cc68 74#include <TGeoGlobalMagField.h>
a53658c6 75#include <TGeoMaterial.h>
f7a1cc68 76#include <TGeoMatrix.h>
a53658c6 77#include <TGeoMedium.h>
f7a1cc68 78#include <TGeoTube.h> // contains TGeoTubeSeg
79#include <TGeoVolume.h>
80#include <TGeoXtru.h>
c890eba4 81#include <TGeoPcon.h>
bc3498f4 82
592651e2 83// AliRoot includes
bc3498f4 84#include "AliLog.h"
a53658c6 85#include "AliMagF.h"
86#include "AliRun.h"
bc3498f4 87
592651e2 88// Declaration file
db486a6e 89#include "AliITSv11GeometrySPD.h"
90
54c9a3d9 91// Constant definistions
d0048cec 92const Double_t AliITSv11GeometrySPD::fgkGapLadder =
54c9a3d9 93 AliITSv11Geometry::fgkmicron*75.; // 75 microns
d0048cec 94const Double_t AliITSv11GeometrySPD::fgkGapHalfStave =
54c9a3d9 95 AliITSv11Geometry::fgkmicron*120.; // 120 microns
7855ea93 96
db486a6e 97ClassImp(AliITSv11GeometrySPD)
54c9a3d9 98//______________________________________________________________________
99AliITSv11GeometrySPD::AliITSv11GeometrySPD(/*Double_t gap*/):
100AliITSv11Geometry(),// Default constructor of base class
101fAddStave(), // [DEBUG] must be TRUE for all staves which will be
102 // mounted in the sector (used to check overlaps)
103fSPDsectorX0(0), // X of first edge of sector plane for stave
104fSPDsectorY0(0), // Y of first edge of sector plane for stave
105fSPDsectorX1(0), // X of second edge of sector plane for stave
106fSPDsectorY1(0), // Y of second edge of sector plane for stave
d0048cec 107fTubeEndSector() // coordinate of cooling tube ends
54c9a3d9 108{
109 //
110 // Default constructor.
d0048cec 111 // This does not initialize anything and is provided just for
54c9a3d9 112 // completeness. It is recommended to use the other one.
113 // The alignment gap is specified as argument (default = 0.0075 cm).
114 // Inputs:
115 // none.
116 // Outputs:
117 // none.
118 // Return:
119 // A default constructed AliITSv11GeometrySPD class.
120 //
121 Int_t i = 0,j=0,k=0;
db486a6e 122
54c9a3d9 123 for (i = 0; i < 6; i++) fAddStave[i] = kTRUE;
124 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++){
125 this->fTubeEndSector[k][0][i][j] = 0.0;
126 this->fTubeEndSector[k][1][i][j] = 0.0;
127 } // end for i,j
128}
129//______________________________________________________________________
130AliITSv11GeometrySPD::AliITSv11GeometrySPD(Int_t debug/*, Double_t gap*/):
131AliITSv11Geometry(debug),// Default constructor of base class
132fAddStave(), // [DEBUG] must be TRUE for all staves which will be
133 // mounted in the sector (used to check overlaps)
134fSPDsectorX0(0), // X of first edge of sector plane for stave
135fSPDsectorY0(0), // Y of first edge of sector plane for stave
136fSPDsectorX1(0), // X of second edge of sector plane for stave
137fSPDsectorY1(0), // Y of second edge of sector plane for stave
d0048cec 138fTubeEndSector() // coordinate of cooling tube ends
54c9a3d9 139{
140 //
141 // Constructor with debug setting argument
142 // This is the constructor which is recommended to be used.
143 // It sets a debug level, and initializes the name of the object.
144 // The alignment gap is specified as argument (default = 0.0075 cm).
145 // Inputs:
146 // Int_t debug Debug level, 0= no debug output.
147 // Outputs:
148 // none.
149 // Return:
150 // A default constructed AliITSv11GeometrySPD class.
151 //
152 Int_t i = 0,j=0,k=0;
db486a6e 153
54c9a3d9 154 for (i = 0; i < 6; i++) fAddStave[i] = kTRUE;
155 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++){
156 this->fTubeEndSector[k][0][i][j] = 0.0;
157 this->fTubeEndSector[k][1][i][j] = 0.0;
158 } // end for i,j
159}
160//______________________________________________________________________
161AliITSv11GeometrySPD::AliITSv11GeometrySPD(const AliITSv11GeometrySPD &s):
162AliITSv11Geometry(s),// Base Class Copy constructor
163fAddStave(), // [DEBUG] must be TRUE for all staves which will be
164 // mounted in the sector (used to check overlaps)
165fSPDsectorX0(s.fSPDsectorX0), // X of first edge of sector plane for stave
166fSPDsectorY0(s.fSPDsectorY0), // Y of first edge of sector plane for stave
167fSPDsectorX1(s.fSPDsectorX1), // X of second edge of sector plane for stave
168fSPDsectorY1(s.fSPDsectorY1) // Y of second edge of sector plane for stave
bc3498f4 169{
54c9a3d9 170 //
171 // Copy Constructor
172 // Inputs:
173 // AliITSv11GeometrySPD &s source class
174 // Outputs:
175 // none.
176 // Return:
177 // A copy of a AliITSv11GeometrySPD class.
178 //
179 Int_t i=0,j=0,k=0;
180
181 for (i = 0; i < 6; i++) this->fAddStave[i] = s.fAddStave[i];
182 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++){
183 this->fTubeEndSector[k][0][i][j] = s.fTubeEndSector[k][0][i][j];
184 this->fTubeEndSector[k][1][i][j] = s.fTubeEndSector[k][1][i][j];
185 } // end for i,j
bc3498f4 186}
54c9a3d9 187//______________________________________________________________________
d0048cec 188AliITSv11GeometrySPD& AliITSv11GeometrySPD::operator=(const
54c9a3d9 189 AliITSv11GeometrySPD &s)
bc3498f4 190{
54c9a3d9 191 //
192 // = operator
193 // Inputs:
194 // AliITSv11GeometrySPD &s source class
195 // Outputs:
196 // none.
197 // Return:
198 // A copy of a AliITSv11GeometrySPD class.
199 //
200 Int_t i=0,j=0,k=0;
201
202 if(this==&s) return *this;
203 for (i = 0; i < 6; i++) this->fAddStave[i] = s.fAddStave[i];
204 this->fSPDsectorX0=s.fSPDsectorX0;
205 this->fSPDsectorY0=s.fSPDsectorY0;
206 this->fSPDsectorX1=s.fSPDsectorX1;
207 this->fSPDsectorY1=s.fSPDsectorY1;
208 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++){
209 this->fTubeEndSector[k][0][i][j] = s.fTubeEndSector[k][0][i][j];
210 this->fTubeEndSector[k][1][i][j] = s.fTubeEndSector[k][1][i][j];
211 } // end for i,j
212 return *this;
bc3498f4 213}
54c9a3d9 214//______________________________________________________________________
215TGeoMedium* AliITSv11GeometrySPD::GetMedium(const char* mediumName,
216 TGeoManager *mgr) const
bc3498f4 217{
54c9a3d9 218 //
d0048cec 219 // This function is used to recovery any medium
220 // used to build the geometry volumes.
221 // If the required medium does not exists,
54c9a3d9 222 // a NULL pointer is returned, and an error message is written.
223 //
224 Char_t itsMediumName[30];
225
226 sprintf(itsMediumName, "ITS_%s", mediumName);
227 TGeoMedium* medium = mgr->GetMedium(itsMediumName);
228 if (!medium) AliError(Form("Medium <%s> not found", mediumName));
229
230 return medium;
bc3498f4 231}
54c9a3d9 232
54c9a3d9 233//______________________________________________________________________
bc3498f4 234void AliITSv11GeometrySPD::SPDSector(TGeoVolume *moth, TGeoManager *mgr)
235{
54c9a3d9 236 //
d0048cec 237 // Creates a single SPD carbon fiber sector and places it
54c9a3d9 238 // in a container volume passed as first argument ('moth').
239 // Second argument points to the TGeoManager which coordinates
240 // the overall volume creation.
d0048cec 241 // The position of the sector is based on distance of
242 // closest point of SPD stave to beam pipe
54c9a3d9 243 // (figures all-sections-modules.ps) of 7.22mm at section A-A.
244 //
245
246 // Begin_Html
247 /*
248 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/assembly.ps"
249 title="SPD Sector drawing with all cross sections defined">
d0048cec 250 <p>The SPD Sector definition. In
54c9a3d9 251 <a href="http://alice.pd.infn.it/latestdr/Geometric-Revision/assembly.hpgl">HPGL</a> format.
252 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/assembly-10-modules.ps"
253 titile="SPD All Sectors end view with thermal sheald">
254 <p>The SPD all sector end view with thermal sheald.
255 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/assembly.ps"
256 title="SPD side view cross section">
257 <p>SPD side view cross section with condes and thermal shealds.
258 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/SECTION-A_A.jpg"
259 title="Cross section A-A"><p>Cross section A-A.
260 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/SECTION-B_B.jpg"
261 title="Cross updated section A-A"><p>Cross updated section A-A.
262 <img src="http://physics.mps.ohio-state.edu/~nilsen/ITSfigures/Sezione_layerAA.pdf"
263 title="Cross section B-B"><p>Cross section B-B.
264 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/SECTION-C_C.jpg"
265 title-"Cross section C-C"><p>Cross section C-C.
266 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/SECTION-D_D.jpg"
267 title="Cross section D-D"><p>Cross section D-D.
268 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/SECTION-E_E.jpg"
269 title="Cross section E-E"><p>Cross section E-E.
270 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/SECTION-F_F.jpg"
271 title="Cross section F-F"><p>Cross section F-F.
272 <img src="http://alice.pd.infn.it/latestdr/Geometric-Revision/SECTION-G_G.jpg"
273 title="Cross section G-G"><p>Cross section G-G.
274 */
275 // End_Html
276
277 // Inputs:
278 // TGeoVolume *moth Pointer to mother volume where this object
279 // is to be placed in
280 // TGeoManager *mgr Pointer to the TGeoManager used, defaule is
281 // gGeoManager.
282 // Outputs:
283 // none.
284 // Return:
285 // none.
286 // Updated values for kSPDclossesStaveAA, kBeamPipeRadius, and
d0048cec 287 // staveThicknessAA are taken from
54c9a3d9 288 // http://physics.mps.ohio-state.edu/~nilsen/ITSfigures/Sezione_layerAA.pdf
289 //
3ffa185f 290 const Double_t kSPDclossesStaveAA = 7.25* fgkmm;
54c9a3d9 291 const Double_t kSectorStartingAngle = -72.0 * fgkDegree;
3ffa185f 292 const Int_t kNSectorsTotal = 10;
293 const Double_t kSectorRelativeAngle = 36.0 * fgkDegree; // = 360.0 / 10
294 const Double_t kBeamPipeRadius = 0.5 * 59.6 * fgkmm; // diam. = 59.6 mm
295 //const Double_t staveThicknessAA = 0.9 *fgkmm; // nominal thickness
296 const Double_t staveThicknessAA = 1.02 * fgkmm; // get from stave geometry.
d0048cec 297
3ffa185f 298 Int_t i, j, k;
54c9a3d9 299 Double_t angle, radiusSector, xAAtubeCenter0, yAAtubeCenter0;
3ffa185f 300 TGeoCombiTrans *secRot = new TGeoCombiTrans(), *comrot;
30611568 301 TGeoVolume *vCarbonFiberSector[10];
54c9a3d9 302 TGeoMedium *medSPDcf;
303
d0048cec 304 // Define an assembly and fill it with the support of
54c9a3d9 305 // a single carbon fiber sector and staves in it
306 medSPDcf = GetMedium("SPD C (M55J)$", mgr);
30611568 307 for(Int_t is=0; is<10; is++)
308 {
309 vCarbonFiberSector[is] = new TGeoVolumeAssembly("ITSSPDCarbonFiberSectorV");
310 vCarbonFiberSector[is]->SetMedium(medSPDcf);
311 CarbonFiberSector(vCarbonFiberSector[is], is, xAAtubeCenter0, yAAtubeCenter0, mgr);
312 }
54c9a3d9 313
314 // Compute the radial shift out of the sectors
3ffa185f 315 radiusSector = kBeamPipeRadius + kSPDclossesStaveAA + staveThicknessAA;
316 radiusSector = GetSPDSectorTranslation(fSPDsectorX0.At(1), fSPDsectorY0.At(1),
317 fSPDsectorX1.At(1), fSPDsectorY1.At(1), radiusSector);
318 //radiusSector *= radiusSector; // squaring;
319 //radiusSector -= xAAtubeCenter0 * xAAtubeCenter0;
320 //radiusSector = -yAAtubeCenter0 + TMath::Sqrt(radiusSector);
d0048cec 321
3ffa185f 322 AliDebug(1, Form("SPDSector : radiusSector=%f\n",radiusSector));
323 i = 1;
324 AliDebug(1, Form("i= %d x0=%f y0=%f x1=%f y1=%f\n", i,
325 fSPDsectorX0.At(i), fSPDsectorY0.At(i),
326 fSPDsectorX1.At(i),fSPDsectorY1.At(i)));
d0048cec 327
54c9a3d9 328 // add 10 single sectors, by replicating the virtual sector defined above
329 // and placing at different angles
330 Double_t shiftX, shiftY, tub[2][6][3];
3ffa185f 331 for(i=0;i<2;i++)for(j=0;j<6;j++)for(k=0;k<3;k++) tub[i][j][k] = fTubeEndSector[0][i][j][k];
54c9a3d9 332 angle = kSectorStartingAngle;
333 secRot->RotateZ(angle);
334 TGeoVolumeAssembly *vcenteral = new TGeoVolumeAssembly("ITSSPD");
3ffa185f 335 moth->AddNode(vcenteral, 1, 0);
336 for(i = 0; i < kNSectorsTotal; i++) {
54c9a3d9 337 shiftX = -radiusSector * TMath::Sin(angle/fgkRadian);
338 shiftY = radiusSector * TMath::Cos(angle/fgkRadian);
d0048cec 339 //cout << "ANGLE = " << angle << endl;
3ffa185f 340 shiftX += 0.1094 * TMath::Cos((angle + 196.)/fgkRadian);
341 shiftY += 0.1094 * TMath::Sin((angle + 196.)/fgkRadian);
342 //shiftX -= 0.105;
343 //shiftY -= 0.031;
344 //shiftX -= 0.11 * TMath::Cos(angle/fgkRadian); // add by Alberto
345 //shiftY -= 0.11 * TMath::Sin(angle/fgkRadian); // don't ask me where that 0.11 comes from!
54c9a3d9 346 secRot->SetDx(shiftX);
347 secRot->SetDy(shiftY);
348 comrot = new TGeoCombiTrans(*secRot);
30611568 349 vcenteral->AddNode(vCarbonFiberSector[i],i+1,comrot);
54c9a3d9 350 for(j=0;j<2;j++)for(k=0;k<6;k++) // Transform Tube ends for each sector
351 comrot->LocalToMaster(tub[j][k],fTubeEndSector[i][j][k]);
352 if(GetDebug(5)) {
353 AliInfo(Form("i=%d angle=%g angle[rad]=%g radiusSector=%g "
354 "x=%g y=%g \n",i, angle, angle/fgkRadian,
355 radiusSector, shiftX, shiftY));
356 } // end if GetDebug(5)
357 angle += kSectorRelativeAngle;
358 secRot->RotateZ(kSectorRelativeAngle);
359 } // end for i
360 if(GetDebug(3)) moth->PrintNodes();
361 delete secRot;
d0048cec 362
7f69c251 363 CreateCones(moth);
a53658c6 364}
54c9a3d9 365//______________________________________________________________________
30611568 366void AliITSv11GeometrySPD::CarbonFiberSector(TGeoVolume *moth, Int_t sect,
54c9a3d9 367 Double_t &xAAtubeCenter0, Double_t &yAAtubeCenter0, TGeoManager *mgr)
bc3498f4 368{
30611568 369 // The method has been modified in order to build a support sector
370 // whose shape is dependent on the sector number; the aim is to get
371 // as close as possible to the shape inferred from alignment
372 // and avoid as much as possible overlaps generated by alignment.
54c9a3d9 373 //
374 // Define the detail SPD Carbon fiber support Sector geometry.
375 // Based on the drawings:
376 /*
377 http:///QA-construzione-profilo-modulo.ps
378 */
379 // - ALICE-Pixel "Costruzione Profilo Modulo" (march 25 2004)
380 // - ALICE-SUPPORTO "Costruzione Profilo Modulo"
381 // ---
382 // Define outside radii as negative, where "outside" means that the
383 // center of the arc is outside of the object (feb 16 2004).
384 // ---
385 // Arguments [the one passed by ref contain output values]:
386 // Inputs:
387 // TGeoVolume *moth the voulme which will contain this object
388 // TGeoManager *mgr TGeo builder defauls is gGeoManager
389 // Outputs:
390 // Double_t &xAAtubeCenter0 (by ref) x location of the outer surface
391 // of the cooling tube center for tube 0.
392 // Double_t &yAAtubeCenter0 (by ref) y location of the outer surface
393 // of the cooling tube center for tube 0.
394 // Return:
395 // none.
396 // ---
397 // Int the two variables passed by reference values will be stored
398 // which will then be used to correctly locate this sector.
399 // The information used for this is the distance between the
400 // center of the #0 detector and the beam pipe.
401 // Measurements are taken at cross section A-A.
402 //
d0048cec 403
54c9a3d9 404 //TGeoMedium *medSPDfs = 0;//SPD support cone inserto stesalite 4411w
405 //TGeoMedium *medSPDfo = 0;//SPD support cone foam, Rohacell 50A.
406 //TGeoMedium *medSPDal = 0;//SPD support cone SDD mounting bracket Al
407 TGeoMedium *medSPDcf = GetMedium("SPD C (M55J)$", mgr);
408 TGeoMedium *medSPDss = GetMedium("INOX$", mgr);
409 TGeoMedium *medSPDair = GetMedium("AIR$", mgr);
410 TGeoMedium *medSPDcoolfl = GetMedium("Freon$", mgr); //ITSspdCoolingFluid
411 //
412 const Double_t ksecDz = 0.5 * 500.0 * fgkmm;
413 //const Double_t ksecLen = 30.0 * fgkmm;
414 const Double_t ksecCthick = 0.2 * fgkmm;
415 const Double_t ksecDipLength = 3.2 * fgkmm;
416 const Double_t ksecDipRadii = 0.4 * fgkmm;
417 //const Double_t ksecCoolingTubeExtraDepth = 0.86 * fgkmm;
418 //
419 // The following positions ('ksecX#' and 'ksecY#') and radii ('ksecR#')
420 // are the centers and radii of curvature of all the rounded corners
421 // between the straight borders of the SPD sector shape.
422 // To draw this SPD sector, the following steps are followed:
423 // 1) the (ksecX, ksecY) points are plotted
424 // and circles of the specified radii are drawn around them.
425 // 2) each pair of consecutive circles is connected by a line
d0048cec 426 // tangent to them, in accordance with the radii being "internal"
427 // or "external" with respect to the closed shape which describes
54c9a3d9 428 // the sector itself.
d0048cec 429 // The resulting connected shape is the section
54c9a3d9 430 // of the SPD sector surface in the transverse plane (XY).
431 //
432 const Double_t ksecX0 = -10.725 * fgkmm;
433 const Double_t ksecY0 = -14.853 * fgkmm;
434 const Double_t ksecR0 = -0.8 * fgkmm; // external
3ffa185f 435
30611568 436 const Double_t ksecR1 = +0.6 * fgkmm;
437 const Double_t ksecR2 = +0.6 * fgkmm;
438 const Double_t ksecR3 = -0.6 * fgkmm;
439 const Double_t ksecR4 = +0.8 * fgkmm;
440 const Double_t ksecR5 = +0.8 * fgkmm;
441 const Double_t ksecR6 = +0.6 * fgkmm;
442 const Double_t ksecR7 = -0.6 * fgkmm;
443 const Double_t ksecR8 = +0.6 * fgkmm;
444 const Double_t ksecR9 = -0.6 * fgkmm;
445 const Double_t ksecR10 = +0.6 * fgkmm;
446 const Double_t ksecR11 = -0.6 * fgkmm;
447 const Double_t ksecR12 = +0.85 * fgkmm;
448
449// // IDEAL GEOMETRY
450// const Double_t ksecX1[10] ={-1.3187,-1.3187,-1.3187,-1.3187,-1.3187,-1.3187,-1.3187,-1.3187,-1.3187,-1.3187};
451// const Double_t ksecY1[10] ={-1.9964,-1.9964,-1.9964,-1.9964,-1.9964,-1.9964,-1.9964,-1.9964,-1.9964,-1.9964};
452// const Double_t ksecX2[10] ={-0.3833,-0.3833,-0.3833,-0.3833,-0.3833,-0.3833,-0.3833,-0.3833,-0.3833,-0.3833};
453// const Double_t ksecY2[10] ={-1.7805,-1.7805,-1.7805,-1.7805,-1.7805,-1.7805,-1.7805,-1.7805,-1.7805,-1.7805};
454// const Double_t ksecX3[10] ={-0.3123,-0.3123,-0.3123,-0.3123,-0.3123,-0.3123,-0.3123,-0.3123,-0.3123,-0.3123};
455// const Double_t ksecY3[10] ={-1.4618,-1.4618,-1.4618,-1.4618,-1.4618,-1.4618,-1.4618,-1.4618,-1.4618,-1.4618};
456// const Double_t ksecX4[10] ={+1.1280,+1.1280,+1.1280,+1.1280,+1.1280,+1.1280,+1.1280,+1.1280,+1.1280,+1.1280};
457// const Double_t ksecY4[10] ={-1.4473,-1.4473,-1.4473,-1.4473,-1.4473,-1.4473,-1.4473,-1.4473,-1.4473,-1.4473};
458// const Double_t ksecX5[10] ={+1.9544,+1.9544,+1.9544,+1.9544,+1.9544,+1.9544,+1.9544,+1.9544,+1.9544,+1.9544};
459// const Double_t ksecY5[10] ={+1.0961,+1.0961,+1.0961,+1.0961,+1.0961,+1.0961,+1.0961,+1.0961,+1.0961,+1.0961};
460// const Double_t ksecX6[10] ={+1.0830,+1.0830,+1.0830,+1.0830,+1.0830,+1.0830,+1.0830,+1.0830,+1.0830,+1.0830};
461// const Double_t ksecY6[10] ={+1.6868,+1.6868,+1.6868,+1.6868,+1.6868,+1.6868,+1.6868,+1.6868,+1.6868,+1.6868};
462// const Double_t ksecX7[10] ={+1.1581,+1.1581,+1.1581,+1.1581,+1.1581,+1.1581,+1.1581,+1.1581,+1.1581,+1.1581};
463// const Double_t ksecY7[10] ={+1.3317,+1.3317,+1.3317,+1.3317,+1.3317,+1.3317,+1.3317,+1.3317,+1.3317,+1.3317};
464// const Double_t ksecX8[10] ={-0.0733,-0.0733,-0.0733,-0.0733,-0.0733,-0.0733,-0.0733,-0.0733,-0.0733,-0.0733};
465// const Double_t ksecY8[10] ={+1.7486,+1.7486,+1.7486,+1.7486,+1.7486,+1.7486,+1.7486,+1.7486,+1.7486,+1.7486};
466// const Double_t ksecX9[10] ={+0.0562,+0.0562,+0.0562,+0.0562,+0.0562,+0.0562,+0.0562,+0.0562,+0.0562,+0.0562};
467// const Double_t ksecY9[10] ={+1.4107,+1.4107,+1.4107,+1.4107,+1.4107,+1.4107,+1.4107,+1.4107,+1.4107,+1.4107};
468// const Double_t ksecX10[10]={-1.2252,-1.2252,-1.2252,-1.2252,-1.2252,-1.2252,-1.2252,-1.2252,-1.2252,-1.2252};
469// const Double_t ksecY10[10]={+1.6298,+1.6298,+1.6298,+1.6298,+1.6298,+1.6298,+1.6298,+1.6298,+1.6298,+1.6298};
470// const Double_t ksecX11[10]={-1.0445,-1.0445,-1.0445,-1.0445,-1.0445,-1.0445,-1.0445,-1.0445,-1.0445,-1.0445};
471// const Double_t ksecY11[10]={+1.3162,+1.3162,+1.3162,+1.3162,+1.3162,+1.3162,+1.3162,+1.3162,+1.3162,+1.3162};
472// const Double_t ksecX12[10]={-2.2276,-2.2276,-2.2276,-2.2276,-2.2276,-2.2276,-2.2276,-2.2276,-2.2276,-2.2276};
473// const Double_t ksecY12[10]={+1.2948,+1.2948,+1.2948,+1.2948,+1.2948,+1.2948,+1.2948,+1.2948,+1.2948,+1.2948};
474
475
476// MODIFIED GEOMETRY according with partial alignment of Staves relative to Sectors
477// last numbers: 2010/06/11 (ML)
478
479 const Double_t ksecX1[10]={-1.305917, -1.322242, -1.300649, -1.298700, -1.290830, -1.274307, -1.276433, -1.286468, -1.274381, -1.314864};
480 const Double_t ksecY1[10]={-1.997857, -2.018611, -2.005854, -2.004897, -1.995517, -2.002552, -1.995860, -2.021062, -2.012931, -2.043967};
481 const Double_t ksecX2[10]={-0.366115, -0.385562, -0.372689, -0.365682, -0.348432, -0.348442, -0.342468, -0.354071, -0.346900, -0.381275};
482 const Double_t ksecY2[10]={-1.801679, -1.808306, -1.759315, -1.778851, -1.811655, -1.747888, -1.773811, -1.792427, -1.764514, -1.820324};
483// const Double_t ksecX1[10]={-1.305917, -1.322242, -1.300649, -1.298700, -1.290830, -1.274307, -1.276433, -1.286468, -1.274381, -1.325864};
484// const Double_t ksecY1[10]={-1.997857, -2.018611, -2.005854, -2.004897, -1.995517, -2.002552, -1.995860, -2.021062, -2.012931, -2.032967};
485// const Double_t ksecX2[10]={-0.366115, -0.385562, -0.372689, -0.365682, -0.348432, -0.348442, -0.342468, -0.354071, -0.346900, -0.392275};
486// const Double_t ksecY2[10]={-1.801679, -1.808306, -1.759315, -1.778851, -1.811655, -1.747888, -1.773811, -1.792427, -1.764514, -1.809324};
487 const Double_t ksecX3[10]={-0.314030, -0.315531, -0.347521, -0.337675, -0.300420, -0.378487, -0.330729, -0.330850, -0.362360, -0.321097};
488 const Double_t ksecY3[10]={-1.452488, -1.460418, -1.447060, -1.443146, -1.472410, -1.430019, -1.469073, -1.472048, -1.462010, -1.444355};
489 const Double_t ksecX4[10]={1.124299, 1.124162, 1.089523, 1.095520, 1.136171, 1.058616, 1.105626, 1.106433, 1.077455, 1.117946};
490 const Double_t ksecY4[10]={-1.458714, -1.452649, -1.465297, -1.492717, -1.494665, -1.447732, -1.493369, -1.488126, -1.452925, -1.443447};
491 const Double_t ksecX5[10]={1.951621, 1.939284, 1.931830, 1.935235, 1.952206, 1.939082, 1.924822, 1.940114, 1.918160, 1.960017};
492 const Double_t ksecY5[10]={1.092731, 1.118870, 1.129765, 1.129422, 1.081511, 1.127387, 1.103960, 1.101784, 1.121428, 1.150110};
493 const Double_t ksecX6[10]={1.070070, 1.048297, 1.035920, 1.049049, 1.083621, 1.045882, 1.050399, 1.067823, 1.037967, 1.070850};
494 const Double_t ksecY6[10]={1.667590, 1.678571, 1.681383, 1.696892, 1.676520, 1.683470, 1.689988, 1.691111, 1.698432, 1.712770};
495 const Double_t ksecX7[10]={1.139398, 1.150471, 1.150074, 1.132807, 1.150192, 1.124064, 1.124335, 1.137723, 1.143056, 1.130568};
496 const Double_t ksecY7[10]={1.345588, 1.356062, 1.342468, 1.320467, 1.335807, 1.334477, 1.328622, 1.347184, 1.319861, 1.308420};
497 const Double_t ksecX8[10]={-0.096963, -0.098603, -0.095286, -0.099990, -0.075132, -0.121593, -0.108673, -0.104237, -0.092082, -0.104044};
498 const Double_t ksecY8[10]={1.751207, 1.731467, 1.726908, 1.734219, 1.766159, 1.718203, 1.741891, 1.739743, 1.728288, 1.718046};
499 const Double_t ksecX9[10]={0.047615, 0.087875, 0.034917, 0.071603, 0.026468, 0.091619, 0.051994, 0.059947, 0.079785, 0.043443};
500 const Double_t ksecY9[10]={1.414699, 1.403187, 1.399061, 1.403430, 1.435056, 1.384557, 1.397692, 1.420269, 1.391372, 1.398954};
501 const Double_t ksecX10[10]={-1.233255, -1.186874, -1.246702, -1.213368, -1.259425, -1.190067, -1.225655, -1.224171, -1.197833, -1.237182};
502 const Double_t ksecY10[10]={1.635767, 1.646249, 1.617336, 1.608928, 1.636944, 1.602583, 1.630504, 1.629065, 1.624295, 1.620934};
503 const Double_t ksecX11[10]={-1.018270, -1.031317, -0.960524, -1.001155, -1.045437, -0.986867, -1.002685, -1.017369, -1.005614, -0.985385};
504 const Double_t ksecY11[10]={1.318108, 1.330683, 1.301572, 1.314410, 1.326680, 1.295226, 1.306372, 1.309414, 1.306542, 1.307086};
505 const Double_t ksecX12[10]={-2.199004, -2.214964, -2.139247, -2.180547, -2.224505, -2.165324, -2.175883, -2.193485, -2.183227, -2.161570};
506 const Double_t ksecY12[10]={1.317677, 1.303982, 1.317057, 1.324766, 1.339537, 1.312715, 1.359642, 1.343638, 1.330234, 1.340836};
507
508
54c9a3d9 509 const Double_t ksecR13 = -0.8 * fgkmm; // external
510 const Double_t ksecAngleSide13 = 36.0 * fgkDegree;
511 //
512 const Int_t ksecNRadii = 20;
513 const Int_t ksecNPointsPerRadii = 4;
514 const Int_t ksecNCoolingTubeDips = 6;
515 //
516 // Since the rounded parts are approximated by a regular polygon
517 // and a cooling tube of the propper diameter must fit, a scaling factor
518 // increases the size of the polygon for the tube to fit.
519 //const Double_t ksecRCoolScale = 1./TMath::Cos(TMath::Pi()/
520 // (Double_t)ksecNPointsPerRadii);
521 const Double_t ksecZEndLen = 30.000 * fgkmm;
522 //const Double_t ksecZFlangLen = 45.000 * fgkmm;
523 const Double_t ksecTl = 0.860 * fgkmm;
524 const Double_t ksecCthick2 = 0.600 * fgkmm;
525 //const Double_t ksecCthick3 = 1.80 * fgkmm;
526 //const Double_t ksecSidelen = 22.0 * fgkmm;
527 //const Double_t ksecSideD5 = 3.679 * fgkmm;
528 //const Double_t ksecSideD12 = 7.066 * fgkmm;
529 const Double_t ksecRCoolOut = 2.400 * fgkmm;
530 const Double_t ksecRCoolIn = 2.000 * fgkmm;
531 const Double_t ksecDl1 = 5.900 * fgkmm;
532 const Double_t ksecDl2 = 8.035 * fgkmm;
533 const Double_t ksecDl3 = 4.553 * fgkmm;
534 const Double_t ksecDl4 = 6.978 * fgkmm;
535 const Double_t ksecDl5 = 6.978 * fgkmm;
536 const Double_t ksecDl6 = 6.978 * fgkmm;
537 const Double_t ksecCoolTubeThick = 0.04 * fgkmm;
538 const Double_t ksecCoolTubeROuter = 2.6 * fgkmm;
539 const Double_t ksecCoolTubeFlatX = 3.696 * fgkmm;
540 const Double_t ksecCoolTubeFlatY = 0.68 * fgkmm;
541 //const Double_t ksecBeamX0 = 0.0 * fgkmm; // guess
542 //const Double_t ksecBeamY0 = (15.223 + 40.) * fgkmm; // guess
543 //
544 // redefine some of the points already defined above
545 // in the format of arrays (???)
546 const Int_t ksecNPoints = (ksecNPointsPerRadii + 1) * ksecNRadii + 8;
547 Double_t secX[ksecNRadii] = {
30611568 548 ksecX0, ksecX1[sect], -1000.0,
549 ksecX2[sect], ksecX3[sect], -1000.0,
550 ksecX4[sect], ksecX5[sect], -1000.0,
551 ksecX6[sect], ksecX7[sect], -1000.0,
552 ksecX8[sect], ksecX9[sect], -1000.0,
553 ksecX10[sect], ksecX11[sect], -1000.0,
554 ksecX12[sect], -1000.0
54c9a3d9 555 };
556 Double_t secY[ksecNRadii] = {
30611568 557 ksecY0, ksecY1[sect], -1000.0,
558 ksecY2[sect], ksecY3[sect], -1000.0,
559 ksecY4[sect], ksecY5[sect], -1000.0,
560 ksecY6[sect], ksecY7[sect], -1000.0,
561 ksecY8[sect], ksecY9[sect], -1000.0,
562 ksecY10[sect], ksecY11[sect], -1000.0,
563 ksecY12[sect], -1000.0
54c9a3d9 564 };
d0048cec 565 Double_t secR[ksecNRadii] = {
54c9a3d9 566 ksecR0, ksecR1, -.5 * ksecDipLength - ksecDipRadii,
567 ksecR2, ksecR3, -.5 * ksecDipLength - ksecDipRadii,
568 ksecR4, ksecR5, -.5 * ksecDipLength - ksecDipRadii,
569 ksecR6, ksecR7, -.5 * ksecDipLength - ksecDipRadii,
570 ksecR8, ksecR9, -.5 * ksecDipLength - ksecDipRadii,
571 ksecR10, ksecR11, -.5 * ksecDipLength - ksecDipRadii,
572 ksecR12, ksecR13
573 };
c890eba4 574
54c9a3d9 575 Double_t secX2[ksecNRadii];
576 Double_t secY2[ksecNRadii];
577 Double_t secR2[ksecNRadii] = {
578 ksecR0, ksecR1, ksecRCoolOut,
579 ksecR2, ksecR3, ksecRCoolOut,
580 ksecR4, ksecR5, ksecRCoolOut,
581 ksecR6, ksecR7, ksecRCoolOut,
582 ksecR8, ksecR9, ksecRCoolOut,
583 ksecR10, ksecR11, ksecRCoolOut,
584 ksecR12, ksecR13
585 };
d0048cec 586 Double_t secDip2[ksecNCoolingTubeDips] = {
587 ksecDl1, ksecDl2, ksecDl3,
588 ksecDl4, ksecDl5, ksecDl6
54c9a3d9 589 };
590 Double_t secX3[ksecNRadii];
591 Double_t secY3[ksecNRadii];
592 const Int_t ksecDipIndex[ksecNCoolingTubeDips] = {2, 5, 8, 11, 14, 17};
593 Double_t secAngleStart[ksecNRadii];
594 Double_t secAngleEnd[ksecNRadii];
595 Double_t secAngleStart2[ksecNRadii];
596 Double_t secAngleEnd2[ksecNRadii];
597 Double_t secAngleTurbo[ksecNCoolingTubeDips] = {0., 0., 0., 0., 0., 0.0};
598 //Double_t secAngleStart3[ksecNRadii];
599 //Double_t secAngleEnd3[ksecNRadii];
600 Double_t xpp[ksecNPoints], ypp[ksecNPoints];
601 Double_t xpp2[ksecNPoints], ypp2[ksecNPoints];
602 Double_t *xp[ksecNRadii], *xp2[ksecNRadii];
603 Double_t *yp[ksecNRadii], *yp2[ksecNRadii];
604 TGeoXtru *sA0, *sA1, *sB0, *sB1,*sB2;
605 TGeoBBox *sB3;
606 TGeoEltu *sTA0, *sTA1;
607 TGeoTube *sTB0, *sTB1; //,*sM0;
608 TGeoRotation *rot;
609 TGeoTranslation *trans;
610 TGeoCombiTrans *rotrans;
611 Double_t t, t0, t1, a, b, x0, y0,z0, x1, y1;
612 Int_t i, j, k, m;
613 Bool_t tst;
614
615 if(!moth) {
616 AliError("Container volume (argument) is NULL");
617 return;
618 } // end if(!moth)
619 for(i = 0; i < ksecNRadii; i++) {
620 xp[i] = &(xpp[i*(ksecNPointsPerRadii+1)]);
621 yp[i] = &(ypp[i*(ksecNPointsPerRadii+1)]);
622 xp2[i] = &(xpp2[i*(ksecNPointsPerRadii+1)]);
623 yp2[i] = &(ypp2[i*(ksecNPointsPerRadii+1)]);
624 secX2[i] = secX[i];
625 secY2[i] = secY[i];
626 secX3[i] = secX[i];
627 secY3[i] = secY[i];
628 } // end for i
629 //
630 // find starting and ending angles for all but cooling tube sections
631 secAngleStart[0] = 0.5 * ksecAngleSide13;
632 for(i = 0; i < ksecNRadii - 2; i++) {
633 tst = kFALSE;
634 for(j=0;j<ksecNCoolingTubeDips;j++) tst = (tst||i==ksecDipIndex[j]);
635 if (tst) continue;
636 tst = kFALSE;
637 for(j=0;j<ksecNCoolingTubeDips;j++) tst =(tst||(i+1)==ksecDipIndex[j]);
638 if (tst) j = i+2; else j = i+1;
639 AnglesForRoundedCorners(secX[i],secY[i],secR[i],secX[j],secY[j],
640 secR[j],t0,t1);
641 secAngleEnd[i] = t0;
642 secAngleStart[j] = t1;
643 if(secR[i] > 0.0 && secR[j] > 0.0) {
644 if(secAngleStart[i] > secAngleEnd[i]) secAngleEnd[i] += 360.0;
645 } // end if(secR[i]>0.0 && secR[j]>0.0)
646 secAngleStart2[i] = secAngleStart[i];
647 secAngleEnd2[i] = secAngleEnd[i];
648 } // end for i
649 secAngleEnd[ksecNRadii-2] = secAngleStart[ksecNRadii-2] +
650 (secAngleEnd[ksecNRadii-5] - secAngleStart[ksecNRadii-5]);
651 if (secAngleEnd[ksecNRadii-2] < 0.0) secAngleEnd[ksecNRadii-2] += 360.0;
652 secAngleStart[ksecNRadii-1] = secAngleEnd[ksecNRadii-2] - 180.0;
653 secAngleEnd[ksecNRadii-1] = secAngleStart[0];
654 secAngleStart2[ksecNRadii-2] = secAngleStart[ksecNRadii-2];
655 secAngleEnd2[ksecNRadii-2] = secAngleEnd[ksecNRadii-2];
656 secAngleStart2[ksecNRadii-1] = secAngleStart[ksecNRadii-1];
657 secAngleEnd2[ksecNRadii-1] = secAngleEnd[ksecNRadii-1];
658 //
659 // find location of circle last rounded corner.
660 i = 0;
661 j = ksecNRadii - 2;
662 t0 = TanD(secAngleStart[i]-90.);
663 t1 = TanD(secAngleEnd[j]-90.);
664 t = secY[i] - secY[j];
665 // NOTE: secR[i=0] < 0; secR[j=18] > 0; and secR[j+1=19] < 0
666 t += (-secR[i]+secR[j+1]) * SinD(secAngleStart[i]);
667 t -= (secR[j]-secR[j+1]) * SinD(secAngleEnd[j]);
668 t += t1 * secX[j] - t0*secX[i];
669 t += t1 * (secR[j] - secR[j+1]) * CosD(secAngleEnd[j]);
670 t -= t0 * (-secR[i]+secR[j+1]) * CosD(secAngleStart[i]);
671 secX[ksecNRadii-1] = t / (t1-t0);
672 secY[ksecNRadii-1] = TanD(90.0+0.5*ksecAngleSide13)*
673 (secX[ksecNRadii-1]-secX[0])+secY[0];
674 secX2[ksecNRadii-1] = secX[ksecNRadii-1];
675 secY2[ksecNRadii-1] = secY[ksecNRadii-1];
676 secX3[ksecNRadii-1] = secX[ksecNRadii-1];
677 secY3[ksecNRadii-1] = secY[ksecNRadii-1];
d0048cec 678
54c9a3d9 679 // find location of cooling tube centers
680 for(i = 0; i < ksecNCoolingTubeDips; i++) {
681 j = ksecDipIndex[i];
682 x0 = secX[j-1] + TMath::Abs(secR[j-1]) * CosD(secAngleEnd[j-1]);
683 y0 = secY[j-1] + TMath::Abs(secR[j-1]) * SinD(secAngleEnd[j-1]);
684 x1 = secX[j+1] + TMath::Abs(secR[j+1]) * CosD(secAngleStart[j+1]);
685 y1 = secY[j+1] + TMath::Abs(secR[j+1]) * SinD(secAngleStart[j+1]);
686 t0 = TMath::Sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
687 t = secDip2[i] / t0;
688 a = x0+(x1-x0) * t;
689 b = y0+(y1-y0) * t;
d0048cec 690 if(i == 0) {
54c9a3d9 691 // get location of tube center->Surface for locating
692 // this sector around the beam pipe.
693 // This needs to be double checked, but I need my notes for that.
694 // (Bjorn Nilsen)
695 xAAtubeCenter0 = x0 + (x1 - x0) * t * 0.5;
696 yAAtubeCenter0 = y0 + (y1 - y0) * t * 0.5;
697 }// end if i==0
698 if(a + b*(a - x0) / (b - y0) > 0.0) {
699 secX[j] = a + TMath::Abs(y1-y0) * 2.0 * ksecDipRadii/t0;
700 secY[j] = b - TMath::Sign(2.0*ksecDipRadii,y1-y0) * (x1-x0)/t0;
701 secX2[j] = a + TMath::Abs(y1-y0) * ksecTl/t0;
702 secY2[j] = b - TMath::Sign(ksecTl,y1-y0) * (x1-x0) / t0;
d0048cec 703 secX3[j] = a + TMath::Abs(y1-y0) *
54c9a3d9 704 (2.0*ksecDipRadii-0.5*ksecCoolTubeFlatY)/t0;
705 secY3[j] = b - TMath::Sign(2.0*ksecDipRadii-0.5*ksecCoolTubeFlatY,
706 y1-y0)*(x1-x0)/t0;
707 } else {
708 secX[j] = a - TMath::Abs(y1-y0)*2.0*ksecDipRadii/t0;
709 secY[j] = b + TMath::Sign(2.0*ksecDipRadii,y1-y0)*(x1-x0)/t0;
710 secX2[j] = a - TMath::Abs(y1-y0)*ksecTl/t0;
711 secY2[j] = b + TMath::Sign(ksecTl,y1-y0)*(x1-x0)/t0;
712 secX3[j] = a - TMath::Abs(y1-y0)*(2.0*ksecDipRadii-0.5*
713 ksecCoolTubeFlatY)/t0;
714 secY3[j] = b + TMath::Sign(2.0*ksecDipRadii-0.5*ksecCoolTubeFlatY,
715 y1-y0)*(x1-x0)/t0;
716 } // end if(a+b*(a-x0)/(b-y0)>0.0)
d0048cec 717
54c9a3d9 718 // Set up Start and End angles to correspond to start/end of dips.
719 t1 = (secDip2[i]-TMath::Abs(secR[j])) / t0;
720 secAngleStart[j] =TMath::RadToDeg()*TMath::ATan2(y0+(y1-y0)*t1-secY[j],
721 x0+(x1-x0)*t1-secX[j]);
722 if (secAngleStart[j]<0.0) secAngleStart[j] += 360.0;
723 secAngleStart2[j] = secAngleStart[j];
724 t1 = (secDip2[i]+TMath::Abs(secR[j]))/t0;
725 secAngleEnd[j] = TMath::RadToDeg()*TMath::ATan2(y0+(y1-y0)*t1-secY[j],
726 x0+(x1-x0)*t1-secX[j]);
727 if (secAngleEnd[j]<0.0) secAngleEnd[j] += 360.0;
728 secAngleEnd2[j] = secAngleEnd[j];
729 if (secAngleEnd[j]>secAngleStart[j]) secAngleEnd[j] -= 360.0;
730 secR[j] = TMath::Sqrt(secR[j]*secR[j]+4.0*ksecDipRadii*ksecDipRadii);
731 } // end for i
d0048cec 732
54c9a3d9 733 // Special cases
734 secAngleStart2[8] -= 360.;
735 secAngleStart2[11] -= 360.;
736
737 SPDsectorShape(ksecNRadii, secX, secY, secR, secAngleStart, secAngleEnd,
738 ksecNPointsPerRadii, m, xp, yp);
739
740 // Fix up dips to be square.
741 for(i = 0; i < ksecNCoolingTubeDips; i++) {
742 j = ksecDipIndex[i];
743 t = 0.5*ksecDipLength+ksecDipRadii;
744 t0 = TMath::RadToDeg()*TMath::ATan(2.0*ksecDipRadii/t);
745 t1 = secAngleEnd[j] + t0;
746 t0 = secAngleStart[j] - t0;
747 x0 = xp[j][1] = secX[j] + t*CosD(t0);
748 y0 = yp[j][1] = secY[j] + t*SinD(t0);
749 x1 = xp[j][ksecNPointsPerRadii-1] = secX[j] + t*CosD(t1);
750 y1 = yp[j][ksecNPointsPerRadii-1] = secY[j] + t*SinD(t1);
751 t0 = 1./((Double_t)(ksecNPointsPerRadii-2));
752 for(k = 2; k < ksecNPointsPerRadii - 1; k++) {
753 // extra points spread them out.
754 t = ((Double_t)(k-1)) * t0;
755 xp[j][k] = x0+(x1-x0) * t;
756 yp[j][k] = y0+(y1-y0) * t;
757 } // end for k
758 secAngleTurbo[i] = -TMath::RadToDeg() * TMath::ATan2(y1-y0, x1-x0);
d0048cec 759 if(GetDebug(3)) {
54c9a3d9 760 AliInfo(
761 Form("i=%d -- angle=%f -- x0,y0=(%f, %f) -- x1,y1=(%f, %f)",
762 i, secAngleTurbo[i], x0, y0, x1, y1));
763 } // end if GetDebug(3)
764 } // end for i
765 sA0 = new TGeoXtru(2);
766 sA0->SetName("ITS SPD Carbon fiber support Sector A0");
767 sA0->DefinePolygon(m, xpp, ypp);
768 sA0->DefineSection(0, -ksecDz);
769 sA0->DefineSection(1, ksecDz);
d0048cec 770
54c9a3d9 771 // store the edges of each XY segment which defines
772 // one of the plane zones where staves will have to be placed
773 fSPDsectorX0.Set(ksecNCoolingTubeDips);
774 fSPDsectorY0.Set(ksecNCoolingTubeDips);
775 fSPDsectorX1.Set(ksecNCoolingTubeDips);
776 fSPDsectorY1.Set(ksecNCoolingTubeDips);
777 Int_t ixy0, ixy1;
778 for(i = 0; i < ksecNCoolingTubeDips; i++) {
779 // Find index in xpp[] and ypp[] corresponding to where the
780 // SPD ladders are to be attached. Order them according to
781 // the ALICE numbering schema. Using array of indexes (+-1 for
d0048cec 782 // cooling tubes. For any "bend/dip/edge, there are
54c9a3d9 783 // ksecNPointsPerRadii+1 points involved.
784 if(i == 0) j = 1;
785 else if (i == 1) j = 0;
786 else j = i;
787 ixy0 = (ksecDipIndex[j]-1)*(ksecNPointsPerRadii+1)+
788 (ksecNPointsPerRadii);
789 ixy1 = (ksecDipIndex[j]+1) * (ksecNPointsPerRadii+1);
790 fSPDsectorX0[i] = sA0->GetX(ixy0);
791 fSPDsectorY0[i] = sA0->GetY(ixy0);
792 fSPDsectorX1[i] = sA0->GetX(ixy1);
793 fSPDsectorY1[i] = sA0->GetY(ixy1);
794 } // end for i
d0048cec 795
54c9a3d9 796 //printf("SectorA#%d ",0);
797 InsidePoint(xpp[m-1],ypp[m-1],xpp[0],ypp[0],xpp[1],ypp[1],ksecCthick,
798 xpp2[0],ypp2[0]);
799 for(i = 1; i < m - 1; i++) {
800 j = i / (ksecNPointsPerRadii+1);
801 //printf("SectorA#%d ",i);
802 InsidePoint(xpp[i-1],ypp[i-1],xpp[i],ypp[i],xpp[i+1],ypp[i+1],
803 ksecCthick,xpp2[i],ypp2[i]);
804 } // end for i
805 //printf("SectorA#%d ",m);
806 InsidePoint(xpp[m-2],ypp[m-2],xpp[m-1],ypp[m-1],xpp[0],ypp[0],
807 ksecCthick,xpp2[m-1],ypp2[m-1]);
808 // Fix center value of cooling tube dip and
809 // find location of cooling tube centers
810 for(i = 0; i < ksecNCoolingTubeDips; i++) {
811 j = ksecDipIndex[i];
812 x0 = xp2[j][1];
813 y0 = yp2[j][1];
814 x1 = xp2[j][ksecNPointsPerRadii-1];
815 y1 = yp2[j][ksecNPointsPerRadii-1];
816 t0 = TMath::Sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
817 t = secDip2[i]/t0;
818 for(k = 2; k < ksecNPointsPerRadii - 1; k++) {
819 // extra points spread them out.
820 t = ((Double_t)(k-1)) * t0;
821 xp2[j][k] = x0+(x1-x0) * t;
822 yp2[j][k] = y0+(y1-y0) * t;
823 } // end for k
824 } // end for i
825 sA1 = new TGeoXtru(2);
826 sA1->SetName("ITS SPD Carbon fiber support Sector Air A1");
827 sA1->DefinePolygon(m, xpp2, ypp2);
828 sA1->DefineSection(0, -ksecDz);
829 sA1->DefineSection(1, ksecDz);
830 //
831 // Error in TGeoEltu. Semi-axis X must be < Semi-axis Y (?).
832 sTA0 = new TGeoEltu("ITS SPD Cooling Tube TA0", 0.5 * ksecCoolTubeFlatY,
833 0.5 * ksecCoolTubeFlatX, ksecDz);
d0048cec 834 sTA1 = new TGeoEltu("ITS SPD Cooling Tube coolant TA1",
54c9a3d9 835 sTA0->GetA() - ksecCoolTubeThick,
836 sTA0->GetB()-ksecCoolTubeThick,ksecDz);
837 SPDsectorShape(ksecNRadii,secX2,secY2,secR2,secAngleStart2,secAngleEnd2,
838 ksecNPointsPerRadii, m, xp, yp);
839 sB0 = new TGeoXtru(2);
840 sB0->SetName("ITS SPD Carbon fiber support Sector End B0");
841 sB0->DefinePolygon(m, xpp, ypp);
842 sB0->DefineSection(0, ksecDz);
843 sB0->DefineSection(1, ksecDz + ksecZEndLen);
844
845 //printf("SectorB#%d ",0);
53506676 846 // Points around the most sharpened tips have to be avoided - M.S. 24 feb 09
847 const Int_t nSpecialPoints = 5;
848 const Int_t kSpecialPoints[nSpecialPoints] = {7, 17, 47, 62, 77};
849 Int_t i2 = 0;
54c9a3d9 850 InsidePoint(xpp[m-1],ypp[m-1],xpp[0],ypp[0],xpp[1],ypp[1],
53506676 851 ksecCthick2,xpp2[i2],ypp2[i2]);
54c9a3d9 852 for(i = 1; i < m - 1; i++) {
853 t = ksecCthick2;
854 for(k = 0; k < ksecNCoolingTubeDips; k++)
855 if((i/(ksecNPointsPerRadii+1))==ksecDipIndex[k])
856 if(!(ksecDipIndex[k]*(ksecNPointsPerRadii+1) == i ||
857 ksecDipIndex[k]*(ksecNPointsPerRadii+1) +
858 ksecNPointsPerRadii == i))
859 t = ksecRCoolOut-ksecRCoolIn;
860 //printf("SectorB#%d ",i);
53506676 861 Bool_t useThisPoint = kTRUE;
862 for(Int_t ii = 0; ii < nSpecialPoints; ii++)
863 if ( (i == kSpecialPoints[ii] - 1) ||
864 (i == kSpecialPoints[ii] + 1) ) useThisPoint = kFALSE;
865 if (useThisPoint) {
866 i2++;
867 InsidePoint(xpp[i-1],ypp[i-1],xpp[i],ypp[i],xpp[i+1],ypp[i+1],t,
868 xpp2[i2],ypp2[i2]);
869 }
54c9a3d9 870 }// end for i
871 //printf("SectorB#%d ",m);
53506676 872 i2++;
54c9a3d9 873 InsidePoint(xpp[m-2],ypp[m-2],xpp[m-1],ypp[m-1],xpp[0],ypp[0],
53506676 874 ksecCthick2,xpp2[i2],ypp2[i2]);
54c9a3d9 875 sB1 = new TGeoXtru(2);
876 sB1->SetName("ITS SPD Carbon fiber support Sector Air End B1");
53506676 877 sB1->DefinePolygon(i2+1, xpp2, ypp2);
54c9a3d9 878 sB1->DefineSection(0,sB0->GetZ(0));
879 sB1->DefineSection(1,sB0->GetZ(1)-ksecCthick2);
880 const Double_t kspdEndHoleRadius1=5.698*fgkmm;
881 const Double_t kspdEndHoleRadius2=2.336*fgkmm;
882 const Double_t kspdEndHoleDisplacement=6.29*fgkmm;
883 k = (m-1)/4;
884 for(i=0;i<=k;i++){
885 t= ((Double_t)i)/((Double_t)(k));
886 if(!CFHolePoints(t,kspdEndHoleRadius1,kspdEndHoleRadius2,
887 kspdEndHoleDisplacement,xpp2[i],ypp2[i])){
888 Warning("CarbonFiberSector","CFHolePoints failed "
889 "i=%d m=%d k=%d t=%e",i,m,k,t);
890 } // end if
891 // simitry in each quadrant.
892 xpp2[2*k-i] = -xpp2[i];
893 ypp2[2*k-i] = ypp2[i];
894 xpp2[2*k+i] = -xpp2[i];
895 ypp2[2*k+i] = -ypp2[i];
896 xpp2[4*k-i] = xpp2[i];
897 ypp2[4*k-i] = -ypp2[i];
898 }// end for i
899 //xpp2[m-1] = xpp2[0]; // begining point in
900 //ypp2[m-1] = ypp2[0]; // comment with end point
901 sB2 = new TGeoXtru(2);
902 sB2->SetName("ITS SPD Hole in Carbon fiber support End plate");
903 sB2->DefinePolygon(4*k, xpp2, ypp2);
904 sB2->DefineSection(0,sB1->GetZ(1));
905 sB2->DefineSection(1,sB0->GetZ(1));
906 // SPD sector mount blocks
907 const Double_t kMountBlock[3] = {0.5*(1.8-0.2)*fgkmm,0.5*22.0*fgkmm,
908 0.5*45.0*fgkmm};
909 sB3 = new TGeoBBox((Double_t*)kMountBlock);
910 // SPD sector cooling tubes
911 sTB0 = new TGeoTube("ITS SPD Cooling Tube End TB0", 0.0,
7708d5f3 912 0.5*ksecCoolTubeROuter,0.5*(sB1->GetZ(1)-sB1->GetZ(0)));
54c9a3d9 913 sTB1 = new TGeoTube("ITS SPD Cooling Tube End coolant TB0", 0.0,
914 sTB0->GetRmax() - ksecCoolTubeThick,sTB0->GetDz());
915 //
916 if(GetDebug(3)) {
917 if(medSPDcf) medSPDcf->Dump(); else AliInfo("medSPDcf = 0");
918 if(medSPDss) medSPDss->Dump(); else AliInfo("medSPDss = 0");
919 if(medSPDair) medSPDair->Dump(); else AliInfo("medSPDAir = 0");
920 if(medSPDcoolfl) medSPDcoolfl->Dump();else AliInfo("medSPDcoolfl = 0");
921 sA0->InspectShape();
922 sA1->InspectShape();
923 sB0->InspectShape();
924 sB1->InspectShape();
925 sB2->InspectShape();
926 } // end if(GetDebug(3))
d0048cec 927
54c9a3d9 928 // create the assembly of the support and place staves on it
929 TGeoVolumeAssembly *vM0 = new TGeoVolumeAssembly(
930 "ITSSPDSensitiveVirtualvolumeM0");
931 StavesInSector(vM0);
932 // create other volumes with some graphical settings
933 TGeoVolume *vA0 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorA0",
934 sA0, medSPDcf);
935 vA0->SetVisibility(kTRUE);
936 vA0->SetLineColor(4); // Blue
937 vA0->SetLineWidth(1);
938 vA0->SetFillColor(vA0->GetLineColor());
939 vA0->SetFillStyle(4010); // 10% transparent
940 TGeoVolume *vA1 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorAirA1",
941 sA1, medSPDair);
942 vA1->SetVisibility(kTRUE);
943 vA1->SetLineColor(7); // light Blue
944 vA1->SetLineWidth(1);
945 vA1->SetFillColor(vA1->GetLineColor());
946 vA1->SetFillStyle(4090); // 90% transparent
947 TGeoVolume *vTA0 = new TGeoVolume("ITSSPDCoolingTubeTA0", sTA0, medSPDss);
948 vTA0->SetVisibility(kTRUE);
949 vTA0->SetLineColor(15); // gray
950 vTA0->SetLineWidth(1);
951 vTA0->SetFillColor(vTA0->GetLineColor());
952 vTA0->SetFillStyle(4000); // 0% transparent
953 TGeoVolume *vTA1 = new TGeoVolume("ITSSPDCoolingTubeFluidTA1",
954 sTA1, medSPDcoolfl);
955 vTA1->SetVisibility(kTRUE);
956 vTA1->SetLineColor(6); // Purple
957 vTA1->SetLineWidth(1);
958 vTA1->SetFillColor(vTA1->GetLineColor());
959 vTA1->SetFillStyle(4000); // 0% transparent
960 TGeoVolume *vB0 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorEndB0",
961 sB0, medSPDcf);
962 vB0->SetVisibility(kTRUE);
963 vB0->SetLineColor(1); // Black
964 vB0->SetLineWidth(1);
965 vB0->SetFillColor(vB0->GetLineColor());
966 vB0->SetFillStyle(4000); // 0% transparent
967 TGeoVolume *vB1 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorEndAirB1",
968 sB1, medSPDair);
969 vB1->SetVisibility(kTRUE);
970 vB1->SetLineColor(0); // white
971 vB1->SetLineWidth(1);
972 vB1->SetFillColor(vB1->GetLineColor());
973 vB1->SetFillStyle(4100); // 100% transparent
974 TGeoVolume *vB2 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorEndAirB2",
975 sB2, medSPDair);
976 vB2->SetVisibility(kTRUE);
977 vB2->SetLineColor(0); // white
978 vB2->SetLineWidth(1);
979 vB2->SetFillColor(vB2->GetLineColor());
980 vB2->SetFillStyle(4100); // 100% transparent
981 TGeoVolume *vB3 = new TGeoVolume(
982 "ITSSPDCarbonFiberSupportSectorMountBlockB3",sB3, medSPDcf);
983 vB3->SetVisibility(kTRUE);
984 vB3->SetLineColor(1); // Black
985 vB3->SetLineWidth(1);
986 vB3->SetFillColor(vB3->GetLineColor());
987 vB3->SetFillStyle(4000); // 0% transparent
988 TGeoVolume *vTB0 = new TGeoVolume("ITSSPDCoolingTubeEndTB0",sTB0,medSPDss);
989 vTB0->SetVisibility(kTRUE);
990 vTB0->SetLineColor(15); // gray
991 vTB0->SetLineWidth(1);
992 vTB0->SetFillColor(vTB0->GetLineColor());
993 vTB0->SetFillStyle(4000); // 0% transparent
994 TGeoVolume *vTB1 = new TGeoVolume("ITSSPDCoolingTubeEndFluidTB1",sTB1,
995 medSPDcoolfl);
996 vTB1->SetVisibility(kTRUE);
997 vTB1->SetLineColor(7); // light blue
998 vTB1->SetLineWidth(1);
999 vTB1->SetFillColor(vTB1->GetLineColor());
1000 vTB1->SetFillStyle(4050); // 0% transparent
d0048cec 1001
54c9a3d9 1002 // add volumes to mother container passed as argument of this method
1003 moth->AddNode(vM0,1,0); // Add virtual volume to mother
1004 vA0->AddNode(vA1,1,0); // Put air inside carbon fiber.
1005 vB0->AddNode(vB1,1,0); // Put air inside carbon fiber ends.
1006 vB0->AddNode(vB2,1,0); // Put air wholes inside carbon fiber ends
1007 vTA0->AddNode(vTA1,1,0); // Put cooling liquid indide tube middel.
1008 vTB0->AddNode(vTB1,1,0); // Put cooling liquid inside tube end.
1009 Double_t tubeEndLocal[3]={0.0,0.0,sTA0->GetDz()};
1010 for(i = 0; i < ksecNCoolingTubeDips; i++) {
1011 x0 = secX3[ksecDipIndex[i]];
1012 y0 = secY3[ksecDipIndex[i]];
1013 t = 90.0 - secAngleTurbo[i];
1014 trans = new TGeoTranslation("",x0,y0,0.5*(sB1->GetZ(0)+sB1->GetZ(1)));
1015 vB1->AddNode(vTB0, i+1, trans);
1016 // Find location of tube ends for later use.
1017 trans->LocalToMaster(tubeEndLocal,fTubeEndSector[0][0][i]);
1018 rot = new TGeoRotation("", 0.0, 0.0, t);
1019 rotrans = new TGeoCombiTrans("", x0, y0, 0.0, rot);
1020 vM0->AddNode(vTA0, i+1, rotrans);
1021 } // end for i
1022 vM0->AddNode(vA0, 1, 0);
1023 vM0->AddNode(vB0, 1, 0);
1024 // Reflection.
1025 rot = new TGeoRotation("", 90., 0., 90., 90., 180., 0.);
1026 vM0->AddNode(vB0,2,rot);
1027 // Find location of tube ends for later use.
1028 for(i=0;i<ksecNCoolingTubeDips;i++) rot->LocalToMaster(
1029 fTubeEndSector[0][0][i],fTubeEndSector[0][1][i]);
1030 // left side
1031 t = -TMath::RadToDeg()*TMath::ATan2(
1032 sB0->GetX(0)-sB0->GetX(sB0->GetNvert()-1),
1033 sB0->GetY(0)-sB0->GetY(sB0->GetNvert()-1));
1034 rot = new TGeoRotation("",t,0.0,0.0);// z axis rotation
1035 x0 = 0.5*(sB0->GetX(0)+sB0->GetX(sB0->GetNvert()-1))+
1036 sB3->GetDX()*TMath::Cos(t*TMath::DegToRad());
1037 y0 = 0.5*(sB0->GetY(0)+sB0->GetY(sB0->GetNvert()-1))+
1038 sB3->GetDX()*TMath::Sin(t*TMath::DegToRad());
1039 z0 = sB0->GetZ(0)+sB3->GetDZ();
1040 rotrans = new TGeoCombiTrans("",x0,y0,z0,rot);
1041 vM0->AddNode(vB3,1,rotrans); // Put Mounting bracket on sector
1042 rotrans = new TGeoCombiTrans("",x0,y0,-z0,rot);
1043 vM0->AddNode(vB3,2,rotrans); // Put Mounting bracket on sector
54c9a3d9 1044 t *= -1.0;
1045 rot = new TGeoRotation("",t,0.0,0.0); // z axis rotation
c890eba4 1046
54c9a3d9 1047 x0 = -0.5*(sB0->GetX(0)+sB0->GetX(sB0->GetNvert()-1))-3.5*
1048 sB3->GetDX()*TMath::Cos(t*TMath::DegToRad());
1049 y0 = 0.5*(sB0->GetY(0)+sB0->GetY(sB0->GetNvert()-1))-3.5*
1050 sB3->GetDX()*TMath::Sin(t*TMath::DegToRad());
22726349 1051 rotrans = new TGeoCombiTrans("",1.01*x0,y0,z0,rot);
54c9a3d9 1052 vM0->AddNode(vB3,3,rotrans); // Put Mounting bracket on sector
22726349 1053 rotrans = new TGeoCombiTrans("",1.01*x0,y0,-z0,rot);
54c9a3d9 1054 vM0->AddNode(vB3,4,rotrans); // Put Mounting bracket on sector
1055 if(GetDebug(3)){
1056 vM0->PrintNodes();
1057 vA0->PrintNodes();
1058 vA1->PrintNodes();
1059 vB0->PrintNodes();
1060 vB1->PrintNodes();
1061 vB2->PrintNodes();
1062 vB3->PrintNodes();
1063 vTA0->PrintNodes();
1064 vTA1->PrintNodes();
1065 vTB0->PrintNodes();
1066 vTB1->PrintNodes();
1067 } // end if(GetDebug(3))
bc3498f4 1068}
54c9a3d9 1069//______________________________________________________________________
1070Bool_t AliITSv11GeometrySPD::CFHolePoints(Double_t s,Double_t r1,
1071 Double_t r2,Double_t l,Double_t &x,Double_t &y) const
bc3498f4 1072{
54c9a3d9 1073 //
1074 // Step along arck a distancs ds and compute boundry of
1075 // two holes (radius r1 and r2) a distance l apart (along
1076 // x-axis).
1077 // Inputs:
1078 // Double_t s fractional Distance along arcs [0-1]
1079 // where 0-> alpha=beta=0, 1-> alpha=90 degrees.
1080 // Double_t r1 radius at center circle
1081 // Double_t r2 radius of displaced circle
1082 // Double_t l Distance displaced circle is displaces (x-axis)
1083 // Output:
1084 // Double_t x x coordinate along double circle.
1085 // Double_t y y coordinate along double circle.
1086 // Return:
1087 // logical, kFALSE if an error
1088 //
1089 Double_t alpha,beta;
1090 Double_t ac,bc,scb,sca,t,alphac,betac; // at intersection of two circles
1091
1092 x=y=0.0;
1093 ac = r1*r1-l*l-r2*r2;
1094 bc = 2.*l*r2;
1095 if(bc==0.0) {printf("bc=0 l=%e r2=%e\n",l,r2);return kFALSE;}
1096 betac = TMath::ACos(ac/bc);
60e55aee 1097 alphac = TMath::Sqrt((bc-ac)*(bc+ac))/(2.*l*r1);
54c9a3d9 1098 scb = r2*betac;
1099 sca = r1*alphac;
1100 t = r1*0.5*TMath::Pi() - sca + scb;
1101 if(s<= scb/t){
1102 beta = s*t/r2;
1103 x = r2*TMath::Cos(beta) + l;
1104 y = r2*TMath::Sin(beta);
1105 //printf("betac=%e scb=%e t=%e s=%e beta=%e x=%e y=%e\n",
1106 // betac,scb,t,s,beta,x,y);
1107 return kTRUE;
1108 }else{
1109 beta = (s*t-scb+sca)/(r1*0.5*TMath::Pi());
1110 alpha = beta*0.5*TMath::Pi();
1111 x = r1*TMath::Cos(alpha);
1112 y = r1*TMath::Sin(alpha);
1113 //printf("alphac=%e sca=%e t=%e s=%e beta=%e alpha=%e x=%e y=%e\n",
1114 // alphac,sca,t,s,beta,alpha,x,y);
1115 return kTRUE;
1116 } // end if
1117 return kFALSE;
bc3498f4 1118}
54c9a3d9 1119//______________________________________________________________________
1120Bool_t AliITSv11GeometrySPD::GetSectorMountingPoints(Int_t index,Double_t &x0,
1121 Double_t &y0, Double_t &x1, Double_t &y1) const
bc3498f4 1122{
54c9a3d9 1123 //
1124 // Returns the edges of the straight borders in the SPD sector shape,
1125 // which are used to mount staves on them.
1126 // Coordinate system is that of the carbon fiber sector volume.
1127 // ---
1128 // Index numbering is as follows:
1129 // /5
1130 // /\/4
1131 // 1\ \/3
1132 // 0|___\/2
1133 // ---
1134 // Arguments [the ones passed by reference contain output values]:
1135 // Int_t index --> location index according to above scheme [0-5]
1136 // Double_t &x0 --> (by ref) x0 location or the ladder sector [cm]
1137 // Double_t &y0 --> (by ref) y0 location of the ladder sector [cm]
1138 // Double_t &x1 --> (by ref) x1 location or the ladder sector [cm]
1139 // Double_t &y1 --> (by ref) y1 location of the ladder sector [cm]
1140 // TGeoManager *mgr --> The TGeo builder
1141 // ---
1142 // The location is described by a line going from (x0, y0) to (x1, y1)
1143 // ---
1144 // Returns kTRUE if no problems encountered.
1145 // Returns kFALSE if a problem was encountered (e.g.: shape not found).
d0048cec 1146 //
54c9a3d9 1147 Int_t isize = fSPDsectorX0.GetSize();
1148
1149 x0 = x1 = y0 = y1 = 0.0;
1150 if(index < 0 || index > isize) {
c890eba4 1151 AliError(Form("index = %d: allowed 0 --> %d", index, isize));
1152 return kFALSE;
54c9a3d9 1153 } // end if(index<0||index>isize)
1154 x0 = fSPDsectorX0[index];
1155 x1 = fSPDsectorX1[index];
1156 y0 = fSPDsectorY0[index];
1157 y1 = fSPDsectorY1[index];
1158 return kTRUE;
bc3498f4 1159}
54c9a3d9 1160//______________________________________________________________________
d0048cec 1161void AliITSv11GeometrySPD::SPDsectorShape(Int_t n,const Double_t *xc,
54c9a3d9 1162 const Double_t *yc, const Double_t *r,
d0048cec 1163 const Double_t *ths, const Double_t *the,
54c9a3d9 1164 Int_t npr, Int_t &m, Double_t **xp, Double_t **yp) const
bc3498f4 1165{
54c9a3d9 1166 //
1167 // Code to compute the points that make up the shape of the SPD
1168 // Carbon fiber support sections
1169 // Inputs:
1170 // Int_t n size of arrays xc,yc, and r.
1171 // Double_t *xc array of x values for radii centers.
1172 // Double_t *yc array of y values for radii centers.
1173 // Double_t *r array of signed radii values.
1174 // Double_t *ths array of starting angles [degrees].
1175 // Double_t *the array of ending angles [degrees].
1176 // Int_t npr the number of lines segments to aproximate the arc.
1177 // Outputs (arguments passed by reference):
d0048cec 1178 // Int_t m the number of enetries in the arrays *xp[npr+1]
54c9a3d9 1179 // and *yp[npr+1].
1180 // Double_t **xp array of x coordinate values of the line segments
1181 // which make up the SPD support sector shape.
1182 // Double_t **yp array of y coordinate values of the line segments
1183 // which make up the SPD support sector shape.
1184 //
1185 Int_t i, k;
1186 Double_t t, t0, t1;
1187
1188 m = n*(npr + 1);
1189 if(GetDebug(2)) {
1190 cout <<" X \t Y \t R \t S \t E" << m << endl;
1191 for(i = 0; i < n; i++) {
1192 cout << "{" << xc[i] << ", ";
1193 cout << yc[i] << ", ";
1194 cout << r[i] << ", ";
1195 cout << ths[i] << ", ";
1196 cout << the[i] << "}, " << endl;
1197 } // end for i
1198 } // end if(GetDebug(2))
1199 if (GetDebug(3)) cout << "Double_t sA0 = [" << n*(npr+1)+1<<"][";
1200 if (GetDebug(4)) cout << "3] {";
1201 else if(GetDebug(3)) cout <<"2] {";
1202 t0 = (Double_t)npr;
1203 for(i = 0; i < n; i++) {
1204 t1 = (the[i] - ths[i]) / t0;
1205 if(GetDebug(5)) cout << "t1 = " << t1 << endl;
1206 for(k = 0; k <= npr; k++) {
1207 t = ths[i] + ((Double_t)k) * t1;
1208 xp[i][k] = TMath::Abs(r[i]) * CosD(t) + xc[i];
1209 yp[i][k] = TMath::Abs(r[i]) * SinD(t) + yc[i];
1210 if(GetDebug(3)) {
1211 cout << "{" << xp[i][k] << "," << yp[i][k];
1212 if (GetDebug(4)) cout << "," << t;
1213 cout << "},";
1214 } // end if GetDebug
1215 } // end for k
1216 if(GetDebug(3)) cout << endl;
1217 } // end of i
1218 if(GetDebug(3)) cout << "{" << xp[0][0] << ", " << yp[0][0];
1219 if(GetDebug(4)) cout << "," << ths[0];
1220 if(GetDebug(3)) cout << "}}" << endl;
592651e2 1221}
22726349 1222
54c9a3d9 1223//______________________________________________________________________
1224TGeoVolume* AliITSv11GeometrySPD::CreateLadder(Int_t layer,TArrayD &sizes,
1225 TGeoManager *mgr) const
bc3498f4 1226{
54c9a3d9 1227 //
1228 // Creates the "ladder" = silicon sensor + 5 chips.
1229 // Returns a TGeoVolume containing the following components:
1230 // - the sensor (TGeoBBox), whose name depends on the layer
1231 // - 5 identical chips (TGeoBBox)
1232 // - a guard ring around the sensor (subtraction of TGeoBBoxes),
1233 // which is separated from the rest of sensor because it is not
1234 // a sensitive part
1235 // - bump bondings (TGeoBBox stripes for the whole width of the
1236 // sensor, one per column).
1237 // ---
1238 // Arguments:
1239 // 1 - the owner layer (MUST be 1 or 2 or a fatal error is raised)
1240 // 2 - a TArrayD passed by reference, which will contain relevant
1241 // dimensions related to this object:
1242 // size[0] = 'thickness' (the smallest dimension)
1243 // size[1] = 'length' (the direction along the ALICE Z axis)
d0048cec 1244 // size[2] = 'width' (extension in the direction perp. to the
54c9a3d9 1245 // above ones)
1246 // 3 - the used TGeoManager
1247
d0048cec 1248 // ** CRITICAL CHECK **
54c9a3d9 1249 // layer number can be ONLY 1 or 2
1250 if (layer != 1 && layer != 2) AliFatal("Layer number MUST be 1 or 2");
1251
1252 // ** MEDIA **
1253 TGeoMedium *medAir = GetMedium("AIR$",mgr);
1254 TGeoMedium *medSPDSiChip = GetMedium("SPD SI CHIP$",mgr); // SPD SI CHIP
1255 TGeoMedium *medSi = GetMedium("SI$",mgr);
1256 TGeoMedium *medBumpBond = GetMedium("COPPER$",mgr); // ??? BumpBond
d0048cec 1257
1258 // ** SIZES **
54c9a3d9 1259 Double_t chipThickness = fgkmm * 0.150;
1260 Double_t chipWidth = fgkmm * 15.950;
1261 Double_t chipLength = fgkmm * 13.600;
1262 Double_t chipSpacing = fgkmm * 0.400; // separation of chips along Z
1263 Double_t sensThickness = fgkmm * 0.200;
1264 Double_t sensLength = fgkmm * 69.600;
1265 Double_t sensWidth = fgkmm * 12.800;
d0048cec 1266 Double_t guardRingWidth = fgkmm * 0.560; // a border of this thickness
54c9a3d9 1267 // all around the sensor
1268 Double_t bbLength = fgkmm * 0.042;
1269 Double_t bbWidth = sensWidth;
1270 Double_t bbThickness = fgkmm * 0.012;
1271 Double_t bbPos = 0.080; // Z position w.r. to left pixel edge
1272 // compute the size of the container volume which
1273 // will also be returned in the referenced TArrayD;
1274 // for readability, they are linked by reference to a more meaningful name
1275 sizes.Set(3);
1276 Double_t &thickness = sizes[0];
1277 Double_t &length = sizes[1];
1278 Double_t &width = sizes[2];
1279 // the container is a box which exactly enclose all the stuff;
1280 width = chipWidth;
1281 length = sensLength + 2.0*guardRingWidth;
1282 thickness = sensThickness + chipThickness + bbThickness;
1283
1284 // ** VOLUMES **
1285 // While creating this volume, since it is a sensitive volume,
1286 // we must respect some standard criteria for its local reference frame.
1287 // Local X must correspond to x coordinate of the sensitive volume:
d0048cec 1288 // this means that we are going to create the container with a local
54c9a3d9 1289 // reference system that is **not** in the middle of the box.
d0048cec 1290 // This is accomplished by calling the shape constructor with an
54c9a3d9 1291 // additional option ('originShift'):
1292 Double_t xSens = 0.5 * (width - sensWidth - 2.0*guardRingWidth);
1293 Double_t originShift[3] = {-xSens, 0., 0.};
1294 TGeoBBox *shapeContainer = new TGeoBBox(0.5*width,0.5*thickness,
1295 0.5*length,originShift);
1296 // then the volume is made of air, and using this shape
1297 TGeoVolume *container = new TGeoVolume(Form("ITSSPDlay%d-Ladder",layer),
1298 shapeContainer, medAir);
1299 // the chip is a common box
1300 TGeoVolume *volChip = mgr->MakeBox("ITSSPDchip",medSPDSiChip,
1301 0.5*chipWidth,0.5*chipThickness,0.5*chipLength);
1302 // the sensor as well
1303 TGeoVolume *volSens = mgr->MakeBox(GetSenstiveVolumeName(layer),medSi,
1304 0.5*sensWidth,0.5*sensThickness,0.5*sensLength);
d0048cec 1305 // the guard ring shape is the subtraction of two boxes with the
54c9a3d9 1306 // same center.
1307 TGeoBBox *shIn = new TGeoBBox(0.5*sensWidth,sensThickness,0.5*sensLength);
1308 TGeoBBox *shOut = new TGeoBBox(0.5*sensWidth+guardRingWidth,
1309 0.5*sensThickness,0.5*sensLength+guardRingWidth);
1310 shIn->SetName("ITSSPDinnerBox");
1311 shOut->SetName("ITSSPDouterBox");
1312 TGeoCompositeShape *shBorder = new TGeoCompositeShape(
1313 "ITSSPDgaurdRingBorder",Form("%s-%s",shOut->GetName(),shIn->GetName()));
1314 TGeoVolume *volBorder = new TGeoVolume("ITSSPDgaurdRing",shBorder,medSi);
1315 // bump bonds for one whole column
1316 TGeoVolume *volBB = mgr->MakeBox("ITSSPDbb",medBumpBond,0.5*bbWidth,
1317 0.5*bbThickness,0.5*bbLength);
1318 // set colors of all objects for visualization
1319 volSens->SetLineColor(kYellow + 1);
1320 volChip->SetLineColor(kGreen);
1321 volBorder->SetLineColor(kYellow + 3);
1322 volBB->SetLineColor(kGray);
1323
1324 // ** MOVEMENTS **
1325 // sensor is translated along thickness (X) and width (Y)
1326 Double_t ySens = 0.5 * (thickness - sensThickness);
1327 Double_t zSens = 0.0;
d0048cec 1328 // we want that the x of the ladder is the same as the one of
54c9a3d9 1329 // its sensitive volume
1330 TGeoTranslation *trSens = new TGeoTranslation(0.0, ySens, zSens);
1331 // bump bonds are translated along all axes:
1332 // keep same Y used for sensors, but change the Z
1333 TGeoTranslation *trBB[160];
1334 Double_t x = 0.0;
1335 Double_t y = 0.5 * (thickness - bbThickness) - sensThickness;
1336 Double_t z = -0.5 * sensLength + guardRingWidth + fgkmm*0.425 - bbPos;
1337 Int_t i;
1338 for (i = 0; i < 160; i++) {
1339 trBB[i] = new TGeoTranslation(x, y, z);
1340 switch(i) {
1341 case 31:case 63:case 95:case 127:
1342 z += fgkmm * 0.625 + fgkmm * 0.2;
1343 break;
1344 default:
1345 z += fgkmm * 0.425;
1346 } // end switch
1347 } // end for i
1348 // the chips are translated along the length (Z) and thickness (X)
1349 TGeoTranslation *trChip[5] = {0, 0, 0, 0, 0};
1350 x = -xSens;
1351 y = 0.5 * (chipThickness - thickness);
1352 z = 0.0;
1353 for (i = 0; i < 5; i++) {
d0048cec 1354 z = -0.5*length + guardRingWidth
54c9a3d9 1355 + (Double_t)i*chipSpacing + ((Double_t)(i) + 0.5)*chipLength;
1356 trChip[i] = new TGeoTranslation(x, y, z);
1357 } // end ofr i
d0048cec 1358
54c9a3d9 1359 // add nodes to container
1360 container->AddNode(volSens, 1, trSens);
1361 container->AddNode(volBorder, 1, trSens);
1362 for (i = 0; i < 160; i++) container->AddNode(volBB,i+1,trBB[i]);
1363 for (i = 0; i < 5; i++) container->AddNode(volChip,i+3,trChip[i]);
1364 // return the container
1365 return container;
592651e2 1366}
22726349 1367
7855ea93 1368//______________________________________________________________________
54c9a3d9 1369TGeoVolume* AliITSv11GeometrySPD::CreateClip(TArrayD &sizes,Bool_t isDummy,
1370 TGeoManager *mgr) const
1371{
1372 //
1373 // Creates the carbon fiber clips which are added to the central ladders.
1374 // They have a complicated shape which is approximated by a TGeoXtru
1375 // Implementation of a single clip over an half-stave.
1376 // It has a complicated shape which is approximated to a section like this:
d0048cec 1377 //
54c9a3d9 1378 // 6
1379 // /\ .
1380 // 7 //\\ 5
1381 // / 1\\___________________4
1382 // 0 \___________________
1383 // 2 3
d0048cec 1384 // with a finite thickness for all the shape
54c9a3d9 1385 // Its local reference frame is such that point A corresponds to origin.
d0048cec 1386 //
30611568 1387
1388 // MODIFIED geometry
1389 Double_t sposty = fgkmm * -0.5; // lower internal side to avoid overlaps with modified geometry
1390
54c9a3d9 1391 Double_t fullLength = fgkmm * 12.6; // = x4 - x0
1392 Double_t flatLength = fgkmm * 5.4; // = x4 - x3
1393 Double_t inclLongLength = fgkmm * 5.0; // = 5-6
1394 Double_t inclShortLength = fgkmm * 2.0; // = 6-7
1395 Double_t fullHeight = fgkmm * 2.8; // = y6 - y3
3ffa185f 1396 Double_t thickness = fgkmm * 0.18; // thickness
54c9a3d9 1397 Double_t totalLength = fgkmm * 52.0; // total length in Z
d0048cec 1398 Double_t holeSize = fgkmm * 5.0; // dimension of cubic
54c9a3d9 1399 // hole inserted for pt1000
1400 Double_t angle1 = 27.0; // supplementary of angle DCB
1401 Double_t angle2; // angle DCB
1402 Double_t angle3; // angle of GH with vertical
d0048cec 1403
54c9a3d9 1404 angle2 = 0.5 * (180.0 - angle1);
d0048cec 1405 angle3 = 90.0 - TMath::ACos(fullLength - flatLength -
1406 inclLongLength*TMath::Cos(angle1)) *
54c9a3d9 1407 TMath::RadToDeg();
1408 angle1 *= TMath::DegToRad();
1409 angle2 *= TMath::DegToRad();
1410 angle3 *= TMath::DegToRad();
1411
1412 Double_t x[8], y[8];
d0048cec 1413
54c9a3d9 1414 x[0] = 0.0;
1415 x[1] = x[0] + fullLength - flatLength - inclLongLength*TMath::Cos(angle1);
1416 x[2] = x[0] + fullLength - flatLength;
1417 x[3] = x[0] + fullLength;
1418 x[4] = x[3];
1419 x[5] = x[4] - flatLength + thickness * TMath::Cos(angle2);
1420 x[6] = x[1];
1421 x[7] = x[0];
d0048cec 1422
54c9a3d9 1423 y[0] = 0.0;
1424 y[1] = y[0] + inclShortLength * TMath::Cos(angle3);
1425 y[2] = y[1] - inclLongLength * TMath::Sin(angle1);
1426 y[3] = y[2];
1427 y[4] = y[3] + thickness;
1428 y[5] = y[4];
1429 y[6] = y[1] + thickness;
1430 y[7] = y[0] + thickness;
d0048cec 1431
30611568 1432 y[0] += sposty;
1433 y[7] += sposty;
1434
54c9a3d9 1435 sizes.Set(7);
1436 sizes[0] = totalLength;
1437 sizes[1] = fullHeight;
1438 sizes[2] = y[2];
1439 sizes[3] = y[6];
1440 sizes[4] = x[0];
1441 sizes[5] = x[3];
1442 sizes[6] = x[2];
1443
1444 if(isDummy){// use this argument when on ewant just the
1445 // positions without create any volume
1446 return NULL;
1447 } // end if isDummy
1448
1449 TGeoXtru *shClip = new TGeoXtru(2);
1450 shClip->SetName("ITSSPDshclip");
1451 shClip->DefinePolygon(8, x, y);
1452 shClip->DefineSection(0, -0.5*totalLength, 0., 0., 1.0);
1453 shClip->DefineSection(1, 0.5*totalLength, 0., 0., 1.0);
d0048cec 1454
54c9a3d9 1455 TGeoBBox *shHole = new TGeoBBox("ITSSPDSHClipHole",0.5*holeSize,
1456 0.5*holeSize,0.5*holeSize);
1457 TGeoTranslation *tr1 = new TGeoTranslation("ITSSPDTRClipHole1",x[2],0.0,
1458 fgkmm*14.);
1459 TGeoTranslation *tr2 = new TGeoTranslation("ITSSPDTRClipHole2",x[2],0.0,
1460 0.0);
1461 TGeoTranslation *tr3 = new TGeoTranslation("ITSSPDTRClipHole3",x[2],0.0,
1462 -fgkmm*14.);
1463 tr1->RegisterYourself();
1464 tr2->RegisterYourself();
1465 tr3->RegisterYourself();
1466
1467 //TString strExpr("ITSSPDshclip-(");
1468 TString strExpr(shClip->GetName());
1469 strExpr.Append("-(");
1470 strExpr.Append(Form("%s:%s+", shHole->GetName(), tr1->GetName()));
1471 strExpr.Append(Form("%s:%s+", shHole->GetName(), tr2->GetName()));
1472 strExpr.Append(Form("%s:%s)", shHole->GetName(), tr3->GetName()));
1473 TGeoCompositeShape *shClipHole = new TGeoCompositeShape(
1474 "ITSSPDSHClipHoles",strExpr.Data());
1475
1476 TGeoMedium *mat = GetMedium("SPD C (M55J)$", mgr);
1477 TGeoVolume *vClip = new TGeoVolume("ITSSPDclip", shClipHole, mat);
1478 vClip->SetLineColor(kGray + 2);
1479 return vClip;
45c52bb2 1480}
1481
1482//______________________________________________________________________
1483TGeoVolume* AliITSv11GeometrySPD::CreatePatchPanel(TArrayD &sizes,
1484 TGeoManager *mgr) const
1485{
1486 //
1487 // Creates the patch panel approximated with a "L"-shaped TGeoXtru
1488 // with a finite thickness for all the shape
1489 // Its local reference frame is such that point A corresponds to origin.
1490 //
1491 Double_t hLength = fgkmm * 50.0; // horizontal length
1492 Double_t vLength = fgkmm * 50.0; // vertical length
c890eba4 1493 Double_t angle = 88.3; // angle between hor and vert
45c52bb2 1494 Double_t thickness = fgkmm * 4.0; // thickness
1495 Double_t width = fgkmm * 100.0; // width looking from cone
1496
1497 Double_t x[7], y[7];
1498
1499 y[0] = 0.0;
1500 y[1] = y[0] + hLength;
1501 y[2] = y[1];
1502 y[3] = y[0] + thickness;
1503 y[4] = y[3] + vLength * TMath::Cos(angle*TMath::DegToRad());
1504 y[5] = y[4] - thickness / TMath::Sin(angle*TMath::DegToRad());
1505 y[6] = y[0];
1506
1507 x[0] = 0.0;
1508 x[1] = x[0];
1509 x[2] = x[1] + thickness;
1510 x[3] = x[2];
1511 x[4] = x[3] + vLength * TMath::Sin(angle*TMath::DegToRad());
1512 x[5] = x[4];
1513 x[6] = x[0] + thickness;
1514
1515 sizes.Set(3);
1516 sizes[0] = hLength;
1517 sizes[1] = vLength;
1518 sizes[2] = thickness;
1519
1520 TGeoXtru *shPatch = new TGeoXtru(2);
1521 shPatch->SetName("ITSSPDpatchShape1");
1522 shPatch->DefinePolygon(7, x, y);
1523 shPatch->DefineSection(0, -0.5*width, 0., 0., 1.0);
1524 shPatch->DefineSection(1, 0.5*width, 0., 0., 1.0);
1525
1526 /*
1527 Double_t subThickness = 10.0 * fgkmm;
1528 Double_t subWidth = 55.0 * fgkmm;
1529 new TGeoBBox("ITSSPDpatchShape2", 0.5*subThickness, 60.0 * fgkmm, 0.5*subWidth);
1530 TGeoRotation *rotSub = new TGeoRotation(*gGeoIdentity);
1531 rotSub->SetName("shPatchSubRot");
1532 rotSub->RotateZ(50.0);
1533 rotSub->RegisterYourself();
1534 TGeoCombiTrans *trSub = new TGeoCombiTrans(0.26*hLength, 0.26*vLength, 0.0, rotSub);
1535 trSub->SetName("shPatchSubTr");
1536 trSub->RegisterYourself();
1537
1538 TGeoCompositeShape *shPatchFinal = new TGeoCompositeShape("ITSSPDpatchShape1-(ITSSPDpatchShape2:shPatchSubTr)");
1539 */
1540
1541 TGeoMedium *mat = GetMedium("AL$", mgr);
1542 //TGeoVolume *vPatch = new TGeoVolume("ITSSPDpatchPanel", shPatchFinal, mat);
1543 TGeoVolume *vPatch = new TGeoVolume("ITSSPDpatchPanel", shPatch, mat);
1544 vPatch->SetLineColor(kAzure);
1545
1546 return vPatch;
1547}
1548
c890eba4 1549//___________________________________________________________________
7855ea93 1550TGeoCompositeShape* AliITSv11GeometrySPD::CreateGroundingFoilShape
54c9a3d9 1551 (Int_t itype,Double_t &length,Double_t &width,
1552 Double_t thickness,TArrayD &sizes)
bc3498f4 1553{
54c9a3d9 1554 //
d0048cec 1555 // Creates the typical composite shape of the grounding foil:
1556 //
54c9a3d9 1557 // +---------------------------------------------------------+
1558 // | 5 6 9 |
1559 // | +-----------+ +------------+ 10
1560 // | O | | |
1561 // | 3 /-----+ 4 +------+
1562 // | 1 / 7 8
1563 // | /----------/
1564 // +-----/ 2 +
1565 // 0
1566 // Z + 11
1567 //
d0048cec 1568 // This shape is used 4 times: two layers of glue, one in kapton
1569 // and one in aluminum, taking into account that the aliminum
54c9a3d9 1570 // layer has small differences in the size of some parts.
1571 // ---
d0048cec 1572 // In order to overcome problems apparently due to a large number
1573 // of points, the shape creation is done according the following
54c9a3d9 1574 // steps:
d0048cec 1575 // 1) a TGeoBBox is created with a size right enough to contain
54c9a3d9 1576 // the whole shape (0-1-X-13)
d0048cec 1577 // 2) holes are defined as other TGeoBBox which are subtracted
54c9a3d9 1578 // from the main shape
d0048cec 1579 // 3) a TGeoXtru is defined connecting the points (0-->11-->0)
54c9a3d9 1580 // and is also subtracted from the main shape
1581 // ---
d0048cec 1582 // The argument ("type") is used to choose between all these
54c9a3d9 1583 // possibilities:
1584 // - type = 0 --> kapton layer
1585 // - type = 1 --> aluminum layer
1586 // - type = 2 --> glue layer between support and GF
1587 // - type = 3 --> glue layer between GF and ladders
d0048cec 1588 // Returns: a TGeoCompositeShape which will then be used to shape
1589 // several volumes. Since TGeoXtru is used, the local reference
54c9a3d9 1590 // frame of this object has X horizontal and Y vertical w.r to
1591 // the shape drawn above, and Z axis going perpendicularly to the screen.
d0048cec 1592 // This is not the correct reference for the half stave, for which
1593 // the "long" dimension is Z and the "short" is X, while Y goes in
1594 // the direction of thickness. This will imply some rotations when
54c9a3d9 1595 // using the volumes created with this shape.
d0048cec 1596
54c9a3d9 1597 // suffix to differentiate names
1598 Char_t type[10];
d0048cec 1599
54c9a3d9 1600 // size of the virtual box containing exactly this volume
1601 length = fgkmm * 243.18;
1602 width = fgkmm * 15.95;
1603 if (itype == 1) {
1604 length -= fgkmm * 0.4;
1605 width -= fgkmm * 0.4;
1606 } // end if itype==1
1607 switch (itype) {
1608 case 0:
1609 sprintf(type,"Kap");
1610 break;
1611 case 1:
1612 sprintf(type,"Alu");
1613 break;
1614 case 2:
1615 sprintf(type,"Glue1");
1616 break;
1617 case 3:
1618 sprintf(type,"Glue2");
1619 break;
1620 }
d0048cec 1621 // we divide the shape in several slices along the horizontal
1622 // direction (local X) here we define define the length of all
54c9a3d9 1623 // sectors (from leftmost to rightmost)
1624 Int_t i;
1625 Double_t sliceLength[] = { 140.71, 2.48, 26.78, 4.00,
1626 10.00, 24.40, 10.00, 24.81 };
1627 for (i = 0; i < 8; i++) sliceLength[i] *= fgkmm;
1628 if (itype == 1) {
1629 sliceLength[0] -= fgkmm * 0.2;
1630 sliceLength[4] -= fgkmm * 0.2;
1631 sliceLength[5] += fgkmm * 0.4;
1632 sliceLength[6] -= fgkmm * 0.4;
1633 } // end if itype ==1
d0048cec 1634
1635 // as shown in the drawing, we have four different widths
54c9a3d9 1636 // (along local Y) in this shape:
1637 Double_t widthMax = fgkmm * 15.95;
1638 Double_t widthMed1 = fgkmm * 15.00;
1639 Double_t widthMed2 = fgkmm * 11.00;
1640 Double_t widthMin = fgkmm * 4.40;
1641 if (itype == 1) {
1642 widthMax -= fgkmm * 0.4;
1643 widthMed1 -= fgkmm * 0.4;
1644 widthMed2 -= fgkmm * 0.4;
1645 widthMin -= fgkmm * 0.4;
1646 } // end if itype==1
d0048cec 1647
54c9a3d9 1648 // create the main shape
1649 TGeoBBox *shGroundFull = 0;
1650 shGroundFull = new TGeoBBox(Form("ITSSPDSHgFoil%sFull", type),
1651 0.5*length,0.5*width, 0.5*thickness);
d0048cec 1652
1653 // create the polygonal shape to be subtracted to give the correct
1654 // shape to the borders its vertices are defined in sugh a way that
1655 // this polygonal will be placed in the correct place considered
1656 // that the origin of the local reference frame is in the center
1657 // of the main box: we fix the starting point at the lower-left
1658 // edge of the shape (point 12), and add all points in order,
54c9a3d9 1659 // following a clockwise rotation
d0048cec 1660
54c9a3d9 1661 Double_t x[13], y[13];
1662 x[ 0] = -0.5 * length + sliceLength[0];
1663 y[ 0] = -0.5 * widthMax;
1664
1665 x[ 1] = x[0] + sliceLength[1];
1666 y[ 1] = y[0] + (widthMax - widthMed1);
1667
1668 x[ 2] = x[1] + sliceLength[2];
1669 y[ 2] = y[1];
1670
1671 x[ 3] = x[2] + sliceLength[3];
1672 y[ 3] = y[2] + (widthMed1 - widthMed2);
1673
1674 x[ 4] = x[3] + sliceLength[4];
1675 y[ 4] = y[3];
1676
1677 x[ 5] = x[4];
1678 y[ 5] = y[4] + (widthMed2 - widthMin);
1679
1680 x[ 6] = x[5] + sliceLength[5];
1681 y[ 6] = y[5];
1682
1683 x[ 7] = x[6];
1684 y[ 7] = y[4];
1685
1686 x[ 8] = x[7] + sliceLength[6];
1687 y[ 8] = y[7];
1688
1689 x[ 9] = x[8];
1690 y[ 9] = y[6];
1691
1692 x[10] = x[9] + sliceLength[7] + 0.5;
1693 y[10] = y[9];
1694
1695 x[11] = x[10];
1696 y[11] = y[0] - 0.5;
1697
1698 x[12] = x[0];
1699 y[12] = y[11];
1700
1701 // create the shape
1702 TGeoXtru *shGroundXtru = new TGeoXtru(2);
1703 shGroundXtru->SetName(Form("ITSSPDSHgFoil%sXtru", type));
1704 shGroundXtru->DefinePolygon(13, x, y);
1705 shGroundXtru->DefineSection(0, -thickness, 0., 0., 1.0);
1706 shGroundXtru->DefineSection(1, thickness, 0., 0., 1.0);
d0048cec 1707
54c9a3d9 1708 // define a string which will express the algebric operations among volumes
1709 // and add the subtraction of this shape from the main one
1710 TString strComposite(Form("ITSSPDSHgFoil%sFull-(%s+", type,
1711 shGroundXtru->GetName()));
d0048cec 1712
54c9a3d9 1713 // define the holes according to size information coming from drawings:
1714 Double_t holeLength = fgkmm * 10.00;
1715 Double_t holeWidth = fgkmm * 7.50;
d0048cec 1716 Double_t holeSepX0 = fgkmm * 7.05; // separation between center
54c9a3d9 1717 // of first hole and left border
d0048cec 1718 Double_t holeSepXC = fgkmm * 14.00; // separation between the centers
54c9a3d9 1719 // of two consecutive holes
d0048cec 1720 Double_t holeSepX1 = fgkmm * 15.42; // separation between centers of
54c9a3d9 1721 // 5th and 6th hole
d0048cec 1722 Double_t holeSepX2 = fgkmm * 22.00; // separation between centers of
54c9a3d9 1723 // 10th and 11th hole
1724 if (itype == 1) {
1725 holeSepX0 -= fgkmm * 0.2;
1726 holeLength += fgkmm * 0.4;
1727 holeWidth += fgkmm * 0.4;
1728 } // end if itype==1
1729 sizes.Set(7);
1730 sizes[0] = holeLength;
1731 sizes[1] = holeWidth;
1732 sizes[2] = holeSepX0;
1733 sizes[3] = holeSepXC;
1734 sizes[4] = holeSepX1;
1735 sizes[5] = holeSepX2;
1736 sizes[6] = fgkmm * 4.40;
d0048cec 1737
54c9a3d9 1738 // X position of hole center (will change for each hole)
1739 Double_t holeX = -0.5*length;
1740 // Y position of center of all holes (= 4.4 mm from upper border)
1741 Double_t holeY = 0.5*(width - holeWidth) - widthMin;
d0048cec 1742
54c9a3d9 1743 // create a shape for the holes (common)
1744 TGeoBBox *shHole = 0;
1745 shHole = new TGeoBBox(Form("ITSSPD%sGfoilHole", type),0.5*holeLength,
1746 0.5*holeWidth, thickness);
d0048cec 1747
54c9a3d9 1748 // insert the holes in the XTRU shape:
d0048cec 1749 // starting from the first value of X, they are simply
54c9a3d9 1750 // shifted along this axis
1751 char name[200];
1752 TGeoTranslation *transHole[11];
4adcf390 1753 for (i = 0; i < 11; i++) {
54c9a3d9 1754 // set the position of the hole, depending on index
1755 if (i == 0) {
1756 holeX += holeSepX0;
1757 }else if (i < 5) {
1758 holeX += holeSepXC;
1759 }else if (i == 5) {
1760 holeX += holeSepX1;
1761 }else if (i < 10) {
1762 holeX += holeSepXC;
1763 }else {
1764 holeX += holeSepX2;
1765 } // end if else if's
1766 //cout << i << " --> X = " << holeX << endl;
1767 sprintf(name,"ITSSPDTRgFoil%sHole%d", type, i);
1768 transHole[i] = new TGeoTranslation(name, holeX, holeY, 0.0);
1769 transHole[i]->RegisterYourself();
1770 strComposite.Append(Form("ITSSPD%sGfoilHole:%s", type, name));
1771 if (i < 10) strComposite.Append("+"); else strComposite.Append(")");
1772 } // end for i
d0048cec 1773
54c9a3d9 1774 // create composite shape
1775 TGeoCompositeShape *shGround = new TGeoCompositeShape(
1776 Form("ITSSPDSHgFoil%s", type), strComposite.Data());
1777
1778 return shGround;
592651e2 1779}
54c9a3d9 1780//______________________________________________________________________
d0048cec 1781TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateGroundingFoil(Bool_t isRight,
54c9a3d9 1782 TArrayD &sizes, TGeoManager *mgr)
bc3498f4 1783{
54c9a3d9 1784 //
d0048cec 1785 // Create a volume containing all parts of the grounding foil a
1786 // for a half-stave.
54c9a3d9 1787 // It consists of 4 layers with the same shape but different thickness:
1788 // 1) a layer of glue
1789 // 2) the aluminum layer
1790 // 3) the kapton layer
1791 // 4) another layer of glue
1792 // ---
1793 // Arguments:
d0048cec 1794 // 1: a boolean value to know if it is the grounding foir for
54c9a3d9 1795 // the right or left side
1796 // 2: a TArrayD which will contain the dimension of the container box:
1797 // - size[0] = length along Z (the beam line direction)
d0048cec 1798 // - size[1] = the 'width' of the stave, which defines, together
54c9a3d9 1799 // with Z, the plane of the carbon fiber support
d0048cec 1800 // - size[2] = 'thickness' (= the direction along which all
54c9a3d9 1801 // stave components are superimposed)
1802 // 3: the TGeoManager
1803 // ---
d0048cec 1804 // The return value is a TGeoBBox volume containing all grounding
54c9a3d9 1805 // foil components.
1806 // to avoid strange behaviour of the geometry manager,
1807 // create a suffix to be used in the names of all shapes
1808 //
1809 char suf[5];
1810 if (isRight) strcpy(suf, "R"); else strcpy(suf, "L");
d0048cec 1811 // this volume will be created in order to ease its placement in
1812 // the half-stave; then, it is added here the small distance of
1813 // the "central" edge of each volume from the Z=0 plane in the stave
54c9a3d9 1814 // reference (which coincides with ALICE one)
1815 Double_t dist = fgkmm * 0.71;
d0048cec 1816
54c9a3d9 1817 // define materials
1818 TGeoMedium *medKap = GetMedium("SPD KAPTON(POLYCH2)$", mgr);
1819 TGeoMedium *medAlu = GetMedium("AL$", mgr);
1820 TGeoMedium *medGlue = GetMedium("EPOXY$", mgr); //??? GLUE_GF_SUPPORT
d0048cec 1821
54c9a3d9 1822 // compute the volume shapes (thicknesses change from one to the other)
1823 Double_t kpLength, kpWidth, alLength, alWidth;
1824 TArrayD kpSize, alSize, glSize;
ed0e944d 1825 Double_t kpThickness = fgkmm * 0.04;
1826 Double_t alThickness = fgkmm * 0.01;
1827//cout << "AL THICKNESS" << alThickness << endl;
1828 //Double_t g0Thickness = fgkmm * 0.1175 - fgkGapHalfStave;
1829 //Double_t g1Thickness = fgkmm * 0.1175 - fgkGapLadder;
1830 Double_t g0Thickness = fgkmm * 0.1275 - fgkGapHalfStave;
1831 Double_t g1Thickness = fgkmm * 0.1275 - fgkGapLadder;
54c9a3d9 1832 TGeoCompositeShape *kpShape = CreateGroundingFoilShape(0,kpLength,kpWidth,
1833 kpThickness, kpSize);
1834 TGeoCompositeShape *alShape = CreateGroundingFoilShape(1,alLength,alWidth,
1835 alThickness, alSize);
3ffa185f 1836 TGeoCompositeShape *g0Shape = CreateGroundingFoilShape(2,kpLength,kpWidth,
1837 g0Thickness, glSize);
1838 TGeoCompositeShape *g1Shape = CreateGroundingFoilShape(3,kpLength,kpWidth,
1839 g1Thickness, glSize);
d0048cec 1840 // create the component volumes and register their sizes in the
1841 // passed arrays for readability reasons, some reference variables
54c9a3d9 1842 // explicit the meaning of the array slots
1843 TGeoVolume *kpVol = new TGeoVolume(Form("ITSSPDgFoilKap%s",suf),
1844 kpShape, medKap);
1845 TGeoVolume *alVol = new TGeoVolume(Form("ITSSPDgFoilAlu%s",suf),
1846 alShape, medAlu);
3ffa185f 1847 TGeoVolume *g0Vol = new TGeoVolume(Form("ITSSPDgFoilGlue%s",suf),
1848 g0Shape, medGlue);
1849 TGeoVolume *g1Vol = new TGeoVolume(Form("ITSSPDgFoilGlue%s",suf),
1850 g1Shape, medGlue);
54c9a3d9 1851 // set colors for the volumes
1852 kpVol->SetLineColor(kRed);
1853 alVol->SetLineColor(kGray);
3ffa185f 1854 g0Vol->SetLineColor(kYellow);
1855 g1Vol->SetLineColor(kYellow);
54c9a3d9 1856 // create references for the final size object
1857 if (sizes.GetSize() != 3) sizes.Set(3);
1858 Double_t &fullThickness = sizes[0];
1859 Double_t &fullLength = sizes[1];
1860 Double_t &fullWidth = sizes[2];
d0048cec 1861 // kapton leads the larger dimensions of the foil
54c9a3d9 1862 // (including the cited small distance from Z=0 stave reference plane)
1863 // the thickness is the sum of the ones of all components
1864 fullLength = kpLength + dist;
1865 fullWidth = kpWidth;
3ffa185f 1866 fullThickness = kpThickness + alThickness + g0Thickness + g1Thickness;
54c9a3d9 1867 // create the container
d0048cec 1868// TGeoMedium *air = GetMedium("AIR$", mgr);
1869 TGeoVolumeAssembly *container = new TGeoVolumeAssembly(Form("ITSSPDgFOIL-%s",suf));
1870// TGeoVolume *container = mgr->MakeBox(Form("ITSSPDgFOIL-%s",suf),
1871// air, 0.5*fullThickness, 0.5*fullWidth, 0.5*fullLength);
1872 // create the common correction rotation (which depends of what side
54c9a3d9 1873 // we are building)
1874 TGeoRotation *rotCorr = new TGeoRotation(*gGeoIdentity);
1875 if (isRight) rotCorr->RotateY(90.0);
d0048cec 1876 else rotCorr->RotateY(-90.0);
1877 // compute the translations, which are in the length and
54c9a3d9 1878 // thickness directions
1879 Double_t x, y, z, shift = 0.0;
1880 if (isRight) shift = dist;
1881 // glue (bottom)
3ffa185f 1882 x = -0.5*(fullThickness - g0Thickness);
54c9a3d9 1883 z = 0.5*(fullLength - kpLength) - shift;
1884 TGeoCombiTrans *glTrans0 = new TGeoCombiTrans(x, 0.0, z, rotCorr);
1885 // kapton
3ffa185f 1886 x += 0.5*(g0Thickness + kpThickness);
54c9a3d9 1887 TGeoCombiTrans *kpTrans = new TGeoCombiTrans(x, 0.0, z, rotCorr);
1888 // aluminum
1889 x += 0.5*(kpThickness + alThickness);
1890 z = 0.5*(fullLength - alLength) - shift - 0.5*(kpLength - alLength);
1891 TGeoCombiTrans *alTrans = new TGeoCombiTrans(x, 0.0, z, rotCorr);
1892 // glue (top)
3ffa185f 1893 x += 0.5*(alThickness + g1Thickness);
54c9a3d9 1894 z = 0.5*(fullLength - kpLength) - shift;
1895 TGeoCombiTrans *glTrans1 = new TGeoCombiTrans(x, 0.0, z, rotCorr);
d0048cec 1896
ed0e944d 1897 //cout << fgkGapHalfStave << endl;
1898 //cout << g0Thickness << endl;
1899 //cout << kpThickness << endl;
1900 //cout << alThickness << endl;
1901 //cout << g1Thickness << endl;
54c9a3d9 1902
1903 // add to container
22726349 1904 container->SetLineColor(kMagenta-10);
54c9a3d9 1905 container->AddNode(kpVol, 1, kpTrans);
1906 container->AddNode(alVol, 1, alTrans);
3ffa185f 1907 container->AddNode(g0Vol, 1, glTrans0);
d0048cec 1908 container->AddNode(g1Vol, 2, glTrans1);
1909 // to add the grease we remember the sizes of the holes, stored as
54c9a3d9 1910 // additional parameters in the kapton layer size:
1911 // - sizes[3] = hole length
1912 // - sizes[4] = hole width
1913 // - sizes[5] = position of first hole center
1914 // - sizes[6] = standard separation between holes
1915 // - sizes[7] = separation between 5th and 6th hole
1916 // - sizes[8] = separation between 10th and 11th hole
d0048cec 1917 // - sizes[9] = separation between the upper hole border and
54c9a3d9 1918 // the foil border
1919 Double_t holeLength = kpSize[0];
1920 Double_t holeWidth = kpSize[1];
1921 Double_t holeFirstZ = kpSize[2];
1922 Double_t holeSepZ = kpSize[3];
1923 Double_t holeSep5th6th = kpSize[4];
1924 Double_t holeSep10th11th = kpSize[5];
1925 Double_t holeSepY = kpSize[6];
1926 // volume (common)
1927 // Grease has not been defined to date. Need much more information
1928 // no this material!
1929 TGeoMedium *grease = GetMedium("SPD KAPTON(POLYCH2)$", mgr); // ??? GREASE
1930 TGeoVolume *hVol = mgr->MakeBox("ITSSPDGrease", grease,
1931 0.5*fullThickness, 0.5*holeWidth, 0.5*holeLength);
1932 hVol->SetLineColor(kBlue);
1933 // displacement of volumes in the container
1934 Int_t idx = 1; // copy numbers start from 1.
1935 x = 0.0;
1936 y = 0.5*(fullWidth - holeWidth) - holeSepY;
1937 if (isRight) z = holeFirstZ - 0.5*fullLength + dist;
1938 else z = 0.5*fullLength - holeFirstZ - dist;
1939 for (Int_t i = 0; i < 11; i++) {
1940 TGeoTranslation *t = 0;
1941 t = new TGeoTranslation(x, y, -z);
1942 container->AddNode(hVol, idx++, t);
1943 if (i < 4) shift = holeSepZ;
1944 else if (i == 4) shift = holeSep5th6th;
1945 else if (i < 9) shift = holeSepZ;
1946 else shift = holeSep10th11th;
1947 if (isRight) z += shift;
1948 else z -= shift;
1949 } // end for i
1950 return container;
592651e2 1951}
54c9a3d9 1952//___________________________________________________________________
1953TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateMCM(Bool_t isRight,
1954 TArrayD &sizes, TGeoManager *mgr) const
bc3498f4 1955{
54c9a3d9 1956 //
1957 // Create a TGeoAssembly containing all the components of the MCM.
1958 // The TGeoVolume container is rejected due to the possibility of overlaps
1959 // when placing this object on the carbon fiber sector.
1960 // The assembly contains:
1961 // - the thin part of the MCM (integrated circuit)
1962 // - the MCM chips (specifications from EDMS)
1963 // - the cap which covers the zone where chips are bound to MCM
1964 // ---
d0048cec 1965 // The local reference frame of this assembly is defined in such a way
1966 // that all volumes are contained in a virtual box whose center
1967 // is placed exactly in the middle of the occupied space w.r to all
1968 // directions. This will ease the positioning of this object in the
1969 // half-stave. The sizes of this virtual box are stored in
54c9a3d9 1970 // the array passed by reference.
1971 // ---
1972 // Arguments:
d0048cec 1973 // - a boolean flag to know if this is the "left" or "right" MCM, when
1974 // looking at the stave from above (i.e. the direction from which
1975 // one sees bus over ladders over grounding foil) and keeping the
1976 // continuous border in the upper part, one sees the thicker part
54c9a3d9 1977 // on the left or right.
d0048cec 1978 // - an array passed by reference which will contain the size of
54c9a3d9 1979 // the virtual container.
1980 // - a pointer to the used TGeoManager.
1981 //
1982
1983 // to distinguish the "left" and "right" objects, a suffix is created
1984 char suf[5];
1985 if (isRight) strcpy(suf, "R"); else strcpy(suf, "L");
1986
1987 // ** MEDIA **
1988 TGeoMedium *medBase = GetMedium("SPD KAPTON(POLYCH2)$",mgr);// ??? MCM BASE
1989 TGeoMedium *medChip = GetMedium("SPD SI CHIP$",mgr);
1990 TGeoMedium *medCap = GetMedium("AL$",mgr);
1991
d0048cec 1992 // The shape of the MCM is divided into 3 sectors with different
54c9a3d9 1993 // widths (Y) and lengths (X), like in this sketch:
1994 //
d0048cec 1995 // 0 1 2
54c9a3d9 1996 // +---------------------+-----------------------------------+
1997 // | 4 sect 2 |
1998 // | 6 sect 1 /-------------------+
1999 // | sect 0 /--------------/ 3
2000 // +--------------------/ 5
2001 // 8 7
2002 //
2003 // the inclination of all oblique borders (6-7, 4-5) is always 45 degrees.
2004 // From drawings we can parametrize the dimensions of all these sectors,
2005 // then the shape of this part of the MCM is implemented as a
d0048cec 2006 // TGeoXtru centerd in the virtual XY space.
54c9a3d9 2007 // The first step is definig the relevant sizes of this shape:
2008 Int_t i, j;
2009 Double_t mcmThickness = fgkmm * 0.35;
2010 Double_t sizeXtot = fgkmm * 105.6; // total distance (0-2)
2011 // resp. 7-8, 5-6 and 3-4
2012 Double_t sizeXsector[3] = {fgkmm * 28.4, fgkmm * 41.4, fgkmm * 28.8};
2013 // resp. 0-8, 1-6 and 2-3
2014 Double_t sizeYsector[3] = {fgkmm * 15.0, fgkmm * 11.0, fgkmm * 8.0};
2015 Double_t sizeSep01 = fgkmm * 4.0; // x(6)-x(7)
2016 Double_t sizeSep12 = fgkmm * 3.0; // x(4)-x(5)
2017
2018 // define sizes of chips (last is the thickest)
2019 Double_t chipLength[5] = { 4.00, 6.15, 3.85, 5.60, 18.00 };
2020 Double_t chipWidth[5] = { 3.00, 4.10, 3.85, 5.60, 5.45 };
2021 Double_t chipThickness[5] = { 0.60, 0.30, 0.30, 1.00, 1.20 };
2022 TString name[5];
2023 name[0] = "ITSSPDanalog";
2024 name[1] = "ITSSPDpilot";
2025 name[2] = "ITSSPDgol";
2026 name[3] = "ITSSPDrx40";
2027 name[4] = "ITSSPDoptical";
2028 Color_t color[5] = { kCyan, kGreen, kYellow, kBlue, kOrange };
2029
2030 // define the sizes of the cover
2031 Double_t capThickness = fgkmm * 0.3;
2032 Double_t capHeight = fgkmm * 1.7;
2033
2034 // compute the total size of the virtual container box
2035 sizes.Set(3);
2036 Double_t &thickness = sizes[0];
2037 Double_t &length = sizes[1];
2038 Double_t &width = sizes[2];
2039 length = sizeXtot;
2040 width = sizeYsector[0];
2041 thickness = mcmThickness + capHeight;
2042
d0048cec 2043 // define all the relevant vertices of the polygon
54c9a3d9 2044 // which defines the transverse shape of the MCM.
d0048cec 2045 // These values are used to several purposes, and
54c9a3d9 2046 // for each one, some points must be excluded
2047 Double_t xRef[9], yRef[9];
2048 xRef[0] = -0.5*sizeXtot;
2049 yRef[0] = 0.5*sizeYsector[0];
2050 xRef[1] = xRef[0] + sizeXsector[0] + sizeSep01;
2051 yRef[1] = yRef[0];
2052 xRef[2] = -xRef[0];
2053 yRef[2] = yRef[0];
2054 xRef[3] = xRef[2];
2055 yRef[3] = yRef[2] - sizeYsector[2];
2056 xRef[4] = xRef[3] - sizeXsector[2];
2057 yRef[4] = yRef[3];
2058 xRef[5] = xRef[4] - sizeSep12;
2059 yRef[5] = yRef[4] - sizeSep12;
2060 xRef[6] = xRef[5] - sizeXsector[1];
2061 yRef[6] = yRef[5];
2062 xRef[7] = xRef[6] - sizeSep01;
2063 yRef[7] = yRef[6] - sizeSep01;
2064 xRef[8] = xRef[0];
2065 yRef[8] = -yRef[0];
2066
d0048cec 2067 // the above points are defined for the "right" MCM (if ve view the
2068 // stave from above) in order to change to the "left" one, we must
54c9a3d9 2069 // change the sign to all X values:
2070 if (isRight) for (i = 0; i < 9; i++) xRef[i] = -xRef[i];
d0048cec 2071
2072 // the shape of the MCM and glue layer are done excluding point 1,
54c9a3d9 2073 // which is not necessary and cause the geometry builder to get confused
2074 j = 0;
2075 Double_t xBase[8], yBase[8];
2076 for (i = 0; i < 9; i++) {
2077 if (i == 1) continue;
2078 xBase[j] = xRef[i];
2079 yBase[j] = yRef[i];
2080 j++;
2081 } // end for i
2082
2083 // the MCM cover is superimposed over the zones 1 and 2 only
2084 Double_t xCap[6], yCap[6];
2085 j = 0;
2086 for (i = 1; i <= 6; i++) {
2087 xCap[j] = xRef[i];
2088 yCap[j] = yRef[i];
2089 j++;
2090 } // end for i
2091
d0048cec 2092 // define positions of chips,
54c9a3d9 2093 // which must be added to the bottom-left corner of MCM
2094 // and divided by 1E4;
2095 Double_t chipX[5], chipY[5];
2096 if (isRight) {
2097 chipX[0] = 666320.;
2098 chipX[1] = 508320.;
2099 chipX[2] = 381320.;
2100 chipX[3] = 295320.;
2101 chipX[4] = 150320.;
2102 chipY[0] = 23750.;
2103 chipY[1] = 27750.;
2104 chipY[2] = 20750.;
2105 chipY[3] = 42750.;
2106 chipY[4] = 39750.;
2107 } else {
2108 chipX[0] = 389730.;
2109 chipX[1] = 548630.;
2110 chipX[2] = 674930.;
2111 chipX[3] = 761430.;
2112 chipX[4] = 905430.;
2113 chipY[0] = 96250.;
2114 chipY[1] = 91950.;
2115 chipY[2] = 99250.;
2116 chipY[3] = 107250.;
2117 chipY[4] = 109750.;
2118 } // end if isRight
2119 for (i = 0; i < 5; i++) {
2120 chipX[i] *= 0.00001;
2121 chipY[i] *= 0.00001;
2122 if (isRight) {
2123 chipX[i] += xRef[3];
2124 chipY[i] += yRef[3];
2125 } else {
2126 chipX[i] += xRef[8];
2127 chipY[i] += yRef[8];
2128 } // end for isRight
2129 chipLength[i] *= fgkmm;
2130 chipWidth[i] *= fgkmm;
2131 chipThickness[i] *= fgkmm;
2132 } // end for i
2133
d0048cec 2134 // create shapes for MCM
54c9a3d9 2135 Double_t z1, z2;
2136 TGeoXtru *shBase = new TGeoXtru(2);
2137 z1 = -0.5*thickness;
2138 z2 = z1 + mcmThickness;
2139 shBase->DefinePolygon(8, xBase, yBase);
2140 shBase->DefineSection(0, z1, 0., 0., 1.0);
2141 shBase->DefineSection(1, z2, 0., 0., 1.0);
2142
2143 // create volumes of MCM
2144 TGeoVolume *volBase = new TGeoVolume("ITSSPDbase", shBase, medBase);
2145 volBase->SetLineColor(kRed);
2146
d0048cec 2147 // to create the border of the MCM cover, it is required the
2148 // subtraction of two shapes the outer is created using the
54c9a3d9 2149 // reference points defined here
2150 TGeoXtru *shCapOut = new TGeoXtru(2);
2151 shCapOut->SetName(Form("ITSSPDshCAPOUT%s", suf));
2152 z1 = z2;
2153 z2 = z1 + capHeight - capThickness;
2154 shCapOut->DefinePolygon(6, xCap, yCap);
2155 shCapOut->DefineSection(0, z1, 0., 0., 1.0);
2156 shCapOut->DefineSection(1, z2, 0., 0., 1.0);
2157 // the inner is built similarly but subtracting the thickness
2158 Double_t angle, cs;
2159 Double_t xin[6], yin[6];
2160 if (!isRight) {
2161 angle = 45.0;
2162 cs = TMath::Cos( 0.5*(TMath::Pi() - angle*TMath::DegToRad()) );
2163 xin[0] = xCap[0] + capThickness;
2164 yin[0] = yCap[0] - capThickness;
2165 xin[1] = xCap[1] - capThickness;
2166 yin[1] = yin[0];
2167 xin[2] = xin[1];
2168 yin[2] = yCap[2] + capThickness;
2169 xin[3] = xCap[3] - capThickness*cs;
2170 yin[3] = yin[2];
2171 xin[4] = xin[3] - sizeSep12;
2172 yin[4] = yCap[4] + capThickness;
2173 xin[5] = xin[0];
2174 yin[5] = yin[4];
2175 } else {
2176 angle = 45.0;
2177 cs = TMath::Cos( 0.5*(TMath::Pi() - angle*TMath::DegToRad()) );
2178 xin[0] = xCap[0] - capThickness;
2179 yin[0] = yCap[0] - capThickness;
2180 xin[1] = xCap[1] + capThickness;
2181 yin[1] = yin[0];
2182 xin[2] = xin[1];
2183 yin[2] = yCap[2] + capThickness;
2184 xin[3] = xCap[3] - capThickness*cs;
2185 yin[3] = yin[2];
2186 xin[4] = xin[3] + sizeSep12;
2187 yin[4] = yCap[4] + capThickness;
2188 xin[5] = xin[0];
2189 yin[5] = yin[4];
2190 } // end if !isRight
2191 TGeoXtru *shCapIn = new TGeoXtru(2);
2192 shCapIn->SetName(Form("ITSSPDshCAPIN%s", suf));
2193 shCapIn->DefinePolygon(6, xin, yin);
2194 shCapIn->DefineSection(0, z1 - 0.01, 0., 0., 1.0);
2195 shCapIn->DefineSection(1, z2 + 0.01, 0., 0., 1.0);
2196 // compose shapes
2197 TGeoCompositeShape *shCapBorder = new TGeoCompositeShape(
d0048cec 2198 Form("ITSSPDshBORDER%s", suf),
54c9a3d9 2199 Form("%s-%s", shCapOut->GetName(),
2200 shCapIn->GetName()));
2201 // create volume
2202 TGeoVolume *volCapBorder = new TGeoVolume("ITSSPDcapBoarder",
2203 shCapBorder,medCap);
2204 volCapBorder->SetLineColor(kGreen);
d0048cec 2205 // finally, we create the top of the cover, which has the same
2206 // shape of outer border and a thickness equal of the one othe
54c9a3d9 2207 // cover border one
2208 TGeoXtru *shCapTop = new TGeoXtru(2);
2209 z1 = z2;
2210 z2 = z1 + capThickness;
2211 shCapTop->DefinePolygon(6, xCap, yCap);
2212 shCapTop->DefineSection(0, z1, 0., 0., 1.0);
2213 shCapTop->DefineSection(1, z2, 0., 0., 1.0);
2214 TGeoVolume *volCapTop = new TGeoVolume("ITSSPDcapTop", shCapTop, medCap);
2215 volCapTop->SetLineColor(kBlue);
2216
2217 // create container assembly with right suffix
2218 TGeoVolumeAssembly *mcmAssembly = new TGeoVolumeAssembly(
2219 Form("ITSSPDmcm%s", suf));
2220
2221 // add mcm layer
2222 mcmAssembly->AddNode(volBase, 1, gGeoIdentity);
2223 // add chips
2224 for (i = 0; i < 5; i++) {
2225 TGeoVolume *box = gGeoManager->MakeBox(name[i],medChip,
2226 0.5*chipLength[i], 0.5*chipWidth[i], 0.5*chipThickness[i]);
2227 TGeoTranslation *tr = new TGeoTranslation(chipX[i],chipY[i],
2228 0.5*(-thickness + chipThickness[i]) + mcmThickness);
2229 box->SetLineColor(color[i]);
2230 mcmAssembly->AddNode(box, 1, tr);
2231 } // end for i
2232 // add cap border
2233 mcmAssembly->AddNode(volCapBorder, 1, gGeoIdentity);
2234 // add cap top
d0048cec 2235 mcmAssembly->AddNode(volCapTop, 1, gGeoIdentity);
54c9a3d9 2236
2237 return mcmAssembly;
592651e2 2238}
7f69c251 2239
54c9a3d9 2240//______________________________________________________________________
bc3498f4 2241TGeoVolumeAssembly* AliITSv11GeometrySPD::CreatePixelBus
22726349 2242(Bool_t isRight, Int_t ilayer, TArrayD &sizes, TGeoManager *mgr) const
bc3498f4 2243{
54c9a3d9 2244 //
d0048cec 2245 // The pixel bus is implemented as a TGeoBBox with some objects on it,
54c9a3d9 2246 // which could affect the particle energy loss.
2247 // ---
d0048cec 2248 // In order to avoid confusion, the bus is directly displaced
54c9a3d9 2249 // according to the axis orientations which are used in the final stave:
2250 // X --> thickness direction
2251 // Y --> width direction
2252 // Z --> length direction
2253 //
d0048cec 2254
22726349 2255 // ** CRITICAL CHECK ******************************************************
2256 // layer number can be ONLY 1 or 2
2257 if (ilayer != 1 && ilayer != 2) AliFatal("Layer number MUST be 1 or 2");
54c9a3d9 2258
2259 // ** MEDIA **
2260 //PIXEL BUS
2261 TGeoMedium *medBus = GetMedium("SPDBUS(AL+KPT+EPOX)$",mgr);
2262 TGeoMedium *medPt1000 = GetMedium("CERAMICS$",mgr); // ??? PT1000
2263 // Capacity
2264 TGeoMedium *medCap = GetMedium("SDD X7R capacitors$",mgr);
2265 // ??? Resistance
d0048cec 2266 //TGeoMedium *medRes = GetMedium("SDD X7R capacitors$",mgr);
7f69c251 2267 TGeoMedium *medRes = GetMedium("ALUMINUM$",mgr);
45c52bb2 2268 //TGeoMedium *medExt = GetMedium("SDDKAPTON (POLYCH2)$", mgr);
2269 TGeoMedium *medExt = GetMedium("SPD-MIX CU KAPTON$", mgr);
54c9a3d9 2270 // ** SIZES & POSITIONS **
2271 Double_t busLength = 170.501 * fgkmm; // length of plane part
2272 Double_t busWidth = 13.800 * fgkmm; // width
2273 Double_t busThickness = 0.280 * fgkmm; // thickness
2274 Double_t pt1000Length = fgkmm * 1.50;
2275 Double_t pt1000Width = fgkmm * 3.10;
2276 Double_t pt1000Thickness = fgkmm * 0.60;
2277 Double_t pt1000Y, pt1000Z[10];// position of the pt1000's along the bus
2278 Double_t capLength = fgkmm * 2.55;
2279 Double_t capWidth = fgkmm * 1.50;
2280 Double_t capThickness = fgkmm * 1.35;
2281 Double_t capY[2], capZ[2];
d0048cec 2282
54c9a3d9 2283 Double_t resLength = fgkmm * 2.20;
2284 Double_t resWidth = fgkmm * 0.80;
2285 Double_t resThickness = fgkmm * 0.35;
2286 Double_t resY[2], resZ[2];
d0048cec 2287
7f69c251 2288 Double_t extThickness = fgkmm * 0.25;
3ffa185f 2289 Double_t ext1Length = fgkmm * (26.7 - 10.0);
ddf00e3c 2290 Double_t ext2Length = fgkmm * 284.0 - ext1Length + extThickness;
3ffa185f 2291 Double_t extWidth = fgkmm * 11.0;
2292 Double_t extHeight = fgkmm * 2.5;
d0048cec 2293
2294 // position of pt1000, resistors and capacitors depends on the
54c9a3d9 2295 // bus if it's left or right one
2296 if (!isRight) {
2297 pt1000Y = 64400.;
2298 pt1000Z[0] = 66160.;
2299 pt1000Z[1] = 206200.;
2300 pt1000Z[2] = 346200.;
2301 pt1000Z[3] = 486200.;
2302 pt1000Z[4] = 626200.;
2303 pt1000Z[5] = 776200.;
2304 pt1000Z[6] = 916200.;
2305 pt1000Z[7] = 1056200.;
2306 pt1000Z[8] = 1196200.;
d0048cec 2307 pt1000Z[9] = 1336200.;
54c9a3d9 2308 resZ[0] = 1397500.;
2309 resY[0] = 26900.;
2310 resZ[1] = 682500.;
2311 resY[1] = 27800.;
2312 capZ[0] = 1395700.;
2313 capY[0] = 45700.;
2314 capZ[1] = 692600.;
2315 capY[1] = 45400.;
2316 } else {
2317 pt1000Y = 66100.;
2318 pt1000Z[0] = 319700.;
2319 pt1000Z[1] = 459700.;
2320 pt1000Z[2] = 599700.;
2321 pt1000Z[3] = 739700.;
2322 pt1000Z[4] = 879700.;
2323 pt1000Z[5] = 1029700.;
2324 pt1000Z[6] = 1169700.;
2325 pt1000Z[7] = 1309700.;
2326 pt1000Z[8] = 1449700.;
d0048cec 2327 pt1000Z[9] = 1589700.;
54c9a3d9 2328 capY[0] = 44500.;
2329 capZ[0] = 266700.;
2330 capY[1] = 44300.;
2331 capZ[1] = 974700.;
2332 resZ[0] = 266500.;
2333 resY[0] = 29200.;
2334 resZ[1] = 974600.;
2335 resY[1] = 29900.;
2336 } // end if isRight
2337 Int_t i;
2338 pt1000Y *= 1E-4 * fgkmm;
2339 for (i = 0; i < 10; i++) {
2340 pt1000Z[i] *= 1E-4 * fgkmm;
2341 if (i < 2) {
2342 capZ[i] *= 1E-4 * fgkmm;
2343 capY[i] *= 1E-4 * fgkmm;
2344 resZ[i] *= 1E-4 * fgkmm;
2345 resY[i] *= 1E-4 * fgkmm;
2346 } // end if iM2
2347 } // end for i
d0048cec 2348
54c9a3d9 2349 Double_t &fullLength = sizes[1];
2350 Double_t &fullWidth = sizes[2];
2351 Double_t &fullThickness = sizes[0];
2352 fullLength = busLength;
2353 fullWidth = busWidth;
2354 // add the thickness of the thickest component on bus (capacity)
d0048cec 2355 fullThickness = busThickness + capThickness;
54c9a3d9 2356
2357 // ** VOLUMES **
2358 TGeoVolumeAssembly *container = new TGeoVolumeAssembly("ITSSPDpixelBus");
d0048cec 2359 TGeoVolume *bus = mgr->MakeBox("ITSSPDbus", medBus, 0.5*busThickness,
54c9a3d9 2360 0.5*busWidth, 0.5*busLength);
2361 TGeoVolume *pt1000 = mgr->MakeBox("ITSSPDpt1000",medPt1000,
2362 0.5*pt1000Thickness,0.5*pt1000Width, 0.5*pt1000Length);
2363 TGeoVolume *res = mgr->MakeBox("ITSSPDresistor", medRes, 0.5*resThickness,
2364 0.5*resWidth, 0.5*resLength);
2365 TGeoVolume *cap = mgr->MakeBox("ITSSPDcapacitor", medCap, 0.5*capThickness,
2366 0.5*capWidth, 0.5*capLength);
d0048cec 2367
954323d3 2368 char extname[12];
2369 sprintf(extname,"Extender1l%d",ilayer);
2370 TGeoVolume *ext1 = mgr->MakeBox(extname, medExt, 0.5*extThickness, 0.5*extWidth, 0.5*ext1Length);
2371 sprintf(extname,"Extender2l%d",ilayer);
2372 TGeoVolume *ext2 = mgr->MakeBox(extname, medExt, 0.5*extHeight - 2.*extThickness, 0.5*extWidth, 0.5*extThickness);
2373 TGeoVolume *ext3=0;
2374 sprintf(extname,"Extender3l%d",ilayer);
2375 if (ilayer==1) {
2376 Double_t halflen=(0.5*ext2Length + extThickness);
2377 Double_t xprof[6],yprof[6];
2378 Double_t alpha=24;
2379 xprof[0] = -halflen;
2380 yprof[0] = -0.5*extThickness;
2381 xprof[1] = halflen/2;
2382 yprof[1] = yprof[0];
2383 xprof[2] = xprof[1] + 0.5*halflen*CosD(alpha);
2384 yprof[2] = yprof[1] + 0.5*halflen*SinD(alpha);
2385 xprof[3] = xprof[2] - extThickness*SinD(alpha);
2386 yprof[3] = yprof[2] + extThickness*CosD(alpha);
2387 InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
2388 extThickness, xprof[4], yprof[4]);
2389 xprof[5] = xprof[0];
2390 yprof[5] = 0.5*extThickness;
2391 TGeoXtru *ext3sh = new TGeoXtru(2);
2392 ext3sh->DefinePolygon(6, xprof, yprof);
2393 ext3sh->DefineSection(0, -0.5*(extWidth-0.8*fgkmm));
2394 ext3sh->DefineSection(1, 0.5*(extWidth-0.8*fgkmm));
2395 ext3 = new TGeoVolume(extname, ext3sh, medExt);
2396 } else
2397 ext3 = mgr->MakeBox(extname, medExt, 0.5*extThickness, 0.5*(extWidth-0.8*fgkmm), 0.5*ext2Length + extThickness); // Hardcode fix of a small overlap
54c9a3d9 2398 bus->SetLineColor(kYellow + 2);
2399 pt1000->SetLineColor(kGreen + 3);
2400 res->SetLineColor(kRed + 1);
2401 cap->SetLineColor(kBlue - 7);
7f69c251 2402 ext1->SetLineColor(kGray);
3ffa185f 2403 ext2->SetLineColor(kGray);
2404 ext3->SetLineColor(kGray);
54c9a3d9 2405
2406 // ** MOVEMENTS AND POSITIONEMENT **
2407 // bus
d0048cec 2408 TGeoTranslation *trBus = new TGeoTranslation(0.5 * (busThickness -
54c9a3d9 2409 fullThickness), 0.0, 0.0);
2410 container->AddNode(bus, 1, trBus);
2411 Double_t zRef, yRef, x, y, z;
2412 if (isRight) {
2413 zRef = -0.5*fullLength;
2414 yRef = -0.5*fullWidth;
2415 } else {
2416 zRef = -0.5*fullLength;
2417 yRef = -0.5*fullWidth;
2418 } // end if isRight
2419 // pt1000
2420 x = 0.5*(pt1000Thickness - fullThickness) + busThickness;
2421 for (i = 0; i < 10; i++) {
2422 y = yRef + pt1000Y;
2423 z = zRef + pt1000Z[i];
2424 TGeoTranslation *tr = new TGeoTranslation(x, y, z);
2425 container->AddNode(pt1000, i+1, tr);
2426 } // end for i
2427 // capacitors
2428 x = 0.5*(capThickness - fullThickness) + busThickness;
2429 for (i = 0; i < 2; i++) {
2430 y = yRef + capY[i];
2431 z = zRef + capZ[i];
2432 TGeoTranslation *tr = new TGeoTranslation(x, y, z);
2433 container->AddNode(cap, i+1, tr);
2434 } // end for i
2435 // resistors
2436 x = 0.5*(resThickness - fullThickness) + busThickness;
2437 for (i = 0; i < 2; i++) {
2438 y = yRef + resY[i];
2439 z = zRef + resZ[i];
2440 TGeoTranslation *tr = new TGeoTranslation(x, y, z);
2441 container->AddNode(res, i+1, tr);
2442 } // end for i
d0048cec 2443
7f69c251 2444 // extender
22726349 2445 if (ilayer == 2) {
3ffa185f 2446 if (isRight) {
2447 y = 0.5 * (fullWidth - extWidth) - 0.1;
2448 z = 0.5 * (-fullLength + fgkmm * 10.0);
2449 }
2450 else {
2451 y = 0.5 * (fullWidth - extWidth) - 0.1;
2452 z = 0.5 * ( fullLength - fgkmm * 10.0);
2453 }
22726349 2454 }
2455 else {
2456 if (isRight) {
2457 y = -0.5 * (fullWidth - extWidth);
2458 z = 0.5 * (-fullLength + fgkmm * 10.0);
2459 }
2460 else {
2461 y = -0.5 * (fullWidth - extWidth);
2462 z = 0.5 * ( fullLength - fgkmm * 10.0);
2463 }
2464 }
3ffa185f 2465 x = 0.5 * (extThickness - fullThickness) + busThickness;
2466 //y = 0.5 * (fullWidth - extWidth);
2467 TGeoTranslation *trExt1 = new TGeoTranslation(x, y, z);
2468 if (isRight) {
2469 z -= 0.5 * (ext1Length - extThickness);
2470 }
2471 else {
2472 z += 0.5 * (ext1Length - extThickness);
2473 }
2474 x += 0.5*(extHeight - 3.*extThickness);
2475 TGeoTranslation *trExt2 = new TGeoTranslation(x, y, z);
2476 if (isRight) {
2477 z -= 0.5 * (ext2Length - extThickness) + 2.5*extThickness;
2478 }
2479 else {
2480 z += 0.5 * (ext2Length - extThickness) + 2.5*extThickness;
2481 }
2482 x += 0.5*(extHeight - extThickness) - 2.*extThickness;
954323d3 2483 TGeoCombiTrans *trExt3=0;
2484 if (ilayer==1) {
2485 if (isRight)
2486 trExt3 = new TGeoCombiTrans(x, y, z, new TGeoRotation("",0.,-90.,90.));
2487 else
2488 trExt3 = new TGeoCombiTrans(x, y, z, new TGeoRotation("",0., 90.,90.));
2489 } else
2490 trExt3 = new TGeoCombiTrans(x, y, z, 0);
3ffa185f 2491 container->AddNode(ext1, 0, trExt1);
2492 container->AddNode(ext2, 0, trExt2);
2493 container->AddNode(ext3, 0, trExt3);
d0048cec 2494
54c9a3d9 2495 sizes[3] = yRef + pt1000Y;
2496 sizes[4] = zRef + pt1000Z[2];
2497 sizes[5] = zRef + pt1000Z[7];
d0048cec 2498
54c9a3d9 2499 return container;
592651e2 2500}
7f69c251 2501
2502//______________________________________________________________________
44d18d38 2503TList* AliITSv11GeometrySPD::CreateConeModule(Bool_t sideC, const Double_t angrot,
96eb8210 2504 TGeoManager *mgr) const
7f69c251 2505{
96eb8210 2506 //
2507 // Creates all services modules and places them in a TList
2508 // angrot is the rotation angle (passed as an argument to avoid
2509 // defining the same quantity in two different places)
2510 //
45c52bb2 2511 // Created: ?? ??? 2008 A. Pulvirenti
2512 // Updated: 03 May 2010 M. Sitta
2513 // Updated: 20 Jun 2010 A. Pulvirenti Optical patch panels
2514 // Updated: 22 Jun 2010 M. Sitta Fiber cables
c890eba4 2515 // Updated: 04 Jul 2010 M. Sitta Water cooling
44d18d38 2516 // Updated: 08 Jul 2010 A. Pulvirenti Air cooling on Side C
96eb8210 2517 //
2518
7f69c251 2519 TGeoMedium *medInox = GetMedium("INOX$",mgr);
45c52bb2 2520 //TGeoMedium *medExt = GetMedium("SDDKAPTON (POLYCH2)$", mgr);
2521 TGeoMedium *medExtB = GetMedium("SPD-BUS CU KAPTON$", mgr);
2522 TGeoMedium *medExtM = GetMedium("SPD-MCM CU KAPTON$", mgr);
3ffa185f 2523 TGeoMedium *medPlate = GetMedium("SPD C (M55J)$", mgr);
96eb8210 2524 TGeoMedium *medFreon = GetMedium("Freon$", mgr);
2525 TGeoMedium *medGas = GetMedium("GASEOUS FREON$", mgr);
45c52bb2 2526 TGeoMedium *medFibs = GetMedium("SDD OPTICFIB$",mgr);
c890eba4 2527 TGeoMedium *medCopper= GetMedium("COPPER$",mgr);
44d18d38 2528 TGeoMedium *medPVC = GetMedium("PVC$",mgr);
d0048cec 2529
3ffa185f 2530 Double_t extThickness = fgkmm * 0.25;
2531 Double_t ext1Length = fgkmm * (26.7 - 10.0);
96eb8210 2532// Double_t ext2Length = fgkmm * (285.0 - ext1Length + extThickness);
2533 Double_t ext2Length = fgkmm * 285.0 - ext1Length + extThickness;
d0048cec 2534
96eb8210 2535 const Double_t kCableThickness = 1.5 *fgkmm;
954323d3 2536 Double_t cableL0 = 10.0 * fgkmm;
96eb8210 2537 Double_t cableL1 = 340.0 * fgkmm - extThickness - ext1Length - ext2Length;
2538 Double_t cableL2 = 300.0 * fgkmm;
7f69c251 2539 //Double_t cableL3 = 570.0 * fgkmm;
2540 Double_t cableL3 = 57.0 * fgkmm;
2541 Double_t cableW1 = 11.0 * fgkmm;
2542 Double_t cableW2 = 30.0 * fgkmm;
2543 Double_t cableW3 = 50.0 * fgkmm;
d0048cec 2544
954323d3 2545 const Double_t kMCMLength = cableL0 + cableL1 + cableL2 + cableL3;
96eb8210 2546 const Double_t kMCMWidth = cableW1;
2547 const Double_t kMCMThickness = 1.2 *fgkmm;
d0048cec 2548
96eb8210 2549 const Double_t kPlateLength = 200.0 *fgkmm;
2550 const Double_t kPlateWidth = 50.0 *fgkmm;
2551 const Double_t kPlateThickness = 5.0 *fgkmm;
2552
45c52bb2 2553 const Double_t kConeTubeRmin = 2.0 *fgkmm;
2554 const Double_t kConeTubeRmax = 3.0 *fgkmm;
96eb8210 2555
45c52bb2 2556 const Double_t kHorizTubeLen = 150.0 *fgkmm;
4c8afd2e 2557 const Double_t kYtoHalfStave = 9.5 *fgkmm;
c890eba4 2558
2559 const Double_t kWaterCoolRMax = 2.6 *fgkmm;
2560 const Double_t kWaterCoolThick = 0.04 *fgkmm;
2561 const Double_t kWaterCoolLen = 250.0 *fgkmm;
2562 const Double_t kWCPlateThick = 0.5 *fgkmm;
2563 const Double_t kWCPlateWide = 33.0 *fgkmm;
2564 const Double_t kWCPlateLen = 230.0 *fgkmm;
2565 const Double_t kWCFittingRext1 = 2.4 *fgkmm;
2566 const Double_t kWCFittingRext2 = 3.7 *fgkmm;
2567 const Double_t kWCFittingRint1 = 1.9 *fgkmm;
2568 const Double_t kWCFittingRint2 = kWaterCoolRMax;
2569 const Double_t kWCFittingLen1 = 7.0 *fgkmm;
2570 const Double_t kWCFittingLen2 = 8.0 *fgkmm;
44d18d38 2571
2572 const Double_t kCollWidth = 40.0 *fgkmm;
2573 const Double_t kCollLength = 60.0 *fgkmm;
2574 const Double_t kCollThickness = 10.0 *fgkmm;
2575 const Double_t kCollTubeThick = 1.0 *fgkmm;
2576 const Double_t kCollTubeRadius = 7.0 *fgkmm;
2577 const Double_t kCollTubeLength = 190.0 *fgkmm;
45c52bb2 2578
2579 const Double_t kOptFibDiamet = 4.5 *fgkmm;
d0048cec 2580
7f69c251 2581 Double_t x[12], y[12];
96eb8210 2582 Double_t xloc, yloc, zloc;
2583
2584 Int_t kPurple = 6; // Purple (Root does not define it)
2585
c890eba4 2586 TGeoVolumeAssembly* container[5];
96eb8210 2587 container[0] = new TGeoVolumeAssembly("ITSSPDConeModule");
2588 container[1] = new TGeoVolumeAssembly("ITSSPDCoolingModuleSideA");
2589 container[2] = new TGeoVolumeAssembly("ITSSPDCoolingModuleSideC");
45c52bb2 2590 container[3] = new TGeoVolumeAssembly("ITSSPDPatchPanelModule");
c890eba4 2591 container[4] = new TGeoVolumeAssembly("ITSSPDWaterCooling");
d0048cec 2592
96eb8210 2593 // The extender on the cone as a Xtru
954323d3 2594 x[0] = -cableL0;
7f69c251 2595 y[0] = 0.0 + 0.5 * cableW1;
d0048cec 2596
954323d3 2597 x[1] = x[0] + cableL0 + cableL1 - 0.5*(cableW2 - cableW1);
7f69c251 2598 y[1] = y[0];
d0048cec 2599
954323d3 2600 x[2] = x[0] + cableL0 + cableL1;
7f69c251 2601 y[2] = y[1] + 0.5*(cableW2 - cableW1);
d0048cec 2602
7f69c251 2603 x[3] = x[2] + cableL2;
2604 y[3] = y[2];
d0048cec 2605
7f69c251 2606 x[4] = x[3] + 0.5*(cableW3 - cableW2);
2607 y[4] = y[3] + 0.5*(cableW3 - cableW2);
d0048cec 2608
7f69c251 2609 x[5] = x[4] + cableL3 - 0.5*(cableW3 - cableW2);
2610 y[5] = y[4];
d0048cec 2611
7f69c251 2612 for (Int_t i = 6; i < 12; i++) {
2613 x[i] = x[11 - i];
2614 y[i] = -y[11 - i];
2615 }
d0048cec 2616
7f69c251 2617 TGeoXtru *shCable = new TGeoXtru(2);
2618 shCable->DefinePolygon(12, x, y);
96eb8210 2619 shCable->DefineSection(0, 0.0);
2620 shCable->DefineSection(1, kCableThickness);
d0048cec 2621
45c52bb2 2622 TGeoVolume *volCable = new TGeoVolume("ITSSPDExtender", shCable, medExtB);
7f69c251 2623 volCable->SetLineColor(kGreen);
d0048cec 2624
96eb8210 2625 // The MCM extender on the cone as a Xtru
2626 TGeoBBox *shMCMExt = new TGeoBBox(0.5*kMCMLength,
2627 0.5*kMCMWidth,
2628 0.5*kMCMThickness);
d0048cec 2629
96eb8210 2630 TGeoVolume *volMCMExt = new TGeoVolume("ITSSPDExtenderMCM",
45c52bb2 2631 shMCMExt, medExtM);
7f69c251 2632 volMCMExt->SetLineColor(kGreen+3);
d0048cec 2633
96eb8210 2634 // The support plate on the cone as a composite shape
2635 Double_t thickness = kCableThickness + kMCMThickness;
2636 TGeoBBox *shOut = new TGeoBBox("ITSSPD_shape_plateout",
2637 0.5*kPlateLength,
2638 0.5*kPlateWidth,
2639 0.5*kPlateThickness);
2640 TGeoBBox *shIn = new TGeoBBox("ITSSPD_shape_platein" ,
2641 0.5*kPlateLength,
2642 0.5*cableW2,
2643 0.5*thickness);
2644 Char_t string[255];
2645 sprintf(string, "%s-%s", shOut->GetName(), shIn->GetName());
2646 TGeoCompositeShape *shPlate = new TGeoCompositeShape("ITSSPDPlate_shape",
2647 string);
d0048cec 2648
96eb8210 2649 TGeoVolume *volPlate = new TGeoVolume("ITSSPDPlate",
2650 shPlate, medPlate);
2651 volPlate->SetLineColor(kRed);
44d18d38 2652
2653 // The air cooling tubes
2654 TGeoBBox *shCollBox = new TGeoBBox("ITSSPD_shape_collector_box", 0.5*kCollLength, 0.5*kCollWidth, 0.5*kCollThickness);
2655 TGeoTube *shCollTube = new TGeoTube("ITSSPD_shape_collector_tube",kCollTubeRadius - kCollTubeThick, kCollTubeRadius, 0.5*kCollTubeLength);
2656 TGeoVolume *volCollBox = new TGeoVolume("ITSSPDCollectorBox", shCollBox, medPVC);
2657 TGeoVolume *volCollTube = new TGeoVolume("ITSSPDCollectorTube", shCollTube, medPVC);
2658 volCollBox->SetLineColor(kAzure);
2659 volCollTube->SetLineColor(kAzure);
d0048cec 2660
96eb8210 2661 // The cooling tube on the cone as a Ctub
2662 Double_t tubeLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave;
2663 TGeoCtub *shTube = new TGeoCtub(0, kConeTubeRmax, 0.5*tubeLength, 0, 360,
2664 0, SinD(angrot/2), -CosD(angrot/2),
2665 0, 0, 1);
2666
2667 TGeoVolume *volTubeA = new TGeoVolume("ITSSPDCoolingTubeOnConeA",
2668 shTube, medInox);
2669 volTubeA->SetLineColor(kGray);
2670
2671 TGeoVolume *volTubeC = new TGeoVolume("ITSSPDCoolingTubeOnConeC",
2672 shTube, medInox);
2673 volTubeC->SetLineColor(kGray);
2674
2675 // The freon in the cooling tubes on the cone as a Ctub
2676 TGeoCtub *shFreon = new TGeoCtub(0, kConeTubeRmin, 0.5*tubeLength, 0, 360,
2677 0, SinD(angrot/2), -CosD(angrot/2),
2678 0, 0, 1);
2679
2680 TGeoVolume *volFreon = new TGeoVolume("ITSSPDCoolingFreonOnCone",
2681 shFreon, medFreon);
2682 volFreon->SetLineColor(kPurple);
2683
2684 TGeoVolume *volGasFr = new TGeoVolume("ITSSPDCoolingFreonGasOnCone",
2685 shFreon, medGas);
2686 volGasFr->SetLineColor(kPurple);
2687
2688 // The cooling tube inside the cylinder as a Ctub
2689 TGeoCtub *shCylTub = new TGeoCtub(0, kConeTubeRmax,
2690 0.5*kHorizTubeLen, 0, 360,
2691 0, 0, -1,
2692 0, SinD(angrot/2), CosD(angrot/2));
2693
2694 TGeoVolume *volCylTubA = new TGeoVolume("ITSSPDCoolingTubeOnCylA",
2695 shCylTub, medInox);
2696 volCylTubA->SetLineColor(kGray);
2697
2698 TGeoVolume *volCylTubC = new TGeoVolume("ITSSPDCoolingTubeOnCylC",
2699 shCylTub, medInox);
2700 volCylTubC->SetLineColor(kGray);
2701
2702 // The freon in the cooling tubes in the cylinder as a Ctub
2703 TGeoCtub *shCylFr = new TGeoCtub(0, kConeTubeRmin,
2704 0.5*kHorizTubeLen, 0, 360,
2705 0, 0, -1,
2706 0, SinD(angrot/2), CosD(angrot/2));
2707
2708 TGeoVolume *volCylFr = new TGeoVolume("ITSSPDCoolingFreonOnCyl",
2709 shCylFr, medFreon);
2710 volCylFr->SetLineColor(kPurple);
2711
2712 TGeoVolume *volCylGasFr = new TGeoVolume("ITSSPDCoolingFreonGasOnCyl",
2713 shCylFr, medGas);
2714 volCylGasFr->SetLineColor(kPurple);
2715
45c52bb2 2716 // The optical fibers bundle on the cone as a Tube
2717 Double_t optLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave;
2718 TGeoTube *shOptFibs = new TGeoTube(0., 0.5*kOptFibDiamet, 0.5*optLength);
2719
2720 TGeoVolume *volOptFibs = new TGeoVolume("ITSSPDOpticalFibersOnCone",
2721 shOptFibs, medFibs);
2722 volOptFibs->SetLineColor(kOrange);
2723
2724 // The optical patch panels
2725 TArrayD psizes;
2726 TGeoVolume *volPatch = CreatePatchPanel(psizes, mgr);
2727
c890eba4 2728 // The water cooling tube as a Tube
2729 TGeoTube *shWatCool = new TGeoTube(kWaterCoolRMax-kWaterCoolThick,
2730 kWaterCoolRMax, kWaterCoolLen/2);
2731
2732 TGeoVolume *volWatCool = new TGeoVolume("ITSSPDWaterCoolingOnCone",
2733 shWatCool, medInox);
2734 volWatCool->SetLineColor(kGray);
2735
2736 // The support plate for the water tubes: a Tubs and a BBox
2737 TGeoTubeSeg *shWCPltT = new TGeoTubeSeg(kWaterCoolRMax,
2738 kWaterCoolRMax+kWCPlateThick,
2739 kWCPlateLen/2, 180., 360.);
2740
2741 Double_t plateBoxWide = (kWCPlateWide - 2*kWaterCoolRMax)/2;
2742 TGeoBBox *shWCPltB = new TGeoBBox(plateBoxWide/2,
2743 kWCPlateThick/2,
2744 kWCPlateLen/2);
2745
2746 TGeoVolume *volWCPltT = new TGeoVolume("ITSSPDWaterCoolingTubsPlate",
2747 shWCPltT, medPlate);
2748 volWCPltT->SetLineColor(kRed);
2749
2750 TGeoVolume *volWCPltB = new TGeoVolume("ITSSPDWaterCoolingBoxPlate",
2751 shWCPltB, medPlate);
2752 volWCPltB->SetLineColor(kRed);
2753
2754 // The fitting for the water cooling tube: a Pcon
2755 TGeoPcon *shFitt = new TGeoPcon(0., 360., 4);
2756 shFitt->Z(0) = -kWCFittingLen1;
2757 shFitt->Rmin(0) = kWCFittingRint1;
2758 shFitt->Rmax(0) = kWCFittingRext1;
2759
2760 shFitt->Z(1) = 0;
2761 shFitt->Rmin(1) = kWCFittingRint1;
2762 shFitt->Rmax(1) = kWCFittingRext1;
2763
2764 shFitt->Z(2) = 0;
2765 shFitt->Rmin(2) = kWCFittingRint2;
2766 shFitt->Rmax(2) = kWCFittingRext2;
2767
2768 shFitt->Z(3) = kWCFittingLen2;
2769 shFitt->Rmin(3) = kWCFittingRint2;
2770 shFitt->Rmax(3) = kWCFittingRext2;
2771
2772 TGeoVolume *volFitt = new TGeoVolume("ITSSPDWaterCoolingFitting",
2773 shFitt, medCopper);
2774 volFitt->SetLineColor(kOrange);
2775
96eb8210 2776 // Now place everything in the containers
2777 volTubeA->AddNode(volGasFr, 1, 0);
2778 volTubeC->AddNode(volFreon, 1, 0);
2779
2780 volCylTubA->AddNode(volCylGasFr, 1, 0);
2781 volCylTubC->AddNode(volCylFr , 1, 0);
2782
2783 container[0]->AddNode(volCable, 1, 0);
2784
954323d3 2785 xloc = shMCMExt->GetDX() - cableL0;
96eb8210 2786 zloc = shMCMExt->GetDZ();
2787 container[0]->AddNode(volMCMExt, 1,
2788 new TGeoTranslation( xloc, 0.,-zloc));
2789
2790 xloc = shMCMExt->GetDX();
2791 zloc = shCable->GetZ(1)/2 - shMCMExt->GetDZ();
2792 container[0]->AddNode(volPlate, 1,
2793 new TGeoTranslation( xloc, 0., zloc));
2794
45c52bb2 2795 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
2796 rot2->SetName("rotPatch");
2797 rot2->RotateX(90.0);
2798 rot2->RotateY(163.0);
2799 //rot2->RotateZ(132.5);
2800
44d18d38 2801 // add collectors only on side C
2802 if (sideC)
2803 {
2804 TGeoTranslation *trCollBox = new TGeoTranslation(xloc - 0.5*kPlateLength + 0.5*kCollLength, 0.0, +0.5*(kPlateThickness+1.1*kCollThickness));
2805 TGeoRotation *rotCollTube = new TGeoRotation(*gGeoIdentity);
2806 rotCollTube->RotateY(90.0);
2807 TGeoCombiTrans *trCollTube = new TGeoCombiTrans(xloc + 0.5*kCollTubeLength - (0.5*kPlateLength - kCollLength), 0.0, +0.5*(kPlateThickness+2.0*kCollTubeRadius+kCollTubeThick), rotCollTube);
2808 container[0]->AddNode(volCollBox, 1, trCollBox);
2809 container[0]->AddNode(volCollTube, 1, trCollTube);
2810 }
2811
45c52bb2 2812 Double_t dxPatch = 2.9;
2813 Double_t dzPatch = 2.8;
2814 TGeoCombiTrans *tr2 = new TGeoCombiTrans(1.7*ext2Length - dxPatch, 0.0, dzPatch, rot2);
2815 container[3]->AddNode(volPatch, 0, tr2);
2816
96eb8210 2817 xloc = shTube->GetRmax();
2818 yloc = shTube->GetRmax();
2819 zloc = shTube->GetDz() - shTube->GetRmax() - kYtoHalfStave;
2820 container[1]->AddNode(volTubeA, 1,
2821 new TGeoTranslation(-xloc, -yloc, zloc));
2822 container[2]->AddNode(volTubeC, 1,
2823 new TGeoTranslation(-xloc, -yloc, zloc));
2824
2825 xloc = shTube->GetRmax();
2826 yloc = (shCylTub->GetDz())*SinD(angrot) - shTube->GetRmax();
2827 zloc = (shCylTub->GetDz())*CosD(angrot) + shTube->GetRmax() +kYtoHalfStave;
2828 container[1]->AddNode(volCylTubA, 1,
2829 new TGeoCombiTrans(-xloc, yloc,-zloc,
2830 new TGeoRotation("",0.,angrot,0.)));
2831 container[2]->AddNode(volCylTubC, 1,
2832 new TGeoCombiTrans(-xloc, yloc,-zloc,
2833 new TGeoRotation("",0.,angrot,0.)));
2834
45c52bb2 2835 xloc = shOptFibs->GetRmax() + 2*shTube->GetRmax();
c890eba4 2836 yloc = 1.6*shOptFibs->GetRmax();
45c52bb2 2837 zloc = shOptFibs->GetDZ() - shTube->GetRmax() - kYtoHalfStave;
2838 container[1]->AddNode(volOptFibs, 1,
2839 new TGeoTranslation(-xloc, -yloc, zloc));
2840 container[2]->AddNode(volOptFibs, 1,
2841 new TGeoTranslation(-xloc, -yloc, zloc));
2842
c890eba4 2843 yloc = shWatCool->GetRmax();
2844 zloc = (2*shTube->GetDz() - shTube->GetRmax() - kYtoHalfStave)/2;
2845 container[4]->AddNode(volWatCool, 1,
2846 new TGeoTranslation(0, -yloc, zloc));
2847
2848 container[4]->AddNode(volWCPltT, 1,
2849 new TGeoTranslation(0, -yloc, zloc));
2850
2851 yloc -= shWCPltB->GetDY();
2852 xloc = shWatCool->GetRmax() + shWCPltB->GetDX();
2853 container[4]->AddNode(volWCPltB, 1,
2854 new TGeoTranslation( xloc, -yloc, zloc));
2855 container[4]->AddNode(volWCPltB, 2,
2856 new TGeoTranslation(-xloc, -yloc, zloc));
2857
2858 yloc = shWatCool->GetRmax();
2859 zloc -= shWatCool->GetDz();
2860 container[4]->AddNode(volFitt, 1,
2861 new TGeoTranslation(0, -yloc, zloc));
2862
96eb8210 2863 // Finally create the list of assemblies and return it to the caller
0b9c8a10 2864 TList* conemodulelist = new TList();
0b9c8a10 2865 conemodulelist->Add(container[0]);
2866 conemodulelist->Add(container[1]);
96eb8210 2867 conemodulelist->Add(container[2]);
45c52bb2 2868 conemodulelist->Add(container[3]);
c890eba4 2869 conemodulelist->Add(container[4]);
d0048cec 2870
0b9c8a10 2871 return conemodulelist;
7f69c251 2872}
2873
2874//______________________________________________________________________
2875void AliITSv11GeometrySPD::CreateCones(TGeoVolume *moth) const
2876{
96eb8210 2877 //
2878 // Places all services modules in the mother reference system
2879 //
2880 // Created: ?? ??? 2008 Alberto Pulvirenti
2881 // Updated: 03 May 2010 Mario Sitta
c890eba4 2882 // Updated: 04 Jul 2010 Mario Sitta Water cooling
96eb8210 2883 //
d0048cec 2884
96eb8210 2885 const Int_t kNumberOfModules = 10;
2886
2887 const Double_t kInnerRadius = 80.775*fgkmm;
2888 const Double_t kZTrans = 452.000*fgkmm;
2889 const Double_t kAlphaRot = 46.500*fgkDegree;
c890eba4 2890 const Double_t kAlphaSpaceCool = 9.200*fgkDegree;
96eb8210 2891
44d18d38 2892 TList* modulelistA = CreateConeModule(kFALSE, 90-kAlphaRot);
2893 TList* modulelistC = CreateConeModule(kTRUE , 90-kAlphaRot);
2894 TList* &modulelist = modulelistC;
2895 TGeoVolumeAssembly* module, *moduleA, *moduleC;
d0048cec 2896
96eb8210 2897 Double_t xloc, yloc, zloc;
2898
7f69c251 2899 //Double_t angle[10] = {18., 54., 90., 126., 162., -18., -54., -90., -126., -162.};
45c52bb2 2900 // anglem for cone modules (cables and cooling tubes)
2901 // anglep for pathc panels
96eb8210 2902 Double_t anglem[10] = {18., 54., 90., 126., 162., 198., 234., 270., 306., 342.};
45c52bb2 2903 Double_t anglep[10] = {18., 62., 90., 115., 162., 198., 242., 270., 295., 342.};
96eb8210 2904// Double_t angle1m[10] = {23., 53., 90., 127., 157., 203.0, 233.0, 270.0, 307.0, 337.0};
2905// Double_t angle2m[10] = {18., 53., 90., 126., 162., 198.0, 233.0, 270.0, 309.0, 342.0};
2906// Double_t angle1c[10] = {23., 53., 90., 124., 157., 203.0, 233.0, 270.0, 304.0, 337.0};
2907// Double_t angle2c[10] = {18., 44., 90., 126., 162., 198.0, 223.0, 270.0, 309.0, 342.0};
0b9c8a10 2908
2909 // First add the cables
44d18d38 2910 moduleA = (TGeoVolumeAssembly*)modulelistA->At(0);
2911 moduleC = (TGeoVolumeAssembly*)modulelistC->At(0);
96eb8210 2912 for (Int_t i = 0; i < kNumberOfModules; i++) {
7f69c251 2913 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
96eb8210 2914 rot1->RotateY(-kAlphaRot);
2915 rot1->RotateZ(anglem[i]);
2916 xloc = kInnerRadius*CosD(anglem[i]);
2917 yloc = kInnerRadius*SinD(anglem[i]);
2918 zloc = kZTrans;
44d18d38 2919 moth->AddNode(moduleA, 2*i+2,
96eb8210 2920 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
2921
7f69c251 2922 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
96eb8210 2923 rot2->RotateY(180.-kAlphaRot);
2924 rot2->RotateZ(anglem[i]);
2925 xloc = kInnerRadius*CosD(anglem[i]);
2926 yloc = kInnerRadius*SinD(anglem[i]);
2927 zloc = kZTrans;
44d18d38 2928 moth->AddNode(moduleC, 2*i+1,
96eb8210 2929 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
0b9c8a10 2930 }
2931
96eb8210 2932 // Then the cooling tubes on Side A
0b9c8a10 2933 module = (TGeoVolumeAssembly*)modulelist->At(1);
96eb8210 2934 Double_t anglec;
2935 for (Int_t i = 0; i < kNumberOfModules; i++) {
2936 anglec = anglem[i] + kAlphaSpaceCool;
0b9c8a10 2937 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
c890eba4 2938 rot1->RotateX(-90.0+kAlphaRot-0.04); // 0.04 fixes small overlap
2939 rot1->RotateZ(-90.0+anglec);
96eb8210 2940 xloc = kInnerRadius*CosD(anglec);
2941 yloc = kInnerRadius*SinD(anglec);
c890eba4 2942 zloc = kZTrans+0.162; // 0.162 fixes small overlap
2943 moth->AddNode(module, 2*i+2,
96eb8210 2944 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
2945 }
2946
45c52bb2 2947 // And the cooling tubes on Side C
96eb8210 2948 module = (TGeoVolumeAssembly*)modulelist->At(2);
2949 for (Int_t i = 0; i < kNumberOfModules; i++) {
2950 anglec = anglem[i] - kAlphaSpaceCool;
0b9c8a10 2951 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
c890eba4 2952 rot2->RotateX(-90.0+kAlphaRot-0.04); // 0.04 fixes small overlap
96eb8210 2953 rot2->RotateY(180.);
c890eba4 2954 rot2->RotateZ(90.0+anglec);
96eb8210 2955 xloc = kInnerRadius*CosD(anglec);
2956 yloc = kInnerRadius*SinD(anglec);
c890eba4 2957 zloc = kZTrans+0.162; // 0.162 fixes small overlap
96eb8210 2958 moth->AddNode(module, 2*i+1,
2959 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
7f69c251 2960 }
96eb8210 2961
c890eba4 2962 // Then the water cooling tubes
2963 module = (TGeoVolumeAssembly*)modulelist->At(4);
2964 for (Int_t i = 1; i < kNumberOfModules; i++) { // i = 1,2,...,9
2965 if (i != 5) { // There is no tube in this position
2966 anglec = (anglem[i-1]+anglem[i])/2;
2967 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
2968 rot1->RotateX(-90.0+kAlphaRot);
2969 rot1->RotateZ(-90.0+anglec);
2970 xloc = kInnerRadius*CosD(anglec);
2971 yloc = kInnerRadius*SinD(anglec);
2972 zloc = kZTrans;
2973 moth->AddNode(module, 2*i+2,
2974 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
2975
2976 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
2977 rot2->RotateX(-90.0+kAlphaRot);
2978 rot2->RotateY(180.);
2979 rot2->RotateZ(90.0+anglec);
2980 xloc = kInnerRadius*CosD(anglec);
2981 yloc = kInnerRadius*SinD(anglec);
2982 zloc = kZTrans;
2983 moth->AddNode(module, 2*i+1,
2984 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
2985 }
2986 }
2987
45c52bb2 2988 // Finally the optical patch panels
2989 module = (TGeoVolumeAssembly*)modulelist->At(3);
2990 for (Int_t i = 0; i < kNumberOfModules; i++) {
2991 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
2992 rot1->RotateY(-kAlphaRot);
2993 rot1->RotateZ(anglep[i]);
2994 xloc = kInnerRadius*CosD(anglep[i]);
2995 yloc = kInnerRadius*SinD(anglep[i]);
2996 zloc = kZTrans;
c890eba4 2997 moth->AddNode(module, 2*i+2,
45c52bb2 2998 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
2999
3000 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
3001 rot2->RotateY(180.-kAlphaRot);
3002 rot2->RotateZ(anglep[i]);
3003 xloc = kInnerRadius*CosD(anglep[i]);
3004 yloc = kInnerRadius*SinD(anglep[i]);
3005 zloc = kZTrans;
3006 moth->AddNode(module, 2*i+1,
3007 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
3008 }
3009
7f69c251 3010}
3011
c890eba4 3012
54c9a3d9 3013//______________________________________________________________________
3014TGeoVolume* AliITSv11GeometrySPD::CreateExtender(
3015 const Double_t *extenderParams, const TGeoMedium *extenderMedium,
3016 TArrayD& sizes) const
bc3498f4 3017{
54c9a3d9 3018 //
3019 // ------------------ CREATE AN EXTENDER ------------------------
3020 //
3021 // This function creates the following picture (in plane xOy)
3022 // Should be useful for the definition of the pixel bus and MCM extenders
d0048cec 3023 // The origin corresponds to point 0 on the picture, at half-width
3024 // in Z direction
54c9a3d9 3025 //
3026 // Y 7 6 5
3027 // ^ +---+---------------------+
3028 // | / |
3029 // | / |
3030 // 0------> X / +---------------------+
3031 // / / 3 4
3032 // / /
3033 // 9 8 / /
3034 // +-----------+ /
3035 // | /
3036 // | /
3037 // ---> +-----------+---+
3038 // | 0 1 2
3039 // |
3040 // origin (0,0,0)
3041 //
3042 //
3043 // Takes 6 parameters in the following order :
3044 // |--> par 0 : inner length [0-1] / [9-8]
3045 // |--> par 1 : thickness ( = [0-9] / [4-5])
3046 // |--> par 2 : angle of the slope
3047 // |--> par 3 : total height in local Y direction
3048 // |--> par 4 : outer length [3-4] / [6-5]
3049 // |--> par 5 : width in local Z direction
3050 //
d0048cec 3051 Double_t slopeDeltaX = (extenderParams[3] - extenderParams[1]
3052 * TMath::Cos(extenderParams[2])) /
54c9a3d9 3053 TMath::Tan(extenderParams[2]);
3054 Double_t extenderXtruX[10] = {
3055 0 ,
3056 extenderParams[0] ,
d0048cec 3057 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2]) ,
54c9a3d9 3058 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
3059 slopeDeltaX ,
3060 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
d0048cec 3061 slopeDeltaX + extenderParams[4],
54c9a3d9 3062 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
d0048cec 3063 slopeDeltaX + extenderParams[4],
54c9a3d9 3064 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
d0048cec 3065 slopeDeltaX ,
54c9a3d9 3066 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
3067 slopeDeltaX - extenderParams[1] * TMath::Sin(extenderParams[2]) ,
3068 extenderParams[0] ,
3069 0
3070 };
3071 Double_t extenderXtruY[10] = {
3072 0 ,
3073 0 ,
3074 extenderParams[1] * (1-TMath::Cos(extenderParams[2])) ,
3075 extenderParams[3] - extenderParams[1] ,
3076 extenderParams[3] - extenderParams[1] ,
3077 extenderParams[3] ,
3078 extenderParams[3] ,
3079 extenderParams[3]-extenderParams[1]*(1-TMath::Cos(extenderParams[2])) ,
3080 extenderParams[1] ,
3081 extenderParams[1]
3082 };
592651e2 3083
54c9a3d9 3084 if (sizes.GetSize() != 3) sizes.Set(3);
3085 Double_t &thickness = sizes[0];
3086 Double_t &length = sizes[1];
3087 Double_t &width = sizes[2];
3088
3089 thickness = extenderParams[3];
3090 width = extenderParams[5];
3091 length = extenderParams[0]+extenderParams[1]*
3092 TMath::Sin(extenderParams[2])+slopeDeltaX+extenderParams[4];
3093
3094 // creation of the volume
3095 TGeoXtru *extenderXtru = new TGeoXtru(2);
3096 TGeoVolume *extenderXtruVol = new TGeoVolume("ITSSPDextender",extenderXtru,
3097 extenderMedium);
3098 extenderXtru->DefinePolygon(10,extenderXtruX,extenderXtruY);
3099 extenderXtru->DefineSection(0,-0.5*extenderParams[4]);
3100 extenderXtru->DefineSection(1, 0.5*extenderParams[4]);
3101 return extenderXtruVol;
3102}
c890eba4 3103
54c9a3d9 3104//______________________________________________________________________
3105TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateHalfStave(Bool_t isRight,
3106Int_t layer,Int_t idxCentral,Int_t idxSide,TArrayD &sizes,TGeoManager *mgr)
bc3498f4 3107{
54c9a3d9 3108 //
d0048cec 3109 // Implementation of an half-stave, which depends on the side where
3110 // we are on the stave. The convention for "left" and "right" is the
3111 // same as for the MCM. The return value is a TGeoAssembly which is
3112 // structured in such a way that the origin of its local reference
54c9a3d9 3113 // frame coincides with the origin of the whole stave.
3114 // The TArrayD passed by reference will contain details of the shape:
3115 // - sizes[0] = thickness
3116 // - sizes[1] = length
3117 // - sizes[2] = width
3118 // - sizes[3] = common 'x' position for eventual clips
3119 // - sizes[4] = common 'y' position for eventual clips
3120 // - sizes[5] = 'z' position of first clip
3121 // - sizes[6] = 'z' position of second clip
3122 //
3123
3124 // ** CHECK **
3125
3126 // idxCentral and idxSide must be different
3127 if (idxCentral == idxSide) {
3128 AliInfo("Ladders must be inserted in half-stave with "
3129 "different indexes.");
3130 idxSide = idxCentral + 1;
3131 AliInfo(Form("Central ladder will be inserted with index %d",
3132 idxCentral));
3133 AliInfo(Form("Side ladder will be inserted with index %d",idxSide));
3134 } // end if
3135
3136 // define the separations along Z direction between the objects
3137 Double_t sepLadderLadder = fgkmm * 0.2; // sep. btw the 2 ladders
d0048cec 3138 Double_t sepLadderCenter = fgkmm * 0.4; // sep. btw the "central" ladder
54c9a3d9 3139 // and the Z=0 plane in stave ref.
3140 Double_t sepLadderMCM = fgkmm * 0.3; // sep. btw the "external" ladder
3141 // and MCM
d0048cec 3142 Double_t sepBusCenter = fgkmm * 0.3; // sep. btw the bus central edge
54c9a3d9 3143 // and the Z=0 plane in stave ref.
3144
3145 // ** VOLUMES **
3146
3147 // grounding foil
3148 TArrayD grndSize(3);
3149 // This one line repalces the 3 bellow, BNS.
3150 TGeoVolume *grndVol = CreateGroundingFoil(isRight, grndSize, mgr);
3151 Double_t &grndThickness = grndSize[0];
3152 Double_t &grndLength = grndSize[1];
3153
3154 // ladder
3155 TArrayD ladderSize(3);
3156 TGeoVolume *ladder = CreateLadder(layer, ladderSize, mgr);
3157 Double_t ladderThickness = ladderSize[0];
3158 Double_t ladderLength = ladderSize[1];
3159 Double_t ladderWidth = ladderSize[2];
3160
3161 // MCM
3162 TArrayD mcmSize(3);
3163 TGeoVolumeAssembly *mcm = CreateMCM(!isRight,mcmSize,mgr);
3164 Double_t mcmThickness = mcmSize[0];
3165 Double_t mcmLength = mcmSize[1];
3166 Double_t mcmWidth = mcmSize[2];
d0048cec 3167
54c9a3d9 3168 // bus
3169 TArrayD busSize(6);
22726349 3170 TGeoVolumeAssembly *bus = CreatePixelBus(isRight, layer, busSize, mgr);
54c9a3d9 3171 Double_t busThickness = busSize[0];
3172 Double_t busLength = busSize[1];
3173 Double_t busWidth = busSize[2];
3174
3175 // glue between ladders and pixel bus
3176 TGeoMedium *medLadGlue = GetMedium("EPOXY$", mgr);
3177 Double_t ladGlueThickness = fgkmm * 0.1175 - fgkGapLadder;
3178 TGeoVolume *ladderGlue = mgr->MakeBox("ITSSPDladderGlue",medLadGlue,
3179 0.5*ladGlueThickness, 0.5*busWidth, 0.5*busLength);
3180 ladderGlue->SetLineColor(kYellow + 5);
3181
3182 // create references for the whole object, as usual
3183 sizes.Set(7);
3184 Double_t &fullThickness = sizes[0];
3185 Double_t &fullLength = sizes[1];
3186 Double_t &fullWidth = sizes[2];
d0048cec 3187
54c9a3d9 3188 // compute the full size of the container
3189 fullLength = sepLadderCenter+2.0*ladderLength+sepLadderMCM+
3190 sepLadderLadder+mcmLength;
3191 fullWidth = ladderWidth;
3192 fullThickness = grndThickness + fgkGapLadder + mcmThickness + busThickness;
ed0e944d 3193 //cout << "HSTAVE FULL THICKNESS = " << fullThickness << endl;
54c9a3d9 3194
3195 // ** MOVEMENTS **
3196
3197 // grounding foil (shifted only along thickness)
3198 Double_t xGrnd = -0.5*fullThickness + 0.5*grndThickness;
3199 Double_t zGrnd = -0.5*grndLength;
3200 if (!isRight) zGrnd = -zGrnd;
3201 TGeoTranslation *grndTrans = new TGeoTranslation(xGrnd, 0.0, zGrnd);
3202
3203 // ladders (translations along thickness and length)
d0048cec 3204 // layers must be sorted going from the one at largest Z to the
54c9a3d9 3205 // one at smallest Z:
3206 // -|Zmax| ------> |Zmax|
3207 // 3 2 1 0
d0048cec 3208 // then, for layer 1 ladders they must be placed exactly this way,
3209 // and in layer 2 at the opposite. In order to remember the placements,
3210 // we define as "inner" and "outer" ladder respectively the one close
54c9a3d9 3211 // to barrel center, and the one closer to MCM, respectively.
3212 Double_t xLad, zLadIn, zLadOut;
3213 xLad = xGrnd + 0.5*(grndThickness + ladderThickness) +
3214 0.01175 - fgkGapLadder;
3215 zLadIn = -sepLadderCenter - 0.5*ladderLength;
3216 zLadOut = zLadIn - sepLadderLadder - ladderLength;
3217 if (!isRight) {
3218 zLadIn = -zLadIn;
3219 zLadOut = -zLadOut;
3220 } // end if !isRight
3221 TGeoRotation *rotLad = new TGeoRotation(*gGeoIdentity);
3222 rotLad->RotateZ(90.0);
3223 rotLad->RotateY(180.0);
3224 Double_t sensWidth = fgkmm * 12.800;
3225 Double_t chipWidth = fgkmm * 15.950;
3226 Double_t guardRingWidth = fgkmm * 0.560;
3227 Double_t ladderShift = 0.5 * (chipWidth - sensWidth - 2.0*guardRingWidth);
3228 TGeoCombiTrans *trLadIn = new TGeoCombiTrans(xLad,ladderShift,zLadIn,
3229 rotLad);
3230 TGeoCombiTrans *trLadOut = new TGeoCombiTrans(xLad,ladderShift,zLadOut,
3231 rotLad);
3232
d0048cec 3233 // MCM (length and thickness direction, placing at same level as the
3234 // ladder, which implies to recompute the position of center, because
3235 // ladder and MCM have NOT the same thickness) the two copies of the
54c9a3d9 3236 // MCM are placed at the same distance from the center, on both sides
d0048cec 3237 Double_t xMCM = xGrnd + 0.5*grndThickness + 0.5*mcmThickness +
54c9a3d9 3238 0.01175 - fgkGapLadder;
3239 Double_t yMCM = 0.5*(fullWidth - mcmWidth);
3240 Double_t zMCM = zLadOut - 0.5*ladderLength - 0.5*mcmLength - sepLadderMCM;
d0048cec 3241 if (!isRight) zMCM = zLadOut + 0.5*ladderLength + 0.5*mcmLength +
54c9a3d9 3242 sepLadderMCM;
3243
3244 // create the correction rotations
3245 TGeoRotation *rotMCM = new TGeoRotation(*gGeoIdentity);
3246 rotMCM->RotateY(90.0);
3247 TGeoCombiTrans *trMCM = new TGeoCombiTrans(xMCM, yMCM, zMCM, rotMCM);
3248
3249 // glue between ladders and pixel bus
d0048cec 3250 Double_t xLadGlue = xLad + 0.5*ladderThickness + 0.01175 -
54c9a3d9 3251 fgkGapLadder + 0.5*ladGlueThickness;
3252
3253 // bus (length and thickness direction)
3254 Double_t xBus = xLadGlue + 0.5*ladGlueThickness + 0.5*busThickness;
7708d5f3 3255 Double_t yBus = 0.5*(fullWidth - busWidth) + 0.075; // Hardcode fix of a small overlap
54c9a3d9 3256 Double_t zBus = -0.5*busLength - sepBusCenter;
3257 if (!isRight) zBus = -zBus;
3258 TGeoTranslation *trBus = new TGeoTranslation(xBus, yBus, zBus);
3259
3260 TGeoTranslation *trLadGlue = new TGeoTranslation(xLadGlue, 0.0, zBus);
3261
3262 // create the container
3263 TGeoVolumeAssembly *container = 0;
3264 if (idxCentral+idxSide==5) {
3265 container = new TGeoVolumeAssembly("ITSSPDhalf-Stave1");
3266 } else {
3267 container = new TGeoVolumeAssembly("ITSSPDhalf-Stave0");
3268 } // end if
3269
3270 // add to container all objects
3271 container->AddNode(grndVol, 1, grndTrans);
3272 // ladders are inserted in different order to respect numbering scheme
3273 // which is inverted when going from outer to inner layer
3274 container->AddNode(ladder, idxCentral+1, trLadIn);
3275 container->AddNode(ladder, idxSide+1, trLadOut);
3276 container->AddNode(ladderGlue, 1, trLadGlue);
3277 container->AddNode(mcm, 1, trMCM);
3278 container->AddNode(bus, 1, trBus);
3279
3280 // since the clips are placed in correspondence of two pt1000s,
3281 // their position is computed here, but they are not added by default
3282 // it will be the StavesInSector method which will decide to add them
3283 // anyway, to recovery some size informations on the clip, it must be
3284 // created
3285 TArrayD clipSize;
3ffa185f 3286 // TGeoVolume *clipDummy = CreateClip(clipSize, kTRUE, mgr);
54c9a3d9 3287 CreateClip(clipSize, kTRUE, mgr);
3288 // define clip movements (width direction)
3289 sizes[3] = xBus + 0.5*busThickness;
3290 sizes[4] = 0.5 * (fullWidth - busWidth) - clipSize[6] - fgkmm*0.48;
3291 sizes[5] = zBus + busSize[4];
3292 sizes[6] = zBus + busSize[5];
3293
3294 return container;
592651e2 3295}
54c9a3d9 3296//______________________________________________________________________
3297TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateStave(Int_t layer,
3298 TArrayD &sizes, TGeoManager *mgr)
7855ea93 3299{
54c9a3d9 3300 //
3301 // This method uses all other ones which create pieces of the stave
3302 // and assemblies everything together, in order to return the whole
3303 // stave implementation, which is returned as a TGeoVolumeAssembly,
3304 // due to the presence of some parts which could generate fake overlaps
3305 // when put on the sector.
3306 // This assembly contains, going from bottom to top in the thickness
3307 // direction:
d0048cec 3308 // - the complete grounding foil, defined by the "CreateGroundingFoil"
3309 // method which already joins some glue and real groudning foil
54c9a3d9 3310 // layers for the whole stave (left + right);
d0048cec 3311 // - 4 ladders, which are sorted according to the ALICE numbering
54c9a3d9 3312 // scheme, which depends on the layer we are building this stave for;
3313 // - 2 MCMs (a left and a right one);
3314 // - 2 pixel buses (a left and a right one);
3315 // ---
3316 // Arguments:
d0048cec 3317 // - the layer number, which determines the displacement and naming
54c9a3d9 3318 // of sensitive volumes
d0048cec 3319 // - a TArrayD passed by reference which will contain the size
54c9a3d9 3320 // of virtual box containing the stave
3321 // - the TGeoManager
3322 //
3323
3324 // create the container
3325 TGeoVolumeAssembly *container = new TGeoVolumeAssembly(Form(
3326 "ITSSPDlay%d-Stave",layer));
3327 // define the indexes of the ladders in order to have the correct order
d0048cec 3328 // keeping in mind that the staves will be inserted as they are on layer
3329 // 2, while they are rotated around their local Y axis when inserted
3330 // on layer 1, so in this case they must be put in the "wrong" order
3331 // to turn out to be right at the end. The convention is:
54c9a3d9 3332 // -|Zmax| ------> |Zmax|
3333 // 3 2 1 0
d0048cec 3334 // with respect to the "native" stave reference frame, "left" is in
54c9a3d9 3335 // the positive Z this leads the definition of these indexes:
3336 Int_t idxCentralL, idxSideL, idxCentralR, idxSideR;
3337
3338 if (layer == 1) {
3339 idxSideL = 3;
3340 idxCentralL = 2;
3341 idxCentralR = 1;
3342 idxSideR = 0;
3343 } else {
3344 idxSideL = 0;
3345 idxCentralL = 1;
3346 idxCentralR = 2;
3347 idxSideR = 3;
3348 } // end if layer ==1
d0048cec 3349
54c9a3d9 3350 // create the two half-staves
3351 TArrayD sizeL, sizeR;
3352 TGeoVolumeAssembly *hstaveL = CreateHalfStave(kFALSE, layer, idxCentralL,
3353 idxSideL, sizeL,mgr);
3354 TGeoVolumeAssembly *hstaveR = CreateHalfStave(kTRUE, layer, idxCentralR,
3355 idxSideR, sizeR, mgr);
3356 // copy the size to the stave's one
3357 sizes.Set(9);
3358 sizes[0] = sizeL[0];
3359 sizes[1] = sizeR[1] + sizeL[1];
3360 sizes[2] = sizeL[2];
3361 sizes[3] = sizeL[3];
3362 sizes[4] = sizeL[4];
3363 sizes[5] = sizeL[5];
3364 sizes[6] = sizeL[6];
3365 sizes[7] = sizeR[5];
3366 sizes[8] = sizeR[6];
3367
3368 // add to container all objects
3369 container->AddNode(hstaveL, 1);
3370 container->AddNode(hstaveR, 1);
3371
3372 return container;
bc3498f4 3373}
54c9a3d9 3374//______________________________________________________________________
bc3498f4 3375void AliITSv11GeometrySPD::SetAddStave(Bool_t *mask)
3376{
54c9a3d9 3377 //
3378 // Define a mask which states qhich staves must be placed.
d0048cec 3379 // It is a string which must contain '0' or '1' depending if
54c9a3d9 3380 // a stave must be placed or not.
d0048cec 3381 // Each place is referred to one of the staves, so the first
54c9a3d9 3382 // six characters of the string will be checked.
3383 //
3384 Int_t i;
3385
3386 for (i = 0; i < 6; i++) fAddStave[i] = mask[i];
bc3498f4 3387}
54c9a3d9 3388//______________________________________________________________________
3389void AliITSv11GeometrySPD::StavesInSector(TGeoVolume *moth, TGeoManager *mgr)
3390{
3391 //
3392 // Unification of essentially two methods:
3393 // - the one which creates the sector structure
3394 // - the one which returns the complete stave
3395 // ---
3396 // For compatibility, this method requires the same arguments
3397 // asked by "CarbonFiberSector" method, which is recalled here.
3398 // Like this cited method, this one does not return any value,
3399 // but it inserts in the mother volume (argument 'moth') all the stuff
3400 // which composes the complete SPD sector.
3401 // ---
d0048cec 3402 // In the following, the stave numbering order used for arrays is the
54c9a3d9 3403 // same as defined in the GetSectorMountingPoints():
3404 // /5
3405 // /\/4
3406 // 1\ \/3
3407 // 0|___\/2
3408 // ---
3409 // Arguments: see description of "CarbonFiberSector" method.
3410 //
3411
d0048cec 3412 Double_t shift[6]; // shift from the innermost position in the
3413 // sector placement plane (where the stave
3414 // edge is in the point where the rounded
54c9a3d9 3415 // corner begins)
3416
3417 shift[0] = fgkmm * -0.691;
3418 shift[1] = fgkmm * 5.041;
3419 shift[2] = fgkmm * 1.816;
3420 shift[3] = fgkmm * -0.610;
3421 shift[4] = fgkmm * -0.610;
3422 shift[5] = fgkmm * -0.610;
d0048cec 3423
3ffa185f 3424 // corrections after interaction with Andrea and CAD
3425 Double_t corrX[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3426 Double_t corrY[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
d0048cec 3427
3ffa185f 3428 corrX[0] = 0.0046;
3429 corrX[1] = -0.0041;
3430 corrX[2] = corrX[3] = corrX[4] = corrX[5] = -0.0016;
d0048cec 3431
3ffa185f 3432 corrY[0] = -0.0007;
3433 corrY[1] = -0.0009;
3434 corrY[2] = corrY[3] = corrY[4] = corrY[5] = -0.0003;
d0048cec 3435
3ffa185f 3436 corrX[0] += 0.00026;
3437 corrY[0] += -0.00080;
d0048cec 3438
3ffa185f 3439 corrX[1] += 0.00018;
3440 corrY[1] += -0.00086;
d0048cec 3441
3ffa185f 3442 corrX[2] += 0.00020;
3443 corrY[2] += -0.00062;
d0048cec 3444
3ffa185f 3445 corrX[3] += 0.00017;
3446 corrY[3] += -0.00076;
d0048cec 3447
3ffa185f 3448 corrX[4] += 0.00016;
3449 corrY[4] += -0.00096;
d0048cec 3450
3ffa185f 3451 corrX[5] += 0.00018;
3452 corrY[5] += -0.00107;
d0048cec 3453
54c9a3d9 3454 // create stave volumes (different for layer 1 and 2)
3455 TArrayD staveSizes1(9), staveSizes2(9), clipSize(5);
3456 Double_t &staveHeight = staveSizes1[2], &staveThickness = staveSizes1[0];
3457 TGeoVolume *stave1 = CreateStave(1, staveSizes1, mgr);
3458 TGeoVolume *stave2 = CreateStave(2, staveSizes2, mgr);
3459 TGeoVolume *clip = CreateClip(clipSize, kFALSE, mgr);
3460
3461 Double_t xL, yL; // leftmost edge of mounting point (XY projection)
3462 Double_t xR, yR; // rightmost edge of mounting point (XY projection)
3463 Double_t xM, yM; // middle point of the segment L-R
3464 Double_t dx, dy; // (xL - xR) and (yL - yR)
3465 Double_t widthLR; // width of the segment L-R
3466 Double_t angle; // stave rotation angle in degrees
d0048cec 3467 Double_t diffWidth; // difference between mounting plane width and
54c9a3d9 3468 // stave width (smaller)
3469 Double_t xPos, yPos; // final translation of the stave
3470 Double_t parMovement; // translation in the LR plane direction
d0048cec 3471
54c9a3d9 3472 staveThickness += fgkGapHalfStave;
d0048cec 3473
54c9a3d9 3474 // loop on staves
3475 Int_t i, iclip = 1;
3476 for (i = 0; i < 6; i++) {
3477 // in debug mode, if this stave is not required, it is skipped
3478 if (!fAddStave[i]) continue;
3479 // retrieve reference points
3480 GetSectorMountingPoints(i, xL, yL, xR, yR);
3481 xM = 0.5 * (xL + xR);
3482 yM = 0.5 * (yL + yR);
3483 dx = xL - xR;
3484 dy = yL - yR;
3485 angle = TMath::ATan2(dy, dx);
3486 widthLR = TMath::Sqrt(dx*dx + dy*dy);
3487 diffWidth = 0.5*(widthLR - staveHeight);
3488 // first, a movement along this plane must be done
3489 // by an amount equal to the width difference
3490 // and then the fixed shift must also be added
3491 parMovement = diffWidth + shift[i];
d0048cec 3492 // due to stave thickness, another movement must be done
54c9a3d9 3493 // in the direction normal to the mounting plane
d0048cec 3494 // which is computed using an internal method, in a reference
3495 // frame where the LR segment has its middle point in the origin
54c9a3d9 3496 // and axes parallel to the master reference frame
3497 if (i == 0) {
d0048cec 3498 ParallelPosition(-0.5*staveThickness, -parMovement, angle,
54c9a3d9 3499 xPos, yPos);
3500 } // end if i==0
3501 if (i == 1) {
d0048cec 3502 ParallelPosition( 0.5*staveThickness, -parMovement, angle,
54c9a3d9 3503 xPos, yPos);
3504 }else {
d0048cec 3505 ParallelPosition( 0.5*staveThickness, parMovement, angle,
54c9a3d9 3506 xPos, yPos);
3507 } // end if i==1
3508 // then we go into the true reference frame
3509 xPos += xM;
3510 yPos += yM;
3ffa185f 3511 xPos += corrX[i];
3512 yPos += corrY[i];
d0048cec 3513 // using the parameters found here, compute the
54c9a3d9 3514 // translation and rotation of this stave:
3515 TGeoRotation *rot = new TGeoRotation(*gGeoIdentity);
3516 if (i == 0 || i == 1) rot->RotateX(180.0);
3517 rot->RotateZ(90.0 + angle * TMath::RadToDeg());
3518 TGeoCombiTrans *trans = new TGeoCombiTrans(xPos, yPos, 0.0, rot);
3519 if (i == 0 || i == 1) {
3520 moth->AddNode(stave1, i+1, trans);
3521 }else {
3522 moth->AddNode(stave2, i - 1, trans);
3523 if (i != 2) {
3524 // except in the case of stave #2,
3525 // clips must be added, and this is done directly on the sector
3526 Int_t j;
4adcf390 3527 //TArrayD clipSize;
54c9a3d9 3528 TGeoRotation *rotClip = new TGeoRotation(*gGeoIdentity);
3529 rotClip->RotateZ(-90.0);
3530 rotClip->RotateX(180.0);
3531 Double_t x = staveSizes2[3] + fgkGapHalfStave;
3532 Double_t y = staveSizes2[4];
d0048cec 3533 Double_t z[4] = { staveSizes2[5], staveSizes2[6],
54c9a3d9 3534 staveSizes2[7], staveSizes2[8] };
3535 for (j = 0; j < 4; j++) {
3536 TGeoCombiTrans *trClip = new TGeoCombiTrans(x, y, z[j],
3537 rotClip);
3538 *trClip = *trans * *trClip;
3539 moth->AddNode(clip, iclip++, trClip);
3540 } // end for j
3541 } // end if i!=2
3542 } // end if i==0||i==1 else
3543 } // end for i
e0b38446 3544
3545
3546 // Add a box representing the collector for cooling tubes
3547 Double_t collWidth = fgkmm * 22.0;
3548 Double_t collLength = fgkmm * 50.0;
3549 Double_t collThickness = fgkmm * 7.0;
3550 Double_t collInSize = fgkmm * 10.5;
3551
3552 TGeoMedium *medColl = GetMedium("INOX$");
3553 TGeoMedium *medCollIn = GetMedium("COPPER$");
3554 TGeoVolume *vColl = mgr->MakeBox("ITSSPDSectorTubeColl" , medColl, 0.5*collWidth, 0.5*collThickness, 0.5*collLength);
3555 TGeoVolume *vCollIn = mgr->MakeBox("ITSSPDSectorTubeCollIn", medCollIn, 0.5*collInSize, 0.5*collInSize, 0.5*collInSize);
3556 vColl->SetLineColor(kGreen+2);
3557 vCollIn->SetLineColor(kYellow);
3558
3559 TGeoTranslation *tr1 = new TGeoTranslation( 0.1, 1.2, 35.0);
3560 TGeoTranslation *tr2 = new TGeoTranslation(-0.1, 1.2, -35.0);
3561 TGeoTranslation *tr3 = new TGeoTranslation( 0.1, 1.2 - 0.5*(collThickness+collInSize), 35.0 + 0.5*(collLength - collInSize));
3562 TGeoTranslation *tr4 = new TGeoTranslation(-0.1, 1.2 - 0.5*(collThickness+collInSize), -35.0 - 0.5*(collLength - collInSize));
3563
3564 moth->AddNode(vColl, 0, tr1);
3565 moth->AddNode(vColl, 1, tr2);
3566 moth->AddNode(vCollIn, 0, tr3);
3567 moth->AddNode(vCollIn, 1, tr4);
3568
592651e2 3569}
54c9a3d9 3570//______________________________________________________________________
bc3498f4 3571void AliITSv11GeometrySPD::ParallelPosition(Double_t dist1, Double_t dist2,
54c9a3d9 3572 Double_t phi, Double_t &x, Double_t &y) const
3573{
3574 //
3575 // Performs the following steps:
d0048cec 3576 // 1 - finds a straight line parallel to the one passing through
54c9a3d9 3577 // the origin and with angle 'phi' with X axis(phi in RADIANS);
d0048cec 3578 // 2 - finds another line parallel to the previous one, with a
54c9a3d9 3579 // distance 'dist1' from it
d0048cec 3580 // 3 - takes a reference point in the second line in the intersection
54c9a3d9 3581 // between the normal to both lines passing through the origin
d0048cec 3582 // 4 - finds a point whith has distance 'dist2' from this reference,
54c9a3d9 3583 // in the second line (point 2)
3584 // ----
d0048cec 3585 // According to the signs given to dist1 and dist2, the point is
54c9a3d9 3586 // found in different position w.r. to the origin
3587 // compute the point
3588 //
3589 Double_t cs = TMath::Cos(phi);
3590 Double_t sn = TMath::Sin(phi);
3591
3592 x = dist2*cs - dist1*sn;
3593 y = dist1*cs + dist2*sn;
592651e2 3594}
54c9a3d9 3595//______________________________________________________________________
3596Double_t AliITSv11GeometrySPD::GetSPDSectorTranslation(
3597 Double_t x0,Double_t y0,Double_t x1,Double_t y1,Double_t r) const
3598{
3599 //
3600 // Comutes the radial translation of a sector to give the
3601 // proper distance between SPD detectors and the beam pipe.
3602 // Units in are units out.
3603 //
3604
3605 //Begin_Html
3606 /*
3607 <A HREF="http://www.physics.ohio-state.edu/HIRG/SoftWareDoc/SPD_Sector_Position.png">
3608 Figure showing the geometry used in the computation below. </A>
3609 */
3610 //End_Html
3611
3612 // Inputs:
3613 // Double_t x0 Point x0 on Sector surface for the inner
3614 // most detector mounting
3615 // Double_t y0 Point y0 on Sector surface for the innor
3616 // most detector mounting
3617 // Double_t x1 Point x1 on Sector surface for the inner
3618 // most detector mounting
3619 // Double_t y1 Point y1 on Sector surface for the innor
3620 // most detector mounting
3621 // Double_t r The radial distance this mounting surface
3622 // should be from the center of the beam pipe.
3623 // Outputs:
3624 // none.
3625 // Return:
3626 // The distance the SPD sector should be displaced radialy.
3627 //
3628 Double_t a,b,c;
3629
3630 a = x0-x1;
3631 if(a==0.0) return 0.0;
3632 a = (y0-y1)/a;
3633 b = TMath::Sqrt(1.0+a*a);
3634 c = y0-a*x0-r*b;
3635 return -c;
3636}
c890eba4 3637
54c9a3d9 3638//______________________________________________________________________
3639void AliITSv11GeometrySPD::PrintAscii(ostream *os) const
3640{
3641 //
bc3498f4 3642 // Print out class data values in Ascii Form to output stream
3643 // Inputs:
3644 // ostream *os Output stream where Ascii data is to be writen
3645 // Outputs:
3646 // none.
3647 // Return:
3648 // none.
54c9a3d9 3649 //
3650 Int_t i,j,k;
bc3498f4 3651#if defined __GNUC__
3652#if __GNUC__ > 2
3653 ios::fmtflags fmt = cout.flags();
3654#else
3655 Int_t fmt;
3656#endif
3657#else
3658#if defined __ICC || defined __ECC || defined __xlC__
3659 ios::fmtflags fmt;
3660#else
3661 Int_t fmt;
3662#endif
3663#endif
54c9a3d9 3664
3665 *os<< fgkGapLadder <<" "<< fgkGapHalfStave<<" "<< 6 <<" ";
3666 for(i=0;i<6;i++) *os<< fAddStave[i] <<" "<<fSPDsectorX0.GetSize();
3667 for(i=0;i<fSPDsectorX0.GetSize();i++) *os<< fSPDsectorX0.GetAt(i) << " ";
3668 for(i=0;i<fSPDsectorX0.GetSize();i++) *os<< fSPDsectorY0.GetAt(i) << " ";
3669 for(i=0;i<fSPDsectorX1.GetSize();i++) *os<< fSPDsectorX1.GetAt(i) << " ";
3670 for(i=0;i<fSPDsectorX1.GetSize();i++) *os<< fSPDsectorY1.GetAt(i) << " ";
3671 *os<<10<<" "<< 2 <<" " << 6 << " "<< 3 <<" ";
d0048cec 3672 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++)
54c9a3d9 3673 *os<<fTubeEndSector[k][0][i][j]<<" ";
d0048cec 3674 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++)
54c9a3d9 3675 *os<<fTubeEndSector[k][1][i][j]<<" ";
bc3498f4 3676 os->flags(fmt); // reset back to old Formating.
3677 return;
3678}
3679//
54c9a3d9 3680//______________________________________________________________________
3681void AliITSv11GeometrySPD::ReadAscii(istream* is)
3682{
3683 //
bc3498f4 3684 // Read in class data values in Ascii Form to output stream
3685 // Inputs:
3686 // istream *is Input stream where Ascii data is to be read in from
3687 // Outputs:
3688 // none.
3689 // Return:
3690 // none.
54c9a3d9 3691 //
3692 Int_t i,j,k,n;
3693 Double_t gapLadder,GapHalfStave;
3694
3695 *is>>gapLadder>>GapHalfStave>>n;
3696 if(n!=6){
3697 Warning("ReadAscii","fAddStave Array !=6 n=%d",n);
3698 return;
3699 } // end if
3700 for(i=0;i<n;i++) *is>>fAddStave[i];
3701 *is>>n;
3702 fSPDsectorX0.Set(n);
3703 fSPDsectorY0.Set(n);
3704 fSPDsectorX1.Set(n);
3705 fSPDsectorY1.Set(n);
3706 for(i=0;i<n;i++) *is>>fSPDsectorX0[i];
3707 for(i=0;i<n;i++) *is>>fSPDsectorY0[i];
3708 for(i=0;i<n;i++) *is>>fSPDsectorX1[i];
3709 for(i=0;i<n;i++) *is>>fSPDsectorY1[i];
3710 *is>> i>>j>>n;
3711 if(i!=2||j!=6||n!=3){
3712 Warning("ReadAscii","fTubeEndSector array wrong size [2][6][3],"
3713 "found [%d][%d][%d]",i,j,n);
3714 return;
3715 } // end if
d0048cec 3716 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++)
54c9a3d9 3717 *is>>fTubeEndSector[k][0][i][j];
d0048cec 3718 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++)
54c9a3d9 3719 *is>>fTubeEndSector[k][1][i][j];
3720 return;
bc3498f4 3721}
3722//
54c9a3d9 3723//______________________________________________________________________
3724ostream &operator<<(ostream &os,const AliITSv11GeometrySPD &s)
3725{
3726 //
bc3498f4 3727 // Standard output streaming function
3728 // Inputs:
3729 // ostream &os output steam
3730 // AliITSvPPRasymmFMD &s class to be streamed.
3731 // Output:
3732 // none.
3733 // Return:
3734 // ostream &os The stream pointer
54c9a3d9 3735 //
bc3498f4 3736 s.PrintAscii(&os);
3737 return os;
3738}
3739//
54c9a3d9 3740//______________________________________________________________________
3741istream &operator>>(istream &is,AliITSv11GeometrySPD &s)
3742{
3743 //
bc3498f4 3744 // Standard inputput streaming function
3745 // Inputs:
3746 // istream &is input steam
3747 // AliITSvPPRasymmFMD &s class to be streamed.
3748 // Output:
3749 // none.
3750 // Return:
3751 // ostream &os The stream pointer
54c9a3d9 3752 //
bc3498f4 3753 s.ReadAscii(&is);
3754 return is;
3755}
c890eba4 3756