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