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