1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.3 2003/03/27 08:49:39 hristov
19 Initialization of static data members in the implementation file
21 Revision 1.2 2003/03/25 23:27:19 nilsen
22 ITS new Geometry files. Not yet ready for uses, committed to allow additional
25 Revision 1.1 2003/02/10 17:03:52 nilsen
26 New version and structure of ITS V11 geometry. Work still in progress.
33 A base geometry class defining all of the ITS volumes that make up an ITS
37 Created February 2003.
40 #include <Riostream.h>
45 #include <TGeometry.h>
50 #include <TFile.h> // only required for Tracking function?
52 #include <TObjArray.h>
53 #include <TLorentzVector.h>
54 #include <TObjString.h>
55 #include <TClonesArray.h>
61 #include "AliITSBaseGeometry.h"
63 ClassImp(AliITSBaseGeometry)
65 const Double_t AliITSBaseGeometry::fAlpha = 7.297352533e-3;
66 const Double_t AliITSBaseGeometry::fRe = 2.81794028e-13;
67 const Double_t AliITSBaseGeometry::fNa = 6.02214199e+23;
68 Int_t AliITSBaseGeometry::fNCreates = 0;
69 Int_t* AliITSBaseGeometry::fidrot = 0;
70 Int_t AliITSBaseGeometry::fidrotsize = 0;
71 Int_t AliITSBaseGeometry::fidrotlast = 0;
72 Int_t AliITSBaseGeometry::fVolNameSize = 0;
73 Int_t AliITSBaseGeometry::fVolNameLast = 0;
74 TString* AliITSBaseGeometry::fVolName = 0;
76 //______________________________________________________________________
77 AliITSBaseGeometry::AliITSBaseGeometry(){
78 // Default construtor for the ITS Base Geometry class.
86 fScale = 1.0; // Default value.
87 fits = 0; // zero pointers.
88 if(fNCreates==0){ // only for very first init
90 fNCreates++; // incrament this creation counter.
92 //______________________________________________________________________
93 AliITSBaseGeometry::AliITSBaseGeometry(AliModule *its,Int_t iflag){
94 // Standard construtor for the ITS Base Geometry class.
96 // Int_t iflag flag to indecate specific swiches in the geometry
102 fScale = 1.0; // Default value.
103 fits = its; // get a copy of the pointer to the ITS.
104 if(fNCreates==0){ // only for very first init
105 fidrotsize = ITSG3VnameToIndex("TSV")+1;
106 fidrot = new Int_t[fidrotsize];
109 fNCreates++; // incrament this creation counter.
111 //______________________________________________________________________
112 AliITSBaseGeometry::~AliITSBaseGeometry(){
113 // Standeard destructor for the ITS Base Geometry class.
115 // Int_t iflag flag to indecate specific swiches in the geometry
121 fits = 0; // This class does not own this class. It contaitns a pointer
122 // to it for conveniance.
124 if(fNCreates==0){ // Now delete the static members
127 for(i=0;i<fVolNameLast;i++) delete fVolName[i];
133 fidrotsize = fidrotlast = 0;
136 //______________________________________________________________________
137 Int_t AliITSBaseGeometry::AddVolName(const TString name){
138 // Checks if the volume name already exist, if not it adds it to
139 // the list of volume names and returns an index to that volume name.
140 // it will create and expand the array of volume names as needed.
141 // If the volume name already exists, it will give an error message and
142 // return an index <0.
144 // const TString name Volume name to be added to the list.
148 // The index where this volume name is stored.
151 if(fVolName==0){ // must create array.
152 fVolNameSize = 38624;
153 fVolName = new TString[fVolNameSize];
156 for(i=0;i<fVolNameLast;i++) if(fVolName[i].CompareTo(name)==0){ // Error
157 Error("AddVolName","Volume name already exists for volume %d name %s",
161 if(fVolNameSize==fVolNameLast-1){ // Array is full must expand.
162 Int_t size = fVolNameSize*2;
163 TString *old = fVolName;
164 fVolName = new TString[fVolNameSize];
165 for(i=0;i<fVolNameLast;i++) fVolName[i] = old[i];
169 i=ITSIndexToITSG3name(fVolNameLast);
170 if(strcmp((char*)(&i),"ITSV")==0){
171 // Special Reserved Geant 3 volumen name. Skip it
172 // fill it with explination for conveniance.
173 fVolName[fVolNameLast] = "ITS Master Mother Volume";
176 fVolName[fVolNameLast] = name;
178 return fVolNameLast-1; // return the index
180 //______________________________________________________________________
181 Int_t AliITSBaseGeometry::ITSIndexToITSG3name(const Int_t i){
182 // Given the ITS volume index i, it returns the Geant3 ITS volume
183 // name. The valid characters must be in the range
184 // '0' through 'Z'. This will include all upper case letter and the
185 // numbers 0-9. In addition it does not will include the following simbols
188 // const Int_t i the ITS volume index
192 // char[4] with the ITS volume name starting from "I000" to "IZZZ"
193 const Int_t rangen=(Int_t)('9'-'0'+1); // range of numbers
194 const Int_t rangel=(Int_t)('Z'-'A'+1); // range of letters
195 const Int_t range = rangen+rangel; // the number of characters between
198 Byte_t *a = (Byte_t*) &k;
202 a[0] = (Byte_t)('I');
203 a[1] = (Byte_t)('0'+j/(range*range));
204 if(a[1]>'9') a[1] += 'A'-'9'-1;//if it is a letter add in gap for simples.
205 j -= range*range*((Int_t)(j/(range*range)));
206 a[2] = (Byte_t)('0'+j/range);
207 if(a[2]>'9') a[2] += 'A'-'9'-1;//if it is a letter add in gap for simples.
208 j -= range*((Int_t)(j/range));
209 a[3] = (Byte_t)('0'+j);
210 if(a[3]>'9') a[3] += 'A'-'9'-1;//if it is a letter add in gap for simples.
213 //______________________________________________________________________
214 Int_t AliITSBaseGeometry::ITSG3VnameToIndex(const char *name)const{
215 // Given the last three characters of the ITS Geant3 volume name,
216 // this returns the index. The valid characters must be in the range
217 // '0' through 'Z'. This will include all upper case letter and the
218 // numbers 0-9. In addition it will include the following simbles
221 // const char name[3] The last three characters of the ITS Geant3
227 const Int_t rangen = (Int_t)('9'-'0'+1); // range of numbers
228 const Int_t rangel = (Int_t)('Z'-'A'+1); // range of letters
229 const Int_t range = rangen+rangel; // the number of characters between
234 for(j=k;j>k-3;j--) if(isdigit(name[j])) // number
235 i += (Int_t)((name[j]-'0')*TMath::Power((Double_t)range,
238 i += (Int_t)((name[j]-'A'+rangen)*TMath::Power((Double_t)range,
242 //______________________________________________________________________
243 TString AliITSBaseGeometry::GetVolName(const Int_t i)const{
244 // Returns the volume name at a given index i. Index must be in
245 // range and the array of volume names must exist. If there is an
246 // error, a message is written and 0 is returned.
248 // const Int_t i Index
252 // A TString contianing the ITS volume name.
254 if(i<0||i>=fVolNameLast){
255 Error("GetVolName","Index=%d out of range but be witin 0<%d",i,
261 //______________________________________________________________________
262 Int_t AliITSBaseGeometry::GetVolumeIndex(const TString &a){
263 // Return the index corresponding the the volume name a. If the
264 // Volumen name is not found, return -1, and a warning message given.
266 // const TString &a Name of volume for which index is wanted.
270 // Int_t Index corresponding the volume a. If not found -1 is returned.
273 for(i=0;i<fVolNameLast;i++) if(fVolName[i].CompareTo(a)==0) return i;
274 Info("GetVolumeIndex","Volume name %s not found",a.Data());
277 //______________________________________________________________________
278 void AliITSBaseGeometry::Box(const char *gnam,const TString &dis,
279 Double_t dx,Double_t dy,Double_t dz,Int_t med){
280 // Interface to TMC->Gsvolu() for ITS bos geometries. Box with faces
281 // perpendicular to the axes. It has 3 paramters. See SetScale() for
282 // units. Default units are geant 3 [cm].
284 // const char *gnam 3 character geant volume name. The letter "I"
285 // is appended to the front to indecate that this
287 // TString &dis String containging part discription.
288 // Double_t dx half-length of box in x-axis
289 // Double_t dy half-length of box in y-axis
290 // Double_t dz half-length of box in z-axis
291 // Int_t med media index number.
299 param[0] = fScale*dx;
300 param[1] = fScale*dy;
301 param[2] = fScale*dz;
303 gMC->Gsvolu(name,"BOX ",GetMed(med),param,3);
305 //______________________________________________________________________
306 void AliITSBaseGeometry::Trapezoid1(const char *gnam,const TString &dis,
307 Double_t dxn,Double_t dxp,Double_t dy,
308 Double_t dz,Int_t med){
309 // Interface to TMC->Gsvolu() for ITS TRD1 geometries. Trapezoid with the
310 // x dimension varing along z. It has 4 parameters. See SetScale() for
311 // units. Default units are geant 3 [cm].
313 // const char *gnam 3 character geant volume name. The letter "I"
314 // is appended to the front to indecate that this
316 // TString &dis String containging part discription.
317 // Double_t dxn half-length along x at the z surface positioned
319 // Double_t dxp half-length along x at the z surface positioned
321 // Double_t dy half-length along the y-axis
322 // Double_t dz half-length along the z-axis
323 // Int_t med media index number.
331 param[0] = fScale*dxn;
332 param[1] = fScale*dxp;
333 param[2] = fScale*dy;
334 param[3] = fScale*dz;
336 gMC->Gsvolu(name,"TRD1",GetMed(med),param,4);
338 //______________________________________________________________________
339 void AliITSBaseGeometry::Trapezoid2(const char *gnam,const TString &dis,
340 Double_t dxn,Double_t dxp,Double_t dyn,
341 Double_t dyp,Double_t dz,Int_t med){
342 // Interface to TMC->Gsvolu() for ITS TRD2 geometries. Trapezoid with the
343 // x and y dimension varing along z. It has 5 parameters. See SetScale()
344 // for units. Default units are geant 3 [cm].
346 // const char *gnam 3 character geant volume name. The letter "I"
347 // is appended to the front to indecate that this
349 // TString &dis String containging part discription.
350 // Double_t dxn half-length along x at the z surface positioned
352 // Double_t dxp half-length along x at the z surface positioned
354 // Double_t dyn half-length along x at the z surface positioned
356 // Double_t dyp half-length along x at the z surface positioned
358 // Double_t dz half-length along the z-axis
359 // Int_t med media index number.
367 param[0] = fScale*dxn;
368 param[1] = fScale*dxp;
369 param[2] = fScale*dyn;
370 param[3] = fScale*dyp;
371 param[4] = fScale*dz;
373 gMC->Gsvolu(name,"TRD2",GetMed(med),param,5);
375 //______________________________________________________________________
376 void AliITSBaseGeometry::Trapezoid(const char *gnam,const TString &dis,
377 Double_t dz,Double_t thet,Double_t phi,
378 Double_t h1,Double_t bl1,Double_t tl1,
379 Double_t alp1,Double_t h2,Double_t bl2,
380 Double_t tl2,Double_t alp2,Int_t med){
381 // Interface to TMC->Gsvolu() for ITS TRAP geometries. General Trapezoid,
382 // The faces perpendicular to z are trapezia and their centers are not
383 // necessarily on a line parallel to the z axis. This shape has 11
384 // parameters, but only cosidering that the faces should be planar, only
385 // 9 are really independent. A check is performed on the user parameters
386 // and a message is printed in case of non-planar faces. Ignoring this
387 // warning may cause unpredictable effects at tracking time. See
388 // SetScale() for units. Default units are geant 3 [cm].
390 // const char *gnam 3 character geant volume name. The letter "I"
391 // is appended to the front to indecate that this
393 // TString &dis String containging part discription.
394 // Double_t dz Half-length along the z-asix
395 // Double_t thet Polar angle of the line joing the center of the
396 // face at -dz to the center of the one at dz
398 // Double_t phi aximuthal angle of the line joing the center of
399 // the face at -dz to the center of the one at +dz
401 // Double_t h1 half-length along y of the face at -dz.
402 // Double_t bl1 half-length along x of the side at -h1 in y of
403 // the face at -dz in z.
404 // Double_t tl1 half-length along x of teh side at +h1 in y of
405 // the face at -dz in z.
406 // Double_t alp1 angle with respect to the y axis from the
407 // center of the side at -h1 in y to the cetner
408 // of the side at +h1 in y of the face at -dz in z
410 // Double_t h2 half-length along y of the face at +dz
411 // Double_t bl2 half-length along x of the side at -h2 in y of
412 // the face at +dz in z.
413 // Double_t tl2 half-length along x of the side at _h2 in y of
414 // the face at +dz in z.
415 // Double_t alp2 angle with respect to the y axis from the
416 // center of the side at -h2 in y to the center
417 // of the side at +h2 in y of the face at +dz in z
419 // Int_t med media index number.
427 param[0] = fScale*dz;
430 param[3] = fScale*h1;
431 param[4] = fScale*bl1;
432 param[5] = fScale*tl1;
434 param[7] = fScale*h2;
435 param[8] = fScale*bl2;
436 param[9] = fScale*tl2;
439 gMC->Gsvolu(name,"TRAP",GetMed(med),param,11);
441 //______________________________________________________________________
442 void AliITSBaseGeometry::Tube(const char *gnam,const TString &dis,
443 Double_t rmin,Double_t rmax,Double_t dz,
445 // Interface to TMC->Gsvolu() for ITS TUBE geometries. Simple Tube. It has
446 // 3 parameters. See SetScale()
447 // for units. Default units are geant 3 [cm].
449 // const char *gnam 3 character geant volume name. The letter "I"
450 // is appended to the front to indecate that this
452 // TString &dis String containging part discription.
453 // Double_t rmin Inside Radius.
454 // Double_t rmax Outside Radius.
455 // Double_t dz half-length along the z-axis
456 // Int_t med media index number.
464 param[0] = fScale*rmin;
465 param[1] = fScale*rmax;
466 param[2] = fScale*dz;
468 gMC->Gsvolu(name,"TUBE",GetMed(med),param,3);
470 //______________________________________________________________________
471 void AliITSBaseGeometry::Tube(AliITSTubeData &d,Int_t med){
472 // Interface to TMC->Gsvolu() for ITS TUBE geometries. Simple Tube. It has
473 // 3 parameters. See SetScale()
474 // for units. Default units are geant 3 [cm].
476 // AliITSTubeData Structure with the tube parameters
477 // Int_t med media index number.
485 char *j = (char *) &k;
487 param[0] = fScale*d.Rmin();
488 param[1] = fScale*d.Rmax();
489 param[2] = fScale*d.DzAt();
490 d.SetVid(AddVolName((d.GetName())->Data()));
491 k = ITSIndexToITSG3name(d.GetVid());
492 for(i=0;i<4;i++) name[i] = j[i];
494 gMC->Gsvolu(name,"TUBE",GetMed(med),param,3);
496 //______________________________________________________________________
497 void AliITSBaseGeometry::TubeSegment(const char *gnam,const TString &dis,
498 Double_t rmin,Double_t rmax,Double_t dz,
499 Double_t phi1,Double_t phi2,Int_t med){
500 // Interface to TMC->Gsvolu() for ITS TUBE geometries. Phi segment of a
501 // tube. It has 5 parameters. Phi1 should be smaller than phi2. If this
502 // is not the case, the system adds 360 degrees to phi2. See SetScale()
503 // for units. Default units are geant 3 [cm].
505 // const char *gnam 3 character geant volume name. The letter "I"
506 // is appended to the front to indecate that this
508 // TString &dis String containging part discription.
509 // Double_t rmin Inside Radius.
510 // Double_t rmax Outside Radius.
511 // Double_t dz half-length along the z-axis
512 // Double_t phi1 Starting angle of the segment [degree].
513 // Double_t phi2 Ending angle of the segment [degree].
514 // Int_t med media index number.
522 param[0] = fScale*rmin;
523 param[1] = fScale*rmax;
524 param[2] = fScale*dz;
528 gMC->Gsvolu(name,"TUBS",GetMed(med),param,5);
530 //______________________________________________________________________
531 void AliITSBaseGeometry::Cone(const char *gnam,const TString &dis,
532 Double_t dz,Double_t rmin1,Double_t rmax1,
533 Double_t rmin2,Double_t rmax2,Int_t med){
534 // Interface to TMC->Gsvolu() for ITS Cone geometries. Conical tube. It
535 // has 5 parameters. See SetScale()
536 // for units. Default units are geant 3 [cm].
538 // const char *gnam 3 character geant volume name. The letter "I"
539 // is appended to the front to indecate that this
541 // TString &dis String containging part discription.
542 // Double_t dz half-length along the z-axis
543 // Double_t rmin1 Inside Radius at -dz.
544 // Double_t rmax1 Outside Radius at -dz.
545 // Double_t rmin2 inside radius at +dz.
546 // Double_t rmax2 outside radius at +dz.
547 // Int_t med media index number.
555 param[0] = fScale*dz;
556 param[1] = fScale*rmin1;
557 param[2] = fScale*rmax1;
558 param[3] = fScale*rmin2;
559 param[4] = fScale*rmax2;
561 gMC->Gsvolu(name,"CONS",GetMed(med),param,5);
563 //______________________________________________________________________
564 void AliITSBaseGeometry::ConeSegment(const char *gnam,const TString &dis,
565 Double_t dz,Double_t rmin1,
566 Double_t rmax1,Double_t rmin2,
567 Double_t rmax2,Double_t phi1,
568 Double_t phi2,Int_t med){
569 // Interface to TMC->Gsvolu() for ITS ConS geometries. One segment of a
570 // conical tube. It has 7 parameters. Phi1 should be smaller than phi2.
571 // If this is not the case, the system adds 360 degrees to phi2. See
572 // SetScale() for units. Default units are geant 3 [cm].
574 // const char *gnam 3 character geant volume name. The letter "I"
575 // is appended to the front to indecate that
576 // this is an ITS volume.
577 // TString &dis String containging part discription.
578 // Double_t dz half-length along the z-axis
579 // Double_t rmin1 Inside Radius at -dz.
580 // Double_t rmax1 Outside Radius at -dz.
581 // Double_t rmin2 inside radius at +dz.
582 // Double_t rmax2 outside radius at +dz.
583 // Double_t phi1 Starting angle of the segment [degree].
584 // Double_t phi2 Ending angle of the segment [degree].
585 // Int_t med media index number.
593 param[0] = fScale*dz;
594 param[1] = fScale*rmin1;
595 param[2] = fScale*rmax1;
596 param[3] = fScale*rmin2;
597 param[4] = fScale*rmax2;
601 gMC->Gsvolu(name,"CONS",GetMed(med),param,7);
603 //______________________________________________________________________
604 void AliITSBaseGeometry::Sphere(const char *gnam,const TString &dis,
605 Double_t rmin,Double_t rmax,Double_t the1,
606 Double_t the2,Double_t phi1,Double_t phi2,
608 // Interface to TMC->Gsvolu() for ITS SPHE geometries. Segment of a
609 // sphereical shell. It has 6 parameters. See SetScale()
610 // for units. Default units are geant 3 [cm].
612 // const char *gnam 3 character geant volume name. The letter "I"
613 // is appended to the front to indecate that this
615 // TString &dis String containging part discription.
616 // Double_t rmin Inside Radius.
617 // Double_t rmax Outside Radius.
618 // Double_t the1 staring polar angle of the shell [degree].
619 // Double_t the2 ending polar angle of the shell [degree].
620 // Double_t phui staring asimuthal angle of the shell [degree].
621 // Double_t phi2 ending asimuthal angle of the shell [degree].
622 // Int_t med media index number.
630 param[0] = fScale*rmin;
631 param[1] = fScale*rmax;
637 gMC->Gsvolu(name,"SPHE",GetMed(med),param,6);
639 //______________________________________________________________________
640 void AliITSBaseGeometry::Parallelepiped(const char *gnam,const TString &dis,
641 Double_t dx,Double_t dy,Double_t dz,
642 Double_t alpha,Double_t thet,
643 Double_t phi,Int_t med){
644 // Interface to TMC->Gsvolu() for ITS PARA geometries. Parallelepiped. It
645 // has 6 parameters. See SetScale() for units. Default units are geant 3
648 // const char *gnam 3 character geant volume name. The letter "I"
649 // is appended to the front to indecate that this
651 // TString &dis String containging part discription.
652 // Double_t dx half-length allong x-axis
653 // Double_t dy half-length allong y-axis
654 // Double_t dz half-length allong z-axis
655 // Double_t alpha angle formed by the y axis and by the plane
656 // joining the center of teh faces parallel to the
657 // z-x plane at -dY and +dy [degree].
658 // Double_t thet polar angle of the line joining the centers of
659 // the faces at -dz and +dz in z [degree].
660 // Double_t phi azimuthal angle of teh line joing the centers
661 // of the faaces at -dz and +dz in z [degree].
662 // Int_t med media index number.
670 param[0] = fScale*dx;
671 param[1] = fScale*dy;
672 param[2] = fScale*dz;
677 gMC->Gsvolu(name,"PARA",GetMed(med),param,6);
679 //______________________________________________________________________
680 void AliITSBaseGeometry::PolyGon(const char *gnam,const TString &dis,
681 Double_t phi1,Double_t dphi,Int_t npdv,
682 Int_t nz,Double_t *z,Double_t *rmin,
683 Double_t *rmax,Int_t med){
684 // Interface to TMC->Gsvolu() for ITS PGON geometry. Polygon It has 10
685 // parameters or more. See SetScale() for units. Default units are geant
688 // const char *gnam 3 character geant volume name. The letter "I"
689 // is appended to the front to indecate that this
691 // TString &dis String containging part discription.
692 // Double_t phi1 the azimuthal angle at which the volume begins
693 // (angles are counted clouterclockwise) [degrees].
694 // Double_t dphi opening angle of the volume, which extends from
695 // phi1 to phi1+dphi [degree].
696 // Int_t npdv the number of sides of teh cross section
697 // between the given phi limits.
698 // Int_t nz number of planes perpendicular to the z axis
699 // where the dimension of the section is given -
700 // this number should be at least 2 and NP triples
701 // of number must follow.
702 // Double_t *z array [nz] of z coordiates of the sections..
703 // Double_t *rmin array [nz] of radius of teh circle tangent to
704 // the sides of the inner polygon in teh
706 // Double_t *rmax array [nz] of radius of the circle tangent to
707 // the sides of the outer polygon in the
709 // Int_t med media index number.
719 param = new Float_t[n];
722 param[2] = (Float_t)npdv;
723 param[3] = (Float_t)nz;
725 param[4+3*i] = fScale*z[i];
726 param[5+3*i] = fScale*rmin[i];
727 param[6+3*i] = fScale*rmax[i];
730 gMC->Gsvolu(name,"PGON",GetMed(med),param,n);
734 //______________________________________________________________________
735 void AliITSBaseGeometry::PolyGon(AliITSPGonData &d,Int_t med){
736 // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9
737 // parameters or more. See SetScale() for units. Default units are geant
740 // AliITSPGonData &d Object with poly cone data stored in it.
741 // Int_t med media index number.
749 char *j = (char *) &k;
752 param = new Float_t[n];
755 param[2] = (Float_t) d.NPhi();
756 param[3] = (Float_t) d.Nz();
757 for(i=0;i<d.Nz();i++){
758 param[4+3*i] = fScale*d.ZAt(i);
759 param[5+3*i] = fScale*d.Rmin(i);
760 param[6+3*i] = fScale*d.Rmax(i);
762 d.SetVid(AddVolName((d.GetName())->Data()));
763 k = ITSIndexToITSG3name(d.GetVid());
764 for(i=0;i<4;i++) name[i] = j[i];
766 gMC->Gsvolu(name,"PGON",GetMed(med),param,n);
770 //______________________________________________________________________
771 void AliITSBaseGeometry::PolyCone(const char *gnam,const TString &dis,
772 Double_t phi1,Double_t dphi,Int_t nz,
773 Double_t *z,Double_t *rmin,Double_t *rmax,
775 // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9
776 // parameters or more. See SetScale() for units. Default units are geant
779 // const char *gnam 3 character geant volume name. The letter "I"
780 // is appended to the front to indecate that this
782 // TString &dis String containging part discription.
783 // Double_t phi1 the azimuthal angle at which the volume begins
784 // (angles are counted clouterclockwise) [degrees].
785 // Double_t dphi opening angle of the volume, which extends from
786 // phi1 to phi1+dphi [degree].
787 // Int_t nz number of planes perpendicular to the z axis
788 // where the dimension of the section is given -
789 // this number should be at least 2 and NP triples
790 // of number must follow.
791 // Double_t *z Array [nz] of z coordinate of the section.
792 // Double_t *rmin Array [nz] of radius of teh inner circle in the
794 // Double_t *rmax Array [nz] of radius of the outer circle in the
796 // Int_t med media index number.
806 param = new Float_t[n];
809 param[2] = (Float_t) nz;
811 param[3+3*i] = fScale*z[i];
812 param[4+3*i] = fScale*rmin[i];
813 param[5+3*i] = fScale*rmax[i];
816 gMC->Gsvolu(name,"PCON",GetMed(med),param,n);
820 //______________________________________________________________________
821 void AliITSBaseGeometry::PolyCone(AliITSPConeData &d,Int_t med){
822 // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9
823 // parameters or more. See SetScale() for units. Default units are geant
826 // AliITSPConeData &d Object with poly cone data stored in it.
827 // Int_t med media index number.
835 char *j = (char *) &k;
838 param = new Float_t[n];
841 param[2] = (Float_t) d.Nz();
842 for(i=0;i<d.Nz();i++){
843 param[3+3*i] = fScale*d.ZAt(i);
844 param[4+3*i] = fScale*d.Rmin(i);
845 param[5+3*i] = fScale*d.Rmax(i);
847 d.SetVid(AddVolName((d.GetName())->Data()));
848 k = ITSIndexToITSG3name(d.GetVid());
849 for(i=0;i<4;i++) name[i] = j[i];
851 gMC->Gsvolu(name,"PCON",GetMed(med),param,n);
855 //______________________________________________________________________
856 void AliITSBaseGeometry::TubeElliptical(const char *gnam,const TString &dis,
857 Double_t p1,Double_t p2,Double_t dz,Int_t med){
858 // Interface to TMC->Gsvolu() for ITS ELTU geometries. Elliptical
859 // cross-section Tube. It has 3 parameters. See SetScale()
860 // for units. Default units are geant 3 [cm]. The equation of the surface
861 // is x^2 * p1^-2 + y^2 * p2^-2 = 1.
863 // const char *gnam 3 character geant volume name. The letter "I"
864 // is appended to the front to indecate that this
866 // TString &dis String containging part discription.
867 // Double_t p1 semi-axis of the elipse along x.
868 // Double_t p2 semi-axis of the elipse along y.
869 // Double_t dz half-length along the z-axis
870 // Int_t med media index number.
878 param[0] = fScale*p1;
879 param[1] = fScale*p2;
880 param[2] = fScale*dz;
882 gMC->Gsvolu(name,"ELTU",GetMed(med),param,3);
884 //______________________________________________________________________
885 void AliITSBaseGeometry::HyperbolicTube(const char *gnam,const TString &dis,
886 Double_t rmin,Double_t rmax,Double_t dz,
887 Double_t thet,Int_t med){
888 // Interface to TMC->Gsvolu() for ITS HYPE geometries. Hyperbolic tube.
889 // Fore example the inner and outer surfaces are hyperboloids, as would
890 // be foumed by a system of cylinderical wires which were then rotated
891 // tangentially about their centers. It has 4 parameters. See SetScale()
892 // for units. Default units are geant 3 [cm]. The hyperbolic surfaces are
893 // given by r^2 = (ztan(thet)^2 + r(z=0)^2.
895 // const char *gnam 3 character geant volume name. The letter "I"
896 // is appended to the front to indecate that this
898 // TString &dis String containging part discription.
899 // Double_t rmin Inner radius at z=0 where tube is narrowest.
900 // Double_t rmax Outer radius at z=0 where tube is narrowest.
901 // Double_t dz half-length along the z-axis
902 // Double_t thet stero angel of rotation of the two faces
904 // Int_t med media index number.
912 param[0] = fScale*rmin;
913 param[1] = fScale*rmax;
914 param[2] = fScale*dz;
917 gMC->Gsvolu(name,"HYPE",GetMed(med),param,4);
919 //______________________________________________________________________
920 void AliITSBaseGeometry::TwistedTrapezoid(const char *gnam,
922 Double_t dz,Double_t thet,Double_t phi,
923 Double_t twist,Double_t h1,Double_t bl1,
924 Double_t tl1,Double_t apl1,Double_t h2,
925 Double_t bl2,Double_t tl2,Double_t apl2,
927 // Interface to TMC->Gsvolu() for ITS GTRA geometries. General twisted
928 // trapazoid. The faces perpendicular to z are trapazia and their centers
929 // are not necessarily on a line parallel to the z axis as the TRAP.
930 // Additionally, the faces may be twisted so that none of their edges are
931 // parallel. It is a TRAP shape, exept that it is twisted in the x-y
932 // plane as a function of z. The parallel sides perpendicular to the x
933 // axis are rotated with respect to the x axis by an angle TWIST, which
934 // is one of the parameters. The shape is defined by the eight corners
935 // and is assumed to be constructed of straight lines joingin points on
936 // the boundry of the trapezoidal face at Z=-dz to the coresponding
937 // points on the face at z=+dz. Divisions are not allowed. It has 12
938 // parameters. See SetScale() for units. Default units are geant 3 [cm].
939 // Note: This shape suffers from the same limitations than the TRAP. The
940 // tracking routines assume that the faces are planar, but htis
941 // constraint is not easily expressed in terms of the 12 parameters.
942 // Additionally, no check on th efaces is performed in this case. Users
943 // should avoid to use this shape as much as possible, and if they have
944 // to do so, they should make sure that the faces are really planes.
945 // If this is not the case, the result of the trasport is unpredictable.
946 // To accelerat ethe computations necessary for trasport, 18 additioanl
947 // parameters are calculated for this shape are 1 DXODZ dx/dz of the
948 // line joing the centers of the faces at z=+_dz. 2 DYODZ dy/dz of the
949 // line joing the centers of the faces at z=+_dz.
950 // 3 XO1 x at z=0 for line joing the + on parallel side, perpendicular
951 // corners at z=+_dz.
952 // 4 YO1 y at z=0 for line joing the + on parallel side, + on
953 // perpendicular corners at z=+-dz.
954 // 5 DXDZ1 dx/dz for line joing the + on parallel side, + on
955 // perpendicular corners at z=+-dz.
956 // 6 DYDZ1 dy/dz for line joing the + on parallel side, + on
957 // perpendicular corners at z=+-dz.
958 // 7 X02 x at z=0 for line joing the - on parallel side, + on
959 // perpendicular corners at z=+-dz.
960 // 8 YO2 y at z=0 for line joing the - on parallel side, + on
961 // perpendicular corners at z=+-dz.
962 // 9 DXDZ2 dx/dz for line joing the - on parallel side, + on
963 // perpendicular corners at z=+-dz.
964 // 10 DYDZ2dy/dz for line joing the - on parallel side, + on
965 // perpendicular corners at z=+-dz.
966 // 11 XO3 x at z=0 for line joing the - on parallel side, - on
967 // perpendicular corners at z=+-dz.
968 // 12 YO3 y at z=0 for line joing the - on parallel side, - on
969 // perpendicular corners at z=+-dz.
970 // 13 DXDZ3 dx/dzfor line joing the - on parallel side, - on
971 // perpendicular corners at z=+-dz.
972 // 14 DYDZ3 dydz for line joing the - on parallel side, - on
973 // perpendicular corners at z=+-dz.
974 // 15 XO4 x at z=0 for line joing the + on parallel side, - on
975 // perpendicular corners at z=+-dz.
976 // 16 YO4 y at z=0 for line joing the + on parallel side, - on
977 // perpendicular corners at z=+-dz.
978 // 17 DXDZ4 dx/dz for line joing the + on parallel side, - on
979 // perpendicular corners at z=+-dz.
980 // 18 DYDZ4 dydz for line joing the + on parallel side, - on
981 // perpendicular corners at z=+-dz.
983 // const char *gnam 3 character geant volume name. The letter "I"
984 // is appended to the front to indecate that this
986 // TString &dis String containging part discription.
987 // Double_t dz half-length along the z axis.
988 // Double_t thet polar angle of the line joing the center of the
989 // face at -dz to the center of the one at +dz
991 // Double_t phi Azymuthal angle of teh line joing the centre of
992 // the face at -dz to the center of the one at +dz
994 // Double_t twist Twist angle of the faces parallel to the x-y
995 // plane at z=+-dz around an axis parallel to z
996 // passing through their centre [degrees].
997 // Double_t h1 Half-length along y of the face at -dz.
998 // Double_t bl1 half-length along x of the side -h1 in y of the
1000 // Double_t tl1 half-length along x of the side at +h1 in y of
1001 // the face at -dz in z.
1002 // Double_t apl1 Angle with respect to the y ais from the center
1003 // of the side at -h1 in y to the centere of the
1004 // side at +h1 in y of the face at -dz in z
1006 // Double_t h2 half-length along the face at +dz.
1007 // Double_t bl2 half-length along x of the side at -h2 in y of
1008 // the face at -dz in z.
1009 // Double_t tl2 half-length along x of the side at +h2 in y of
1010 // the face at +dz in z.
1011 // Double_t apl2 angle with respect to the y axis from the
1012 // center of the side at -h2 in y to the center
1013 // of the side at +h2 in y of the face at +dz in
1015 // Int_t med media index number.
1023 param[0] = fScale*dz;
1027 param[4] = fScale*h1;
1028 param[5] = fScale*bl1;
1029 param[6] = fScale*tl1;
1031 param[8] = fScale*h2;
1032 param[9] = fScale*bl2;
1033 param[10] = fScale*tl2;
1036 gMC->Gsvolu(name,"GTRA",GetMed(med),param,12);
1038 //______________________________________________________________________
1039 void AliITSBaseGeometry::CutTube(const char *gnam,const TString &dis,
1040 Double_t rmin,Double_t rmax,Double_t dz,
1041 Double_t phi1,Double_t phi2,Double_t lx,
1042 Double_t ly,Double_t lz,Double_t hx,
1043 Double_t hy,Double_t hz,Int_t med){
1044 // Interface to TMC->Gsvolu() for ITS CTUB geometries. Cut tube. A tube
1045 // cut at the extremities with planes not necessarily perpendicular to
1046 // the z axis. It has 11 parameters. See SetScale() for units. Default
1047 // units are geant 3 [cm]. phi1 should be smaller than phi2. If this is
1048 // not the case, the system adds 360 degrees to phi2.
1050 // const char *gnam 3 character geant volume name. The letter "I"
1051 // is appended to the front to indecate that this
1052 // is an ITS volume.
1053 // TString &dis String containging part discription.
1054 // Double_t rmin Inner radius at z=0 where tube is narrowest.
1055 // Double_t rmax Outer radius at z=0 where tube is narrowest.
1056 // Double_t dz half-length along the z-axis
1057 // Double_t dz half-length along the z-axis
1058 // Double_t phi1 Starting angle of the segment [degree].
1059 // Double_t phi2 Ending angle of the segment [degree].
1060 // Double_t lx x component of a unit vector perpendicular to
1062 // Double_t ly y component of a unit vector perpendicular to
1064 // Double_t lz z component of a unit vector perpendicular to
1066 // Double_t hx x component of a unit vector perpendicular to
1068 // Double_t hy y component of a unit vector perpendicular to
1070 // Double_t hz z component of a unit vector perpendicular to
1072 // Int_t med media index number.
1080 param[0] = fScale*rmin;
1081 param[1] = fScale*rmax;
1082 param[2] = fScale*dz;
1092 gMC->Gsvolu(name,"CTUB",GetMed(med),param,11);
1094 //______________________________________________________________________
1095 void AliITSBaseGeometry::Pos(AliITSBaseVolParams &v,Int_t cn,
1096 AliITSBaseVolParams &m,
1097 TVector3 &t,Int_t irot){
1098 // Place a copy of a volume previously defined by a call to GSVOLU inside
1099 // its mother volulme moth.
1101 // const char vol[3] 3 character geant volume name. The letter "I"
1102 // is appended to the front to indecate that this
1103 // is an ITS volume.
1104 // const char moth[3] 3 character geant volume name of the mother
1105 // volume in which vol will be placed. The letter
1106 // "I" is appended to the front to indecate that
1107 // this is an ITS volume.
1108 // Double_t x The x positon of the volume in the mother's
1110 // Double_t y The y positon of the volume in the mother's
1112 // Double_t z The z positon of the volume in the mother's
1114 // Int_t irot the index for the rotation matrix to be used.
1115 // irot=-1 => unit rotation.
1120 char name[5],mother[5];
1123 char *n = (char*)&r;
1125 param[0] = fScale*t.X();
1126 param[1] = fScale*t.Y();
1127 param[2] = fScale*t.Z();
1128 r = ITSIndexToITSG3name(v.GetVid());
1129 for(i=0;i<4;i++) name[i] = n[i]; name[4] ='\0';
1130 r = ITSIndexToITSG3name(m.GetVid());
1131 for(i=0;i<4;i++) mother[i] = n[i]; mother[4] ='\0';
1132 if(irot>0) r = fidrot[irot]; else r=0;
1133 gMC->Gspos(name,cn,mother,param[0],param[1],param[2],r,"ONLY");
1135 //______________________________________________________________________
1136 void AliITSBaseGeometry::Pos(const char *vol,Int_t cn,const char *moth,
1137 Double_t x,Double_t y,Double_t z,Int_t irot){
1138 // Place a copy of a volume previously defined by a call to GSVOLU inside
1139 // its mother volulme moth.
1141 // const char vol[3] 3 character geant volume name. The letter "I"
1142 // is appended to the front to indecate that this
1143 // is an ITS volume.
1144 // const char moth[3] 3 character geant volume name of the mother
1145 // volume in which vol will be placed. The letter
1146 // "I" is appended to the front to indecate that
1147 // this is an ITS volume.
1148 // Double_t x The x positon of the volume in the mother's
1150 // Double_t y The y positon of the volume in the mother's
1152 // Double_t z The z positon of the volume in the mother's
1154 // Int_t irot the index for the rotation matrix to be used.
1155 // irot=-1 => unit rotation.
1160 char name[5],mother[5];
1164 param[0] = fScale*x;
1165 param[1] = fScale*y;
1166 param[2] = fScale*z;
1168 G3name(moth,mother);
1169 if(irot>0) r = fidrot[irot];
1170 gMC->Gspos(name,cn,mother,param[0],param[1],param[2],r,"ONLY");
1172 //______________________________________________________________________
1173 void AliITSBaseGeometry::Matrix(Int_t irot,Double_t thet1,Double_t phi1,
1174 Double_t thet2,Double_t phi2,
1175 Double_t thet3,Double_t phi3){
1176 // Defines a Geant rotation matrix. checks to see if it is the unit
1177 // matrix. If so, then no additonal matrix is defined. Stores rotation
1178 // matrix irot in the data structure JROTM. If the matrix is not
1179 // orthonormal, it will be corrected by setting y' perpendicular to x'
1180 // and z' = x' X y'. A warning message is printed in this case.
1182 // Int_t irot Intex specifing which rotation matrix.
1183 // Double_t thet1 Polar angle for axisw x [degrees].
1184 // Double_t phi1 azimuthal angle for axis x [degrees].
1185 // Double_t thet12Polar angle for axisw y [degrees].
1186 // Double_t phi2 azimuthal angle for axis y [degrees].
1187 // Double_t thet3 Polar angle for axisw z [degrees].
1188 // Double_t phi3 azimuthal angle for axis z [degrees].
1193 Float_t t1,p1,t2,p2,t3,p3;
1195 if(thet1==90.0&&phi1== 0.0&&
1196 thet2==90.0&&phi2==90.0&&
1197 thet3== 0.0&&phi3== 0.0){
1198 fidrot[irot] = 0; // Unit matrix
1206 fits->AliMatrix(fidrot[irot],t1,p1,t2,p2,t3,p3);
1209 //______________________________________________________________________
1210 void AliITSBaseGeometry::Matrix(Int_t irot,Int_t axis,Double_t thet){
1211 // Defines a Geant rotation matrix. checks to see if it is the unit
1212 // matrix. If so, then no additonal matrix is defined. Stores rotation
1213 // matrix irot in the data structure JROTM. If the matrix is not
1214 // orthonormal, it will be corrected by setting y' perpendicular to x'
1215 // and z' = x' X y'. A warning message is printed in this case.
1217 // Int_t irot Intex specifing which rotation matrix.
1218 // Int_t axis Axis about which rotation is to be done.
1219 // Double_t thet Angle to rotate by [degrees].
1226 fidrot[irot] = 0; // Unit matrix
1229 case 0: //Rotate about x-axis, x-axis does not change.
1230 fits->AliMatrix(fidrot[irot],90.0,0.0,90.0+thet,90.0,thet,90.0);
1232 case 1: //Rotate about y-axis, y-axis does not change.
1233 fits->AliMatrix(fidrot[irot],360.-90.0-thet,0.0,90.0,90.0,
1236 case 2: //Rotate about z-axis, z-axis does not change.
1237 fits->AliMatrix(fidrot[irot],90.0,thet,90.0,360.-thet-90.0,
1241 Error("Matrix","axis must be either 0, 1, or 2. for matrix=%d",
1247 //______________________________________________________________________
1248 void AliITSBaseGeometry::Matrix(Int_t irot,Double_t rot[3][3]){
1249 // Defines a Geant rotation matrix. checks to see if it is the unit
1250 // matrix. If so, then no additonal matrix is defined. Stores rotation
1251 // matrix irot in the data structure JROTM. If the matrix is not
1252 // orthonormal, it will be corrected by setting y' perpendicular to x'
1253 // and z' = x' X y'. A warning message is printed in this case.
1255 // Int_t irot Intex specifing which rotation matrix.
1256 // Double_t rot[3][3] The 3 by 3 rotation matrix.
1262 if(rot[0][0]==1.0&&rot[1][1]==1.0&&rot[2][2]==1.0&&
1263 rot[0][1]==0.0&&rot[0][2]==0.0&&rot[1][0]==0.0&&
1264 rot[1][2]==0.0&&rot[2][0]==0.0&&rot[2][1]==0.0){
1265 fidrot[irot] = 0; // Unit matrix
1267 Double_t si,c=180./TMath::Pi();
1270 ang[1] = TMath::ATan2(rot[0][1],rot[0][0]);
1271 if(TMath::Cos(ang[1])!=0.0) si = rot[0][0]/TMath::Cos(ang[1]);
1272 else si = rot[0][1]/TMath::Sin(ang[1]);
1273 ang[0] = TMath::ATan2(si,rot[0][2]);
1275 ang[3] = TMath::ATan2(rot[1][1],rot[1][0]);
1276 if(TMath::Cos(ang[3])!=0.0) si = rot[1][0]/TMath::Cos(ang[3]);
1277 else si = rot[1][1]/TMath::Sin(ang[3]);
1278 ang[2] = TMath::ATan2(si,rot[1][2]);
1280 ang[5] = TMath::ATan2(rot[2][1],rot[2][0]);
1281 if(TMath::Cos(ang[5])!=0.0) si = rot[2][0]/TMath::Cos(ang[5]);
1282 else si = rot[2][1]/TMath::Sin(ang[5]);
1283 ang[4] = TMath::ATan2(si,rot[2][2]);
1285 for(Int_t i=0;i<6;i++) {ang[i] *= c; if(ang[i]<0.0) ang[i] += 360.;}
1286 fits->AliMatrix(fidrot[irot],ang[0],ang[1],ang[2],ang[3],
1290 //______________________________________________________________________
1291 Float_t AliITSBaseGeometry::GetA(Int_t z){
1292 // Returns the isotopicaly averaged atomic number.
1294 // Int_t z Elemental number
1298 // The atomic mass number.
1300 1.00794 , 4.0026902, 6.941 , 9.012182 , 10.811 , // H-B
1301 12.01007 , 14.00674 , 15.9994 , 18.9984032, 20.1797 , // C-Ne
1302 22.98970 , 24.3050 , 26.981538, 28.0855 , 30.973761, // Na-P
1303 32.066 , 35.4527 , 39.948 , 39.0983 , 40.078 , // S-Ca
1304 44.95591 , 47.867 , 50.9415 , 51.9961 , 54.938049, // Sc-Mn
1305 55.845 , 58.933200 , 58.6934 , 63.546 , 65.39 , // Fe-Zn
1306 69.723 , 72.61 , 74.92160 , 78.96 , 79.904 , // Ga-Br
1307 83.80 , 85.4678 , 87.62 , 88.9085 , 91.224 , // Kr-Zr
1308 92.90638 , 95.94 , 97.907215, 101.07 ,102.90550 , // Nb-Rh
1309 106.42 ,107.8682 ,112.411 ,114.818 ,118.710 , // Pd-Sn
1310 121.760 ,127.60 ,126.90447 ,131.29 ,132.90545 , // Sb-Cs
1311 137.327 ,138.9055 ,140.116 ,140.90765 ,144.24 , // La-Nd
1312 144.912746,150.36 ,151.964 ,157.25 ,158.92534 , // Pm-Tb
1313 162.50 ,164.93032 ,167.26 ,168.93421 ,173.04 , // Dy-Yb
1314 174.967 ,178.49 ,180.9479 ,183.84 ,186.207 , // Lu-Re
1315 190.23 ,192.217 ,195.078 ,196.96655 ,200.59 , // Os-Hg
1316 204.3833 ,207.2 ,208.98038,208.982415 ,209.987131, // Tl-At
1317 222.017570,223.019731 ,226.025402,227.027747 ,232.0381 , // Rn-Th
1318 231.03588 ,238.0289 }; // Pa,U
1321 Error("GetA","z must be 0<z<93. z=%d",z);
1326 //______________________________________________________________________
1327 Float_t AliITSBaseGeometry::GetStandardMaxStepSize(Int_t istd){
1328 // Returns one of a set of standard Maximum Step Size values.
1330 // Int_t istd Index to indecate which standard.
1334 // The appropreate standard Maximum Step Size value [cm].
1335 Float_t t[]={1.0, // default
1336 0.0075, // Silicon detectors...
1337 1.0, // Air in central detectors region
1338 1.0 // Material in non-centeral region
1342 //______________________________________________________________________
1343 Float_t AliITSBaseGeometry::GetStandardThetaMax(Int_t istd){
1344 // Returns one of a set of standard Theata Max values.
1346 // Int_t istd Index to indecate which standard.
1350 // The appropreate standard Theta max value [degrees].
1351 Float_t t[]={0.1, // default
1352 0.1, // Silicon detectors...
1353 0.1, // Air in central detectors region
1354 1.0 // Material in non-centeral region
1358 //______________________________________________________________________
1359 Float_t AliITSBaseGeometry::GetStandardEfraction(Int_t istd){
1360 // Returns one of a set of standard E fraction values.
1362 // Int_t istd Index to indecate which standard.
1366 // The appropreate standard E fraction value [#].
1367 Float_t t[]={0.1, // default
1368 0.1, // Silicon detectors...
1369 0.1, // Air in central detectors region
1370 0.5 // Material in non-centeral region
1374 //______________________________________________________________________
1375 Float_t AliITSBaseGeometry::GetStandardEpsilon(Int_t istd){
1376 // Returns one of the standard Epsilon valuse
1378 // Int_t istd index of standard cuts to get
1382 // Float_t the standard Epsilon cut value.
1383 Float_t t[]={1.0E-4, // default
1384 1.0E-4, // Silicon detectors...
1385 1.0E-4, // Air in central detector region
1386 1.0E-3, // Material in non-cneteral regions
1391 //______________________________________________________________________
1392 void AliITSBaseGeometry::Element(Int_t imat,const char* name,Int_t z,
1393 Double_t dens,Int_t istd){
1394 // Defines a Geant single element material and sets its Geant medium
1395 // proporties. The average atomic A is assumed to be given by their
1396 // natural abundances. Things like the radiation length are calculated
1399 // Int_t imat Material number.
1400 // const char* name Material name. No need to add a $ at the end.
1401 // Int_t z The elemental number.
1402 // Double_t dens The density of the material [g/cm^3].
1403 // Int_t istd Defines which standard set of transport parameters
1404 // which should be used.
1409 Float_t rad,Z,A=GetA(z),tmax,stemax,deemax,epsilon;
1413 len = strlen(name)+1;
1414 name2 = new char[len];
1415 strncpy(name2,name,len-1);
1416 name2[len-1] = '\0';
1419 rad = GetRadLength(z)/dens;
1420 fits->AliMaterial(imat,name2,A,Z,dens,rad,0.0,0,0);
1421 tmax = GetStandardThetaMax(istd); // degree
1422 stemax = GetStandardMaxStepSize(istd); // cm
1423 deemax = GetStandardEfraction(istd); // ratio
1424 epsilon = GetStandardEpsilon(istd); //
1425 fits->AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1426 gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1429 //______________________________________________________________________
1430 void AliITSBaseGeometry::MixtureByWeight(Int_t imat,const char* name,Int_t *z,
1431 Double_t *w,Double_t dens,Int_t n,Int_t istd){
1432 // Defines a Geant material by a set of elements and weights, and sets
1433 // its Geant medium proporties. The average atomic A is assumed to be
1434 // given by their natural abundances. Things like the radiation length
1435 // are calculated for you.
1437 // Int_t imat Material number.
1438 // const char* name Material name. No need to add a $ at the end.
1439 // Int_t *z Array of The elemental numbers.
1440 // Double_t *w Array of relative weights.
1441 // Double_t dens The density of the material [g/cm^3].
1442 // Int_t n the number of elements making up the mixture.
1443 // Int_t istd Defines which standard set of transport parameters
1444 // which should be used.
1449 Float_t *Z,*A,*W,tmax,stemax,deemax,epsilon;
1456 len = strlen(name)+2;
1457 name2 = new char[len];
1458 strncpy(name2,name,len-1);
1459 name2[len-1] = '\0';
1461 for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
1462 W[i] = (Float_t)w[i];}
1463 fits->AliMixture(imat,name2,A,Z,dens,n,W);
1464 tmax = GetStandardThetaMax(istd); // degree
1465 stemax = GetStandardMaxStepSize(istd); // cm
1466 deemax = GetStandardEfraction(istd); // #
1467 epsilon = GetStandardEpsilon(istd);
1468 fits->AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1469 gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1475 //______________________________________________________________________
1476 void AliITSBaseGeometry::MixtureByNumber(Int_t imat,const char* name,Int_t *z,
1477 Int_t *w,Double_t dens,Int_t n,Int_t istd){
1478 // Defines a Geant material by a set of elements and number, and sets
1479 // its Geant medium proporties. The average atomic A is assumed to be
1480 // given by their natural abundances. Things like the radiation length
1481 // are calculated for you.
1483 // Int_t imat Material number.
1484 // const char* name Material name. No need to add a $ at the end.
1485 // Int_t *z Array of The elemental numbers.
1486 // Int_t_t *w Array of relative number.
1487 // Double_t dens The density of the material [g/cm^3].
1488 // Int_t n the number of elements making up the mixture.
1489 // Int_t istd Defines which standard set of transport parameters
1490 // which should be used.
1495 Float_t *Z,*A,*W,tmax,stemax,deemax,epsilon;
1502 len = strlen(name)+1;
1503 name2 = new char[len];
1504 strncpy(name2,name,len-1);
1505 name2[len-1] = '\0';
1507 for(i=0;i<n;i++){Z[i] = (Float_t)z[i];A[i] = (Float_t)GetA(z[i]);
1508 W[i] = (Float_t)w[i];}
1509 fits->AliMixture(imat,name2,A,Z,dens,-n,W);
1510 tmax = GetStandardThetaMax(istd); // degree
1511 stemax = GetStandardMaxStepSize(istd); // cm
1512 deemax = GetStandardEfraction(istd); // #
1513 epsilon = GetStandardEpsilon(istd);
1514 fits->AliMedium(imat,name2,imat,0,gAlice->Field()->Integ(),
1515 gAlice->Field()->Max(),tmax,stemax,deemax,epsilon,0.0);
1521 //______________________________________________________________________
1522 Double_t AliITSBaseGeometry::RadLength(Int_t iz,Double_t a){
1523 // Computes the radiation length in accordance to the PDG 2000 Section
1524 // 23.4.1 p. 166. Transladed from the c code of Flavio Tosello.
1526 // Int_t iz The elemental number
1527 // Dougle_t The elemental average atomic mass number
1530 // Double_t returns the radiation length of the element iz in
1532 Double_t z = (Double_t)iz;
1533 Double_t alphaz = fAlpha*z;
1534 Double_t alphaz2 = alphaz*alphaz;
1535 Double_t c0 = +0.20206,c1 = -0.0369,c2 = +0.0083,c3 = -0.0020;
1536 Double_t z12,z23,l,lp,c;
1538 c = alphaz2*(1./(1.+alphaz2) + c0 + c1*alphaz2 + c2*alphaz2*alphaz2
1539 +c3*alphaz2*alphaz2*alphaz2);
1540 z12 = TMath::Exp(TMath::Log(z)/3.0);
1560 l = TMath::Log(184.15/z12);
1561 lp = TMath::Log(1194.0/z23);
1564 Double_t re2,b,r,xz;
1567 b = 4.0*fAlpha*re2*fNa/a;
1568 r = b*z*(z*(l-c)+lp);
1570 return xz; // [gm/cm^2]
1572 //======================================================================
1573 ClassImp(AliITSPConeData)
1574 //______________________________________________________________________
1575 void AliITSPConeData::Print(ostream *os){
1576 // Prints out the data kept in this class
1578 // ostream *os The output stream pointer
1585 #if defined __GNUC__
1592 #if defined __ICC || defined __ECC
1599 *os << "Volume "<< GetVid() << " Name: " << *GetName() << endl;
1600 *os << "fNz=" << fNz << " fPhi0=" << fPhi0 << " fdPhi=" << fDphi << endl;
1601 *os <<" Z , Rmin , Rmax " << endl;
1602 fmt = os->setf(ios::scientific); // set scientific floating point output
1604 *os << setprecision(16) << fZ[i] <<"\t";
1605 *os << setprecision(16) << fRmin[i] << "\t";
1606 *os << setprecision(16) << fRmax[i] << endl;
1608 os->flags(fmt); // reset back to old formating.
1611 //______________________________________________________________________
1612 void AliITSPConeData::Read(istream *is){
1613 // Read in data kept in this class
1615 // istream *is the input stream
1625 *is >> i; SetVid(i);
1627 *is >> t; SetName(t.Data());
1637 *is >> fZ[i] >> fRmin[i] >> fRmax[i];
1640 //______________________________________________________________________
1641 ostream &operator<<(ostream &os,AliITSPConeData &p){
1642 // Operator << for C++ like output
1644 // ostream &os The output stream
1645 // AliITSPConeData &p The class to be outputed
1649 // ostream &os The output stream
1654 //______________________________________________________________________
1655 istream &operator>>(istream &is,AliITSPConeData &r){
1656 // Operator << for C++ like output
1658 // istream &is The input stream
1659 // AliITSPConeData &r The class to be read in
1663 // istream &is The input stream
1668 //======================================================================
1669 ClassImp(AliITSPGonData)
1670 //______________________________________________________________________
1671 void AliITSPGonData::Print(ostream *os){
1672 // Prints out the data kept in this class
1674 // ostream *os The output stream pointer
1681 #if defined __GNUC__
1688 #if defined __ICC || defined __ECC
1695 *os << "Volume "<< GetVid() << " Name: " << *GetName() << endl;
1696 *os << "fNz=" << fNz << " fNphi=" << fNphi << " fPhi0=" << fPhi0;
1697 *os << " fdPhi=" << fDphi << endl;
1698 *os <<" Z , Rmin , Rmax " << endl;
1699 fmt = os->setf(ios::scientific); // set scientific floating point output
1701 *os << setprecision(16) << fZ[i] <<"\t";
1702 *os << setprecision(16) << fRmin[i] << "\t";
1703 *os << setprecision(16) << fRmax[i] << endl;
1705 os->flags(fmt); // reset back to old formating.
1708 //______________________________________________________________________
1709 void AliITSPGonData::Read(istream *is){
1710 // Read in data kept in this class
1712 // istream *is the input stream
1724 *is >> t; SetName(t.Data());
1738 *is >> fZ[i] >> fRmin[i] >> fRmax[i];
1741 //______________________________________________________________________
1742 ostream &operator<<(ostream &os,AliITSPGonData &p){
1743 // Operator << for C++ like output
1745 // ostream &os The output stream
1746 // AliITSPGonData &p The class to be outputed
1750 // ostream &os The output stream
1755 //______________________________________________________________________
1756 istream &operator>>(istream &is,AliITSPGonData &r){
1757 // Operator << for C++ like output
1759 // istream &is The input stream
1760 // AliITSPGonData &r The class to be read in
1764 // istream &is The input stream
1769 //======================================================================
1770 ClassImp(AliITSTubeData)
1771 //______________________________________________________________________
1772 void AliITSTubeData::Print(ostream *os){
1773 // Prints out the data kept in this class
1775 // ostream *os The output stream pointer
1781 #if defined __GNUC__
1788 #if defined __ICC || defined __ECC
1795 *os << "Volume "<< GetVid() << " Name: " << *GetName() << endl;
1796 *os <<" Z , Rmin , Rmax " << endl;
1797 fmt = os->setf(ios::scientific); // set scientific floating point output
1798 *os << setprecision(16) << fDz <<"\t";
1799 *os << setprecision(16) << fRmin << "\t";
1800 *os << setprecision(16) << fRmax << endl;
1801 os->flags(fmt); // reset back to old formating.
1804 //______________________________________________________________________
1805 void AliITSTubeData::Read(istream *is){
1806 // Read in data kept in this class
1808 // istream *is the input stream
1820 *is >> t; SetName(t.Data());
1823 *is >> fDz >> fRmin >> fRmax;
1825 //______________________________________________________________________
1826 ostream &operator<<(ostream &os,AliITSTubeData &p){
1827 // Operator << for C++ like output
1829 // ostream &os The output stream
1830 // AliITSTubeData &p The class to be outputed
1834 // ostream &os The output stream
1839 //______________________________________________________________________
1840 istream &operator>>(istream &is,AliITSTubeData &r){
1841 // Operator << for C++ like output
1843 // istream &is The input stream
1844 // AliITSTubeData &r The class to be read in
1848 // istream &is The input stream