]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv11GeometrySPD.cxx
Fixes for Coverity warnings - removing one unused class
[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
6932f314 226 snprintf(itsMediumName, 30, "ITS_%s", mediumName);
54c9a3d9 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:
6932f314 1609 snprintf(type,10,"Kap");
54c9a3d9 1610 break;
1611 case 1:
6932f314 1612 snprintf(type,10, "Alu");
54c9a3d9 1613 break;
1614 case 2:
6932f314 1615 snprintf(type,10,"Glue1");
54c9a3d9 1616 break;
1617 case 3:
6932f314 1618 snprintf(type,10,"Glue2");
54c9a3d9 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
6932f314 1653 if(GetDebug(5)) shGroundFull->Print(); // Avoid Coverity warning
1654
d0048cec 1655 // create the polygonal shape to be subtracted to give the correct
1656 // shape to the borders its vertices are defined in sugh a way that
1657 // this polygonal will be placed in the correct place considered
1658 // that the origin of the local reference frame is in the center
1659 // of the main box: we fix the starting point at the lower-left
1660 // edge of the shape (point 12), and add all points in order,
54c9a3d9 1661 // following a clockwise rotation
d0048cec 1662
54c9a3d9 1663 Double_t x[13], y[13];
1664 x[ 0] = -0.5 * length + sliceLength[0];
1665 y[ 0] = -0.5 * widthMax;
1666
1667 x[ 1] = x[0] + sliceLength[1];
1668 y[ 1] = y[0] + (widthMax - widthMed1);
1669
1670 x[ 2] = x[1] + sliceLength[2];
1671 y[ 2] = y[1];
1672
1673 x[ 3] = x[2] + sliceLength[3];
1674 y[ 3] = y[2] + (widthMed1 - widthMed2);
1675
1676 x[ 4] = x[3] + sliceLength[4];
1677 y[ 4] = y[3];
1678
1679 x[ 5] = x[4];
1680 y[ 5] = y[4] + (widthMed2 - widthMin);
1681
1682 x[ 6] = x[5] + sliceLength[5];
1683 y[ 6] = y[5];
1684
1685 x[ 7] = x[6];
1686 y[ 7] = y[4];
1687
1688 x[ 8] = x[7] + sliceLength[6];
1689 y[ 8] = y[7];
1690
1691 x[ 9] = x[8];
1692 y[ 9] = y[6];
1693
1694 x[10] = x[9] + sliceLength[7] + 0.5;
1695 y[10] = y[9];
1696
1697 x[11] = x[10];
1698 y[11] = y[0] - 0.5;
1699
1700 x[12] = x[0];
1701 y[12] = y[11];
1702
1703 // create the shape
1704 TGeoXtru *shGroundXtru = new TGeoXtru(2);
1705 shGroundXtru->SetName(Form("ITSSPDSHgFoil%sXtru", type));
1706 shGroundXtru->DefinePolygon(13, x, y);
1707 shGroundXtru->DefineSection(0, -thickness, 0., 0., 1.0);
1708 shGroundXtru->DefineSection(1, thickness, 0., 0., 1.0);
d0048cec 1709
54c9a3d9 1710 // define a string which will express the algebric operations among volumes
1711 // and add the subtraction of this shape from the main one
1712 TString strComposite(Form("ITSSPDSHgFoil%sFull-(%s+", type,
1713 shGroundXtru->GetName()));
d0048cec 1714
54c9a3d9 1715 // define the holes according to size information coming from drawings:
1716 Double_t holeLength = fgkmm * 10.00;
1717 Double_t holeWidth = fgkmm * 7.50;
d0048cec 1718 Double_t holeSepX0 = fgkmm * 7.05; // separation between center
54c9a3d9 1719 // of first hole and left border
d0048cec 1720 Double_t holeSepXC = fgkmm * 14.00; // separation between the centers
54c9a3d9 1721 // of two consecutive holes
d0048cec 1722 Double_t holeSepX1 = fgkmm * 15.42; // separation between centers of
54c9a3d9 1723 // 5th and 6th hole
d0048cec 1724 Double_t holeSepX2 = fgkmm * 22.00; // separation between centers of
54c9a3d9 1725 // 10th and 11th hole
1726 if (itype == 1) {
1727 holeSepX0 -= fgkmm * 0.2;
1728 holeLength += fgkmm * 0.4;
1729 holeWidth += fgkmm * 0.4;
1730 } // end if itype==1
1731 sizes.Set(7);
1732 sizes[0] = holeLength;
1733 sizes[1] = holeWidth;
1734 sizes[2] = holeSepX0;
1735 sizes[3] = holeSepXC;
1736 sizes[4] = holeSepX1;
1737 sizes[5] = holeSepX2;
1738 sizes[6] = fgkmm * 4.40;
d0048cec 1739
54c9a3d9 1740 // X position of hole center (will change for each hole)
1741 Double_t holeX = -0.5*length;
1742 // Y position of center of all holes (= 4.4 mm from upper border)
1743 Double_t holeY = 0.5*(width - holeWidth) - widthMin;
d0048cec 1744
54c9a3d9 1745 // create a shape for the holes (common)
c0fc8108 1746 new TGeoBBox(Form("ITSSPD%sGfoilHole", type),0.5*holeLength,
1747 0.5*holeWidth, thickness);
d0048cec 1748
54c9a3d9 1749 // insert the holes in the XTRU shape:
d0048cec 1750 // starting from the first value of X, they are simply
54c9a3d9 1751 // shifted along this axis
1752 char name[200];
1753 TGeoTranslation *transHole[11];
4adcf390 1754 for (i = 0; i < 11; i++) {
54c9a3d9 1755 // set the position of the hole, depending on index
1756 if (i == 0) {
1757 holeX += holeSepX0;
1758 }else if (i < 5) {
1759 holeX += holeSepXC;
1760 }else if (i == 5) {
1761 holeX += holeSepX1;
1762 }else if (i < 10) {
1763 holeX += holeSepXC;
1764 }else {
1765 holeX += holeSepX2;
1766 } // end if else if's
1767 //cout << i << " --> X = " << holeX << endl;
6932f314 1768 snprintf(name,200,"ITSSPDTRgFoil%sHole%d", type, i);
54c9a3d9 1769 transHole[i] = new TGeoTranslation(name, holeX, holeY, 0.0);
1770 transHole[i]->RegisterYourself();
1771 strComposite.Append(Form("ITSSPD%sGfoilHole:%s", type, name));
1772 if (i < 10) strComposite.Append("+"); else strComposite.Append(")");
1773 } // end for i
d0048cec 1774
54c9a3d9 1775 // create composite shape
1776 TGeoCompositeShape *shGround = new TGeoCompositeShape(
1777 Form("ITSSPDSHgFoil%s", type), strComposite.Data());
1778
1779 return shGround;
592651e2 1780}
54c9a3d9 1781//______________________________________________________________________
d0048cec 1782TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateGroundingFoil(Bool_t isRight,
54c9a3d9 1783 TArrayD &sizes, TGeoManager *mgr)
bc3498f4 1784{
54c9a3d9 1785 //
d0048cec 1786 // Create a volume containing all parts of the grounding foil a
1787 // for a half-stave.
54c9a3d9 1788 // It consists of 4 layers with the same shape but different thickness:
1789 // 1) a layer of glue
1790 // 2) the aluminum layer
1791 // 3) the kapton layer
1792 // 4) another layer of glue
1793 // ---
1794 // Arguments:
d0048cec 1795 // 1: a boolean value to know if it is the grounding foir for
54c9a3d9 1796 // the right or left side
1797 // 2: a TArrayD which will contain the dimension of the container box:
1798 // - size[0] = length along Z (the beam line direction)
d0048cec 1799 // - size[1] = the 'width' of the stave, which defines, together
54c9a3d9 1800 // with Z, the plane of the carbon fiber support
d0048cec 1801 // - size[2] = 'thickness' (= the direction along which all
54c9a3d9 1802 // stave components are superimposed)
1803 // 3: the TGeoManager
1804 // ---
d0048cec 1805 // The return value is a TGeoBBox volume containing all grounding
54c9a3d9 1806 // foil components.
1807 // to avoid strange behaviour of the geometry manager,
1808 // create a suffix to be used in the names of all shapes
1809 //
1810 char suf[5];
6932f314 1811 if (isRight) strncpy(suf, "R", 5); else strncpy(suf, "L", 5);
d0048cec 1812 // this volume will be created in order to ease its placement in
1813 // the half-stave; then, it is added here the small distance of
1814 // the "central" edge of each volume from the Z=0 plane in the stave
54c9a3d9 1815 // reference (which coincides with ALICE one)
1816 Double_t dist = fgkmm * 0.71;
d0048cec 1817
54c9a3d9 1818 // define materials
1819 TGeoMedium *medKap = GetMedium("SPD KAPTON(POLYCH2)$", mgr);
1820 TGeoMedium *medAlu = GetMedium("AL$", mgr);
1821 TGeoMedium *medGlue = GetMedium("EPOXY$", mgr); //??? GLUE_GF_SUPPORT
d0048cec 1822
54c9a3d9 1823 // compute the volume shapes (thicknesses change from one to the other)
1824 Double_t kpLength, kpWidth, alLength, alWidth;
1825 TArrayD kpSize, alSize, glSize;
ed0e944d 1826 Double_t kpThickness = fgkmm * 0.04;
1827 Double_t alThickness = fgkmm * 0.01;
1828//cout << "AL THICKNESS" << alThickness << endl;
1829 //Double_t g0Thickness = fgkmm * 0.1175 - fgkGapHalfStave;
1830 //Double_t g1Thickness = fgkmm * 0.1175 - fgkGapLadder;
1831 Double_t g0Thickness = fgkmm * 0.1275 - fgkGapHalfStave;
1832 Double_t g1Thickness = fgkmm * 0.1275 - fgkGapLadder;
54c9a3d9 1833 TGeoCompositeShape *kpShape = CreateGroundingFoilShape(0,kpLength,kpWidth,
1834 kpThickness, kpSize);
1835 TGeoCompositeShape *alShape = CreateGroundingFoilShape(1,alLength,alWidth,
1836 alThickness, alSize);
3ffa185f 1837 TGeoCompositeShape *g0Shape = CreateGroundingFoilShape(2,kpLength,kpWidth,
1838 g0Thickness, glSize);
1839 TGeoCompositeShape *g1Shape = CreateGroundingFoilShape(3,kpLength,kpWidth,
1840 g1Thickness, glSize);
d0048cec 1841 // create the component volumes and register their sizes in the
1842 // passed arrays for readability reasons, some reference variables
54c9a3d9 1843 // explicit the meaning of the array slots
1844 TGeoVolume *kpVol = new TGeoVolume(Form("ITSSPDgFoilKap%s",suf),
1845 kpShape, medKap);
1846 TGeoVolume *alVol = new TGeoVolume(Form("ITSSPDgFoilAlu%s",suf),
1847 alShape, medAlu);
3ffa185f 1848 TGeoVolume *g0Vol = new TGeoVolume(Form("ITSSPDgFoilGlue%s",suf),
1849 g0Shape, medGlue);
1850 TGeoVolume *g1Vol = new TGeoVolume(Form("ITSSPDgFoilGlue%s",suf),
1851 g1Shape, medGlue);
54c9a3d9 1852 // set colors for the volumes
1853 kpVol->SetLineColor(kRed);
1854 alVol->SetLineColor(kGray);
3ffa185f 1855 g0Vol->SetLineColor(kYellow);
1856 g1Vol->SetLineColor(kYellow);
54c9a3d9 1857 // create references for the final size object
1858 if (sizes.GetSize() != 3) sizes.Set(3);
1859 Double_t &fullThickness = sizes[0];
1860 Double_t &fullLength = sizes[1];
1861 Double_t &fullWidth = sizes[2];
d0048cec 1862 // kapton leads the larger dimensions of the foil
54c9a3d9 1863 // (including the cited small distance from Z=0 stave reference plane)
1864 // the thickness is the sum of the ones of all components
1865 fullLength = kpLength + dist;
1866 fullWidth = kpWidth;
3ffa185f 1867 fullThickness = kpThickness + alThickness + g0Thickness + g1Thickness;
54c9a3d9 1868 // create the container
d0048cec 1869// TGeoMedium *air = GetMedium("AIR$", mgr);
1870 TGeoVolumeAssembly *container = new TGeoVolumeAssembly(Form("ITSSPDgFOIL-%s",suf));
1871// TGeoVolume *container = mgr->MakeBox(Form("ITSSPDgFOIL-%s",suf),
1872// air, 0.5*fullThickness, 0.5*fullWidth, 0.5*fullLength);
1873 // create the common correction rotation (which depends of what side
54c9a3d9 1874 // we are building)
1875 TGeoRotation *rotCorr = new TGeoRotation(*gGeoIdentity);
1876 if (isRight) rotCorr->RotateY(90.0);
d0048cec 1877 else rotCorr->RotateY(-90.0);
1878 // compute the translations, which are in the length and
54c9a3d9 1879 // thickness directions
1880 Double_t x, y, z, shift = 0.0;
1881 if (isRight) shift = dist;
1882 // glue (bottom)
3ffa185f 1883 x = -0.5*(fullThickness - g0Thickness);
54c9a3d9 1884 z = 0.5*(fullLength - kpLength) - shift;
1885 TGeoCombiTrans *glTrans0 = new TGeoCombiTrans(x, 0.0, z, rotCorr);
1886 // kapton
3ffa185f 1887 x += 0.5*(g0Thickness + kpThickness);
54c9a3d9 1888 TGeoCombiTrans *kpTrans = new TGeoCombiTrans(x, 0.0, z, rotCorr);
1889 // aluminum
1890 x += 0.5*(kpThickness + alThickness);
1891 z = 0.5*(fullLength - alLength) - shift - 0.5*(kpLength - alLength);
1892 TGeoCombiTrans *alTrans = new TGeoCombiTrans(x, 0.0, z, rotCorr);
1893 // glue (top)
3ffa185f 1894 x += 0.5*(alThickness + g1Thickness);
54c9a3d9 1895 z = 0.5*(fullLength - kpLength) - shift;
1896 TGeoCombiTrans *glTrans1 = new TGeoCombiTrans(x, 0.0, z, rotCorr);
d0048cec 1897
ed0e944d 1898 //cout << fgkGapHalfStave << endl;
1899 //cout << g0Thickness << endl;
1900 //cout << kpThickness << endl;
1901 //cout << alThickness << endl;
1902 //cout << g1Thickness << endl;
54c9a3d9 1903
1904 // add to container
22726349 1905 container->SetLineColor(kMagenta-10);
54c9a3d9 1906 container->AddNode(kpVol, 1, kpTrans);
1907 container->AddNode(alVol, 1, alTrans);
3ffa185f 1908 container->AddNode(g0Vol, 1, glTrans0);
d0048cec 1909 container->AddNode(g1Vol, 2, glTrans1);
1910 // to add the grease we remember the sizes of the holes, stored as
54c9a3d9 1911 // additional parameters in the kapton layer size:
1912 // - sizes[3] = hole length
1913 // - sizes[4] = hole width
1914 // - sizes[5] = position of first hole center
1915 // - sizes[6] = standard separation between holes
1916 // - sizes[7] = separation between 5th and 6th hole
1917 // - sizes[8] = separation between 10th and 11th hole
d0048cec 1918 // - sizes[9] = separation between the upper hole border and
54c9a3d9 1919 // the foil border
1920 Double_t holeLength = kpSize[0];
1921 Double_t holeWidth = kpSize[1];
1922 Double_t holeFirstZ = kpSize[2];
1923 Double_t holeSepZ = kpSize[3];
1924 Double_t holeSep5th6th = kpSize[4];
1925 Double_t holeSep10th11th = kpSize[5];
1926 Double_t holeSepY = kpSize[6];
1927 // volume (common)
1928 // Grease has not been defined to date. Need much more information
1929 // no this material!
1930 TGeoMedium *grease = GetMedium("SPD KAPTON(POLYCH2)$", mgr); // ??? GREASE
1931 TGeoVolume *hVol = mgr->MakeBox("ITSSPDGrease", grease,
1932 0.5*fullThickness, 0.5*holeWidth, 0.5*holeLength);
1933 hVol->SetLineColor(kBlue);
1934 // displacement of volumes in the container
1935 Int_t idx = 1; // copy numbers start from 1.
1936 x = 0.0;
1937 y = 0.5*(fullWidth - holeWidth) - holeSepY;
1938 if (isRight) z = holeFirstZ - 0.5*fullLength + dist;
1939 else z = 0.5*fullLength - holeFirstZ - dist;
1940 for (Int_t i = 0; i < 11; i++) {
1941 TGeoTranslation *t = 0;
1942 t = new TGeoTranslation(x, y, -z);
1943 container->AddNode(hVol, idx++, t);
1944 if (i < 4) shift = holeSepZ;
1945 else if (i == 4) shift = holeSep5th6th;
1946 else if (i < 9) shift = holeSepZ;
1947 else shift = holeSep10th11th;
1948 if (isRight) z += shift;
1949 else z -= shift;
1950 } // end for i
1951 return container;
592651e2 1952}
54c9a3d9 1953//___________________________________________________________________
1954TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateMCM(Bool_t isRight,
1955 TArrayD &sizes, TGeoManager *mgr) const
bc3498f4 1956{
54c9a3d9 1957 //
1958 // Create a TGeoAssembly containing all the components of the MCM.
1959 // The TGeoVolume container is rejected due to the possibility of overlaps
1960 // when placing this object on the carbon fiber sector.
1961 // The assembly contains:
1962 // - the thin part of the MCM (integrated circuit)
1963 // - the MCM chips (specifications from EDMS)
1964 // - the cap which covers the zone where chips are bound to MCM
1965 // ---
d0048cec 1966 // The local reference frame of this assembly is defined in such a way
1967 // that all volumes are contained in a virtual box whose center
1968 // is placed exactly in the middle of the occupied space w.r to all
1969 // directions. This will ease the positioning of this object in the
1970 // half-stave. The sizes of this virtual box are stored in
54c9a3d9 1971 // the array passed by reference.
1972 // ---
1973 // Arguments:
d0048cec 1974 // - a boolean flag to know if this is the "left" or "right" MCM, when
1975 // looking at the stave from above (i.e. the direction from which
1976 // one sees bus over ladders over grounding foil) and keeping the
1977 // continuous border in the upper part, one sees the thicker part
54c9a3d9 1978 // on the left or right.
d0048cec 1979 // - an array passed by reference which will contain the size of
54c9a3d9 1980 // the virtual container.
1981 // - a pointer to the used TGeoManager.
1982 //
1983
1984 // to distinguish the "left" and "right" objects, a suffix is created
1985 char suf[5];
6932f314 1986 if (isRight) strncpy(suf, "R", 5); else strncpy(suf, "L", 5);
54c9a3d9 1987
1988 // ** MEDIA **
1989 TGeoMedium *medBase = GetMedium("SPD KAPTON(POLYCH2)$",mgr);// ??? MCM BASE
1990 TGeoMedium *medChip = GetMedium("SPD SI CHIP$",mgr);
1991 TGeoMedium *medCap = GetMedium("AL$",mgr);
1992
d0048cec 1993 // The shape of the MCM is divided into 3 sectors with different
54c9a3d9 1994 // widths (Y) and lengths (X), like in this sketch:
1995 //
d0048cec 1996 // 0 1 2
54c9a3d9 1997 // +---------------------+-----------------------------------+
1998 // | 4 sect 2 |
1999 // | 6 sect 1 /-------------------+
2000 // | sect 0 /--------------/ 3
2001 // +--------------------/ 5
2002 // 8 7
2003 //
2004 // the inclination of all oblique borders (6-7, 4-5) is always 45 degrees.
2005 // From drawings we can parametrize the dimensions of all these sectors,
2006 // then the shape of this part of the MCM is implemented as a
d0048cec 2007 // TGeoXtru centerd in the virtual XY space.
54c9a3d9 2008 // The first step is definig the relevant sizes of this shape:
2009 Int_t i, j;
2010 Double_t mcmThickness = fgkmm * 0.35;
2011 Double_t sizeXtot = fgkmm * 105.6; // total distance (0-2)
2012 // resp. 7-8, 5-6 and 3-4
2013 Double_t sizeXsector[3] = {fgkmm * 28.4, fgkmm * 41.4, fgkmm * 28.8};
2014 // resp. 0-8, 1-6 and 2-3
2015 Double_t sizeYsector[3] = {fgkmm * 15.0, fgkmm * 11.0, fgkmm * 8.0};
2016 Double_t sizeSep01 = fgkmm * 4.0; // x(6)-x(7)
2017 Double_t sizeSep12 = fgkmm * 3.0; // x(4)-x(5)
2018
2019 // define sizes of chips (last is the thickest)
2020 Double_t chipLength[5] = { 4.00, 6.15, 3.85, 5.60, 18.00 };
2021 Double_t chipWidth[5] = { 3.00, 4.10, 3.85, 5.60, 5.45 };
2022 Double_t chipThickness[5] = { 0.60, 0.30, 0.30, 1.00, 1.20 };
2023 TString name[5];
2024 name[0] = "ITSSPDanalog";
2025 name[1] = "ITSSPDpilot";
2026 name[2] = "ITSSPDgol";
2027 name[3] = "ITSSPDrx40";
2028 name[4] = "ITSSPDoptical";
2029 Color_t color[5] = { kCyan, kGreen, kYellow, kBlue, kOrange };
2030
2031 // define the sizes of the cover
2032 Double_t capThickness = fgkmm * 0.3;
2033 Double_t capHeight = fgkmm * 1.7;
2034
2035 // compute the total size of the virtual container box
2036 sizes.Set(3);
2037 Double_t &thickness = sizes[0];
2038 Double_t &length = sizes[1];
2039 Double_t &width = sizes[2];
2040 length = sizeXtot;
2041 width = sizeYsector[0];
2042 thickness = mcmThickness + capHeight;
2043
d0048cec 2044 // define all the relevant vertices of the polygon
54c9a3d9 2045 // which defines the transverse shape of the MCM.
d0048cec 2046 // These values are used to several purposes, and
54c9a3d9 2047 // for each one, some points must be excluded
2048 Double_t xRef[9], yRef[9];
2049 xRef[0] = -0.5*sizeXtot;
2050 yRef[0] = 0.5*sizeYsector[0];
2051 xRef[1] = xRef[0] + sizeXsector[0] + sizeSep01;
2052 yRef[1] = yRef[0];
2053 xRef[2] = -xRef[0];
2054 yRef[2] = yRef[0];
2055 xRef[3] = xRef[2];
2056 yRef[3] = yRef[2] - sizeYsector[2];
2057 xRef[4] = xRef[3] - sizeXsector[2];
2058 yRef[4] = yRef[3];
2059 xRef[5] = xRef[4] - sizeSep12;
2060 yRef[5] = yRef[4] - sizeSep12;
2061 xRef[6] = xRef[5] - sizeXsector[1];
2062 yRef[6] = yRef[5];
2063 xRef[7] = xRef[6] - sizeSep01;
2064 yRef[7] = yRef[6] - sizeSep01;
2065 xRef[8] = xRef[0];
2066 yRef[8] = -yRef[0];
2067
d0048cec 2068 // the above points are defined for the "right" MCM (if ve view the
2069 // stave from above) in order to change to the "left" one, we must
54c9a3d9 2070 // change the sign to all X values:
2071 if (isRight) for (i = 0; i < 9; i++) xRef[i] = -xRef[i];
d0048cec 2072
2073 // the shape of the MCM and glue layer are done excluding point 1,
54c9a3d9 2074 // which is not necessary and cause the geometry builder to get confused
2075 j = 0;
2076 Double_t xBase[8], yBase[8];
2077 for (i = 0; i < 9; i++) {
2078 if (i == 1) continue;
2079 xBase[j] = xRef[i];
2080 yBase[j] = yRef[i];
2081 j++;
2082 } // end for i
2083
2084 // the MCM cover is superimposed over the zones 1 and 2 only
2085 Double_t xCap[6], yCap[6];
2086 j = 0;
2087 for (i = 1; i <= 6; i++) {
2088 xCap[j] = xRef[i];
2089 yCap[j] = yRef[i];
2090 j++;
2091 } // end for i
2092
d0048cec 2093 // define positions of chips,
54c9a3d9 2094 // which must be added to the bottom-left corner of MCM
2095 // and divided by 1E4;
2096 Double_t chipX[5], chipY[5];
2097 if (isRight) {
2098 chipX[0] = 666320.;
2099 chipX[1] = 508320.;
2100 chipX[2] = 381320.;
2101 chipX[3] = 295320.;
2102 chipX[4] = 150320.;
2103 chipY[0] = 23750.;
2104 chipY[1] = 27750.;
2105 chipY[2] = 20750.;
2106 chipY[3] = 42750.;
2107 chipY[4] = 39750.;
2108 } else {
2109 chipX[0] = 389730.;
2110 chipX[1] = 548630.;
2111 chipX[2] = 674930.;
2112 chipX[3] = 761430.;
2113 chipX[4] = 905430.;
2114 chipY[0] = 96250.;
2115 chipY[1] = 91950.;
2116 chipY[2] = 99250.;
2117 chipY[3] = 107250.;
2118 chipY[4] = 109750.;
2119 } // end if isRight
2120 for (i = 0; i < 5; i++) {
2121 chipX[i] *= 0.00001;
2122 chipY[i] *= 0.00001;
2123 if (isRight) {
2124 chipX[i] += xRef[3];
2125 chipY[i] += yRef[3];
2126 } else {
2127 chipX[i] += xRef[8];
2128 chipY[i] += yRef[8];
2129 } // end for isRight
2130 chipLength[i] *= fgkmm;
2131 chipWidth[i] *= fgkmm;
2132 chipThickness[i] *= fgkmm;
2133 } // end for i
2134
d0048cec 2135 // create shapes for MCM
54c9a3d9 2136 Double_t z1, z2;
2137 TGeoXtru *shBase = new TGeoXtru(2);
2138 z1 = -0.5*thickness;
2139 z2 = z1 + mcmThickness;
2140 shBase->DefinePolygon(8, xBase, yBase);
2141 shBase->DefineSection(0, z1, 0., 0., 1.0);
2142 shBase->DefineSection(1, z2, 0., 0., 1.0);
2143
2144 // create volumes of MCM
2145 TGeoVolume *volBase = new TGeoVolume("ITSSPDbase", shBase, medBase);
2146 volBase->SetLineColor(kRed);
2147
d0048cec 2148 // to create the border of the MCM cover, it is required the
2149 // subtraction of two shapes the outer is created using the
54c9a3d9 2150 // reference points defined here
2151 TGeoXtru *shCapOut = new TGeoXtru(2);
2152 shCapOut->SetName(Form("ITSSPDshCAPOUT%s", suf));
2153 z1 = z2;
2154 z2 = z1 + capHeight - capThickness;
2155 shCapOut->DefinePolygon(6, xCap, yCap);
2156 shCapOut->DefineSection(0, z1, 0., 0., 1.0);
2157 shCapOut->DefineSection(1, z2, 0., 0., 1.0);
2158 // the inner is built similarly but subtracting the thickness
2159 Double_t angle, cs;
2160 Double_t xin[6], yin[6];
2161 if (!isRight) {
2162 angle = 45.0;
2163 cs = TMath::Cos( 0.5*(TMath::Pi() - angle*TMath::DegToRad()) );
2164 xin[0] = xCap[0] + capThickness;
2165 yin[0] = yCap[0] - capThickness;
2166 xin[1] = xCap[1] - capThickness;
2167 yin[1] = yin[0];
2168 xin[2] = xin[1];
2169 yin[2] = yCap[2] + capThickness;
2170 xin[3] = xCap[3] - capThickness*cs;
2171 yin[3] = yin[2];
2172 xin[4] = xin[3] - sizeSep12;
2173 yin[4] = yCap[4] + capThickness;
2174 xin[5] = xin[0];
2175 yin[5] = yin[4];
2176 } else {
2177 angle = 45.0;
2178 cs = TMath::Cos( 0.5*(TMath::Pi() - angle*TMath::DegToRad()) );
2179 xin[0] = xCap[0] - capThickness;
2180 yin[0] = yCap[0] - capThickness;
2181 xin[1] = xCap[1] + capThickness;
2182 yin[1] = yin[0];
2183 xin[2] = xin[1];
2184 yin[2] = yCap[2] + capThickness;
2185 xin[3] = xCap[3] - capThickness*cs;
2186 yin[3] = yin[2];
2187 xin[4] = xin[3] + sizeSep12;
2188 yin[4] = yCap[4] + capThickness;
2189 xin[5] = xin[0];
2190 yin[5] = yin[4];
2191 } // end if !isRight
2192 TGeoXtru *shCapIn = new TGeoXtru(2);
2193 shCapIn->SetName(Form("ITSSPDshCAPIN%s", suf));
2194 shCapIn->DefinePolygon(6, xin, yin);
2195 shCapIn->DefineSection(0, z1 - 0.01, 0., 0., 1.0);
2196 shCapIn->DefineSection(1, z2 + 0.01, 0., 0., 1.0);
2197 // compose shapes
2198 TGeoCompositeShape *shCapBorder = new TGeoCompositeShape(
d0048cec 2199 Form("ITSSPDshBORDER%s", suf),
54c9a3d9 2200 Form("%s-%s", shCapOut->GetName(),
2201 shCapIn->GetName()));
2202 // create volume
2203 TGeoVolume *volCapBorder = new TGeoVolume("ITSSPDcapBoarder",
2204 shCapBorder,medCap);
2205 volCapBorder->SetLineColor(kGreen);
d0048cec 2206 // finally, we create the top of the cover, which has the same
2207 // shape of outer border and a thickness equal of the one othe
54c9a3d9 2208 // cover border one
2209 TGeoXtru *shCapTop = new TGeoXtru(2);
2210 z1 = z2;
2211 z2 = z1 + capThickness;
2212 shCapTop->DefinePolygon(6, xCap, yCap);
2213 shCapTop->DefineSection(0, z1, 0., 0., 1.0);
2214 shCapTop->DefineSection(1, z2, 0., 0., 1.0);
2215 TGeoVolume *volCapTop = new TGeoVolume("ITSSPDcapTop", shCapTop, medCap);
2216 volCapTop->SetLineColor(kBlue);
2217
2218 // create container assembly with right suffix
2219 TGeoVolumeAssembly *mcmAssembly = new TGeoVolumeAssembly(
2220 Form("ITSSPDmcm%s", suf));
2221
2222 // add mcm layer
2223 mcmAssembly->AddNode(volBase, 1, gGeoIdentity);
2224 // add chips
2225 for (i = 0; i < 5; i++) {
2226 TGeoVolume *box = gGeoManager->MakeBox(name[i],medChip,
2227 0.5*chipLength[i], 0.5*chipWidth[i], 0.5*chipThickness[i]);
2228 TGeoTranslation *tr = new TGeoTranslation(chipX[i],chipY[i],
2229 0.5*(-thickness + chipThickness[i]) + mcmThickness);
2230 box->SetLineColor(color[i]);
2231 mcmAssembly->AddNode(box, 1, tr);
2232 } // end for i
2233 // add cap border
2234 mcmAssembly->AddNode(volCapBorder, 1, gGeoIdentity);
2235 // add cap top
d0048cec 2236 mcmAssembly->AddNode(volCapTop, 1, gGeoIdentity);
54c9a3d9 2237
2238 return mcmAssembly;
592651e2 2239}
7f69c251 2240
54c9a3d9 2241//______________________________________________________________________
bc3498f4 2242TGeoVolumeAssembly* AliITSv11GeometrySPD::CreatePixelBus
22726349 2243(Bool_t isRight, Int_t ilayer, TArrayD &sizes, TGeoManager *mgr) const
bc3498f4 2244{
54c9a3d9 2245 //
d0048cec 2246 // The pixel bus is implemented as a TGeoBBox with some objects on it,
54c9a3d9 2247 // which could affect the particle energy loss.
2248 // ---
d0048cec 2249 // In order to avoid confusion, the bus is directly displaced
54c9a3d9 2250 // according to the axis orientations which are used in the final stave:
2251 // X --> thickness direction
2252 // Y --> width direction
2253 // Z --> length direction
2254 //
d0048cec 2255
22726349 2256 // ** CRITICAL CHECK ******************************************************
2257 // layer number can be ONLY 1 or 2
2258 if (ilayer != 1 && ilayer != 2) AliFatal("Layer number MUST be 1 or 2");
54c9a3d9 2259
2260 // ** MEDIA **
2261 //PIXEL BUS
2262 TGeoMedium *medBus = GetMedium("SPDBUS(AL+KPT+EPOX)$",mgr);
2263 TGeoMedium *medPt1000 = GetMedium("CERAMICS$",mgr); // ??? PT1000
2264 // Capacity
2265 TGeoMedium *medCap = GetMedium("SDD X7R capacitors$",mgr);
2266 // ??? Resistance
d0048cec 2267 //TGeoMedium *medRes = GetMedium("SDD X7R capacitors$",mgr);
7f69c251 2268 TGeoMedium *medRes = GetMedium("ALUMINUM$",mgr);
45c52bb2 2269 //TGeoMedium *medExt = GetMedium("SDDKAPTON (POLYCH2)$", mgr);
2270 TGeoMedium *medExt = GetMedium("SPD-MIX CU KAPTON$", mgr);
54c9a3d9 2271 // ** SIZES & POSITIONS **
2272 Double_t busLength = 170.501 * fgkmm; // length of plane part
2273 Double_t busWidth = 13.800 * fgkmm; // width
2274 Double_t busThickness = 0.280 * fgkmm; // thickness
2275 Double_t pt1000Length = fgkmm * 1.50;
2276 Double_t pt1000Width = fgkmm * 3.10;
2277 Double_t pt1000Thickness = fgkmm * 0.60;
2278 Double_t pt1000Y, pt1000Z[10];// position of the pt1000's along the bus
2279 Double_t capLength = fgkmm * 2.55;
2280 Double_t capWidth = fgkmm * 1.50;
2281 Double_t capThickness = fgkmm * 1.35;
2282 Double_t capY[2], capZ[2];
d0048cec 2283
54c9a3d9 2284 Double_t resLength = fgkmm * 2.20;
2285 Double_t resWidth = fgkmm * 0.80;
2286 Double_t resThickness = fgkmm * 0.35;
2287 Double_t resY[2], resZ[2];
d0048cec 2288
7f69c251 2289 Double_t extThickness = fgkmm * 0.25;
3ffa185f 2290 Double_t ext1Length = fgkmm * (26.7 - 10.0);
ddf00e3c 2291 Double_t ext2Length = fgkmm * 284.0 - ext1Length + extThickness;
3ffa185f 2292 Double_t extWidth = fgkmm * 11.0;
2293 Double_t extHeight = fgkmm * 2.5;
d0048cec 2294
2295 // position of pt1000, resistors and capacitors depends on the
54c9a3d9 2296 // bus if it's left or right one
2297 if (!isRight) {
2298 pt1000Y = 64400.;
2299 pt1000Z[0] = 66160.;
2300 pt1000Z[1] = 206200.;
2301 pt1000Z[2] = 346200.;
2302 pt1000Z[3] = 486200.;
2303 pt1000Z[4] = 626200.;
2304 pt1000Z[5] = 776200.;
2305 pt1000Z[6] = 916200.;
2306 pt1000Z[7] = 1056200.;
2307 pt1000Z[8] = 1196200.;
d0048cec 2308 pt1000Z[9] = 1336200.;
54c9a3d9 2309 resZ[0] = 1397500.;
2310 resY[0] = 26900.;
2311 resZ[1] = 682500.;
2312 resY[1] = 27800.;
2313 capZ[0] = 1395700.;
2314 capY[0] = 45700.;
2315 capZ[1] = 692600.;
2316 capY[1] = 45400.;
2317 } else {
2318 pt1000Y = 66100.;
2319 pt1000Z[0] = 319700.;
2320 pt1000Z[1] = 459700.;
2321 pt1000Z[2] = 599700.;
2322 pt1000Z[3] = 739700.;
2323 pt1000Z[4] = 879700.;
2324 pt1000Z[5] = 1029700.;
2325 pt1000Z[6] = 1169700.;
2326 pt1000Z[7] = 1309700.;
2327 pt1000Z[8] = 1449700.;
d0048cec 2328 pt1000Z[9] = 1589700.;
54c9a3d9 2329 capY[0] = 44500.;
2330 capZ[0] = 266700.;
2331 capY[1] = 44300.;
2332 capZ[1] = 974700.;
2333 resZ[0] = 266500.;
2334 resY[0] = 29200.;
2335 resZ[1] = 974600.;
2336 resY[1] = 29900.;
2337 } // end if isRight
2338 Int_t i;
2339 pt1000Y *= 1E-4 * fgkmm;
2340 for (i = 0; i < 10; i++) {
2341 pt1000Z[i] *= 1E-4 * fgkmm;
2342 if (i < 2) {
2343 capZ[i] *= 1E-4 * fgkmm;
2344 capY[i] *= 1E-4 * fgkmm;
2345 resZ[i] *= 1E-4 * fgkmm;
2346 resY[i] *= 1E-4 * fgkmm;
2347 } // end if iM2
2348 } // end for i
d0048cec 2349
54c9a3d9 2350 Double_t &fullLength = sizes[1];
2351 Double_t &fullWidth = sizes[2];
2352 Double_t &fullThickness = sizes[0];
2353 fullLength = busLength;
2354 fullWidth = busWidth;
2355 // add the thickness of the thickest component on bus (capacity)
d0048cec 2356 fullThickness = busThickness + capThickness;
54c9a3d9 2357
2358 // ** VOLUMES **
2359 TGeoVolumeAssembly *container = new TGeoVolumeAssembly("ITSSPDpixelBus");
d0048cec 2360 TGeoVolume *bus = mgr->MakeBox("ITSSPDbus", medBus, 0.5*busThickness,
54c9a3d9 2361 0.5*busWidth, 0.5*busLength);
2362 TGeoVolume *pt1000 = mgr->MakeBox("ITSSPDpt1000",medPt1000,
2363 0.5*pt1000Thickness,0.5*pt1000Width, 0.5*pt1000Length);
2364 TGeoVolume *res = mgr->MakeBox("ITSSPDresistor", medRes, 0.5*resThickness,
2365 0.5*resWidth, 0.5*resLength);
2366 TGeoVolume *cap = mgr->MakeBox("ITSSPDcapacitor", medCap, 0.5*capThickness,
2367 0.5*capWidth, 0.5*capLength);
d0048cec 2368
954323d3 2369 char extname[12];
6932f314 2370 snprintf(extname,12,"Extender1l%d",ilayer);
954323d3 2371 TGeoVolume *ext1 = mgr->MakeBox(extname, medExt, 0.5*extThickness, 0.5*extWidth, 0.5*ext1Length);
6932f314 2372 snprintf(extname,12,"Extender2l%d",ilayer);
954323d3 2373 TGeoVolume *ext2 = mgr->MakeBox(extname, medExt, 0.5*extHeight - 2.*extThickness, 0.5*extWidth, 0.5*extThickness);
2374 TGeoVolume *ext3=0;
6932f314 2375 snprintf(extname,12,"Extender3l%d",ilayer);
954323d3 2376 if (ilayer==1) {
2377 Double_t halflen=(0.5*ext2Length + extThickness);
2378 Double_t xprof[6],yprof[6];
2379 Double_t alpha=24;
2380 xprof[0] = -halflen;
2381 yprof[0] = -0.5*extThickness;
2382 xprof[1] = halflen/2;
2383 yprof[1] = yprof[0];
2384 xprof[2] = xprof[1] + 0.5*halflen*CosD(alpha);
2385 yprof[2] = yprof[1] + 0.5*halflen*SinD(alpha);
2386 xprof[3] = xprof[2] - extThickness*SinD(alpha);
2387 yprof[3] = yprof[2] + extThickness*CosD(alpha);
2388 InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
2389 extThickness, xprof[4], yprof[4]);
2390 xprof[5] = xprof[0];
2391 yprof[5] = 0.5*extThickness;
2392 TGeoXtru *ext3sh = new TGeoXtru(2);
2393 ext3sh->DefinePolygon(6, xprof, yprof);
2394 ext3sh->DefineSection(0, -0.5*(extWidth-0.8*fgkmm));
2395 ext3sh->DefineSection(1, 0.5*(extWidth-0.8*fgkmm));
2396 ext3 = new TGeoVolume(extname, ext3sh, medExt);
2397 } else
2398 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 2399 bus->SetLineColor(kYellow + 2);
2400 pt1000->SetLineColor(kGreen + 3);
2401 res->SetLineColor(kRed + 1);
2402 cap->SetLineColor(kBlue - 7);
7f69c251 2403 ext1->SetLineColor(kGray);
3ffa185f 2404 ext2->SetLineColor(kGray);
2405 ext3->SetLineColor(kGray);
54c9a3d9 2406
2407 // ** MOVEMENTS AND POSITIONEMENT **
2408 // bus
d0048cec 2409 TGeoTranslation *trBus = new TGeoTranslation(0.5 * (busThickness -
54c9a3d9 2410 fullThickness), 0.0, 0.0);
2411 container->AddNode(bus, 1, trBus);
2412 Double_t zRef, yRef, x, y, z;
2413 if (isRight) {
2414 zRef = -0.5*fullLength;
2415 yRef = -0.5*fullWidth;
2416 } else {
2417 zRef = -0.5*fullLength;
2418 yRef = -0.5*fullWidth;
2419 } // end if isRight
2420 // pt1000
2421 x = 0.5*(pt1000Thickness - fullThickness) + busThickness;
2422 for (i = 0; i < 10; i++) {
2423 y = yRef + pt1000Y;
2424 z = zRef + pt1000Z[i];
2425 TGeoTranslation *tr = new TGeoTranslation(x, y, z);
2426 container->AddNode(pt1000, i+1, tr);
2427 } // end for i
2428 // capacitors
2429 x = 0.5*(capThickness - fullThickness) + busThickness;
2430 for (i = 0; i < 2; i++) {
2431 y = yRef + capY[i];
2432 z = zRef + capZ[i];
2433 TGeoTranslation *tr = new TGeoTranslation(x, y, z);
2434 container->AddNode(cap, i+1, tr);
2435 } // end for i
2436 // resistors
2437 x = 0.5*(resThickness - fullThickness) + busThickness;
2438 for (i = 0; i < 2; i++) {
2439 y = yRef + resY[i];
2440 z = zRef + resZ[i];
2441 TGeoTranslation *tr = new TGeoTranslation(x, y, z);
2442 container->AddNode(res, i+1, tr);
2443 } // end for i
d0048cec 2444
7f69c251 2445 // extender
22726349 2446 if (ilayer == 2) {
3ffa185f 2447 if (isRight) {
2448 y = 0.5 * (fullWidth - extWidth) - 0.1;
2449 z = 0.5 * (-fullLength + fgkmm * 10.0);
2450 }
2451 else {
2452 y = 0.5 * (fullWidth - extWidth) - 0.1;
2453 z = 0.5 * ( fullLength - fgkmm * 10.0);
2454 }
22726349 2455 }
2456 else {
2457 if (isRight) {
2458 y = -0.5 * (fullWidth - extWidth);
2459 z = 0.5 * (-fullLength + fgkmm * 10.0);
2460 }
2461 else {
2462 y = -0.5 * (fullWidth - extWidth);
2463 z = 0.5 * ( fullLength - fgkmm * 10.0);
2464 }
2465 }
3ffa185f 2466 x = 0.5 * (extThickness - fullThickness) + busThickness;
2467 //y = 0.5 * (fullWidth - extWidth);
2468 TGeoTranslation *trExt1 = new TGeoTranslation(x, y, z);
2469 if (isRight) {
2470 z -= 0.5 * (ext1Length - extThickness);
2471 }
2472 else {
2473 z += 0.5 * (ext1Length - extThickness);
2474 }
2475 x += 0.5*(extHeight - 3.*extThickness);
2476 TGeoTranslation *trExt2 = new TGeoTranslation(x, y, z);
2477 if (isRight) {
2478 z -= 0.5 * (ext2Length - extThickness) + 2.5*extThickness;
2479 }
2480 else {
2481 z += 0.5 * (ext2Length - extThickness) + 2.5*extThickness;
2482 }
2483 x += 0.5*(extHeight - extThickness) - 2.*extThickness;
954323d3 2484 TGeoCombiTrans *trExt3=0;
2485 if (ilayer==1) {
2486 if (isRight)
2487 trExt3 = new TGeoCombiTrans(x, y, z, new TGeoRotation("",0.,-90.,90.));
2488 else
2489 trExt3 = new TGeoCombiTrans(x, y, z, new TGeoRotation("",0., 90.,90.));
2490 } else
2491 trExt3 = new TGeoCombiTrans(x, y, z, 0);
3ffa185f 2492 container->AddNode(ext1, 0, trExt1);
2493 container->AddNode(ext2, 0, trExt2);
2494 container->AddNode(ext3, 0, trExt3);
d0048cec 2495
54c9a3d9 2496 sizes[3] = yRef + pt1000Y;
2497 sizes[4] = zRef + pt1000Z[2];
2498 sizes[5] = zRef + pt1000Z[7];
d0048cec 2499
54c9a3d9 2500 return container;
592651e2 2501}
7f69c251 2502
2503//______________________________________________________________________
44d18d38 2504TList* AliITSv11GeometrySPD::CreateConeModule(Bool_t sideC, const Double_t angrot,
96eb8210 2505 TGeoManager *mgr) const
7f69c251 2506{
96eb8210 2507 //
2508 // Creates all services modules and places them in a TList
2509 // angrot is the rotation angle (passed as an argument to avoid
2510 // defining the same quantity in two different places)
2511 //
45c52bb2 2512 // Created: ?? ??? 2008 A. Pulvirenti
2513 // Updated: 03 May 2010 M. Sitta
2514 // Updated: 20 Jun 2010 A. Pulvirenti Optical patch panels
2515 // Updated: 22 Jun 2010 M. Sitta Fiber cables
c890eba4 2516 // Updated: 04 Jul 2010 M. Sitta Water cooling
44d18d38 2517 // Updated: 08 Jul 2010 A. Pulvirenti Air cooling on Side C
96eb8210 2518 //
2519
7f69c251 2520 TGeoMedium *medInox = GetMedium("INOX$",mgr);
45c52bb2 2521 //TGeoMedium *medExt = GetMedium("SDDKAPTON (POLYCH2)$", mgr);
2522 TGeoMedium *medExtB = GetMedium("SPD-BUS CU KAPTON$", mgr);
2523 TGeoMedium *medExtM = GetMedium("SPD-MCM CU KAPTON$", mgr);
3ffa185f 2524 TGeoMedium *medPlate = GetMedium("SPD C (M55J)$", mgr);
96eb8210 2525 TGeoMedium *medFreon = GetMedium("Freon$", mgr);
2526 TGeoMedium *medGas = GetMedium("GASEOUS FREON$", mgr);
45c52bb2 2527 TGeoMedium *medFibs = GetMedium("SDD OPTICFIB$",mgr);
c890eba4 2528 TGeoMedium *medCopper= GetMedium("COPPER$",mgr);
44d18d38 2529 TGeoMedium *medPVC = GetMedium("PVC$",mgr);
d0048cec 2530
3ffa185f 2531 Double_t extThickness = fgkmm * 0.25;
2532 Double_t ext1Length = fgkmm * (26.7 - 10.0);
96eb8210 2533// Double_t ext2Length = fgkmm * (285.0 - ext1Length + extThickness);
2534 Double_t ext2Length = fgkmm * 285.0 - ext1Length + extThickness;
d0048cec 2535
96eb8210 2536 const Double_t kCableThickness = 1.5 *fgkmm;
954323d3 2537 Double_t cableL0 = 10.0 * fgkmm;
96eb8210 2538 Double_t cableL1 = 340.0 * fgkmm - extThickness - ext1Length - ext2Length;
2539 Double_t cableL2 = 300.0 * fgkmm;
7f69c251 2540 //Double_t cableL3 = 570.0 * fgkmm;
2541 Double_t cableL3 = 57.0 * fgkmm;
2542 Double_t cableW1 = 11.0 * fgkmm;
2543 Double_t cableW2 = 30.0 * fgkmm;
2544 Double_t cableW3 = 50.0 * fgkmm;
d0048cec 2545
954323d3 2546 const Double_t kMCMLength = cableL0 + cableL1 + cableL2 + cableL3;
96eb8210 2547 const Double_t kMCMWidth = cableW1;
2548 const Double_t kMCMThickness = 1.2 *fgkmm;
d0048cec 2549
96eb8210 2550 const Double_t kPlateLength = 200.0 *fgkmm;
2551 const Double_t kPlateWidth = 50.0 *fgkmm;
2552 const Double_t kPlateThickness = 5.0 *fgkmm;
2553
45c52bb2 2554 const Double_t kConeTubeRmin = 2.0 *fgkmm;
2555 const Double_t kConeTubeRmax = 3.0 *fgkmm;
96eb8210 2556
45c52bb2 2557 const Double_t kHorizTubeLen = 150.0 *fgkmm;
4c8afd2e 2558 const Double_t kYtoHalfStave = 9.5 *fgkmm;
c890eba4 2559
2560 const Double_t kWaterCoolRMax = 2.6 *fgkmm;
2561 const Double_t kWaterCoolThick = 0.04 *fgkmm;
2562 const Double_t kWaterCoolLen = 250.0 *fgkmm;
2563 const Double_t kWCPlateThick = 0.5 *fgkmm;
2564 const Double_t kWCPlateWide = 33.0 *fgkmm;
2565 const Double_t kWCPlateLen = 230.0 *fgkmm;
2566 const Double_t kWCFittingRext1 = 2.4 *fgkmm;
2567 const Double_t kWCFittingRext2 = 3.7 *fgkmm;
2568 const Double_t kWCFittingRint1 = 1.9 *fgkmm;
2569 const Double_t kWCFittingRint2 = kWaterCoolRMax;
2570 const Double_t kWCFittingLen1 = 7.0 *fgkmm;
2571 const Double_t kWCFittingLen2 = 8.0 *fgkmm;
44d18d38 2572
2573 const Double_t kCollWidth = 40.0 *fgkmm;
2574 const Double_t kCollLength = 60.0 *fgkmm;
2575 const Double_t kCollThickness = 10.0 *fgkmm;
2576 const Double_t kCollTubeThick = 1.0 *fgkmm;
2577 const Double_t kCollTubeRadius = 7.0 *fgkmm;
2578 const Double_t kCollTubeLength = 190.0 *fgkmm;
45c52bb2 2579
2580 const Double_t kOptFibDiamet = 4.5 *fgkmm;
d0048cec 2581
7f69c251 2582 Double_t x[12], y[12];
96eb8210 2583 Double_t xloc, yloc, zloc;
2584
2585 Int_t kPurple = 6; // Purple (Root does not define it)
2586
c890eba4 2587 TGeoVolumeAssembly* container[5];
96eb8210 2588 container[0] = new TGeoVolumeAssembly("ITSSPDConeModule");
2589 container[1] = new TGeoVolumeAssembly("ITSSPDCoolingModuleSideA");
2590 container[2] = new TGeoVolumeAssembly("ITSSPDCoolingModuleSideC");
45c52bb2 2591 container[3] = new TGeoVolumeAssembly("ITSSPDPatchPanelModule");
c890eba4 2592 container[4] = new TGeoVolumeAssembly("ITSSPDWaterCooling");
d0048cec 2593
96eb8210 2594 // The extender on the cone as a Xtru
954323d3 2595 x[0] = -cableL0;
7f69c251 2596 y[0] = 0.0 + 0.5 * cableW1;
d0048cec 2597
954323d3 2598 x[1] = x[0] + cableL0 + cableL1 - 0.5*(cableW2 - cableW1);
7f69c251 2599 y[1] = y[0];
d0048cec 2600
954323d3 2601 x[2] = x[0] + cableL0 + cableL1;
7f69c251 2602 y[2] = y[1] + 0.5*(cableW2 - cableW1);
d0048cec 2603
7f69c251 2604 x[3] = x[2] + cableL2;
2605 y[3] = y[2];
d0048cec 2606
7f69c251 2607 x[4] = x[3] + 0.5*(cableW3 - cableW2);
2608 y[4] = y[3] + 0.5*(cableW3 - cableW2);
d0048cec 2609
7f69c251 2610 x[5] = x[4] + cableL3 - 0.5*(cableW3 - cableW2);
2611 y[5] = y[4];
d0048cec 2612
7f69c251 2613 for (Int_t i = 6; i < 12; i++) {
2614 x[i] = x[11 - i];
2615 y[i] = -y[11 - i];
2616 }
d0048cec 2617
7f69c251 2618 TGeoXtru *shCable = new TGeoXtru(2);
2619 shCable->DefinePolygon(12, x, y);
96eb8210 2620 shCable->DefineSection(0, 0.0);
2621 shCable->DefineSection(1, kCableThickness);
d0048cec 2622
45c52bb2 2623 TGeoVolume *volCable = new TGeoVolume("ITSSPDExtender", shCable, medExtB);
7f69c251 2624 volCable->SetLineColor(kGreen);
d0048cec 2625
96eb8210 2626 // The MCM extender on the cone as a Xtru
2627 TGeoBBox *shMCMExt = new TGeoBBox(0.5*kMCMLength,
2628 0.5*kMCMWidth,
2629 0.5*kMCMThickness);
d0048cec 2630
96eb8210 2631 TGeoVolume *volMCMExt = new TGeoVolume("ITSSPDExtenderMCM",
45c52bb2 2632 shMCMExt, medExtM);
7f69c251 2633 volMCMExt->SetLineColor(kGreen+3);
d0048cec 2634
96eb8210 2635 // The support plate on the cone as a composite shape
2636 Double_t thickness = kCableThickness + kMCMThickness;
2637 TGeoBBox *shOut = new TGeoBBox("ITSSPD_shape_plateout",
2638 0.5*kPlateLength,
2639 0.5*kPlateWidth,
2640 0.5*kPlateThickness);
2641 TGeoBBox *shIn = new TGeoBBox("ITSSPD_shape_platein" ,
2642 0.5*kPlateLength,
2643 0.5*cableW2,
2644 0.5*thickness);
2645 Char_t string[255];
6932f314 2646 snprintf(string, 255, "%s-%s", shOut->GetName(), shIn->GetName());
96eb8210 2647 TGeoCompositeShape *shPlate = new TGeoCompositeShape("ITSSPDPlate_shape",
2648 string);
d0048cec 2649
96eb8210 2650 TGeoVolume *volPlate = new TGeoVolume("ITSSPDPlate",
2651 shPlate, medPlate);
2652 volPlate->SetLineColor(kRed);
44d18d38 2653
2654 // The air cooling tubes
2655 TGeoBBox *shCollBox = new TGeoBBox("ITSSPD_shape_collector_box", 0.5*kCollLength, 0.5*kCollWidth, 0.5*kCollThickness);
2656 TGeoTube *shCollTube = new TGeoTube("ITSSPD_shape_collector_tube",kCollTubeRadius - kCollTubeThick, kCollTubeRadius, 0.5*kCollTubeLength);
2657 TGeoVolume *volCollBox = new TGeoVolume("ITSSPDCollectorBox", shCollBox, medPVC);
2658 TGeoVolume *volCollTube = new TGeoVolume("ITSSPDCollectorTube", shCollTube, medPVC);
2659 volCollBox->SetLineColor(kAzure);
2660 volCollTube->SetLineColor(kAzure);
d0048cec 2661
96eb8210 2662 // The cooling tube on the cone as a Ctub
2663 Double_t tubeLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave;
2664 TGeoCtub *shTube = new TGeoCtub(0, kConeTubeRmax, 0.5*tubeLength, 0, 360,
2665 0, SinD(angrot/2), -CosD(angrot/2),
2666 0, 0, 1);
2667
2668 TGeoVolume *volTubeA = new TGeoVolume("ITSSPDCoolingTubeOnConeA",
2669 shTube, medInox);
2670 volTubeA->SetLineColor(kGray);
2671
2672 TGeoVolume *volTubeC = new TGeoVolume("ITSSPDCoolingTubeOnConeC",
2673 shTube, medInox);
2674 volTubeC->SetLineColor(kGray);
2675
2676 // The freon in the cooling tubes on the cone as a Ctub
2677 TGeoCtub *shFreon = new TGeoCtub(0, kConeTubeRmin, 0.5*tubeLength, 0, 360,
2678 0, SinD(angrot/2), -CosD(angrot/2),
2679 0, 0, 1);
2680
2681 TGeoVolume *volFreon = new TGeoVolume("ITSSPDCoolingFreonOnCone",
2682 shFreon, medFreon);
2683 volFreon->SetLineColor(kPurple);
2684
2685 TGeoVolume *volGasFr = new TGeoVolume("ITSSPDCoolingFreonGasOnCone",
2686 shFreon, medGas);
2687 volGasFr->SetLineColor(kPurple);
2688
2689 // The cooling tube inside the cylinder as a Ctub
2690 TGeoCtub *shCylTub = new TGeoCtub(0, kConeTubeRmax,
2691 0.5*kHorizTubeLen, 0, 360,
2692 0, 0, -1,
2693 0, SinD(angrot/2), CosD(angrot/2));
2694
2695 TGeoVolume *volCylTubA = new TGeoVolume("ITSSPDCoolingTubeOnCylA",
2696 shCylTub, medInox);
2697 volCylTubA->SetLineColor(kGray);
2698
2699 TGeoVolume *volCylTubC = new TGeoVolume("ITSSPDCoolingTubeOnCylC",
2700 shCylTub, medInox);
2701 volCylTubC->SetLineColor(kGray);
2702
2703 // The freon in the cooling tubes in the cylinder as a Ctub
2704 TGeoCtub *shCylFr = new TGeoCtub(0, kConeTubeRmin,
2705 0.5*kHorizTubeLen, 0, 360,
2706 0, 0, -1,
2707 0, SinD(angrot/2), CosD(angrot/2));
2708
2709 TGeoVolume *volCylFr = new TGeoVolume("ITSSPDCoolingFreonOnCyl",
2710 shCylFr, medFreon);
2711 volCylFr->SetLineColor(kPurple);
2712
2713 TGeoVolume *volCylGasFr = new TGeoVolume("ITSSPDCoolingFreonGasOnCyl",
2714 shCylFr, medGas);
2715 volCylGasFr->SetLineColor(kPurple);
2716
45c52bb2 2717 // The optical fibers bundle on the cone as a Tube
2718 Double_t optLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave;
2719 TGeoTube *shOptFibs = new TGeoTube(0., 0.5*kOptFibDiamet, 0.5*optLength);
2720
2721 TGeoVolume *volOptFibs = new TGeoVolume("ITSSPDOpticalFibersOnCone",
2722 shOptFibs, medFibs);
2723 volOptFibs->SetLineColor(kOrange);
2724
2725 // The optical patch panels
2726 TArrayD psizes;
2727 TGeoVolume *volPatch = CreatePatchPanel(psizes, mgr);
2728
c890eba4 2729 // The water cooling tube as a Tube
2730 TGeoTube *shWatCool = new TGeoTube(kWaterCoolRMax-kWaterCoolThick,
2731 kWaterCoolRMax, kWaterCoolLen/2);
2732
2733 TGeoVolume *volWatCool = new TGeoVolume("ITSSPDWaterCoolingOnCone",
2734 shWatCool, medInox);
2735 volWatCool->SetLineColor(kGray);
2736
2737 // The support plate for the water tubes: a Tubs and a BBox
2738 TGeoTubeSeg *shWCPltT = new TGeoTubeSeg(kWaterCoolRMax,
2739 kWaterCoolRMax+kWCPlateThick,
2740 kWCPlateLen/2, 180., 360.);
2741
2742 Double_t plateBoxWide = (kWCPlateWide - 2*kWaterCoolRMax)/2;
2743 TGeoBBox *shWCPltB = new TGeoBBox(plateBoxWide/2,
2744 kWCPlateThick/2,
2745 kWCPlateLen/2);
2746
2747 TGeoVolume *volWCPltT = new TGeoVolume("ITSSPDWaterCoolingTubsPlate",
2748 shWCPltT, medPlate);
2749 volWCPltT->SetLineColor(kRed);
2750
2751 TGeoVolume *volWCPltB = new TGeoVolume("ITSSPDWaterCoolingBoxPlate",
2752 shWCPltB, medPlate);
2753 volWCPltB->SetLineColor(kRed);
2754
2755 // The fitting for the water cooling tube: a Pcon
2756 TGeoPcon *shFitt = new TGeoPcon(0., 360., 4);
2757 shFitt->Z(0) = -kWCFittingLen1;
2758 shFitt->Rmin(0) = kWCFittingRint1;
2759 shFitt->Rmax(0) = kWCFittingRext1;
2760
2761 shFitt->Z(1) = 0;
2762 shFitt->Rmin(1) = kWCFittingRint1;
2763 shFitt->Rmax(1) = kWCFittingRext1;
2764
2765 shFitt->Z(2) = 0;
2766 shFitt->Rmin(2) = kWCFittingRint2;
2767 shFitt->Rmax(2) = kWCFittingRext2;
2768
2769 shFitt->Z(3) = kWCFittingLen2;
2770 shFitt->Rmin(3) = kWCFittingRint2;
2771 shFitt->Rmax(3) = kWCFittingRext2;
2772
2773 TGeoVolume *volFitt = new TGeoVolume("ITSSPDWaterCoolingFitting",
2774 shFitt, medCopper);
2775 volFitt->SetLineColor(kOrange);
2776
96eb8210 2777 // Now place everything in the containers
2778 volTubeA->AddNode(volGasFr, 1, 0);
2779 volTubeC->AddNode(volFreon, 1, 0);
2780
2781 volCylTubA->AddNode(volCylGasFr, 1, 0);
2782 volCylTubC->AddNode(volCylFr , 1, 0);
2783
2784 container[0]->AddNode(volCable, 1, 0);
2785
954323d3 2786 xloc = shMCMExt->GetDX() - cableL0;
96eb8210 2787 zloc = shMCMExt->GetDZ();
2788 container[0]->AddNode(volMCMExt, 1,
2789 new TGeoTranslation( xloc, 0.,-zloc));
2790
2791 xloc = shMCMExt->GetDX();
2792 zloc = shCable->GetZ(1)/2 - shMCMExt->GetDZ();
2793 container[0]->AddNode(volPlate, 1,
2794 new TGeoTranslation( xloc, 0., zloc));
2795
45c52bb2 2796 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
2797 rot2->SetName("rotPatch");
2798 rot2->RotateX(90.0);
2799 rot2->RotateY(163.0);
2800 //rot2->RotateZ(132.5);
2801
44d18d38 2802 // add collectors only on side C
2803 if (sideC)
2804 {
2805 TGeoTranslation *trCollBox = new TGeoTranslation(xloc - 0.5*kPlateLength + 0.5*kCollLength, 0.0, +0.5*(kPlateThickness+1.1*kCollThickness));
2806 TGeoRotation *rotCollTube = new TGeoRotation(*gGeoIdentity);
2807 rotCollTube->RotateY(90.0);
2808 TGeoCombiTrans *trCollTube = new TGeoCombiTrans(xloc + 0.5*kCollTubeLength - (0.5*kPlateLength - kCollLength), 0.0, +0.5*(kPlateThickness+2.0*kCollTubeRadius+kCollTubeThick), rotCollTube);
2809 container[0]->AddNode(volCollBox, 1, trCollBox);
2810 container[0]->AddNode(volCollTube, 1, trCollTube);
2811 }
2812
45c52bb2 2813 Double_t dxPatch = 2.9;
2814 Double_t dzPatch = 2.8;
2815 TGeoCombiTrans *tr2 = new TGeoCombiTrans(1.7*ext2Length - dxPatch, 0.0, dzPatch, rot2);
2816 container[3]->AddNode(volPatch, 0, tr2);
2817
96eb8210 2818 xloc = shTube->GetRmax();
2819 yloc = shTube->GetRmax();
2820 zloc = shTube->GetDz() - shTube->GetRmax() - kYtoHalfStave;
2821 container[1]->AddNode(volTubeA, 1,
2822 new TGeoTranslation(-xloc, -yloc, zloc));
2823 container[2]->AddNode(volTubeC, 1,
2824 new TGeoTranslation(-xloc, -yloc, zloc));
2825
2826 xloc = shTube->GetRmax();
2827 yloc = (shCylTub->GetDz())*SinD(angrot) - shTube->GetRmax();
2828 zloc = (shCylTub->GetDz())*CosD(angrot) + shTube->GetRmax() +kYtoHalfStave;
2829 container[1]->AddNode(volCylTubA, 1,
2830 new TGeoCombiTrans(-xloc, yloc,-zloc,
2831 new TGeoRotation("",0.,angrot,0.)));
2832 container[2]->AddNode(volCylTubC, 1,
2833 new TGeoCombiTrans(-xloc, yloc,-zloc,
2834 new TGeoRotation("",0.,angrot,0.)));
2835
45c52bb2 2836 xloc = shOptFibs->GetRmax() + 2*shTube->GetRmax();
c890eba4 2837 yloc = 1.6*shOptFibs->GetRmax();
45c52bb2 2838 zloc = shOptFibs->GetDZ() - shTube->GetRmax() - kYtoHalfStave;
2839 container[1]->AddNode(volOptFibs, 1,
2840 new TGeoTranslation(-xloc, -yloc, zloc));
2841 container[2]->AddNode(volOptFibs, 1,
2842 new TGeoTranslation(-xloc, -yloc, zloc));
2843
c890eba4 2844 yloc = shWatCool->GetRmax();
2845 zloc = (2*shTube->GetDz() - shTube->GetRmax() - kYtoHalfStave)/2;
2846 container[4]->AddNode(volWatCool, 1,
2847 new TGeoTranslation(0, -yloc, zloc));
2848
2849 container[4]->AddNode(volWCPltT, 1,
2850 new TGeoTranslation(0, -yloc, zloc));
2851
2852 yloc -= shWCPltB->GetDY();
2853 xloc = shWatCool->GetRmax() + shWCPltB->GetDX();
2854 container[4]->AddNode(volWCPltB, 1,
2855 new TGeoTranslation( xloc, -yloc, zloc));
2856 container[4]->AddNode(volWCPltB, 2,
2857 new TGeoTranslation(-xloc, -yloc, zloc));
2858
2859 yloc = shWatCool->GetRmax();
2860 zloc -= shWatCool->GetDz();
2861 container[4]->AddNode(volFitt, 1,
2862 new TGeoTranslation(0, -yloc, zloc));
2863
96eb8210 2864 // Finally create the list of assemblies and return it to the caller
0b9c8a10 2865 TList* conemodulelist = new TList();
0b9c8a10 2866 conemodulelist->Add(container[0]);
2867 conemodulelist->Add(container[1]);
96eb8210 2868 conemodulelist->Add(container[2]);
45c52bb2 2869 conemodulelist->Add(container[3]);
c890eba4 2870 conemodulelist->Add(container[4]);
d0048cec 2871
0b9c8a10 2872 return conemodulelist;
7f69c251 2873}
2874
2875//______________________________________________________________________
2876void AliITSv11GeometrySPD::CreateCones(TGeoVolume *moth) const
2877{
96eb8210 2878 //
2879 // Places all services modules in the mother reference system
2880 //
2881 // Created: ?? ??? 2008 Alberto Pulvirenti
2882 // Updated: 03 May 2010 Mario Sitta
c890eba4 2883 // Updated: 04 Jul 2010 Mario Sitta Water cooling
96eb8210 2884 //
d0048cec 2885
96eb8210 2886 const Int_t kNumberOfModules = 10;
2887
2888 const Double_t kInnerRadius = 80.775*fgkmm;
2889 const Double_t kZTrans = 452.000*fgkmm;
2890 const Double_t kAlphaRot = 46.500*fgkDegree;
c890eba4 2891 const Double_t kAlphaSpaceCool = 9.200*fgkDegree;
96eb8210 2892
44d18d38 2893 TList* modulelistA = CreateConeModule(kFALSE, 90-kAlphaRot);
2894 TList* modulelistC = CreateConeModule(kTRUE , 90-kAlphaRot);
2895 TList* &modulelist = modulelistC;
2896 TGeoVolumeAssembly* module, *moduleA, *moduleC;
d0048cec 2897
96eb8210 2898 Double_t xloc, yloc, zloc;
2899
7f69c251 2900 //Double_t angle[10] = {18., 54., 90., 126., 162., -18., -54., -90., -126., -162.};
45c52bb2 2901 // anglem for cone modules (cables and cooling tubes)
2902 // anglep for pathc panels
96eb8210 2903 Double_t anglem[10] = {18., 54., 90., 126., 162., 198., 234., 270., 306., 342.};
45c52bb2 2904 Double_t anglep[10] = {18., 62., 90., 115., 162., 198., 242., 270., 295., 342.};
96eb8210 2905// Double_t angle1m[10] = {23., 53., 90., 127., 157., 203.0, 233.0, 270.0, 307.0, 337.0};
2906// Double_t angle2m[10] = {18., 53., 90., 126., 162., 198.0, 233.0, 270.0, 309.0, 342.0};
2907// Double_t angle1c[10] = {23., 53., 90., 124., 157., 203.0, 233.0, 270.0, 304.0, 337.0};
2908// Double_t angle2c[10] = {18., 44., 90., 126., 162., 198.0, 223.0, 270.0, 309.0, 342.0};
0b9c8a10 2909
2910 // First add the cables
44d18d38 2911 moduleA = (TGeoVolumeAssembly*)modulelistA->At(0);
2912 moduleC = (TGeoVolumeAssembly*)modulelistC->At(0);
96eb8210 2913 for (Int_t i = 0; i < kNumberOfModules; i++) {
7f69c251 2914 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
96eb8210 2915 rot1->RotateY(-kAlphaRot);
2916 rot1->RotateZ(anglem[i]);
2917 xloc = kInnerRadius*CosD(anglem[i]);
2918 yloc = kInnerRadius*SinD(anglem[i]);
2919 zloc = kZTrans;
44d18d38 2920 moth->AddNode(moduleA, 2*i+2,
96eb8210 2921 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
2922
7f69c251 2923 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
96eb8210 2924 rot2->RotateY(180.-kAlphaRot);
2925 rot2->RotateZ(anglem[i]);
2926 xloc = kInnerRadius*CosD(anglem[i]);
2927 yloc = kInnerRadius*SinD(anglem[i]);
2928 zloc = kZTrans;
44d18d38 2929 moth->AddNode(moduleC, 2*i+1,
96eb8210 2930 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
0b9c8a10 2931 }
2932
96eb8210 2933 // Then the cooling tubes on Side A
0b9c8a10 2934 module = (TGeoVolumeAssembly*)modulelist->At(1);
96eb8210 2935 Double_t anglec;
2936 for (Int_t i = 0; i < kNumberOfModules; i++) {
2937 anglec = anglem[i] + kAlphaSpaceCool;
0b9c8a10 2938 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
c890eba4 2939 rot1->RotateX(-90.0+kAlphaRot-0.04); // 0.04 fixes small overlap
2940 rot1->RotateZ(-90.0+anglec);
96eb8210 2941 xloc = kInnerRadius*CosD(anglec);
2942 yloc = kInnerRadius*SinD(anglec);
c890eba4 2943 zloc = kZTrans+0.162; // 0.162 fixes small overlap
2944 moth->AddNode(module, 2*i+2,
96eb8210 2945 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
2946 }
2947
45c52bb2 2948 // And the cooling tubes on Side C
96eb8210 2949 module = (TGeoVolumeAssembly*)modulelist->At(2);
2950 for (Int_t i = 0; i < kNumberOfModules; i++) {
2951 anglec = anglem[i] - kAlphaSpaceCool;
0b9c8a10 2952 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
c890eba4 2953 rot2->RotateX(-90.0+kAlphaRot-0.04); // 0.04 fixes small overlap
96eb8210 2954 rot2->RotateY(180.);
c890eba4 2955 rot2->RotateZ(90.0+anglec);
96eb8210 2956 xloc = kInnerRadius*CosD(anglec);
2957 yloc = kInnerRadius*SinD(anglec);
c890eba4 2958 zloc = kZTrans+0.162; // 0.162 fixes small overlap
96eb8210 2959 moth->AddNode(module, 2*i+1,
2960 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
7f69c251 2961 }
96eb8210 2962
c890eba4 2963 // Then the water cooling tubes
2964 module = (TGeoVolumeAssembly*)modulelist->At(4);
2965 for (Int_t i = 1; i < kNumberOfModules; i++) { // i = 1,2,...,9
2966 if (i != 5) { // There is no tube in this position
2967 anglec = (anglem[i-1]+anglem[i])/2;
2968 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
2969 rot1->RotateX(-90.0+kAlphaRot);
2970 rot1->RotateZ(-90.0+anglec);
2971 xloc = kInnerRadius*CosD(anglec);
2972 yloc = kInnerRadius*SinD(anglec);
2973 zloc = kZTrans;
2974 moth->AddNode(module, 2*i+2,
2975 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
2976
2977 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
2978 rot2->RotateX(-90.0+kAlphaRot);
2979 rot2->RotateY(180.);
2980 rot2->RotateZ(90.0+anglec);
2981 xloc = kInnerRadius*CosD(anglec);
2982 yloc = kInnerRadius*SinD(anglec);
2983 zloc = kZTrans;
2984 moth->AddNode(module, 2*i+1,
2985 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
2986 }
2987 }
2988
45c52bb2 2989 // Finally the optical patch panels
2990 module = (TGeoVolumeAssembly*)modulelist->At(3);
2991 for (Int_t i = 0; i < kNumberOfModules; i++) {
2992 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
2993 rot1->RotateY(-kAlphaRot);
2994 rot1->RotateZ(anglep[i]);
2995 xloc = kInnerRadius*CosD(anglep[i]);
2996 yloc = kInnerRadius*SinD(anglep[i]);
2997 zloc = kZTrans;
c890eba4 2998 moth->AddNode(module, 2*i+2,
45c52bb2 2999 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
3000
3001 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
3002 rot2->RotateY(180.-kAlphaRot);
3003 rot2->RotateZ(anglep[i]);
3004 xloc = kInnerRadius*CosD(anglep[i]);
3005 yloc = kInnerRadius*SinD(anglep[i]);
3006 zloc = kZTrans;
3007 moth->AddNode(module, 2*i+1,
3008 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
3009 }
3010
7f69c251 3011}
3012
c890eba4 3013
54c9a3d9 3014//______________________________________________________________________
3015TGeoVolume* AliITSv11GeometrySPD::CreateExtender(
3016 const Double_t *extenderParams, const TGeoMedium *extenderMedium,
3017 TArrayD& sizes) const
bc3498f4 3018{
54c9a3d9 3019 //
3020 // ------------------ CREATE AN EXTENDER ------------------------
3021 //
3022 // This function creates the following picture (in plane xOy)
3023 // Should be useful for the definition of the pixel bus and MCM extenders
d0048cec 3024 // The origin corresponds to point 0 on the picture, at half-width
3025 // in Z direction
54c9a3d9 3026 //
3027 // Y 7 6 5
3028 // ^ +---+---------------------+
3029 // | / |
3030 // | / |
3031 // 0------> X / +---------------------+
3032 // / / 3 4
3033 // / /
3034 // 9 8 / /
3035 // +-----------+ /
3036 // | /
3037 // | /
3038 // ---> +-----------+---+
3039 // | 0 1 2
3040 // |
3041 // origin (0,0,0)
3042 //
3043 //
3044 // Takes 6 parameters in the following order :
3045 // |--> par 0 : inner length [0-1] / [9-8]
3046 // |--> par 1 : thickness ( = [0-9] / [4-5])
3047 // |--> par 2 : angle of the slope
3048 // |--> par 3 : total height in local Y direction
3049 // |--> par 4 : outer length [3-4] / [6-5]
3050 // |--> par 5 : width in local Z direction
3051 //
d0048cec 3052 Double_t slopeDeltaX = (extenderParams[3] - extenderParams[1]
3053 * TMath::Cos(extenderParams[2])) /
54c9a3d9 3054 TMath::Tan(extenderParams[2]);
3055 Double_t extenderXtruX[10] = {
3056 0 ,
3057 extenderParams[0] ,
d0048cec 3058 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2]) ,
54c9a3d9 3059 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
3060 slopeDeltaX ,
3061 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
d0048cec 3062 slopeDeltaX + extenderParams[4],
54c9a3d9 3063 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
d0048cec 3064 slopeDeltaX + extenderParams[4],
54c9a3d9 3065 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
d0048cec 3066 slopeDeltaX ,
54c9a3d9 3067 extenderParams[0]+extenderParams[1]*TMath::Sin(extenderParams[2])+
3068 slopeDeltaX - extenderParams[1] * TMath::Sin(extenderParams[2]) ,
3069 extenderParams[0] ,
3070 0
3071 };
3072 Double_t extenderXtruY[10] = {
3073 0 ,
3074 0 ,
3075 extenderParams[1] * (1-TMath::Cos(extenderParams[2])) ,
3076 extenderParams[3] - extenderParams[1] ,
3077 extenderParams[3] - extenderParams[1] ,
3078 extenderParams[3] ,
3079 extenderParams[3] ,
3080 extenderParams[3]-extenderParams[1]*(1-TMath::Cos(extenderParams[2])) ,
3081 extenderParams[1] ,
3082 extenderParams[1]
3083 };
592651e2 3084
54c9a3d9 3085 if (sizes.GetSize() != 3) sizes.Set(3);
3086 Double_t &thickness = sizes[0];
3087 Double_t &length = sizes[1];
3088 Double_t &width = sizes[2];
3089
3090 thickness = extenderParams[3];
3091 width = extenderParams[5];
3092 length = extenderParams[0]+extenderParams[1]*
3093 TMath::Sin(extenderParams[2])+slopeDeltaX+extenderParams[4];
3094
3095 // creation of the volume
3096 TGeoXtru *extenderXtru = new TGeoXtru(2);
3097 TGeoVolume *extenderXtruVol = new TGeoVolume("ITSSPDextender",extenderXtru,
3098 extenderMedium);
3099 extenderXtru->DefinePolygon(10,extenderXtruX,extenderXtruY);
3100 extenderXtru->DefineSection(0,-0.5*extenderParams[4]);
3101 extenderXtru->DefineSection(1, 0.5*extenderParams[4]);
3102 return extenderXtruVol;
3103}
c890eba4 3104
54c9a3d9 3105//______________________________________________________________________
3106TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateHalfStave(Bool_t isRight,
3107Int_t layer,Int_t idxCentral,Int_t idxSide,TArrayD &sizes,TGeoManager *mgr)
bc3498f4 3108{
54c9a3d9 3109 //
d0048cec 3110 // Implementation of an half-stave, which depends on the side where
3111 // we are on the stave. The convention for "left" and "right" is the
3112 // same as for the MCM. The return value is a TGeoAssembly which is
3113 // structured in such a way that the origin of its local reference
54c9a3d9 3114 // frame coincides with the origin of the whole stave.
3115 // The TArrayD passed by reference will contain details of the shape:
3116 // - sizes[0] = thickness
3117 // - sizes[1] = length
3118 // - sizes[2] = width
3119 // - sizes[3] = common 'x' position for eventual clips
3120 // - sizes[4] = common 'y' position for eventual clips
3121 // - sizes[5] = 'z' position of first clip
3122 // - sizes[6] = 'z' position of second clip
3123 //
3124
3125 // ** CHECK **
3126
3127 // idxCentral and idxSide must be different
3128 if (idxCentral == idxSide) {
3129 AliInfo("Ladders must be inserted in half-stave with "
3130 "different indexes.");
3131 idxSide = idxCentral + 1;
3132 AliInfo(Form("Central ladder will be inserted with index %d",
3133 idxCentral));
3134 AliInfo(Form("Side ladder will be inserted with index %d",idxSide));
3135 } // end if
3136
3137 // define the separations along Z direction between the objects
3138 Double_t sepLadderLadder = fgkmm * 0.2; // sep. btw the 2 ladders
d0048cec 3139 Double_t sepLadderCenter = fgkmm * 0.4; // sep. btw the "central" ladder
54c9a3d9 3140 // and the Z=0 plane in stave ref.
3141 Double_t sepLadderMCM = fgkmm * 0.3; // sep. btw the "external" ladder
3142 // and MCM
d0048cec 3143 Double_t sepBusCenter = fgkmm * 0.3; // sep. btw the bus central edge
54c9a3d9 3144 // and the Z=0 plane in stave ref.
3145
3146 // ** VOLUMES **
3147
3148 // grounding foil
3149 TArrayD grndSize(3);
3150 // This one line repalces the 3 bellow, BNS.
3151 TGeoVolume *grndVol = CreateGroundingFoil(isRight, grndSize, mgr);
3152 Double_t &grndThickness = grndSize[0];
3153 Double_t &grndLength = grndSize[1];
3154
3155 // ladder
3156 TArrayD ladderSize(3);
3157 TGeoVolume *ladder = CreateLadder(layer, ladderSize, mgr);
3158 Double_t ladderThickness = ladderSize[0];
3159 Double_t ladderLength = ladderSize[1];
3160 Double_t ladderWidth = ladderSize[2];
3161
3162 // MCM
3163 TArrayD mcmSize(3);
3164 TGeoVolumeAssembly *mcm = CreateMCM(!isRight,mcmSize,mgr);
3165 Double_t mcmThickness = mcmSize[0];
3166 Double_t mcmLength = mcmSize[1];
3167 Double_t mcmWidth = mcmSize[2];
d0048cec 3168
54c9a3d9 3169 // bus
3170 TArrayD busSize(6);
22726349 3171 TGeoVolumeAssembly *bus = CreatePixelBus(isRight, layer, busSize, mgr);
54c9a3d9 3172 Double_t busThickness = busSize[0];
3173 Double_t busLength = busSize[1];
3174 Double_t busWidth = busSize[2];
3175
3176 // glue between ladders and pixel bus
3177 TGeoMedium *medLadGlue = GetMedium("EPOXY$", mgr);
3178 Double_t ladGlueThickness = fgkmm * 0.1175 - fgkGapLadder;
3179 TGeoVolume *ladderGlue = mgr->MakeBox("ITSSPDladderGlue",medLadGlue,
3180 0.5*ladGlueThickness, 0.5*busWidth, 0.5*busLength);
3181 ladderGlue->SetLineColor(kYellow + 5);
3182
3183 // create references for the whole object, as usual
3184 sizes.Set(7);
3185 Double_t &fullThickness = sizes[0];
3186 Double_t &fullLength = sizes[1];
3187 Double_t &fullWidth = sizes[2];
d0048cec 3188
54c9a3d9 3189 // compute the full size of the container
3190 fullLength = sepLadderCenter+2.0*ladderLength+sepLadderMCM+
3191 sepLadderLadder+mcmLength;
3192 fullWidth = ladderWidth;
3193 fullThickness = grndThickness + fgkGapLadder + mcmThickness + busThickness;
ed0e944d 3194 //cout << "HSTAVE FULL THICKNESS = " << fullThickness << endl;
54c9a3d9 3195
3196 // ** MOVEMENTS **
3197
3198 // grounding foil (shifted only along thickness)
3199 Double_t xGrnd = -0.5*fullThickness + 0.5*grndThickness;
3200 Double_t zGrnd = -0.5*grndLength;
3201 if (!isRight) zGrnd = -zGrnd;
3202 TGeoTranslation *grndTrans = new TGeoTranslation(xGrnd, 0.0, zGrnd);
3203
3204 // ladders (translations along thickness and length)
d0048cec 3205 // layers must be sorted going from the one at largest Z to the
54c9a3d9 3206 // one at smallest Z:
3207 // -|Zmax| ------> |Zmax|
3208 // 3 2 1 0
d0048cec 3209 // then, for layer 1 ladders they must be placed exactly this way,
3210 // and in layer 2 at the opposite. In order to remember the placements,
3211 // we define as "inner" and "outer" ladder respectively the one close
54c9a3d9 3212 // to barrel center, and the one closer to MCM, respectively.
3213 Double_t xLad, zLadIn, zLadOut;
3214 xLad = xGrnd + 0.5*(grndThickness + ladderThickness) +
3215 0.01175 - fgkGapLadder;
3216 zLadIn = -sepLadderCenter - 0.5*ladderLength;
3217 zLadOut = zLadIn - sepLadderLadder - ladderLength;
3218 if (!isRight) {
3219 zLadIn = -zLadIn;
3220 zLadOut = -zLadOut;
3221 } // end if !isRight
3222 TGeoRotation *rotLad = new TGeoRotation(*gGeoIdentity);
3223 rotLad->RotateZ(90.0);
3224 rotLad->RotateY(180.0);
3225 Double_t sensWidth = fgkmm * 12.800;
3226 Double_t chipWidth = fgkmm * 15.950;
3227 Double_t guardRingWidth = fgkmm * 0.560;
3228 Double_t ladderShift = 0.5 * (chipWidth - sensWidth - 2.0*guardRingWidth);
3229 TGeoCombiTrans *trLadIn = new TGeoCombiTrans(xLad,ladderShift,zLadIn,
3230 rotLad);
3231 TGeoCombiTrans *trLadOut = new TGeoCombiTrans(xLad,ladderShift,zLadOut,
3232 rotLad);
3233
d0048cec 3234 // MCM (length and thickness direction, placing at same level as the
3235 // ladder, which implies to recompute the position of center, because
3236 // ladder and MCM have NOT the same thickness) the two copies of the
54c9a3d9 3237 // MCM are placed at the same distance from the center, on both sides
d0048cec 3238 Double_t xMCM = xGrnd + 0.5*grndThickness + 0.5*mcmThickness +
54c9a3d9 3239 0.01175 - fgkGapLadder;
3240 Double_t yMCM = 0.5*(fullWidth - mcmWidth);
3241 Double_t zMCM = zLadOut - 0.5*ladderLength - 0.5*mcmLength - sepLadderMCM;
d0048cec 3242 if (!isRight) zMCM = zLadOut + 0.5*ladderLength + 0.5*mcmLength +
54c9a3d9 3243 sepLadderMCM;
3244
3245 // create the correction rotations
3246 TGeoRotation *rotMCM = new TGeoRotation(*gGeoIdentity);
3247 rotMCM->RotateY(90.0);
3248 TGeoCombiTrans *trMCM = new TGeoCombiTrans(xMCM, yMCM, zMCM, rotMCM);
3249
3250 // glue between ladders and pixel bus
d0048cec 3251 Double_t xLadGlue = xLad + 0.5*ladderThickness + 0.01175 -
54c9a3d9 3252 fgkGapLadder + 0.5*ladGlueThickness;
3253
3254 // bus (length and thickness direction)
3255 Double_t xBus = xLadGlue + 0.5*ladGlueThickness + 0.5*busThickness;
7708d5f3 3256 Double_t yBus = 0.5*(fullWidth - busWidth) + 0.075; // Hardcode fix of a small overlap
54c9a3d9 3257 Double_t zBus = -0.5*busLength - sepBusCenter;
3258 if (!isRight) zBus = -zBus;
3259 TGeoTranslation *trBus = new TGeoTranslation(xBus, yBus, zBus);
3260
3261 TGeoTranslation *trLadGlue = new TGeoTranslation(xLadGlue, 0.0, zBus);
3262
3263 // create the container
3264 TGeoVolumeAssembly *container = 0;
3265 if (idxCentral+idxSide==5) {
3266 container = new TGeoVolumeAssembly("ITSSPDhalf-Stave1");
3267 } else {
3268 container = new TGeoVolumeAssembly("ITSSPDhalf-Stave0");
3269 } // end if
3270
3271 // add to container all objects
3272 container->AddNode(grndVol, 1, grndTrans);
3273 // ladders are inserted in different order to respect numbering scheme
3274 // which is inverted when going from outer to inner layer
3275 container->AddNode(ladder, idxCentral+1, trLadIn);
3276 container->AddNode(ladder, idxSide+1, trLadOut);
3277 container->AddNode(ladderGlue, 1, trLadGlue);
3278 container->AddNode(mcm, 1, trMCM);
3279 container->AddNode(bus, 1, trBus);
3280
3281 // since the clips are placed in correspondence of two pt1000s,
3282 // their position is computed here, but they are not added by default
3283 // it will be the StavesInSector method which will decide to add them
3284 // anyway, to recovery some size informations on the clip, it must be
3285 // created
3286 TArrayD clipSize;
3ffa185f 3287 // TGeoVolume *clipDummy = CreateClip(clipSize, kTRUE, mgr);
54c9a3d9 3288 CreateClip(clipSize, kTRUE, mgr);
3289 // define clip movements (width direction)
3290 sizes[3] = xBus + 0.5*busThickness;
3291 sizes[4] = 0.5 * (fullWidth - busWidth) - clipSize[6] - fgkmm*0.48;
3292 sizes[5] = zBus + busSize[4];
3293 sizes[6] = zBus + busSize[5];
3294
3295 return container;
592651e2 3296}
54c9a3d9 3297//______________________________________________________________________
3298TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateStave(Int_t layer,
3299 TArrayD &sizes, TGeoManager *mgr)
7855ea93 3300{
54c9a3d9 3301 //
3302 // This method uses all other ones which create pieces of the stave
3303 // and assemblies everything together, in order to return the whole
3304 // stave implementation, which is returned as a TGeoVolumeAssembly,
3305 // due to the presence of some parts which could generate fake overlaps
3306 // when put on the sector.
3307 // This assembly contains, going from bottom to top in the thickness
3308 // direction:
d0048cec 3309 // - the complete grounding foil, defined by the "CreateGroundingFoil"
3310 // method which already joins some glue and real groudning foil
54c9a3d9 3311 // layers for the whole stave (left + right);
d0048cec 3312 // - 4 ladders, which are sorted according to the ALICE numbering
54c9a3d9 3313 // scheme, which depends on the layer we are building this stave for;
3314 // - 2 MCMs (a left and a right one);
3315 // - 2 pixel buses (a left and a right one);
3316 // ---
3317 // Arguments:
d0048cec 3318 // - the layer number, which determines the displacement and naming
54c9a3d9 3319 // of sensitive volumes
d0048cec 3320 // - a TArrayD passed by reference which will contain the size
54c9a3d9 3321 // of virtual box containing the stave
3322 // - the TGeoManager
3323 //
3324
3325 // create the container
3326 TGeoVolumeAssembly *container = new TGeoVolumeAssembly(Form(
3327 "ITSSPDlay%d-Stave",layer));
3328 // define the indexes of the ladders in order to have the correct order
d0048cec 3329 // keeping in mind that the staves will be inserted as they are on layer
3330 // 2, while they are rotated around their local Y axis when inserted
3331 // on layer 1, so in this case they must be put in the "wrong" order
3332 // to turn out to be right at the end. The convention is:
54c9a3d9 3333 // -|Zmax| ------> |Zmax|
3334 // 3 2 1 0
d0048cec 3335 // with respect to the "native" stave reference frame, "left" is in
54c9a3d9 3336 // the positive Z this leads the definition of these indexes:
3337 Int_t idxCentralL, idxSideL, idxCentralR, idxSideR;
3338
3339 if (layer == 1) {
3340 idxSideL = 3;
3341 idxCentralL = 2;
3342 idxCentralR = 1;
3343 idxSideR = 0;
3344 } else {
3345 idxSideL = 0;
3346 idxCentralL = 1;
3347 idxCentralR = 2;
3348 idxSideR = 3;
3349 } // end if layer ==1
d0048cec 3350
54c9a3d9 3351 // create the two half-staves
3352 TArrayD sizeL, sizeR;
3353 TGeoVolumeAssembly *hstaveL = CreateHalfStave(kFALSE, layer, idxCentralL,
3354 idxSideL, sizeL,mgr);
3355 TGeoVolumeAssembly *hstaveR = CreateHalfStave(kTRUE, layer, idxCentralR,
3356 idxSideR, sizeR, mgr);
3357 // copy the size to the stave's one
3358 sizes.Set(9);
3359 sizes[0] = sizeL[0];
3360 sizes[1] = sizeR[1] + sizeL[1];
3361 sizes[2] = sizeL[2];
3362 sizes[3] = sizeL[3];
3363 sizes[4] = sizeL[4];
3364 sizes[5] = sizeL[5];
3365 sizes[6] = sizeL[6];
3366 sizes[7] = sizeR[5];
3367 sizes[8] = sizeR[6];
3368
3369 // add to container all objects
3370 container->AddNode(hstaveL, 1);
3371 container->AddNode(hstaveR, 1);
3372
3373 return container;
bc3498f4 3374}
54c9a3d9 3375//______________________________________________________________________
bc3498f4 3376void AliITSv11GeometrySPD::SetAddStave(Bool_t *mask)
3377{
54c9a3d9 3378 //
3379 // Define a mask which states qhich staves must be placed.
d0048cec 3380 // It is a string which must contain '0' or '1' depending if
54c9a3d9 3381 // a stave must be placed or not.
d0048cec 3382 // Each place is referred to one of the staves, so the first
54c9a3d9 3383 // six characters of the string will be checked.
3384 //
3385 Int_t i;
3386
3387 for (i = 0; i < 6; i++) fAddStave[i] = mask[i];
bc3498f4 3388}
54c9a3d9 3389//______________________________________________________________________
3390void AliITSv11GeometrySPD::StavesInSector(TGeoVolume *moth, TGeoManager *mgr)
3391{
3392 //
3393 // Unification of essentially two methods:
3394 // - the one which creates the sector structure
3395 // - the one which returns the complete stave
3396 // ---
3397 // For compatibility, this method requires the same arguments
3398 // asked by "CarbonFiberSector" method, which is recalled here.
3399 // Like this cited method, this one does not return any value,
3400 // but it inserts in the mother volume (argument 'moth') all the stuff
3401 // which composes the complete SPD sector.
3402 // ---
d0048cec 3403 // In the following, the stave numbering order used for arrays is the
54c9a3d9 3404 // same as defined in the GetSectorMountingPoints():
3405 // /5
3406 // /\/4
3407 // 1\ \/3
3408 // 0|___\/2
3409 // ---
3410 // Arguments: see description of "CarbonFiberSector" method.
3411 //
3412
d0048cec 3413 Double_t shift[6]; // shift from the innermost position in the
3414 // sector placement plane (where the stave
3415 // edge is in the point where the rounded
54c9a3d9 3416 // corner begins)
3417
3418 shift[0] = fgkmm * -0.691;
3419 shift[1] = fgkmm * 5.041;
3420 shift[2] = fgkmm * 1.816;
3421 shift[3] = fgkmm * -0.610;
3422 shift[4] = fgkmm * -0.610;
3423 shift[5] = fgkmm * -0.610;
d0048cec 3424
3ffa185f 3425 // corrections after interaction with Andrea and CAD
3426 Double_t corrX[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3427 Double_t corrY[6] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
d0048cec 3428
3ffa185f 3429 corrX[0] = 0.0046;
3430 corrX[1] = -0.0041;
3431 corrX[2] = corrX[3] = corrX[4] = corrX[5] = -0.0016;
d0048cec 3432
3ffa185f 3433 corrY[0] = -0.0007;
3434 corrY[1] = -0.0009;
3435 corrY[2] = corrY[3] = corrY[4] = corrY[5] = -0.0003;
d0048cec 3436
3ffa185f 3437 corrX[0] += 0.00026;
3438 corrY[0] += -0.00080;
d0048cec 3439
3ffa185f 3440 corrX[1] += 0.00018;
3441 corrY[1] += -0.00086;
d0048cec 3442
3ffa185f 3443 corrX[2] += 0.00020;
3444 corrY[2] += -0.00062;
d0048cec 3445
3ffa185f 3446 corrX[3] += 0.00017;
3447 corrY[3] += -0.00076;
d0048cec 3448
3ffa185f 3449 corrX[4] += 0.00016;
3450 corrY[4] += -0.00096;
d0048cec 3451
3ffa185f 3452 corrX[5] += 0.00018;
3453 corrY[5] += -0.00107;
d0048cec 3454
54c9a3d9 3455 // create stave volumes (different for layer 1 and 2)
3456 TArrayD staveSizes1(9), staveSizes2(9), clipSize(5);
3457 Double_t &staveHeight = staveSizes1[2], &staveThickness = staveSizes1[0];
3458 TGeoVolume *stave1 = CreateStave(1, staveSizes1, mgr);
3459 TGeoVolume *stave2 = CreateStave(2, staveSizes2, mgr);
3460 TGeoVolume *clip = CreateClip(clipSize, kFALSE, mgr);
3461
3462 Double_t xL, yL; // leftmost edge of mounting point (XY projection)
3463 Double_t xR, yR; // rightmost edge of mounting point (XY projection)
3464 Double_t xM, yM; // middle point of the segment L-R
3465 Double_t dx, dy; // (xL - xR) and (yL - yR)
3466 Double_t widthLR; // width of the segment L-R
3467 Double_t angle; // stave rotation angle in degrees
d0048cec 3468 Double_t diffWidth; // difference between mounting plane width and
54c9a3d9 3469 // stave width (smaller)
3470 Double_t xPos, yPos; // final translation of the stave
3471 Double_t parMovement; // translation in the LR plane direction
d0048cec 3472
54c9a3d9 3473 staveThickness += fgkGapHalfStave;
d0048cec 3474
54c9a3d9 3475 // loop on staves
3476 Int_t i, iclip = 1;
3477 for (i = 0; i < 6; i++) {
3478 // in debug mode, if this stave is not required, it is skipped
3479 if (!fAddStave[i]) continue;
3480 // retrieve reference points
3481 GetSectorMountingPoints(i, xL, yL, xR, yR);
3482 xM = 0.5 * (xL + xR);
3483 yM = 0.5 * (yL + yR);
3484 dx = xL - xR;
3485 dy = yL - yR;
3486 angle = TMath::ATan2(dy, dx);
3487 widthLR = TMath::Sqrt(dx*dx + dy*dy);
3488 diffWidth = 0.5*(widthLR - staveHeight);
3489 // first, a movement along this plane must be done
3490 // by an amount equal to the width difference
3491 // and then the fixed shift must also be added
3492 parMovement = diffWidth + shift[i];
d0048cec 3493 // due to stave thickness, another movement must be done
54c9a3d9 3494 // in the direction normal to the mounting plane
d0048cec 3495 // which is computed using an internal method, in a reference
3496 // frame where the LR segment has its middle point in the origin
54c9a3d9 3497 // and axes parallel to the master reference frame
3498 if (i == 0) {
d0048cec 3499 ParallelPosition(-0.5*staveThickness, -parMovement, angle,
54c9a3d9 3500 xPos, yPos);
3501 } // end if i==0
3502 if (i == 1) {
d0048cec 3503 ParallelPosition( 0.5*staveThickness, -parMovement, angle,
54c9a3d9 3504 xPos, yPos);
3505 }else {
d0048cec 3506 ParallelPosition( 0.5*staveThickness, parMovement, angle,
54c9a3d9 3507 xPos, yPos);
3508 } // end if i==1
3509 // then we go into the true reference frame
3510 xPos += xM;
3511 yPos += yM;
3ffa185f 3512 xPos += corrX[i];
3513 yPos += corrY[i];
d0048cec 3514 // using the parameters found here, compute the
54c9a3d9 3515 // translation and rotation of this stave:
3516 TGeoRotation *rot = new TGeoRotation(*gGeoIdentity);
3517 if (i == 0 || i == 1) rot->RotateX(180.0);
3518 rot->RotateZ(90.0 + angle * TMath::RadToDeg());
3519 TGeoCombiTrans *trans = new TGeoCombiTrans(xPos, yPos, 0.0, rot);
3520 if (i == 0 || i == 1) {
3521 moth->AddNode(stave1, i+1, trans);
3522 }else {
3523 moth->AddNode(stave2, i - 1, trans);
3524 if (i != 2) {
3525 // except in the case of stave #2,
3526 // clips must be added, and this is done directly on the sector
3527 Int_t j;
4adcf390 3528 //TArrayD clipSize;
54c9a3d9 3529 TGeoRotation *rotClip = new TGeoRotation(*gGeoIdentity);
3530 rotClip->RotateZ(-90.0);
3531 rotClip->RotateX(180.0);
3532 Double_t x = staveSizes2[3] + fgkGapHalfStave;
3533 Double_t y = staveSizes2[4];
d0048cec 3534 Double_t z[4] = { staveSizes2[5], staveSizes2[6],
54c9a3d9 3535 staveSizes2[7], staveSizes2[8] };
3536 for (j = 0; j < 4; j++) {
3537 TGeoCombiTrans *trClip = new TGeoCombiTrans(x, y, z[j],
3538 rotClip);
3539 *trClip = *trans * *trClip;
3540 moth->AddNode(clip, iclip++, trClip);
3541 } // end for j
3542 } // end if i!=2
3543 } // end if i==0||i==1 else
3544 } // end for i
e0b38446 3545
3546
3547 // Add a box representing the collector for cooling tubes
3548 Double_t collWidth = fgkmm * 22.0;
3549 Double_t collLength = fgkmm * 50.0;
3550 Double_t collThickness = fgkmm * 7.0;
3551 Double_t collInSize = fgkmm * 10.5;
3552
3553 TGeoMedium *medColl = GetMedium("INOX$");
3554 TGeoMedium *medCollIn = GetMedium("COPPER$");
3555 TGeoVolume *vColl = mgr->MakeBox("ITSSPDSectorTubeColl" , medColl, 0.5*collWidth, 0.5*collThickness, 0.5*collLength);
3556 TGeoVolume *vCollIn = mgr->MakeBox("ITSSPDSectorTubeCollIn", medCollIn, 0.5*collInSize, 0.5*collInSize, 0.5*collInSize);
3557 vColl->SetLineColor(kGreen+2);
3558 vCollIn->SetLineColor(kYellow);
3559
3560 TGeoTranslation *tr1 = new TGeoTranslation( 0.1, 1.2, 35.0);
3561 TGeoTranslation *tr2 = new TGeoTranslation(-0.1, 1.2, -35.0);
3562 TGeoTranslation *tr3 = new TGeoTranslation( 0.1, 1.2 - 0.5*(collThickness+collInSize), 35.0 + 0.5*(collLength - collInSize));
3563 TGeoTranslation *tr4 = new TGeoTranslation(-0.1, 1.2 - 0.5*(collThickness+collInSize), -35.0 - 0.5*(collLength - collInSize));
3564
3565 moth->AddNode(vColl, 0, tr1);
3566 moth->AddNode(vColl, 1, tr2);
3567 moth->AddNode(vCollIn, 0, tr3);
3568 moth->AddNode(vCollIn, 1, tr4);
3569
592651e2 3570}
54c9a3d9 3571//______________________________________________________________________
bc3498f4 3572void AliITSv11GeometrySPD::ParallelPosition(Double_t dist1, Double_t dist2,
54c9a3d9 3573 Double_t phi, Double_t &x, Double_t &y) const
3574{
3575 //
3576 // Performs the following steps:
d0048cec 3577 // 1 - finds a straight line parallel to the one passing through
54c9a3d9 3578 // the origin and with angle 'phi' with X axis(phi in RADIANS);
d0048cec 3579 // 2 - finds another line parallel to the previous one, with a
54c9a3d9 3580 // distance 'dist1' from it
d0048cec 3581 // 3 - takes a reference point in the second line in the intersection
54c9a3d9 3582 // between the normal to both lines passing through the origin
d0048cec 3583 // 4 - finds a point whith has distance 'dist2' from this reference,
54c9a3d9 3584 // in the second line (point 2)
3585 // ----
d0048cec 3586 // According to the signs given to dist1 and dist2, the point is
54c9a3d9 3587 // found in different position w.r. to the origin
3588 // compute the point
3589 //
3590 Double_t cs = TMath::Cos(phi);
3591 Double_t sn = TMath::Sin(phi);
3592
3593 x = dist2*cs - dist1*sn;
3594 y = dist1*cs + dist2*sn;
592651e2 3595}
54c9a3d9 3596//______________________________________________________________________
3597Double_t AliITSv11GeometrySPD::GetSPDSectorTranslation(
3598 Double_t x0,Double_t y0,Double_t x1,Double_t y1,Double_t r) const
3599{
3600 //
3601 // Comutes the radial translation of a sector to give the
3602 // proper distance between SPD detectors and the beam pipe.
3603 // Units in are units out.
3604 //
3605
3606 //Begin_Html
3607 /*
3608 <A HREF="http://www.physics.ohio-state.edu/HIRG/SoftWareDoc/SPD_Sector_Position.png">
3609 Figure showing the geometry used in the computation below. </A>
3610 */
3611 //End_Html
3612
3613 // Inputs:
3614 // Double_t x0 Point x0 on Sector surface for the inner
3615 // most detector mounting
3616 // Double_t y0 Point y0 on Sector surface for the innor
3617 // most detector mounting
3618 // Double_t x1 Point x1 on Sector surface for the inner
3619 // most detector mounting
3620 // Double_t y1 Point y1 on Sector surface for the innor
3621 // most detector mounting
3622 // Double_t r The radial distance this mounting surface
3623 // should be from the center of the beam pipe.
3624 // Outputs:
3625 // none.
3626 // Return:
3627 // The distance the SPD sector should be displaced radialy.
3628 //
3629 Double_t a,b,c;
3630
3631 a = x0-x1;
3632 if(a==0.0) return 0.0;
3633 a = (y0-y1)/a;
3634 b = TMath::Sqrt(1.0+a*a);
3635 c = y0-a*x0-r*b;
3636 return -c;
3637}
c890eba4 3638
54c9a3d9 3639//______________________________________________________________________
3640void AliITSv11GeometrySPD::PrintAscii(ostream *os) const
3641{
3642 //
bc3498f4 3643 // Print out class data values in Ascii Form to output stream
3644 // Inputs:
3645 // ostream *os Output stream where Ascii data is to be writen
3646 // Outputs:
3647 // none.
3648 // Return:
3649 // none.
54c9a3d9 3650 //
3651 Int_t i,j,k;
bc3498f4 3652#if defined __GNUC__
3653#if __GNUC__ > 2
3654 ios::fmtflags fmt = cout.flags();
3655#else
3656 Int_t fmt;
3657#endif
3658#else
3659#if defined __ICC || defined __ECC || defined __xlC__
3660 ios::fmtflags fmt;
3661#else
3662 Int_t fmt;
3663#endif
3664#endif
54c9a3d9 3665
3666 *os<< fgkGapLadder <<" "<< fgkGapHalfStave<<" "<< 6 <<" ";
3667 for(i=0;i<6;i++) *os<< fAddStave[i] <<" "<<fSPDsectorX0.GetSize();
3668 for(i=0;i<fSPDsectorX0.GetSize();i++) *os<< fSPDsectorX0.GetAt(i) << " ";
3669 for(i=0;i<fSPDsectorX0.GetSize();i++) *os<< fSPDsectorY0.GetAt(i) << " ";
3670 for(i=0;i<fSPDsectorX1.GetSize();i++) *os<< fSPDsectorX1.GetAt(i) << " ";
3671 for(i=0;i<fSPDsectorX1.GetSize();i++) *os<< fSPDsectorY1.GetAt(i) << " ";
3672 *os<<10<<" "<< 2 <<" " << 6 << " "<< 3 <<" ";
d0048cec 3673 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++)
54c9a3d9 3674 *os<<fTubeEndSector[k][0][i][j]<<" ";
d0048cec 3675 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++)
54c9a3d9 3676 *os<<fTubeEndSector[k][1][i][j]<<" ";
bc3498f4 3677 os->flags(fmt); // reset back to old Formating.
3678 return;
3679}
3680//
54c9a3d9 3681//______________________________________________________________________
3682void AliITSv11GeometrySPD::ReadAscii(istream* is)
3683{
3684 //
bc3498f4 3685 // Read in class data values in Ascii Form to output stream
3686 // Inputs:
3687 // istream *is Input stream where Ascii data is to be read in from
3688 // Outputs:
3689 // none.
3690 // Return:
3691 // none.
54c9a3d9 3692 //
3693 Int_t i,j,k,n;
3694 Double_t gapLadder,GapHalfStave;
c0fc8108 3695 const Int_t kLimits = 100;
54c9a3d9 3696 *is>>gapLadder>>GapHalfStave>>n;
3697 if(n!=6){
c0fc8108 3698 AliError(Form("fAddStave Array !=6 n=%d",n));
54c9a3d9 3699 return;
3700 } // end if
3701 for(i=0;i<n;i++) *is>>fAddStave[i];
3702 *is>>n;
c0fc8108 3703 if(n<0 || n> kLimits){
3704 AliError("Anomalous value for parameter n");
3705 return;
3706 }
54c9a3d9 3707 fSPDsectorX0.Set(n);
3708 fSPDsectorY0.Set(n);
3709 fSPDsectorX1.Set(n);
3710 fSPDsectorY1.Set(n);
3711 for(i=0;i<n;i++) *is>>fSPDsectorX0[i];
3712 for(i=0;i<n;i++) *is>>fSPDsectorY0[i];
3713 for(i=0;i<n;i++) *is>>fSPDsectorX1[i];
3714 for(i=0;i<n;i++) *is>>fSPDsectorY1[i];
3715 *is>> i>>j>>n;
3716 if(i!=2||j!=6||n!=3){
3717 Warning("ReadAscii","fTubeEndSector array wrong size [2][6][3],"
3718 "found [%d][%d][%d]",i,j,n);
3719 return;
3720 } // end if
d0048cec 3721 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++)
54c9a3d9 3722 *is>>fTubeEndSector[k][0][i][j];
d0048cec 3723 for(k=0;k<10;k++)for(i=0;i<6;i++)for(j=0;j<3;j++)
54c9a3d9 3724 *is>>fTubeEndSector[k][1][i][j];
3725 return;
bc3498f4 3726}
3727//
54c9a3d9 3728//______________________________________________________________________
3729ostream &operator<<(ostream &os,const AliITSv11GeometrySPD &s)
3730{
3731 //
bc3498f4 3732 // Standard output streaming function
3733 // Inputs:
3734 // ostream &os output steam
3735 // AliITSvPPRasymmFMD &s class to be streamed.
3736 // Output:
3737 // none.
3738 // Return:
3739 // ostream &os The stream pointer
54c9a3d9 3740 //
bc3498f4 3741 s.PrintAscii(&os);
3742 return os;
3743}
3744//
54c9a3d9 3745//______________________________________________________________________
3746istream &operator>>(istream &is,AliITSv11GeometrySPD &s)
3747{
3748 //
bc3498f4 3749 // Standard inputput streaming function
3750 // Inputs:
3751 // istream &is input steam
3752 // AliITSvPPRasymmFMD &s class to be streamed.
3753 // Output:
3754 // none.
3755 // Return:
3756 // ostream &os The stream pointer
54c9a3d9 3757 //
bc3498f4 3758 s.ReadAscii(&is);
3759 return is;
3760}
c890eba4 3761