fixed ReadFromTree
[u/mrichter/AliRoot.git] / ITS / AliITSv11GeometrySPD.cxx
CommitLineData
db486a6e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
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 **************************************************************************/
15
16// This class Defines the Geometry for the ITS services and support cones
17// outside of the ceneteral volume (except for the Ceneteral support
18// cylinders. Other classes define the rest of the ITS. Specificaly the ITS
19// The SSD support cone,SSD Support centeral cylinder, SDD support cone,
20// The SDD cupport centeral cylinder, the SPD Thermal Sheald, The supports
21// and cable trays on both the RB26 (muon dump) and RB24 sides, and all of
22// the cabling from the ladders/stave ends out past the TPC.
23
543b7370 24/* $Id$ */
db486a6e 25// General Root includes
26#include <Riostream.h>
27#include <TMath.h>
28#include <TLatex.h>
29#include <TCanvas.h>
30#include <TPolyLine.h>
31// Root Geometry includes
db486a6e 32#include <TGeoVolume.h>
33#include <TGeoPcon.h>
34#include <TGeoCone.h>
35#include <TGeoTube.h> // contaings TGeoTubeSeg
36#include <TGeoArb8.h>
37#include <TGeoEltu.h>
38#include <TGeoXtru.h>
39#include <TGeoCompositeShape.h>
40#include <TGeoMatrix.h>
a53658c6 41#include <TGeoMaterial.h>
42#include <TGeoMedium.h>
43#include "AliMagF.h"
44#include "AliRun.h"
bf86817c 45//#include <TGeoRotation.h>
46//#include <TGeoCombiTrans.h>
47//#include <TGeoTranslation.h>
db486a6e 48#include "AliITSv11GeometrySPD.h"
49
50ClassImp(AliITSv11GeometrySPD)
51
52#define SQ(A) (A)*(A)
53
54//______________________________________________________________________
a53658c6 55Int_t AliITSv11GeometrySPD::CreateSPDCenteralMaterials(Int_t &medOffset,
56 Int_t &matOffset){
57 // Define the specific materials used for the ITS SPD centeral
58 // detectors. Note, These are the same old names. By the ALICE
59 // naming convension, these should start out at ITS SPD ....
60 // This data has been taken from AliITSvPPRasymmFMD::CreateMaterials().
61 // Intputs:
62 // Int_t &medOffset The starting number of the list of media
63 // Int_t &matOffset The starting number of the list of Materials
64 // Outputs:
65 // Int_t &medOffset The ending number of the list of media
66 // Int_t &matOffset The ending number of the list of Materials
67 // Return:
68 // the last material number used +1 (the next avaiable material number).
69 //Begin_Html
70 /*
71 <img src="http://alice.pd.infn.it/latestdr/all-sections-module.ps"
72 title="SPD Sector drawing with all cross sections defined">
73 <p>The SPD Sector definition.
74 <img src="http://alice.pd.infn.it/latestdr/assembly-10-modules.ps"
75 titile="SPD All Sectors end view with thermal sheald">
76 <p>The SPD all sector end view with thermal sheald.
77 <img src="http://alice.pd.infn.it/latestdr/assembly.ps"
78 title="SPD side view cross section">
79 <p>SPD side view cross section with condes and thermal shealds.
80 <img src="http://alice.pd.infn.it/latestdr/SECTION-A_A.jpg"
81 title="Cross setion A-A"><p>Cross section A-A
82 <img src="http://alice.pd.infn.it/latestdr/SECTION-B_B.jpg"
83 title="Cross section B-B"><p>Cross section B-B
84 <img src="http://alice.pd.infn.it/latestdr/SECTION-C_C.jpg"
85 title-"Cross section C-C"><p>Cross section C-C
86 <img src="http://alice.pd.infn.it/latestdr/SECTION-D_D.jpg"
87 title="Cross section D-D"><p>Cross section D-D
88 <img src="http://alice.pd.infn.it/latestdr/SECTION-F_F.jpg"
89 title="Cross section F-F"><p>Cross section F-F
90 <img src="http://alice.pd.infn.it/latestdr/SECTION-G_G.jpg"
91 title="Cross section G-G"><p>Cross section G-G
92 */
93 //End_Html
94 const Double_t ktmaxfd = 0.1*fgkDegree; // Degree
95 const Double_t kstemax = 1.0*fgkcm; // cm
96 const Double_t kdeemax = 0.1; // Fraction of particle's energy 0<deemax<=1
97 const Double_t kepsil = 1.0E-4; //
98 const Double_t kstmin = 0.0*fgkcm; // cm "Default value used"
99 const Double_t ktmaxfdAir = 0.1*fgkDegree; // Degree
100 const Double_t kstemaxAir = 1.0000E+00*fgkcm; // cm
101 const Double_t kdeemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
102 const Double_t kepsilAir = 1.0E-4;//
103 const Double_t kstminAir = 0.0*fgkcm; // cm "Default value used"
104 const Double_t ktmaxfdSi = 0.1*fgkDegree; // .10000E+01; // Degree
105 const Double_t kstemaxSi = 0.0075*fgkcm; // .10000E+01; // cm
106 const Double_t kdeemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
107 const Double_t kepsilSi = 1.0E-4;//
108 const Double_t kstminSi = 0.0*fgkcm; // cm "Default value used"
109 //
110 Int_t matindex=matOffset;
111 Int_t medindex=medOffset;
112 Double_t params[8]={8*0.0};
113 TGeoMaterial *mat;
114 TGeoMixture *mix;
115 TGeoMedium *med;
116 //
117 Int_t ifield = (gAlice->Field()->Integ());
118 Double_t fieldm = (gAlice->Field()->Max());
119 params[1] = (Double_t) ifield;
120 params[2] = fieldm;
121 params[3] = ktmaxfdSi;
122 params[4] = kstemaxSi;
123 params[5] = kdeemaxSi;
124 params[6] = kepsilSi;
125 params[7] = kstminSi;
126
127 mat = new TGeoMaterial("SI",28.086,14.0,2.33*fgkgcm3,
128 TGeoMaterial::kMatStateSolid,25.0*fgkCelsius,
129 0.0*fgkPascal);
130 mat->SetIndex(matindex);
131 med = new TGeoMedium("SI",medindex++,mat,params);
132 //med = new TGeoMedium("SI",medindex++,matindex++,0,ifield,
133 // fieldm,ktmaxfdSi,kstemaxSi,kdeemaxSi,kepsilSi,kstminSi);
134 //
135 mat = new TGeoMaterial("SPD SI CHIP",28.086,14.0,2.33*fgkgcm3,
136 TGeoMaterial::kMatStateSolid,25.0*fgkCelsius,
137 0.0*fgkPascal);
138 mat->SetIndex(matindex);
139 med = new TGeoMedium("SPD SI CHIP",medindex++,mat,params);
140 //med = new TGeoMedium("SPD SI CHIP",medindex++,matindex++,0,ifield,
141 // fieldm,ktmaxfdSi,kstemaxSi,kdeemaxSi,kepsilSi,kstminSi);
142 //
143 mat = new TGeoMaterial("SPD SI BUS",28.086,14.0,2.33*fgkgcm3,
144 TGeoMaterial::kMatStateSolid,25.0*fgkCelsius,
145 0.0*fgkPascal);
146 mat->SetIndex(matindex);
147 med = new TGeoMedium("SPD SI BUS",medindex++,mat,params);
148 //med = new TGeoMedium("SPD SI BUS",medindex++,matindex++,0,ifield,
149 // fieldm,ktmaxfdSi,kstemaxSi,kdeemaxSi,kepsilSi,kstminSi);
150 //
151 mix = new TGeoMixture("C (M55J)",4,1.9866*fgkgcm3);// Carbon fiber by fractional weight "C (M55J)"
152 mix->SetIndex(matindex);
153 mix->DefineElement(0,12.0107,6.0,0.908508078); // Carbon by fractional weight
154 mix->DefineElement(1,14.0067,7.0,0.010387573); // Nitrogen by fractional weight
155 mix->DefineElement(2,15.9994,8.0,0.055957585); // Oxigen by fractional weight
156 mix->DefineElement(3,1.00794,1.0,0.025146765); // Hydrogen by fractional weight
157 mix->SetPressure(0.0*fgkPascal);
158 mix->SetTemperature(25.0*fgkCelsius);
159 mix->SetState(TGeoMaterial::kMatStateSolid);
160 params[3] = ktmaxfd;
161 params[4] = kstemax;
162 params[5] = kdeemax;
163 params[6] = kepsil;
164 params[7] = kstmin;
165 med = new TGeoMedium("ITSspdCarbonFiber",medindex++,mix,params);
166 //med = new TGeoMedium("ITSspdCarbonFiber",medindex++,matindex++,0,ifield,
167 // fieldm,ktmaxfd,kstemax,kdeemax,kepsil,kstmin);
168 //
169 mix = new TGeoMixture("Air",4,1.20479E-3*fgkgcm3);// Carbon fiber by fractional weight
170 mix->SetIndex(matindex);
171 mix->DefineElement(0,12.0107,6.0,0.000124); // Carbon by fractional weight
172 mix->DefineElement(1,14.0067,7.0,0.755267); // Nitrogen by fractional weight
173 mix->DefineElement(2,15.9994,8.0,0.231781); // Oxigen by fractional weight
174 mix->DefineElement(3,39.948,18.0,0.012827); // Argon by fractional weight
175 mix->SetPressure(101325.0*fgkPascal); // 1 atmosphere
176 mix->SetTemperature(25.0*fgkCelsius);
177 mix->SetState(TGeoMaterial::kMatStateGas);
178 params[3] = ktmaxfdAir;
179 params[4] = kstemaxAir;
180 params[5] = kdeemaxAir;
181 params[6] = kepsilAir;
182 params[7] = kstminAir;
183 med = new TGeoMedium("ITSspdAir",medindex++,mix,params);
184 //med = new TGeoMedium("ITSspdAir",medindex++,matindex++,0,ifield,
185 // fieldm,ktmaxfdAir,kstemaxAir,kdeemaxAir,kepsilAir,kstminAir);
186 //
187 mix = new TGeoMixture("INOX",9,8.03*fgkgcm3);// Carbon fiber by fractional weight
188 mix->SetIndex(matindex);
189 mix->DefineElement(0,12.0107, 6.0,0.0003); // Carbon by fractional weight
190 mix->DefineElement(1,54.9380,25.0,0.02); // Iron by fractional weight
191 mix->DefineElement(2,28.0855,14.0,0.01); // Sodium by fractional weight
192 mix->DefineElement(3,30.9738,15.0,0.00045); // by fractional weight
193 mix->DefineElement(4,32.066 ,16.0,0.0003); // by fractional weight
194 mix->DefineElement(5,58.6928,28.0,0.12); // Nickel by fractional weight
195 mix->DefineElement(6,55.9961,24.0,0.17); // by fractional weight
196 mix->DefineElement(7,95.84 ,42.0,0.025); // by fractional weight
197 mix->DefineElement(8,55.845 ,26.0,0.654); // by fractional weight
198 mix->SetPressure(0.0*fgkPascal); //
199 mix->SetTemperature(25.0*fgkCelsius);
200 mix->SetState(TGeoMaterial::kMatStateSolid);
201 params[3] = ktmaxfdAir;
202 params[4] = kstemaxAir;
203 params[5] = kdeemaxAir;
204 params[6] = kepsilAir;
205 params[7] = kstminAir;
206 med = new TGeoMedium("ITSspdStainlessSteel",medindex++,mix,params);
207 //med = new TGeoMedium("ITSspdStainlessSteel",medindex++,matindex++,0,ifield,
208 // fieldm,ktmaxfdAir,kstemaxAir,kdeemaxAir,kepsilAir,kstminAir);
209 //
210 mix = new TGeoMixture("Freon",2,1.63*fgkgcm3);// Carbon fiber by fractional weight
211 mix->SetIndex(matindex);
212 mix->DefineElement(0,12.0107,6.0,4); // Carbon by fractional weight
213 mix->DefineElement(1,18.9984032,9.0,10); // Florine by fractional weight
214 mix->SetPressure(101325.0*fgkPascal); // 1 atmosphere
215 mix->SetTemperature(25.0*fgkCelsius);
216 mix->SetState(TGeoMaterial::kMatStateLiquid);
217 params[3] = ktmaxfdAir;
218 params[4] = kstemaxAir;
219 params[5] = kdeemaxAir;
220 params[6] = kepsilAir;
221 params[7] = kstminAir;
222 med = new TGeoMedium("ITSspdCoolingFluid",medindex++,mix,params);
223 //med = new TGeoMedium("ITSspdCoolingFluid",medindex++,matindex++,0,ifield,
224 // fieldm,ktmaxfdAir,kstemaxAir,kdeemaxAir,kepsilAir,kstminAir);
225 //
226 medOffset = medindex;
227 matOffset = matindex;
228 return matOffset;
229}
230//______________________________________________________________________
231void AliITSv11GeometrySPD::InitSPDCenteral(Int_t offset,TVirtualMC *vmc){
232 // Do any SPD Centeral detector related initilizations, setting
233 // transport cuts for example.
234 // Some GEANT3 Physics switches
235 // "MULTS"
236 // Multiple scattering. The variable IMULS controls this process. For
237 // more information see [PHYS320 or 325 or 328].
238 // 0 - No multiple scattering.
239 // 1 - Multiple scattering according to Molière theory. Default setting.
240 // 2 - Same as 1. Kept for backward compatibility.
241 // 3 - Pure Gaussian scattering according to the Rossi formula.
242 // "DRAY"
243 // delta ray production. The variable IDRAY controls this process. See [PHYS430]
244 // 0 - No delta rays production.
245 // 1 - delta rays production with generation of . Default setting.
246 // 2 - delta rays production without generation of .
247 // "LOSS"
248 // Continuous energy loss. The variable ILOSS controls this process.
249 // 0 - No continuous energy loss, IDRAY is set to 0.
250 // 1 - Continuous energy loss with generation of delta rays above
251 // DCUTE (common/GCUTS/) and restricted Landau fluctuations below DCUTE.
252 // 2 - Continuous energy loss without generation of delta rays and full
253 // Landau-Vavilov-Gauss fluctuations. In this case the variable IDRAY
254 // is forced to 0 to avoid double counting of fluctuations. Default setting.
255 // 3 - Same as 1, kept for backward compatibility.
256 // 4 - Energy loss without fluctuation. The value obtained from the tables is
257 // used directly.
258 // Intputs:
259 // Int_t offset The material/medium index offset.
260 // TVirturalMC *vmc The pointer to the virtual Monte Carlo default gMC.
261 // Outputs:
262 // none.
263 // Return:
264 // none.
265 Int_t i,n=4;
266
267 for(i=0;i<n;i++){
268 vmc->Gstpar(i+offset,"CUTGAM",30.0*fgkKeV);
269 vmc->Gstpar(i+offset,"CUTELE",30.0*fgkKeV);
270 vmc->Gstpar(i+offset,"CUTNEU",30.0*fgkKeV);
271 vmc->Gstpar(i+offset,"CUTHAD",30.0*fgkKeV);
272 vmc->Gstpar(i+offset,"CUTMUO",30.0*fgkKeV);
273 vmc->Gstpar(i+offset,"BCUTE",30.0*fgkKeV);
274 vmc->Gstpar(i+offset,"BCUTM",30.0*fgkKeV);
275 vmc->Gstpar(i+offset,"DCUTE",30.0*fgkKeV);
276 vmc->Gstpar(i+offset,"DCUTM",30.0*fgkKeV);
277 //vmc->Gstpar(i+offset,"PPCUTM",);
278 //vmc->Gstpar(i+offset,"PAIR",);
279 //vmc->Gstpar(i+offset,"COMPT",);
280 //vmc->Gstpar(i+offset,"PHOT",);
281 //vmc->Gstpar(i+offset,"PFIS",);
282 vmc->Gstpar(i+offset,"DRAY",1);
283 //vmc->Gstpar(i+offset,"ANNI",);
284 //vmc->Gstpar(i+offset,"BREM",);
285 //vmc->Gstpar(i+offset,"HADR",);
286 //vmc->Gstpar(i+offset,"MUNU",);
287 //vmc->Gstpar(i+offset,"DCAY",);
288 vmc->Gstpar(i+offset,"LOSS",1);
289 //vmc->Gstpar(i+offset,"MULS",);
290 //vmc->Gstpar(i+offset,"GHCOR1",);
291 //vmc->Gstpar(i+offset,"BIRK1",);
292 //vmc->Gstpar(i+offset,"BRIK2",);
293 //vmc->Gstpar(i+offset,"BRIK3",);
294 //vmc->Gstpar(i+offset,"LABS",);
295 //vmc->Gstpar(i+offset,"SYNC",);
296 //vmc->Gstpar(i+offset,"STRA",);
297 } // end for i
298}
299//______________________________________________________________________
300void AliITSv11GeometrySPD::SPDSector(TGeoVolume *moth,TGeoManager *mgr){
301 // Position of the Carbon Fiber Assembly based on distance
302 // of closest point of SPD stave to beam pipe figures
303 // all-sections-modules.ps of 7.22mm at section A-A.
304 // Inputs:
305 // TGeoVolume *moth the mother volume which this
306 // object/volume is to be placed in.
307 // Outputs:
308 // none.
309 // Return:
310 // none.
311 const Double_t kSPDclossesStaveAA = 7.22*fgkmm;
312 const Double_t kSectorStartingAngle = -72.0*fgkDegree;
313 const Double_t kNSectorsTotal = 10.; // number
314 const Double_t kSectorRelativeAngle = 360./kNSectorsTotal*fgkDegree;
315 const Double_t kBeamPipeRadius = 0.5*60.0*fgkmm;
316 //
317 Int_t i;
318 Double_t angle,radiusSector,xAAtubeCenter0,yAAtubeCenter0;
319 Double_t staveThicknessAA=1.03*fgkmm; // get from stave geometry.
320 TGeoCombiTrans *secRot=new TGeoCombiTrans();
321 TGeoVolume *vCarbonFiberSector;
322 TGeoMedium *medSPDcf;
323
324 medSPDcf = mgr->GetMedium("ITSspdCarbonFiber");
325 vCarbonFiberSector = new TGeoVolumeAssembly("ITSSPDCarbonFiberSectorV");
326 vCarbonFiberSector->SetMedium(medSPDcf);
327 CarbonFiberSector(vCarbonFiberSector,xAAtubeCenter0,yAAtubeCenter0);
328 vCarbonFiberSector->SetVisibility(kFALSE); // logical volume
329 // Compute the radial shift out of the sectors.
330 radiusSector = kBeamPipeRadius+kSPDclossesStaveAA+staveThicknessAA;
331 radiusSector *= radiusSector; // squaring;
332 radiusSector -= xAAtubeCenter0*xAAtubeCenter0;
333 radiusSector = -yAAtubeCenter0+TMath::Sqrt(radiusSector);
334 angle = kSectorStartingAngle;
335 secRot->RotateZ(angle);
336 for(i=0;i<(Int_t)kNSectorsTotal;i++){
337 secRot->SetDx(-radiusSector*TMath::Sin(angle/fgkRadian));
338 secRot->SetDy(radiusSector*TMath::Cos(angle/fgkRadian));
339 //secRot->RegisterYourself();
340 moth->AddNode(vCarbonFiberSector,i+1,new TGeoCombiTrans(*secRot));
543b7370 341 if(GetDebug(5)){
342 printf("i=%d angle=%g angle[rad]=%g radiusSector=%g x=%g y=%g \n",
343 i,angle,angle/fgkRadian,radiusSector,
344 -radiusSector*TMath::Sin(angle/fgkRadian),
345 radiusSector*TMath::Cos(angle/fgkRadian));
346 } // end if GetDebug(5)
a53658c6 347 angle += kSectorRelativeAngle;
348 secRot->RotateZ(kSectorRelativeAngle);
349 } // end for i
543b7370 350 if(GetDebug(3)){
a53658c6 351 moth->PrintNodes();
352 } // end if GetDebug().
353 delete secRot;
354}
355//______________________________________________________________________
356void AliITSv11GeometrySPD::CarbonFiberSector(TGeoVolume *moth,
357 Double_t &xAAtubeCenter0,
358 Double_t &yAAtubeCenter0,
359 TGeoManager *mgr){
db486a6e 360 // Define the detail SPD Carbon fiber support Sector geometry.
361 // Based on the drawings ALICE-Pixel "Construzione Profilo Modulo"
362 // March 25 2004 and ALICE-SUPPORTO "construzione Profilo Modulo"
363 // Define Outside radii as negitive, Outside in the sence that the
364 // center of the arc is outside of the object.
365 // February 16 2004.
366 // Inputs:
a53658c6 367 // TGeoVolume *moth The mother volume to put this object
db486a6e 368 // Outputs:
a53658c6 369 // Double_t &xAAtubeCenter0 The x location of the outer surface
370 // of the cooling tube center for tube 0.
371 // This location helps determine where
372 // this sector is to be located (information
373 // used for this is the distance the
374 // center of the #0 detector is from the
375 // beam pipe. Measurements taken at
376 // cross section A-A.
377 // Double_t &yAAtubeCenter0 The y location of the outer surface
378 // of the cooling tube center for tube 0
379 // This location helps determine where
380 // this sector is to be located (information
381 // used for this is the distance the
382 // center of the #0 detector is from the
383 // beam pipe. Measurements taken at
384 // cross section A-A.
385 // TGeoManager *mgr The TGeoManager as needed, default is
386 // gGeoManager.
db486a6e 387 // Return:
bf86817c 388 // none.
db486a6e 389 TGeoMedium *medSPDcf = 0; // SPD support cone Carbon Fiber materal number.
390 //TGeoMedium *medSPDfs = 0; // SPD support cone inserto stesalite 4411w.
391 //TGeoMedium *medSPDfo = 0; // SPD support cone foam, Rohacell 50A.
392 TGeoMedium *medSPDss = 0; // SPD support cone screw material,Stainless
393 TGeoMedium *medSPDair = 0; // SPD support cone Air
394 //TGeoMedium *medSPDal = 0; // SPD support cone SDD mounting bracket Al
395 TGeoMedium *medSPDcoolfl = 0; // SPD cooling fluid, Freeon
396 medSPDcf = mgr->GetMedium("ITSspdCarbonFiber");
397 //medSPDfs = mgr->GetMedium("ITSspdStaselite4411w");
398 //medSPDfo = mgr->GetMedium("ITSspdRohacell50A");
a53658c6 399 medSPDss = mgr->GetMedium("ITSspdStainlessSteel");
db486a6e 400 medSPDair= mgr->GetMedium("ITSspdAir");
401 medSPDcoolfl= mgr->GetMedium("ITSspdCoolingFluid");
402 //
403 const Double_t ksecDz = 0.5*500.0*fgkmm;
404 const Double_t ksecLen = 30.0*fgkmm;
405 const Double_t ksecCthick = 0.20*fgkmm;
406 const Double_t ksecDipLength = 3.2*fgkmm;
407 const Double_t ksecDipRadii = 0.4*fgkmm;
408 //const Double_t ksecCoolingTubeExtraDepth = 0.86*fgkmm;
a53658c6 409 // These positions, ksecX*,ksecY* are the center of curvatures
410 // for the different point around the SPD sector. The radii,
411 // inner and outer, are the radous of curvature about the centers
412 // ksecX* and ksecY*. To draw this SPD sector, first plot all of
413 // the ksecX and ksecY points and draw circles of the specified
414 // radius about these points. Connect the circles, such that the
415 // lines are tangent to the circles, in accordance with the
416 // radii being "Inside" or "Outside". These lines and the
417 // corresponding arc's are the surface of this SPD sector.
db486a6e 418 const Double_t ksecX0 = -10.725*fgkmm;
419 const Double_t ksecY0 = -14.853*fgkmm;
420 const Double_t ksecR0 = -0.8*fgkmm; // Outside
421 const Double_t ksecX1 = -13.187*fgkmm;
422 const Double_t ksecY1 = -19.964*fgkmm;
423 const Double_t ksecR1 = +0.6*fgkmm; // Inside
a53658c6 424 //const Double_t ksecDip0 = 5.9*fgkmm;
db486a6e 425 //
426 const Double_t ksecX2 = -3.883*fgkmm;
427 const Double_t ksecY2 = -17.805*fgkmm;
428 const Double_t ksecR2 = +0.80*fgkmm; // Inside Guess.
429 const Double_t ksecX3 = -3.123*fgkmm;
430 const Double_t ksecY3 = -14.618*fgkmm;
431 const Double_t ksecR3 = -0.6*fgkmm; // Outside
a53658c6 432 //const Double_t ksecDip1 = 8.035*fgkmm;
db486a6e 433 //
434 const Double_t ksecX4 = +11.280*fgkmm;
435 const Double_t ksecY4 = -14.473*fgkmm;
436 const Double_t ksecR4 = +0.8*fgkmm; // Inside
437 const Double_t ksecX5 = +19.544*fgkmm;
438 const Double_t ksecY5 = +10.961*fgkmm;
439 const Double_t ksecR5 = +0.8*fgkmm; // Inside
a53658c6 440 //const Double_t ksecDip2 = 4.553*fgkmm;
db486a6e 441 //
442 const Double_t ksecX6 = +10.830*fgkmm;
443 const Double_t ksecY6 = +16.858*fgkmm;
444 const Double_t ksecR6 = +0.6*fgkmm; // Inside
445 const Double_t ksecX7 = +11.581*fgkmm;
446 const Double_t ksecY7 = +13.317*fgkmm;
447 const Double_t ksecR7 = -0.6*fgkmm; // Outside
a53658c6 448 //const Double_t ksecDip3 = 6.978*fgkmm;
db486a6e 449 //
450 const Double_t ksecX8 = -0.733*fgkmm;
451 const Double_t ksecY8 = +17.486*fgkmm;
452 const Double_t ksecR8 = +0.6*fgkmm; // Inside
453 const Double_t ksecX9 = +0.562*fgkmm;
454 const Double_t ksecY9 = +14.486*fgkmm;
455 const Double_t ksecR9 = -0.6*fgkmm; // Outside
a53658c6 456 //const Double_t ksecDip4 = 6.978*fgkmm;
db486a6e 457 //
458 const Double_t ksecX10 = -12.252*fgkmm;
459 const Double_t ksecY10 = +16.298*fgkmm;
460 const Double_t ksecR10 = +0.6*fgkmm; // Inside
461 const Double_t ksecX11 = -10.445*fgkmm;
462 const Double_t ksecY11 = +13.162*fgkmm;
463 const Double_t ksecR11 = -0.6*fgkmm; // Outside
a53658c6 464 //const Double_t ksecDip5 = 6.978*fgkmm;
db486a6e 465 //
466 const Double_t ksecX12 = -22.276*fgkmm;
467 const Double_t ksecY12 = +12.948*fgkmm;
468 const Double_t ksecR12 = +0.85*fgkmm; // Inside
469 //const Double_t ksecX13 = *fgkmm;
470 //const Double_t ksecY13 = *fgkmm;
471 const Double_t ksecR13 = -0.8*fgkmm; // Outside
472 const Double_t ksecAngleSide13 = 36.0*fgkDegree;
473 //
a53658c6 474 const Int_t ksecNRadii = 20;
db486a6e 475 const Int_t ksecNPointsPerRadii = 4;
476 const Int_t ksecNCoolingTubeDips = 6;
477 // Since the Rounded parts are aproximated by a regular polygon and
478 // a cooling tube of the propper diameter must fit, a scaling factor
479 // increases the size of the polygon for the tube to fit.
480 //const Double_t ksecRCoolScale = 1./TMath::Cos(TMath::Pi()/
481 // (Double_t)ksecNPointsPerRadii);
482 const Double_t ksecZEndLen = 30.00*fgkmm;
483 //const Double_t ksecZFlangLen= 45.00*fgkmm;
484 const Double_t ksecTl = 0.860*fgkmm;
485 const Double_t ksecCthick2 = 0.600*fgkmm;
a53658c6 486 //const Double_t ksecCthick3 = 1.800*fgkmm;
487 //const Double_t ksecSidelen = 22.00*fgkmm;
488 //const Double_t ksecSideD5 = 3.679*fgkmm;
489 //const Double_t ksecSideD12 = 7.066*fgkmm;
db486a6e 490 const Double_t ksecRCoolOut = 2.400*fgkmm;
491 const Double_t ksecRCoolIn = 2.000*fgkmm;
492 const Double_t ksecDl1 = 5.900*fgkmm;
493 const Double_t ksecDl2 = 8.035*fgkmm;
494 const Double_t ksecDl3 = 4.553*fgkmm;
495 const Double_t ksecDl4 = 6.978*fgkmm;
496 const Double_t ksecDl5 = 6.978*fgkmm;
497 const Double_t ksecDl6 = 6.978*fgkmm;
a53658c6 498 const Double_t ksecCoolTubeThick = 0.04*fgkmm;
499 const Double_t ksecCoolTubeROuter = 2.6*fgkmm;
500 const Double_t ksecCoolTubeFlatX = 3.696*fgkmm;
501 const Double_t ksecCoolTubeFlatY = 0.68*fgkmm;
502 //const Double_t ksecBeamX0 = 0.0*fgkmm; // guess
503 //const Double_t ksecBeamY0 = (15.223+40.)*fgkmm; // guess
504 //
505 const Int_t ksecNPoints = (ksecNPointsPerRadii+1)*ksecNRadii + 8;
506 Double_t secX[ksecNRadii] = {ksecX0,ksecX1,-1000.0,ksecX2 ,ksecX3 ,-1000.0,
507 ksecX4,ksecX5,-1000.0,ksecX6 ,ksecX7 ,-1000.0,
508 ksecX8,ksecX9,-1000.0,ksecX10,ksecX11,-1000.0,
509 ksecX12,-1000.0};
510 Double_t secY[ksecNRadii] = {ksecY0,ksecY1,-1000.0,ksecY2 ,ksecY3 ,-1000.0,
511 ksecY4,ksecY5,-1000.0,ksecY6 ,ksecY7 ,-1000.0,
512 ksecY8,ksecY9,-1000.0,ksecY10,ksecY11,-1000.0,
513 ksecY12,-1000.0};
514 Double_t secR[ksecNRadii] ={ksecR0 ,ksecR1 ,-.5*ksecDipLength-ksecDipRadii,
515 ksecR2 ,ksecR3 ,-.5*ksecDipLength-ksecDipRadii,
516 ksecR4 ,ksecR5 ,-.5*ksecDipLength-ksecDipRadii,
517 ksecR6 ,ksecR7 ,-.5*ksecDipLength-ksecDipRadii,
518 ksecR8 ,ksecR9 ,-.5*ksecDipLength-ksecDipRadii,
519 ksecR10,ksecR11,-.5*ksecDipLength-ksecDipRadii,
520 ksecR12,ksecR13};/*
521 Double_t secDip[ksecNRadii]={0.0,0.0,ksecDip0,0.0,0.0,ksecDip1,
522 0.0,0.0,ksecDip2,0.0,0.0,ksecDip3,
523 0.0,0.0,ksecDip4,0.0,0.0,ksecDip5,
524 0.0,0.0};*/
525 Double_t secX2[ksecNRadii];
526 Double_t secY2[ksecNRadii];
527 Double_t secR2[ksecNRadii] = {
528 ksecR0,ksecR1,ksecRCoolOut,ksecR2,ksecR3,ksecRCoolOut,ksecR4,ksecR5,
529 ksecRCoolOut,ksecR6,ksecR7,ksecRCoolOut,ksecR8,ksecR9,ksecRCoolOut,
530 ksecR10,ksecR11,ksecRCoolOut,ksecR12,ksecR13};
531 Double_t secDip2[ksecNCoolingTubeDips]={ksecDl1,ksecDl2,ksecDl3,
532 ksecDl4,ksecDl5,ksecDl6};
533 Double_t secX3[ksecNRadii];
534 Double_t secY3[ksecNRadii];
db486a6e 535 const Int_t ksecDipIndex[ksecNCoolingTubeDips] = {2,5,8,11,14,17};
536 Double_t secAngleStart[ksecNRadii];
537 Double_t secAngleEnd[ksecNRadii];
a53658c6 538 Double_t secAngleStart2[ksecNRadii];
539 Double_t secAngleEnd2[ksecNRadii];
540 Double_t secAngleTurbo[ksecNCoolingTubeDips] = {0.0,0.0,0.0,0.0,0.0,0.0};
541 //Double_t secAngleStart3[ksecNRadii];
542 //Double_t secAngleEnd3[ksecNRadii];
543 Double_t xpp[ksecNPoints],ypp[ksecNPoints];
544 Double_t xpp2[ksecNPoints],ypp2[ksecNPoints];
545 Double_t *xp[ksecNRadii],*xp2[ksecNRadii];
546 Double_t *yp[ksecNRadii],*yp2[ksecNRadii];
db486a6e 547 TGeoXtru *sA0,*sA1,*sB0,*sB1;
548 TGeoEltu *sTA0,*sTA1;
a53658c6 549 TGeoTube *sTB0,*sTB1,*sM0;
db486a6e 550 TGeoRotation *rot;
551 TGeoTranslation *trans;
552 TGeoCombiTrans *rotrans;
553 Double_t t,t0,t1,a,b,x0,y0,x1,y1;
a53658c6 554 Int_t i,j,k,m;
555 Bool_t tst;
db486a6e 556
557 if(moth==0){
a53658c6 558 Error("CarbonFiberSector","moth=%p",moth);
559 return;
db486a6e 560 } // end if moth==0
a53658c6 561 //SetDebug(3);
562 for(i=0;i<ksecNRadii;i++){
563 xp[i] = &(xpp[i*(ksecNPointsPerRadii+1)]);
564 yp[i] = &(ypp[i*(ksecNPointsPerRadii+1)]);
565 xp2[i] = &(xpp2[i*(ksecNPointsPerRadii+1)]);
566 yp2[i] = &(ypp2[i*(ksecNPointsPerRadii+1)]);
567 secX2[i] = secX[i];
568 secY2[i] = secY[i];
569 secX3[i] = secX[i];
570 secY3[i] = secY[i];
571 } // end for i
db486a6e 572
a53658c6 573 // Find starting and ending angles for all but cooling tube sections
db486a6e 574 secAngleStart[0] = 0.5*ksecAngleSide13;
575 for(i=0;i<ksecNRadii-2;i++){
a53658c6 576 tst = kFALSE;
577 for(j=0;j<ksecNCoolingTubeDips;j++) tst = tst||i==ksecDipIndex[j];
578 if(tst) continue;
579 tst = kFALSE;
580 for(j=0;j<ksecNCoolingTubeDips;j++) tst = tst||(i+1)==ksecDipIndex[j];
581 if(tst) j = i+2;
582 else j = i+1;
583 AnglesForRoundedCorners(secX[i],secY[i],secR[i],
584 secX[j],secY[j],secR[j],t0,t1);
585 secAngleEnd[i] = t0;
586 secAngleStart[j] = t1;
587 if(secR[i]>0.0&&secR[j]>0.0)if(secAngleStart[i]>secAngleEnd[i])
588 secAngleEnd[i] += 360.0;
589 secAngleStart2[i] = secAngleStart[i];
590 secAngleEnd2[i] = secAngleEnd[i];
db486a6e 591 } // end for i
592 secAngleEnd[ksecNRadii-2] = secAngleStart[ksecNRadii-2] +
a53658c6 593 (secAngleEnd[ksecNRadii-5]-
594 secAngleStart[ksecNRadii-5]);
db486a6e 595 if(secAngleEnd[ksecNRadii-2]<0.0) secAngleEnd[ksecNRadii-2] += 360.0;
596 secAngleStart[ksecNRadii-1] = secAngleEnd[ksecNRadii-2] - 180.0;
597 secAngleEnd[ksecNRadii-1] = secAngleStart[0];
a53658c6 598 secAngleStart2[ksecNRadii-2] = secAngleStart[ksecNRadii-2];
599 secAngleEnd2[ksecNRadii-2] = secAngleEnd[ksecNRadii-2];
600 secAngleStart2[ksecNRadii-1] = secAngleStart[ksecNRadii-1];
601 secAngleEnd2[ksecNRadii-1] = secAngleEnd[ksecNRadii-1];
602 // Find location of circle last rounded corner.
db486a6e 603 i = 0;
604 j = ksecNRadii-2;
605 t0 = TanD(secAngleStart[i]-90.);
606 t1 = TanD(secAngleEnd[j]-90.);
607 t = secY[i] - secY[j];
a53658c6 608 // Note, secR[i=0] <0; secR[j=18]>0; and secR[j+1=19] <0
db486a6e 609 t += (-secR[i]+secR[j+1])*SinD(secAngleStart[i]);
610 t -= (secR[j]-secR[j+1])*SinD(secAngleEnd[j]);
611 t += t1*secX[j] - t0*secX[i];
612 t += t1*(secR[j]-secR[j+1])*CosD(secAngleEnd[j]);
613 t -= t0*(-secR[i]+secR[j+1])*CosD(secAngleStart[i]);
614 secX[ksecNRadii-1] = t/(t1-t0);
615 secY[ksecNRadii-1] = TanD(90.+0.5*ksecAngleSide13)*
a53658c6 616 (secX[ksecNRadii-1]-secX[0]) + secY[0];
617 secX2[ksecNRadii-1] = secX[ksecNRadii-1];
618 secY2[ksecNRadii-1] = secY[ksecNRadii-1];
619 secX3[ksecNRadii-1] = secX[ksecNRadii-1];
620 secY3[ksecNRadii-1] = secY[ksecNRadii-1];
621 // find location of cooling tube centers
622 for(i=0;i<ksecNCoolingTubeDips;i++){
623 j = ksecDipIndex[i];
624 x0 = secX[j-1] + TMath::Abs(secR[j-1])*CosD(secAngleEnd[j-1]);
625 y0 = secY[j-1] + TMath::Abs(secR[j-1])*SinD(secAngleEnd[j-1]);
626 x1 = secX[j+1] + TMath::Abs(secR[j+1])*CosD(secAngleStart[j+1]);
627 y1 = secY[j+1] + TMath::Abs(secR[j+1])*SinD(secAngleStart[j+1]);
628 t0 = TMath::Sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
629 t = secDip2[i]/t0;
630 a = x0+(x1-x0)*t;
631 b = y0+(y1-y0)*t;
632 if(i==0){ // get location of tube center->Surface for locating
633 // this sector around the beam pipe. This needs to be
634 // double checked, but I need my notes for that, Bjorn Nilsen
635 xAAtubeCenter0 = x0+(x1-x0)*t*0.5;
636 yAAtubeCenter0 = y0+(y1-y0)*t*0.5;
637 } // end if i==0
638 if(a+b*(a-x0)/(b-y0)>0.0){
639 secX[j] = a + TMath::Abs(y1-y0)*2.0*ksecDipRadii/t0;
640 secY[j] = b - TMath::Sign(2.0*ksecDipRadii,y1-y0)*(x1-x0)/t0;
641 secX2[j] = a + TMath::Abs(y1-y0)*ksecTl/t0;
642 secY2[j] = b - TMath::Sign(ksecTl,y1-y0)*(x1-x0)/t0;
643 secX3[j] = a + TMath::Abs(y1-y0)*(2.0*ksecDipRadii-
644 0.5*ksecCoolTubeFlatY)/t0;
645 secY3[j] = b - TMath::Sign(2.0*ksecDipRadii-0.5*ksecCoolTubeFlatY,
646 y1-y0)*(x1-x0)/t0;
647 }else{
648 secX[j] = a - TMath::Abs(y1-y0)*2.0*ksecDipRadii/t0;
649 secY[j] = b + TMath::Sign(2.0*ksecDipRadii,y1-y0)*(x1-x0)/t0;
650 secX2[j] = a - TMath::Abs(y1-y0)*ksecTl/t0;
651 secY2[j] = b + TMath::Sign(ksecTl,y1-y0)*(x1-x0)/t0;
652 secX3[j] = a - TMath::Abs(y1-y0)*(2.0*ksecDipRadii-
653 0.5*ksecCoolTubeFlatY)/t0;
654 secY3[j] = b + TMath::Sign(2.0*ksecDipRadii-0.5*ksecCoolTubeFlatY,
655 y1-y0)*(x1-x0)/t0;
656 } // end if
657 // Set up Start and End angles to correspond to start/end of dips.
658 t1 = (secDip2[i]-TMath::Abs(secR[j]))/t0;
659 secAngleStart[j] = TMath::RadToDeg()*TMath::ATan2(
660 y0+(y1-y0)*t1-secY[j],x0+(x1-x0)*t1-secX[j]);
661 if(secAngleStart[j]<0.0) secAngleStart[j] += 360.0;
662 secAngleStart2[j] = secAngleStart[j];
663 t1 = (secDip2[i]+TMath::Abs(secR[j]))/t0;
664 secAngleEnd[j] = TMath::RadToDeg()*TMath::ATan2(
665 y0+(y1-y0)*t1-secY[j],x0+(x1-x0)*t1-secX[j]);
666 if(secAngleEnd[j]<0.0) secAngleEnd[j] += 360.0;
667 secAngleEnd2[j] = secAngleEnd[j];
668 if(secAngleEnd[j]>secAngleStart[j]) secAngleEnd[j] -= 360.0;
669 secR[j] = TMath::Sqrt(secR[j]*secR[j]+4.0*ksecDipRadii*ksecDipRadii);
670 } // end for i
671 // Spcial cases
672 secAngleStart2[8] -= 360.;
673 secAngleStart2[11] -= 360.;
bf86817c 674 //
a53658c6 675 SPDsectorShape(ksecNRadii,secX,secY,secR,secAngleStart,secAngleEnd,
676 ksecNPointsPerRadii,m,xp,yp);
677 // Fix up dips to be square.
678 for(i=0;i<ksecNCoolingTubeDips;i++){
679 j = ksecDipIndex[i];
680 t = 0.5*ksecDipLength+ksecDipRadii;
681 t0 = TMath::RadToDeg()*TMath::ATan(2.0*ksecDipRadii/t);
682 t1 = secAngleEnd[j] + t0;
683 t0 = secAngleStart[j] - t0;
684 x0 = xp[j][1] = secX[j] + t*CosD(t0);
685 y0 = yp[j][1] = secY[j] + t*SinD(t0);
686 x1 = xp[j][ksecNPointsPerRadii-1] = secX[j] + t*CosD(t1);
687 y1 = yp[j][ksecNPointsPerRadii-1] = secY[j] + t*SinD(t1);
688 t0 = 1./((Double_t)(ksecNPointsPerRadii-2));
689 for(k=2;k<ksecNPointsPerRadii-1;k++){// extra points spread them out.
690 t = ((Double_t)(k-1))*t0;
691 xp[j][k] = x0+(x1-x0)*t;
692 yp[j][k] = y0+(y1-y0)*t;
db486a6e 693 } // end for k
a53658c6 694 secAngleTurbo[i] = -TMath::RadToDeg()*TMath::ATan2(y1-y0,x1-x0);
695 if(GetDebug(3)){
696 cout <<"i="<<i<<" angle="<<secAngleTurbo[i]<<" x0,y0{"
697 <<x0<<","<<y0<<"} x1y1={"<<x1<<","<<y1<<"}"<<endl;
698 } // end if
699 } // end for i
db486a6e 700 sA0 = new TGeoXtru(2);
701 sA0->SetName("ITS SPD Carbon fiber support Sector A0");
a53658c6 702 sA0->DefinePolygon(m,xpp,ypp);
db486a6e 703 sA0->DefineSection(0,-ksecDz);
704 sA0->DefineSection(1,ksecDz);
705 //
543b7370 706 //printf("SectorA#%d ",0);
a53658c6 707 InsidePoint(xpp[m-1],ypp[m-1],xpp[0],ypp[0],xpp[1],ypp[1],
708 ksecCthick,xpp2[0],ypp2[0]);
709 for(i=1;i<m-1;i++){
710 j = i/(ksecNPointsPerRadii+1);
543b7370 711 //printf("SectorA#%d ",i);
a53658c6 712 InsidePoint(xpp[i-1],ypp[i-1],xpp[i],ypp[i],xpp[i+1],ypp[i+1],
713 ksecCthick,xpp2[i],ypp2[i]);
714 } // end for i
543b7370 715 //printf("SectorA#%d ",m);
a53658c6 716 InsidePoint(xpp[m-2],ypp[m-2],xpp[m-1],ypp[m-1],xpp[0],ypp[0],
717 ksecCthick,xpp2[m-1],ypp2[m-1]);
718 // Fix center value of cooling tube dip.
719 // find location of cooling tube centers
720 for(i=0;i<ksecNCoolingTubeDips;i++){
721 j = ksecDipIndex[i];
722 x0 = xp2[j][1];
723 y0 = yp2[j][1];
724 x1 = xp2[j][ksecNPointsPerRadii-1];
725 y1 = yp2[j][ksecNPointsPerRadii-1];
726 t0 = TMath::Sqrt((x0-x1)*(x0-x1)+(y0-y1)*(y0-y1));
727 t = secDip2[i]/t0;
728 for(k=2;k<ksecNPointsPerRadii-1;k++){// extra points spread them out.
729 t = ((Double_t)(k-1))*t0;
730 xp2[j][k] = x0+(x1-x0)*t;
731 yp2[j][k] = y0+(y1-y0)*t;
732 } // end for k
733 } // end for i
db486a6e 734 sA1 = new TGeoXtru(2);
735 sA1->SetName("ITS SPD Carbon fiber support Sector Air A1");
a53658c6 736 sA1->DefinePolygon(m,xpp2,ypp2);
db486a6e 737 sA1->DefineSection(0,-ksecDz);
738 sA1->DefineSection(1,ksecDz);
739 //
a53658c6 740 // Error in TGeoEltu. Semi-axis X must be < Semi-axis Y (?).
db486a6e 741 sTA0 = new TGeoEltu("ITS SPD Cooling Tube TA0",
a53658c6 742 0.5* ksecCoolTubeFlatY, 0.5* ksecCoolTubeFlatX,ksecDz);
db486a6e 743 sTA1 = new TGeoEltu("ITS SPD Cooling Tube coolant TA1",
744 sTA0->GetA()-ksecCoolTubeThick,
745 sTA0->GetB()-ksecCoolTubeThick,ksecDz);
746 //
a53658c6 747 SPDsectorShape(ksecNRadii,secX2,secY2,secR2,secAngleStart2,secAngleEnd2,
748 ksecNPointsPerRadii,m,xp,yp);
db486a6e 749 //
750 sB0 = new TGeoXtru(2);
751 sB0->SetName("ITS SPD Carbon fiber support Sector End B0");
a53658c6 752 sB0->DefinePolygon(m,xpp,ypp);
db486a6e 753 sB0->DefineSection(0,ksecDz);
754 sB0->DefineSection(1,ksecDz+ksecZEndLen);
755 //
543b7370 756 //printf("SectorB#%d ",0);
a53658c6 757 InsidePoint(xpp[m-1],ypp[m-1],xpp[0],ypp[0],xpp[1],ypp[1],
758 ksecCthick2,xpp2[0],ypp2[0]);
759 for(i=1;i<m-1;i++){
760 t = ksecCthick2;
761 for(k=0;k<ksecNCoolingTubeDips;k++)
762 if((i/(ksecNPointsPerRadii+1))==ksecDipIndex[k])
763 if(!(ksecDipIndex[k]*(ksecNPointsPerRadii+1)==i ||
764 ksecDipIndex[k]*(ksecNPointsPerRadii+1)+
765 ksecNPointsPerRadii==i ))
766 t = ksecRCoolOut-ksecRCoolIn;
543b7370 767 //printf("SectorB#%d ",i);
a53658c6 768 InsidePoint(xpp[i-1],ypp[i-1],xpp[i],ypp[i],xpp[i+1],ypp[i+1],
769 t,xpp2[i],ypp2[i]);
543b7370 770 } // end for
771 //printf("SectorB#%d ",m);
a53658c6 772 InsidePoint(xpp[m-2],ypp[m-2],xpp[m-1],ypp[m-1],xpp[0],ypp[0],
773 ksecCthick2,xpp2[m-1],ypp2[m-1]);
db486a6e 774 sB1 = new TGeoXtru(2);
775 sB1->SetName("ITS SPD Carbon fiber support Sector Air End B1");
a53658c6 776 sB1->DefinePolygon(m,xpp2,ypp2);
db486a6e 777 sB1->DefineSection(0,ksecDz);
778 sB1->DefineSection(1,ksecDz+ksecLen);
779 sTB0 = new TGeoTube("ITS SPD Cooling Tube End TB0",0.0,
a53658c6 780 0.5*ksecCoolTubeROuter,0.5*ksecLen);
db486a6e 781 sTB1 = new TGeoTube("ITS SPD Cooling Tube End coolant TB0",0.0,
782 sTB0->GetRmax()-ksecCoolTubeThick,0.5*ksecLen);
783 //
543b7370 784 //sM0 = new TGeoTube("ITS SPD Sensitive Virutual Volume M0",0.0,8.0,
785 // sA0->GetZ(1)+sB0->GetZ(1));
a53658c6 786 //
543b7370 787 if(GetDebug(3)){
a53658c6 788 if(medSPDcf) medSPDcf->Dump();
543b7370 789 else printf("medSPDcf=0\n");
a53658c6 790 if(medSPDss) medSPDss->Dump();
543b7370 791 else printf("medSPDss=0\n");
a53658c6 792 if(medSPDair) medSPDair->Dump();
543b7370 793 else printf("medSPDAir=0\n");
a53658c6 794 if(medSPDcoolfl) medSPDcoolfl->Dump();
543b7370 795 else printf("medSPDcoolfl=0\n");
796 //sM0->InspectShape();
db486a6e 797 sA0->InspectShape();
798 sA1->InspectShape();
799 sB0->InspectShape();
800 sB1->InspectShape();
801 } // end if GetDebug
802 //
543b7370 803 TGeoVolume *vA0,*vA1,*vTA0,*vTA1,*vB0,*vB1,*vTB0,*vTB1;
804 TGeoVolumeAssembly *vM0;
805 vM0 = new TGeoVolumeAssembly("ITSSPDSensitiveVirtualvolumeM0");
806 //vM0 = new TGeoVolume("ITSSPDSensitiveVirtualvolumeM0",sM0,medSPDair);
807 //vM0->SetVisibility(kTRUE);
808 //vM0->SetLineColor(7); // light Blue
809 //vM0->SetLineWidth(1);
810 //vM0->SetFillColor(vM0->GetLineColor());
811 //vM0->SetFillStyle(4090); // 90% transparent
db486a6e 812 vA0 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorA0",sA0,medSPDcf);
813 vA0->SetVisibility(kTRUE);
814 vA0->SetLineColor(4); // Blue
815 vA0->SetLineWidth(1);
816 vA0->SetFillColor(vA0->GetLineColor());
817 vA0->SetFillStyle(4010); // 10% transparent
818 vA1 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorAirA1",sA1,medSPDair);
819 vA1->SetVisibility(kTRUE);
820 vA1->SetLineColor(7); // light Blue
821 vA1->SetLineWidth(1);
822 vA1->SetFillColor(vA1->GetLineColor());
823 vA1->SetFillStyle(4090); // 90% transparent
824 vTA0 = new TGeoVolume("ITSSPDCoolingTubeTA0",sTA0,medSPDss);
825 vTA0->SetVisibility(kTRUE);
826 vTA0->SetLineColor(1); // Black
827 vTA0->SetLineWidth(1);
828 vTA0->SetFillColor(vTA0->GetLineColor());
829 vTA0->SetFillStyle(4000); // 0% transparent
830 vTA1 = new TGeoVolume("ITSSPDCoolingTubeFluidTA1",sTA1,medSPDcoolfl);
831 vTA1->SetVisibility(kTRUE);
832 vTA1->SetLineColor(6); // Purple
833 vTA1->SetLineWidth(1);
834 vTA1->SetFillColor(vTA1->GetLineColor());
835 vTA1->SetFillStyle(4000); // 0% transparent
836 vB0 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorEndB0",sB0,medSPDcf);
837 vB0->SetVisibility(kTRUE);
838 vB0->SetLineColor(4); // Blue
839 vB0->SetLineWidth(1);
840 vB0->SetFillColor(vB0->GetLineColor());
841 vB0->SetFillStyle(4010); // 10% transparent
a53658c6 842 vB1 = new TGeoVolume("ITSSPDCarbonFiberSupportSectorEndAirB1",
843 sB1,medSPDair);
db486a6e 844 vB1->SetVisibility(kTRUE);
845 vB1->SetLineColor(7); // light Blue
846 vB1->SetLineWidth(1);
847 vB1->SetFillColor(vB1->GetLineColor());
848 vB1->SetFillStyle(4090); // 90% transparent
849 vTB0 = new TGeoVolume("ITSSPDCoolingTubeEndTB0",sTB0,medSPDss);
850 vTB0->SetVisibility(kTRUE);
851 vTB0->SetLineColor(1); // Black
852 vTB0->SetLineWidth(1);
853 vTB0->SetFillColor(vTB0->GetLineColor());
854 vTB0->SetFillStyle(4000); // 0% transparent
855 vTB1 = new TGeoVolume("ITSSPDCoolingTubeEndFluidTB1",sTB1,medSPDcoolfl);
856 vTB1->SetVisibility(kTRUE);
857 vTB1->SetLineColor(6); // Purple
858 vTB1->SetLineWidth(1);
859 vTB1->SetFillColor(vTB1->GetLineColor());
860 vTB1->SetFillStyle(4000); // 0% transparent
861 //
a53658c6 862 moth->AddNode(vM0,1,0); // Add virtual volume to mother
db486a6e 863 vA0->AddNode(vA1,1,0); // Put air inside carbon fiber.
864 vB0->AddNode(vB1,1,0); // Put air inside carbon fiber.
865 vTA0->AddNode(vTA1,1,0); // Put air inside carbon fiber.
866 vTB0->AddNode(vTB1,1,0); // Put air inside carbon fiber.
867 for(i=0;i<ksecNCoolingTubeDips;i++){
a53658c6 868 x0 = secX3[ksecDipIndex[i]];
869 y0 = secY3[ksecDipIndex[i]];
870 t = 90.0-secAngleTurbo[i];
871 trans = new TGeoTranslation("",x0,y0,0.5*(sB1->GetZ(0)+sB1->GetZ(1)));
db486a6e 872 vB1->AddNode(vTB0,i+1,trans);
a53658c6 873 rot = new TGeoRotation("",0.0,0.0,t);
874 rotrans = new TGeoCombiTrans("",x0,y0,0.0,rot);
875 vM0->AddNode(vTA0,i+1,rotrans);
876 //delete rot; // rot owned by AliITSv11GeometerySPD::CarbonFiberSector
db486a6e 877 } // end for i
a53658c6 878 vM0->AddNode(vA0,1,0);
879 vM0->AddNode(vB0,1,0);
880 // Reflection.
881 vM0->AddNode(vB0,2,new TGeoRotation("",90.,0.,90.,90.,180.,0.));
543b7370 882 if(GetDebug(3)){
a53658c6 883 vM0->PrintNodes();
db486a6e 884 vA0->PrintNodes();
885 vA1->PrintNodes();
886 vB0->PrintNodes();
887 vB1->PrintNodes();
a53658c6 888 vTA0->PrintNodes();
889 vTA1->PrintNodes();
890 vTB0->PrintNodes();
891 vTB1->PrintNodes();
db486a6e 892 } // end if GetDebug
893 //
db486a6e 894}
a53658c6 895//----------------------------------------------------------------------
896void AliITSv11GeometrySPD::SPDsectorShape(Int_t n,const Double_t *xc,
897const Double_t *yc,const Double_t *r,const Double_t *ths,const Double_t *the,
898 Int_t npr,Int_t &m,Double_t **xp,Double_t **yp){
899 // Code to compute the points that make up the shape of the SPD
900 // Carbon fiber support sections
901 // Inputs:
902 // Int_t n Size of arrays xc,yc, and r.
903 // Double_t *xc Array of x values for radii centers.
904 // Double_t *yc Array of y values for radii centers.
905 // Double_t *r Array of signed radii values.
906 // Double_t *ths Array of starting angles [degrees].
907 // Double_t *the Array of ending angles [degrees].
908 // Int_t npr The number of lines segments to aproximate the arc.
909 // Outputs:
910 // Int_t m The number of enetries in the arrays *xp[npr+1]
911 // and *yp[npr+1].
912 // Double_t **xp Array of x coordinate values of the line segments
913 // which make up the SPD support sector shape.
914 // Double_t **yp Array of y coordinate values of the line segments
915 // which make up the SPD support sector shape.
916 // Return:
917 // none.
918 Int_t i,k;
919 Double_t t,t0,t1;
920
921 m = n*(npr+1);
922 if(GetDebug(2)){
923 cout <<" X \t Y \t R \t S \t E"<< m <<endl;
924 for(i=0;i<n;i++){
925 cout <<"{"<< xc[i] <<",";
926 cout << yc[i] <<",";
927 cout << r[i] <<",";
928 cout << ths[i] <<",";
929 cout << the[i] <<"},"<< endl;
930 } // end for i
931 } // end if GetDebug
932 //
933 if(GetDebug(3)) cout <<"Double_t sA0 = ["<< n*(npr+1)+1<<"][";
934 if(GetDebug(4)) cout <<"3]{";
935 else if(GetDebug(3)) cout <<"2]{";
936 t0 = (Double_t)npr;
937 for(i=0;i<n;i++){
938 t1 = (the[i]-ths[i])/t0;
939 if(GetDebug(5)) cout<<"t1="<< t1<<endl;
940 for(k=0;k<=npr;k++){
941 t=ths[i]+((Double_t)k)*t1;
942 xp[i][k] = TMath::Abs(r[i])*CosD(t)+xc[i];
943 yp[i][k] = TMath::Abs(r[i])*SinD(t)+yc[i];
944 if(GetDebug(3)){
945 cout << "{"<<xp[i][k]<<","<<yp[i][k];
946 if(GetDebug(4)) cout <<","<<t;
947 cout <<"},";
948 } // end if GetDebug
949 } // end for k
950 if(GetDebug(3)) cout << endl;
951 } // end of i
952 if(GetDebug(3)) cout<<"{"<<xp[0][0]<<","<<yp[0][0];
953 if(GetDebug(4)) cout<<","<< ths[0];
954 if(GetDebug(3)) cout<<"}}"<<endl;
955 //
956 return;
957}
db486a6e 958//______________________________________________________________________
a53658c6 959void AliITSv11GeometrySPD::HalfStave(TGeoVolume *moth,Double_t &thicknessAA,
960 TGeoManager *mgr){
db486a6e 961 // Define the detail SPD Half Stave geometry.
962 // Inputs:
a53658c6 963 // TGeoVolume *moth The mother volume to place this object.
964 // Int_t &thicknessAA Thickness of stave at section A-A
965 // TGeoManager *mgr TGeoManager default gGeoManager
db486a6e 966 // Outputs:
967 // none.
968 // Return:
969 // none.
970
a53658c6 971 thicknessAA = 1.03*fgkmm; // Default value
bf86817c 972 if(moth==0){
a53658c6 973 Error("HalfStave","moth=%p mgr=%p",moth,mgr);
bf86817c 974 return;
975 } // end if moth==0
db486a6e 976}
977//----------------------------------------------------------------------
978void AliITSv11GeometrySPD::CreateFigure0(const Char_t *filepath,
a53658c6 979 const Char_t *type,
980 TGeoManager *mgr){
db486a6e 981 // Creates Figure 0 for the documentation of this class. In this
982 // specific case, it creates the X,Y cross section of the SPD suport
983 // section, center and ends. The output is written to a standard
984 // file name to the path specificed.
985 // Inputs:
986 // const Char_t *filepath Path where the figure is to be drawn
987 // const Char_t *type The type of file, default is gif.
a53658c6 988 // TGeoManager *mgr The TGeoManager default gGeoManager
db486a6e 989 // Output:
990 // none.
991 // Return:
992 // none.
993 TGeoXtru *sA0,*sA1,*sB0,*sB1;
994 //TPolyMarker *pmA,*pmB;
995 TPolyLine plA0,plA1,plB0,plB1;
996 TCanvas *canvas;
997 TLatex txt;
a53658c6 998 Double_t x=0.0,y=0.0;
999 Int_t i,kNRadii=6;
db486a6e 1000
a53658c6 1001 if(strcmp(filepath,"")){
1002 Error("CreateFigure0","filepath=%s type=%s",filepath,type);
1003 } // end if
1004 //
1005 sA0 = (TGeoXtru*) mgr->GetVolume(
db486a6e 1006 "ITSSPDCarbonFiberSupportSectorA0_1")->GetShape();
a53658c6 1007 sA1 = (TGeoXtru*) mgr->GetVolume(
db486a6e 1008 "ITSSPDCarbonFiberSupportSectorAirA1_1")->GetShape();
a53658c6 1009 sB0 = (TGeoXtru*) mgr->GetVolume(
db486a6e 1010 "ITSSPDCarbonFiberSupportSectorEndB0_1")->GetShape();
a53658c6 1011 sB1 = (TGeoXtru*) mgr->GetVolume(
db486a6e 1012 "ITSSPDCarbonFiberSupportSectorEndAirB1_1")->GetShape();
1013 //pmA = new TPolyMarker();
1014 //pmA.SetMarkerStyle(2); // +
1015 //pmA.SetMarkerColor(7); // light blue
1016 //pmB = new TPolyMarker();
1017 //pmB.SetMarkerStyle(5); // X
1018 //pmB.SetMarkerColor(6); // purple
a53658c6 1019 plA0.SetPolyLine(sA0->GetNvert());
db486a6e 1020 plA0.SetLineColor(1); // black
1021 plA0.SetLineStyle(1);
a53658c6 1022 plA1.SetPolyLine(sA1->GetNvert());
db486a6e 1023 plA1.SetLineColor(2); // red
1024 plA1.SetLineStyle(1);
a53658c6 1025 plB0.SetPolyLine(sB0->GetNvert());
db486a6e 1026 plB0.SetLineColor(3); // Green
1027 plB0.SetLineStyle(2);
1028 plB1.SetPolyLine(sB1->GetNvert());
1029 plB1.SetLineColor(4); // Blue
1030 plB1.SetLineStyle(2);
1031 //for(i=0;i<kNRadii;i++) pmA.SetPoint(i,xyB1p[i][0],xyB1p[i][1]);
1032 //for(i=0;i<kNRadii;i++) pmB.SetPoint(i,xyB1p[i][0],xyB1p[i][1]);
1033 for(i=0;i<sA0->GetNvert();i++) plA0.SetPoint(i,sA0->GetX(i),sA0->GetY(i));
1034 for(i=0;i<sA1->GetNvert();i++) plA1.SetPoint(i,sA1->GetX(i),sA1->GetY(i));
1035 for(i=0;i<sB0->GetNvert();i++) plB0.SetPoint(i,sB0->GetX(i),sB0->GetY(i));
1036 for(i=0;i<sB1->GetNvert();i++) plB1.SetPoint(i,sB1->GetX(i),sB1->GetY(i));
1037 canvas = new TCanvas("AliITSv11GeometrySPDFig0","",1000,1000);
a53658c6 1038 canvas->Range(-3.,-3.,3.,3.);
1039 txt.SetTextSize(0.05);
db486a6e 1040 txt.SetTextAlign(33);
1041 txt.SetTextColor(1);
a53658c6 1042 txt.DrawLatex(2.9,2.9,"Section A-A outer Carbon Fiber surface");
db486a6e 1043 txt.SetTextColor(2);
a53658c6 1044 txt.DrawLatex(2.9,2.5,"Section A-A Inner Carbon Fiber surface");
db486a6e 1045 txt.SetTextColor(3);
a53658c6 1046 txt.DrawLatex(2.9,2.1,"Section E-E outer Carbon Fiber surface");
db486a6e 1047 txt.SetTextColor(4);
a53658c6 1048 txt.DrawLatex(2.9,1.7,"Section E-E Inner Carbon Fiber surface");
db486a6e 1049 plA0.Draw();
1050 plA1.Draw();
1051 plB0.Draw();
1052 plB1.Draw();
1053 //pmA.Draw();
1054 //pmB.Draw();
1055 //
a53658c6 1056 x = 1.0;
1057 y = -2.5;
db486a6e 1058 Char_t chr[3];
1059 for(i=0;i<kNRadii;i++){
1060 sprintf(chr,"%2d",i);txt.DrawLatex(x-0.1,y,chr);
a53658c6 1061 sprintf(chr,"%8.4f",5.000);txt.DrawLatex(x,y,chr);
1062 sprintf(chr,"%8.4f",5.000);txt.DrawLatex(x+0.5,y,chr);
1063 sprintf(chr,"%8.4f",5.000);txt.DrawLatex(x+1.0,y,chr);
1064 sprintf(chr,"%8.4f",5.000);txt.DrawLatex(x+1.5,y,chr);
1065 sprintf(chr,"%8.4f",5.000);txt.DrawLatex(x+2.0,y,chr);
1066 if(kTRUE) txt.DrawLatex(x+2.5,y,"A-A/E-E");
db486a6e 1067 else txt.DrawLatex(x+2.5,y,"E-E");
1068 } // end for i
1069 txt.DrawLatex(x,y,"x_{c} mm");
1070 txt.DrawLatex(x+0.5,y,"y_{c} mm");
1071 txt.DrawLatex(x+1.0,y,"R mm");
1072 txt.DrawLatex(x+1.5,y,"#theta_{start}^{#circle}");
1073 txt.DrawLatex(x+2.0,y,"#theta_{end}^{#circle}");
1074 txt.DrawLatex(x+2.5,y,"Section");
1075 //
1076}