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