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