ITS new Geometry files. Not yet ready for uses, committed to allow additional
[u/mrichter/AliRoot.git] / ITS / AliITSBaseGeometry.cxx
CommitLineData
aa9bc63b 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/*
17$Log$
162acd47 18Revision 1.1 2003/02/10 17:03:52 nilsen
19New version and structure of ITS V11 geometry. Work still in progress.
20
aa9bc63b 21
22$Id$
23*/
24
25/*
26 A base geometry class defining all of the ITS volumes that make up an ITS
27geometry.
28Auhors: B. S. Nilsen
29Version 0
30Created February 2003.
31*/
32
33#include <Riostream.h>
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <TMath.h>
38#include <TGeometry.h>
39#include <TNode.h>
40#include <TTUBE.h>
41#include <TTUBS.h>
42#include <TPCON.h>
43#include <TFile.h> // only required for Tracking function?
44#include <TCanvas.h>
45#include <TObjArray.h>
46#include <TLorentzVector.h>
47#include <TObjString.h>
48#include <TClonesArray.h>
49#include <TBRIK.h>
50#include <TSystem.h>
51#include <AliRun.h>
52#include <AliMagF.h>
53#include <AliConst.h>
54#include "AliITSBaseGeometry.h"
55
56ClassImp(AliITSBaseGeometry)
162acd47 57
58Int_t AliITSBaseGeometry::fNCreates = 0;
59Int_t* AliITSBaseGeometry::fidrot = 0;
60Int_t AliITSBaseGeometry::fidrotsize = 0;
61Int_t AliITSBaseGeometry::fidrotlast = 0;
62Int_t AliITSBaseGeometry::fVolNameSize = 0;
63Int_t AliITSBaseGeometry::fVolNameLast = 0;
64TString* AliITSBaseGeometry::fVolName = 0;
65
aa9bc63b 66//______________________________________________________________________
67AliITSBaseGeometry::AliITSBaseGeometry(){
68 // Default construtor for the ITS Base Geometry class.
69 // Inputs:
70 // none.
71 // Outputs:
72 // none.
73 // Return:
74 // none.
75
76 fScale = 1.0; // Default value.
77 fits = 0; // zero pointers.
162acd47 78 if(fNCreates==0){ // only for very first init
79 } // end if
aa9bc63b 80 fNCreates++; // incrament this creation counter.
81}
82//______________________________________________________________________
83AliITSBaseGeometry::AliITSBaseGeometry(AliModule *its,Int_t iflag){
84 // Standard construtor for the ITS Base Geometry class.
85 // Inputs:
86 // Int_t iflag flag to indecate specific swiches in the geometry
87 // Outputs:
88 // none.
89 // Return:
90 // none.
91
92 fScale = 1.0; // Default value.
93 fits = its; // get a copy of the pointer to the ITS.
162acd47 94 if(fNCreates==0){ // only for very first init
95 fidrotsize = ITSG3VnameToIndex("TSV")+1;
96 fidrot = new Int_t[fidrotsize];
97 fidrotlast = 0;
98 } // end if
aa9bc63b 99 fNCreates++; // incrament this creation counter.
100}
101//______________________________________________________________________
102AliITSBaseGeometry::~AliITSBaseGeometry(){
103 // Standeard destructor for the ITS Base Geometry class.
104 // Inputs:
105 // Int_t iflag flag to indecate specific swiches in the geometry
106 // Outputs:
107 // none.
108 // Return:
109 // none.
110
111 fits = 0; // This class does not own this class. It contaitns a pointer
112 // to it for conveniance.
aa9bc63b 113 fNCreates--;
114 if(fNCreates==0){ // Now delete the static members
115 Int_t i;
116 if(fVolName!=0){
117 for(i=0;i<fVolNameLast;i++) delete fVolName[i];
118 fVolNameSize = 0;
119 fVolNameLast = 0;
120 delete[] fVolName;
121 }// end if
122 delete[] fidrot;
123 fidrotsize = fidrotlast = 0;
124 }// end if
125}
126//______________________________________________________________________
127Int_t AliITSBaseGeometry::AddVolName(const TString name){
128 // Checks if the volume name already exist, if not it adds it to
129 // the list of volume names and returns an index to that volume name.
130 // it will create and expand the array of volume names as needed.
131 // If the volume name already exists, it will give an error message and
132 // return an index <0.
133 // Inputs:
134 // const TString name Volume name to be added to the list.
135 // Outputs:
136 // none.
137 // Return:
138 // The index where this volume name is stored.
139 Int_t i;
140
141 if(fVolName==0){ // must create array.
162acd47 142 fVolNameSize = 38624;
aa9bc63b 143 fVolName = new TString[fVolNameSize];
144 fVolNameLast = 0;
145 } // end if
146 for(i=0;i<fVolNameLast;i++) if(fVolName[i].CompareTo(name)==0){ // Error
162acd47 147 Error("AddVolName","Volume name already exists for volume %d name %s",
148 i,name.Data());
aa9bc63b 149 return -1;
150 } // end for i
151 if(fVolNameSize==fVolNameLast-1){ // Array is full must expand.
152 Int_t size = fVolNameSize*2;
153 TString *old = fVolName;
154 fVolName = new TString[fVolNameSize];
155 for(i=0;i<fVolNameLast;i++) fVolName[i] = old[i];
156 delete[] old;
157 fVolNameSize = size;
158 } // end if
162acd47 159 i=ITSIndexToITSG3name(fVolNameLast);
160 if(strcmp((char*)(&i),"ITSV")==0){
aa9bc63b 161 // Special Reserved Geant 3 volumen name. Skip it
162 // fill it with explination for conveniance.
163 fVolName[fVolNameLast] = "ITS Master Mother Volume";
164 fVolNameLast++;
165 } // end if
166 fVolName[fVolNameLast] = name;
167 fVolNameLast++;
168 return fVolNameLast-1; // return the index
169}
170//______________________________________________________________________
162acd47 171Int_t AliITSBaseGeometry::ITSIndexToITSG3name(const Int_t i){
aa9bc63b 172 // Given the ITS volume index i, it returns the Geant3 ITS volume
173 // name. The valid characters must be in the range
174 // '0' through 'Z'. This will include all upper case letter and the
175 // numbers 0-9. In addition it does not will include the following simbols
176 // ":;<=>?@"
177 // Inputs:
178 // const Int_t i the ITS volume index
179 // Output:
180 // none.
181 // Return:
182 // char[4] with the ITS volume name starting from "I000" to "IZZZ"
183 const Int_t rangen=(Int_t)('9'-'0'+1); // range of numbers
184 const Int_t rangel=(Int_t)('Z'-'A'+1); // range of letters
185 const Int_t range = rangen+rangel; // the number of characters between
186 // 0-9 and A-Z.
162acd47 187 Int_t k;
188 Byte_t *a = (Byte_t*) &k;
aa9bc63b 189 Int_t j = i;
190
162acd47 191 k = 0;
192 a[0] = (Byte_t)('I');
193 a[1] = (Byte_t)('0'+j/(range*range));
194 if(a[1]>'9') a[1] += 'A'-'9'-1;//if it is a letter add in gap for simples.
195 j -= range*range*((Int_t)(j/(range*range)));
196 a[2] = (Byte_t)('0'+j/range);
197 if(a[2]>'9') a[2] += 'A'-'9'-1;//if it is a letter add in gap for simples.
198 j -= range*((Int_t)(j/range));
199 a[3] = (Byte_t)('0'+j);
200 if(a[3]>'9') a[3] += 'A'-'9'-1;//if it is a letter add in gap for simples.
201 return k;
aa9bc63b 202}
203//______________________________________________________________________
162acd47 204Int_t AliITSBaseGeometry::ITSG3VnameToIndex(const char *name)const{
aa9bc63b 205 // Given the last three characters of the ITS Geant3 volume name,
206 // this returns the index. The valid characters must be in the range
207 // '0' through 'Z'. This will include all upper case letter and the
208 // numbers 0-9. In addition it will include the following simbles
209 // ":;<=>?@"
210 // Inputs:
211 // const char name[3] The last three characters of the ITS Geant3
212 // volume name
213 // Output:
214 // none.
215 // Return:
216 // Int_t the index.
162acd47 217 const Int_t rangen = (Int_t)('9'-'0'+1); // range of numbers
218 const Int_t rangel = (Int_t)('Z'-'A'+1); // range of letters
219 const Int_t range = rangen+rangel; // the number of characters between
220 // 0-9 + A-Z.
221 Int_t i=0,j,k;
222
223 k = strlen(name)-1;
224 for(j=k;j>k-3;j--) if(isdigit(name[j])) // number
225 i += (Int_t)((name[j]-'0')*TMath::Power((Double_t)range,
226 (Double_t)(k-j)));
227 else
228 i += (Int_t)((name[j]-'A'+rangen)*TMath::Power((Double_t)range,
229 (Double_t)(k-j)));
aa9bc63b 230 return i;
231}
232//______________________________________________________________________
233TString AliITSBaseGeometry::GetVolName(const Int_t i)const{
234 // Returns the volume name at a given index i. Index must be in
235 // range and the array of volume names must exist. If there is an
236 // error, a message is written and 0 is returned.
237 // Inputs:
238 // const Int_t i Index
239 // Output:
240 // none.
241 // Return:
242 // A TString contianing the ITS volume name.
243
244 if(i<0||i>=fVolNameLast){
245 Error("GetVolName","Index=%d out of range but be witin 0<%d",i,
246 fVolName-1);
247 return 0;
248 } // end if Error
249 return fVolName[i];
250}
251//______________________________________________________________________
252Int_t AliITSBaseGeometry::GetVolumeIndex(const TString &a){
253 // Return the index corresponding the the volume name a. If the
254 // Volumen name is not found, return -1, and a warning message given.
255 // Inputs:
256 // const TString &a Name of volume for which index is wanted.
257 // Output:
258 // none.
259 // Return:
260 // Int_t Index corresponding the volume a. If not found -1 is returned.
261 Int_t i;
262
263 for(i=0;i<fVolNameLast;i++) if(fVolName[i].CompareTo(a)==0) return i;
264 Info("GetVolumeIndex","Volume name %s not found",a.Data());
265 return -1;
266}
267//______________________________________________________________________
162acd47 268void AliITSBaseGeometry::Box(const char *gnam,const TString &dis,
aa9bc63b 269 Double_t dx,Double_t dy,Double_t dz,Int_t med){
270 // Interface to TMC->Gsvolu() for ITS bos geometries. Box with faces
271 // perpendicular to the axes. It has 3 paramters. See SetScale() for
272 // units. Default units are geant 3 [cm].
273 // Inputs:
162acd47 274 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 275 // is appended to the front to indecate that this
276 // is an ITS volume.
277 // TString &dis String containging part discription.
278 // Double_t dx half-length of box in x-axis
279 // Double_t dy half-length of box in y-axis
280 // Double_t dz half-length of box in z-axis
281 // Int_t med media index number.
282 // Output:
283 // none.
284 // Return.
285 // none.
162acd47 286 char name[5];
aa9bc63b 287 Float_t param[3];
288
aa9bc63b 289 param[0] = fScale*dx;
290 param[1] = fScale*dy;
291 param[2] = fScale*dz;
162acd47 292 G3name(gnam,name);
293 gMC->Gsvolu(name,"BOX ",GetMed(med),param,3);
aa9bc63b 294}
295//______________________________________________________________________
162acd47 296void AliITSBaseGeometry::Trapezoid1(const char *gnam,const TString &dis,
aa9bc63b 297 Double_t dxn,Double_t dxp,Double_t dy,
298 Double_t dz,Int_t med){
299 // Interface to TMC->Gsvolu() for ITS TRD1 geometries. Trapezoid with the
300 // x dimension varing along z. It has 4 parameters. See SetScale() for
301 // units. Default units are geant 3 [cm].
302 // Inputs:
162acd47 303 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 304 // is appended to the front to indecate that this
305 // is an ITS volume.
306 // TString &dis String containging part discription.
307 // Double_t dxn half-length along x at the z surface positioned
308 // at -DZ
309 // Double_t dxp half-length along x at the z surface positioned
310 // at +DZ
311 // Double_t dy half-length along the y-axis
312 // Double_t dz half-length along the z-axis
313 // Int_t med media index number.
314 // Output:
315 // none.
316 // Return.
317 // none.
162acd47 318 char name[5];
aa9bc63b 319 Float_t param[4];
320
aa9bc63b 321 param[0] = fScale*dxn;
322 param[1] = fScale*dxp;
323 param[2] = fScale*dy;
324 param[3] = fScale*dz;
162acd47 325 G3name(gnam,name);
326 gMC->Gsvolu(name,"TRD1",GetMed(med),param,4);
aa9bc63b 327}
328//______________________________________________________________________
162acd47 329void AliITSBaseGeometry::Trapezoid2(const char *gnam,const TString &dis,
aa9bc63b 330 Double_t dxn,Double_t dxp,Double_t dyn,
331 Double_t dyp,Double_t dz,Int_t med){
332 // Interface to TMC->Gsvolu() for ITS TRD2 geometries. Trapezoid with the
333 // x and y dimension varing along z. It has 5 parameters. See SetScale()
334 // for units. Default units are geant 3 [cm].
335 // Inputs:
162acd47 336 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 337 // is appended to the front to indecate that this
338 // is an ITS volume.
339 // TString &dis String containging part discription.
340 // Double_t dxn half-length along x at the z surface positioned
341 // at -DZ
342 // Double_t dxp half-length along x at the z surface positioned
343 // at +DZ
344 // Double_t dyn half-length along x at the z surface positioned
345 // at -DZ
346 // Double_t dyp half-length along x at the z surface positioned
347 // at +DZ
348 // Double_t dz half-length along the z-axis
349 // Int_t med media index number.
350 // Output:
351 // none.
352 // Return.
353 // none.
162acd47 354 char name[5];
aa9bc63b 355 Float_t param[5];
356
aa9bc63b 357 param[0] = fScale*dxn;
358 param[1] = fScale*dxp;
359 param[2] = fScale*dyn;
360 param[3] = fScale*dyp;
361 param[4] = fScale*dz;
162acd47 362 G3name(gnam,name);
363 gMC->Gsvolu(name,"TRD2",GetMed(med),param,5);
aa9bc63b 364}
365//______________________________________________________________________
162acd47 366void AliITSBaseGeometry::Trapezoid(const char *gnam,const TString &dis,
aa9bc63b 367 Double_t dz,Double_t thet,Double_t phi,
368 Double_t h1,Double_t bl1,Double_t tl1,
369 Double_t alp1,Double_t h2,Double_t bl2,
370 Double_t tl2,Double_t alp2,Int_t med){
371 // Interface to TMC->Gsvolu() for ITS TRAP geometries. General Trapezoid,
372 // The faces perpendicular to z are trapezia and their centers are not
373 // necessarily on a line parallel to the z axis. This shape has 11
162acd47 374 // parameters, but only cosidering that the faces should be planar, only
375 // 9 are really independent. A check is performed on the user parameters
376 // and a message is printed in case of non-planar faces. Ignoring this
377 // warning may cause unpredictable effects at tracking time. See
378 // SetScale() for units. Default units are geant 3 [cm].
aa9bc63b 379 // Inputs:
162acd47 380 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 381 // is appended to the front to indecate that this
382 // is an ITS volume.
383 // TString &dis String containging part discription.
384 // Double_t dz Half-length along the z-asix
385 // Double_t thet Polar angle of the line joing the center of the
386 // face at -dz to the center of the one at dz
387 // [degree].
388 // Double_t phi aximuthal angle of the line joing the center of
389 // the face at -dz to the center of the one at +dz
390 // [degree].
391 // Double_t h1 half-length along y of the face at -dz.
392 // Double_t bl1 half-length along x of the side at -h1 in y of
393 // the face at -dz in z.
394 // Double_t tl1 half-length along x of teh side at +h1 in y of
395 // the face at -dz in z.
162acd47 396 // Double_t alp1 angle with respect to the y axis from the
397 // center of the side at -h1 in y to the cetner
398 // of the side at +h1 in y of the face at -dz in z
aa9bc63b 399 // [degree].
400 // Double_t h2 half-length along y of the face at +dz
401 // Double_t bl2 half-length along x of the side at -h2 in y of
402 // the face at +dz in z.
403 // Double_t tl2 half-length along x of the side at _h2 in y of
404 // the face at +dz in z.
162acd47 405 // Double_t alp2 angle with respect to the y axis from the
406 // center of the side at -h2 in y to the center
407 // of the side at +h2 in y of the face at +dz in z
aa9bc63b 408 // [degree].
409 // Int_t med media index number.
410 // Output:
411 // none.
412 // Return.
413 // none.
162acd47 414 char name[5];
aa9bc63b 415 Float_t param[11];
416
aa9bc63b 417 param[0] = fScale*dz;
418 param[1] = thet;
419 param[2] = phi;
420 param[3] = fScale*h1;
421 param[4] = fScale*bl1;
422 param[5] = fScale*tl1;
423 param[6] = alp1;
424 param[7] = fScale*h2;
425 param[8] = fScale*bl2;
426 param[9] = fScale*tl2;
427 param[10] = alp2;
162acd47 428 G3name(gnam,name);
429 gMC->Gsvolu(name,"TRAP",GetMed(med),param,11);
aa9bc63b 430}
431//______________________________________________________________________
162acd47 432void AliITSBaseGeometry::Tube(const char *gnam,const TString &dis,
aa9bc63b 433 Double_t rmin,Double_t rmax,Double_t dz,
434 Int_t med){
435 // Interface to TMC->Gsvolu() for ITS TUBE geometries. Simple Tube. It has
436 // 3 parameters. See SetScale()
437 // for units. Default units are geant 3 [cm].
438 // Inputs:
162acd47 439 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 440 // is appended to the front to indecate that this
441 // is an ITS volume.
442 // TString &dis String containging part discription.
443 // Double_t rmin Inside Radius.
444 // Double_t rmax Outside Radius.
445 // Double_t dz half-length along the z-axis
446 // Int_t med media index number.
447 // Output:
448 // none.
449 // Return.
450 // none.
162acd47 451 char name[5];
aa9bc63b 452 Float_t param[3];
453
aa9bc63b 454 param[0] = fScale*rmin;
455 param[1] = fScale*rmax;
456 param[2] = fScale*dz;
162acd47 457 G3name(gnam,name);
458 gMC->Gsvolu(name,"TUBE",GetMed(med),param,3);
459}
460//______________________________________________________________________
461void AliITSBaseGeometry::Tube(AliITSTubeData &d,Int_t med){
462 // Interface to TMC->Gsvolu() for ITS TUBE geometries. Simple Tube. It has
463 // 3 parameters. See SetScale()
464 // for units. Default units are geant 3 [cm].
465 // Inputs:
466 // AliITSTubeData Structure with the tube parameters
467 // Int_t med media index number.
468 // Output:
469 // none.
470 // Return.
471 // none.
472 char name[5];
473 Float_t param[3];
474 Int_t i,k;
475 char *j = (char *) &k;
476
477 param[0] = fScale*d.Rmin();
478 param[1] = fScale*d.Rmax();
479 param[2] = fScale*d.DzAt();
480 d.SetVid(AddVolName((d.GetName())->Data()));
481 k = ITSIndexToITSG3name(d.GetVid());
482 for(i=0;i<4;i++) name[i] = j[i];
483 name[4] = '\0';
484 gMC->Gsvolu(name,"TUBE",GetMed(med),param,3);
aa9bc63b 485}
486//______________________________________________________________________
162acd47 487void AliITSBaseGeometry::TubeSegment(const char *gnam,const TString &dis,
aa9bc63b 488 Double_t rmin,Double_t rmax,Double_t dz,
489 Double_t phi1,Double_t phi2,Int_t med){
490 // Interface to TMC->Gsvolu() for ITS TUBE geometries. Phi segment of a
162acd47 491 // tube. It has 5 parameters. Phi1 should be smaller than phi2. If this
492 // is not the case, the system adds 360 degrees to phi2. See SetScale()
aa9bc63b 493 // for units. Default units are geant 3 [cm].
494 // Inputs:
162acd47 495 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 496 // is appended to the front to indecate that this
497 // is an ITS volume.
498 // TString &dis String containging part discription.
499 // Double_t rmin Inside Radius.
500 // Double_t rmax Outside Radius.
501 // Double_t dz half-length along the z-axis
502 // Double_t phi1 Starting angle of the segment [degree].
503 // Double_t phi2 Ending angle of the segment [degree].
504 // Int_t med media index number.
505 // Output:
506 // none.
507 // Return.
508 // none.
162acd47 509 char name[5];
aa9bc63b 510 Float_t param[5];
511
aa9bc63b 512 param[0] = fScale*rmin;
513 param[1] = fScale*rmax;
514 param[2] = fScale*dz;
515 param[3] = phi1;
516 param[4] = phi2;
162acd47 517 G3name(gnam,name);
518 gMC->Gsvolu(name,"TUBS",GetMed(med),param,5);
aa9bc63b 519}
520//______________________________________________________________________
162acd47 521void AliITSBaseGeometry::Cone(const char *gnam,const TString &dis,
aa9bc63b 522 Double_t dz,Double_t rmin1,Double_t rmax1,
523 Double_t rmin2,Double_t rmax2,Int_t med){
524 // Interface to TMC->Gsvolu() for ITS Cone geometries. Conical tube. It
525 // has 5 parameters. See SetScale()
526 // for units. Default units are geant 3 [cm].
527 // Inputs:
162acd47 528 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 529 // is appended to the front to indecate that this
530 // is an ITS volume.
531 // TString &dis String containging part discription.
532 // Double_t dz half-length along the z-axis
533 // Double_t rmin1 Inside Radius at -dz.
534 // Double_t rmax1 Outside Radius at -dz.
535 // Double_t rmin2 inside radius at +dz.
536 // Double_t rmax2 outside radius at +dz.
537 // Int_t med media index number.
538 // Output:
539 // none.
540 // Return.
541 // none.
162acd47 542 char name[5];
aa9bc63b 543 Float_t param[5];
544
aa9bc63b 545 param[0] = fScale*dz;
546 param[1] = fScale*rmin1;
547 param[2] = fScale*rmax1;
548 param[3] = fScale*rmin2;
549 param[4] = fScale*rmax2;
162acd47 550 G3name(gnam,name);
551 gMC->Gsvolu(name,"CONS",GetMed(med),param,5);
aa9bc63b 552}
553//______________________________________________________________________
162acd47 554void AliITSBaseGeometry::ConeSegment(const char *gnam,const TString &dis,
555 Double_t dz,Double_t rmin1,
556 Double_t rmax1,Double_t rmin2,
557 Double_t rmax2,Double_t phi1,
558 Double_t phi2,Int_t med){
aa9bc63b 559 // Interface to TMC->Gsvolu() for ITS ConS geometries. One segment of a
162acd47 560 // conical tube. It has 7 parameters. Phi1 should be smaller than phi2.
561 // If this is not the case, the system adds 360 degrees to phi2. See
aa9bc63b 562 // SetScale() for units. Default units are geant 3 [cm].
563 // Inputs:
162acd47 564 // const char *gnam 3 character geant volume name. The letter "I"
565 // is appended to the front to indecate that
566 // this is an ITS volume.
aa9bc63b 567 // TString &dis String containging part discription.
568 // Double_t dz half-length along the z-axis
569 // Double_t rmin1 Inside Radius at -dz.
570 // Double_t rmax1 Outside Radius at -dz.
571 // Double_t rmin2 inside radius at +dz.
572 // Double_t rmax2 outside radius at +dz.
573 // Double_t phi1 Starting angle of the segment [degree].
574 // Double_t phi2 Ending angle of the segment [degree].
575 // Int_t med media index number.
576 // Output:
577 // none.
578 // Return.
579 // none.
162acd47 580 char name[5];
aa9bc63b 581 Float_t param[7];
582
aa9bc63b 583 param[0] = fScale*dz;
584 param[1] = fScale*rmin1;
585 param[2] = fScale*rmax1;
586 param[3] = fScale*rmin2;
587 param[4] = fScale*rmax2;
588 param[5] = phi1;
589 param[6] = phi2;
162acd47 590 G3name(gnam,name);
591 gMC->Gsvolu(name,"CONS",GetMed(med),param,7);
aa9bc63b 592}
593//______________________________________________________________________
162acd47 594void AliITSBaseGeometry::Sphere(const char *gnam,const TString &dis,
aa9bc63b 595 Double_t rmin,Double_t rmax,Double_t the1,
596 Double_t the2,Double_t phi1,Double_t phi2,
597 Int_t med){
598 // Interface to TMC->Gsvolu() for ITS SPHE geometries. Segment of a
599 // sphereical shell. It has 6 parameters. See SetScale()
600 // for units. Default units are geant 3 [cm].
601 // Inputs:
162acd47 602 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 603 // is appended to the front to indecate that this
604 // is an ITS volume.
605 // TString &dis String containging part discription.
606 // Double_t rmin Inside Radius.
607 // Double_t rmax Outside Radius.
608 // Double_t the1 staring polar angle of the shell [degree].
609 // Double_t the2 ending polar angle of the shell [degree].
610 // Double_t phui staring asimuthal angle of the shell [degree].
611 // Double_t phi2 ending asimuthal angle of the shell [degree].
612 // Int_t med media index number.
613 // Output:
614 // none.
615 // Return.
616 // none.
162acd47 617 char name[5];
aa9bc63b 618 Float_t param[6];
619
aa9bc63b 620 param[0] = fScale*rmin;
621 param[1] = fScale*rmax;
622 param[2] = the1;
623 param[3] = the2;
624 param[4] = phi1;
625 param[5] = phi2;
162acd47 626 G3name(gnam,name);
627 gMC->Gsvolu(name,"SPHE",GetMed(med),param,6);
aa9bc63b 628}
629//______________________________________________________________________
162acd47 630void AliITSBaseGeometry::Parallelepiped(const char *gnam,const TString &dis,
aa9bc63b 631 Double_t dx,Double_t dy,Double_t dz,
632 Double_t alpha,Double_t thet,
633 Double_t phi,Int_t med){
634 // Interface to TMC->Gsvolu() for ITS PARA geometries. Parallelepiped. It
635 // has 6 parameters. See SetScale() for units. Default units are geant 3
636 // [cm].
637 // Inputs:
162acd47 638 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 639 // is appended to the front to indecate that this
640 // is an ITS volume.
641 // TString &dis String containging part discription.
642 // Double_t dx half-length allong x-axis
643 // Double_t dy half-length allong y-axis
644 // Double_t dz half-length allong z-axis
645 // Double_t alpha angle formed by the y axis and by the plane
646 // joining the center of teh faces parallel to the
647 // z-x plane at -dY and +dy [degree].
648 // Double_t thet polar angle of the line joining the centers of
649 // the faces at -dz and +dz in z [degree].
162acd47 650 // Double_t phi azimuthal angle of teh line joing the centers
651 // of the faaces at -dz and +dz in z [degree].
aa9bc63b 652 // Int_t med media index number.
653 // Output:
654 // none.
655 // Return.
656 // none.
162acd47 657 char name[5];
aa9bc63b 658 Float_t param[6];
659
aa9bc63b 660 param[0] = fScale*dx;
661 param[1] = fScale*dy;
662 param[2] = fScale*dz;
663 param[3] = alpha;
664 param[4] = thet;
665 param[5] = phi;
162acd47 666 G3name(gnam,name);
667 gMC->Gsvolu(name,"PARA",GetMed(med),param,6);
aa9bc63b 668}
669//______________________________________________________________________
162acd47 670void AliITSBaseGeometry::PolyGon(const char *gnam,const TString &dis,
aa9bc63b 671 Double_t phi1,Double_t dphi,Int_t npdv,
672 Int_t nz,Double_t *z,Double_t *rmin,
673 Double_t *rmax,Int_t med){
674 // Interface to TMC->Gsvolu() for ITS PGON geometry. Polygon It has 10
162acd47 675 // parameters or more. See SetScale() for units. Default units are geant
676 // 3 [cm].
aa9bc63b 677 // Inputs:
162acd47 678 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 679 // is appended to the front to indecate that this
680 // is an ITS volume.
681 // TString &dis String containging part discription.
682 // Double_t phi1 the azimuthal angle at which the volume begins
683 // (angles are counted clouterclockwise) [degrees].
684 // Double_t dphi opening angle of the volume, which extends from
685 // phi1 to phi1+dphi [degree].
162acd47 686 // Int_t npdv the number of sides of teh cross section
687 // between the given phi limits.
aa9bc63b 688 // Int_t nz number of planes perpendicular to the z axis
689 // where the dimension of the section is given -
690 // this number should be at least 2 and NP triples
691 // of number must follow.
692 // Double_t *z array [nz] of z coordiates of the sections..
693 // Double_t *rmin array [nz] of radius of teh circle tangent to
694 // the sides of the inner polygon in teh
695 // cross-section.
696 // Double_t *rmax array [nz] of radius of the circle tangent to
697 // the sides of the outer polygon in the
698 // cross-section.
699 // Int_t med media index number.
700 // Output:
701 // none.
702 // Return.
703 // none.
162acd47 704 char name[5];
aa9bc63b 705 Float_t *param;
706 Int_t n,i;
707
aa9bc63b 708 n = 4+3*nz;
709 param = new Float_t[n];
710 param[0] = phi1;
711 param[1] = dphi;
712 param[2] = (Float_t)npdv;
713 param[3] = (Float_t)nz;
714 for(i=0;i<nz;i++){
162acd47 715 param[4+3*i] = fScale*z[i];
716 param[5+3*i] = fScale*rmin[i];
717 param[6+3*i] = fScale*rmax[i];
718 } // end for i
719 G3name(gnam,name);
720 gMC->Gsvolu(name,"PGON",GetMed(med),param,n);
721
722 delete[] param;
723}
724//______________________________________________________________________
725void AliITSBaseGeometry::PolyGon(AliITSPGonData &d,Int_t med){
726 // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9
727 // parameters or more. See SetScale() for units. Default units are geant
728 // 3 [cm].
729 // Inputs:
730 // AliITSPGonData &d Object with poly cone data stored in it.
731 // Int_t med media index number.
732 // Output:
733 // none.
734 // Return.
735 // none.
736 char name[5];
737 Float_t *param;
738 Int_t n,i,k;
739 char *j = (char *) &k;
740
741 n = 4+3*d.Nz();
742 param = new Float_t[n];
743 param[0] = d.Phi0();
744 param[1] = d.DPhi();
745 param[2] = (Float_t) d.NPhi();
746 param[3] = (Float_t) d.Nz();
747 for(i=0;i<d.Nz();i++){
748 param[4+3*i] = fScale*d.ZAt(i);
749 param[5+3*i] = fScale*d.Rmin(i);
750 param[6+3*i] = fScale*d.Rmax(i);
aa9bc63b 751 } // end for i
162acd47 752 d.SetVid(AddVolName((d.GetName())->Data()));
753 k = ITSIndexToITSG3name(d.GetVid());
754 for(i=0;i<4;i++) name[i] = j[i];
755 name[4] = '\0';
756 gMC->Gsvolu(name,"PGON",GetMed(med),param,n);
aa9bc63b 757
758 delete[] param;
759}
760//______________________________________________________________________
162acd47 761void AliITSBaseGeometry::PolyCone(const char *gnam,const TString &dis,
aa9bc63b 762 Double_t phi1,Double_t dphi,Int_t nz,
763 Double_t *z,Double_t *rmin,Double_t *rmax,
764 Int_t med){
765 // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9
162acd47 766 // parameters or more. See SetScale() for units. Default units are geant
767 // 3 [cm].
aa9bc63b 768 // Inputs:
162acd47 769 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 770 // is appended to the front to indecate that this
771 // is an ITS volume.
772 // TString &dis String containging part discription.
773 // Double_t phi1 the azimuthal angle at which the volume begins
774 // (angles are counted clouterclockwise) [degrees].
775 // Double_t dphi opening angle of the volume, which extends from
776 // phi1 to phi1+dphi [degree].
777 // Int_t nz number of planes perpendicular to the z axis
778 // where the dimension of the section is given -
779 // this number should be at least 2 and NP triples
780 // of number must follow.
781 // Double_t *z Array [nz] of z coordinate of the section.
782 // Double_t *rmin Array [nz] of radius of teh inner circle in the
783 // cross-section.
784 // Double_t *rmax Array [nz] of radius of the outer circle in the
785 // cross-section.
786 // Int_t med media index number.
787 // Output:
788 // none.
789 // Return.
790 // none.
162acd47 791 char name[5];
aa9bc63b 792 Float_t *param;
793 Int_t n,i;
794
aa9bc63b 795 n = 3+3*nz;
796 param = new Float_t[n];
797 param[0] = phi1;
798 param[1] = dphi;
799 param[2] = (Float_t) nz;
800 for(i=0;i<nz;i++){
162acd47 801 param[3+3*i] = fScale*z[i];
802 param[4+3*i] = fScale*rmin[i];
803 param[5+3*i] = fScale*rmax[i];
aa9bc63b 804 } // end for i
162acd47 805 G3name(gnam,name);
806 gMC->Gsvolu(name,"PCON",GetMed(med),param,n);
aa9bc63b 807
808 delete[] param;
809}
810//______________________________________________________________________
162acd47 811void AliITSBaseGeometry::PolyCone(AliITSPConeData &d,Int_t med){
812 // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9
813 // parameters or more. See SetScale() for units. Default units are geant
814 // 3 [cm].
815 // Inputs:
816 // AliITSPConeData &d Object with poly cone data stored in it.
817 // Int_t med media index number.
818 // Output:
819 // none.
820 // Return.
821 // none.
822 char name[5];
823 Float_t *param;
824 Int_t n,i,k;
825 char *j = (char *) &k;
826
827 n = 3+3*d.Nz();
828 param = new Float_t[n];
829 param[0] = d.Phi0();
830 param[1] = d.DPhi();
831 param[2] = (Float_t) d.Nz();
832 for(i=0;i<d.Nz();i++){
833 param[3+3*i] = fScale*d.ZAt(i);
834 param[4+3*i] = fScale*d.Rmin(i);
835 param[5+3*i] = fScale*d.Rmax(i);
836 } // end for if
837 d.SetVid(AddVolName((d.GetName())->Data()));
838 k = ITSIndexToITSG3name(d.GetVid());
839 for(i=0;i<4;i++) name[i] = j[i];
840 name[4] = '\0';
841 gMC->Gsvolu(name,"PCON",GetMed(med),param,n);
842
843 delete[] param;
844}
845//______________________________________________________________________
846void AliITSBaseGeometry::TubeElliptical(const char *gnam,const TString &dis,
aa9bc63b 847 Double_t p1,Double_t p2,Double_t dz,Int_t med){
848 // Interface to TMC->Gsvolu() for ITS ELTU geometries. Elliptical
849 // cross-section Tube. It has 3 parameters. See SetScale()
850 // for units. Default units are geant 3 [cm]. The equation of the surface
851 // is x^2 * p1^-2 + y^2 * p2^-2 = 1.
852 // Inputs:
162acd47 853 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 854 // is appended to the front to indecate that this
855 // is an ITS volume.
856 // TString &dis String containging part discription.
857 // Double_t p1 semi-axis of the elipse along x.
858 // Double_t p2 semi-axis of the elipse along y.
859 // Double_t dz half-length along the z-axis
860 // Int_t med media index number.
861 // Output:
862 // none.
863 // Return.
864 // none.
162acd47 865 char name[5];
aa9bc63b 866 Float_t param[3];
867
aa9bc63b 868 param[0] = fScale*p1;
869 param[1] = fScale*p2;
870 param[2] = fScale*dz;
162acd47 871 G3name(gnam,name);
872 gMC->Gsvolu(name,"ELTU",GetMed(med),param,3);
aa9bc63b 873}
874//______________________________________________________________________
162acd47 875void AliITSBaseGeometry::HyperbolicTube(const char *gnam,const TString &dis,
aa9bc63b 876 Double_t rmin,Double_t rmax,Double_t dz,
877 Double_t thet,Int_t med){
878 // Interface to TMC->Gsvolu() for ITS HYPE geometries. Hyperbolic tube.
162acd47 879 // Fore example the inner and outer surfaces are hyperboloids, as would
880 // be foumed by a system of cylinderical wires which were then rotated
aa9bc63b 881 // tangentially about their centers. It has 4 parameters. See SetScale()
882 // for units. Default units are geant 3 [cm]. The hyperbolic surfaces are
883 // given by r^2 = (ztan(thet)^2 + r(z=0)^2.
884 // Inputs:
162acd47 885 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 886 // is appended to the front to indecate that this
887 // is an ITS volume.
888 // TString &dis String containging part discription.
889 // Double_t rmin Inner radius at z=0 where tube is narrowest.
890 // Double_t rmax Outer radius at z=0 where tube is narrowest.
891 // Double_t dz half-length along the z-axis
892 // Double_t thet stero angel of rotation of the two faces
893 // [degrees].
894 // Int_t med media index number.
895 // Output:
896 // none.
897 // Return.
898 // none.
162acd47 899 char name[5];
aa9bc63b 900 Float_t param[4];
901
aa9bc63b 902 param[0] = fScale*rmin;
903 param[1] = fScale*rmax;
904 param[2] = fScale*dz;
905 param[3] = thet;
162acd47 906 G3name(gnam,name);
907 gMC->Gsvolu(name,"HYPE",GetMed(med),param,4);
aa9bc63b 908}
909//______________________________________________________________________
162acd47 910void AliITSBaseGeometry::TwistedTrapezoid(const char *gnam,
aa9bc63b 911 const TString &dis,
912 Double_t dz,Double_t thet,Double_t phi,
913 Double_t twist,Double_t h1,Double_t bl1,
914 Double_t tl1,Double_t apl1,Double_t h2,
915 Double_t bl2,Double_t tl2,Double_t apl2,
916 Int_t med){
917 // Interface to TMC->Gsvolu() for ITS GTRA geometries. General twisted
918 // trapazoid. The faces perpendicular to z are trapazia and their centers
919 // are not necessarily on a line parallel to the z axis as the TRAP.
920 // Additionally, the faces may be twisted so that none of their edges are
162acd47 921 // parallel. It is a TRAP shape, exept that it is twisted in the x-y
922 // plane as a function of z. The parallel sides perpendicular to the x
923 // axis are rotated with respect to the x axis by an angle TWIST, which
924 // is one of the parameters. The shape is defined by the eight corners
925 // and is assumed to be constructed of straight lines joingin points on
926 // the boundry of the trapezoidal face at Z=-dz to the coresponding
927 // points on the face at z=+dz. Divisions are not allowed. It has 12
928 // parameters. See SetScale() for units. Default units are geant 3 [cm].
929 // Note: This shape suffers from the same limitations than the TRAP. The
930 // tracking routines assume that the faces are planar, but htis
931 // constraint is not easily expressed in terms of the 12 parameters.
932 // Additionally, no check on th efaces is performed in this case. Users
933 // should avoid to use this shape as much as possible, and if they have
934 // to do so, they should make sure that the faces are really planes.
935 // If this is not the case, the result of the trasport is unpredictable.
936 // To accelerat ethe computations necessary for trasport, 18 additioanl
937 // parameters are calculated for this shape are 1 DXODZ dx/dz of the
938 // line joing the centers of the faces at z=+_dz. 2 DYODZ dy/dz of the
939 // line joing the centers of the faces at z=+_dz.
aa9bc63b 940 // 3 XO1 x at z=0 for line joing the + on parallel side, perpendicular
941 // corners at z=+_dz.
942 // 4 YO1 y at z=0 for line joing the + on parallel side, + on
943 // perpendicular corners at z=+-dz.
944 // 5 DXDZ1 dx/dz for line joing the + on parallel side, + on
945 // perpendicular corners at z=+-dz.
946 // 6 DYDZ1 dy/dz for line joing the + on parallel side, + on
947 // perpendicular corners at z=+-dz.
948 // 7 X02 x at z=0 for line joing the - on parallel side, + on
949 // perpendicular corners at z=+-dz.
950 // 8 YO2 y at z=0 for line joing the - on parallel side, + on
951 // perpendicular corners at z=+-dz.
952 // 9 DXDZ2 dx/dz for line joing the - on parallel side, + on
953 // perpendicular corners at z=+-dz.
954 // 10 DYDZ2dy/dz for line joing the - on parallel side, + on
955 // perpendicular corners at z=+-dz.
956 // 11 XO3 x at z=0 for line joing the - on parallel side, - on
957 // perpendicular corners at z=+-dz.
958 // 12 YO3 y at z=0 for line joing the - on parallel side, - on
959 // perpendicular corners at z=+-dz.
960 // 13 DXDZ3 dx/dzfor line joing the - on parallel side, - on
961 // perpendicular corners at z=+-dz.
962 // 14 DYDZ3 dydz for line joing the - on parallel side, - on
963 // perpendicular corners at z=+-dz.
964 // 15 XO4 x at z=0 for line joing the + on parallel side, - on
965 // perpendicular corners at z=+-dz.
966 // 16 YO4 y at z=0 for line joing the + on parallel side, - on
967 // perpendicular corners at z=+-dz.
968 // 17 DXDZ4 dx/dz for line joing the + on parallel side, - on
969 // perpendicular corners at z=+-dz.
970 // 18 DYDZ4 dydz for line joing the + on parallel side, - on
971 // perpendicular corners at z=+-dz.
972 // Inputs:
162acd47 973 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 974 // is appended to the front to indecate that this
975 // is an ITS volume.
976 // TString &dis String containging part discription.
977 // Double_t dz half-length along the z axis.
978 // Double_t thet polar angle of the line joing the center of the
979 // face at -dz to the center of the one at +dz
980 // [degrees].
981 // Double_t phi Azymuthal angle of teh line joing the centre of
982 // the face at -dz to the center of the one at +dz
983 // [degrees].
984 // Double_t twist Twist angle of the faces parallel to the x-y
985 // plane at z=+-dz around an axis parallel to z
986 // passing through their centre [degrees].
987 // Double_t h1 Half-length along y of the face at -dz.
988 // Double_t bl1 half-length along x of the side -h1 in y of the
989 // face at -dz in z.
990 // Double_t tl1 half-length along x of the side at +h1 in y of
991 // the face at -dz in z.
992 // Double_t apl1 Angle with respect to the y ais from the center
993 // of the side at -h1 in y to the centere of the
994 // side at +h1 in y of the face at -dz in z
995 // [degrees].
996 // Double_t h2 half-length along the face at +dz.
997 // Double_t bl2 half-length along x of the side at -h2 in y of
998 // the face at -dz in z.
999 // Double_t tl2 half-length along x of the side at +h2 in y of
1000 // the face at +dz in z.
162acd47 1001 // Double_t apl2 angle with respect to the y axis from the
1002 // center of the side at -h2 in y to the center
1003 // of the side at +h2 in y of the face at +dz in
1004 // z [degrees].
aa9bc63b 1005 // Int_t med media index number.
1006 // Output:
1007 // none.
1008 // Return.
1009 // none.
162acd47 1010 char name[5];
aa9bc63b 1011 Float_t param[12];
1012
aa9bc63b 1013 param[0] = fScale*dz;
1014 param[1] = thet;
1015 param[2] = phi;
1016 param[3] = twist;
1017 param[4] = fScale*h1;
1018 param[5] = fScale*bl1;
1019 param[6] = fScale*tl1;
1020 param[7] = apl1;
1021 param[8] = fScale*h2;
1022 param[9] = fScale*bl2;
1023 param[10] = fScale*tl2;
1024 param[11] = apl2;
162acd47 1025 G3name(gnam,name);
1026 gMC->Gsvolu(name,"GTRA",GetMed(med),param,12);
aa9bc63b 1027}
1028//______________________________________________________________________
162acd47 1029void AliITSBaseGeometry::CutTube(const char *gnam,const TString &dis,
aa9bc63b 1030 Double_t rmin,Double_t rmax,Double_t dz,
1031 Double_t phi1,Double_t phi2,Double_t lx,
1032 Double_t ly,Double_t lz,Double_t hx,
1033 Double_t hy,Double_t hz,Int_t med){
162acd47 1034 // Interface to TMC->Gsvolu() for ITS CTUB geometries. Cut tube. A tube
1035 // cut at the extremities with planes not necessarily perpendicular to
1036 // the z axis. It has 11 parameters. See SetScale() for units. Default
1037 // units are geant 3 [cm]. phi1 should be smaller than phi2. If this is
1038 // not the case, the system adds 360 degrees to phi2.
aa9bc63b 1039 // Inputs:
162acd47 1040 // const char *gnam 3 character geant volume name. The letter "I"
aa9bc63b 1041 // is appended to the front to indecate that this
1042 // is an ITS volume.
1043 // TString &dis String containging part discription.
1044 // Double_t rmin Inner radius at z=0 where tube is narrowest.
1045 // Double_t rmax Outer radius at z=0 where tube is narrowest.
1046 // Double_t dz half-length along the z-axis
1047 // Double_t dz half-length along the z-axis
1048 // Double_t phi1 Starting angle of the segment [degree].
1049 // Double_t phi2 Ending angle of the segment [degree].
1050 // Double_t lx x component of a unit vector perpendicular to
1051 // the face at -dz.
1052 // Double_t ly y component of a unit vector perpendicular to
1053 // the face at -dz.
1054 // Double_t lz z component of a unit vector perpendicular to
1055 // the face at -dz.
1056 // Double_t hx x component of a unit vector perpendicular to
1057 // the face at +dz.
1058 // Double_t hy y component of a unit vector perpendicular to
1059 // the face at +dz.
1060 // Double_t hz z component of a unit vector perpendicular to
1061 // the face at +dz.
1062 // Int_t med media index number.
1063 // Output:
1064 // none.
1065 // Return.
1066 // none.
162acd47 1067 char name[5];
aa9bc63b 1068 Float_t param[11];
1069
aa9bc63b 1070 param[0] = fScale*rmin;
1071 param[1] = fScale*rmax;
1072 param[2] = fScale*dz;
1073 param[3] = phi1;
1074 param[4] = phi2;
1075 param[5] = lx;
1076 param[6] = ly;
1077 param[7] = lz;
1078 param[8] = hx;
1079 param[9] = hy;
1080 param[10] = hz;
162acd47 1081 G3name(gnam,name);
1082 gMC->Gsvolu(name,"CTUB",GetMed(med),param,11);
aa9bc63b 1083}
1084//______________________________________________________________________
162acd47 1085void AliITSBaseGeometry::Pos(AliITSBaseVolParams &v,Int_t cn,
1086 AliITSBaseVolParams &m,
1087 TVector3 &t,Int_t irot){
aa9bc63b 1088 // Place a copy of a volume previously defined by a call to GSVOLU inside
1089 // its mother volulme moth.
1090 // Inputs:
1091 // const char vol[3] 3 character geant volume name. The letter "I"
1092 // is appended to the front to indecate that this
1093 // is an ITS volume.
162acd47 1094 // const char moth[3] 3 character geant volume name of the mother
1095 // volume in which vol will be placed. The letter
1096 // "I" is appended to the front to indecate that
1097 // this is an ITS volume.
aa9bc63b 1098 // Double_t x The x positon of the volume in the mother's
1099 // reference system
1100 // Double_t y The y positon of the volume in the mother's
1101 // reference system
1102 // Double_t z The z positon of the volume in the mother's
1103 // reference system
1104 // Int_t irot the index for the rotation matrix to be used.
1105 // irot=-1 => unit rotation.
1106 // Outputs:
1107 // none.
1108 // Return:
1109 // none.
162acd47 1110 char name[5],mother[5];
aa9bc63b 1111 Float_t param[3];
1112 Int_t r=0,i;
162acd47 1113 char *n = (char*)&r;
aa9bc63b 1114
162acd47 1115 param[0] = fScale*t.X();
1116 param[1] = fScale*t.Y();
1117 param[2] = fScale*t.Z();
1118 r = ITSIndexToITSG3name(v.GetVid());
1119 for(i=0;i<4;i++) name[i] = n[i]; name[4] ='\0';
1120 r = ITSIndexToITSG3name(m.GetVid());
1121 for(i=0;i<4;i++) mother[i] = n[i]; mother[4] ='\0';
1122 if(irot>0) r = fidrot[irot]; else r=0;
1123 gMC->Gspos(name,cn,mother,param[0],param[1],param[2],r,"ONLY");
1124}
1125//______________________________________________________________________
1126void AliITSBaseGeometry::Pos(const char *vol,Int_t cn,const char *moth,
1127 Double_t x,Double_t y,Double_t z,Int_t irot){
1128 // Place a copy of a volume previously defined by a call to GSVOLU inside
1129 // its mother volulme moth.
1130 // Inputs:
1131 // const char vol[3] 3 character geant volume name. The letter "I"
1132 // is appended to the front to indecate that this
1133 // is an ITS volume.
1134 // const char moth[3] 3 character geant volume name of the mother
1135 // volume in which vol will be placed. The letter
1136 // "I" is appended to the front to indecate that
1137 // this is an ITS volume.
1138 // Double_t x The x positon of the volume in the mother's
1139 // reference system
1140 // Double_t y The y positon of the volume in the mother's
1141 // reference system
1142 // Double_t z The z positon of the volume in the mother's
1143 // reference system
1144 // Int_t irot the index for the rotation matrix to be used.
1145 // irot=-1 => unit rotation.
1146 // Outputs:
1147 // none.
1148 // Return:
1149 // none.
1150 char name[5],mother[5];
1151 Float_t param[3];
1152 Int_t r=0;
1153
1154 param[0] = fScale*x;
1155 param[1] = fScale*y;
1156 param[2] = fScale*z;
1157 G3name(vol,name);
1158 G3name(moth,mother);
1159 if(irot>0) r = fidrot[irot];
1160 gMC->Gspos(name,cn,mother,param[0],param[1],param[2],r,"ONLY");
aa9bc63b 1161}
1162//______________________________________________________________________
1163void AliITSBaseGeometry::Matrix(Int_t irot,Double_t thet1,Double_t phi1,
1164 Double_t thet2,Double_t phi2,
1165 Double_t thet3,Double_t phi3){
1166 // Defines a Geant rotation matrix. checks to see if it is the unit
1167 // matrix. If so, then no additonal matrix is defined. Stores rotation
1168 // matrix irot in the data structure JROTM. If the matrix is not
1169 // orthonormal, it will be corrected by setting y' perpendicular to x'
1170 // and z' = x' X y'. A warning message is printed in this case.
1171 // Inputs:
1172 // Int_t irot Intex specifing which rotation matrix.
1173 // Double_t thet1 Polar angle for axisw x [degrees].
1174 // Double_t phi1 azimuthal angle for axis x [degrees].
1175 // Double_t thet12Polar angle for axisw y [degrees].
1176 // Double_t phi2 azimuthal angle for axis y [degrees].
1177 // Double_t thet3 Polar angle for axisw z [degrees].
1178 // Double_t phi3 azimuthal angle for axis z [degrees].
1179 // Outputs:
1180 // none.
1181 // Return:
1182 // none.
1183 Float_t t1,p1,t2,p2,t3,p3;
1184
162acd47 1185 if(thet1==90.0&&phi1== 0.0&&
1186 thet2==90.0&&phi2==90.0&&
1187 thet3== 0.0&&phi3== 0.0){
aa9bc63b 1188 fidrot[irot] = 0; // Unit matrix
1189 }else{
1190 t1 = thet1;
1191 p1 = phi1;
1192 t2 = thet2;
1193 p2 = phi2;
1194 t3 = thet3;
1195 p3 = phi3;
1196 fits->AliMatrix(fidrot[irot],t1,p1,t2,p2,t3,p3);
1197 } // end if
1198}
1199//______________________________________________________________________
1200void AliITSBaseGeometry::Matrix(Int_t irot,Int_t axis,Double_t thet){
1201 // Defines a Geant rotation matrix. checks to see if it is the unit
1202 // matrix. If so, then no additonal matrix is defined. Stores rotation
1203 // matrix irot in the data structure JROTM. If the matrix is not
1204 // orthonormal, it will be corrected by setting y' perpendicular to x'
1205 // and z' = x' X y'. A warning message is printed in this case.
1206 // Inputs:
1207 // Int_t irot Intex specifing which rotation matrix.
1208 // Int_t axis Axis about which rotation is to be done.
1209 // Double_t thet Angle to rotate by [degrees].
1210 // Outputs:
1211 // none.
1212 // Return:
1213 // none.
1214
1215 if(thet==0.0){
1216 fidrot[irot] = 0; // Unit matrix
1217 }else{
162acd47 1218 switch (axis) {
aa9bc63b 1219 case 0: //Rotate about x-axis, x-axis does not change.
1220 fits->AliMatrix(fidrot[irot],90.0,0.0,90.0+thet,90.0,thet,90.0);
1221 break;
1222 case 1: //Rotate about y-axis, y-axis does not change.
162acd47 1223 fits->AliMatrix(fidrot[irot],360.-90.0-thet,0.0,90.0,90.0,
1224 thet,90.0);
aa9bc63b 1225 break;
1226 case 2: //Rotate about z-axis, z-axis does not change.
162acd47 1227 fits->AliMatrix(fidrot[irot],90.0,thet,90.0,360.-thet-90.0,
1228 0.0,0.0);
aa9bc63b 1229 break;
1230 default:
1231 Error("Matrix","axis must be either 0, 1, or 2. for matrix=%d",
1232 irot);
1233 break;
1234 } // end switch
1235 } // end if
1236}
1237//______________________________________________________________________
1238void AliITSBaseGeometry::Matrix(Int_t irot,Double_t rot[3][3]){
1239 // Defines a Geant rotation matrix. checks to see if it is the unit
1240 // matrix. If so, then no additonal matrix is defined. Stores rotation
1241 // matrix irot in the data structure JROTM. If the matrix is not
1242 // orthonormal, it will be corrected by setting y' perpendicular to x'
1243 // and z' = x' X y'. A warning message is printed in this case.
1244 // Inputs:
1245 // Int_t irot Intex specifing which rotation matrix.
1246 // Double_t rot[3][3] The 3 by 3 rotation matrix.
1247 // Outputs:
1248 // none.
1249 // Return:
1250 // none.
1251
1252 if(rot[0][0]==1.0&&rot[1][1]==1.0&&rot[2][2]==1.0&&
1253 rot[0][1]==0.0&&rot[0][2]==0.0&&rot[1][0]==0.0&&
1254 rot[1][2]==0.0&&rot[2][0]==0.0&&rot[2][1]==0.0){
1255 fidrot[irot] = 0; // Unit matrix
1256 }else{
1257 Double_t si,c=180./TMath::Pi();
1258 Double_t ang[6];
1259
1260 ang[1] = TMath::ATan2(rot[0][1],rot[0][0]);
1261 if(TMath::Cos(ang[1])!=0.0) si = rot[0][0]/TMath::Cos(ang[1]);
1262 else si = rot[0][1]/TMath::Sin(ang[1]);
1263 ang[0] = TMath::ATan2(si,rot[0][2]);
1264
1265 ang[3] = TMath::ATan2(rot[1][1],rot[1][0]);
1266 if(TMath::Cos(ang[3])!=0.0) si = rot[1][0]/TMath::Cos(ang[3]);
1267 else si = rot[1][1]/TMath::Sin(ang[3]);
1268 ang[2] = TMath::ATan2(si,rot[1][2]);
1269
1270 ang[5] = TMath::ATan2(rot[2][1],rot[2][0]);
1271 if(TMath::Cos(ang[5])!=0.0) si = rot[2][0]/TMath::Cos(ang[5]);
1272 else si = rot[2][1]/TMath::Sin(ang[5]);
1273 ang[4] = TMath::ATan2(si,rot[2][2]);
1274
1275 for(Int_t i=0;i<6;i++) {ang[i] *= c; if(ang[i]<0.0) ang[i] += 360.;}
1276 fits->AliMatrix(fidrot[irot],ang[0],ang[1],ang[2],ang[3],
1277 ang[4],ang[5]);
1278 } // end if
1279}
1280//______________________________________________________________________
1281Float_t AliITSBaseGeometry::GetA(Int_t z){
1282 // Returns the isotopicaly averaged atomic number.
1283 // Inputs:
1284 // Int_t z Elemental number
1285 // Outputs:
1286 // none.
1287 // Return:
1288 // The atomic mass number.
162acd47 1289 const Float_t A[]={
1290 1.00794 , 4.0026902, 6.941 , 9.012182 , 10.811 , // H-B
1291 12.01007 , 14.00674 , 15.9994 , 18.9984032, 20.1797 , // C-Ne
1292 22.98970 , 24.3050 , 26.981538, 28.0855 , 30.973761, // Na-P
1293 32.066 , 35.4527 , 39.948 , 39.0983 , 40.078 , // S-Ca
1294 44.95591 , 47.867 , 50.9415 , 51.9961 , 54.938049, // Sc-Mn
1295 55.845 , 58.933200 , 58.6934 , 63.546 , 65.39 , // Fe-Zn
1296 69.723 , 72.61 , 74.92160 , 78.96 , 79.904 , // Ga-Br
1297 83.80 , 85.4678 , 87.62 , 88.9085 , 91.224 , // Kr-Zr
1298 92.90638 , 95.94 , 97.907215, 101.07 ,102.90550 , // Nb-Rh
1299 106.42 ,107.8682 ,112.411 ,114.818 ,118.710 , // Pd-Sn
1300 121.760 ,127.60 ,126.90447 ,131.29 ,132.90545 , // Sb-Cs
1301 137.327 ,138.9055 ,140.116 ,140.90765 ,144.24 , // La-Nd
1302 144.912746,150.36 ,151.964 ,157.25 ,158.92534 , // Pm-Tb
1303 162.50 ,164.93032 ,167.26 ,168.93421 ,173.04 , // Dy-Yb
1304 174.967 ,178.49 ,180.9479 ,183.84 ,186.207 , // Lu-Re
1305 190.23 ,192.217 ,195.078 ,196.96655 ,200.59 , // Os-Hg
1306 204.3833 ,207.2 ,208.98038,208.982415 ,209.987131, // Tl-At
1307 222.017570,223.019731 ,226.025402,227.027747 ,232.0381 , // Rn-Th
1308 231.03588 ,238.0289 }; // Pa,U
aa9bc63b 1309
1310 if(z<1||z>92){
1311 Error("GetA","z must be 0<z<93. z=%d",z);
1312 return 0.0;
1313 } // end if
1314 return A[z-1];
1315}
1316//______________________________________________________________________
1317Float_t AliITSBaseGeometry::GetStandardMaxStepSize(Int_t istd){
1318 // Returns one of a set of standard Maximum Step Size values.
1319 // Inputs:
1320 // Int_t istd Index to indecate which standard.
1321 // Outputs:
1322 // none.
1323 // Return:
1324 // The appropreate standard Maximum Step Size value [cm].
1325 Float_t t[]={1.0, // default
1326 0.0075, // Silicon detectors...
1327 1.0, // Air in central detectors region
1328 1.0 // Material in non-centeral region
1329 };
1330 return t[istd];
1331}
1332//______________________________________________________________________
1333Float_t AliITSBaseGeometry::GetStandardThetaMax(Int_t istd){
1334 // Returns one of a set of standard Theata Max values.
1335 // Inputs:
1336 // Int_t istd Index to indecate which standard.
1337 // Outputs:
1338 // none.
1339 // Return:
1340 // The appropreate standard Theta max value [degrees].
1341 Float_t t[]={0.1, // default
1342 0.1, // Silicon detectors...
1343 0.1, // Air in central detectors region
1344 1.0 // Material in non-centeral region
1345 };
1346 return t[istd];
1347}
1348//______________________________________________________________________
1349Float_t AliITSBaseGeometry::GetStandardEfraction(Int_t istd){
1350 // Returns one of a set of standard E fraction values.
1351 // Inputs:
1352 // Int_t istd Index to indecate which standard.
1353 // Outputs:
1354 // none.
1355 // Return:
1356 // The appropreate standard E fraction value [#].
1357 Float_t t[]={0.1, // default
1358 0.1, // Silicon detectors...
1359 0.1, // Air in central detectors region
1360 0.5 // Material in non-centeral region
1361 };
1362 return t[istd];
1363}
162acd47 1364//______________________________________________________________________
aa9bc63b 1365Float_t AliITSBaseGeometry::GetStandardEpsilon(Int_t istd){
1366 // Returns one of the standard Epsilon valuse
1367 // Inputs:
1368 // Int_t istd index of standard cuts to get
1369 // Output:
1370 // none.
1371 // Return:
1372 // Float_t the standard Epsilon cut value.
1373 Float_t t[]={1.0E-4, // default
1374 1.0E-4, // Silicon detectors...
1375 1.0E-4, // Air in central detector region
1376 1.0E-3, // Material in non-cneteral regions
1377 };
1378
1379 return t[istd];
1380}
1381//______________________________________________________________________
1382void AliITSBaseGeometry::Element(Int_t imat,const char* name,Int_t z,
1383 Double_t dens,Int_t istd){
1384 // Defines a Geant single element material and sets its Geant medium
1385 // proporties. The average atomic A is assumed to be given by their
1386 // natural abundances. Things like the radiation length are calculated
1387 // for you.
1388 // Inputs:
1389 // Int_t imat Material number.
1390 // const char* name Material name. No need to add a $ at the end.
1391 // Int_t z The elemental number.
1392 // Double_t dens The density of the material [g/cm^3].
1393 // Int_t istd Defines which standard set of transport parameters
1394 // which should be used.
1395 // Output:
1396 // none.
1397 // Return:
1398 // none.
1399 Float_t rad,Z,A=GetA(z),tmax,stemax,deemax,epsilon;
1400 char *name2;
1401 Int_t len;
1402
1403 len = strlen(name)+1;
1404 name2 = new char[len];
1405 strncpy(name2,name,len-1);
1406 name2[len-1] = '\0';
1407 name2[len-2] = '$';
1408 Z = (Float_t)z;
1409 rad = GetRadLength(z)/dens;
1410 fits->AliMaterial(imat,name2,A,Z,dens,rad,0.0,0,0);
1411 tmax = GetStandardThetaMax(istd); // degree
1412 stemax = GetStandardMaxStepSize(istd); // cm
1413 deemax = GetStandardEfraction(istd); // ratio
1414 epsilon = GetStandardEpsilon(istd); //
1415 fits->AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1416 gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1417 delete[] name2;
1418}
1419//______________________________________________________________________
1420void AliITSBaseGeometry::MixtureByWeight(Int_t imat,const char* name,Int_t *z,
1421 Double_t *w,Double_t dens,Int_t n,Int_t istd){
1422 // Defines a Geant material by a set of elements and weights, and sets
1423 // its Geant medium proporties. The average atomic A is assumed to be
1424 // given by their natural abundances. Things like the radiation length
1425 // are calculated for you.
1426 // Inputs:
1427 // Int_t imat Material number.
1428 // const char* name Material name. No need to add a $ at the end.
1429 // Int_t *z Array of The elemental numbers.
1430 // Double_t *w Array of relative weights.
1431 // Double_t dens The density of the material [g/cm^3].
1432 // Int_t n the number of elements making up the mixture.
1433 // Int_t istd Defines which standard set of transport parameters
1434 // which should be used.
1435 // Output:
1436 // none.
1437 // Return:
1438 // none.
1439 Float_t *Z,*A,*W,tmax,stemax,deemax,epsilon;
1440 char *name2;
1441 Int_t len,i;
1442 Z = new Float_t[n];
1443 A = new Float_t[n];
1444 W = new Float_t[n];
1445
162acd47 1446 len = strlen(name)+2;
aa9bc63b 1447 name2 = new char[len];
1448 strncpy(name2,name,len-1);
1449 name2[len-1] = '\0';
1450 name2[len-2] = '$';
1451 for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
1452 W[i] = (Float_t)w[i];}
1453 fits->AliMixture(imat,name2,A,Z,dens,n,W);
1454 tmax = GetStandardThetaMax(istd); // degree
1455 stemax = GetStandardMaxStepSize(istd); // cm
1456 deemax = GetStandardEfraction(istd); // #
1457 epsilon = GetStandardEpsilon(istd);
1458 fits->AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1459 gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1460 delete[] name2;
1461 delete[] Z;
1462 delete[] A;
1463 delete[] W;
1464}
1465//______________________________________________________________________
1466void AliITSBaseGeometry::MixtureByNumber(Int_t imat,const char* name,Int_t *z,
1467 Int_t *w,Double_t dens,Int_t n,Int_t istd){
1468 // Defines a Geant material by a set of elements and number, and sets
1469 // its Geant medium proporties. The average atomic A is assumed to be
1470 // given by their natural abundances. Things like the radiation length
1471 // are calculated for you.
1472 // Inputs:
1473 // Int_t imat Material number.
1474 // const char* name Material name. No need to add a $ at the end.
1475 // Int_t *z Array of The elemental numbers.
1476 // Int_t_t *w Array of relative number.
1477 // Double_t dens The density of the material [g/cm^3].
1478 // Int_t n the number of elements making up the mixture.
1479 // Int_t istd Defines which standard set of transport parameters
1480 // which should be used.
1481 // Output:
1482 // none.
1483 // Return:
1484 // none.
1485 Float_t *Z,*A,*W,tmax,stemax,deemax,epsilon;
1486 char *name2;
1487 Int_t len,i;
1488 Z = new Float_t[n];
1489 A = new Float_t[n];
1490 W = new Float_t[n];
1491
1492 len = strlen(name)+1;
1493 name2 = new char[len];
1494 strncpy(name2,name,len-1);
1495 name2[len-1] = '\0';
1496 name2[len-2] = '$';
1497 for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
1498 W[i] = (Float_t)w[i];}
1499 fits->AliMixture(imat,name2,A,Z,dens,-n,W);
1500 tmax = GetStandardThetaMax(istd); // degree
1501 stemax = GetStandardMaxStepSize(istd); // cm
1502 deemax = GetStandardEfraction(istd); // #
1503 epsilon = GetStandardEpsilon(istd);
1504 fits->AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1505 gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1506 delete[] name2;
1507 delete[] Z;
1508 delete[] A;
1509 delete[] W;
1510}
1511//______________________________________________________________________
1512Double_t AliITSBaseGeometry::RadLength(Int_t iz,Double_t a){
1513 // Computes the radiation length in accordance to the PDG 2000 Section
1514 // 23.4.1 p. 166. Transladed from the c code of Flavio Tosello.
1515 // Inputs:
1516 // Int_t iz The elemental number
1517 // Dougle_t The elemental average atomic mass number
1518 // Outputs:
1519 // Return:
1520 // Double_t returns the radiation length of the element iz in
1521 // [gm/cm^2].
1522 Double_t z = (Double_t)iz;
1523 Double_t alphaz = fAlpha*z;
1524 Double_t alphaz2 = alphaz*alphaz;
1525 Double_t c0 = +0.20206,c1 = -0.0369,c2 = +0.0083,c3 = -0.0020;
1526 Double_t z12,z23,l,lp,c;
1527
1528 c = alphaz2*(1./(1.+alphaz2) + c0 + c1*alphaz2 + c2*alphaz2*alphaz2
1529 +c3*alphaz2*alphaz2*alphaz2);
1530 z12 = TMath::Exp(TMath::Log(z)/3.0);
1531 z23 = z12*z12;
1532 switch (iz){
1533 case 1: //Hydrogen
1534 l = 5.31;
1535 lp = 6.144;
1536 break;
1537 case 2: //Helium
1538 l = 4.79;
1539 lp = 5,621;
1540 break;
1541 case 3: //Lithium
1542 l = 4.74;
1543 lp = 5.805;
1544 break;
1545 case 4: //Berilium
1546 l = 4.71;
1547 lp = 5.924;
1548 break;
1549 default: //Others
1550 l = TMath::Log(184.15/z12);
1551 lp = TMath::Log(1194.0/z23);
1552 break;
1553 } // end switch
1554 Double_t re2,b,r,xz;
1555
1556 re2 = fRe*fRe;
1557 b = 4.0*fAlpha*re2*fNa/a;
1558 r = b*z*(z*(l-c)+lp);
1559 xz = 1.0/r;
1560 return xz; // [gm/cm^2]
1561}
162acd47 1562//======================================================================
1563ClassImp(AliITSPConeData)
1564//______________________________________________________________________
1565void AliITSPConeData::Print(ostream *os){
1566 // Prints out the data kept in this class
1567 // Inputs:
1568 // ostream *os The output stream pointer
1569 // Outputs:
1570 // none.
1571 // Return:
1572 // none.
1573 Int_t i;
1574
1575#if defined __GNUC__
1576#if __GNUC__ > 2
1577 ios::fmtflags fmt;
1578#else
1579 Int_t fmt;
1580#endif
1581#else
1582#if defined __ICC || defined __ECC
1583 ios::fmtflags fmt;
1584#else
1585 Int_t fmt;
1586#endif
1587#endif
1588
1589 *os << "Volume "<< GetVid() << " Name: " << *GetName() << endl;
1590 *os << "fNz=" << fNz << " fPhi0=" << fPhi0 << " fdPhi=" << fDphi << endl;
1591 *os <<" Z , Rmin , Rmax " << endl;
1592 fmt = os->setf(ios::scientific); // set scientific floating point output
1593 for(i=0;i<fNz;i++){
1594 *os << setprecision(16) << fZ[i] <<" ";
1595 *os << setprecision(16) << fRmin[i] << " ";
1596 *os << setprecision(16) << fRmax[i] << endl;
1597 } // end for i
1598 os->flags(fmt); // reset back to old formating.
1599 return;
1600}
1601//______________________________________________________________________
1602void AliITSPConeData::Read(istream *is){
1603 // Read in data kept in this class
1604 // Inputs:
1605 // istream *is the input stream
1606 // Outputs:
1607 // none.
1608 // Return:
1609 // none.
1610 Int_t i;
1611 char s[50];
1612 TString t;
1613
1614 is->get(s,7);
1615 *is >> i; SetVid(i);
1616 is->get(s,7);
1617 *is >> t; SetName(t.Data());
1618 is->get(s,4);
1619 *is >> fNz;
1620 is->get(s,6);
1621 *is >> fPhi0;
1622 is->get(s,6);
1623 *is >> fDphi;
1624 is->getline(s,49);
1625 Size(fNz);
1626 for(i=0;i<fNz;i++){
1627 *is >> fZ[i] >> fRmin[i] >> fRmax[i];
1628 } // end for i
1629}
1630//______________________________________________________________________
1631ostream &operator<<(ostream &os,AliITSPConeData &p){
1632 // Operator << for C++ like output
1633 // Inputs:
1634 // ostream &os The output stream
1635 // AliITSPConeData &p The class to be outputed
1636 // Output:
1637 // none.
1638 // Return:
1639 // ostream &os The output stream
1640
1641 p.Print(&os);
1642 return os;
1643}
1644//______________________________________________________________________
1645istream &operator>>(istream &is,AliITSPConeData &r){
1646 // Operator << for C++ like output
1647 // Inputs:
1648 // istream &is The input stream
1649 // AliITSPConeData &r The class to be read in
1650 // Output:
1651 // none.
1652 // Return:
1653 // istream &is The input stream
1654
1655 r.Read(&is);
1656 return is;
1657}
1658//======================================================================
1659ClassImp(AliITSPGonData)
1660//______________________________________________________________________
1661void AliITSPGonData::Print(ostream *os){
1662 // Prints out the data kept in this class
1663 // Inputs:
1664 // ostream *os The output stream pointer
1665 // Outputs:
1666 // none.
1667 // Return:
1668 // none.
1669 Int_t i;
1670
1671#if defined __GNUC__
1672#if __GNUC__ > 2
1673 ios::fmtflags fmt;
1674#else
1675 Int_t fmt;
1676#endif
1677#else
1678#if defined __ICC || defined __ECC
1679 ios::fmtflags fmt;
1680#else
1681 Int_t fmt;
1682#endif
1683#endif
1684
1685 *os << "Volume "<< GetVid() << " Name: " << *GetName() << endl;
1686 *os << "fNz=" << fNz << " fNphi=" << fNphi << " fPhi0=" << fPhi0;
1687 *os << " fdPhi=" << fDphi << endl;
1688 *os <<" Z , Rmin , Rmax " << endl;
1689 fmt = os->setf(ios::scientific); // set scientific floating point output
1690 for(i=0;i<fNz;i++){
1691 *os << setprecision(16) << fZ[i] <<" ";
1692 *os << setprecision(16) << fRmin[i] << " ";
1693 *os << setprecision(16) << fRmax[i] << endl;
1694 } // end for i
1695 os->flags(fmt); // reset back to old formating.
1696 return;
1697}
1698//______________________________________________________________________
1699void AliITSPGonData::Read(istream *is){
1700 // Read in data kept in this class
1701 // Inputs:
1702 // istream *is the input stream
1703 // Outputs:
1704 // none.
1705 // Return:
1706 // none.
1707 Int_t i;
1708 char s[50];
1709 TString t;
1710
1711 is->get(s,7);
1712 *is >> i;SetVid(i);
1713 is->get(s,7);
1714 *is >> t; SetName(t.Data());
1715
1716 is->get(s,4);
1717 *is >> fNz;
1718 is->get(s,6);
1719 *is >> fNphi;
1720 is->get(s,6);
1721 *is >> fPhi0;
1722 is->get(s,6);
1723 *is >> fDphi;
1724 is->getline(s,49);
1725
1726 Size(fNz);
1727 for(i=0;i<fNz;i++){
1728 *is >> fZ[i] >> fRmin[i] >> fRmax[i];
1729 } // end for i
1730}
1731//______________________________________________________________________
1732ostream &operator<<(ostream &os,AliITSPGonData &p){
1733 // Operator << for C++ like output
1734 // Inputs:
1735 // ostream &os The output stream
1736 // AliITSPGonData &p The class to be outputed
1737 // Output:
1738 // none.
1739 // Return:
1740 // ostream &os The output stream
1741
1742 p.Print(&os);
1743 return os;
1744}
1745//______________________________________________________________________
1746istream &operator>>(istream &is,AliITSPGonData &r){
1747 // Operator << for C++ like output
1748 // Inputs:
1749 // istream &is The input stream
1750 // AliITSPGonData &r The class to be read in
1751 // Output:
1752 // none.
1753 // Return:
1754 // istream &is The input stream
1755
1756 r.Read(&is);
1757 return is;
1758}
1759//======================================================================
1760ClassImp(AliITSTubeData)
1761//______________________________________________________________________
1762void AliITSTubeData::Print(ostream *os){
1763 // Prints out the data kept in this class
1764 // Inputs:
1765 // ostream *os The output stream pointer
1766 // Outputs:
1767 // none.
1768 // Return:
1769 // none.
1770
1771#if defined __GNUC__
1772#if __GNUC__ > 2
1773 ios::fmtflags fmt;
1774#else
1775 Int_t fmt;
1776#endif
1777#else
1778#if defined __ICC || defined __ECC
1779 ios::fmtflags fmt;
1780#else
1781 Int_t fmt;
1782#endif
1783#endif
1784
1785 *os << "Volume "<< GetVid() << " Name: " << *GetName() << endl;
1786 *os <<" Z , Rmin , Rmax " << endl;
1787 fmt = os->setf(ios::scientific); // set scientific floating point output
1788 *os << setprecision(16) << fDz <<" ";
1789 *os << setprecision(16) << fRmin << " ";
1790 *os << setprecision(16) << fRmax << endl;
1791 os->flags(fmt); // reset back to old formating.
1792 return;
1793}
1794//______________________________________________________________________
1795void AliITSTubeData::Read(istream *is){
1796 // Read in data kept in this class
1797 // Inputs:
1798 // istream *is the input stream
1799 // Outputs:
1800 // none.
1801 // Return:
1802 // none.
1803 Int_t i;
1804 char s[50];
1805 TString t;
1806
1807 is->get(s,7);
1808 *is >> i;SetVid(i);
1809 is->get(s,7);
1810 *is >> t; SetName(t.Data());
1811
1812 is->getline(s,49);
1813 *is >> fDz >> fRmin >> fRmax;
1814}
1815//______________________________________________________________________
1816ostream &operator<<(ostream &os,AliITSTubeData &p){
1817 // Operator << for C++ like output
1818 // Inputs:
1819 // ostream &os The output stream
1820 // AliITSTubeData &p The class to be outputed
1821 // Output:
1822 // none.
1823 // Return:
1824 // ostream &os The output stream
1825
1826 p.Print(&os);
1827 return os;
1828}
1829//______________________________________________________________________
1830istream &operator>>(istream &is,AliITSTubeData &r){
1831 // Operator << for C++ like output
1832 // Inputs:
1833 // istream &is The input stream
1834 // AliITSTubeData &r The class to be read in
1835 // Output:
1836 // none.
1837 // Return:
1838 // istream &is The input stream
1839
1840 r.Read(&is);
1841 return is;
1842}