Separating well and badly reconstructed pileup vertices. Adding statistics of associa...
[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);
54c9a3d9 416 TGeoMedium *medSPDcoolfl = GetMedium("Freon$", mgr); //ITSspdCoolingFluid
417 //
418 const Double_t ksecDz = 0.5 * 500.0 * fgkmm;
419 //const Double_t ksecLen = 30.0 * fgkmm;
420 const Double_t ksecCthick = 0.2 * fgkmm;
421 const Double_t ksecDipLength = 3.2 * fgkmm;
422 const Double_t ksecDipRadii = 0.4 * fgkmm;
423 //const Double_t ksecCoolingTubeExtraDepth = 0.86 * fgkmm;
424 //
425 // The following positions ('ksecX#' and 'ksecY#') and radii ('ksecR#')
426 // are the centers and radii of curvature of all the rounded corners
427 // between the straight borders of the SPD sector shape.
428 // To draw this SPD sector, the following steps are followed:
429 // 1) the (ksecX, ksecY) points are plotted
430 // and circles of the specified radii are drawn around them.
431 // 2) each pair of consecutive circles is connected by a line
d0048cec 432 // tangent to them, in accordance with the radii being "internal"
433 // or "external" with respect to the closed shape which describes
54c9a3d9 434 // the sector itself.
d0048cec 435 // The resulting connected shape is the section
54c9a3d9 436 // of the SPD sector surface in the transverse plane (XY).
437 //
438 const Double_t ksecX0 = -10.725 * fgkmm;
439 const Double_t ksecY0 = -14.853 * fgkmm;
440 const Double_t ksecR0 = -0.8 * fgkmm; // external
3ffa185f 441
30611568 442 const Double_t ksecR1 = +0.6 * fgkmm;
443 const Double_t ksecR2 = +0.6 * fgkmm;
444 const Double_t ksecR3 = -0.6 * fgkmm;
445 const Double_t ksecR4 = +0.8 * fgkmm;
446 const Double_t ksecR5 = +0.8 * fgkmm;
447 const Double_t ksecR6 = +0.6 * fgkmm;
448 const Double_t ksecR7 = -0.6 * fgkmm;
449 const Double_t ksecR8 = +0.6 * fgkmm;
450 const Double_t ksecR9 = -0.6 * fgkmm;
451 const Double_t ksecR10 = +0.6 * fgkmm;
452 const Double_t ksecR11 = -0.6 * fgkmm;
453 const Double_t ksecR12 = +0.85 * fgkmm;
454
455// // IDEAL GEOMETRY
456// 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};
457// 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};
458// 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};
459// 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};
460// 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};
461// 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};
462// 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};
463// 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};
464// 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};
465// 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};
466// 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};
467// 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};
468// 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};
469// 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};
470// 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};
471// 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};
472// 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};
473// 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};
474// 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};
475// 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};
476// 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};
477// 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};
478// 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};
479// 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};
480
481
482// MODIFIED GEOMETRY according with partial alignment of Staves relative to Sectors
483// last numbers: 2010/06/11 (ML)
484
485 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};
486 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};
487 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};
488 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};
489// 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};
490// 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};
491// 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};
492// 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};
493 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};
494 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};
495 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};
496 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};
497 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};
498 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};
499 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};
500 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};
501 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};
502 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};
503 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};
504 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};
505 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};
506 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};
507 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};
508 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};
509 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};
510 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};
511 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};
512 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};
513
514
54c9a3d9 515 const Double_t ksecR13 = -0.8 * fgkmm; // external
516 const Double_t ksecAngleSide13 = 36.0 * fgkDegree;
517 //
518 const Int_t ksecNRadii = 20;
519 const Int_t ksecNPointsPerRadii = 4;
520 const Int_t ksecNCoolingTubeDips = 6;
521 //
522 // Since the rounded parts are approximated by a regular polygon
523 // and a cooling tube of the propper diameter must fit, a scaling factor
524 // increases the size of the polygon for the tube to fit.
525 //const Double_t ksecRCoolScale = 1./TMath::Cos(TMath::Pi()/
526 // (Double_t)ksecNPointsPerRadii);
527 const Double_t ksecZEndLen = 30.000 * fgkmm;
528 //const Double_t ksecZFlangLen = 45.000 * fgkmm;
529 const Double_t ksecTl = 0.860 * fgkmm;
530 const Double_t ksecCthick2 = 0.600 * fgkmm;
531 //const Double_t ksecCthick3 = 1.80 * fgkmm;
532 //const Double_t ksecSidelen = 22.0 * fgkmm;
533 //const Double_t ksecSideD5 = 3.679 * fgkmm;
534 //const Double_t ksecSideD12 = 7.066 * fgkmm;
535 const Double_t ksecRCoolOut = 2.400 * fgkmm;
536 const Double_t ksecRCoolIn = 2.000 * fgkmm;
537 const Double_t ksecDl1 = 5.900 * fgkmm;
538 const Double_t ksecDl2 = 8.035 * fgkmm;
539 const Double_t ksecDl3 = 4.553 * fgkmm;
540 const Double_t ksecDl4 = 6.978 * fgkmm;
541 const Double_t ksecDl5 = 6.978 * fgkmm;
542 const Double_t ksecDl6 = 6.978 * fgkmm;
543 const Double_t ksecCoolTubeThick = 0.04 * fgkmm;
544 const Double_t ksecCoolTubeROuter = 2.6 * fgkmm;
545 const Double_t ksecCoolTubeFlatX = 3.696 * fgkmm;
546 const Double_t ksecCoolTubeFlatY = 0.68 * fgkmm;
547 //const Double_t ksecBeamX0 = 0.0 * fgkmm; // guess
548 //const Double_t ksecBeamY0 = (15.223 + 40.) * fgkmm; // guess
549 //
550 // redefine some of the points already defined above
551 // in the format of arrays (???)
552 const Int_t ksecNPoints = (ksecNPointsPerRadii + 1) * ksecNRadii + 8;
553 Double_t secX[ksecNRadii] = {
30611568 554 ksecX0, ksecX1[sect], -1000.0,
555 ksecX2[sect], ksecX3[sect], -1000.0,
556 ksecX4[sect], ksecX5[sect], -1000.0,
557 ksecX6[sect], ksecX7[sect], -1000.0,
558 ksecX8[sect], ksecX9[sect], -1000.0,
559 ksecX10[sect], ksecX11[sect], -1000.0,
560 ksecX12[sect], -1000.0
54c9a3d9 561 };
562 Double_t secY[ksecNRadii] = {
30611568 563 ksecY0, ksecY1[sect], -1000.0,
564 ksecY2[sect], ksecY3[sect], -1000.0,
565 ksecY4[sect], ksecY5[sect], -1000.0,
566 ksecY6[sect], ksecY7[sect], -1000.0,
567 ksecY8[sect], ksecY9[sect], -1000.0,
568 ksecY10[sect], ksecY11[sect], -1000.0,
569 ksecY12[sect], -1000.0
54c9a3d9 570 };
d0048cec 571 Double_t secR[ksecNRadii] = {
54c9a3d9 572 ksecR0, ksecR1, -.5 * ksecDipLength - ksecDipRadii,
573 ksecR2, ksecR3, -.5 * ksecDipLength - ksecDipRadii,
574 ksecR4, ksecR5, -.5 * ksecDipLength - ksecDipRadii,
575 ksecR6, ksecR7, -.5 * ksecDipLength - ksecDipRadii,
576 ksecR8, ksecR9, -.5 * ksecDipLength - ksecDipRadii,
577 ksecR10, ksecR11, -.5 * ksecDipLength - ksecDipRadii,
578 ksecR12, ksecR13
579 };
c890eba4 580
54c9a3d9 581 Double_t secX2[ksecNRadii];
582 Double_t secY2[ksecNRadii];
583 Double_t secR2[ksecNRadii] = {
584 ksecR0, ksecR1, ksecRCoolOut,
585 ksecR2, ksecR3, ksecRCoolOut,
586 ksecR4, ksecR5, ksecRCoolOut,
587 ksecR6, ksecR7, ksecRCoolOut,
588 ksecR8, ksecR9, ksecRCoolOut,
589 ksecR10, ksecR11, ksecRCoolOut,
590 ksecR12, ksecR13
591 };
d0048cec 592 Double_t secDip2[ksecNCoolingTubeDips] = {
593 ksecDl1, ksecDl2, ksecDl3,
594 ksecDl4, ksecDl5, ksecDl6
54c9a3d9 595 };
596 Double_t secX3[ksecNRadii];
597 Double_t secY3[ksecNRadii];
598 const Int_t ksecDipIndex[ksecNCoolingTubeDips] = {2, 5, 8, 11, 14, 17};
599 Double_t secAngleStart[ksecNRadii];
600 Double_t secAngleEnd[ksecNRadii];
3b81eea3 601 for(Int_t i = 0; i < ksecNRadii; i++)secAngleEnd[i] = 0.;
54c9a3d9 602 Double_t secAngleStart2[ksecNRadii];
603 Double_t secAngleEnd2[ksecNRadii];
604 Double_t secAngleTurbo[ksecNCoolingTubeDips] = {0., 0., 0., 0., 0., 0.0};
605 //Double_t secAngleStart3[ksecNRadii];
606 //Double_t secAngleEnd3[ksecNRadii];
607 Double_t xpp[ksecNPoints], ypp[ksecNPoints];
608 Double_t xpp2[ksecNPoints], ypp2[ksecNPoints];
609 Double_t *xp[ksecNRadii], *xp2[ksecNRadii];
610 Double_t *yp[ksecNRadii], *yp2[ksecNRadii];
c6bf4fa5 611 TGeoXtru *sA0, *sA1, *sB0, *sB1;
39c2e170 612 TGeoCompositeShape *sA2, *sB2;
54c9a3d9 613 TGeoBBox *sB3;
614 TGeoEltu *sTA0, *sTA1;
615 TGeoTube *sTB0, *sTB1; //,*sM0;
616 TGeoRotation *rot;
617 TGeoTranslation *trans;
618 TGeoCombiTrans *rotrans;
619 Double_t t, t0, t1, a, b, x0, y0,z0, x1, y1;
620 Int_t i, j, k, m;
621 Bool_t tst;
622
623 if(!moth) {
624 AliError("Container volume (argument) is NULL");
625 return;
626 } // end if(!moth)
627 for(i = 0; i < ksecNRadii; i++) {
628 xp[i] = &(xpp[i*(ksecNPointsPerRadii+1)]);
629 yp[i] = &(ypp[i*(ksecNPointsPerRadii+1)]);
630 xp2[i] = &(xpp2[i*(ksecNPointsPerRadii+1)]);
631 yp2[i] = &(ypp2[i*(ksecNPointsPerRadii+1)]);
632 secX2[i] = secX[i];
633 secY2[i] = secY[i];
634 secX3[i] = secX[i];
635 secY3[i] = secY[i];
636 } // end for i
637 //
638 // find starting and ending angles for all but cooling tube sections
639 secAngleStart[0] = 0.5 * ksecAngleSide13;
640 for(i = 0; i < ksecNRadii - 2; i++) {
641 tst = kFALSE;
642 for(j=0;j<ksecNCoolingTubeDips;j++) tst = (tst||i==ksecDipIndex[j]);
643 if (tst) continue;
644 tst = kFALSE;
645 for(j=0;j<ksecNCoolingTubeDips;j++) tst =(tst||(i+1)==ksecDipIndex[j]);
646 if (tst) j = i+2; else j = i+1;
647 AnglesForRoundedCorners(secX[i],secY[i],secR[i],secX[j],secY[j],
648 secR[j],t0,t1);
649 secAngleEnd[i] = t0;
650 secAngleStart[j] = t1;
651 if(secR[i] > 0.0 && secR[j] > 0.0) {
652 if(secAngleStart[i] > secAngleEnd[i]) secAngleEnd[i] += 360.0;
653 } // end if(secR[i]>0.0 && secR[j]>0.0)
654 secAngleStart2[i] = secAngleStart[i];
655 secAngleEnd2[i] = secAngleEnd[i];
656 } // end for i
657 secAngleEnd[ksecNRadii-2] = secAngleStart[ksecNRadii-2] +
658 (secAngleEnd[ksecNRadii-5] - secAngleStart[ksecNRadii-5]);
659 if (secAngleEnd[ksecNRadii-2] < 0.0) secAngleEnd[ksecNRadii-2] += 360.0;
660 secAngleStart[ksecNRadii-1] = secAngleEnd[ksecNRadii-2] - 180.0;
661 secAngleEnd[ksecNRadii-1] = secAngleStart[0];
662 secAngleStart2[ksecNRadii-2] = secAngleStart[ksecNRadii-2];
663 secAngleEnd2[ksecNRadii-2] = secAngleEnd[ksecNRadii-2];
664 secAngleStart2[ksecNRadii-1] = secAngleStart[ksecNRadii-1];
665 secAngleEnd2[ksecNRadii-1] = secAngleEnd[ksecNRadii-1];
666 //
667 // find location of circle last rounded corner.
668 i = 0;
669 j = ksecNRadii - 2;
670 t0 = TanD(secAngleStart[i]-90.);
671 t1 = TanD(secAngleEnd[j]-90.);
672 t = secY[i] - secY[j];
673 // NOTE: secR[i=0] < 0; secR[j=18] > 0; and secR[j+1=19] < 0
674 t += (-secR[i]+secR[j+1]) * SinD(secAngleStart[i]);
675 t -= (secR[j]-secR[j+1]) * SinD(secAngleEnd[j]);
676 t += t1 * secX[j] - t0*secX[i];
677 t += t1 * (secR[j] - secR[j+1]) * CosD(secAngleEnd[j]);
678 t -= t0 * (-secR[i]+secR[j+1]) * CosD(secAngleStart[i]);
679 secX[ksecNRadii-1] = t / (t1-t0);
680 secY[ksecNRadii-1] = TanD(90.0+0.5*ksecAngleSide13)*
681 (secX[ksecNRadii-1]-secX[0])+secY[0];
682 secX2[ksecNRadii-1] = secX[ksecNRadii-1];
683 secY2[ksecNRadii-1] = secY[ksecNRadii-1];
684 secX3[ksecNRadii-1] = secX[ksecNRadii-1];
685 secY3[ksecNRadii-1] = secY[ksecNRadii-1];
d0048cec 686
54c9a3d9 687 // find location of cooling tube centers
688 for(i = 0; i < ksecNCoolingTubeDips; i++) {
689 j = ksecDipIndex[i];
690 x0 = secX[j-1] + TMath::Abs(secR[j-1]) * CosD(secAngleEnd[j-1]);
691 y0 = secY[j-1] + TMath::Abs(secR[j-1]) * SinD(secAngleEnd[j-1]);
692 x1 = secX[j+1] + TMath::Abs(secR[j+1]) * CosD(secAngleStart[j+1]);
693 y1 = secY[j+1] + TMath::Abs(secR[j+1]) * SinD(secAngleStart[j+1]);
694 t0 = TMath::Sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
695 t = secDip2[i] / t0;
696 a = x0+(x1-x0) * t;
697 b = y0+(y1-y0) * t;
d0048cec 698 if(i == 0) {
54c9a3d9 699 // get location of tube center->Surface for locating
700 // this sector around the beam pipe.
701 // This needs to be double checked, but I need my notes for that.
702 // (Bjorn Nilsen)
703 xAAtubeCenter0 = x0 + (x1 - x0) * t * 0.5;
704 yAAtubeCenter0 = y0 + (y1 - y0) * t * 0.5;
705 }// end if i==0
706 if(a + b*(a - x0) / (b - y0) > 0.0) {
707 secX[j] = a + TMath::Abs(y1-y0) * 2.0 * ksecDipRadii/t0;
708 secY[j] = b - TMath::Sign(2.0*ksecDipRadii,y1-y0) * (x1-x0)/t0;
709 secX2[j] = a + TMath::Abs(y1-y0) * ksecTl/t0;
710 secY2[j] = b - TMath::Sign(ksecTl,y1-y0) * (x1-x0) / t0;
d0048cec 711 secX3[j] = a + TMath::Abs(y1-y0) *
54c9a3d9 712 (2.0*ksecDipRadii-0.5*ksecCoolTubeFlatY)/t0;
713 secY3[j] = b - TMath::Sign(2.0*ksecDipRadii-0.5*ksecCoolTubeFlatY,
714 y1-y0)*(x1-x0)/t0;
715 } else {
716 secX[j] = a - TMath::Abs(y1-y0)*2.0*ksecDipRadii/t0;
717 secY[j] = b + TMath::Sign(2.0*ksecDipRadii,y1-y0)*(x1-x0)/t0;
718 secX2[j] = a - TMath::Abs(y1-y0)*ksecTl/t0;
719 secY2[j] = b + TMath::Sign(ksecTl,y1-y0)*(x1-x0)/t0;
720 secX3[j] = a - TMath::Abs(y1-y0)*(2.0*ksecDipRadii-0.5*
721 ksecCoolTubeFlatY)/t0;
722 secY3[j] = b + TMath::Sign(2.0*ksecDipRadii-0.5*ksecCoolTubeFlatY,
723 y1-y0)*(x1-x0)/t0;
724 } // end if(a+b*(a-x0)/(b-y0)>0.0)
d0048cec 725
54c9a3d9 726 // Set up Start and End angles to correspond to start/end of dips.
727 t1 = (secDip2[i]-TMath::Abs(secR[j])) / t0;
728 secAngleStart[j] =TMath::RadToDeg()*TMath::ATan2(y0+(y1-y0)*t1-secY[j],
729 x0+(x1-x0)*t1-secX[j]);
730 if (secAngleStart[j]<0.0) secAngleStart[j] += 360.0;
731 secAngleStart2[j] = secAngleStart[j];
732 t1 = (secDip2[i]+TMath::Abs(secR[j]))/t0;
733 secAngleEnd[j] = TMath::RadToDeg()*TMath::ATan2(y0+(y1-y0)*t1-secY[j],
734 x0+(x1-x0)*t1-secX[j]);
735 if (secAngleEnd[j]<0.0) secAngleEnd[j] += 360.0;
736 secAngleEnd2[j] = secAngleEnd[j];
737 if (secAngleEnd[j]>secAngleStart[j]) secAngleEnd[j] -= 360.0;
738 secR[j] = TMath::Sqrt(secR[j]*secR[j]+4.0*ksecDipRadii*ksecDipRadii);
739 } // end for i
d0048cec 740
54c9a3d9 741 // Special cases
742 secAngleStart2[8] -= 360.;
743 secAngleStart2[11] -= 360.;
744
745 SPDsectorShape(ksecNRadii, secX, secY, secR, secAngleStart, secAngleEnd,
746 ksecNPointsPerRadii, m, xp, yp);
747
748 // Fix up dips to be square.
749 for(i = 0; i < ksecNCoolingTubeDips; i++) {
750 j = ksecDipIndex[i];
751 t = 0.5*ksecDipLength+ksecDipRadii;
752 t0 = TMath::RadToDeg()*TMath::ATan(2.0*ksecDipRadii/t);
753 t1 = secAngleEnd[j] + t0;
754 t0 = secAngleStart[j] - t0;
755 x0 = xp[j][1] = secX[j] + t*CosD(t0);
756 y0 = yp[j][1] = secY[j] + t*SinD(t0);
757 x1 = xp[j][ksecNPointsPerRadii-1] = secX[j] + t*CosD(t1);
758 y1 = yp[j][ksecNPointsPerRadii-1] = secY[j] + t*SinD(t1);
759 t0 = 1./((Double_t)(ksecNPointsPerRadii-2));
760 for(k = 2; k < ksecNPointsPerRadii - 1; k++) {
761 // extra points spread them out.
762 t = ((Double_t)(k-1)) * t0;
763 xp[j][k] = x0+(x1-x0) * t;
764 yp[j][k] = y0+(y1-y0) * t;
765 } // end for k
766 secAngleTurbo[i] = -TMath::RadToDeg() * TMath::ATan2(y1-y0, x1-x0);
d0048cec 767 if(GetDebug(3)) {
54c9a3d9 768 AliInfo(
769 Form("i=%d -- angle=%f -- x0,y0=(%f, %f) -- x1,y1=(%f, %f)",
770 i, secAngleTurbo[i], x0, y0, x1, y1));
771 } // end if GetDebug(3)
772 } // end for i
773 sA0 = new TGeoXtru(2);
39c2e170 774 sA0->SetName("SectorA0");
54c9a3d9 775 sA0->DefinePolygon(m, xpp, ypp);
776 sA0->DefineSection(0, -ksecDz);
777 sA0->DefineSection(1, ksecDz);
d0048cec 778
54c9a3d9 779 // store the edges of each XY segment which defines
780 // one of the plane zones where staves will have to be placed
781 fSPDsectorX0.Set(ksecNCoolingTubeDips);
782 fSPDsectorY0.Set(ksecNCoolingTubeDips);
783 fSPDsectorX1.Set(ksecNCoolingTubeDips);
784 fSPDsectorY1.Set(ksecNCoolingTubeDips);
785 Int_t ixy0, ixy1;
786 for(i = 0; i < ksecNCoolingTubeDips; i++) {
787 // Find index in xpp[] and ypp[] corresponding to where the
788 // SPD ladders are to be attached. Order them according to
789 // the ALICE numbering schema. Using array of indexes (+-1 for
d0048cec 790 // cooling tubes. For any "bend/dip/edge, there are
54c9a3d9 791 // ksecNPointsPerRadii+1 points involved.
792 if(i == 0) j = 1;
793 else if (i == 1) j = 0;
794 else j = i;
795 ixy0 = (ksecDipIndex[j]-1)*(ksecNPointsPerRadii+1)+
796 (ksecNPointsPerRadii);
797 ixy1 = (ksecDipIndex[j]+1) * (ksecNPointsPerRadii+1);
798 fSPDsectorX0[i] = sA0->GetX(ixy0);
799 fSPDsectorY0[i] = sA0->GetY(ixy0);
800 fSPDsectorX1[i] = sA0->GetX(ixy1);
801 fSPDsectorY1[i] = sA0->GetY(ixy1);
802 } // end for i
d0048cec 803
54c9a3d9 804 //printf("SectorA#%d ",0);
805 InsidePoint(xpp[m-1],ypp[m-1],xpp[0],ypp[0],xpp[1],ypp[1],ksecCthick,
806 xpp2[0],ypp2[0]);
807 for(i = 1; i < m - 1; i++) {
808 j = i / (ksecNPointsPerRadii+1);
809 //printf("SectorA#%d ",i);
810 InsidePoint(xpp[i-1],ypp[i-1],xpp[i],ypp[i],xpp[i+1],ypp[i+1],
811 ksecCthick,xpp2[i],ypp2[i]);
812 } // end for i
813 //printf("SectorA#%d ",m);
814 InsidePoint(xpp[m-2],ypp[m-2],xpp[m-1],ypp[m-1],xpp[0],ypp[0],
815 ksecCthick,xpp2[m-1],ypp2[m-1]);
816 // Fix center value of cooling tube dip and
817 // find location of cooling tube centers
818 for(i = 0; i < ksecNCoolingTubeDips; i++) {
819 j = ksecDipIndex[i];
820 x0 = xp2[j][1];
821 y0 = yp2[j][1];
822 x1 = xp2[j][ksecNPointsPerRadii-1];
823 y1 = yp2[j][ksecNPointsPerRadii-1];
824 t0 = TMath::Sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
825 t = secDip2[i]/t0;
826 for(k = 2; k < ksecNPointsPerRadii - 1; k++) {
827 // extra points spread them out.
828 t = ((Double_t)(k-1)) * t0;
829 xp2[j][k] = x0+(x1-x0) * t;
830 yp2[j][k] = y0+(y1-y0) * t;
831 } // end for k
832 } // end for i
833 sA1 = new TGeoXtru(2);
39c2e170 834 sA1->SetName("SectorA1");
54c9a3d9 835 sA1->DefinePolygon(m, xpp2, ypp2);
39c2e170 836 sA1->DefineSection(0, -ksecDz-ksecCthick2);
837 sA1->DefineSection(1, ksecDz+ksecCthick2);
838
839 sA2 = new TGeoCompositeShape("ITS SPD Carbon fiber support Sector A0",
840 "SectorA0-SectorA1");
54c9a3d9 841 //
842 // Error in TGeoEltu. Semi-axis X must be < Semi-axis Y (?).
843 sTA0 = new TGeoEltu("ITS SPD Cooling Tube TA0", 0.5 * ksecCoolTubeFlatY,
844 0.5 * ksecCoolTubeFlatX, ksecDz);
d0048cec 845 sTA1 = new TGeoEltu("ITS SPD Cooling Tube coolant TA1",
54c9a3d9 846 sTA0->GetA() - ksecCoolTubeThick,
847 sTA0->GetB()-ksecCoolTubeThick,ksecDz);
848 SPDsectorShape(ksecNRadii,secX2,secY2,secR2,secAngleStart2,secAngleEnd2,
849 ksecNPointsPerRadii, m, xp, yp);
850 sB0 = new TGeoXtru(2);
c6bf4fa5 851 sB0->SetName("EndB0");
54c9a3d9 852 sB0->DefinePolygon(m, xpp, ypp);
853 sB0->DefineSection(0, ksecDz);
854 sB0->DefineSection(1, ksecDz + ksecZEndLen);
855
856 //printf("SectorB#%d ",0);
53506676 857 // Points around the most sharpened tips have to be avoided - M.S. 24 feb 09
858 const Int_t nSpecialPoints = 5;
859 const Int_t kSpecialPoints[nSpecialPoints] = {7, 17, 47, 62, 77};
860 Int_t i2 = 0;
54c9a3d9 861 InsidePoint(xpp[m-1],ypp[m-1],xpp[0],ypp[0],xpp[1],ypp[1],
53506676 862 ksecCthick2,xpp2[i2],ypp2[i2]);
54c9a3d9 863 for(i = 1; i < m - 1; i++) {
864 t = ksecCthick2;
865 for(k = 0; k < ksecNCoolingTubeDips; k++)
866 if((i/(ksecNPointsPerRadii+1))==ksecDipIndex[k])
867 if(!(ksecDipIndex[k]*(ksecNPointsPerRadii+1) == i ||
868 ksecDipIndex[k]*(ksecNPointsPerRadii+1) +
869 ksecNPointsPerRadii == i))
870 t = ksecRCoolOut-ksecRCoolIn;
871 //printf("SectorB#%d ",i);
53506676 872 Bool_t useThisPoint = kTRUE;
873 for(Int_t ii = 0; ii < nSpecialPoints; ii++)
874 if ( (i == kSpecialPoints[ii] - 1) ||
875 (i == kSpecialPoints[ii] + 1) ) useThisPoint = kFALSE;
876 if (useThisPoint) {
877 i2++;
878 InsidePoint(xpp[i-1],ypp[i-1],xpp[i],ypp[i],xpp[i+1],ypp[i+1],t,
879 xpp2[i2],ypp2[i2]);
880 }
54c9a3d9 881 }// end for i
882 //printf("SectorB#%d ",m);
53506676 883 i2++;
54c9a3d9 884 InsidePoint(xpp[m-2],ypp[m-2],xpp[m-1],ypp[m-1],xpp[0],ypp[0],
53506676 885 ksecCthick2,xpp2[i2],ypp2[i2]);
54c9a3d9 886 sB1 = new TGeoXtru(2);
c6bf4fa5 887 sB1->SetName("EndB1");
53506676 888 sB1->DefinePolygon(i2+1, xpp2, ypp2);
c6bf4fa5 889 sB1->DefineSection(0,sB0->GetZ(0)-ksecCthick2);
890 sB1->DefineSection(1,sB0->GetZ(1)+ksecCthick2);
891
892 sB2 = new TGeoCompositeShape("ITS SPD Carbon fiber support Sector End B0",
893 "EndB0-EndB1");
54c9a3d9 894 // SPD sector mount blocks
895 const Double_t kMountBlock[3] = {0.5*(1.8-0.2)*fgkmm,0.5*22.0*fgkmm,
896 0.5*45.0*fgkmm};
897 sB3 = new TGeoBBox((Double_t*)kMountBlock);
c6bf4fa5 898 // SPD sector mount block screws and nuts (M.S. - 27 oct 2012)
899 const Double_t kMountBlockM3ScrewR = 0.5*3.0*fgkmm; // Metric screw
900 const Double_t kMountBlockHead1R = 0.5*8.0*fgkmm;
901 const Double_t kMountBlockHead1H = 1.0*fgkmm;
902 const Double_t kMountBlockHead2R = 0.5*6.0*fgkmm;
903 const Double_t kMountBlockHead2H = 2.7*fgkmm;
904 const Double_t kMountBlockM3NutR = 1.8*kMountBlockM3ScrewR; // Metric nut
905 const Double_t kMountBlockM3NutH = kMountBlockM3NutR; // Metric nut
906 TGeoTube *sM3 = new TGeoTube(0, kMountBlockM3ScrewR, sB3->GetDX());
907 TGeoTube *sD1 = new TGeoTube(0, kMountBlockHead1R,kMountBlockHead1H/2);
908 TGeoTube *sD2 = new TGeoTube(0, kMountBlockHead2R,kMountBlockHead2H/2);
909 TGeoPgon *sN3 = new TGeoPgon(0, 360, 6, 2);
910 sN3->DefineSection(0,-kMountBlockM3NutH/2, 0, kMountBlockM3NutR);
911 sN3->DefineSection(1, kMountBlockM3NutH/2, 0, kMountBlockM3NutR);
54c9a3d9 912 // SPD sector cooling tubes
913 sTB0 = new TGeoTube("ITS SPD Cooling Tube End TB0", 0.0,
c6bf4fa5 914 0.5*ksecCoolTubeROuter,0.5*(sB0->GetZ(1)-sB0->GetZ(0)));
54c9a3d9 915 sTB1 = new TGeoTube("ITS SPD Cooling Tube End coolant TB0", 0.0,
916 sTB0->GetRmax() - ksecCoolTubeThick,sTB0->GetDz());
917 //
918 if(GetDebug(3)) {
919 if(medSPDcf) medSPDcf->Dump(); else AliInfo("medSPDcf = 0");
920 if(medSPDss) medSPDss->Dump(); else AliInfo("medSPDss = 0");
54c9a3d9 921 if(medSPDcoolfl) medSPDcoolfl->Dump();else AliInfo("medSPDcoolfl = 0");
922 sA0->InspectShape();
923 sA1->InspectShape();
924 sB0->InspectShape();
925 sB1->InspectShape();
926 sB2->InspectShape();
927 } // end if(GetDebug(3))
d0048cec 928
54c9a3d9 929 // create the assembly of the support and place staves on it
930 TGeoVolumeAssembly *vM0 = new TGeoVolumeAssembly(
931 "ITSSPDSensitiveVirtualvolumeM0");
932 StavesInSector(vM0);
933 // create other volumes with some graphical settings
934 TGeoVolume *vA0 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorA0",
39c2e170 935 sA2, medSPDcf);
54c9a3d9 936 vA0->SetVisibility(kTRUE);
937 vA0->SetLineColor(4); // Blue
938 vA0->SetLineWidth(1);
939 vA0->SetFillColor(vA0->GetLineColor());
940 vA0->SetFillStyle(4010); // 10% transparent
54c9a3d9 941 TGeoVolume *vTA0 = new TGeoVolume("ITSSPDCoolingTubeTA0", sTA0, medSPDss);
942 vTA0->SetVisibility(kTRUE);
943 vTA0->SetLineColor(15); // gray
944 vTA0->SetLineWidth(1);
945 vTA0->SetFillColor(vTA0->GetLineColor());
946 vTA0->SetFillStyle(4000); // 0% transparent
947 TGeoVolume *vTA1 = new TGeoVolume("ITSSPDCoolingTubeFluidTA1",
948 sTA1, medSPDcoolfl);
949 vTA1->SetVisibility(kTRUE);
950 vTA1->SetLineColor(6); // Purple
951 vTA1->SetLineWidth(1);
952 vTA1->SetFillColor(vTA1->GetLineColor());
953 vTA1->SetFillStyle(4000); // 0% transparent
954 TGeoVolume *vB0 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorEndB0",
c6bf4fa5 955 sB2, medSPDcf);
54c9a3d9 956 vB0->SetVisibility(kTRUE);
957 vB0->SetLineColor(1); // Black
958 vB0->SetLineWidth(1);
959 vB0->SetFillColor(vB0->GetLineColor());
960 vB0->SetFillStyle(4000); // 0% transparent
54c9a3d9 961 TGeoVolume *vB3 = new TGeoVolume(
962 "ITSSPDCarbonFiberSupportSectorMountBlockB3",sB3, medSPDcf);
963 vB3->SetVisibility(kTRUE);
c6bf4fa5 964 vB3->SetLineColor(26); // Brown shade
54c9a3d9 965 vB3->SetLineWidth(1);
966 vB3->SetFillColor(vB3->GetLineColor());
967 vB3->SetFillStyle(4000); // 0% transparent
c6bf4fa5 968 TGeoVolume *vM3 = new TGeoVolume(
969 "ITSSPDCarbonFiberSupportSectorMountBlockScrewM3",sM3, medSPDss);
970 vM3->SetVisibility(kTRUE);
971 vM3->SetLineColor(kGray); // Gray
972 vM3->SetLineWidth(1);
973 vM3->SetFillColor(vM3->GetLineColor());
974 vM3->SetFillStyle(4000); // 0% transparent
975 TGeoVolume *vD1 = new TGeoVolume(
976 "ITSSPDCarbonFiberSupportSectorMountBlockScrewHead1",sD1, medSPDss);
977 vD1->SetVisibility(kTRUE);
978 vD1->SetLineColor(kGray); // Gray
979 vD1->SetLineWidth(1);
980 vD1->SetFillColor(vD1->GetLineColor());
981 vD1->SetFillStyle(4000); // 0% transparent
982 TGeoVolume *vD2 = new TGeoVolume(
983 "ITSSPDCarbonFiberSupportSectorMountBlockScrewHead2",sD2, medSPDss);
984 vD2->SetVisibility(kTRUE);
985 vD2->SetLineColor(kGray); // Gray
986 vD2->SetLineWidth(1);
987 vD2->SetFillColor(vD2->GetLineColor());
988 vD2->SetFillStyle(4000); // 0% transparent
989 TGeoVolume *vN3 = new TGeoVolume(
990 "ITSSPDCarbonFiberSupportSectorMountBlockScrewNut",sN3, medSPDss);
991 vN3->SetVisibility(kTRUE);
992 vN3->SetLineColor(kGray); // Gray
993 vN3->SetLineWidth(1);
994 vN3->SetFillColor(vN3->GetLineColor());
995 vN3->SetFillStyle(4000); // 0% transparent
54c9a3d9 996 TGeoVolume *vTB0 = new TGeoVolume("ITSSPDCoolingTubeEndTB0",sTB0,medSPDss);
997 vTB0->SetVisibility(kTRUE);
998 vTB0->SetLineColor(15); // gray
999 vTB0->SetLineWidth(1);
1000 vTB0->SetFillColor(vTB0->GetLineColor());
1001 vTB0->SetFillStyle(4000); // 0% transparent
1002 TGeoVolume *vTB1 = new TGeoVolume("ITSSPDCoolingTubeEndFluidTB1",sTB1,
1003 medSPDcoolfl);
1004 vTB1->SetVisibility(kTRUE);
1005 vTB1->SetLineColor(7); // light blue
1006 vTB1->SetLineWidth(1);
1007 vTB1->SetFillColor(vTB1->GetLineColor());
1008 vTB1->SetFillStyle(4050); // 0% transparent
d0048cec 1009
54c9a3d9 1010 // add volumes to mother container passed as argument of this method
1011 moth->AddNode(vM0,1,0); // Add virtual volume to mother
54c9a3d9 1012 vTA0->AddNode(vTA1,1,0); // Put cooling liquid indide tube middel.
1013 vTB0->AddNode(vTB1,1,0); // Put cooling liquid inside tube end.
1014 Double_t tubeEndLocal[3]={0.0,0.0,sTA0->GetDz()};
1015 for(i = 0; i < ksecNCoolingTubeDips; i++) {
1016 x0 = secX3[ksecDipIndex[i]];
1017 y0 = secY3[ksecDipIndex[i]];
1018 t = 90.0 - secAngleTurbo[i];
c6bf4fa5 1019 z0 = 0.5*(sB1->GetZ(0)+sB1->GetZ(1));
1020 trans = new TGeoTranslation("",x0,y0,z0);
1021 vM0->AddNode(vTB0, i+1, trans);
54c9a3d9 1022 // Find location of tube ends for later use.
1023 trans->LocalToMaster(tubeEndLocal,fTubeEndSector[0][0][i]);
c6bf4fa5 1024 trans = new TGeoTranslation("",x0,y0,-z0);
1025 vM0->AddNode(vTB0, i+1+ksecNCoolingTubeDips, trans);
54c9a3d9 1026 rot = new TGeoRotation("", 0.0, 0.0, t);
1027 rotrans = new TGeoCombiTrans("", x0, y0, 0.0, rot);
1028 vM0->AddNode(vTA0, i+1, rotrans);
1029 } // end for i
1030 vM0->AddNode(vA0, 1, 0);
1031 vM0->AddNode(vB0, 1, 0);
1032 // Reflection.
1033 rot = new TGeoRotation("", 90., 0., 90., 90., 180., 0.);
1034 vM0->AddNode(vB0,2,rot);
1035 // Find location of tube ends for later use.
1036 for(i=0;i<ksecNCoolingTubeDips;i++) rot->LocalToMaster(
1037 fTubeEndSector[0][0][i],fTubeEndSector[0][1][i]);
c6bf4fa5 1038 // Put screws inside the mounting block
1039 const Double_t kMountingBlockScrew1ZPos = 0.7 *fgkcm;
1040 const Double_t kMountingBlockScrew2ZPos = 2.01*fgkcm;
1041 const Double_t kMountingBlockScrew34Pos = 0.51*fgkcm;
1042 vB3->AddNode(vM3, 1, new TGeoCombiTrans(0, 0,
1043 (sB3->GetDZ()-kMountingBlockScrew1ZPos),
1044 new TGeoRotation("",90,90,90)));
1045 vB3->AddNode(vM3, 2, new TGeoCombiTrans(0, 0,
1046 (sB3->GetDZ()-kMountingBlockScrew2ZPos),
1047 new TGeoRotation("",90,90,90)));
1048 vB3->AddNode(vM3, 3, new TGeoCombiTrans(0,-kMountingBlockScrew34Pos,
1049 -(sB3->GetDZ()-kMountingBlockScrew34Pos),
1050 new TGeoRotation("",90,90,90)));
1051 vB3->AddNode(vM3, 4, new TGeoCombiTrans(0, kMountingBlockScrew34Pos,
1052 -(sB3->GetDZ()-kMountingBlockScrew34Pos),
1053 new TGeoRotation("",90,90,90)));
54c9a3d9 1054 // left side
1055 t = -TMath::RadToDeg()*TMath::ATan2(
1056 sB0->GetX(0)-sB0->GetX(sB0->GetNvert()-1),
1057 sB0->GetY(0)-sB0->GetY(sB0->GetNvert()-1));
1058 rot = new TGeoRotation("",t,0.0,0.0);// z axis rotation
1059 x0 = 0.5*(sB0->GetX(0)+sB0->GetX(sB0->GetNvert()-1))+
1060 sB3->GetDX()*TMath::Cos(t*TMath::DegToRad());
1061 y0 = 0.5*(sB0->GetY(0)+sB0->GetY(sB0->GetNvert()-1))+
1062 sB3->GetDX()*TMath::Sin(t*TMath::DegToRad());
1063 z0 = sB0->GetZ(0)+sB3->GetDZ();
1064 rotrans = new TGeoCombiTrans("",x0,y0,z0,rot);
1065 vM0->AddNode(vB3,1,rotrans); // Put Mounting bracket on sector
c6bf4fa5 1066 // the screw heads and nuts
1067 Double_t h = sM3->GetDz() + sD1->GetDz();
1068 Double_t zt = sB3->GetDZ()-kMountingBlockScrew1ZPos;
1069 vM0->AddNode(vD1, 1, new TGeoCombiTrans(x0+h*CosD(180+t), y0+h*SinD(180+t),
1070 z0+zt,
1071 new TGeoRotation("",90+t,90,90)));
1072 h = sM3->GetDz() + sD2->GetDz() + ksecCthick2 + 0.06;
1073 zt = sB3->GetDZ()-kMountingBlockScrew2ZPos;
1074 vM0->AddNode(vD2, 1, new TGeoCombiTrans(x0+h*CosD(180+t), y0+h*SinD(180+t),
1075 z0+zt,
1076 new TGeoRotation("",90+t,90,90)));
1077 Double_t loc[3],mas[3];
1078 loc[0]=0;
1079 loc[1]=-kMountingBlockScrew34Pos;
1080 loc[2]=-(sB3->GetDZ()-kMountingBlockScrew34Pos);
1081 rotrans->LocalToMaster(loc,mas);
1082 vM0->AddNode(vD2, 2, new TGeoCombiTrans(mas[0]+h*CosD(180+t),
1083 mas[1]+h*SinD(180+t),
1084 mas[2],
1085 new TGeoRotation("",90+t,90,90)));
1086 loc[1]=kMountingBlockScrew34Pos;
1087 rotrans->LocalToMaster(loc,mas);
1088 vM0->AddNode(vD2, 3, new TGeoCombiTrans(mas[0]+h*CosD(180+t),
1089 mas[1]+h*SinD(180+t),
1090 mas[2],
1091 new TGeoRotation("",90+t,90,90)));
1092
1093 rot = new TGeoRotation("",t,180.0,0.0);// z & x axis rotation
54c9a3d9 1094 rotrans = new TGeoCombiTrans("",x0,y0,-z0,rot);
1095 vM0->AddNode(vB3,2,rotrans); // Put Mounting bracket on sector
c6bf4fa5 1096 h = sM3->GetDz() + sN3->GetZ(1);
1097 zt = sB3->GetDZ()-kMountingBlockScrew1ZPos;
1098 vM0->AddNode(vN3, 1, new TGeoCombiTrans(x0+h*CosD(180+t), y0+h*SinD(180+t),
1099 -z0-zt,
1100 new TGeoRotation("",90+t,90,90)));
1101 h += ksecCthick2 + 0.06;
1102 zt = sB3->GetDZ()-kMountingBlockScrew2ZPos;
1103 vM0->AddNode(vN3, 2, new TGeoCombiTrans(x0+h*CosD(180+t), y0+h*SinD(180+t),
1104 -z0-zt,
1105 new TGeoRotation("",90+t,90,90)));
1106 loc[1]=-kMountingBlockScrew34Pos;
1107 rotrans->LocalToMaster(loc,mas);
1108 vM0->AddNode(vN3, 3, new TGeoCombiTrans(mas[0]+h*CosD(180+t),
1109 mas[1]+h*SinD(180+t),
1110 mas[2],
1111 new TGeoRotation("",90+t,90,90)));
1112 loc[1]=kMountingBlockScrew34Pos;
1113 rotrans->LocalToMaster(loc,mas);
1114 vM0->AddNode(vN3, 4, new TGeoCombiTrans(mas[0]+h*CosD(180+t),
1115 mas[1]+h*SinD(180+t),
1116 mas[2],
1117 new TGeoRotation("",90+t,90,90)));
1118
54c9a3d9 1119 t *= -1.0;
1120 rot = new TGeoRotation("",t,0.0,0.0); // z axis rotation
54c9a3d9 1121 x0 = -0.5*(sB0->GetX(0)+sB0->GetX(sB0->GetNvert()-1))-3.5*
1122 sB3->GetDX()*TMath::Cos(t*TMath::DegToRad());
1123 y0 = 0.5*(sB0->GetY(0)+sB0->GetY(sB0->GetNvert()-1))-3.5*
1124 sB3->GetDX()*TMath::Sin(t*TMath::DegToRad());
54503d83 1125 rotrans = new TGeoCombiTrans("",1.02*x0,y0,z0,rot);
54c9a3d9 1126 vM0->AddNode(vB3,3,rotrans); // Put Mounting bracket on sector
54503d83 1127 h = sM3->GetDz() + sN3->GetZ(1) + 0.03;
c6bf4fa5 1128 zt = sB3->GetDZ()-kMountingBlockScrew1ZPos;
1129 vM0->AddNode(vN3, 5, new TGeoCombiTrans(x0-h*CosD(180-t), y0+h*SinD(180-t),
1130 z0+zt,
1131 new TGeoRotation("",90+t,90,90)));
54503d83 1132 h += ksecCthick2 + 0.05;
c6bf4fa5 1133 zt = sB3->GetDZ()-kMountingBlockScrew2ZPos;
1134 vM0->AddNode(vN3, 6, new TGeoCombiTrans(x0-h*CosD(180-t), y0+h*SinD(180-t),
1135 z0+zt,
1136 new TGeoRotation("",90+t,90,90)));
1137 loc[1]=-kMountingBlockScrew34Pos;
1138 rotrans->LocalToMaster(loc,mas);
1139 vM0->AddNode(vN3, 7, new TGeoCombiTrans(mas[0]-h*CosD(180-t),
1140 mas[1]+h*SinD(180-t),
1141 mas[2],
1142 new TGeoRotation("",90+t,90,90)));
1143 loc[1]=kMountingBlockScrew34Pos;
1144 rotrans->LocalToMaster(loc,mas);
1145 vM0->AddNode(vN3, 8, new TGeoCombiTrans(mas[0]-h*CosD(180-t),
1146 mas[1]+h*SinD(180-t),
1147 mas[2],
1148 new TGeoRotation("",90+t,90,90)));
1149
1150 rot = new TGeoRotation("",t,180.0,0.0); // z & x axis rotation
54503d83 1151 rotrans = new TGeoCombiTrans("",1.02*x0,y0,-z0,rot);
54c9a3d9 1152 vM0->AddNode(vB3,4,rotrans); // Put Mounting bracket on sector
c6bf4fa5 1153 h = sM3->GetDz() + sD1->GetDz();
1154 zt = sB3->GetDZ()-kMountingBlockScrew1ZPos;
1155 vM0->AddNode(vD1, 2, new TGeoCombiTrans(x0-h*CosD(180-t), y0+h*SinD(180-t),
1156 -z0-zt,
1157 new TGeoRotation("",90+t,90,90)));
54503d83 1158 h = sM3->GetDz() + sD2->GetDz() + ksecCthick2 + 0.08;
c6bf4fa5 1159 zt = sB3->GetDZ()-kMountingBlockScrew2ZPos;
1160 vM0->AddNode(vD2, 4, new TGeoCombiTrans(x0-h*CosD(180-t), y0+h*SinD(180-t),
1161 -z0-zt,
1162 new TGeoRotation("",90+t,90,90)));
1163 loc[1]=-kMountingBlockScrew34Pos;
1164 rotrans->LocalToMaster(loc,mas);
1165 vM0->AddNode(vD2, 5, new TGeoCombiTrans(mas[0]-h*CosD(180-t),
1166 mas[1]+h*SinD(180-t),
1167 mas[2],
1168 new TGeoRotation("",90+t,90,90)));
1169 loc[1]=kMountingBlockScrew34Pos;
1170 rotrans->LocalToMaster(loc,mas);
1171 vM0->AddNode(vD2, 6, new TGeoCombiTrans(mas[0]-h*CosD(180-t),
1172 mas[1]+h*SinD(180-t),
1173 mas[2],
1174 new TGeoRotation("",90+t,90,90)));
1175
54c9a3d9 1176 if(GetDebug(3)){
1177 vM0->PrintNodes();
1178 vA0->PrintNodes();
54c9a3d9 1179 vB0->PrintNodes();
54c9a3d9 1180 vB3->PrintNodes();
1181 vTA0->PrintNodes();
1182 vTA1->PrintNodes();
1183 vTB0->PrintNodes();
1184 vTB1->PrintNodes();
1185 } // end if(GetDebug(3))
bc3498f4 1186}
54c9a3d9 1187//______________________________________________________________________
1188Bool_t AliITSv11GeometrySPD::CFHolePoints(Double_t s,Double_t r1,
1189 Double_t r2,Double_t l,Double_t &x,Double_t &y) const
bc3498f4 1190{
54c9a3d9 1191 //
1192 // Step along arck a distancs ds and compute boundry of
1193 // two holes (radius r1 and r2) a distance l apart (along
1194 // x-axis).
1195 // Inputs:
1196 // Double_t s fractional Distance along arcs [0-1]
1197 // where 0-> alpha=beta=0, 1-> alpha=90 degrees.
1198 // Double_t r1 radius at center circle
1199 // Double_t r2 radius of displaced circle
1200 // Double_t l Distance displaced circle is displaces (x-axis)
1201 // Output:
1202 // Double_t x x coordinate along double circle.
1203 // Double_t y y coordinate along double circle.
1204 // Return:
1205 // logical, kFALSE if an error
1206 //
1207 Double_t alpha,beta;
1208 Double_t ac,bc,scb,sca,t,alphac,betac; // at intersection of two circles
1209
1210 x=y=0.0;
1211 ac = r1*r1-l*l-r2*r2;
1212 bc = 2.*l*r2;
1213 if(bc==0.0) {printf("bc=0 l=%e r2=%e\n",l,r2);return kFALSE;}
1214 betac = TMath::ACos(ac/bc);
60e55aee 1215 alphac = TMath::Sqrt((bc-ac)*(bc+ac))/(2.*l*r1);
54c9a3d9 1216 scb = r2*betac;
1217 sca = r1*alphac;
1218 t = r1*0.5*TMath::Pi() - sca + scb;
1219 if(s<= scb/t){
1220 beta = s*t/r2;
1221 x = r2*TMath::Cos(beta) + l;
1222 y = r2*TMath::Sin(beta);
1223 //printf("betac=%e scb=%e t=%e s=%e beta=%e x=%e y=%e\n",
1224 // betac,scb,t,s,beta,x,y);
1225 return kTRUE;
1226 }else{
1227 beta = (s*t-scb+sca)/(r1*0.5*TMath::Pi());
1228 alpha = beta*0.5*TMath::Pi();
1229 x = r1*TMath::Cos(alpha);
1230 y = r1*TMath::Sin(alpha);
1231 //printf("alphac=%e sca=%e t=%e s=%e beta=%e alpha=%e x=%e y=%e\n",
1232 // alphac,sca,t,s,beta,alpha,x,y);
1233 return kTRUE;
1234 } // end if
1235 return kFALSE;
bc3498f4 1236}
54c9a3d9 1237//______________________________________________________________________
1238Bool_t AliITSv11GeometrySPD::GetSectorMountingPoints(Int_t index,Double_t &x0,
1239 Double_t &y0, Double_t &x1, Double_t &y1) const
bc3498f4 1240{
54c9a3d9 1241 //
1242 // Returns the edges of the straight borders in the SPD sector shape,
1243 // which are used to mount staves on them.
1244 // Coordinate system is that of the carbon fiber sector volume.
1245 // ---
1246 // Index numbering is as follows:
1247 // /5
1248 // /\/4
1249 // 1\ \/3
1250 // 0|___\/2
1251 // ---
1252 // Arguments [the ones passed by reference contain output values]:
1253 // Int_t index --> location index according to above scheme [0-5]
1254 // Double_t &x0 --> (by ref) x0 location or the ladder sector [cm]
1255 // Double_t &y0 --> (by ref) y0 location of the ladder sector [cm]
1256 // Double_t &x1 --> (by ref) x1 location or the ladder sector [cm]
1257 // Double_t &y1 --> (by ref) y1 location of the ladder sector [cm]
1258 // TGeoManager *mgr --> The TGeo builder
1259 // ---
1260 // The location is described by a line going from (x0, y0) to (x1, y1)
1261 // ---
1262 // Returns kTRUE if no problems encountered.
1263 // Returns kFALSE if a problem was encountered (e.g.: shape not found).
d0048cec 1264 //
54c9a3d9 1265 Int_t isize = fSPDsectorX0.GetSize();
1266
1267 x0 = x1 = y0 = y1 = 0.0;
1268 if(index < 0 || index > isize) {
c890eba4 1269 AliError(Form("index = %d: allowed 0 --> %d", index, isize));
1270 return kFALSE;
54c9a3d9 1271 } // end if(index<0||index>isize)
1272 x0 = fSPDsectorX0[index];
1273 x1 = fSPDsectorX1[index];
1274 y0 = fSPDsectorY0[index];
1275 y1 = fSPDsectorY1[index];
1276 return kTRUE;
bc3498f4 1277}
54c9a3d9 1278//______________________________________________________________________
d0048cec 1279void AliITSv11GeometrySPD::SPDsectorShape(Int_t n,const Double_t *xc,
54c9a3d9 1280 const Double_t *yc, const Double_t *r,
d0048cec 1281 const Double_t *ths, const Double_t *the,
54c9a3d9 1282 Int_t npr, Int_t &m, Double_t **xp, Double_t **yp) const
bc3498f4 1283{
54c9a3d9 1284 //
1285 // Code to compute the points that make up the shape of the SPD
1286 // Carbon fiber support sections
1287 // Inputs:
1288 // Int_t n size of arrays xc,yc, and r.
1289 // Double_t *xc array of x values for radii centers.
1290 // Double_t *yc array of y values for radii centers.
1291 // Double_t *r array of signed radii values.
1292 // Double_t *ths array of starting angles [degrees].
1293 // Double_t *the array of ending angles [degrees].
1294 // Int_t npr the number of lines segments to aproximate the arc.
1295 // Outputs (arguments passed by reference):
d0048cec 1296 // Int_t m the number of enetries in the arrays *xp[npr+1]
54c9a3d9 1297 // and *yp[npr+1].
1298 // Double_t **xp array of x coordinate values of the line segments
1299 // which make up the SPD support sector shape.
1300 // Double_t **yp array of y coordinate values of the line segments
1301 // which make up the SPD support sector shape.
1302 //
1303 Int_t i, k;
1304 Double_t t, t0, t1;
1305
1306 m = n*(npr + 1);
1307 if(GetDebug(2)) {
1308 cout <<" X \t Y \t R \t S \t E" << m << endl;
1309 for(i = 0; i < n; i++) {
1310 cout << "{" << xc[i] << ", ";
1311 cout << yc[i] << ", ";
1312 cout << r[i] << ", ";
1313 cout << ths[i] << ", ";
1314 cout << the[i] << "}, " << endl;
1315 } // end for i
1316 } // end if(GetDebug(2))
1317 if (GetDebug(3)) cout << "Double_t sA0 = [" << n*(npr+1)+1<<"][";
1318 if (GetDebug(4)) cout << "3] {";
1319 else if(GetDebug(3)) cout <<"2] {";
1320 t0 = (Double_t)npr;
1321 for(i = 0; i < n; i++) {
1322 t1 = (the[i] - ths[i]) / t0;
1323 if(GetDebug(5)) cout << "t1 = " << t1 << endl;
1324 for(k = 0; k <= npr; k++) {
1325 t = ths[i] + ((Double_t)k) * t1;
1326 xp[i][k] = TMath::Abs(r[i]) * CosD(t) + xc[i];
1327 yp[i][k] = TMath::Abs(r[i]) * SinD(t) + yc[i];
1328 if(GetDebug(3)) {
1329 cout << "{" << xp[i][k] << "," << yp[i][k];
1330 if (GetDebug(4)) cout << "," << t;
1331 cout << "},";
1332 } // end if GetDebug
1333 } // end for k
1334 if(GetDebug(3)) cout << endl;
1335 } // end of i
1336 if(GetDebug(3)) cout << "{" << xp[0][0] << ", " << yp[0][0];
1337 if(GetDebug(4)) cout << "," << ths[0];
1338 if(GetDebug(3)) cout << "}}" << endl;
592651e2 1339}
22726349 1340
54c9a3d9 1341//______________________________________________________________________
1342TGeoVolume* AliITSv11GeometrySPD::CreateLadder(Int_t layer,TArrayD &sizes,
1343 TGeoManager *mgr) const
bc3498f4 1344{
54c9a3d9 1345 //
1346 // Creates the "ladder" = silicon sensor + 5 chips.
1347 // Returns a TGeoVolume containing the following components:
1348 // - the sensor (TGeoBBox), whose name depends on the layer
1349 // - 5 identical chips (TGeoBBox)
1350 // - a guard ring around the sensor (subtraction of TGeoBBoxes),
1351 // which is separated from the rest of sensor because it is not
1352 // a sensitive part
1353 // - bump bondings (TGeoBBox stripes for the whole width of the
1354 // sensor, one per column).
1355 // ---
1356 // Arguments:
1357 // 1 - the owner layer (MUST be 1 or 2 or a fatal error is raised)
1358 // 2 - a TArrayD passed by reference, which will contain relevant
1359 // dimensions related to this object:
1360 // size[0] = 'thickness' (the smallest dimension)
1361 // size[1] = 'length' (the direction along the ALICE Z axis)
d0048cec 1362 // size[2] = 'width' (extension in the direction perp. to the
54c9a3d9 1363 // above ones)
1364 // 3 - the used TGeoManager
1365
d0048cec 1366 // ** CRITICAL CHECK **
54c9a3d9 1367 // layer number can be ONLY 1 or 2
1368 if (layer != 1 && layer != 2) AliFatal("Layer number MUST be 1 or 2");
1369
1370 // ** MEDIA **
1371 TGeoMedium *medAir = GetMedium("AIR$",mgr);
1372 TGeoMedium *medSPDSiChip = GetMedium("SPD SI CHIP$",mgr); // SPD SI CHIP
1373 TGeoMedium *medSi = GetMedium("SI$",mgr);
1374 TGeoMedium *medBumpBond = GetMedium("COPPER$",mgr); // ??? BumpBond
d0048cec 1375
1376 // ** SIZES **
54c9a3d9 1377 Double_t chipThickness = fgkmm * 0.150;
1378 Double_t chipWidth = fgkmm * 15.950;
1379 Double_t chipLength = fgkmm * 13.600;
1380 Double_t chipSpacing = fgkmm * 0.400; // separation of chips along Z
1381 Double_t sensThickness = fgkmm * 0.200;
1382 Double_t sensLength = fgkmm * 69.600;
1383 Double_t sensWidth = fgkmm * 12.800;
d0048cec 1384 Double_t guardRingWidth = fgkmm * 0.560; // a border of this thickness
54c9a3d9 1385 // all around the sensor
1386 Double_t bbLength = fgkmm * 0.042;
1387 Double_t bbWidth = sensWidth;
1388 Double_t bbThickness = fgkmm * 0.012;
1389 Double_t bbPos = 0.080; // Z position w.r. to left pixel edge
1390 // compute the size of the container volume which
1391 // will also be returned in the referenced TArrayD;
1392 // for readability, they are linked by reference to a more meaningful name
1393 sizes.Set(3);
1394 Double_t &thickness = sizes[0];
1395 Double_t &length = sizes[1];
1396 Double_t &width = sizes[2];
1397 // the container is a box which exactly enclose all the stuff;
1398 width = chipWidth;
1399 length = sensLength + 2.0*guardRingWidth;
1400 thickness = sensThickness + chipThickness + bbThickness;
1401
1402 // ** VOLUMES **
1403 // While creating this volume, since it is a sensitive volume,
1404 // we must respect some standard criteria for its local reference frame.
1405 // Local X must correspond to x coordinate of the sensitive volume:
d0048cec 1406 // this means that we are going to create the container with a local
54c9a3d9 1407 // reference system that is **not** in the middle of the box.
d0048cec 1408 // This is accomplished by calling the shape constructor with an
54c9a3d9 1409 // additional option ('originShift'):
1410 Double_t xSens = 0.5 * (width - sensWidth - 2.0*guardRingWidth);
1411 Double_t originShift[3] = {-xSens, 0., 0.};
1412 TGeoBBox *shapeContainer = new TGeoBBox(0.5*width,0.5*thickness,
1413 0.5*length,originShift);
1414 // then the volume is made of air, and using this shape
1415 TGeoVolume *container = new TGeoVolume(Form("ITSSPDlay%d-Ladder",layer),
1416 shapeContainer, medAir);
1417 // the chip is a common box
1418 TGeoVolume *volChip = mgr->MakeBox("ITSSPDchip",medSPDSiChip,
1419 0.5*chipWidth,0.5*chipThickness,0.5*chipLength);
1420 // the sensor as well
1421 TGeoVolume *volSens = mgr->MakeBox(GetSenstiveVolumeName(layer),medSi,
1422 0.5*sensWidth,0.5*sensThickness,0.5*sensLength);
d0048cec 1423 // the guard ring shape is the subtraction of two boxes with the
54c9a3d9 1424 // same center.
1425 TGeoBBox *shIn = new TGeoBBox(0.5*sensWidth,sensThickness,0.5*sensLength);
1426 TGeoBBox *shOut = new TGeoBBox(0.5*sensWidth+guardRingWidth,
1427 0.5*sensThickness,0.5*sensLength+guardRingWidth);
1428 shIn->SetName("ITSSPDinnerBox");
1429 shOut->SetName("ITSSPDouterBox");
1430 TGeoCompositeShape *shBorder = new TGeoCompositeShape(
1431 "ITSSPDgaurdRingBorder",Form("%s-%s",shOut->GetName(),shIn->GetName()));
1432 TGeoVolume *volBorder = new TGeoVolume("ITSSPDgaurdRing",shBorder,medSi);
1433 // bump bonds for one whole column
1434 TGeoVolume *volBB = mgr->MakeBox("ITSSPDbb",medBumpBond,0.5*bbWidth,
1435 0.5*bbThickness,0.5*bbLength);
1436 // set colors of all objects for visualization
1437 volSens->SetLineColor(kYellow + 1);
1438 volChip->SetLineColor(kGreen);
1439 volBorder->SetLineColor(kYellow + 3);
1440 volBB->SetLineColor(kGray);
1441
1442 // ** MOVEMENTS **
1443 // sensor is translated along thickness (X) and width (Y)
1444 Double_t ySens = 0.5 * (thickness - sensThickness);
1445 Double_t zSens = 0.0;
d0048cec 1446 // we want that the x of the ladder is the same as the one of
54c9a3d9 1447 // its sensitive volume
1448 TGeoTranslation *trSens = new TGeoTranslation(0.0, ySens, zSens);
1449 // bump bonds are translated along all axes:
1450 // keep same Y used for sensors, but change the Z
1451 TGeoTranslation *trBB[160];
1452 Double_t x = 0.0;
1453 Double_t y = 0.5 * (thickness - bbThickness) - sensThickness;
1454 Double_t z = -0.5 * sensLength + guardRingWidth + fgkmm*0.425 - bbPos;
1455 Int_t i;
1456 for (i = 0; i < 160; i++) {
1457 trBB[i] = new TGeoTranslation(x, y, z);
1458 switch(i) {
1459 case 31:case 63:case 95:case 127:
1460 z += fgkmm * 0.625 + fgkmm * 0.2;
1461 break;
1462 default:
1463 z += fgkmm * 0.425;
1464 } // end switch
1465 } // end for i
1466 // the chips are translated along the length (Z) and thickness (X)
1467 TGeoTranslation *trChip[5] = {0, 0, 0, 0, 0};
1468 x = -xSens;
1469 y = 0.5 * (chipThickness - thickness);
1470 z = 0.0;
1471 for (i = 0; i < 5; i++) {
d0048cec 1472 z = -0.5*length + guardRingWidth
54c9a3d9 1473 + (Double_t)i*chipSpacing + ((Double_t)(i) + 0.5)*chipLength;
1474 trChip[i] = new TGeoTranslation(x, y, z);
1475 } // end ofr i
d0048cec 1476
54c9a3d9 1477 // add nodes to container
1478 container->AddNode(volSens, 1, trSens);
1479 container->AddNode(volBorder, 1, trSens);
1480 for (i = 0; i < 160; i++) container->AddNode(volBB,i+1,trBB[i]);
1481 for (i = 0; i < 5; i++) container->AddNode(volChip,i+3,trChip[i]);
1482 // return the container
1483 return container;
592651e2 1484}
22726349 1485
7855ea93 1486//______________________________________________________________________
54c9a3d9 1487TGeoVolume* AliITSv11GeometrySPD::CreateClip(TArrayD &sizes,Bool_t isDummy,
1488 TGeoManager *mgr) const
1489{
1490 //
1491 // Creates the carbon fiber clips which are added to the central ladders.
1492 // They have a complicated shape which is approximated by a TGeoXtru
1493 // Implementation of a single clip over an half-stave.
1494 // It has a complicated shape which is approximated to a section like this:
d0048cec 1495 //
54c9a3d9 1496 // 6
1497 // /\ .
1498 // 7 //\\ 5
1499 // / 1\\___________________4
1500 // 0 \___________________
1501 // 2 3
d0048cec 1502 // with a finite thickness for all the shape
54c9a3d9 1503 // Its local reference frame is such that point A corresponds to origin.
d0048cec 1504 //
30611568 1505
1506 // MODIFIED geometry
1507 Double_t sposty = fgkmm * -0.5; // lower internal side to avoid overlaps with modified geometry
1508
54c9a3d9 1509 Double_t fullLength = fgkmm * 12.6; // = x4 - x0
1510 Double_t flatLength = fgkmm * 5.4; // = x4 - x3
1511 Double_t inclLongLength = fgkmm * 5.0; // = 5-6
1512 Double_t inclShortLength = fgkmm * 2.0; // = 6-7
1513 Double_t fullHeight = fgkmm * 2.8; // = y6 - y3
3ffa185f 1514 Double_t thickness = fgkmm * 0.18; // thickness
54c9a3d9 1515 Double_t totalLength = fgkmm * 52.0; // total length in Z
d0048cec 1516 Double_t holeSize = fgkmm * 5.0; // dimension of cubic
54c9a3d9 1517 // hole inserted for pt1000
1518 Double_t angle1 = 27.0; // supplementary of angle DCB
1519 Double_t angle2; // angle DCB
1520 Double_t angle3; // angle of GH with vertical
d0048cec 1521
54c9a3d9 1522 angle2 = 0.5 * (180.0 - angle1);
d0048cec 1523 angle3 = 90.0 - TMath::ACos(fullLength - flatLength -
1524 inclLongLength*TMath::Cos(angle1)) *
54c9a3d9 1525 TMath::RadToDeg();
1526 angle1 *= TMath::DegToRad();
1527 angle2 *= TMath::DegToRad();
1528 angle3 *= TMath::DegToRad();
1529
1530 Double_t x[8], y[8];
d0048cec 1531
54c9a3d9 1532 x[0] = 0.0;
1533 x[1] = x[0] + fullLength - flatLength - inclLongLength*TMath::Cos(angle1);
1534 x[2] = x[0] + fullLength - flatLength;
1535 x[3] = x[0] + fullLength;
1536 x[4] = x[3];
1537 x[5] = x[4] - flatLength + thickness * TMath::Cos(angle2);
1538 x[6] = x[1];
1539 x[7] = x[0];
d0048cec 1540
54c9a3d9 1541 y[0] = 0.0;
1542 y[1] = y[0] + inclShortLength * TMath::Cos(angle3);
1543 y[2] = y[1] - inclLongLength * TMath::Sin(angle1);
1544 y[3] = y[2];
1545 y[4] = y[3] + thickness;
1546 y[5] = y[4];
1547 y[6] = y[1] + thickness;
1548 y[7] = y[0] + thickness;
d0048cec 1549
30611568 1550 y[0] += sposty;
1551 y[7] += sposty;
1552
54c9a3d9 1553 sizes.Set(7);
1554 sizes[0] = totalLength;
1555 sizes[1] = fullHeight;
1556 sizes[2] = y[2];
1557 sizes[3] = y[6];
1558 sizes[4] = x[0];
1559 sizes[5] = x[3];
1560 sizes[6] = x[2];
1561
1562 if(isDummy){// use this argument when on ewant just the
1563 // positions without create any volume
1564 return NULL;
1565 } // end if isDummy
1566
1567 TGeoXtru *shClip = new TGeoXtru(2);
1568 shClip->SetName("ITSSPDshclip");
1569 shClip->DefinePolygon(8, x, y);
1570 shClip->DefineSection(0, -0.5*totalLength, 0., 0., 1.0);
1571 shClip->DefineSection(1, 0.5*totalLength, 0., 0., 1.0);
d0048cec 1572
54c9a3d9 1573 TGeoBBox *shHole = new TGeoBBox("ITSSPDSHClipHole",0.5*holeSize,
1574 0.5*holeSize,0.5*holeSize);
1575 TGeoTranslation *tr1 = new TGeoTranslation("ITSSPDTRClipHole1",x[2],0.0,
1576 fgkmm*14.);
1577 TGeoTranslation *tr2 = new TGeoTranslation("ITSSPDTRClipHole2",x[2],0.0,
1578 0.0);
1579 TGeoTranslation *tr3 = new TGeoTranslation("ITSSPDTRClipHole3",x[2],0.0,
1580 -fgkmm*14.);
1581 tr1->RegisterYourself();
1582 tr2->RegisterYourself();
1583 tr3->RegisterYourself();
1584
1585 //TString strExpr("ITSSPDshclip-(");
1586 TString strExpr(shClip->GetName());
1587 strExpr.Append("-(");
1588 strExpr.Append(Form("%s:%s+", shHole->GetName(), tr1->GetName()));
1589 strExpr.Append(Form("%s:%s+", shHole->GetName(), tr2->GetName()));
1590 strExpr.Append(Form("%s:%s)", shHole->GetName(), tr3->GetName()));
1591 TGeoCompositeShape *shClipHole = new TGeoCompositeShape(
1592 "ITSSPDSHClipHoles",strExpr.Data());
1593
1594 TGeoMedium *mat = GetMedium("SPD C (M55J)$", mgr);
1595 TGeoVolume *vClip = new TGeoVolume("ITSSPDclip", shClipHole, mat);
1596 vClip->SetLineColor(kGray + 2);
1597 return vClip;
45c52bb2 1598}
1599
1600//______________________________________________________________________
1601TGeoVolume* AliITSv11GeometrySPD::CreatePatchPanel(TArrayD &sizes,
1602 TGeoManager *mgr) const
1603{
1604 //
1605 // Creates the patch panel approximated with a "L"-shaped TGeoXtru
1606 // with a finite thickness for all the shape
1607 // Its local reference frame is such that point A corresponds to origin.
1608 //
1609 Double_t hLength = fgkmm * 50.0; // horizontal length
1610 Double_t vLength = fgkmm * 50.0; // vertical length
c890eba4 1611 Double_t angle = 88.3; // angle between hor and vert
45c52bb2 1612 Double_t thickness = fgkmm * 4.0; // thickness
1613 Double_t width = fgkmm * 100.0; // width looking from cone
1614
1615 Double_t x[7], y[7];
1616
1617 y[0] = 0.0;
1618 y[1] = y[0] + hLength;
1619 y[2] = y[1];
1620 y[3] = y[0] + thickness;
1621 y[4] = y[3] + vLength * TMath::Cos(angle*TMath::DegToRad());
1622 y[5] = y[4] - thickness / TMath::Sin(angle*TMath::DegToRad());
1623 y[6] = y[0];
1624
1625 x[0] = 0.0;
1626 x[1] = x[0];
1627 x[2] = x[1] + thickness;
1628 x[3] = x[2];
1629 x[4] = x[3] + vLength * TMath::Sin(angle*TMath::DegToRad());
1630 x[5] = x[4];
1631 x[6] = x[0] + thickness;
1632
1633 sizes.Set(3);
1634 sizes[0] = hLength;
1635 sizes[1] = vLength;
1636 sizes[2] = thickness;
1637
1638 TGeoXtru *shPatch = new TGeoXtru(2);
1639 shPatch->SetName("ITSSPDpatchShape1");
1640 shPatch->DefinePolygon(7, x, y);
1641 shPatch->DefineSection(0, -0.5*width, 0., 0., 1.0);
1642 shPatch->DefineSection(1, 0.5*width, 0., 0., 1.0);
1643
1644 /*
1645 Double_t subThickness = 10.0 * fgkmm;
1646 Double_t subWidth = 55.0 * fgkmm;
1647 new TGeoBBox("ITSSPDpatchShape2", 0.5*subThickness, 60.0 * fgkmm, 0.5*subWidth);
1648 TGeoRotation *rotSub = new TGeoRotation(*gGeoIdentity);
1649 rotSub->SetName("shPatchSubRot");
1650 rotSub->RotateZ(50.0);
1651 rotSub->RegisterYourself();
1652 TGeoCombiTrans *trSub = new TGeoCombiTrans(0.26*hLength, 0.26*vLength, 0.0, rotSub);
1653 trSub->SetName("shPatchSubTr");
1654 trSub->RegisterYourself();
1655
1656 TGeoCompositeShape *shPatchFinal = new TGeoCompositeShape("ITSSPDpatchShape1-(ITSSPDpatchShape2:shPatchSubTr)");
1657 */
1658
1659 TGeoMedium *mat = GetMedium("AL$", mgr);
1660 //TGeoVolume *vPatch = new TGeoVolume("ITSSPDpatchPanel", shPatchFinal, mat);
1661 TGeoVolume *vPatch = new TGeoVolume("ITSSPDpatchPanel", shPatch, mat);
1662 vPatch->SetLineColor(kAzure);
1663
1664 return vPatch;
1665}
1666
c890eba4 1667//___________________________________________________________________
7855ea93 1668TGeoCompositeShape* AliITSv11GeometrySPD::CreateGroundingFoilShape
54c9a3d9 1669 (Int_t itype,Double_t &length,Double_t &width,
1670 Double_t thickness,TArrayD &sizes)
bc3498f4 1671{
54c9a3d9 1672 //
d0048cec 1673 // Creates the typical composite shape of the grounding foil:
1674 //
54c9a3d9 1675 // +---------------------------------------------------------+
1676 // | 5 6 9 |
1677 // | +-----------+ +------------+ 10
1678 // | O | | |
1679 // | 3 /-----+ 4 +------+
1680 // | 1 / 7 8
1681 // | /----------/
1682 // +-----/ 2 +
1683 // 0
1684 // Z + 11
1685 //
d0048cec 1686 // This shape is used 4 times: two layers of glue, one in kapton
1687 // and one in aluminum, taking into account that the aliminum
54c9a3d9 1688 // layer has small differences in the size of some parts.
1689 // ---
d0048cec 1690 // In order to overcome problems apparently due to a large number
1691 // of points, the shape creation is done according the following
54c9a3d9 1692 // steps:
d0048cec 1693 // 1) a TGeoBBox is created with a size right enough to contain
54c9a3d9 1694 // the whole shape (0-1-X-13)
d0048cec 1695 // 2) holes are defined as other TGeoBBox which are subtracted
54c9a3d9 1696 // from the main shape
d0048cec 1697 // 3) a TGeoXtru is defined connecting the points (0-->11-->0)
54c9a3d9 1698 // and is also subtracted from the main shape
1699 // ---
d0048cec 1700 // The argument ("type") is used to choose between all these
54c9a3d9 1701 // possibilities:
1702 // - type = 0 --> kapton layer
1703 // - type = 1 --> aluminum layer
1704 // - type = 2 --> glue layer between support and GF
1705 // - type = 3 --> glue layer between GF and ladders
d0048cec 1706 // Returns: a TGeoCompositeShape which will then be used to shape
1707 // several volumes. Since TGeoXtru is used, the local reference
54c9a3d9 1708 // frame of this object has X horizontal and Y vertical w.r to
1709 // the shape drawn above, and Z axis going perpendicularly to the screen.
d0048cec 1710 // This is not the correct reference for the half stave, for which
1711 // the "long" dimension is Z and the "short" is X, while Y goes in
1712 // the direction of thickness. This will imply some rotations when
54c9a3d9 1713 // using the volumes created with this shape.
d0048cec 1714
54c9a3d9 1715 // suffix to differentiate names
1716 Char_t type[10];
d0048cec 1717
54c9a3d9 1718 // size of the virtual box containing exactly this volume
1719 length = fgkmm * 243.18;
1720 width = fgkmm * 15.95;
1721 if (itype == 1) {
1722 length -= fgkmm * 0.4;
1723 width -= fgkmm * 0.4;
1724 } // end if itype==1
1725 switch (itype) {
1726 case 0:
6932f314 1727 snprintf(type,10,"Kap");
54c9a3d9 1728 break;
1729 case 1:
6932f314 1730 snprintf(type,10, "Alu");
54c9a3d9 1731 break;
1732 case 2:
6932f314 1733 snprintf(type,10,"Glue1");
54c9a3d9 1734 break;
1735 case 3:
6932f314 1736 snprintf(type,10,"Glue2");
54c9a3d9 1737 break;
1738 }
d0048cec 1739 // we divide the shape in several slices along the horizontal
1740 // direction (local X) here we define define the length of all
54c9a3d9 1741 // sectors (from leftmost to rightmost)
1742 Int_t i;
1743 Double_t sliceLength[] = { 140.71, 2.48, 26.78, 4.00,
1744 10.00, 24.40, 10.00, 24.81 };
1745 for (i = 0; i < 8; i++) sliceLength[i] *= fgkmm;
1746 if (itype == 1) {
1747 sliceLength[0] -= fgkmm * 0.2;
1748 sliceLength[4] -= fgkmm * 0.2;
1749 sliceLength[5] += fgkmm * 0.4;
1750 sliceLength[6] -= fgkmm * 0.4;
1751 } // end if itype ==1
d0048cec 1752
1753 // as shown in the drawing, we have four different widths
54c9a3d9 1754 // (along local Y) in this shape:
1755 Double_t widthMax = fgkmm * 15.95;
1756 Double_t widthMed1 = fgkmm * 15.00;
1757 Double_t widthMed2 = fgkmm * 11.00;
1758 Double_t widthMin = fgkmm * 4.40;
1759 if (itype == 1) {
1760 widthMax -= fgkmm * 0.4;
1761 widthMed1 -= fgkmm * 0.4;
1762 widthMed2 -= fgkmm * 0.4;
1763 widthMin -= fgkmm * 0.4;
1764 } // end if itype==1
d0048cec 1765
54c9a3d9 1766 // create the main shape
1767 TGeoBBox *shGroundFull = 0;
1768 shGroundFull = new TGeoBBox(Form("ITSSPDSHgFoil%sFull", type),
1769 0.5*length,0.5*width, 0.5*thickness);
d0048cec 1770
6932f314 1771 if(GetDebug(5)) shGroundFull->Print(); // Avoid Coverity warning
1772
d0048cec 1773 // create the polygonal shape to be subtracted to give the correct
1774 // shape to the borders its vertices are defined in sugh a way that
1775 // this polygonal will be placed in the correct place considered
1776 // that the origin of the local reference frame is in the center
1777 // of the main box: we fix the starting point at the lower-left
1778 // edge of the shape (point 12), and add all points in order,
54c9a3d9 1779 // following a clockwise rotation
d0048cec 1780
54c9a3d9 1781 Double_t x[13], y[13];
1782 x[ 0] = -0.5 * length + sliceLength[0];
1783 y[ 0] = -0.5 * widthMax;
1784
1785 x[ 1] = x[0] + sliceLength[1];
1786 y[ 1] = y[0] + (widthMax - widthMed1);
1787
1788 x[ 2] = x[1] + sliceLength[2];
1789 y[ 2] = y[1];
1790
1791 x[ 3] = x[2] + sliceLength[3];
1792 y[ 3] = y[2] + (widthMed1 - widthMed2);
1793
1794 x[ 4] = x[3] + sliceLength[4];
1795 y[ 4] = y[3];
1796
1797 x[ 5] = x[4];
1798 y[ 5] = y[4] + (widthMed2 - widthMin);
1799
1800 x[ 6] = x[5] + sliceLength[5];
1801 y[ 6] = y[5];
1802
1803 x[ 7] = x[6];
1804 y[ 7] = y[4];
1805
1806 x[ 8] = x[7] + sliceLength[6];
1807 y[ 8] = y[7];
1808
1809 x[ 9] = x[8];
1810 y[ 9] = y[6];
1811
1812 x[10] = x[9] + sliceLength[7] + 0.5;
1813 y[10] = y[9];
1814
1815 x[11] = x[10];
1816 y[11] = y[0] - 0.5;
1817
1818 x[12] = x[0];
1819 y[12] = y[11];
1820
1821 // create the shape
1822 TGeoXtru *shGroundXtru = new TGeoXtru(2);
1823 shGroundXtru->SetName(Form("ITSSPDSHgFoil%sXtru", type));
1824 shGroundXtru->DefinePolygon(13, x, y);
1825 shGroundXtru->DefineSection(0, -thickness, 0., 0., 1.0);
1826 shGroundXtru->DefineSection(1, thickness, 0., 0., 1.0);
d0048cec 1827
54c9a3d9 1828 // define a string which will express the algebric operations among volumes
1829 // and add the subtraction of this shape from the main one
1830 TString strComposite(Form("ITSSPDSHgFoil%sFull-(%s+", type,
1831 shGroundXtru->GetName()));
d0048cec 1832
54c9a3d9 1833 // define the holes according to size information coming from drawings:
1834 Double_t holeLength = fgkmm * 10.00;
1835 Double_t holeWidth = fgkmm * 7.50;
d0048cec 1836 Double_t holeSepX0 = fgkmm * 7.05; // separation between center
54c9a3d9 1837 // of first hole and left border
d0048cec 1838 Double_t holeSepXC = fgkmm * 14.00; // separation between the centers
54c9a3d9 1839 // of two consecutive holes
d0048cec 1840 Double_t holeSepX1 = fgkmm * 15.42; // separation between centers of
54c9a3d9 1841 // 5th and 6th hole
d0048cec 1842 Double_t holeSepX2 = fgkmm * 22.00; // separation between centers of
54c9a3d9 1843 // 10th and 11th hole
1844 if (itype == 1) {
1845 holeSepX0 -= fgkmm * 0.2;
1846 holeLength += fgkmm * 0.4;
1847 holeWidth += fgkmm * 0.4;
1848 } // end if itype==1
1849 sizes.Set(7);
1850 sizes[0] = holeLength;
1851 sizes[1] = holeWidth;
1852 sizes[2] = holeSepX0;
1853 sizes[3] = holeSepXC;
1854 sizes[4] = holeSepX1;
1855 sizes[5] = holeSepX2;
1856 sizes[6] = fgkmm * 4.40;
d0048cec 1857
54c9a3d9 1858 // X position of hole center (will change for each hole)
1859 Double_t holeX = -0.5*length;
1860 // Y position of center of all holes (= 4.4 mm from upper border)
1861 Double_t holeY = 0.5*(width - holeWidth) - widthMin;
d0048cec 1862
54c9a3d9 1863 // create a shape for the holes (common)
c0fc8108 1864 new TGeoBBox(Form("ITSSPD%sGfoilHole", type),0.5*holeLength,
1865 0.5*holeWidth, thickness);
d0048cec 1866
54c9a3d9 1867 // insert the holes in the XTRU shape:
d0048cec 1868 // starting from the first value of X, they are simply
54c9a3d9 1869 // shifted along this axis
1870 char name[200];
1871 TGeoTranslation *transHole[11];
4adcf390 1872 for (i = 0; i < 11; i++) {
54c9a3d9 1873 // set the position of the hole, depending on index
1874 if (i == 0) {
1875 holeX += holeSepX0;
1876 }else if (i < 5) {
1877 holeX += holeSepXC;
1878 }else if (i == 5) {
1879 holeX += holeSepX1;
1880 }else if (i < 10) {
1881 holeX += holeSepXC;
1882 }else {
1883 holeX += holeSepX2;
1884 } // end if else if's
1885 //cout << i << " --> X = " << holeX << endl;
6932f314 1886 snprintf(name,200,"ITSSPDTRgFoil%sHole%d", type, i);
54c9a3d9 1887 transHole[i] = new TGeoTranslation(name, holeX, holeY, 0.0);
1888 transHole[i]->RegisterYourself();
1889 strComposite.Append(Form("ITSSPD%sGfoilHole:%s", type, name));
1890 if (i < 10) strComposite.Append("+"); else strComposite.Append(")");
1891 } // end for i
d0048cec 1892
54c9a3d9 1893 // create composite shape
1894 TGeoCompositeShape *shGround = new TGeoCompositeShape(
1895 Form("ITSSPDSHgFoil%s", type), strComposite.Data());
1896
1897 return shGround;
592651e2 1898}
54c9a3d9 1899//______________________________________________________________________
d0048cec 1900TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateGroundingFoil(Bool_t isRight,
54c9a3d9 1901 TArrayD &sizes, TGeoManager *mgr)
bc3498f4 1902{
54c9a3d9 1903 //
d0048cec 1904 // Create a volume containing all parts of the grounding foil a
1905 // for a half-stave.
54c9a3d9 1906 // It consists of 4 layers with the same shape but different thickness:
1907 // 1) a layer of glue
1908 // 2) the aluminum layer
1909 // 3) the kapton layer
1910 // 4) another layer of glue
1911 // ---
1912 // Arguments:
d0048cec 1913 // 1: a boolean value to know if it is the grounding foir for
54c9a3d9 1914 // the right or left side
1915 // 2: a TArrayD which will contain the dimension of the container box:
1916 // - size[0] = length along Z (the beam line direction)
d0048cec 1917 // - size[1] = the 'width' of the stave, which defines, together
54c9a3d9 1918 // with Z, the plane of the carbon fiber support
d0048cec 1919 // - size[2] = 'thickness' (= the direction along which all
54c9a3d9 1920 // stave components are superimposed)
1921 // 3: the TGeoManager
1922 // ---
d0048cec 1923 // The return value is a TGeoBBox volume containing all grounding
54c9a3d9 1924 // foil components.
1925 // to avoid strange behaviour of the geometry manager,
1926 // create a suffix to be used in the names of all shapes
1927 //
1928 char suf[5];
6932f314 1929 if (isRight) strncpy(suf, "R", 5); else strncpy(suf, "L", 5);
d0048cec 1930 // this volume will be created in order to ease its placement in
1931 // the half-stave; then, it is added here the small distance of
1932 // the "central" edge of each volume from the Z=0 plane in the stave
54c9a3d9 1933 // reference (which coincides with ALICE one)
1934 Double_t dist = fgkmm * 0.71;
d0048cec 1935
54c9a3d9 1936 // define materials
1937 TGeoMedium *medKap = GetMedium("SPD KAPTON(POLYCH2)$", mgr);
1938 TGeoMedium *medAlu = GetMedium("AL$", mgr);
1939 TGeoMedium *medGlue = GetMedium("EPOXY$", mgr); //??? GLUE_GF_SUPPORT
d0048cec 1940
54c9a3d9 1941 // compute the volume shapes (thicknesses change from one to the other)
1942 Double_t kpLength, kpWidth, alLength, alWidth;
1943 TArrayD kpSize, alSize, glSize;
ed0e944d 1944 Double_t kpThickness = fgkmm * 0.04;
1945 Double_t alThickness = fgkmm * 0.01;
1946//cout << "AL THICKNESS" << alThickness << endl;
1947 //Double_t g0Thickness = fgkmm * 0.1175 - fgkGapHalfStave;
1948 //Double_t g1Thickness = fgkmm * 0.1175 - fgkGapLadder;
1949 Double_t g0Thickness = fgkmm * 0.1275 - fgkGapHalfStave;
1950 Double_t g1Thickness = fgkmm * 0.1275 - fgkGapLadder;
54c9a3d9 1951 TGeoCompositeShape *kpShape = CreateGroundingFoilShape(0,kpLength,kpWidth,
1952 kpThickness, kpSize);
1953 TGeoCompositeShape *alShape = CreateGroundingFoilShape(1,alLength,alWidth,
1954 alThickness, alSize);
3ffa185f 1955 TGeoCompositeShape *g0Shape = CreateGroundingFoilShape(2,kpLength,kpWidth,
1956 g0Thickness, glSize);
1957 TGeoCompositeShape *g1Shape = CreateGroundingFoilShape(3,kpLength,kpWidth,
1958 g1Thickness, glSize);
d0048cec 1959 // create the component volumes and register their sizes in the
1960 // passed arrays for readability reasons, some reference variables
54c9a3d9 1961 // explicit the meaning of the array slots
1962 TGeoVolume *kpVol = new TGeoVolume(Form("ITSSPDgFoilKap%s",suf),
1963 kpShape, medKap);
1964 TGeoVolume *alVol = new TGeoVolume(Form("ITSSPDgFoilAlu%s",suf),
1965 alShape, medAlu);
3ffa185f 1966 TGeoVolume *g0Vol = new TGeoVolume(Form("ITSSPDgFoilGlue%s",suf),
1967 g0Shape, medGlue);
1968 TGeoVolume *g1Vol = new TGeoVolume(Form("ITSSPDgFoilGlue%s",suf),
1969 g1Shape, medGlue);
54c9a3d9 1970 // set colors for the volumes
1971 kpVol->SetLineColor(kRed);
1972 alVol->SetLineColor(kGray);
3ffa185f 1973 g0Vol->SetLineColor(kYellow);
1974 g1Vol->SetLineColor(kYellow);
54c9a3d9 1975 // create references for the final size object
1976 if (sizes.GetSize() != 3) sizes.Set(3);
1977 Double_t &fullThickness = sizes[0];
1978 Double_t &fullLength = sizes[1];
1979 Double_t &fullWidth = sizes[2];
d0048cec 1980 // kapton leads the larger dimensions of the foil
54c9a3d9 1981 // (including the cited small distance from Z=0 stave reference plane)
1982 // the thickness is the sum of the ones of all components
1983 fullLength = kpLength + dist;
1984 fullWidth = kpWidth;
3ffa185f 1985 fullThickness = kpThickness + alThickness + g0Thickness + g1Thickness;
54c9a3d9 1986 // create the container
d0048cec 1987// TGeoMedium *air = GetMedium("AIR$", mgr);
1988 TGeoVolumeAssembly *container = new TGeoVolumeAssembly(Form("ITSSPDgFOIL-%s",suf));
1989// TGeoVolume *container = mgr->MakeBox(Form("ITSSPDgFOIL-%s",suf),
1990// air, 0.5*fullThickness, 0.5*fullWidth, 0.5*fullLength);
1991 // create the common correction rotation (which depends of what side
54c9a3d9 1992 // we are building)
1993 TGeoRotation *rotCorr = new TGeoRotation(*gGeoIdentity);
1994 if (isRight) rotCorr->RotateY(90.0);
d0048cec 1995 else rotCorr->RotateY(-90.0);
1996 // compute the translations, which are in the length and
54c9a3d9 1997 // thickness directions
1998 Double_t x, y, z, shift = 0.0;
1999 if (isRight) shift = dist;
2000 // glue (bottom)
3ffa185f 2001 x = -0.5*(fullThickness - g0Thickness);
54c9a3d9 2002 z = 0.5*(fullLength - kpLength) - shift;
2003 TGeoCombiTrans *glTrans0 = new TGeoCombiTrans(x, 0.0, z, rotCorr);
2004 // kapton
3ffa185f 2005 x += 0.5*(g0Thickness + kpThickness);
54c9a3d9 2006 TGeoCombiTrans *kpTrans = new TGeoCombiTrans(x, 0.0, z, rotCorr);
2007 // aluminum
2008 x += 0.5*(kpThickness + alThickness);
2009 z = 0.5*(fullLength - alLength) - shift - 0.5*(kpLength - alLength);
2010 TGeoCombiTrans *alTrans = new TGeoCombiTrans(x, 0.0, z, rotCorr);
2011 // glue (top)
3ffa185f 2012 x += 0.5*(alThickness + g1Thickness);
54c9a3d9 2013 z = 0.5*(fullLength - kpLength) - shift;
2014 TGeoCombiTrans *glTrans1 = new TGeoCombiTrans(x, 0.0, z, rotCorr);
d0048cec 2015
ed0e944d 2016 //cout << fgkGapHalfStave << endl;
2017 //cout << g0Thickness << endl;
2018 //cout << kpThickness << endl;
2019 //cout << alThickness << endl;
2020 //cout << g1Thickness << endl;
54c9a3d9 2021
2022 // add to container
22726349 2023 container->SetLineColor(kMagenta-10);
54c9a3d9 2024 container->AddNode(kpVol, 1, kpTrans);
2025 container->AddNode(alVol, 1, alTrans);
3ffa185f 2026 container->AddNode(g0Vol, 1, glTrans0);
d0048cec 2027 container->AddNode(g1Vol, 2, glTrans1);
2028 // to add the grease we remember the sizes of the holes, stored as
54c9a3d9 2029 // additional parameters in the kapton layer size:
2030 // - sizes[3] = hole length
2031 // - sizes[4] = hole width
2032 // - sizes[5] = position of first hole center
2033 // - sizes[6] = standard separation between holes
2034 // - sizes[7] = separation between 5th and 6th hole
2035 // - sizes[8] = separation between 10th and 11th hole
d0048cec 2036 // - sizes[9] = separation between the upper hole border and
54c9a3d9 2037 // the foil border
2038 Double_t holeLength = kpSize[0];
2039 Double_t holeWidth = kpSize[1];
2040 Double_t holeFirstZ = kpSize[2];
2041 Double_t holeSepZ = kpSize[3];
2042 Double_t holeSep5th6th = kpSize[4];
2043 Double_t holeSep10th11th = kpSize[5];
2044 Double_t holeSepY = kpSize[6];
2045 // volume (common)
2046 // Grease has not been defined to date. Need much more information
2047 // no this material!
2048 TGeoMedium *grease = GetMedium("SPD KAPTON(POLYCH2)$", mgr); // ??? GREASE
2049 TGeoVolume *hVol = mgr->MakeBox("ITSSPDGrease", grease,
2050 0.5*fullThickness, 0.5*holeWidth, 0.5*holeLength);
2051 hVol->SetLineColor(kBlue);
2052 // displacement of volumes in the container
2053 Int_t idx = 1; // copy numbers start from 1.
2054 x = 0.0;
2055 y = 0.5*(fullWidth - holeWidth) - holeSepY;
2056 if (isRight) z = holeFirstZ - 0.5*fullLength + dist;
2057 else z = 0.5*fullLength - holeFirstZ - dist;
2058 for (Int_t i = 0; i < 11; i++) {
2059 TGeoTranslation *t = 0;
2060 t = new TGeoTranslation(x, y, -z);
2061 container->AddNode(hVol, idx++, t);
2062 if (i < 4) shift = holeSepZ;
2063 else if (i == 4) shift = holeSep5th6th;
2064 else if (i < 9) shift = holeSepZ;
2065 else shift = holeSep10th11th;
2066 if (isRight) z += shift;
2067 else z -= shift;
2068 } // end for i
2069 return container;
592651e2 2070}
54c9a3d9 2071//___________________________________________________________________
2072TGeoVolumeAssembly* AliITSv11GeometrySPD::CreateMCM(Bool_t isRight,
2073 TArrayD &sizes, TGeoManager *mgr) const
bc3498f4 2074{
54c9a3d9 2075 //
2076 // Create a TGeoAssembly containing all the components of the MCM.
2077 // The TGeoVolume container is rejected due to the possibility of overlaps
2078 // when placing this object on the carbon fiber sector.
2079 // The assembly contains:
2080 // - the thin part of the MCM (integrated circuit)
2081 // - the MCM chips (specifications from EDMS)
2082 // - the cap which covers the zone where chips are bound to MCM
2083 // ---
d0048cec 2084 // The local reference frame of this assembly is defined in such a way
2085 // that all volumes are contained in a virtual box whose center
2086 // is placed exactly in the middle of the occupied space w.r to all
2087 // directions. This will ease the positioning of this object in the
2088 // half-stave. The sizes of this virtual box are stored in
54c9a3d9 2089 // the array passed by reference.
2090 // ---
2091 // Arguments:
d0048cec 2092 // - a boolean flag to know if this is the "left" or "right" MCM, when
2093 // looking at the stave from above (i.e. the direction from which
2094 // one sees bus over ladders over grounding foil) and keeping the
2095 // continuous border in the upper part, one sees the thicker part
54c9a3d9 2096 // on the left or right.
d0048cec 2097 // - an array passed by reference which will contain the size of
54c9a3d9 2098 // the virtual container.
2099 // - a pointer to the used TGeoManager.
2100 //
2101
2102 // to distinguish the "left" and "right" objects, a suffix is created
2103 char suf[5];
6932f314 2104 if (isRight) strncpy(suf, "R", 5); else strncpy(suf, "L", 5);
54c9a3d9 2105
2106 // ** MEDIA **
2107 TGeoMedium *medBase = GetMedium("SPD KAPTON(POLYCH2)$",mgr);// ??? MCM BASE
2108 TGeoMedium *medChip = GetMedium("SPD SI CHIP$",mgr);
2109 TGeoMedium *medCap = GetMedium("AL$",mgr);
2110
d0048cec 2111 // The shape of the MCM is divided into 3 sectors with different
54c9a3d9 2112 // widths (Y) and lengths (X), like in this sketch:
2113 //
d0048cec 2114 // 0 1 2
54c9a3d9 2115 // +---------------------+-----------------------------------+
2116 // | 4 sect 2 |
2117 // | 6 sect 1 /-------------------+
2118 // | sect 0 /--------------/ 3
2119 // +--------------------/ 5
2120 // 8 7
2121 //
2122 // the inclination of all oblique borders (6-7, 4-5) is always 45 degrees.
2123 // From drawings we can parametrize the dimensions of all these sectors,
2124 // then the shape of this part of the MCM is implemented as a
d0048cec 2125 // TGeoXtru centerd in the virtual XY space.
54c9a3d9 2126 // The first step is definig the relevant sizes of this shape:
2127 Int_t i, j;
2128 Double_t mcmThickness = fgkmm * 0.35;
2129 Double_t sizeXtot = fgkmm * 105.6; // total distance (0-2)
2130 // resp. 7-8, 5-6 and 3-4
2131 Double_t sizeXsector[3] = {fgkmm * 28.4, fgkmm * 41.4, fgkmm * 28.8};
2132 // resp. 0-8, 1-6 and 2-3
2133 Double_t sizeYsector[3] = {fgkmm * 15.0, fgkmm * 11.0, fgkmm * 8.0};
2134 Double_t sizeSep01 = fgkmm * 4.0; // x(6)-x(7)
2135 Double_t sizeSep12 = fgkmm * 3.0; // x(4)-x(5)
2136
2137 // define sizes of chips (last is the thickest)
2138 Double_t chipLength[5] = { 4.00, 6.15, 3.85, 5.60, 18.00 };
2139 Double_t chipWidth[5] = { 3.00, 4.10, 3.85, 5.60, 5.45 };
2140 Double_t chipThickness[5] = { 0.60, 0.30, 0.30, 1.00, 1.20 };
2141 TString name[5];
2142 name[0] = "ITSSPDanalog";
2143 name[1] = "ITSSPDpilot";
2144 name[2] = "ITSSPDgol";
2145 name[3] = "ITSSPDrx40";
2146 name[4] = "ITSSPDoptical";
2147 Color_t color[5] = { kCyan, kGreen, kYellow, kBlue, kOrange };
2148
2149 // define the sizes of the cover
2150 Double_t capThickness = fgkmm * 0.3;
2151 Double_t capHeight = fgkmm * 1.7;
2152
2153 // compute the total size of the virtual container box
2154 sizes.Set(3);
2155 Double_t &thickness = sizes[0];
2156 Double_t &length = sizes[1];
2157 Double_t &width = sizes[2];
2158 length = sizeXtot;
2159 width = sizeYsector[0];
2160 thickness = mcmThickness + capHeight;
2161
d0048cec 2162 // define all the relevant vertices of the polygon
54c9a3d9 2163 // which defines the transverse shape of the MCM.
d0048cec 2164 // These values are used to several purposes, and
54c9a3d9 2165 // for each one, some points must be excluded
2166 Double_t xRef[9], yRef[9];
2167 xRef[0] = -0.5*sizeXtot;
2168 yRef[0] = 0.5*sizeYsector[0];
2169 xRef[1] = xRef[0] + sizeXsector[0] + sizeSep01;
2170 yRef[1] = yRef[0];
2171 xRef[2] = -xRef[0];
2172 yRef[2] = yRef[0];
2173 xRef[3] = xRef[2];
2174 yRef[3] = yRef[2] - sizeYsector[2];
2175 xRef[4] = xRef[3] - sizeXsector[2];
2176 yRef[4] = yRef[3];
2177 xRef[5] = xRef[4] - sizeSep12;
2178 yRef[5] = yRef[4] - sizeSep12;
2179 xRef[6] = xRef[5] - sizeXsector[1];
2180 yRef[6] = yRef[5];
2181 xRef[7] = xRef[6] - sizeSep01;
2182 yRef[7] = yRef[6] - sizeSep01;
2183 xRef[8] = xRef[0];
2184 yRef[8] = -yRef[0];
2185
d0048cec 2186 // the above points are defined for the "right" MCM (if ve view the
2187 // stave from above) in order to change to the "left" one, we must
54c9a3d9 2188 // change the sign to all X values:
2189 if (isRight) for (i = 0; i < 9; i++) xRef[i] = -xRef[i];
d0048cec 2190
2191 // the shape of the MCM and glue layer are done excluding point 1,
54c9a3d9 2192 // which is not necessary and cause the geometry builder to get confused
2193 j = 0;
2194 Double_t xBase[8], yBase[8];
2195 for (i = 0; i < 9; i++) {
2196 if (i == 1) continue;
2197 xBase[j] = xRef[i];
2198 yBase[j] = yRef[i];
2199 j++;
2200 } // end for i
2201
2202 // the MCM cover is superimposed over the zones 1 and 2 only
2203 Double_t xCap[6], yCap[6];
2204 j = 0;
2205 for (i = 1; i <= 6; i++) {
2206 xCap[j] = xRef[i];
2207 yCap[j] = yRef[i];
2208 j++;
2209 } // end for i
2210
d0048cec 2211 // define positions of chips,
54c9a3d9 2212 // which must be added to the bottom-left corner of MCM
2213 // and divided by 1E4;
2214 Double_t chipX[5], chipY[5];
2215 if (isRight) {
2216 chipX[0] = 666320.;
2217 chipX[1] = 508320.;
2218 chipX[2] = 381320.;
2219 chipX[3] = 295320.;
2220 chipX[4] = 150320.;
2221 chipY[0] = 23750.;
2222 chipY[1] = 27750.;
2223 chipY[2] = 20750.;
2224 chipY[3] = 42750.;
2225 chipY[4] = 39750.;
2226 } else {
2227 chipX[0] = 389730.;
2228 chipX[1] = 548630.;
2229 chipX[2] = 674930.;
2230 chipX[3] = 761430.;
2231 chipX[4] = 905430.;
2232 chipY[0] = 96250.;
2233 chipY[1] = 91950.;
2234 chipY[2] = 99250.;
2235 chipY[3] = 107250.;
2236 chipY[4] = 109750.;
2237 } // end if isRight
2238 for (i = 0; i < 5; i++) {
2239 chipX[i] *= 0.00001;
2240 chipY[i] *= 0.00001;
2241 if (isRight) {
2242 chipX[i] += xRef[3];
2243 chipY[i] += yRef[3];
2244 } else {
2245 chipX[i] += xRef[8];
2246 chipY[i] += yRef[8];
2247 } // end for isRight
2248 chipLength[i] *= fgkmm;
2249 chipWidth[i] *= fgkmm;
2250 chipThickness[i] *= fgkmm;
2251 } // end for i
2252
d0048cec 2253 // create shapes for MCM
54c9a3d9 2254 Double_t z1, z2;
2255 TGeoXtru *shBase = new TGeoXtru(2);
2256 z1 = -0.5*thickness;
2257 z2 = z1 + mcmThickness;
2258 shBase->DefinePolygon(8, xBase, yBase);
2259 shBase->DefineSection(0, z1, 0., 0., 1.0);
2260 shBase->DefineSection(1, z2, 0., 0., 1.0);
2261
2262 // create volumes of MCM
2263 TGeoVolume *volBase = new TGeoVolume("ITSSPDbase", shBase, medBase);
2264 volBase->SetLineColor(kRed);
2265
d0048cec 2266 // to create the border of the MCM cover, it is required the
2267 // subtraction of two shapes the outer is created using the
54c9a3d9 2268 // reference points defined here
2269 TGeoXtru *shCapOut = new TGeoXtru(2);
2270 shCapOut->SetName(Form("ITSSPDshCAPOUT%s", suf));
2271 z1 = z2;
2272 z2 = z1 + capHeight - capThickness;
2273 shCapOut->DefinePolygon(6, xCap, yCap);
2274 shCapOut->DefineSection(0, z1, 0., 0., 1.0);
2275 shCapOut->DefineSection(1, z2, 0., 0., 1.0);
2276 // the inner is built similarly but subtracting the thickness
2277 Double_t angle, cs;
2278 Double_t xin[6], yin[6];
2279 if (!isRight) {
2280 angle = 45.0;
2281 cs = TMath::Cos( 0.5*(TMath::Pi() - angle*TMath::DegToRad()) );
2282 xin[0] = xCap[0] + capThickness;
2283 yin[0] = yCap[0] - capThickness;
2284 xin[1] = xCap[1] - capThickness;
2285 yin[1] = yin[0];
2286 xin[2] = xin[1];
2287 yin[2] = yCap[2] + capThickness;
2288 xin[3] = xCap[3] - capThickness*cs;
2289 yin[3] = yin[2];
2290 xin[4] = xin[3] - sizeSep12;
2291 yin[4] = yCap[4] + capThickness;
2292 xin[5] = xin[0];
2293 yin[5] = yin[4];
2294 } else {
2295 angle = 45.0;
2296 cs = TMath::Cos( 0.5*(TMath::Pi() - angle*TMath::DegToRad()) );
2297 xin[0] = xCap[0] - capThickness;
2298 yin[0] = yCap[0] - capThickness;
2299 xin[1] = xCap[1] + capThickness;
2300 yin[1] = yin[0];
2301 xin[2] = xin[1];
2302 yin[2] = yCap[2] + capThickness;
2303 xin[3] = xCap[3] - capThickness*cs;
2304 yin[3] = yin[2];
2305 xin[4] = xin[3] + sizeSep12;
2306 yin[4] = yCap[4] + capThickness;
2307 xin[5] = xin[0];
2308 yin[5] = yin[4];
2309 } // end if !isRight
2310 TGeoXtru *shCapIn = new TGeoXtru(2);
2311 shCapIn->SetName(Form("ITSSPDshCAPIN%s", suf));
2312 shCapIn->DefinePolygon(6, xin, yin);
2313 shCapIn->DefineSection(0, z1 - 0.01, 0., 0., 1.0);
2314 shCapIn->DefineSection(1, z2 + 0.01, 0., 0., 1.0);
2315 // compose shapes
2316 TGeoCompositeShape *shCapBorder = new TGeoCompositeShape(
d0048cec 2317 Form("ITSSPDshBORDER%s", suf),
54c9a3d9 2318 Form("%s-%s", shCapOut->GetName(),
2319 shCapIn->GetName()));
2320 // create volume
2321 TGeoVolume *volCapBorder = new TGeoVolume("ITSSPDcapBoarder",
2322 shCapBorder,medCap);
2323 volCapBorder->SetLineColor(kGreen);
d0048cec 2324 // finally, we create the top of the cover, which has the same
2325 // shape of outer border and a thickness equal of the one othe
54c9a3d9 2326 // cover border one
2327 TGeoXtru *shCapTop = new TGeoXtru(2);
2328 z1 = z2;
2329 z2 = z1 + capThickness;
2330 shCapTop->DefinePolygon(6, xCap, yCap);
2331 shCapTop->DefineSection(0, z1, 0., 0., 1.0);
2332 shCapTop->DefineSection(1, z2, 0., 0., 1.0);
2333 TGeoVolume *volCapTop = new TGeoVolume("ITSSPDcapTop", shCapTop, medCap);
2334 volCapTop->SetLineColor(kBlue);
2335
2336 // create container assembly with right suffix
2337 TGeoVolumeAssembly *mcmAssembly = new TGeoVolumeAssembly(
2338 Form("ITSSPDmcm%s", suf));
2339
2340 // add mcm layer
2341 mcmAssembly->AddNode(volBase, 1, gGeoIdentity);
2342 // add chips
2343 for (i = 0; i < 5; i++) {
2344 TGeoVolume *box = gGeoManager->MakeBox(name[i],medChip,
2345 0.5*chipLength[i], 0.5*chipWidth[i], 0.5*chipThickness[i]);
2346 TGeoTranslation *tr = new TGeoTranslation(chipX[i],chipY[i],
2347 0.5*(-thickness + chipThickness[i]) + mcmThickness);
2348 box->SetLineColor(color[i]);
2349 mcmAssembly->AddNode(box, 1, tr);
2350 } // end for i
2351 // add cap border
2352 mcmAssembly->AddNode(volCapBorder, 1, gGeoIdentity);
2353 // add cap top
d0048cec 2354 mcmAssembly->AddNode(volCapTop, 1, gGeoIdentity);
54c9a3d9 2355
2356 return mcmAssembly;
592651e2 2357}
7f69c251 2358
54c9a3d9 2359//______________________________________________________________________
bc3498f4 2360TGeoVolumeAssembly* AliITSv11GeometrySPD::CreatePixelBus
22726349 2361(Bool_t isRight, Int_t ilayer, TArrayD &sizes, TGeoManager *mgr) const
bc3498f4 2362{
54c9a3d9 2363 //
d0048cec 2364 // The pixel bus is implemented as a TGeoBBox with some objects on it,
54c9a3d9 2365 // which could affect the particle energy loss.
2366 // ---
d0048cec 2367 // In order to avoid confusion, the bus is directly displaced
54c9a3d9 2368 // according to the axis orientations which are used in the final stave:
2369 // X --> thickness direction
2370 // Y --> width direction
2371 // Z --> length direction
2372 //
d0048cec 2373
22726349 2374 // ** CRITICAL CHECK ******************************************************
2375 // layer number can be ONLY 1 or 2
2376 if (ilayer != 1 && ilayer != 2) AliFatal("Layer number MUST be 1 or 2");
54c9a3d9 2377
2378 // ** MEDIA **
2379 //PIXEL BUS
2380 TGeoMedium *medBus = GetMedium("SPDBUS(AL+KPT+EPOX)$",mgr);
2381 TGeoMedium *medPt1000 = GetMedium("CERAMICS$",mgr); // ??? PT1000
2382 // Capacity
2383 TGeoMedium *medCap = GetMedium("SDD X7R capacitors$",mgr);
2384 // ??? Resistance
d0048cec 2385 //TGeoMedium *medRes = GetMedium("SDD X7R capacitors$",mgr);
7f69c251 2386 TGeoMedium *medRes = GetMedium("ALUMINUM$",mgr);
45c52bb2 2387 //TGeoMedium *medExt = GetMedium("SDDKAPTON (POLYCH2)$", mgr);
2388 TGeoMedium *medExt = GetMedium("SPD-MIX CU KAPTON$", mgr);
54c9a3d9 2389 // ** SIZES & POSITIONS **
2390 Double_t busLength = 170.501 * fgkmm; // length of plane part
2391 Double_t busWidth = 13.800 * fgkmm; // width
2392 Double_t busThickness = 0.280 * fgkmm; // thickness
2393 Double_t pt1000Length = fgkmm * 1.50;
2394 Double_t pt1000Width = fgkmm * 3.10;
2395 Double_t pt1000Thickness = fgkmm * 0.60;
2396 Double_t pt1000Y, pt1000Z[10];// position of the pt1000's along the bus
2397 Double_t capLength = fgkmm * 2.55;
2398 Double_t capWidth = fgkmm * 1.50;
2399 Double_t capThickness = fgkmm * 1.35;
2400 Double_t capY[2], capZ[2];
d0048cec 2401
54c9a3d9 2402 Double_t resLength = fgkmm * 2.20;
2403 Double_t resWidth = fgkmm * 0.80;
2404 Double_t resThickness = fgkmm * 0.35;
2405 Double_t resY[2], resZ[2];
d0048cec 2406
7f69c251 2407 Double_t extThickness = fgkmm * 0.25;
3ffa185f 2408 Double_t ext1Length = fgkmm * (26.7 - 10.0);
ddf00e3c 2409 Double_t ext2Length = fgkmm * 284.0 - ext1Length + extThickness;
c33a0330 2410 Double_t ext2LengthL2 = fgkmm * 130.0;
2411 Double_t ext4Length = fgkmm * 40.0;
2412 Double_t ext4Twist = 66.54; //deg
3ffa185f 2413 Double_t extWidth = fgkmm * 11.0;
2414 Double_t extHeight = fgkmm * 2.5;
d0048cec 2415
2416 // position of pt1000, resistors and capacitors depends on the
54c9a3d9 2417 // bus if it's left or right one
2418 if (!isRight) {
2419 pt1000Y = 64400.;
2420 pt1000Z[0] = 66160.;
2421 pt1000Z[1] = 206200.;
2422 pt1000Z[2] = 346200.;
2423 pt1000Z[3] = 486200.;
2424 pt1000Z[4] = 626200.;
2425 pt1000Z[5] = 776200.;
2426 pt1000Z[6] = 916200.;
2427 pt1000Z[7] = 1056200.;
2428 pt1000Z[8] = 1196200.;
d0048cec 2429 pt1000Z[9] = 1336200.;
54c9a3d9 2430 resZ[0] = 1397500.;
2431 resY[0] = 26900.;
2432 resZ[1] = 682500.;
2433 resY[1] = 27800.;
2434 capZ[0] = 1395700.;
2435 capY[0] = 45700.;
2436 capZ[1] = 692600.;
2437 capY[1] = 45400.;
2438 } else {
2439 pt1000Y = 66100.;
2440 pt1000Z[0] = 319700.;
2441 pt1000Z[1] = 459700.;
2442 pt1000Z[2] = 599700.;
2443 pt1000Z[3] = 739700.;
2444 pt1000Z[4] = 879700.;
2445 pt1000Z[5] = 1029700.;
2446 pt1000Z[6] = 1169700.;
2447 pt1000Z[7] = 1309700.;
2448 pt1000Z[8] = 1449700.;
d0048cec 2449 pt1000Z[9] = 1589700.;
54c9a3d9 2450 capY[0] = 44500.;
2451 capZ[0] = 266700.;
2452 capY[1] = 44300.;
2453 capZ[1] = 974700.;
2454 resZ[0] = 266500.;
2455 resY[0] = 29200.;
2456 resZ[1] = 974600.;
2457 resY[1] = 29900.;
2458 } // end if isRight
2459 Int_t i;
2460 pt1000Y *= 1E-4 * fgkmm;
2461 for (i = 0; i < 10; i++) {
2462 pt1000Z[i] *= 1E-4 * fgkmm;
2463 if (i < 2) {
2464 capZ[i] *= 1E-4 * fgkmm;
2465 capY[i] *= 1E-4 * fgkmm;
2466 resZ[i] *= 1E-4 * fgkmm;
2467 resY[i] *= 1E-4 * fgkmm;
2468 } // end if iM2
2469 } // end for i
d0048cec 2470
54c9a3d9 2471 Double_t &fullLength = sizes[1];
2472 Double_t &fullWidth = sizes[2];
2473 Double_t &fullThickness = sizes[0];
2474 fullLength = busLength;
2475 fullWidth = busWidth;
2476 // add the thickness of the thickest component on bus (capacity)
d0048cec 2477 fullThickness = busThickness + capThickness;
54c9a3d9 2478
2479 // ** VOLUMES **
2480 TGeoVolumeAssembly *container = new TGeoVolumeAssembly("ITSSPDpixelBus");
d0048cec 2481 TGeoVolume *bus = mgr->MakeBox("ITSSPDbus", medBus, 0.5*busThickness,
54c9a3d9 2482 0.5*busWidth, 0.5*busLength);
2483 TGeoVolume *pt1000 = mgr->MakeBox("ITSSPDpt1000",medPt1000,
2484 0.5*pt1000Thickness,0.5*pt1000Width, 0.5*pt1000Length);
2485 TGeoVolume *res = mgr->MakeBox("ITSSPDresistor", medRes, 0.5*resThickness,
2486 0.5*resWidth, 0.5*resLength);
2487 TGeoVolume *cap = mgr->MakeBox("ITSSPDcapacitor", medCap, 0.5*capThickness,
2488 0.5*capWidth, 0.5*capLength);
d0048cec 2489
954323d3 2490 char extname[12];
6932f314 2491 snprintf(extname,12,"Extender1l%d",ilayer);
954323d3 2492 TGeoVolume *ext1 = mgr->MakeBox(extname, medExt, 0.5*extThickness, 0.5*extWidth, 0.5*ext1Length);
6932f314 2493 snprintf(extname,12,"Extender2l%d",ilayer);
954323d3 2494 TGeoVolume *ext2 = mgr->MakeBox(extname, medExt, 0.5*extHeight - 2.*extThickness, 0.5*extWidth, 0.5*extThickness);
2495 TGeoVolume *ext3=0;
6932f314 2496 snprintf(extname,12,"Extender3l%d",ilayer);
c33a0330 2497 TGeoVolume *ext4=0;
2498 snprintf(extname,12,"Extender3l%d",ilayer);
954323d3 2499 if (ilayer==1) {
2500 Double_t halflen=(0.5*ext2Length + extThickness);
2501 Double_t xprof[6],yprof[6];
2502 Double_t alpha=24;
2503 xprof[0] = -halflen;
2504 yprof[0] = -0.5*extThickness;
2505 xprof[1] = halflen/2;
2506 yprof[1] = yprof[0];
2507 xprof[2] = xprof[1] + 0.5*halflen*CosD(alpha);
2508 yprof[2] = yprof[1] + 0.5*halflen*SinD(alpha);
2509 xprof[3] = xprof[2] - extThickness*SinD(alpha);
2510 yprof[3] = yprof[2] + extThickness*CosD(alpha);
2511 InsidePoint(xprof[0], yprof[0], xprof[1], yprof[1], xprof[2], yprof[2],
2512 extThickness, xprof[4], yprof[4]);
2513 xprof[5] = xprof[0];
2514 yprof[5] = 0.5*extThickness;
2515 TGeoXtru *ext3sh = new TGeoXtru(2);
2516 ext3sh->DefinePolygon(6, xprof, yprof);
2517 ext3sh->DefineSection(0, -0.5*(extWidth-0.8*fgkmm));
2518 ext3sh->DefineSection(1, 0.5*(extWidth-0.8*fgkmm));
2519 ext3 = new TGeoVolume(extname, ext3sh, medExt);
c33a0330 2520 } else {
2521 ext3 = mgr->MakeBox(extname, medExt, 0.5*extThickness, 0.5*(extWidth-0.8*fgkmm), 0.5*ext2LengthL2 + extThickness); // Hardcode fix of a small overlap
2522 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);
2523 ext4->SetLineColor(kGray);
2524 }
54c9a3d9 2525 bus->SetLineColor(kYellow + 2);
2526 pt1000->SetLineColor(kGreen + 3);
2527 res->SetLineColor(kRed + 1);
2528 cap->SetLineColor(kBlue - 7);
7f69c251 2529 ext1->SetLineColor(kGray);
3ffa185f 2530 ext2->SetLineColor(kGray);
2531 ext3->SetLineColor(kGray);
54c9a3d9 2532
2533 // ** MOVEMENTS AND POSITIONEMENT **
2534 // bus
d0048cec 2535 TGeoTranslation *trBus = new TGeoTranslation(0.5 * (busThickness -
54c9a3d9 2536 fullThickness), 0.0, 0.0);
2537 container->AddNode(bus, 1, trBus);
2538 Double_t zRef, yRef, x, y, z;
2539 if (isRight) {
2540 zRef = -0.5*fullLength;
2541 yRef = -0.5*fullWidth;
2542 } else {
2543 zRef = -0.5*fullLength;
2544 yRef = -0.5*fullWidth;
2545 } // end if isRight
2546 // pt1000
2547 x = 0.5*(pt1000Thickness - fullThickness) + busThickness;
2548 for (i = 0; i < 10; i++) {
2549 y = yRef + pt1000Y;
2550 z = zRef + pt1000Z[i];
2551 TGeoTranslation *tr = new TGeoTranslation(x, y, z);
2552 container->AddNode(pt1000, i+1, tr);
2553 } // end for i
2554 // capacitors
2555 x = 0.5*(capThickness - fullThickness) + busThickness;
2556 for (i = 0; i < 2; i++) {
2557 y = yRef + capY[i];
2558 z = zRef + capZ[i];
2559 TGeoTranslation *tr = new TGeoTranslation(x, y, z);
2560 container->AddNode(cap, i+1, tr);
2561 } // end for i
2562 // resistors
2563 x = 0.5*(resThickness - fullThickness) + busThickness;
2564 for (i = 0; i < 2; i++) {
2565 y = yRef + resY[i];
2566 z = zRef + resZ[i];
2567 TGeoTranslation *tr = new TGeoTranslation(x, y, z);
2568 container->AddNode(res, i+1, tr);
2569 } // end for i
d0048cec 2570
7f69c251 2571 // extender
22726349 2572 if (ilayer == 2) {
3ffa185f 2573 if (isRight) {
2574 y = 0.5 * (fullWidth - extWidth) - 0.1;
2575 z = 0.5 * (-fullLength + fgkmm * 10.0);
2576 }
2577 else {
2578 y = 0.5 * (fullWidth - extWidth) - 0.1;
2579 z = 0.5 * ( fullLength - fgkmm * 10.0);
2580 }
22726349 2581 }
2582 else {
2583 if (isRight) {
2584 y = -0.5 * (fullWidth - extWidth);
2585 z = 0.5 * (-fullLength + fgkmm * 10.0);
2586 }
2587 else {
2588 y = -0.5 * (fullWidth - extWidth);
2589 z = 0.5 * ( fullLength - fgkmm * 10.0);
2590 }
2591 }
3ffa185f 2592 x = 0.5 * (extThickness - fullThickness) + busThickness;
2593 //y = 0.5 * (fullWidth - extWidth);
2594 TGeoTranslation *trExt1 = new TGeoTranslation(x, y, z);
2595 if (isRight) {
2596 z -= 0.5 * (ext1Length - extThickness);
2597 }
2598 else {
2599 z += 0.5 * (ext1Length - extThickness);
2600 }
2601 x += 0.5*(extHeight - 3.*extThickness);
2602 TGeoTranslation *trExt2 = new TGeoTranslation(x, y, z);
2603 if (isRight) {
c33a0330 2604 if (ilayer==1)
3ffa185f 2605 z -= 0.5 * (ext2Length - extThickness) + 2.5*extThickness;
c33a0330 2606 else
2607 z -= 0.5 * (ext2LengthL2 - extThickness) + 2.5*extThickness;
3ffa185f 2608 }
2609 else {
c33a0330 2610 if (ilayer==1)
3ffa185f 2611 z += 0.5 * (ext2Length - extThickness) + 2.5*extThickness;
c33a0330 2612 else
2613 z += 0.5 * (ext2LengthL2 - extThickness) + 2.5*extThickness;
3ffa185f 2614 }
2615 x += 0.5*(extHeight - extThickness) - 2.*extThickness;
954323d3 2616 TGeoCombiTrans *trExt3=0;
2617 if (ilayer==1) {
2618 if (isRight)
2619 trExt3 = new TGeoCombiTrans(x, y, z, new TGeoRotation("",0.,-90.,90.));
2620 else
2621 trExt3 = new TGeoCombiTrans(x, y, z, new TGeoRotation("",0., 90.,90.));
2622 } else
2623 trExt3 = new TGeoCombiTrans(x, y, z, 0);
3ffa185f 2624 container->AddNode(ext1, 0, trExt1);
2625 container->AddNode(ext2, 0, trExt2);
2626 container->AddNode(ext3, 0, trExt3);
c33a0330 2627 if (ilayer==2) {
2628 TGeoCombiTrans *trExt4=0;
2629 if (isRight) {
2630 z -= ( ((TGeoBBox*)ext3->GetShape())->GetDZ() + ((TGeoGtra*)ext4->GetShape())->GetDZ() );
2631 trExt4 = new TGeoCombiTrans(x, y, z, new TGeoRotation("", ext4Twist/2,0,0));
2632 } else {
2633 z += ( ((TGeoBBox*)ext3->GetShape())->GetDZ() + ((TGeoGtra*)ext4->GetShape())->GetDZ() );
2634 trExt4 = new TGeoCombiTrans(x, y, z, new TGeoRotation("",-ext4Twist/2,0,0));
2635 }
2636 container->AddNode(ext4, 0, trExt4);
2637 }
54c9a3d9 2638 sizes[3] = yRef + pt1000Y;
2639 sizes[4] = zRef + pt1000Z[2];
2640 sizes[5] = zRef + pt1000Z[7];
d0048cec 2641
54c9a3d9 2642 return container;
592651e2 2643}
7f69c251 2644
2645//______________________________________________________________________
44d18d38 2646TList* AliITSv11GeometrySPD::CreateConeModule(Bool_t sideC, const Double_t angrot,
96eb8210 2647 TGeoManager *mgr) const
7f69c251 2648{
96eb8210 2649 //
2650 // Creates all services modules and places them in a TList
2651 // angrot is the rotation angle (passed as an argument to avoid
2652 // defining the same quantity in two different places)
2653 //
45c52bb2 2654 // Created: ?? ??? 2008 A. Pulvirenti
2655 // Updated: 03 May 2010 M. Sitta
2656 // Updated: 20 Jun 2010 A. Pulvirenti Optical patch panels
2657 // Updated: 22 Jun 2010 M. Sitta Fiber cables
c890eba4 2658 // Updated: 04 Jul 2010 M. Sitta Water cooling
44d18d38 2659 // Updated: 08 Jul 2010 A. Pulvirenti Air cooling on Side C
96eb8210 2660 //
2661
7f69c251 2662 TGeoMedium *medInox = GetMedium("INOX$",mgr);
45c52bb2 2663 //TGeoMedium *medExt = GetMedium("SDDKAPTON (POLYCH2)$", mgr);
2664 TGeoMedium *medExtB = GetMedium("SPD-BUS CU KAPTON$", mgr);
2665 TGeoMedium *medExtM = GetMedium("SPD-MCM CU KAPTON$", mgr);
3ffa185f 2666 TGeoMedium *medPlate = GetMedium("SPD C (M55J)$", mgr);
96eb8210 2667 TGeoMedium *medFreon = GetMedium("Freon$", mgr);
2668 TGeoMedium *medGas = GetMedium("GASEOUS FREON$", mgr);
45c52bb2 2669 TGeoMedium *medFibs = GetMedium("SDD OPTICFIB$",mgr);
c890eba4 2670 TGeoMedium *medCopper= GetMedium("COPPER$",mgr);
44d18d38 2671 TGeoMedium *medPVC = GetMedium("PVC$",mgr);
d0048cec 2672
3ffa185f 2673 Double_t extThickness = fgkmm * 0.25;
2674 Double_t ext1Length = fgkmm * (26.7 - 10.0);
96eb8210 2675// Double_t ext2Length = fgkmm * (285.0 - ext1Length + extThickness);
2676 Double_t ext2Length = fgkmm * 285.0 - ext1Length + extThickness;
d0048cec 2677
96eb8210 2678 const Double_t kCableThickness = 1.5 *fgkmm;
954323d3 2679 Double_t cableL0 = 10.0 * fgkmm;
96eb8210 2680 Double_t cableL1 = 340.0 * fgkmm - extThickness - ext1Length - ext2Length;
2681 Double_t cableL2 = 300.0 * fgkmm;
7f69c251 2682 //Double_t cableL3 = 570.0 * fgkmm;
2683 Double_t cableL3 = 57.0 * fgkmm;
2684 Double_t cableW1 = 11.0 * fgkmm;
2685 Double_t cableW2 = 30.0 * fgkmm;
2686 Double_t cableW3 = 50.0 * fgkmm;
d0048cec 2687
954323d3 2688 const Double_t kMCMLength = cableL0 + cableL1 + cableL2 + cableL3;
96eb8210 2689 const Double_t kMCMWidth = cableW1;
2690 const Double_t kMCMThickness = 1.2 *fgkmm;
d0048cec 2691
96eb8210 2692 const Double_t kPlateLength = 200.0 *fgkmm;
2693 const Double_t kPlateWidth = 50.0 *fgkmm;
2694 const Double_t kPlateThickness = 5.0 *fgkmm;
2695
45c52bb2 2696 const Double_t kConeTubeRmin = 2.0 *fgkmm;
2697 const Double_t kConeTubeRmax = 3.0 *fgkmm;
96eb8210 2698
45c52bb2 2699 const Double_t kHorizTubeLen = 150.0 *fgkmm;
4c8afd2e 2700 const Double_t kYtoHalfStave = 9.5 *fgkmm;
c890eba4 2701
2702 const Double_t kWaterCoolRMax = 2.6 *fgkmm;
2703 const Double_t kWaterCoolThick = 0.04 *fgkmm;
2704 const Double_t kWaterCoolLen = 250.0 *fgkmm;
2705 const Double_t kWCPlateThick = 0.5 *fgkmm;
2706 const Double_t kWCPlateWide = 33.0 *fgkmm;
2707 const Double_t kWCPlateLen = 230.0 *fgkmm;
2708 const Double_t kWCFittingRext1 = 2.4 *fgkmm;
2709 const Double_t kWCFittingRext2 = 3.7 *fgkmm;
2710 const Double_t kWCFittingRint1 = 1.9 *fgkmm;
2711 const Double_t kWCFittingRint2 = kWaterCoolRMax;
2712 const Double_t kWCFittingLen1 = 7.0 *fgkmm;
2713 const Double_t kWCFittingLen2 = 8.0 *fgkmm;
44d18d38 2714
2715 const Double_t kCollWidth = 40.0 *fgkmm;
2716 const Double_t kCollLength = 60.0 *fgkmm;
2717 const Double_t kCollThickness = 10.0 *fgkmm;
2718 const Double_t kCollTubeThick = 1.0 *fgkmm;
2719 const Double_t kCollTubeRadius = 7.0 *fgkmm;
8bb39321 2720 const Double_t kCollTubeLength = 205.0 *fgkmm;
45c52bb2 2721
2722 const Double_t kOptFibDiamet = 4.5 *fgkmm;
d0048cec 2723
7f69c251 2724 Double_t x[12], y[12];
96eb8210 2725 Double_t xloc, yloc, zloc;
2726
2727 Int_t kPurple = 6; // Purple (Root does not define it)
2728
c890eba4 2729 TGeoVolumeAssembly* container[5];
8bb39321 2730 if (sideC)
2731 container[0] = new TGeoVolumeAssembly("ITSSPDConeModuleC");
2732 else
2733 container[0] = new TGeoVolumeAssembly("ITSSPDConeModuleA");
96eb8210 2734 container[1] = new TGeoVolumeAssembly("ITSSPDCoolingModuleSideA");
2735 container[2] = new TGeoVolumeAssembly("ITSSPDCoolingModuleSideC");
45c52bb2 2736 container[3] = new TGeoVolumeAssembly("ITSSPDPatchPanelModule");
c890eba4 2737 container[4] = new TGeoVolumeAssembly("ITSSPDWaterCooling");
d0048cec 2738
96eb8210 2739 // The extender on the cone as a Xtru
954323d3 2740 x[0] = -cableL0;
7f69c251 2741 y[0] = 0.0 + 0.5 * cableW1;
d0048cec 2742
954323d3 2743 x[1] = x[0] + cableL0 + cableL1 - 0.5*(cableW2 - cableW1);
7f69c251 2744 y[1] = y[0];
d0048cec 2745
954323d3 2746 x[2] = x[0] + cableL0 + cableL1;
7f69c251 2747 y[2] = y[1] + 0.5*(cableW2 - cableW1);
d0048cec 2748
7f69c251 2749 x[3] = x[2] + cableL2;
2750 y[3] = y[2];
d0048cec 2751
7f69c251 2752 x[4] = x[3] + 0.5*(cableW3 - cableW2);
2753 y[4] = y[3] + 0.5*(cableW3 - cableW2);
d0048cec 2754
7f69c251 2755 x[5] = x[4] + cableL3 - 0.5*(cableW3 - cableW2);
2756 y[5] = y[4];
d0048cec 2757
7f69c251 2758 for (Int_t i = 6; i < 12; i++) {
2759 x[i] = x[11 - i];
2760 y[i] = -y[11 - i];
2761 }
d0048cec 2762
7f69c251 2763 TGeoXtru *shCable = new TGeoXtru(2);
2764 shCable->DefinePolygon(12, x, y);
96eb8210 2765 shCable->DefineSection(0, 0.0);
2766 shCable->DefineSection(1, kCableThickness);
d0048cec 2767
45c52bb2 2768 TGeoVolume *volCable = new TGeoVolume("ITSSPDExtender", shCable, medExtB);
7f69c251 2769 volCable->SetLineColor(kGreen);
d0048cec 2770
96eb8210 2771 // The MCM extender on the cone as a Xtru
2772 TGeoBBox *shMCMExt = new TGeoBBox(0.5*kMCMLength,
2773 0.5*kMCMWidth,
2774 0.5*kMCMThickness);
d0048cec 2775
96eb8210 2776 TGeoVolume *volMCMExt = new TGeoVolume("ITSSPDExtenderMCM",
45c52bb2 2777 shMCMExt, medExtM);
7f69c251 2778 volMCMExt->SetLineColor(kGreen+3);
d0048cec 2779
96eb8210 2780 // The support plate on the cone as a composite shape
2781 Double_t thickness = kCableThickness + kMCMThickness;
2782 TGeoBBox *shOut = new TGeoBBox("ITSSPD_shape_plateout",
2783 0.5*kPlateLength,
2784 0.5*kPlateWidth,
2785 0.5*kPlateThickness);
2786 TGeoBBox *shIn = new TGeoBBox("ITSSPD_shape_platein" ,
2787 0.5*kPlateLength,
2788 0.5*cableW2,
2789 0.5*thickness);
2790 Char_t string[255];
6932f314 2791 snprintf(string, 255, "%s-%s", shOut->GetName(), shIn->GetName());
96eb8210 2792 TGeoCompositeShape *shPlate = new TGeoCompositeShape("ITSSPDPlate_shape",
2793 string);
d0048cec 2794
96eb8210 2795 TGeoVolume *volPlate = new TGeoVolume("ITSSPDPlate",
2796 shPlate, medPlate);
2797 volPlate->SetLineColor(kRed);
44d18d38 2798
2799 // The air cooling tubes
2800 TGeoBBox *shCollBox = new TGeoBBox("ITSSPD_shape_collector_box", 0.5*kCollLength, 0.5*kCollWidth, 0.5*kCollThickness);
2801 TGeoTube *shCollTube = new TGeoTube("ITSSPD_shape_collector_tube",kCollTubeRadius - kCollTubeThick, kCollTubeRadius, 0.5*kCollTubeLength);
2802 TGeoVolume *volCollBox = new TGeoVolume("ITSSPDCollectorBox", shCollBox, medPVC);
2803 TGeoVolume *volCollTube = new TGeoVolume("ITSSPDCollectorTube", shCollTube, medPVC);
2804 volCollBox->SetLineColor(kAzure);
2805 volCollTube->SetLineColor(kAzure);
d0048cec 2806
96eb8210 2807 // The cooling tube on the cone as a Ctub
8bb39321 2808 Double_t tubeLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave -0.85;
96eb8210 2809 TGeoCtub *shTube = new TGeoCtub(0, kConeTubeRmax, 0.5*tubeLength, 0, 360,
2810 0, SinD(angrot/2), -CosD(angrot/2),
2811 0, 0, 1);
2812
2813 TGeoVolume *volTubeA = new TGeoVolume("ITSSPDCoolingTubeOnConeA",
2814 shTube, medInox);
2815 volTubeA->SetLineColor(kGray);
2816
2817 TGeoVolume *volTubeC = new TGeoVolume("ITSSPDCoolingTubeOnConeC",
2818 shTube, medInox);
2819 volTubeC->SetLineColor(kGray);
2820
2821 // The freon in the cooling tubes on the cone as a Ctub
2822 TGeoCtub *shFreon = new TGeoCtub(0, kConeTubeRmin, 0.5*tubeLength, 0, 360,
2823 0, SinD(angrot/2), -CosD(angrot/2),
2824 0, 0, 1);
2825
2826 TGeoVolume *volFreon = new TGeoVolume("ITSSPDCoolingFreonOnCone",
2827 shFreon, medFreon);
2828 volFreon->SetLineColor(kPurple);
2829
2830 TGeoVolume *volGasFr = new TGeoVolume("ITSSPDCoolingFreonGasOnCone",
2831 shFreon, medGas);
2832 volGasFr->SetLineColor(kPurple);
2833
2834 // The cooling tube inside the cylinder as a Ctub
2835 TGeoCtub *shCylTub = new TGeoCtub(0, kConeTubeRmax,
2836 0.5*kHorizTubeLen, 0, 360,
2837 0, 0, -1,
2838 0, SinD(angrot/2), CosD(angrot/2));
2839
2840 TGeoVolume *volCylTubA = new TGeoVolume("ITSSPDCoolingTubeOnCylA",
2841 shCylTub, medInox);
2842 volCylTubA->SetLineColor(kGray);
2843
2844 TGeoVolume *volCylTubC = new TGeoVolume("ITSSPDCoolingTubeOnCylC",
2845 shCylTub, medInox);
2846 volCylTubC->SetLineColor(kGray);
2847
2848 // The freon in the cooling tubes in the cylinder as a Ctub
2849 TGeoCtub *shCylFr = new TGeoCtub(0, kConeTubeRmin,
2850 0.5*kHorizTubeLen, 0, 360,
2851 0, 0, -1,
2852 0, SinD(angrot/2), CosD(angrot/2));
2853
2854 TGeoVolume *volCylFr = new TGeoVolume("ITSSPDCoolingFreonOnCyl",
2855 shCylFr, medFreon);
2856 volCylFr->SetLineColor(kPurple);
2857
2858 TGeoVolume *volCylGasFr = new TGeoVolume("ITSSPDCoolingFreonGasOnCyl",
2859 shCylFr, medGas);
2860 volCylGasFr->SetLineColor(kPurple);
2861
45c52bb2 2862 // The optical fibers bundle on the cone as a Tube
5d9d4033 2863 Double_t optLength = shCable->GetX(5) - shCable->GetX(0) + kYtoHalfStave -0.85;
45c52bb2 2864 TGeoTube *shOptFibs = new TGeoTube(0., 0.5*kOptFibDiamet, 0.5*optLength);
2865
2866 TGeoVolume *volOptFibs = new TGeoVolume("ITSSPDOpticalFibersOnCone",
2867 shOptFibs, medFibs);
2868 volOptFibs->SetLineColor(kOrange);
2869
2870 // The optical patch panels
2871 TArrayD psizes;
2872 TGeoVolume *volPatch = CreatePatchPanel(psizes, mgr);
2873
c890eba4 2874 // The water cooling tube as a Tube
2875 TGeoTube *shWatCool = new TGeoTube(kWaterCoolRMax-kWaterCoolThick,
2876 kWaterCoolRMax, kWaterCoolLen/2);
2877
2878 TGeoVolume *volWatCool = new TGeoVolume("ITSSPDWaterCoolingOnCone",
2879 shWatCool, medInox);
2880 volWatCool->SetLineColor(kGray);
2881
2882 // The support plate for the water tubes: a Tubs and a BBox
2883 TGeoTubeSeg *shWCPltT = new TGeoTubeSeg(kWaterCoolRMax,
2884 kWaterCoolRMax+kWCPlateThick,
2885 kWCPlateLen/2, 180., 360.);
2886
2887 Double_t plateBoxWide = (kWCPlateWide - 2*kWaterCoolRMax)/2;
2888 TGeoBBox *shWCPltB = new TGeoBBox(plateBoxWide/2,
2889 kWCPlateThick/2,
2890 kWCPlateLen/2);
2891
2892 TGeoVolume *volWCPltT = new TGeoVolume("ITSSPDWaterCoolingTubsPlate",
2893 shWCPltT, medPlate);
2894 volWCPltT->SetLineColor(kRed);
2895
2896 TGeoVolume *volWCPltB = new TGeoVolume("ITSSPDWaterCoolingBoxPlate",
2897 shWCPltB, medPlate);
2898 volWCPltB->SetLineColor(kRed);
2899
2900 // The fitting for the water cooling tube: a Pcon
2901 TGeoPcon *shFitt = new TGeoPcon(0., 360., 4);
2902 shFitt->Z(0) = -kWCFittingLen1;
2903 shFitt->Rmin(0) = kWCFittingRint1;
2904 shFitt->Rmax(0) = kWCFittingRext1;
2905
2906 shFitt->Z(1) = 0;
2907 shFitt->Rmin(1) = kWCFittingRint1;
2908 shFitt->Rmax(1) = kWCFittingRext1;
2909
2910 shFitt->Z(2) = 0;
2911 shFitt->Rmin(2) = kWCFittingRint2;
2912 shFitt->Rmax(2) = kWCFittingRext2;
2913
2914 shFitt->Z(3) = kWCFittingLen2;
2915 shFitt->Rmin(3) = kWCFittingRint2;
2916 shFitt->Rmax(3) = kWCFittingRext2;
2917
2918 TGeoVolume *volFitt = new TGeoVolume("ITSSPDWaterCoolingFitting",
2919 shFitt, medCopper);
2920 volFitt->SetLineColor(kOrange);
2921
96eb8210 2922 // Now place everything in the containers
2923 volTubeA->AddNode(volGasFr, 1, 0);
2924 volTubeC->AddNode(volFreon, 1, 0);
2925
2926 volCylTubA->AddNode(volCylGasFr, 1, 0);
2927 volCylTubC->AddNode(volCylFr , 1, 0);
2928
2929 container[0]->AddNode(volCable, 1, 0);
2930
954323d3 2931 xloc = shMCMExt->GetDX() - cableL0;
96eb8210 2932 zloc = shMCMExt->GetDZ();
2933 container[0]->AddNode(volMCMExt, 1,
2934 new TGeoTranslation( xloc, 0.,-zloc));
2935
2936 xloc = shMCMExt->GetDX();
2937 zloc = shCable->GetZ(1)/2 - shMCMExt->GetDZ();
2938 container[0]->AddNode(volPlate, 1,
2939 new TGeoTranslation( xloc, 0., zloc));
2940
45c52bb2 2941 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
2942 rot2->SetName("rotPatch");
2943 rot2->RotateX(90.0);
2944 rot2->RotateY(163.0);
2945 //rot2->RotateZ(132.5);
2946
44d18d38 2947 // add collectors only on side C
2948 if (sideC)
2949 {
2950 TGeoTranslation *trCollBox = new TGeoTranslation(xloc - 0.5*kPlateLength + 0.5*kCollLength, 0.0, +0.5*(kPlateThickness+1.1*kCollThickness));
2951 TGeoRotation *rotCollTube = new TGeoRotation(*gGeoIdentity);
2952 rotCollTube->RotateY(90.0);
2953 TGeoCombiTrans *trCollTube = new TGeoCombiTrans(xloc + 0.5*kCollTubeLength - (0.5*kPlateLength - kCollLength), 0.0, +0.5*(kPlateThickness+2.0*kCollTubeRadius+kCollTubeThick), rotCollTube);
2954 container[0]->AddNode(volCollBox, 1, trCollBox);
2955 container[0]->AddNode(volCollTube, 1, trCollTube);
2956 }
2957
5d9d4033 2958 Double_t dxPatch = 2.75;
45c52bb2 2959 Double_t dzPatch = 2.8;
2960 TGeoCombiTrans *tr2 = new TGeoCombiTrans(1.7*ext2Length - dxPatch, 0.0, dzPatch, rot2);
2961 container[3]->AddNode(volPatch, 0, tr2);
2962
96eb8210 2963 xloc = shTube->GetRmax();
2964 yloc = shTube->GetRmax();
2965 zloc = shTube->GetDz() - shTube->GetRmax() - kYtoHalfStave;
2966 container[1]->AddNode(volTubeA, 1,
2967 new TGeoTranslation(-xloc, -yloc, zloc));
2968 container[2]->AddNode(volTubeC, 1,
2969 new TGeoTranslation(-xloc, -yloc, zloc));
2970
2971 xloc = shTube->GetRmax();
2972 yloc = (shCylTub->GetDz())*SinD(angrot) - shTube->GetRmax();
2973 zloc = (shCylTub->GetDz())*CosD(angrot) + shTube->GetRmax() +kYtoHalfStave;
2974 container[1]->AddNode(volCylTubA, 1,
2975 new TGeoCombiTrans(-xloc, yloc,-zloc,
2976 new TGeoRotation("",0.,angrot,0.)));
2977 container[2]->AddNode(volCylTubC, 1,
2978 new TGeoCombiTrans(-xloc, yloc,-zloc,
2979 new TGeoRotation("",0.,angrot,0.)));
2980
45c52bb2 2981 xloc = shOptFibs->GetRmax() + 2*shTube->GetRmax();
c890eba4 2982 yloc = 1.6*shOptFibs->GetRmax();
45c52bb2 2983 zloc = shOptFibs->GetDZ() - shTube->GetRmax() - kYtoHalfStave;
2984 container[1]->AddNode(volOptFibs, 1,
2985 new TGeoTranslation(-xloc, -yloc, zloc));
2986 container[2]->AddNode(volOptFibs, 1,
2987 new TGeoTranslation(-xloc, -yloc, zloc));
2988
c890eba4 2989 yloc = shWatCool->GetRmax();
2990 zloc = (2*shTube->GetDz() - shTube->GetRmax() - kYtoHalfStave)/2;
2991 container[4]->AddNode(volWatCool, 1,
2992 new TGeoTranslation(0, -yloc, zloc));
2993
2994 container[4]->AddNode(volWCPltT, 1,
2995 new TGeoTranslation(0, -yloc, zloc));
2996
2997 yloc -= shWCPltB->GetDY();
2998 xloc = shWatCool->GetRmax() + shWCPltB->GetDX();
2999 container[4]->AddNode(volWCPltB, 1,
3000 new TGeoTranslation( xloc, -yloc, zloc));
3001 container[4]->AddNode(volWCPltB, 2,
3002 new TGeoTranslation(-xloc, -yloc, zloc));
3003
3004 yloc = shWatCool->GetRmax();
3005 zloc -= shWatCool->GetDz();
3006 container[4]->AddNode(volFitt, 1,
3007 new TGeoTranslation(0, -yloc, zloc));
3008
96eb8210 3009 // Finally create the list of assemblies and return it to the caller
0b9c8a10 3010 TList* conemodulelist = new TList();
0b9c8a10 3011 conemodulelist->Add(container[0]);
3012 conemodulelist->Add(container[1]);
96eb8210 3013 conemodulelist->Add(container[2]);
45c52bb2 3014 conemodulelist->Add(container[3]);
c890eba4 3015 conemodulelist->Add(container[4]);
d0048cec 3016
0b9c8a10 3017 return conemodulelist;
7f69c251 3018}
3019
3020//______________________________________________________________________
3021void AliITSv11GeometrySPD::CreateCones(TGeoVolume *moth) const
3022{
96eb8210 3023 //
3024 // Places all services modules in the mother reference system
3025 //
3026 // Created: ?? ??? 2008 Alberto Pulvirenti
3027 // Updated: 03 May 2010 Mario Sitta
c890eba4 3028 // Updated: 04 Jul 2010 Mario Sitta Water cooling
96eb8210 3029 //
d0048cec 3030
96eb8210 3031 const Int_t kNumberOfModules = 10;
3032
3033 const Double_t kInnerRadius = 80.775*fgkmm;
8bb39321 3034 const Double_t kZTrans = 451.800*fgkmm;
96eb8210 3035 const Double_t kAlphaRot = 46.500*fgkDegree;
c890eba4 3036 const Double_t kAlphaSpaceCool = 9.200*fgkDegree;
96eb8210 3037
44d18d38 3038 TList* modulelistA = CreateConeModule(kFALSE, 90-kAlphaRot);
3039 TList* modulelistC = CreateConeModule(kTRUE , 90-kAlphaRot);
3040 TList* &modulelist = modulelistC;
3041 TGeoVolumeAssembly* module, *moduleA, *moduleC;
d0048cec 3042
96eb8210 3043 Double_t xloc, yloc, zloc;
3044
7f69c251 3045 //Double_t angle[10] = {18., 54., 90., 126., 162., -18., -54., -90., -126., -162.};
45c52bb2 3046 // anglem for cone modules (cables and cooling tubes)
3047 // anglep for pathc panels
96eb8210 3048 Double_t anglem[10] = {18., 54., 90., 126., 162., 198., 234., 270., 306., 342.};
45c52bb2 3049 Double_t anglep[10] = {18., 62., 90., 115., 162., 198., 242., 270., 295., 342.};
96eb8210 3050// Double_t angle1m[10] = {23., 53., 90., 127., 157., 203.0, 233.0, 270.0, 307.0, 337.0};
3051// Double_t angle2m[10] = {18., 53., 90., 126., 162., 198.0, 233.0, 270.0, 309.0, 342.0};
3052// Double_t angle1c[10] = {23., 53., 90., 124., 157., 203.0, 233.0, 270.0, 304.0, 337.0};
3053// Double_t angle2c[10] = {18., 44., 90., 126., 162., 198.0, 223.0, 270.0, 309.0, 342.0};
0b9c8a10 3054
3055 // First add the cables
44d18d38 3056 moduleA = (TGeoVolumeAssembly*)modulelistA->At(0);
3057 moduleC = (TGeoVolumeAssembly*)modulelistC->At(0);
96eb8210 3058 for (Int_t i = 0; i < kNumberOfModules; i++) {
7f69c251 3059 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
96eb8210 3060 rot1->RotateY(-kAlphaRot);
3061 rot1->RotateZ(anglem[i]);
3062 xloc = kInnerRadius*CosD(anglem[i]);
3063 yloc = kInnerRadius*SinD(anglem[i]);
3064 zloc = kZTrans;
44d18d38 3065 moth->AddNode(moduleA, 2*i+2,
96eb8210 3066 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
3067
7f69c251 3068 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
96eb8210 3069 rot2->RotateY(180.-kAlphaRot);
3070 rot2->RotateZ(anglem[i]);
3071 xloc = kInnerRadius*CosD(anglem[i]);
3072 yloc = kInnerRadius*SinD(anglem[i]);
3073 zloc = kZTrans;
44d18d38 3074 moth->AddNode(moduleC, 2*i+1,
96eb8210 3075 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
0b9c8a10 3076 }
3077
96eb8210 3078 // Then the cooling tubes on Side A
0b9c8a10 3079 module = (TGeoVolumeAssembly*)modulelist->At(1);
96eb8210 3080 Double_t anglec;
3081 for (Int_t i = 0; i < kNumberOfModules; i++) {
3082 anglec = anglem[i] + kAlphaSpaceCool;
0b9c8a10 3083 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
c890eba4 3084 rot1->RotateX(-90.0+kAlphaRot-0.04); // 0.04 fixes small overlap
3085 rot1->RotateZ(-90.0+anglec);
96eb8210 3086 xloc = kInnerRadius*CosD(anglec);
3087 yloc = kInnerRadius*SinD(anglec);
c890eba4 3088 zloc = kZTrans+0.162; // 0.162 fixes small overlap
3089 moth->AddNode(module, 2*i+2,
96eb8210 3090 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
3091 }
3092
45c52bb2 3093 // And the cooling tubes on Side C
96eb8210 3094 module = (TGeoVolumeAssembly*)modulelist->At(2);
3095 for (Int_t i = 0; i < kNumberOfModules; i++) {
3096 anglec = anglem[i] - kAlphaSpaceCool;
0b9c8a10 3097 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
c890eba4 3098 rot2->RotateX(-90.0+kAlphaRot-0.04); // 0.04 fixes small overlap
96eb8210 3099 rot2->RotateY(180.);
c890eba4 3100 rot2->RotateZ(90.0+anglec);
96eb8210 3101 xloc = kInnerRadius*CosD(anglec);
3102 yloc = kInnerRadius*SinD(anglec);
c890eba4 3103 zloc = kZTrans+0.162; // 0.162 fixes small overlap
96eb8210 3104 moth->AddNode(module, 2*i+1,
3105 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
7f69c251 3106 }
96eb8210 3107
c890eba4 3108 // Then the water cooling tubes
3109 module = (TGeoVolumeAssembly*)modulelist->At(4);
3110 for (Int_t i = 1; i < kNumberOfModules; i++) { // i = 1,2,...,9
3111 if (i != 5) { // There is no tube in this position
3112 anglec = (anglem[i-1]+anglem[i])/2;
3113 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
3114 rot1->RotateX(-90.0+kAlphaRot);
3115 rot1->RotateZ(-90.0+anglec);
3116 xloc = kInnerRadius*CosD(anglec);
3117 yloc = kInnerRadius*SinD(anglec);
3118 zloc = kZTrans;
3119 moth->AddNode(module, 2*i+2,
3120 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
3121
3122 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
3123 rot2->RotateX(-90.0+kAlphaRot);
3124 rot2->RotateY(180.);
3125 rot2->RotateZ(90.0+anglec);
3126 xloc = kInnerRadius*CosD(anglec);
3127 yloc = kInnerRadius*SinD(anglec);
3128 zloc = kZTrans;
3129 moth->AddNode(module, 2*i+1,
3130 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
3131 }
3132 }
3133
45c52bb2 3134 // Finally the optical patch panels
3135 module = (TGeoVolumeAssembly*)modulelist->At(3);
3136 for (Int_t i = 0; i < kNumberOfModules; i++) {
3137 TGeoRotation *rot1 = new TGeoRotation(*gGeoIdentity);
3138 rot1->RotateY(-kAlphaRot);
3139 rot1->RotateZ(anglep[i]);
3140 xloc = kInnerRadius*CosD(anglep[i]);
3141 yloc = kInnerRadius*SinD(anglep[i]);
3142 zloc = kZTrans;
c890eba4 3143 moth->AddNode(module, 2*i+2,
45c52bb2 3144 new TGeoCombiTrans( xloc, yloc, zloc, rot1));
3145
3146 TGeoRotation *rot2 = new TGeoRotation(*gGeoIdentity);
3147 rot2->RotateY(180.-kAlphaRot);
3148 rot2->RotateZ(anglep[i]);
3149 xloc = kInnerRadius*CosD(anglep[i]);
3150 yloc = kInnerRadius*SinD(anglep[i]);
3151 zloc = kZTrans;
3152 moth->AddNode(module, 2*i+1,
3153 new TGeoCombiTrans(-xloc,-yloc,-zloc, rot2));
3154 }
3155
7f69c251 3156}
3157
c890eba4 3158
54c9a3d9 3159//______________________________________________________________________
15b84e14 3160void AliITSv11GeometrySPD::CreateServices(TGeoVolume *moth) const
3161{
3162 //
3163 // New method to implement SPD services
3164 //
3165 // Created: 25 Jul 2012 Mario Sitta
39c2e170 3166 // Updated: 15 Nov 2012 Mario Sitta
15b84e14 3167 //
3168 // Data provided by C.Gargiulo from CAD
3169
3170 // Cooling manifolds
3171 const Double_t kCoolManifWidth = fgkmm * 22.0;
3172 const Double_t kCoolManifLength = fgkmm * 50.0;
3173 const Double_t kCoolManifThick = fgkmm * 7.0;
c33a0330 3174 const Double_t kCoolManifFitR1out = fgkmm * 4.0;
15b84e14 3175 const Double_t kCoolManifFitH1 = fgkmm * 2.5;
3176 const Double_t kCoolManifFitR2out = fgkmm * 4.0;
3177 const Double_t kCoolManifFitR2in = fgkmm * 3.2;
3178 const Double_t kCoolManifFitH2 = fgkmm * 7.0;
3179 const Double_t kCoolManifFitZPos = fgkmm * 2.0; // TO BE CHECKED!
3180 const Double_t kCoolManifCollR1 = fgkmm * 3.0;
3181 const Double_t kCoolManifCollH1 = fgkmm * 2.5;
3182 const Double_t kCoolManifCollR2 = fgkmm * 1.5;
3183 const Double_t kCoolManifCollH2 = fgkmm * 5.0;
c33a0330 3184 const Double_t kCoolManifCollXPos = fgkmm * 5.0;
15b84e14 3185 const Double_t kCoolManifCollDZ = fgkmm * 13.0;
c33a0330 3186 const Double_t kCoolManifCollZ0 = fgkmm * 9.0;
3187
3188 const Double_t kCoolManifRPosCAD = fgkmm * 76.2;
3189 const Double_t kCoolManifZPos = fgkcm * 33.97;// 34.0 - 0.03 toll.
3190 // Manifold supports
3191 const Double_t kManifSuppWidth = fgkmm * 24.0; // TO BE CHECKED!
3192 const Double_t kManifSuppLen1 = fgkmm * 17.9;
3193 const Double_t kManifSuppLen2 = fgkmm * 54.2;
3194 const Double_t kManifSuppLen3 = fgkmm * 7.9;
3195 const Double_t kManifSuppThick = fgkmm * 1.5;
3196 const Double_t kSuppScrewXPos = fgkmm * 4.0;
3197 const Double_t kSuppScrewZPos = fgkmm * 3.0;
3198 const Double_t kRThermalShield = fgkcm * 9.9255; // MUST match with GeometrySupport
97f79b63 3199 // Sector supports
3200 const Double_t kSectSuppWidth = fgkmm * 15.0;
3201 const Double_t kSectSuppLen1 = fgkmm * 16.9; // TO BE CHECKED!
3202 const Double_t kSectSuppLen2 = fgkmm * 35.1; // TO BE CHECKED!
3203 const Double_t kSectSuppThick = fgkmm * 1.5;
3204 const Double_t kSectSuppDepth = fgkmm * 17.78; // MUST match with GeometrySupport
3205 const Double_t kSectScrewZPos = fgkmm * 5.1; // TO BE CHECKED!
3206
3207 const Double_t kSectSuppZPos = fgkcm * 26.5;
3208 // Sector clips
3209 const Double_t kSectClipLength = fgkmm * 30.0;
3210 const Double_t kSectClipWidth = fgkmm * 28.53;
3211 const Double_t kSectClipThick1 = fgkmm * 2.0;
3212 const Double_t kSectClipT