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.1 2003/02/10 17:03:52 nilsen
19 New version and structure of ITS V11 geometry. Work still in progress.
26 A base geometry class defining all of the ITS volumes that make up an ITS
30 Created February 2003.
33 #include <Riostream.h>
38 #include <TGeometry.h>
43 #include <TFile.h> // only required for Tracking function?
45 #include <TObjArray.h>
46 #include <TLorentzVector.h>
47 #include <TObjString.h>
48 #include <TClonesArray.h>
54 #include "AliITSBaseGeometry.h"
56 ClassImp(AliITSBaseGeometry)
58 Int_t AliITSBaseGeometry::fNCreates = 0;
59 Int_t* AliITSBaseGeometry::fidrot = 0;
60 Int_t AliITSBaseGeometry::fidrotsize = 0;
61 Int_t AliITSBaseGeometry::fidrotlast = 0;
62 Int_t AliITSBaseGeometry::fVolNameSize = 0;
63 Int_t AliITSBaseGeometry::fVolNameLast = 0;
64 TString* AliITSBaseGeometry::fVolName = 0;
66 //______________________________________________________________________
67 AliITSBaseGeometry::AliITSBaseGeometry(){
68 // Default construtor for the ITS Base Geometry class.
76 fScale = 1.0; // Default value.
77 fits = 0; // zero pointers.
78 if(fNCreates==0){ // only for very first init
80 fNCreates++; // incrament this creation counter.
82 //______________________________________________________________________
83 AliITSBaseGeometry::AliITSBaseGeometry(AliModule *its,Int_t iflag){
84 // Standard construtor for the ITS Base Geometry class.
86 // Int_t iflag flag to indecate specific swiches in the geometry
92 fScale = 1.0; // Default value.
93 fits = its; // get a copy of the pointer to the ITS.
94 if(fNCreates==0){ // only for very first init
95 fidrotsize = ITSG3VnameToIndex("TSV")+1;
96 fidrot = new Int_t[fidrotsize];
99 fNCreates++; // incrament this creation counter.
101 //______________________________________________________________________
102 AliITSBaseGeometry::~AliITSBaseGeometry(){
103 // Standeard destructor for the ITS Base Geometry class.
105 // Int_t iflag flag to indecate specific swiches in the geometry
111 fits = 0; // This class does not own this class. It contaitns a pointer
112 // to it for conveniance.
114 if(fNCreates==0){ // Now delete the static members
117 for(i=0;i<fVolNameLast;i++) delete fVolName[i];
123 fidrotsize = fidrotlast = 0;
126 //______________________________________________________________________
127 Int_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.
134 // const TString name Volume name to be added to the list.
138 // The index where this volume name is stored.
141 if(fVolName==0){ // must create array.
142 fVolNameSize = 38624;
143 fVolName = new TString[fVolNameSize];
146 for(i=0;i<fVolNameLast;i++) if(fVolName[i].CompareTo(name)==0){ // Error
147 Error("AddVolName","Volume name already exists for volume %d name %s",
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];
159 i=ITSIndexToITSG3name(fVolNameLast);
160 if(strcmp((char*)(&i),"ITSV")==0){
161 // Special Reserved Geant 3 volumen name. Skip it
162 // fill it with explination for conveniance.
163 fVolName[fVolNameLast] = "ITS Master Mother Volume";
166 fVolName[fVolNameLast] = name;
168 return fVolNameLast-1; // return the index
170 //______________________________________________________________________
171 Int_t AliITSBaseGeometry::ITSIndexToITSG3name(const Int_t i){
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
178 // const Int_t i the ITS volume index
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
188 Byte_t *a = (Byte_t*) &k;
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.
203 //______________________________________________________________________
204 Int_t AliITSBaseGeometry::ITSG3VnameToIndex(const char *name)const{
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
211 // const char name[3] The last three characters of the ITS Geant3
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
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,
228 i += (Int_t)((name[j]-'A'+rangen)*TMath::Power((Double_t)range,
232 //______________________________________________________________________
233 TString 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.
238 // const Int_t i Index
242 // A TString contianing the ITS volume name.
244 if(i<0||i>=fVolNameLast){
245 Error("GetVolName","Index=%d out of range but be witin 0<%d",i,
251 //______________________________________________________________________
252 Int_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.
256 // const TString &a Name of volume for which index is wanted.
260 // Int_t Index corresponding the volume a. If not found -1 is returned.
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());
267 //______________________________________________________________________
268 void AliITSBaseGeometry::Box(const char *gnam,const TString &dis,
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].
274 // const char *gnam 3 character geant volume name. The letter "I"
275 // is appended to the front to indecate that this
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.
289 param[0] = fScale*dx;
290 param[1] = fScale*dy;
291 param[2] = fScale*dz;
293 gMC->Gsvolu(name,"BOX ",GetMed(med),param,3);
295 //______________________________________________________________________
296 void AliITSBaseGeometry::Trapezoid1(const char *gnam,const TString &dis,
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].
303 // const char *gnam 3 character geant volume name. The letter "I"
304 // is appended to the front to indecate that this
306 // TString &dis String containging part discription.
307 // Double_t dxn half-length along x at the z surface positioned
309 // Double_t dxp half-length along x at the z surface positioned
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.
321 param[0] = fScale*dxn;
322 param[1] = fScale*dxp;
323 param[2] = fScale*dy;
324 param[3] = fScale*dz;
326 gMC->Gsvolu(name,"TRD1",GetMed(med),param,4);
328 //______________________________________________________________________
329 void AliITSBaseGeometry::Trapezoid2(const char *gnam,const TString &dis,
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].
336 // const char *gnam 3 character geant volume name. The letter "I"
337 // is appended to the front to indecate that this
339 // TString &dis String containging part discription.
340 // Double_t dxn half-length along x at the z surface positioned
342 // Double_t dxp half-length along x at the z surface positioned
344 // Double_t dyn half-length along x at the z surface positioned
346 // Double_t dyp half-length along x at the z surface positioned
348 // Double_t dz half-length along the z-axis
349 // Int_t med media index number.
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;
363 gMC->Gsvolu(name,"TRD2",GetMed(med),param,5);
365 //______________________________________________________________________
366 void AliITSBaseGeometry::Trapezoid(const char *gnam,const TString &dis,
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
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].
380 // const char *gnam 3 character geant volume name. The letter "I"
381 // is appended to the front to indecate that this
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
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
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.
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
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.
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
409 // Int_t med media index number.
417 param[0] = fScale*dz;
420 param[3] = fScale*h1;
421 param[4] = fScale*bl1;
422 param[5] = fScale*tl1;
424 param[7] = fScale*h2;
425 param[8] = fScale*bl2;
426 param[9] = fScale*tl2;
429 gMC->Gsvolu(name,"TRAP",GetMed(med),param,11);
431 //______________________________________________________________________
432 void AliITSBaseGeometry::Tube(const char *gnam,const TString &dis,
433 Double_t rmin,Double_t rmax,Double_t dz,
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].
439 // const char *gnam 3 character geant volume name. The letter "I"
440 // is appended to the front to indecate that this
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.
454 param[0] = fScale*rmin;
455 param[1] = fScale*rmax;
456 param[2] = fScale*dz;
458 gMC->Gsvolu(name,"TUBE",GetMed(med),param,3);
460 //______________________________________________________________________
461 void 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].
466 // AliITSTubeData Structure with the tube parameters
467 // Int_t med media index number.
475 char *j = (char *) &k;
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];
484 gMC->Gsvolu(name,"TUBE",GetMed(med),param,3);
486 //______________________________________________________________________
487 void AliITSBaseGeometry::TubeSegment(const char *gnam,const TString &dis,
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
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()
493 // for units. Default units are geant 3 [cm].
495 // const char *gnam 3 character geant volume name. The letter "I"
496 // is appended to the front to indecate that this
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.
512 param[0] = fScale*rmin;
513 param[1] = fScale*rmax;
514 param[2] = fScale*dz;
518 gMC->Gsvolu(name,"TUBS",GetMed(med),param,5);
520 //______________________________________________________________________
521 void AliITSBaseGeometry::Cone(const char *gnam,const TString &dis,
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].
528 // const char *gnam 3 character geant volume name. The letter "I"
529 // is appended to the front to indecate that this
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.
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;
551 gMC->Gsvolu(name,"CONS",GetMed(med),param,5);
553 //______________________________________________________________________
554 void 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){
559 // Interface to TMC->Gsvolu() for ITS ConS geometries. One segment of a
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
562 // SetScale() for units. Default units are geant 3 [cm].
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.
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.
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;
591 gMC->Gsvolu(name,"CONS",GetMed(med),param,7);
593 //______________________________________________________________________
594 void AliITSBaseGeometry::Sphere(const char *gnam,const TString &dis,
595 Double_t rmin,Double_t rmax,Double_t the1,
596 Double_t the2,Double_t phi1,Double_t phi2,
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].
602 // const char *gnam 3 character geant volume name. The letter "I"
603 // is appended to the front to indecate that this
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.
620 param[0] = fScale*rmin;
621 param[1] = fScale*rmax;
627 gMC->Gsvolu(name,"SPHE",GetMed(med),param,6);
629 //______________________________________________________________________
630 void AliITSBaseGeometry::Parallelepiped(const char *gnam,const TString &dis,
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
638 // const char *gnam 3 character geant volume name. The letter "I"
639 // is appended to the front to indecate that this
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].
650 // Double_t phi azimuthal angle of teh line joing the centers
651 // of the faaces at -dz and +dz in z [degree].
652 // Int_t med media index number.
660 param[0] = fScale*dx;
661 param[1] = fScale*dy;
662 param[2] = fScale*dz;
667 gMC->Gsvolu(name,"PARA",GetMed(med),param,6);
669 //______________________________________________________________________
670 void AliITSBaseGeometry::PolyGon(const char *gnam,const TString &dis,
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
675 // parameters or more. See SetScale() for units. Default units are geant
678 // const char *gnam 3 character geant volume name. The letter "I"
679 // is appended to the front to indecate that this
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].
686 // Int_t npdv the number of sides of teh cross section
687 // between the given phi limits.
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
696 // Double_t *rmax array [nz] of radius of the circle tangent to
697 // the sides of the outer polygon in the
699 // Int_t med media index number.
709 param = new Float_t[n];
712 param[2] = (Float_t)npdv;
713 param[3] = (Float_t)nz;
715 param[4+3*i] = fScale*z[i];
716 param[5+3*i] = fScale*rmin[i];
717 param[6+3*i] = fScale*rmax[i];
720 gMC->Gsvolu(name,"PGON",GetMed(med),param,n);
724 //______________________________________________________________________
725 void 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
730 // AliITSPGonData &d Object with poly cone data stored in it.
731 // Int_t med media index number.
739 char *j = (char *) &k;
742 param = new Float_t[n];
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);
752 d.SetVid(AddVolName((d.GetName())->Data()));
753 k = ITSIndexToITSG3name(d.GetVid());
754 for(i=0;i<4;i++) name[i] = j[i];
756 gMC->Gsvolu(name,"PGON",GetMed(med),param,n);
760 //______________________________________________________________________
761 void AliITSBaseGeometry::PolyCone(const char *gnam,const TString &dis,
762 Double_t phi1,Double_t dphi,Int_t nz,
763 Double_t *z,Double_t *rmin,Double_t *rmax,
765 // Interface to TMC->Gsvolu() for ITS PCON geometry. Poly-cone It has 9
766 // parameters or more. See SetScale() for units. Default units are geant
769 // const char *gnam 3 character geant volume name. The letter "I"
770 // is appended to the front to indecate that this
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
784 // Double_t *rmax Array [nz] of radius of the outer circle in the
786 // Int_t med media index number.
796 param = new Float_t[n];
799 param[2] = (Float_t) nz;
801 param[3+3*i] = fScale*z[i];
802 param[4+3*i] = fScale*rmin[i];
803 param[5+3*i] = fScale*rmax[i];
806 gMC->Gsvolu(name,"PCON",GetMed(med),param,n);
810 //______________________________________________________________________
811 void 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
816 // AliITSPConeData &d Object with poly cone data stored in it.
817 // Int_t med media index number.
825 char *j = (char *) &k;
828 param = new Float_t[n];
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);
837 d.SetVid(AddVolName((d.GetName())->Data()));
838 k = ITSIndexToITSG3name(d.GetVid());
839 for(i=0;i<4;i++) name[i] = j[i];
841 gMC->Gsvolu(name,"PCON",GetMed(med),param,n);
845 //______________________________________________________________________
846 void AliITSBaseGeometry::TubeElliptical(const char *gnam,const TString &dis,
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.
853 // const char *gnam 3 character geant volume name. The letter "I"
854 // is appended to the front to indecate that this
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.
868 param[0] = fScale*p1;
869 param[1] = fScale*p2;
870 param[2] = fScale*dz;
872 gMC->Gsvolu(name,"ELTU",GetMed(med),param,3);
874 //______________________________________________________________________
875 void AliITSBaseGeometry::HyperbolicTube(const char *gnam,const TString &dis,
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.
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
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.
885 // const char *gnam 3 character geant volume name. The letter "I"
886 // is appended to the front to indecate that this
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
894 // Int_t med media index number.
902 param[0] = fScale*rmin;
903 param[1] = fScale*rmax;
904 param[2] = fScale*dz;
907 gMC->Gsvolu(name,"HYPE",GetMed(med),param,4);
909 //______________________________________________________________________
910 void AliITSBaseGeometry::TwistedTrapezoid(const char *gnam,
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,
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
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.
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.
973 // const char *gnam 3 character geant volume name. The letter "I"
974 // is appended to the front to indecate that this
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
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
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
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
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.
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
1005 // Int_t med media index number.
1013 param[0] = fScale*dz;
1017 param[4] = fScale*h1;
1018 param[5] = fScale*bl1;
1019 param[6] = fScale*tl1;
1021 param[8] = fScale*h2;
1022 param[9] = fScale*bl2;
1023 param[10] = fScale*tl2;
1026 gMC->Gsvolu(name,"GTRA",GetMed(med),param,12);
1028 //______________________________________________________________________
1029 void AliITSBaseGeometry::CutTube(const char *gnam,const TString &dis,
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){
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.
1040 // const char *gnam 3 character geant volume name. The letter "I"
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
1052 // Double_t ly y component of a unit vector perpendicular to
1054 // Double_t lz z component of a unit vector perpendicular to
1056 // Double_t hx x component of a unit vector perpendicular to
1058 // Double_t hy y component of a unit vector perpendicular to
1060 // Double_t hz z component of a unit vector perpendicular to
1062 // Int_t med media index number.
1070 param[0] = fScale*rmin;
1071 param[1] = fScale*rmax;
1072 param[2] = fScale*dz;
1082 gMC->Gsvolu(name,"CTUB",GetMed(med),param,11);
1084 //______________________________________________________________________
1085 void AliITSBaseGeometry::Pos(AliITSBaseVolParams &v,Int_t cn,
1086 AliITSBaseVolParams &m,
1087 TVector3 &t,Int_t irot){
1088 // Place a copy of a volume previously defined by a call to GSVOLU inside
1089 // its mother volulme moth.
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.
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.
1098 // Double_t x The x positon of the volume in the mother's
1100 // Double_t y The y positon of the volume in the mother's
1102 // Double_t z The z positon of the volume in the mother's
1104 // Int_t irot the index for the rotation matrix to be used.
1105 // irot=-1 => unit rotation.
1110 char name[5],mother[5];
1113 char *n = (char*)&r;
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");
1125 //______________________________________________________________________
1126 void 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.
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
1140 // Double_t y The y positon of the volume in the mother's
1142 // Double_t z The z positon of the volume in the mother's
1144 // Int_t irot the index for the rotation matrix to be used.
1145 // irot=-1 => unit rotation.
1150 char name[5],mother[5];
1154 param[0] = fScale*x;
1155 param[1] = fScale*y;
1156 param[2] = fScale*z;
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");
1162 //______________________________________________________________________
1163 void 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.
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].
1183 Float_t t1,p1,t2,p2,t3,p3;
1185 if(thet1==90.0&&phi1== 0.0&&
1186 thet2==90.0&&phi2==90.0&&
1187 thet3== 0.0&&phi3== 0.0){
1188 fidrot[irot] = 0; // Unit matrix
1196 fits->AliMatrix(fidrot[irot],t1,p1,t2,p2,t3,p3);
1199 //______________________________________________________________________
1200 void 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.
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].
1216 fidrot[irot] = 0; // Unit matrix
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);
1222 case 1: //Rotate about y-axis, y-axis does not change.
1223 fits->AliMatrix(fidrot[irot],360.-90.0-thet,0.0,90.0,90.0,
1226 case 2: //Rotate about z-axis, z-axis does not change.
1227 fits->AliMatrix(fidrot[irot],90.0,thet,90.0,360.-thet-90.0,
1231 Error("Matrix","axis must be either 0, 1, or 2. for matrix=%d",
1237 //______________________________________________________________________
1238 void 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.
1245 // Int_t irot Intex specifing which rotation matrix.
1246 // Double_t rot[3][3] The 3 by 3 rotation matrix.
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
1257 Double_t si,c=180./TMath::Pi();
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]);
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]);
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]);
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],
1280 //______________________________________________________________________
1281 Float_t AliITSBaseGeometry::GetA(Int_t z){
1282 // Returns the isotopicaly averaged atomic number.
1284 // Int_t z Elemental number
1288 // The atomic mass number.
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
1311 Error("GetA","z must be 0<z<93. z=%d",z);
1316 //______________________________________________________________________
1317 Float_t AliITSBaseGeometry::GetStandardMaxStepSize(Int_t istd){
1318 // Returns one of a set of standard Maximum Step Size values.
1320 // Int_t istd Index to indecate which standard.
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
1332 //______________________________________________________________________
1333 Float_t AliITSBaseGeometry::GetStandardThetaMax(Int_t istd){
1334 // Returns one of a set of standard Theata Max values.
1336 // Int_t istd Index to indecate which standard.
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
1348 //______________________________________________________________________
1349 Float_t AliITSBaseGeometry::GetStandardEfraction(Int_t istd){
1350 // Returns one of a set of standard E fraction values.
1352 // Int_t istd Index to indecate which standard.
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
1364 //______________________________________________________________________
1365 Float_t AliITSBaseGeometry::GetStandardEpsilon(Int_t istd){
1366 // Returns one of the standard Epsilon valuse
1368 // Int_t istd index of standard cuts to get
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
1381 //______________________________________________________________________
1382 void 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
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.
1399 Float_t rad,Z,A=GetA(z),tmax,stemax,deemax,epsilon;
1403 len = strlen(name)+1;
1404 name2 = new char[len];
1405 strncpy(name2,name,len-1);
1406 name2[len-1] = '\0';
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);
1419 //______________________________________________________________________
1420 void 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.
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.
1439 Float_t *Z,*A,*W,tmax,stemax,deemax,epsilon;
1446 len = strlen(name)+2;
1447 name2 = new char[len];
1448 strncpy(name2,name,len-1);
1449 name2[len-1] = '\0';
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);
1465 //______________________________________________________________________
1466 void 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.
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.
1485 Float_t *Z,*A,*W,tmax,stemax,deemax,epsilon;
1492 len = strlen(name)+1;
1493 name2 = new char[len];
1494 strncpy(name2,name,len-1);
1495 name2[len-1] = '\0';
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);
1511 //______________________________________________________________________
1512 Double_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.
1516 // Int_t iz The elemental number
1517 // Dougle_t The elemental average atomic mass number
1520 // Double_t returns the radiation length of the element iz in
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;
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);
1550 l = TMath::Log(184.15/z12);
1551 lp = TMath::Log(1194.0/z23);
1554 Double_t re2,b,r,xz;
1557 b = 4.0*fAlpha*re2*fNa/a;
1558 r = b*z*(z*(l-c)+lp);
1560 return xz; // [gm/cm^2]
1562 //======================================================================
1563 ClassImp(AliITSPConeData)
1564 //______________________________________________________________________
1565 void AliITSPConeData::Print(ostream *os){
1566 // Prints out the data kept in this class
1568 // ostream *os The output stream pointer
1575 #if defined __GNUC__
1582 #if defined __ICC || defined __ECC
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
1594 *os << setprecision(16) << fZ[i] <<" ";
1595 *os << setprecision(16) << fRmin[i] << " ";
1596 *os << setprecision(16) << fRmax[i] << endl;
1598 os->flags(fmt); // reset back to old formating.
1601 //______________________________________________________________________
1602 void AliITSPConeData::Read(istream *is){
1603 // Read in data kept in this class
1605 // istream *is the input stream
1615 *is >> i; SetVid(i);
1617 *is >> t; SetName(t.Data());
1627 *is >> fZ[i] >> fRmin[i] >> fRmax[i];
1630 //______________________________________________________________________
1631 ostream &operator<<(ostream &os,AliITSPConeData &p){
1632 // Operator << for C++ like output
1634 // ostream &os The output stream
1635 // AliITSPConeData &p The class to be outputed
1639 // ostream &os The output stream
1644 //______________________________________________________________________
1645 istream &operator>>(istream &is,AliITSPConeData &r){
1646 // Operator << for C++ like output
1648 // istream &is The input stream
1649 // AliITSPConeData &r The class to be read in
1653 // istream &is The input stream
1658 //======================================================================
1659 ClassImp(AliITSPGonData)
1660 //______________________________________________________________________
1661 void AliITSPGonData::Print(ostream *os){
1662 // Prints out the data kept in this class
1664 // ostream *os The output stream pointer
1671 #if defined __GNUC__
1678 #if defined __ICC || defined __ECC
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
1691 *os << setprecision(16) << fZ[i] <<" ";
1692 *os << setprecision(16) << fRmin[i] << " ";
1693 *os << setprecision(16) << fRmax[i] << endl;
1695 os->flags(fmt); // reset back to old formating.
1698 //______________________________________________________________________
1699 void AliITSPGonData::Read(istream *is){
1700 // Read in data kept in this class
1702 // istream *is the input stream
1714 *is >> t; SetName(t.Data());
1728 *is >> fZ[i] >> fRmin[i] >> fRmax[i];
1731 //______________________________________________________________________
1732 ostream &operator<<(ostream &os,AliITSPGonData &p){
1733 // Operator << for C++ like output
1735 // ostream &os The output stream
1736 // AliITSPGonData &p The class to be outputed
1740 // ostream &os The output stream
1745 //______________________________________________________________________
1746 istream &operator>>(istream &is,AliITSPGonData &r){
1747 // Operator << for C++ like output
1749 // istream &is The input stream
1750 // AliITSPGonData &r The class to be read in
1754 // istream &is The input stream
1759 //======================================================================
1760 ClassImp(AliITSTubeData)
1761 //______________________________________________________________________
1762 void AliITSTubeData::Print(ostream *os){
1763 // Prints out the data kept in this class
1765 // ostream *os The output stream pointer
1771 #if defined __GNUC__
1778 #if defined __ICC || defined __ECC
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.
1794 //______________________________________________________________________
1795 void AliITSTubeData::Read(istream *is){
1796 // Read in data kept in this class
1798 // istream *is the input stream
1810 *is >> t; SetName(t.Data());
1813 *is >> fDz >> fRmin >> fRmax;
1815 //______________________________________________________________________
1816 ostream &operator<<(ostream &os,AliITSTubeData &p){
1817 // Operator << for C++ like output
1819 // ostream &os The output stream
1820 // AliITSTubeData &p The class to be outputed
1824 // ostream &os The output stream
1829 //______________________________________________________________________
1830 istream &operator>>(istream &is,AliITSTubeData &r){
1831 // Operator << for C++ like output
1833 // istream &is The input stream
1834 // AliITSTubeData &r The class to be read in
1838 // istream &is The input stream