1 ///////////////////////////////////////////////////////////////////////////////
3 // Interface Class to the Geant3.21 MonteCarlo //
7 <img src="gif/TGeant3Class.gif">
12 ///////////////////////////////////////////////////////////////////////////////
18 #include "AliCallf77.h"
21 # define gzebra gzebra_
22 # define grfile grfile_
23 # define gpcxyz gpcxyz_
24 # define ggclos ggclos_
27 # define gcinit gcinit_
30 # define gtrigc gtrigc_
31 # define gtrigi gtrigi_
33 # define gzinit gzinit_
34 # define gfmate gfmate_
35 # define gfpart gfpart_
36 # define gftmed gftmed_
40 # define gsmate gsmate_
41 # define gsmixt gsmixt_
42 # define gspart gspart_
43 # define gstmed gstmed_
44 # define gsckov gsckov_
45 # define gstpar gstpar_
46 # define gfkine gfkine_
47 # define gfvert gfvert_
48 # define gskine gskine_
49 # define gsvert gsvert_
50 # define gphysi gphysi_
51 # define gdebug gdebug_
52 # define gekbin gekbin_
53 # define gfinds gfinds_
54 # define gsking gsking_
55 # define gskpho gskpho_
56 # define gsstak gsstak_
58 # define gtrack gtrack_
59 # define gtreve gtreve_
61 # define grndmq grndmq_
63 # define glmoth glmoth_
64 # define gmedia gmedia_
67 # define gsdvn2 gsdvn2_
69 # define gsdvs2 gsdvs2_
71 # define gsdvt2 gsdvt2_
74 # define gsposp gsposp_
75 # define gsrotm gsrotm_
76 # define gprotm gprotm_
77 # define gsvolu gsvolu_
78 # define gprint gprint_
79 # define gdinit gdinit_
82 # define gdrayt gdrayt_
83 # define gdrawc gdrawc_
84 # define gdrawx gdrawx_
85 # define gdhead gdhead_
86 # define gdwmn1 gdwmn1_
87 # define gdwmn2 gdwmn2_
88 # define gdwmn3 gdwmn3_
90 # define gdcxyz gdcxyz_
92 # define gdspec gdspec_
93 # define gdtree gdtree_
94 # define gdelet gdelet_
95 # define gdclos gdclos_
96 # define gdshow gdshow_
97 # define gdopen gdopen_
98 # define dzshow dzshow_
100 # define gfpara gfpara_
101 # define gckpar gckpar_
102 # define gckmat gckmat_
103 # define geditv geditv_
104 # define mzdrop mzdrop_
106 # define setbomb setbomb_
107 # define setclip setclip_
108 # define gcomad gcomad_
111 # define gzebra GZEBRA
112 # define grfile GRFILE
113 # define gpcxyz GPCXYZ
114 # define ggclos GGCLOS
117 # define gcinit GCINIT
120 # define gtrigc GTRIGC
121 # define gtrigi GTRIGI
123 # define gzinit GZINIT
124 # define gfmate GFMATE
125 # define gfpart GFPART
126 # define gftmed GFTMED
130 # define gsmate GSMATE
131 # define gsmixt GSMIXT
132 # define gspart GSPART
133 # define gstmed GSTMED
134 # define gsckov GSCKOV
135 # define gstpar GSTPAR
136 # define gfkine GFKINE
137 # define gfvert GFVERT
138 # define gskine GSKINE
139 # define gsvert GSVERT
140 # define gphysi GPHYSI
141 # define gdebug GDEBUG
142 # define gekbin GEKBIN
143 # define gfinds GFINDS
144 # define gsking GSKING
145 # define gskpho GSKPHO
146 # define gsstak GSSTAK
148 # define gtrack GTRACK
149 # define gtreve GTREVE
151 # define grndmq GRNDMQ
153 # define glmoth GLMOTH
154 # define gmedia GMEDIA
157 # define gsdvn2 GSDVN2
159 # define gsdvs2 GSDVS2
161 # define gsdvt2 GSDVT2
164 # define gsposp GSPOSP
165 # define gsrotm GSROTM
166 # define gprotm GPROTM
167 # define gsvolu GSVOLU
168 # define gprint GPRINT
169 # define gdinit GDINIT
172 # define gdrayt GDRAYT
173 # define gdrawc GDRAWC
174 # define gdrawx GDRAWX
175 # define gdhead GDHEAD
176 # define gdwmn1 GDWMN1
177 # define gdwmn2 GDWMN2
178 # define gdwmn3 GDWMN3
180 # define gdcxyz GDCXYZ
182 # define gdfspc GDFSPC
183 # define gdspec GDSPEC
184 # define gdtree GDTREE
185 # define gdelet GDELET
186 # define gdclos GDCLOS
187 # define gdshow GDSHOW
188 # define gdopen GDOPEN
189 # define dzshow DZSHOW
191 # define gfpara GFPARA
192 # define gckpar GCKPAR
193 # define gckmat GCKMAT
194 # define geditv GEDITV
195 # define mzdrop MZDROP
197 # define setbomb SETBOMB
198 # define setclip SETCLIP
199 # define gcomad GCOMAD
203 //____________________________________________________________________________
207 // Prototypes for GEANT functions
209 void type_of_call gzebra(const int&);
211 void type_of_call gpcxyz();
213 void type_of_call ggclos();
215 void type_of_call glast();
217 void type_of_call ginit();
219 void type_of_call gcinit();
221 void type_of_call grun();
223 void type_of_call gtrig();
225 void type_of_call gtrigc();
227 void type_of_call gtrigi();
229 void type_of_call gwork(const int&);
231 void type_of_call gzinit();
233 void type_of_call gmate();
235 void type_of_call gpart();
237 void type_of_call gsdk(Int_t &, Float_t *, Int_t *);
239 void type_of_call gfkine(Int_t &, Float_t *, Float_t *, Int_t &,
240 Int_t &, Float_t *, Int_t &);
242 void type_of_call gfvert(Int_t &, Float_t *, Int_t &, Int_t &,
243 Float_t &, Float_t *, Int_t &);
245 void type_of_call gskine(Float_t *,Int_t &, Int_t &, Float_t *,
248 void type_of_call gsvert(Float_t *,Int_t &, Int_t &, Float_t *,
251 void type_of_call gphysi();
253 void type_of_call gdebug();
255 void type_of_call gekbin();
257 void type_of_call gfinds();
259 void type_of_call gsking(Int_t &);
261 void type_of_call gskpho(Int_t &);
263 void type_of_call gsstak(Int_t &);
265 void type_of_call gsxyz();
267 void type_of_call gtrack();
269 void type_of_call gtreve();
271 void type_of_call grndm(Float_t *, const Int_t &);
273 void type_of_call grndmq(Int_t &, Int_t &, const Int_t &,
276 void type_of_call gdtom(Float_t *, Float_t *, Int_t &);
278 void type_of_call glmoth(DEFCHARD, Int_t &, Int_t &, Int_t *,
279 Int_t *, Int_t * DEFCHARL);
281 void type_of_call gmedia(Float_t *, Int_t &);
283 void type_of_call gmtod(Float_t *, Float_t *, Int_t &);
285 void type_of_call gsrotm(const Int_t &, const Float_t &, const Float_t &,
286 const Float_t &, const Float_t &, const Float_t &,
289 void type_of_call gprotm(const Int_t &);
291 void type_of_call grfile(const Int_t&, DEFCHARD,
292 DEFCHARD DEFCHARL DEFCHARL);
294 void type_of_call gfmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
295 Float_t &, Float_t &, Float_t &, Float_t *,
298 void type_of_call gfpart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
299 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
301 void type_of_call gftmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
302 Float_t &, Float_t &, Float_t &, Float_t &,
303 Float_t &, Float_t &, Float_t *, Int_t * DEFCHARL);
305 void type_of_call gsmate(const Int_t&, DEFCHARD, Float_t &, Float_t &,
306 Float_t &, Float_t &, Float_t &, Float_t *,
309 void type_of_call gsmixt(const Int_t&, DEFCHARD, Float_t *, Float_t *,
310 Float_t &, Int_t &, Float_t * DEFCHARL);
312 void type_of_call gspart(const Int_t&, DEFCHARD, Int_t &, Float_t &,
313 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
316 void type_of_call gstmed(const Int_t&, DEFCHARD, Int_t &, Int_t &, Int_t &,
317 Float_t &, Float_t &, Float_t &, Float_t &,
318 Float_t &, Float_t &, Float_t *, Int_t & DEFCHARL);
320 void type_of_call gsckov(Int_t &itmed, Int_t &npckov, Float_t *ppckov,
321 Float_t *absco, Float_t *effic, Float_t *rindex);
322 void type_of_call gstpar(const Int_t&, DEFCHARD, Float_t & DEFCHARL);
324 void type_of_call gsdvn(DEFCHARD,DEFCHARD, Int_t &, Int_t &
327 void type_of_call gsdvn2(DEFCHARD,DEFCHARD, Int_t &, Int_t &, Float_t &,
328 Int_t & DEFCHARL DEFCHARL);
330 void type_of_call gsdvs(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &
333 void type_of_call gsdvs2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t &,
334 Int_t & DEFCHARL DEFCHARL);
336 void type_of_call gsdvt(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Int_t &,
337 Int_t & DEFCHARL DEFCHARL);
339 void type_of_call gsdvt2(DEFCHARD,DEFCHARD, Float_t &, Int_t &, Float_t&,
340 Int_t &, Int_t & DEFCHARL DEFCHARL);
342 void type_of_call gsord(DEFCHARD, Int_t & DEFCHARL);
344 void type_of_call gspos(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
345 Float_t &, Int_t &, DEFCHARD DEFCHARL DEFCHARL
348 void type_of_call gsposp(DEFCHARD, Int_t &, DEFCHARD, Float_t &, Float_t &,
349 Float_t &, Int_t &, DEFCHARD,
350 Float_t *, Int_t & DEFCHARL DEFCHARL DEFCHARL);
352 void type_of_call gsvolu(DEFCHARD, DEFCHARD, Int_t &, Float_t *, Int_t &,
353 Int_t & DEFCHARL DEFCHARL);
355 void type_of_call gsatt(DEFCHARD, DEFCHARD, Int_t & DEFCHARL DEFCHARL);
357 void type_of_call gfpara(DEFCHARD , Int_t&, Int_t&, Int_t&, Int_t&, Float_t*,
360 void type_of_call gckpar(Int_t&, Int_t&, Float_t*);
362 void type_of_call gckmat(Int_t&, DEFCHARD DEFCHARL);
364 void type_of_call gprint(DEFCHARD,const int& DEFCHARL);
366 void type_of_call gdinit();
368 void type_of_call gdopt(DEFCHARD,DEFCHARD DEFCHARL DEFCHARL);
370 void type_of_call gdraw(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
371 Float_t &, Float_t &, Float_t & DEFCHARL);
372 void type_of_call gdrayt(DEFCHARD,Float_t &,Float_t &, Float_t &,Float_t &,
373 Float_t &, Float_t &, Float_t & DEFCHARL);
374 void type_of_call gdrawc(DEFCHARD,Int_t &, Float_t &, Float_t &, Float_t &,
375 Float_t &, Float_t & DEFCHARL);
376 void type_of_call gdrawx(DEFCHARD,Float_t &, Float_t &, Float_t &, Float_t &,
377 Float_t &, Float_t &, Float_t &, Float_t &,
379 void type_of_call gdhead(Int_t &,DEFCHARD, Float_t & DEFCHARL);
380 void type_of_call gdxyz(Int_t &);
381 void type_of_call gdcxyz();
382 void type_of_call gdman(Float_t &, Float_t &);
383 void type_of_call gdwmn1(Float_t &, Float_t &);
384 void type_of_call gdwmn2(Float_t &, Float_t &);
385 void type_of_call gdwmn3(Float_t &, Float_t &);
386 void type_of_call gdspec(DEFCHARD DEFCHARL);
387 void type_of_call gdfspc(DEFCHARD, Int_t &, Int_t & DEFCHARL) {;}
388 void type_of_call gdtree(DEFCHARD, Int_t &, Int_t & DEFCHARL);
390 void type_of_call gdopen(Int_t &);
391 void type_of_call gdclos();
392 void type_of_call gdelet(Int_t &);
393 void type_of_call gdshow(Int_t &);
394 void type_of_call geditv(Int_t &) {;}
397 void type_of_call dzshow(DEFCHARD,const int&,const int&,DEFCHARD,const int&,
398 const int&, const int&, const int& DEFCHARL
401 void type_of_call mzdrop(Int_t&, Int_t&, DEFCHARD DEFCHARL);
403 void type_of_call setbomb(Float_t &);
404 void type_of_call setclip(DEFCHARD, Float_t &,Float_t &,Float_t &,Float_t &,
405 Float_t &, Float_t & DEFCHARL);
406 void type_of_call gcomad(DEFCHARD, Int_t*& DEFCHARL);
410 // Geant3 global pointer
412 static Int_t defSize = 600;
416 //____________________________________________________________________________
417 TGeant3::TGeant3() : AliMC()
420 // Default constructor
424 //____________________________________________________________________________
425 TGeant3::TGeant3(const char *title, Int_t nwgeant)
426 :AliMC("TGeant3",title)
429 // Standard constructor for TGeant3 with ZEBRA initialisation
440 // Load Address of Geant3 commons
444 //____________________________________________________________________________
445 Int_t TGeant3::CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens,
446 Float_t &radl, Float_t &absl) const
449 // Return the parameters of the current material during transport
453 dens = fGcmate->dens;
454 radl = fGcmate->radl;
455 absl = fGcmate->absl;
456 return 1; //this could be the number of elements in mixture
459 //____________________________________________________________________________
460 void TGeant3::DefaultRange()
463 // Set range of current drawing pad to 20x20 cm
469 higz->Range(0,0,20,20);
472 //____________________________________________________________________________
473 void TGeant3::InitHIGZ()
484 //____________________________________________________________________________
485 void TGeant3::LoadAddress()
488 // Assigns the address of the GEANT common blocks to the structures
489 // that allow their access from C++
492 gcomad(PASSCHARD("QUEST"), (int*&) fQuest PASSCHARL("QUEST"));
493 gcomad(PASSCHARD("GCBANK"),(int*&) fGcbank PASSCHARL("GCBANK"));
494 gcomad(PASSCHARD("GCLINK"),(int*&) fGclink PASSCHARL("GCLINK"));
495 gcomad(PASSCHARD("GCCUTS"),(int*&) fGccuts PASSCHARL("GCCUTS"));
496 gcomad(PASSCHARD("GCFLAG"),(int*&) fGcflag PASSCHARL("GCFLAG"));
497 gcomad(PASSCHARD("GCKINE"),(int*&) fGckine PASSCHARL("GCKINE"));
498 gcomad(PASSCHARD("GCKING"),(int*&) fGcking PASSCHARL("GCKING"));
499 gcomad(PASSCHARD("GCKIN2"),(int*&) fGckin2 PASSCHARL("GCKIN2"));
500 gcomad(PASSCHARD("GCKIN3"),(int*&) fGckin3 PASSCHARL("GCKIN3"));
501 gcomad(PASSCHARD("GCMATE"),(int*&) fGcmate PASSCHARL("GCMATE"));
502 gcomad(PASSCHARD("GCTMED"),(int*&) fGctmed PASSCHARL("GCTMED"));
503 gcomad(PASSCHARD("GCTRAK"),(int*&) fGctrak PASSCHARL("GCTRAK"));
504 gcomad(PASSCHARD("GCTPOL"),(int*&) fGctpol PASSCHARL("GCTPOL"));
505 gcomad(PASSCHARD("GCVOLU"),(int*&) fGcvolu PASSCHARL("GCVOLU"));
506 gcomad(PASSCHARD("GCNUM"), (int*&) fGcnum PASSCHARL("GCNUM"));
507 gcomad(PASSCHARD("GCSETS"),(int*&) fGcsets PASSCHARL("GCSETS"));
508 gcomad(PASSCHARD("GCPHYS"),(int*&) fGcphys PASSCHARL("GCPHYS"));
509 gcomad(PASSCHARD("GCOPTI"),(int*&) fGcopti PASSCHARL("GCOPTI"));
510 gcomad(PASSCHARD("GCTLIT"),(int*&) fGctlit PASSCHARL("GCTLIT"));
511 gcomad(PASSCHARD("GCVDMA"),(int*&) fGcvdma PASSCHARL("GCVDMA"));
513 gcomad(PASSCHARD("IQ"), addr PASSCHARL("IQ"));
515 gcomad(PASSCHARD("LQ"), addr PASSCHARL("LQ"));
520 //_____________________________________________________________________________
521 void TGeant3::GeomIter()
524 // Geometry iterator for moving upward in the geometry tree
525 // Initialise the iterator
527 fNextVol=fGcvolu->nlevel;
530 //____________________________________________________________________________
531 Int_t TGeant3::NextVolUp(Text_t *name, Int_t ©)
534 // Geometry iterator for moving upward in the geometry tree
535 // Return next volume up
540 gname=fGcvolu->names[fNextVol];
541 strncpy(name,(char *) &gname, 4);
543 copy=fGcvolu->number[fNextVol];
544 i=fGcvolu->lvolum[fNextVol];
545 if(gname == fZiq[fGclink->jvolum+i]) return i;
546 else printf("GeomTree: Volume %s not found in bank\n",name);
551 //_____________________________________________________________________________
552 Int_t TGeant3::CurrentVol(Text_t *name, Int_t ©) const
555 // Returns the current volume ID, name and copy number
556 // if name=0 no name is returned
559 if( (i=fGcvolu->nlevel-1) < 0 ) {
560 printf("CurrentVol: stack depth %d\n",fGcvolu->nlevel);
562 gname=fGcvolu->names[i];
564 strncpy(name,(char *) &gname, 4);
567 copy=fGcvolu->number[i];
568 i=fGcvolu->lvolum[i];
569 if(gname == fZiq[fGclink->jvolum+i]) return i;
570 else printf("CurrentVol: Volume %s not found in bank\n",name);
575 //_____________________________________________________________________________
576 Int_t TGeant3::CurrentVolOff(Int_t off, Text_t *name, Int_t ©) const
579 // Return the current volume "off" upward in the geometrical tree
580 // ID, name and copy number
581 // if name=0 no name is returned
584 if( (i=fGcvolu->nlevel-off-1) < 0 ) {
585 printf("CurrentVolOff: Offset requested %d but stack depth %d\n",off,fGcvolu->nlevel);
587 gname=fGcvolu->names[i];
589 strncpy(name,(char *) &gname, 4);
592 copy=fGcvolu->number[i];
593 i=fGcvolu->lvolum[i];
594 if(gname == fZiq[fGclink->jvolum+i]) return i;
595 else printf("CurrentVolOff: Volume %s not found in bank\n",name);
600 //_____________________________________________________________________________
601 Int_t TGeant3::VolId(Text_t *name) const
604 // Return the unique numeric identifier for volume name
607 strncpy((char *) &gname, name, 4);
608 for(i=1; i<=fGcnum->nvolum; i++)
609 if(gname == fZiq[fGclink->jvolum+i]) return i;
610 printf("VolId: Volume %s not found\n",name);
614 //_____________________________________________________________________________
615 Int_t TGeant3::NofVolumes() const
618 // Return total number of volumes in the geometry
620 return fGcnum->nvolum;
623 //_____________________________________________________________________________
624 const char* TGeant3::VolName(Int_t id) const
627 // Return the volume name given the volume identifier
630 if(id<1 || id > fGcnum->nvolum || fGclink->jvolum<=0)
633 strncpy(name,(char *)&fZiq[fGclink->jvolum+id],4);
638 //_____________________________________________________________________________
639 void TGeant3::TrackPosition(Float_t *xyz) const
642 // Return the current position in the master reference frame of the
643 // track being transported
645 xyz[0]=fGctrak->vect[0];
646 xyz[1]=fGctrak->vect[1];
647 xyz[2]=fGctrak->vect[2];
650 //_____________________________________________________________________________
651 Float_t TGeant3::TrackTime() const
654 // Return the current time of flight of the track being transported
656 return fGctrak->tofg;
659 //_____________________________________________________________________________
660 void TGeant3::TrackMomentum(Float_t *xyz) const
663 // Return the direction and the momentum (GeV/c) of the track
664 // currently being transported
666 xyz[0]=fGctrak->vect[3];
667 xyz[1]=fGctrak->vect[4];
668 xyz[2]=fGctrak->vect[5];
669 xyz[3]=fGctrak->vect[6];
672 //_____________________________________________________________________________
673 Float_t TGeant3::TrackCharge() const
676 // Return charge of the track currently transported
678 return fGckine->charge;
681 //_____________________________________________________________________________
682 Float_t TGeant3::TrackMass() const
685 // Return the mass of the track currently transported
687 return fGckine->amass;
690 //_____________________________________________________________________________
691 Int_t TGeant3::TrackPid() const
694 // Return the id of the particle transported
696 return fGckine->ipart;
699 //_____________________________________________________________________________
700 Float_t TGeant3::TrackStep() const
703 // Return the length in centimeters of the current step
705 return fGctrak->step;
708 //_____________________________________________________________________________
709 Float_t TGeant3::TrackLength() const
712 // Return the length of the current track from its origin
714 return fGctrak->sleng;
717 //_____________________________________________________________________________
718 Bool_t TGeant3::TrackInside() const
721 // True if the track is not at the boundary of the current volume
723 return (fGctrak->inwvol==0);
726 //_____________________________________________________________________________
727 Bool_t TGeant3::TrackEntering() const
730 // True if this is the first step of the track in the current volume
732 return (fGctrak->inwvol==1);
735 //_____________________________________________________________________________
736 Bool_t TGeant3::TrackExiting() const
739 // True if this is the last step of the track in the current volume
741 return (fGctrak->inwvol==2);
744 //_____________________________________________________________________________
745 Bool_t TGeant3::TrackOut() const
748 // True if the track is out of the setup
750 return (fGctrak->inwvol==3);
753 //_____________________________________________________________________________
754 Bool_t TGeant3::TrackStop() const
757 // True if the track energy has fallen below the threshold
759 return (fGctrak->istop==2);
762 //_____________________________________________________________________________
763 Int_t TGeant3::NSecondaries() const
766 // Number of secondary particles generated in the current step
768 return fGcking->ngkine;
771 //_____________________________________________________________________________
772 Int_t TGeant3::CurrentEvent() const
775 // Number of the current event
777 return fGcflag->idevt;
780 //_____________________________________________________________________________
781 void TGeant3::ProdProcess(char* proc) const
784 // Name of the process that has produced the secondary particles
785 // in the current step
787 const Int_t ipmec[13] = { 5,6,7,8,9,10,11,12,21,23,25,105,108 };
790 if(fGcking->ngkine>0) {
791 for (km = 0; km < fGctrak->nmec; ++km) {
792 for (im = 0; im < 13; ++im) {
793 if (fGctrak->lmec[km] == ipmec[im]) {
794 mec = fGctrak->lmec[km];
795 if (0 < mec && mec < 31) {
796 strncpy(proc,(char *)&fGctrak->namec[mec - 1],4);
797 } else if (mec - 100 <= 30 && mec - 100 > 0) {
798 strncpy(proc,(char *)&fGctpol->namec1[mec - 101],4);
806 } else strcpy(proc,"NONE");
809 //_____________________________________________________________________________
810 void TGeant3::GetSecondary(Int_t isec, Int_t& ipart, Float_t* x, Float_t* p)
813 // Get the parameters of the secondary track number isec produced
814 // in the current step
817 if(-1<isec && isec<fGcking->ngkine) {
818 ipart=Int_t (fGcking->gkin[isec][4] +0.5);
820 x[i]=fGckin3->gpos[isec][i];
821 p[i]=fGcking->gkin[isec][i];
823 x[3]=fGcking->tofd[isec];
824 p[3]=fGcking->gkin[isec][3];
826 printf(" * TGeant3::GetSecondary * Secondary %d does not exist\n",isec);
827 x[0]=x[1]=x[2]=x[3]=p[0]=p[1]=p[2]=p[3]=0;
832 //_____________________________________________________________________________
833 void TGeant3::InitLego()
836 SetDEBU(0,0,0); //do not print a message
839 //_____________________________________________________________________________
840 Bool_t TGeant3::TrackDisappear() const
843 // True if the current particle has disappered
844 // either because it decayed or because it underwent
845 // an inelastic collision
847 return (fGctrak->istop==1);
850 //_____________________________________________________________________________
851 Bool_t TGeant3::TrackAlive() const
854 // True if the current particle is alive and will continue to be
857 return (fGctrak->istop==0);
860 //_____________________________________________________________________________
861 void TGeant3::StopTrack()
864 // Stop the transport of the current particle and skip to the next
869 //_____________________________________________________________________________
870 void TGeant3::StopEvent()
873 // Stop simulation of the current event and skip to the next
878 //_____________________________________________________________________________
879 Float_t TGeant3::MaxStep() const
882 // Return the maximum step length in the current medium
884 return fGctmed->stemax;
887 //_____________________________________________________________________________
888 void TGeant3::SetColors()
891 // Set the colors for all the volumes
892 // this is done sequentially for all volumes
893 // based on the number of their medium
896 Int_t jvolum=fGclink->jvolum;
897 //Int_t jtmed=fGclink->jtmed;
898 //Int_t jmate=fGclink->jmate;
899 Int_t nvolum=fGcnum->nvolum;
902 // Now for all the volumes
903 for(kv=1;kv<=nvolum;kv++) {
904 // Get the tracking medium
905 Int_t itm=Int_t (fZq[fZlq[jvolum-kv]+4]);
907 //Int_t ima=Int_t (fZq[fZlq[jtmed-itm]+6]);
909 //Float_t z=fZq[fZlq[jmate-ima]+7];
911 //icol = Int_t(z)%6+2;
912 //icol = 17+Int_t(z*150./92.);
915 strncpy(name,(char*)&fZiq[jvolum+kv],4);
917 Gsatt(name,"COLO",icol);
921 //_____________________________________________________________________________
922 void TGeant3::SetMaxStep(Float_t maxstep)
925 // Set the maximum step allowed till the particle is in the current medium
927 fGctmed->stemax=maxstep;
930 //_____________________________________________________________________________
931 void TGeant3::SetMaxNStep(Int_t maxnstp)
934 // Set the maximum number of steps till the particle is in the current medium
936 fGctrak->maxnst=maxnstp;
939 //_____________________________________________________________________________
940 Int_t TGeant3::GetMaxNStep() const
943 // Maximum number of steps allowed in current medium
945 return fGctrak->maxnst;
948 //_____________________________________________________________________________
949 void TGeant3::Material(Int_t& kmat, const char* name, Float_t a, Float_t z,
950 Float_t dens, Float_t radl, Float_t absl, Float_t* buf,
954 // Defines a Material
956 // kmat number assigned to the material
957 // name material name
958 // a atomic mass in au
960 // dens density in g/cm3
961 // absl absorbtion length in cm
962 // if >=0 it is ignored and the program
963 // calculates it, if <0. -absl is taken
964 // radl radiation length in cm
965 // if >=0 it is ignored and the program
966 // calculates it, if <0. -radl is taken
967 // buf pointer to an array of user words
968 // nbuf number of user words
970 Int_t jmate=fGclink->jmate;
976 for(i=1; i<=ns; i++) {
977 if(fZlq[jmate-i]==0) {
983 gsmate(kmat,PASSCHARD(name), a, z, dens, radl, absl, buf,
984 nwbuf PASSCHARL(name));
987 //_____________________________________________________________________________
988 void TGeant3::Mixture(Int_t& kmat, const char* name, Float_t* a, Float_t* z,
989 Float_t dens, Int_t nlmat, Float_t* wmat)
992 // Defines mixture OR COMPOUND IMAT as composed by
993 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
995 // If NLMAT > 0 then wmat contains the proportion by
996 // weights of each basic material in the mixture.
998 // If nlmat < 0 then WMAT contains the number of atoms
999 // of a given kind into the molecule of the COMPOUND
1000 // In this case, WMAT in output is changed to relative
1003 Int_t jmate=fGclink->jmate;
1009 for(i=1; i<=ns; i++) {
1010 if(fZlq[jmate-i]==0) {
1016 gsmixt(kmat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1019 //_____________________________________________________________________________
1020 void TGeant3::Medium(Int_t& kmed, const char* name, Int_t nmat, Int_t isvol,
1021 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1022 Float_t stemax, Float_t deemax, Float_t epsil,
1023 Float_t stmin, Float_t* ubuf, Int_t nbuf)
1026 // kmed tracking medium number assigned
1027 // name tracking medium name
1028 // nmat material number
1029 // isvol sensitive volume flag
1030 // ifield magnetic field
1031 // fieldm max. field value (kilogauss)
1032 // tmaxfd max. angle due to field (deg/step)
1033 // stemax max. step allowed
1034 // deemax max. fraction of energy lost in a step
1035 // epsil tracking precision (cm)
1036 // stmin min. step due to continuos processes (cm)
1038 // ifield = 0 if no magnetic field; ifield = -1 if user decision in guswim;
1039 // ifield = 1 if tracking performed with grkuta; ifield = 2 if tracking
1040 // performed with ghelix; ifield = 3 if tracking performed with ghelx3.
1042 Int_t jtmed=fGclink->jtmed;
1048 for(i=1; i<=ns; i++) {
1049 if(fZlq[jtmed-i]==0) {
1055 gstmed(kmed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1056 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1059 //_____________________________________________________________________________
1060 void TGeant3::Matrix(Int_t& krot, Float_t thex, Float_t phix, Float_t they,
1061 Float_t phiy, Float_t thez, Float_t phiz)
1064 // krot rotation matrix number assigned
1065 // theta1 polar angle for axis i
1066 // phi1 azimuthal angle for axis i
1067 // theta2 polar angle for axis ii
1068 // phi2 azimuthal angle for axis ii
1069 // theta3 polar angle for axis iii
1070 // phi3 azimuthal angle for axis iii
1072 // it defines the rotation matrix number irot.
1074 Int_t jrotm=fGclink->jrotm;
1080 for(i=1; i<=ns; i++) {
1081 if(fZlq[jrotm-i]==0) {
1087 gsrotm(krot, thex, phix, they, phiy, thez, phiz);
1090 //_____________________________________________________________________________
1091 void TGeant3::GetParticle(const Int_t ipart, char *name, Float_t &mass) const
1094 // Return name and mass of particle code ipart
1095 // Geant321 conventions
1098 Int_t jpart=fGclink->jpart;
1099 Int_t jpa=fZlq[jpart-ipart];
1101 for(Int_t i=1; i<6; i++) hname[i-1]=fZiq[jpa+i];
1103 strncpy(name,(char *)hname, 21);
1107 //_____________________________________________________________________________
1108 Int_t TGeant3::GetMedium() const
1111 // Return the number of the current medium
1113 return fGctmed->numed;
1116 //_____________________________________________________________________________
1117 Float_t TGeant3::Edep() const
1120 // Return the energy lost in the current step
1122 return fGctrak->destep;
1125 //_____________________________________________________________________________
1126 Float_t TGeant3::Etot() const
1129 // Return the total energy of the current track
1131 return fGctrak->getot;
1134 //_____________________________________________________________________________
1135 void TGeant3::Rndm(Float_t* r, const Int_t n) const
1138 // Return an array of n random numbers uniformly distributed
1139 // between 0 and 1 not included
1144 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1146 // Functions from GBASE
1148 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1150 //____________________________________________________________________________
1151 void TGeant3::Gfile(const char *filename, const char *option)
1154 // Routine to open a GEANT/RZ data base.
1156 // LUN logical unit number associated to the file
1158 // CHFILE RZ file name
1160 // CHOPT is a character string which may be
1161 // N To create a new file
1162 // U to open an existing file for update
1163 // " " to open an existing file for read only
1164 // Q The initial allocation (default 1000 records)
1165 // is given in IQUEST(10)
1166 // X Open the file in exchange format
1167 // I Read all data structures from file to memory
1168 // O Write all data structures from memory to file
1171 // If options "I" or "O" all data structures are read or
1172 // written from/to file and the file is closed.
1173 // See routine GRMDIR to create subdirectories
1174 // See routines GROUT,GRIN to write,read objects
1176 grfile(21, PASSCHARD(filename), PASSCHARD(option) PASSCHARL(filename)
1180 //____________________________________________________________________________
1181 void TGeant3::Gpcxyz()
1184 // Print track and volume parameters at current point
1189 //_____________________________________________________________________________
1190 void TGeant3::Ggclos()
1193 // Closes off the geometry setting.
1194 // Initializes the search list for the contents of each
1195 // volume following the order they have been positioned, and
1196 // inserting the content '0' when a call to GSNEXT (-1) has
1197 // been required by the user.
1198 // Performs the development of the JVOLUM structure for all
1199 // volumes with variable parameters, by calling GGDVLP.
1200 // Interprets the user calls to GSORD, through GGORD.
1201 // Computes and stores in a bank (next to JVOLUM mother bank)
1202 // the number of levels in the geometrical tree and the
1203 // maximum number of contents per level, by calling GGNLEV.
1204 // Sets status bit for CONCAVE volumes, through GGCAVE.
1205 // Completes the JSET structure with the list of volume names
1206 // which identify uniquely a given physical detector, the
1207 // list of bit numbers to pack the corresponding volume copy
1208 // numbers, and the generic path(s) in the JVOLUM tree,
1209 // through the routine GHCLOS.
1214 //_____________________________________________________________________________
1215 void TGeant3::Glast()
1218 // Finish a Geant run
1223 //_____________________________________________________________________________
1224 void TGeant3::Gprint(const char *name)
1227 // Routine to print data structures
1228 // CHNAME name of a data structure
1232 gprint(PASSCHARD(vname),0 PASSCHARL(vname));
1235 //_____________________________________________________________________________
1236 void TGeant3::Grun()
1239 // Steering function to process one run
1244 //_____________________________________________________________________________
1245 void TGeant3::Gtrig()
1248 // Steering function to process one event
1253 //_____________________________________________________________________________
1254 void TGeant3::Gtrigc()
1257 // Clear event partition
1262 //_____________________________________________________________________________
1263 void TGeant3::Gtrigi()
1266 // Initialises event partition
1271 //_____________________________________________________________________________
1272 void TGeant3::Gwork(Int_t nwork)
1275 // Allocates workspace in ZEBRA memory
1280 //_____________________________________________________________________________
1281 void TGeant3::Gzinit()
1284 // To initialise GEANT/ZEBRA data structures
1289 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1291 // Functions from GCONS
1293 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1295 //_____________________________________________________________________________
1296 void TGeant3::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
1297 Float_t &dens, Float_t &radl, Float_t &absl,
1298 Float_t* ubuf, Int_t& nbuf)
1301 // Return parameters for material IMAT
1303 gfmate(imat, PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1307 //_____________________________________________________________________________
1308 void TGeant3::Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
1309 Float_t &amass, Float_t &charge, Float_t &tlife)
1312 // Return parameters for particle of type IPART
1316 gfpart(ipart, PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1320 //_____________________________________________________________________________
1321 void TGeant3::Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
1322 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
1323 Float_t &stemax, Float_t &deemax, Float_t &epsil,
1324 Float_t &stmin, Float_t *ubuf, Int_t *nbuf)
1327 // Return parameters for tracking medium NUMED
1329 gftmed(numed, PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1330 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1333 //_____________________________________________________________________________
1334 void TGeant3::Gmate()
1337 // Define standard GEANT materials
1342 //_____________________________________________________________________________
1343 void TGeant3::Gpart()
1346 // Define standard GEANT particles plus selected decay modes
1347 // and branching ratios.
1352 //_____________________________________________________________________________
1353 void TGeant3::Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode)
1355 // Defines branching ratios and decay modes for standard
1357 gsdk(ipart,bratio,mode);
1360 //_____________________________________________________________________________
1361 void TGeant3::Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
1362 Float_t dens, Float_t radl, Float_t absl)
1365 // Defines a Material
1367 // kmat number assigned to the material
1368 // name material name
1369 // a atomic mass in au
1371 // dens density in g/cm3
1372 // absl absorbtion length in cm
1373 // if >=0 it is ignored and the program
1374 // calculates it, if <0. -absl is taken
1375 // radl radiation length in cm
1376 // if >=0 it is ignored and the program
1377 // calculates it, if <0. -radl is taken
1378 // buf pointer to an array of user words
1379 // nbuf number of user words
1383 gsmate(imat,PASSCHARD(name), a, z, dens, radl, absl, ubuf, nbuf
1387 //_____________________________________________________________________________
1388 void TGeant3::Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
1389 Float_t dens, Int_t nlmat, Float_t *wmat)
1392 // Defines mixture OR COMPOUND IMAT as composed by
1393 // THE BASIC NLMAT materials defined by arrays A,Z and WMAT
1395 // If NLMAT.GT.0 then WMAT contains the PROPORTION BY
1396 // WEIGTHS OF EACH BASIC MATERIAL IN THE MIXTURE.
1398 // If NLMAT.LT.0 then WMAT contains the number of atoms
1399 // of a given kind into the molecule of the COMPOUND
1400 // In this case, WMAT in output is changed to relative
1403 gsmixt(imat,PASSCHARD(name), a, z,dens, nlmat,wmat PASSCHARL(name));
1406 //_____________________________________________________________________________
1407 void TGeant3::Gspart(Int_t ipart, const char *name, Int_t itrtyp,
1408 Float_t amass, Float_t charge, Float_t tlife)
1411 // Store particle parameters
1413 // ipart particle code
1414 // name particle name
1415 // itrtyp transport method (see GEANT manual)
1416 // amass mass in GeV/c2
1417 // charge charge in electron units
1418 // tlife lifetime in seconds
1422 gspart(ipart,PASSCHARD(name), itrtyp, amass, charge, tlife, ubuf, nbuf
1426 //_____________________________________________________________________________
1427 void TGeant3::Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
1428 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
1429 Float_t stemax, Float_t deemax, Float_t epsil,
1433 // NTMED Tracking medium number
1434 // NAME Tracking medium name
1435 // NMAT Material number
1436 // ISVOL Sensitive volume flag
1437 // IFIELD Magnetic field
1438 // FIELDM Max. field value (Kilogauss)
1439 // TMAXFD Max. angle due to field (deg/step)
1440 // STEMAX Max. step allowed
1441 // DEEMAX Max. fraction of energy lost in a step
1442 // EPSIL Tracking precision (cm)
1443 // STMIN Min. step due to continuos processes (cm)
1445 // IFIELD = 0 if no magnetic field; IFIELD = -1 if user decision in GUSWIM;
1446 // IFIELD = 1 if tracking performed with GRKUTA; IFIELD = 2 if tracking
1447 // performed with GHELIX; IFIELD = 3 if tracking performed with GHELX3.
1451 gstmed(numed,PASSCHARD(name), nmat, isvol, ifield, fieldm, tmaxfd, stemax,
1452 deemax, epsil, stmin, ubuf, nbuf PASSCHARL(name));
1455 //_____________________________________________________________________________
1456 void TGeant3::Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
1457 Float_t *absco, Float_t *effic, Float_t *rindex)
1460 // Stores the tables for UV photon tracking in medium ITMED
1461 // Please note that it is the user's responsability to
1462 // provide all the coefficients:
1465 // ITMED Tracking medium number
1466 // NPCKOV Number of bins of each table
1467 // PPCKOV Value of photon momentum (in GeV)
1468 // ABSCO Absorbtion coefficients
1469 // dielectric: absorbtion length in cm
1470 // metals : absorbtion fraction (0<=x<=1)
1471 // EFFIC Detection efficiency for UV photons
1472 // RINDEX Refraction index (if=0 metal)
1474 gsckov(itmed,npckov,ppckov,absco,effic,rindex);
1477 //_____________________________________________________________________________
1478 void TGeant3::Gstpar(Int_t itmed, const char *param, Float_t parval)
1481 // To change the value of cut or mechanism "CHPAR"
1482 // to a new value PARVAL for tracking medium ITMED
1483 // The data structure JTMED contains the standard tracking
1484 // parameters (CUTS and flags to control the physics processes) which
1485 // are used by default for all tracking media. It is possible to
1486 // redefine individually with GSTPAR any of these parameters for a
1487 // given tracking medium.
1488 // ITMED tracking medium number
1489 // CHPAR is a character string (variable name)
1490 // PARVAL must be given as a floating point.
1492 gstpar(itmed,PASSCHARD(param), parval PASSCHARL(param));
1495 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1497 // Functions from GCONS
1499 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1501 //_____________________________________________________________________________
1502 void TGeant3::Gfkine(Int_t itra, Float_t *vert, Float_t *pvert, Int_t &ipart,
1505 // Storing/Retrieving Vertex and Track parameters
1506 // ----------------------------------------------
1508 // Stores vertex parameters.
1509 // VERT array of (x,y,z) position of the vertex
1510 // NTBEAM beam track number origin of the vertex
1511 // =0 if none exists
1512 // NTTARG target track number origin of the vertex
1513 // UBUF user array of NUBUF floating point numbers
1515 // NVTX new vertex number (=0 in case of error).
1516 // Prints vertex parameters.
1517 // IVTX for vertex IVTX.
1518 // (For all vertices if IVTX=0)
1519 // Stores long life track parameters.
1520 // PLAB components of momentum
1521 // IPART type of particle (see GSPART)
1522 // NV vertex number origin of track
1523 // UBUF array of NUBUF floating point user parameters
1525 // NT track number (if=0 error).
1526 // Retrieves long life track parameters.
1527 // ITRA track number for which parameters are requested
1528 // VERT vector origin of the track
1529 // PVERT 4 momentum components at the track origin
1530 // IPART particle type (=0 if track ITRA does not exist)
1531 // NVERT vertex number origin of the track
1532 // UBUF user words stored in GSKINE.
1533 // Prints initial track parameters.
1534 // ITRA for track ITRA
1535 // (For all tracks if ITRA=0)
1539 gfkine(itra,vert,pvert,ipart,nvert,ubuf,nbuf);
1542 //_____________________________________________________________________________
1543 void TGeant3::Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg,
1547 // Retrieves the parameter of a vertex bank
1548 // Vertex is generated from tracks NTBEAM NTTARG
1549 // NVTX is the new vertex number
1553 gfvert(nvtx,v,ntbeam,nttarg,tofg,ubuf,nbuf);
1556 //_____________________________________________________________________________
1557 Int_t TGeant3::Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *buf,
1561 // Store kinematics of track NT into data structure
1562 // Track is coming from vertex NV
1565 gskine(plab, ipart, nv, buf, nwbuf, nt);
1569 //_____________________________________________________________________________
1570 Int_t TGeant3::Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf,
1574 // Creates a new vertex bank
1575 // Vertex is generated from tracks NTBEAM NTTARG
1576 // NVTX is the new vertex number
1579 gsvert(v, ntbeam, nttarg, ubuf, nwbuf, nwtx);
1583 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1585 // Functions from GPHYS
1587 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1589 //_____________________________________________________________________________
1590 void TGeant3::Gphysi()
1593 // Initialise material constants for all the physics
1594 // mechanisms used by GEANT
1599 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1601 // Functions from GTRAK
1603 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1605 //_____________________________________________________________________________
1606 void TGeant3::Gdebug()
1609 // Debug the current step
1614 //_____________________________________________________________________________
1615 void TGeant3::Gekbin()
1618 // To find bin number in kinetic energy table
1619 // stored in ELOW(NEKBIN)
1624 //_____________________________________________________________________________
1625 void TGeant3::Gfinds()
1628 // Returns the set/volume parameters corresponding to
1629 // the current space point in /GCTRAK/
1630 // and fill common /GCSETS/
1632 // IHSET user set identifier
1633 // IHDET user detector identifier
1634 // ISET set number in JSET
1635 // IDET detector number in JS=LQ(JSET-ISET)
1636 // IDTYPE detector type (1,2)
1637 // NUMBV detector volume numbers (array of length NVNAME)
1638 // NVNAME number of volume levels
1643 //_____________________________________________________________________________
1644 void TGeant3::Gsking(Int_t igk)
1647 // Stores in stack JSTAK either the IGKth track of /GCKING/,
1648 // or the NGKINE tracks when IGK is 0.
1653 //_____________________________________________________________________________
1654 void TGeant3::Gskpho(Int_t igk)
1657 // Stores in stack JSTAK either the IGKth Cherenkov photon of
1658 // /GCKIN2/, or the NPHOT tracks when IGK is 0.
1663 //_____________________________________________________________________________
1664 void TGeant3::Gsstak(Int_t iflag)
1667 // Stores in auxiliary stack JSTAK the particle currently
1668 // described in common /GCKINE/.
1670 // On request, creates also an entry in structure JKINE :
1672 // 0 : No entry in JKINE structure required (user)
1673 // 1 : New entry in JVERTX / JKINE structures required (user)
1674 // <0 : New entry in JKINE structure at vertex -IFLAG (user)
1675 // 2 : Entry in JKINE structure exists already (from GTREVE)
1680 //_____________________________________________________________________________
1681 void TGeant3::Gsxyz()
1684 // Store space point VECT in banks JXYZ
1689 //_____________________________________________________________________________
1690 void TGeant3::Gtrack()
1693 // Controls tracking of current particle
1698 //_____________________________________________________________________________
1699 void TGeant3::Gtreve()
1702 // Controls tracking of all particles belonging to the current event
1707 //_____________________________________________________________________________
1708 void TGeant3::Grndm(Float_t *rvec, const Int_t len) const
1711 // To generate a vector RVECV of LEN random numbers
1712 // Copy of the CERN Library routine RANECU
1716 //_____________________________________________________________________________
1717 void TGeant3::Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq,
1718 const Text_t *chopt)
1721 // To set/retrieve the seed of the random number generator
1723 grndmq(is1,is2,iseq,PASSCHARD(chopt) PASSCHARL(chopt));
1726 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1728 // Functions from GDRAW
1730 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1732 //_____________________________________________________________________________
1733 void TGeant3::Gdxyz(Int_t it)
1736 // Draw the points stored with Gsxyz relative to track it
1741 //_____________________________________________________________________________
1742 void TGeant3::Gdcxyz()
1745 // Draw the position of the current track
1750 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1752 // Functions from GGEOM
1754 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
1756 //_____________________________________________________________________________
1757 void TGeant3::Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)
1760 // Computes coordinates XM (Master Reference System
1761 // knowing the coordinates XD (Detector Ref System)
1762 // The local reference system can be initialized by
1763 // - the tracking routines and GDTOM used in GUSTEP
1764 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
1765 // (inverse routine is GMTOD)
1767 // If IFLAG=1 convert coordinates
1768 // IFLAG=2 convert direction cosinus
1770 gdtom(xd, xm, iflag);
1773 //_____________________________________________________________________________
1774 void TGeant3::Glmoth(const char* iudet, Int_t iunum, Int_t &nlev, Int_t *lvols,
1778 // Loads the top part of the Volume tree in LVOLS (IVO's),
1779 // LINDX (IN indices) for a given volume defined through
1780 // its name IUDET and number IUNUM.
1782 // The routine stores only upto the last level where JVOLUM
1783 // data structure is developed. If there is no development
1784 // above the current level, it returns NLEV zero.
1786 glmoth(PASSCHARD(iudet), iunum, nlev, lvols, lindx, idum PASSCHARL(iudet));
1789 //_____________________________________________________________________________
1790 void TGeant3::Gmedia(Float_t *x, Int_t &numed)
1793 // Finds in which volume/medium the point X is, and updates the
1794 // common /GCVOLU/ and the structure JGPAR accordingly.
1796 // NUMED returns the tracking medium number, or 0 if point is
1797 // outside the experimental setup.
1802 //_____________________________________________________________________________
1803 void TGeant3::Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)
1806 // Computes coordinates XD (in DRS)
1807 // from known coordinates XM in MRS
1808 // The local reference system can be initialized by
1809 // - the tracking routines and GMTOD used in GUSTEP
1810 // - a call to GMEDIA(XM,NUMED)
1811 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
1812 // (inverse routine is GDTOM)
1814 // If IFLAG=1 convert coordinates
1815 // IFLAG=2 convert direction cosinus
1817 gmtod(xm, xd, iflag);
1820 //_____________________________________________________________________________
1821 void TGeant3::Gsdvn(const char *name, const char *mother, Int_t ndiv,
1825 // Create a new volume by dividing an existing one
1828 // MOTHER Mother volume name
1829 // NDIV Number of divisions
1832 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
1833 // It divides a previously defined volume.
1838 Vname(mother,vmother);
1839 gsdvn(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis PASSCHARL(vname)
1840 PASSCHARL(vmother));
1843 //_____________________________________________________________________________
1844 void TGeant3::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
1845 Int_t iaxis, Float_t c0i, Int_t numed)
1848 // Create a new volume by dividing an existing one
1850 // Divides mother into ndiv divisions called name
1851 // along axis iaxis starting at coordinate value c0.
1852 // the new volume created will be medium number numed.
1857 Vname(mother,vmother);
1858 gsdvn2(PASSCHARD(vname), PASSCHARD(vmother), ndiv, iaxis, c0i, numed
1859 PASSCHARL(vname) PASSCHARL(vmother));
1862 //_____________________________________________________________________________
1863 void TGeant3::Gsdvs(const char *name, const char *mother, Float_t step,
1864 Int_t iaxis, Int_t numed)
1867 // Create a new volume by dividing an existing one
1872 Vname(mother,vmother);
1873 gsdvs(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed
1874 PASSCHARL(vname) PASSCHARL(vmother));
1877 //_____________________________________________________________________________
1878 void TGeant3::Gsdvs2(const char *name, const char *mother, Float_t step,
1879 Int_t iaxis, Float_t c0, Int_t numed)
1882 // Create a new volume by dividing an existing one
1887 Vname(mother,vmother);
1888 gsdvs2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0, numed
1889 PASSCHARL(vname) PASSCHARL(vmother));
1892 //_____________________________________________________________________________
1893 void TGeant3::Gsdvt(const char *name, const char *mother, Float_t step,
1894 Int_t iaxis, Int_t numed, Int_t ndvmx)
1897 // Create a new volume by dividing an existing one
1899 // Divides MOTHER into divisions called NAME along
1900 // axis IAXIS in steps of STEP. If not exactly divisible
1901 // will make as many as possible and will centre them
1902 // with respect to the mother. Divisions will have medium
1903 // number NUMED. If NUMED is 0, NUMED of MOTHER is taken.
1904 // NDVMX is the expected maximum number of divisions
1905 // (If 0, no protection tests are performed)
1910 Vname(mother,vmother);
1911 gsdvt(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, numed, ndvmx
1912 PASSCHARL(vname) PASSCHARL(vmother));
1915 //_____________________________________________________________________________
1916 void TGeant3::Gsdvt2(const char *name, const char *mother, Float_t step,
1917 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx)
1920 // Create a new volume by dividing an existing one
1922 // Divides MOTHER into divisions called NAME along
1923 // axis IAXIS starting at coordinate value C0 with step
1925 // The new volume created will have medium number NUMED.
1926 // If NUMED is 0, NUMED of mother is taken.
1927 // NDVMX is the expected maximum number of divisions
1928 // (If 0, no protection tests are performed)
1933 Vname(mother,vmother);
1934 gsdvt2(PASSCHARD(vname), PASSCHARD(vmother), step, iaxis, c0,
1935 numed, ndvmx PASSCHARL(vname) PASSCHARL(vmother));
1938 //_____________________________________________________________________________
1939 void TGeant3::Gsord(const char *name, Int_t iax)
1942 // Flags volume CHNAME whose contents will have to be ordered
1943 // along axis IAX, by setting the search flag to -IAX
1947 // IAX = 4 Rxy (static ordering only -> GTMEDI)
1948 // IAX = 14 Rxy (also dynamic ordering -> GTNEXT)
1949 // IAX = 5 Rxyz (static ordering only -> GTMEDI)
1950 // IAX = 15 Rxyz (also dynamic ordering -> GTNEXT)
1951 // IAX = 6 PHI (PHI=0 => X axis)
1952 // IAX = 7 THETA (THETA=0 => Z axis)
1956 gsord(PASSCHARD(vname), iax PASSCHARL(vname));
1959 //_____________________________________________________________________________
1960 void TGeant3::Gspos(const char *name, Int_t nr, const char *mother, Float_t x,
1961 Float_t y, Float_t z, Int_t irot, const char *konly)
1964 // Position a volume into an existing one
1967 // NUMBER Copy number of the volume
1968 // MOTHER Mother volume name
1969 // X X coord. of the volume in mother ref. sys.
1970 // Y Y coord. of the volume in mother ref. sys.
1971 // Z Z coord. of the volume in mother ref. sys.
1972 // IROT Rotation matrix number w.r.t. mother ref. sys.
1973 // ONLY ONLY/MANY flag
1975 // It positions a previously defined volume in the mother.
1980 Vname(mother,vmother);
1981 gspos(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
1982 PASSCHARD(konly) PASSCHARL(vname) PASSCHARL(vmother)
1986 //_____________________________________________________________________________
1987 void TGeant3::Gsposp(const char *name, Int_t nr, const char *mother,
1988 Float_t x, Float_t y, Float_t z, Int_t irot,
1989 const char *konly, Float_t *upar, Int_t np )
1992 // Place a copy of generic volume NAME with user number
1993 // NR inside MOTHER, with its parameters UPAR(1..NP)
1998 Vname(mother,vmother);
1999 gsposp(PASSCHARD(vname), nr, PASSCHARD(vmother), x, y, z, irot,
2000 PASSCHARD(konly), upar, np PASSCHARL(vname) PASSCHARL(vmother)
2004 //_____________________________________________________________________________
2005 void TGeant3::Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2,
2006 Float_t phi2, Float_t theta3, Float_t phi3)
2009 // nmat Rotation matrix number
2010 // THETA1 Polar angle for axis I
2011 // PHI1 Azimuthal angle for axis I
2012 // THETA2 Polar angle for axis II
2013 // PHI2 Azimuthal angle for axis II
2014 // THETA3 Polar angle for axis III
2015 // PHI3 Azimuthal angle for axis III
2017 // It defines the rotation matrix number IROT.
2019 gsrotm(nmat, theta1, phi1, theta2, phi2, theta3, phi3);
2022 //_____________________________________________________________________________
2023 void TGeant3::Gprotm(Int_t nmat)
2026 // To print rotation matrices structure JROTM
2027 // nmat Rotation matrix number
2032 //_____________________________________________________________________________
2033 Int_t TGeant3::Gsvolu(const char *name, const char *shape, Int_t nmed,
2034 Float_t *upar, Int_t npar)
2038 // SHAPE Volume type
2039 // NUMED Tracking medium number
2040 // NPAR Number of shape parameters
2041 // UPAR Vector containing shape parameters
2043 // It creates a new volume in the JVOLUM data structure.
2049 Vname(shape,vshape);
2050 gsvolu(PASSCHARD(vname), PASSCHARD(vshape), nmed, upar, npar, ivolu
2051 PASSCHARL(vname) PASSCHARL(vshape));
2055 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2057 // T H E D R A W I N G P A C K A G E
2058 // ======================================
2059 // Drawing functions. These functions allow the visualization in several ways
2060 // of the volumes defined in the geometrical data structure. It is possible
2061 // to draw the logical tree of volumes belonging to the detector (DTREE),
2062 // to show their geometrical specification (DSPEC,DFSPC), to draw them
2063 // and their cut views (DRAW, DCUT). Moreover, it is possible to execute
2064 // these commands when the hidden line removal option is activated; in
2065 // this case, the volumes can be also either translated in the space
2066 // (SHIFT), or clipped by boolean operation (CVOL). In addition, it is
2067 // possible to fill the surfaces of the volumes
2068 // with solid colours when the shading option (SHAD) is activated.
2069 // Several tools (ZOOM, LENS) have been developed to zoom detailed parts
2070 // of the detectors or to scan physical events as well.
2071 // Finally, the command MOVE will allow the rotation, translation and zooming
2072 // on real time parts of the detectors or tracks and hits of a simulated event.
2073 // Ray-tracing commands. In case the command (DOPT RAYT ON) is executed,
2074 // the drawing is performed by the Geant ray-tracing;
2075 // automatically, the color is assigned according to the tracking medium of each
2076 // volume and the volumes with a density lower/equal than the air are considered
2077 // transparent; if the option (USER) is set (ON) (again via the command (DOPT)),
2078 // the user can set color and visibility for the desired volumes via the command
2079 // (SATT), as usual, relatively to the attributes (COLO) and (SEEN).
2080 // The resolution can be set via the command (SATT * FILL VALUE), where (VALUE)
2081 // is the ratio between the number of pixels drawn and 20 (user coordinates).
2082 // Parallel view and perspective view are possible (DOPT PROJ PARA/PERS); in the
2083 // first case, we assume that the first mother volume of the tree is a box with
2084 // dimensions 10000 X 10000 X 10000 cm and the view point (infinetely far) is
2085 // 5000 cm far from the origin along the Z axis of the user coordinates; in the
2086 // second case, the distance between the observer and the origin of the world
2087 // reference system is set in cm by the command (PERSP NAME VALUE); grand-angle
2088 // or telescopic effects can be achieved changing the scale factors in the command
2089 // (DRAW). When the final picture does not occupy the full window,
2090 // mapping the space before tracing can speed up the drawing, but can also
2091 // produce less precise results; values from 1 to 4 are allowed in the command
2092 // (DOPT MAPP VALUE), the mapping being more precise for increasing (VALUE); for
2093 // (VALUE = 0) no mapping is performed (therefore max precision and lowest speed).
2094 // The command (VALCUT) allows the cutting of the detector by three planes
2095 // ortogonal to the x,y,z axis. The attribute (LSTY) can be set by the command
2096 // SATT for any desired volume and can assume values from 0 to 7; it determines
2097 // the different light processing to be performed for different materials:
2098 // 0 = dark-matt, 1 = bright-matt, 2 = plastic, 3 = ceramic, 4 = rough-metals,
2099 // 5 = shiny-metals, 6 = glass, 7 = mirror. The detector is assumed to be in the
2100 // dark, the ambient light luminosity is 0.2 for each basic hue (the saturation
2101 // is 0.9) and the observer is assumed to have a light source (therefore he will
2102 // produce parallel light in the case of parallel view and point-like-source
2103 // light in the case of perspective view).
2105 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
2107 //_____________________________________________________________________________
2108 void TGeant3::Gsatt(const char *name, const char *att, Int_t val)
2112 // IOPT Name of the attribute to be set
2113 // IVAL Value to which the attribute is to be set
2115 // name= "*" stands for all the volumes.
2116 // iopt can be chosen among the following :
2118 // WORK 0=volume name is inactive for the tracking
2119 // 1=volume name is active for the tracking (default)
2121 // SEEN 0=volume name is invisible
2122 // 1=volume name is visible (default)
2123 // -1=volume invisible with all its descendants in the tree
2124 // -2=volume visible but not its descendants in the tree
2126 // LSTY line style 1,2,3,... (default=1)
2127 // LSTY=7 will produce a very precise approximation for
2128 // revolution bodies.
2130 // LWID line width -7,...,1,2,3,..7 (default=1)
2131 // LWID<0 will act as abs(LWID) was set for the volume
2132 // and for all the levels below it. When SHAD is 'ON', LWID
2133 // represent the linewidth of the scan lines filling the surfaces
2134 // (whereas the FILL value represent their number). Therefore
2135 // tuning this parameter will help to obtain the desired
2136 // quality/performance ratio.
2138 // COLO colour code -166,...,1,2,..166 (default=1)
2140 // n=2=red; n=17+m, m=0,25, increasing luminosity according to 'm';
2141 // n=3=green; n=67+m, m=0,25, increasing luminosity according to 'm';
2142 // n=4=blue; n=117+m, m=0,25, increasing luminosity according to 'm';
2143 // n=5=yellow; n=42+m, m=0,25, increasing luminosity according to 'm';
2144 // n=6=violet; n=142+m, m=0,25, increasing luminosity according to 'm';
2145 // n=7=lightblue; n=92+m, m=0,25, increasing luminosity according to 'm';
2146 // colour=n*10+m, m=1,2,...9, will produce the same colour
2147 // as 'n', but with increasing luminosity according to 'm';
2148 // COLO<0 will act as if abs(COLO) was set for the volume
2149 // and for all the levels below it.
2150 // When for a volume the attribute FILL is > 1 (and the
2151 // option SHAD is on), the ABS of its colour code must be < 8
2152 // because an automatic shading of its faces will be
2155 // FILL (1992) fill area -7,...,0,1,...7 (default=0)
2156 // when option SHAD is "on" the FILL attribute of any
2157 // volume can be set different from 0 (normal drawing);
2158 // if it is set to 1, the faces of such volume will be filled
2159 // with solid colours; if ABS(FILL) is > 1, then a light
2160 // source is placed along the observer line, and the faces of
2161 // such volumes will be painted by colours whose luminosity
2162 // will depend on the amount of light reflected;
2163 // if ABS(FILL) = 1, then it is possible to use all the 166
2164 // colours of the colour table, becouse the automatic shading
2165 // is not performed;
2166 // for increasing values of FILL the drawing will be performed
2167 // with higher and higher resolution improving the quality (the
2168 // number of scan lines used to fill the faces increases with FILL);
2169 // it is possible to set different values of FILL
2170 // for different volumes, in order to optimize at the same time
2171 // the performance and the quality of the picture;
2172 // FILL<0 will act as if abs(FILL) was set for the volume
2173 // and for all the levels below it.
2174 // This kind of drawing can be saved in 'picture files'
2175 // or in view banks.
2176 // 0=drawing without fill area
2177 // 1=faces filled with solid colours and resolution = 6
2178 // 2=lowest resolution (very fast)
2179 // 3=default resolution
2180 // 4=.................
2181 // 5=.................
2182 // 6=.................
2184 // Finally, if a coloured background is desired, the FILL
2185 // attribute for the first volume of the tree must be set
2186 // equal to -abs(colo), colo being >0 and <166.
2188 // SET set number associated to volume name
2189 // DET detector number associated to volume name
2190 // DTYP detector type (1,2)
2197 gsatt(PASSCHARD(vname), PASSCHARD(vatt), val PASSCHARL(vname)
2201 //_____________________________________________________________________________
2202 void TGeant3::Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
2203 Int_t& natt, Float_t* par, Float_t* att)
2206 // Find the parameters of a volume
2208 gfpara(PASSCHARD(name), number, intext, npar, natt, par, att
2212 //_____________________________________________________________________________
2213 void TGeant3::Gckpar(Int_t ish, Int_t npar, Float_t* par)
2216 // Check the parameters of a shape
2218 gckpar(ish,npar,par);
2221 //_____________________________________________________________________________
2222 void TGeant3::Gckmat(Int_t itmed, char* natmed)
2225 // Check the parameters of a tracking medium
2227 gckmat(itmed, PASSCHARD(natmed) PASSCHARL(natmed));
2230 //_____________________________________________________________________________
2231 void TGeant3::Gdelete(Int_t iview)
2234 // IVIEW View number
2236 // It deletes a view bank from memory.
2241 //_____________________________________________________________________________
2242 void TGeant3::Gdopen(Int_t iview)
2245 // IVIEW View number
2247 // When a drawing is very complex and requires a long time to be
2248 // executed, it can be useful to store it in a view bank: after a
2249 // call to DOPEN and the execution of the drawing (nothing will
2250 // appear on the screen), and after a necessary call to DCLOSE,
2251 // the contents of the bank can be displayed in a very fast way
2252 // through a call to DSHOW; therefore, the detector can be easily
2253 // zoomed many times in different ways. Please note that the pictures
2254 // with solid colours can now be stored in a view bank or in 'PICTURE FILES'
2261 //_____________________________________________________________________________
2262 void TGeant3::Gdclose()
2265 // It closes the currently open view bank; it must be called after the
2266 // end of the drawing to be stored.
2271 //_____________________________________________________________________________
2272 void TGeant3::Gdshow(Int_t iview)
2275 // IVIEW View number
2277 // It shows on the screen the contents of a view bank. It
2278 // can be called after a view bank has been closed.
2283 //_____________________________________________________________________________
2284 void TGeant3::Gdopt(const char *name,const char *value)
2288 // VALUE Option value
2290 // To set/modify the drawing options.
2293 // THRZ ON Draw tracks in R vs Z
2294 // OFF (D) Draw tracks in X,Y,Z
2297 // PROJ PARA (D) Parallel projection
2299 // TRAK LINE (D) Trajectory drawn with lines
2300 // POIN " " with markers
2301 // HIDE ON Hidden line removal using the CG package
2302 // OFF (D) No hidden line removal
2303 // SHAD ON Fill area and shading of surfaces.
2304 // OFF (D) Normal hidden line removal.
2305 // RAYT ON Ray-tracing on.
2306 // OFF (D) Ray-tracing off.
2307 // EDGE OFF Does not draw contours when shad is on.
2308 // ON (D) Normal shading.
2309 // MAPP 1,2,3,4 Mapping before ray-tracing.
2310 // 0 (D) No mapping.
2311 // USER ON User graphics options in the raytracing.
2312 // OFF (D) Automatic graphics options.
2318 Vname(value,vvalue);
2319 gdopt(PASSCHARD(vname), PASSCHARD(vvalue) PASSCHARL(vname)
2323 //_____________________________________________________________________________
2324 void TGeant3::Gdraw(const char *name,Float_t theta, Float_t phi, Float_t psi,
2325 Float_t u0,Float_t v0,Float_t ul,Float_t vl)
2330 // THETA Viewing angle theta (for 3D projection)
2331 // PHI Viewing angle phi (for 3D projection)
2332 // PSI Viewing angle psi (for 2D rotation)
2333 // U0 U-coord. (horizontal) of volume origin
2334 // V0 V-coord. (vertical) of volume origin
2335 // SU Scale factor for U-coord.
2336 // SV Scale factor for V-coord.
2338 // This function will draw the volumes,
2339 // selected with their graphical attributes, set by the Gsatt
2340 // facility. The drawing may be performed with hidden line removal
2341 // and with shading effects according to the value of the options HIDE
2342 // and SHAD; if the option SHAD is ON, the contour's edges can be
2343 // drawn or not. If the option HIDE is ON, the detector can be
2344 // exploded (BOMB), clipped with different shapes (CVOL), and some
2345 // of its parts can be shifted from their original
2346 // position (SHIFT). When HIDE is ON, if
2347 // the drawing requires more than the available memory, the program
2348 // will evaluate and display the number of missing words
2349 // (so that the user can increase the
2350 // size of its ZEBRA store). Finally, at the end of each drawing (with HIDE on),
2351 // the program will print messages about the memory used and
2352 // statistics on the volumes' visibility.
2353 // The following commands will produce the drawing of a green
2354 // volume, specified by NAME, without using the hidden line removal
2355 // technique, using the hidden line removal technique,
2356 // with different linewidth and colour (red), with
2357 // solid colour, with shading of surfaces, and without edges.
2358 // Finally, some examples are given for the ray-tracing. (A possible
2359 // string for the NAME of the volume can be found using the command DTREE).
2365 if (fGcvdma->raytra != 1) {
2366 gdraw(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2368 gdrayt(PASSCHARD(vname), theta,phi,psi,u0,v0,ul,vl PASSCHARL(vname));
2372 //_____________________________________________________________________________
2373 void TGeant3::Gdrawc(const char *name,Int_t axis, Float_t cut,Float_t u0,
2374 Float_t v0,Float_t ul,Float_t vl)
2379 // CUTVAL Cut plane distance from the origin along the axis
2381 // U0 U-coord. (horizontal) of volume origin
2382 // V0 V-coord. (vertical) of volume origin
2383 // SU Scale factor for U-coord.
2384 // SV Scale factor for V-coord.
2386 // The cut plane is normal to caxis (X,Y,Z), corresponding to iaxis (1,2,3),
2387 // and placed at the distance cutval from the origin.
2388 // The resulting picture is seen from the the same axis.
2389 // When HIDE Mode is ON, it is possible to get the same effect with
2390 // the CVOL/BOX function.
2396 gdrawc(PASSCHARD(vname), axis,cut,u0,v0,ul,vl PASSCHARL(vname));
2399 //_____________________________________________________________________________
2400 void TGeant3::Gdrawx(const char *name,Float_t cutthe, Float_t cutphi,
2401 Float_t cutval, Float_t theta, Float_t phi, Float_t u0,
2402 Float_t v0,Float_t ul,Float_t vl)
2406 // CUTTHE Theta angle of the line normal to cut plane
2407 // CUTPHI Phi angle of the line normal to cut plane
2408 // CUTVAL Cut plane distance from the origin along the axis
2410 // THETA Viewing angle theta (for 3D projection)
2411 // PHI Viewing angle phi (for 3D projection)
2412 // U0 U-coord. (horizontal) of volume origin
2413 // V0 V-coord. (vertical) of volume origin
2414 // SU Scale factor for U-coord.
2415 // SV Scale factor for V-coord.
2417 // The cut plane is normal to the line given by the cut angles
2418 // cutthe and cutphi and placed at the distance cutval from the origin.
2419 // The resulting picture is seen from the viewing angles theta,phi.
2425 gdrawx(PASSCHARD(vname), cutthe,cutphi,cutval,theta,phi,u0,v0,ul,vl
2429 //_____________________________________________________________________________
2430 void TGeant3::Gdhead(Int_t isel, const char *name, Float_t chrsiz)
2435 // ISEL Option flag D=111110
2437 // CHRSIZ Character size (cm) of title NAME D=0.6
2440 // 0 to have only the header lines
2441 // xxxxx1 to add the text name centered on top of header
2442 // xxxx1x to add global detector name (first volume) on left
2443 // xxx1xx to add date on right
2444 // xx1xxx to select thick characters for text on top of header
2445 // x1xxxx to add the text 'EVENT NR x' on top of header
2446 // 1xxxxx to add the text 'RUN NR x' on top of header
2447 // NOTE that ISEL=x1xxx1 or ISEL=1xxxx1 are illegal choices,
2448 // i.e. they generate overwritten text.
2450 gdhead(isel,PASSCHARD(name),chrsiz PASSCHARL(name));
2453 //_____________________________________________________________________________
2454 void TGeant3::Gdman(Float_t u, Float_t v, const char *type)
2457 // Draw a 2D-man at position (U0,V0)
2459 // U U-coord. (horizontal) of the centre of man' R
2460 // V V-coord. (vertical) of the centre of man' R
2461 // TYPE D='MAN' possible values: 'MAN,WM1,WM2,WM3'
2463 // CALL GDMAN(u,v),CALL GDWMN1(u,v),CALL GDWMN2(u,v),CALL GDWMN2(u,v)
2464 // It superimposes the picure of a man or of a woman, chosen among
2465 // three different ones, with the same scale factors as the detector
2466 // in the current drawing.
2469 if (opt.Contains("WM1")) {
2471 } else if (opt.Contains("WM3")) {
2473 } else if (opt.Contains("WM2")) {
2480 //_____________________________________________________________________________
2481 void TGeant3::Gdspec(const char *name)
2486 // Shows 3 views of the volume (two cut-views and a 3D view), together with
2487 // its geometrical specifications. The 3D drawing will
2488 // be performed according the current values of the options HIDE and
2489 // SHAD and according the current SetClipBox clipping parameters for that
2496 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2499 //_____________________________________________________________________________
2500 void TGeant3::DrawOneSpec(const char *name)
2503 // Function called when one double-clicks on a volume name
2504 // in a TPavelabel drawn by Gdtree.
2506 THIGZ *higzSave = higz;
2507 higzSave->SetName("higzSave");
2508 THIGZ *higzSpec = (THIGZ*)gROOT->FindObject("higzSpec");
2509 //printf("DrawOneSpec, higz=%x, higzSpec=%x\n",higz,higzSpec);
2510 if (higzSpec) higz = higzSpec;
2511 else higzSpec = new THIGZ(defSize);
2512 higzSpec->SetName("higzSpec");
2517 gdspec(PASSCHARD(vname) PASSCHARL(vname));
2520 higzSave->SetName("higz");
2524 //_____________________________________________________________________________
2525 void TGeant3::Gdtree(const char *name,Int_t levmax, Int_t isel)
2529 // LEVMAX Depth level
2532 // This function draws the logical tree,
2533 // Each volume in the tree is represented by a TPaveTree object.
2534 // Double-clicking on a TPaveTree draws the specs of the corresponding volume.
2535 // Use TPaveTree pop-up menu to select:
2538 // - drawing tree of parent
2544 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2548 //_____________________________________________________________________________
2549 void TGeant3::GdtreeParent(const char *name,Int_t levmax, Int_t isel)
2553 // LEVMAX Depth level
2556 // This function draws the logical tree of the parent of name.
2560 // Scan list of volumes in JVOLUM
2562 Int_t gname, i, jvo, in, nin, jin, num;
2563 strncpy((char *) &gname, name, 4);
2564 for(i=1; i<=fGcnum->nvolum; i++) {
2565 jvo = fZlq[fGclink->jvolum-i];
2566 nin = Int_t(fZq[jvo+3]);
2567 if (nin == -1) nin = 1;
2568 for (in=1;in<=nin;in++) {
2570 num = Int_t(fZq[jin+2]);
2571 if(gname == fZiq[fGclink->jvolum+num]) {
2572 strncpy(vname,(char*)&fZiq[fGclink->jvolum+i],4);
2574 gdtree(PASSCHARD(vname), levmax, isel PASSCHARL(vname));
2582 //_____________________________________________________________________________
2583 void TGeant3::SetABAN(Int_t par)
2586 // par = 1 particles will be stopped according to their residual
2587 // range if they are not in a sensitive material and are
2588 // far enough from the boundary
2589 // 0 particles are transported normally
2591 fGcphys->dphys1 = par;
2595 //_____________________________________________________________________________
2596 void TGeant3::SetANNI(Int_t par)
2599 // To control positron annihilation.
2600 // par =0 no annihilation
2601 // =1 annihilation. Decays processed.
2602 // =2 annihilation. No decay products stored.
2604 fGcphys->ianni = par;
2608 //_____________________________________________________________________________
2609 void TGeant3::SetAUTO(Int_t par)
2612 // To control automatic calculation of tracking medium parameters:
2613 // par =0 no automatic calculation;
2614 // =1 automati calculation.
2616 fGctrak->igauto = par;
2620 //_____________________________________________________________________________
2621 void TGeant3::SetBOMB(Float_t boom)
2624 // BOOM : Exploding factor for volumes position
2626 // To 'explode' the detector. If BOOM is positive (values smaller
2627 // than 1. are suggested, but any value is possible)
2628 // all the volumes are shifted by a distance
2629 // proportional to BOOM along the direction between their centre
2630 // and the origin of the MARS; the volumes which are symmetric
2631 // with respect to this origin are simply not shown.
2632 // BOOM equal to 0 resets the normal mode.
2633 // A negative (greater than -1.) value of
2634 // BOOM will cause an 'implosion'; for even lower values of BOOM
2635 // the volumes' positions will be reflected respect to the origin.
2636 // This command can be useful to improve the 3D effect for very
2637 // complex detectors. The following commands will make explode the
2644 //_____________________________________________________________________________
2645 void TGeant3::SetBREM(Int_t par)
2648 // To control bremstrahlung.
2649 // par =0 no bremstrahlung
2650 // =1 bremstrahlung. Photon processed.
2651 // =2 bremstrahlung. No photon stored.
2653 fGcphys->ibrem = par;
2657 //_____________________________________________________________________________
2658 void TGeant3::SetCKOV(Int_t par)
2661 // To control Cerenkov production
2662 // par =0 no Cerenkov;
2664 // =2 Cerenkov with primary stopped at each step.
2666 fGctlit->itckov = par;
2670 //_____________________________________________________________________________
2671 void TGeant3::SetClipBox(const char *name,Float_t xmin,Float_t xmax,
2672 Float_t ymin,Float_t ymax,Float_t zmin,Float_t zmax)
2675 // The hidden line removal technique is necessary to visualize properly
2676 // very complex detectors. At the same time, it can be useful to visualize
2677 // the inner elements of a detector in detail. This function allows
2678 // subtractions (via boolean operation) of BOX shape from any part of
2679 // the detector, therefore showing its inner contents.
2680 // If "*" is given as the name of the
2681 // volume to be clipped, all volumes are clipped by the given box.
2682 // A volume can be clipped at most twice.
2683 // if a volume is explicitely clipped twice,
2684 // the "*" will not act on it anymore. Giving "." as the name
2685 // of the volume to be clipped will reset the clipping.
2687 // NAME Name of volume to be clipped
2689 // XMIN Lower limit of the Shape X coordinate
2690 // XMAX Upper limit of the Shape X coordinate
2691 // YMIN Lower limit of the Shape Y coordinate
2692 // YMAX Upper limit of the Shape Y coordinate
2693 // ZMIN Lower limit of the Shape Z coordinate
2694 // ZMAX Upper limit of the Shape Z coordinate
2696 // This function performs a boolean subtraction between the volume
2697 // NAME and a box placed in the MARS according the values of the given
2703 setclip(PASSCHARD(vname),xmin,xmax,ymin,ymax,zmin,zmax PASSCHARL(vname));
2706 //_____________________________________________________________________________
2707 void TGeant3::SetCOMP(Int_t par)
2710 // To control Compton scattering
2711 // par =0 no Compton
2712 // =1 Compton. Electron processed.
2713 // =2 Compton. No electron stored.
2716 fGcphys->icomp = par;
2719 //_____________________________________________________________________________
2720 void TGeant3::SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,
2721 Float_t cuthad,Float_t cutmuo ,Float_t bcute ,
2722 Float_t bcutm ,Float_t dcute ,Float_t dcutm ,
2723 Float_t ppcutm, Float_t tofmax)
2726 // CUTGAM Cut for gammas D=0.001
2727 // CUTELE Cut for electrons D=0.001
2728 // CUTHAD Cut for charged hadrons D=0.01
2729 // CUTNEU Cut for neutral hadrons D=0.01
2730 // CUTMUO Cut for muons D=0.01
2731 // BCUTE Cut for electron brems. D=-1.
2732 // BCUTM Cut for muon brems. D=-1.
2733 // DCUTE Cut for electron delta-rays D=-1.
2734 // DCUTM Cut for muon delta-rays D=-1.
2735 // PPCUTM Cut for e+e- pairs by muons D=0.01
2736 // TOFMAX Time of flight cut D=1.E+10
2738 // If the default values (-1.) for BCUTE ,BCUTM ,DCUTE ,DCUTM
2739 // are not modified, they will be set to CUTGAM,CUTGAM,CUTELE,CUTELE
2741 // If one of the parameters from CUTGAM to PPCUTM included
2742 // is modified, cross-sections and energy loss tables must be
2743 // recomputed via the function Gphysi.
2745 fGccuts->cutgam = cutgam;
2746 fGccuts->cutele = cutele;
2747 fGccuts->cutneu = cutneu;
2748 fGccuts->cuthad = cuthad;
2749 fGccuts->cutmuo = cutmuo;
2750 fGccuts->bcute = bcute;
2751 fGccuts->bcutm = bcutm;
2752 fGccuts->dcute = dcute;
2753 fGccuts->dcutm = dcutm;
2754 fGccuts->ppcutm = ppcutm;
2755 fGccuts->tofmax = tofmax;
2758 //_____________________________________________________________________________
2759 void TGeant3::SetDCAY(Int_t par)
2762 // To control Decay mechanism.
2763 // par =0 no decays.
2764 // =1 Decays. secondaries processed.
2765 // =2 Decays. No secondaries stored.
2767 fGcphys->idcay = par;
2771 //_____________________________________________________________________________
2772 void TGeant3::SetDEBU(Int_t emin, Int_t emax, Int_t emod)
2775 // Set the debug flag and frequency
2776 // Selected debug output will be printed from
2777 // event emin to even emax each emod event
2779 fGcflag->idemin = emin;
2780 fGcflag->idemax = emax;
2781 fGcflag->itest = emod;
2785 //_____________________________________________________________________________
2786 void TGeant3::SetDRAY(Int_t par)
2789 // To control delta rays mechanism.
2790 // par =0 no delta rays.
2791 // =1 Delta rays. secondaries processed.
2792 // =2 Delta rays. No secondaries stored.
2794 fGcphys->idray = par;
2797 //_____________________________________________________________________________
2798 void TGeant3::SetHADR(Int_t par)
2801 // To control hadronic interactions.
2802 // par =0 no hadronic interactions.
2803 // =1 Hadronic interactions. secondaries processed.
2804 // =2 Hadronic interactions. No secondaries stored.
2806 fGcphys->ihadr = par;
2809 //_____________________________________________________________________________
2810 void TGeant3::SetKINE(Int_t kine, Float_t xk1, Float_t xk2, Float_t xk3,
2811 Float_t xk4, Float_t xk5, Float_t xk6, Float_t xk7,
2812 Float_t xk8, Float_t xk9, Float_t xk10)
2815 // Set the variables in /GCFLAG/ IKINE, PKINE(10)
2816 // Their meaning is user defined
2818 fGckine->ikine = kine;
2819 fGckine->pkine[0] = xk1;
2820 fGckine->pkine[1] = xk2;
2821 fGckine->pkine[2] = xk3;
2822 fGckine->pkine[3] = xk4;
2823 fGckine->pkine[4] = xk5;
2824 fGckine->pkine[5] = xk6;
2825 fGckine->pkine[6] = xk7;
2826 fGckine->pkine[7] = xk8;
2827 fGckine->pkine[8] = xk9;
2828 fGckine->pkine[9] = xk10;
2831 //_____________________________________________________________________________
2832 void TGeant3::SetLOSS(Int_t par)
2835 // To control energy loss.
2836 // par =0 no energy loss;
2837 // =1 restricted energy loss fluctuations;
2838 // =2 complete energy loss fluctuations;
2840 // =4 no energy loss fluctuations.
2841 // If the value ILOSS is changed, then cross-sections and energy loss
2842 // tables must be recomputed via the command 'PHYSI'.
2844 fGcphys->iloss = par;
2848 //_____________________________________________________________________________
2849 void TGeant3::SetMULS(Int_t par)
2852 // To control multiple scattering.
2853 // par =0 no multiple scattering.
2854 // =1 Moliere or Coulomb scattering.
2855 // =2 Moliere or Coulomb scattering.
2856 // =3 Gaussian scattering.
2858 fGcphys->imuls = par;
2862 //_____________________________________________________________________________
2863 void TGeant3::SetMUNU(Int_t par)
2866 // To control muon nuclear interactions.
2867 // par =0 no muon-nuclear interactions.
2868 // =1 Nuclear interactions. Secondaries processed.
2869 // =2 Nuclear interactions. Secondaries not processed.
2871 fGcphys->imunu = par;
2874 //_____________________________________________________________________________
2875 void TGeant3::SetOPTI(Int_t par)
2878 // This flag controls the tracking optimisation performed via the
2880 // 1 no optimisation at all; GSORD calls disabled;
2881 // 0 no optimisation; only user calls to GSORD kept;
2882 // 1 all non-GSORDered volumes are ordered along the best axis;
2883 // 2 all volumes are ordered along the best axis.
2885 fGcopti->ioptim = par;
2888 //_____________________________________________________________________________
2889 void TGeant3::SetPAIR(Int_t par)
2892 // To control pair production mechanism.
2893 // par =0 no pair production.
2894 // =1 Pair production. secondaries processed.
2895 // =2 Pair production. No secondaries stored.
2897 fGcphys->ipair = par;
2901 //_____________________________________________________________________________
2902 void TGeant3::SetPFIS(Int_t par)
2905 // To control photo fission mechanism.
2906 // par =0 no photo fission.
2907 // =1 Photo fission. secondaries processed.
2908 // =2 Photo fission. No secondaries stored.
2910 fGcphys->ipfis = par;
2913 //_____________________________________________________________________________
2914 void TGeant3::SetPHOT(Int_t par)
2917 // To control Photo effect.
2918 // par =0 no photo electric effect.
2919 // =1 Photo effect. Electron processed.
2920 // =2 Photo effect. No electron stored.
2922 fGcphys->iphot = par;
2925 //_____________________________________________________________________________
2926 void TGeant3::SetRAYL(Int_t par)
2929 // To control Rayleigh scattering.
2930 // par =0 no Rayleigh scattering.
2933 fGcphys->irayl = par;
2936 //_____________________________________________________________________________
2937 void TGeant3::SetSWIT(Int_t sw, Int_t val)
2941 // val New switch value
2943 // Change one element of array ISWIT(10) in /GCFLAG/
2945 if (sw <= 0 || sw > 10) return;
2946 fGcflag->iswit[sw-1] = val;
2950 //_____________________________________________________________________________
2951 void TGeant3::SetTRIG(Int_t nevents)
2954 // Set number of events to be run
2956 fGcflag->nevent = nevents;
2959 //_____________________________________________________________________________
2960 void TGeant3::SetUserDecay(Int_t ipart)
2963 // Force the decays of particles to be done with Pythia
2964 // and not with the Geant routines.
2965 // just kill pointers doing mzdrop
2967 Int_t jpart=fGclink->jpart;
2968 Int_t jpa=fZlq[jpart-ipart];
2971 Int_t jpa1=fZlq[jpa-1];
2973 mzdrop(fGcbank->ixcons,jpa1,PASSCHARD(" ") PASSCHARL(" "));
2974 Int_t jpa2=fZlq[jpa-2];
2976 mzdrop(fGcbank->ixcons,jpa2,PASSCHARD(" ") PASSCHARL(" "));
2980 //______________________________________________________________________________
2981 void TGeant3::Vname(const char *name, char *vname)
2984 // convert name to upper case. Make vname at least 4 chars
2986 Int_t l = strlen(name);
2989 for (i=0;i<l;i++) vname[i] = toupper(name[i]);
2990 for (i=l;i<4;i++) vname[i] = ' ';
2994 //_____________________________________________________________________________
2995 void TGeant3::WriteEuclid(const char* filnam, const char* topvol,
2996 Int_t number, Int_t nlevel)
3000 // ******************************************************************
3002 // * Write out the geometry of the detector in EUCLID file format *
3004 // * filnam : will be with the extension .euc *
3005 // * topvol : volume name of the starting node *
3006 // * number : copy number of topvol (relevant for gsposp) *
3007 // * nlevel : number of levels in the tree structure *
3008 // * to be written out, starting from topvol *
3010 // * Author : M. Maire *
3012 // ******************************************************************
3014 // File filnam.tme is written out with the definitions of tracking
3015 // medias and materials.
3016 // As to restore original numbers for materials and medias, program
3017 // searches in the file euc_medi.dat and comparing main parameters of
3018 // the mat. defined inside geant and the one in file recognizes them
3019 // and is able to take number from file. If for any material or medium,
3020 // this procedure fails, ordering starts from 1.
3021 // Arrays IOTMED and IOMATE are used for this procedure
3023 const char shape[][5]={"BOX ","TRD1","TRD2","TRAP","TUBE","TUBS","CONE",
3024 "CONS","SPHE","PARA","PGON","PCON","ELTU","HYPE",
3026 Int_t i, end, itm, irm, jrm, k, nmed;
3030 char *filext, *filetme;
3031 char natmed[21], namate[21];
3032 char natmedc[21], namatec[21];
3033 char key[5], name[5], mother[5], konly[5];
3035 Int_t iadvol, iadtmd, iadrot, nwtot, iret;
3036 Int_t mlevel, numbr, natt, numed, nin, ndata;
3037 Int_t iname, ivo, ish, jvo, nvstak, ivstak;
3038 Int_t jdiv, ivin, in, jin, jvin, irot;
3039 Int_t jtm, imat, jma, flag=0, imatc;
3040 Float_t az, dens, radl, absl, a, step, x, y, z;
3041 Int_t npar, ndvmx, left;
3042 Float_t zc, densc, radlc, abslc, c0, tmaxfd;
3044 Int_t iomate[100], iotmed[100];
3045 Float_t par[50], att[20], ubuf[50];
3048 Int_t level, ndiv, iaxe;
3049 Int_t itmedc, nmatc, isvolc, ifieldc, nwbufc, isvol, nmat, ifield, nwbuf;
3050 Float_t fieldmc, tmaxfdc, stemaxc, deemaxc, epsilc, stminc, fieldm;
3051 Float_t tmaxf, stemax, deemax, epsil, stmin;
3052 const char *f10000="!\n%s\n!\n";
3053 //Open the input file
3055 for(i=0;i<end;i++) if(filnam[i]=='.') {
3059 filext=new char[end+4];
3060 filetme=new char[end+4];
3061 strncpy(filext,filnam,end);
3062 strncpy(filetme,filnam,end);
3064 // *** The output filnam name will be with extension '.euc'
3065 strcpy(&filext[end],".euc");
3066 strcpy(&filetme[end],".tme");
3067 lun=fopen(filext,"w");
3069 // *** Initialisation of the working space
3070 iadvol=fGcnum->nvolum;
3071 iadtmd=iadvol+fGcnum->nvolum;
3072 iadrot=iadtmd+fGcnum->ntmed;
3073 if(fGclink->jrotm) {
3074 fGcnum->nrotm=fZiq[fGclink->jrotm-2];
3078 nwtot=iadrot+fGcnum->nrotm;
3079 qws = new float[nwtot+1];
3080 for (i=0;i<nwtot+1;i++) qws[i]=0;
3083 if(nlevel==0) mlevel=20;
3085 // *** find the top volume and put it in the stak
3086 numbr = number>0 ? number : 1;
3087 Gfpara(topvol,numbr,1,npar,natt,par,att);
3089 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3094 // *** authorized shape ?
3095 strncpy((char *)&iname, topvol, 4);
3097 for(i=1; i<=fGcnum->nvolum; i++) if(fZiq[fGclink->jvolum+i]==iname) {
3101 jvo = fZlq[fGclink->jvolum-ivo];
3102 ish = Int_t (fZq[jvo+2]);
3104 printf(" *** GWEUCL *** top volume : %s number : %3d can not be a valid root\n",
3111 iws[iadvol+ivo] = level;
3114 //*** flag all volumes and fill the stak
3118 // pick the next volume in stak
3120 ivo = TMath::Abs(iws[ivstak]);
3121 jvo = fZlq[fGclink->jvolum - ivo];
3123 // flag the tracking medium
3124 numed = Int_t (fZq[jvo + 4]);
3125 iws[iadtmd + numed] = 1;
3127 // get the daughters ...
3128 level = iws[iadvol+ivo];
3129 if (level < mlevel) {
3131 nin = Int_t (fZq[jvo + 3]);
3133 // from division ...
3135 jdiv = fZlq[jvo - 1];
3136 ivin = Int_t (fZq[jdiv + 2]);
3138 iws[nvstak] = -ivin;
3139 iws[iadvol+ivin] = level;
3141 // from position ...
3142 } else if (nin > 0) {
3143 for(in=1; in<=nin; in++) {
3144 jin = fZlq[jvo - in];
3145 ivin = Int_t (fZq[jin + 2 ]);
3146 jvin = fZlq[fGclink->jvolum - ivin];
3147 ish = Int_t (fZq[jvin + 2]);
3148 // authorized shape ?
3150 // not yet flagged ?
3151 if (iws[iadvol+ivin]==0) {
3154 iws[iadvol+ivin] = level;
3156 // flag the rotation matrix
3157 irot = Int_t ( fZq[jin + 4 ]);
3158 if (irot > 0) iws[iadrot+irot] = 1;
3164 // next volume in stak ?
3165 if (ivstak < nvstak) goto L10;
3167 // *** restore original material and media numbers
3168 // file euc_medi.dat is needed to compare materials and medias
3170 FILE* luncor=fopen("euc_medi.dat","r");
3173 for(itm=1; itm<=fGcnum->ntmed; itm++) {
3174 if (iws[iadtmd+itm] > 0) {
3175 jtm = fZlq[fGclink->jtmed-itm];
3176 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3177 imat = Int_t (fZq[jtm+6]);
3178 jma = fZlq[fGclink->jmate-imat];
3180 printf(" *** GWEUCL *** material not defined for tracking medium %5i %s\n",itm,natmed);
3183 strncpy(namate,(char *)&fZiq[jma+1],20);
3186 //** find the material original number
3189 iret=fscanf(luncor,"%4s,%130s",key,card);
3190 if(iret<=0) goto L26;
3192 if(!strcmp(key,"MATE")) {
3193 sscanf(card,"%d %s %f %f %f %f %f %d",&imatc,namatec,&az,&zc,&densc,&radlc,&abslc,&nparc);
3194 Gfmate(imat,namate,a,z,dens,radl,absl,par,npar);
3195 if(!strcmp(namatec,namate)) {
3196 if(az==a && zc==z && densc==dens && radlc==radl
3197 && abslc==absl && nparc==nparc) {
3200 printf("*** GWEUCL *** material : %3d '%s' restored as %3d\n",imat,namate,imatc);
3202 printf("*** GWEUCL *** different definitions for material: %s\n",namate);
3206 if(strcmp(key,"END") && !flag) goto L23;
3208 printf("*** GWEUCL *** cannot restore original number for material: %s\n",namate);
3212 //*** restore original tracking medium number
3215 iret=fscanf(luncor,"%4s,%130s",key,card);
3216 if(iret<=0) goto L26;
3218 if (!strcmp(key,"TMED")) {
3219 sscanf(card,"%d %s %d %d %d %f %f %f %f %f %f %d\n",
3220 &itmedc,natmedc,&nmatc,&isvolc,&ifieldc,&fieldmc,
3221 &tmaxfdc,&stemaxc,&deemaxc,&epsilc,&stminc,&nwbufc);
3222 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxf,stemax,deemax,
3223 epsil,stmin,ubuf,&nwbuf);
3224 if(!strcmp(natmedc,natmed)) {
3225 if (iomate[nmat]==nmatc && nwbuf==nwbufc) {
3228 printf("*** GWEUCL *** medium : %3d '%20s' restored as %3d\n",
3231 printf("*** GWEUCL *** different definitions for tracking medium: %s\n",natmed);
3235 if(strcmp(key,"END") && !flag) goto L24;
3237 printf("cannot restore original number for medium : %s\n",natmed);
3245 L26: printf("*** GWEUCL *** cannot read the data file\n");
3247 L29: if(luncor) fclose (luncor);
3250 // *** write down the tracking medium definition
3252 strcpy(card,"! Tracking medium");
3253 fprintf(lun,f10000,card);
3255 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3256 if (iws[iadtmd+itm]>0) {
3257 jtm = fZlq[fGclink->jtmed-itm];
3258 strncpy(natmed,(char *)&fZiq[jtm+1],20);
3260 imat = Int_t (fZq[jtm+6]);
3261 jma = fZlq[fGclink->jmate-imat];
3262 //* order media from one, if comparing with database failed
3264 iotmed[itm]=++imxtmed;
3265 iomate[imat]=++imxmate;
3270 printf(" *** GWEUCL *** material not defined for tracking medium %5d %s\n",
3273 strncpy(namate,(char *)&fZiq[jma+1],20);
3276 fprintf(lun,"TMED %3d '%20s' %3d '%20s'\n",iotmed[itm],natmed,iomate[imat],namate);
3280 //* *** write down the rotation matrix
3282 strcpy(card,"! Reperes");
3283 fprintf(lun,f10000,card);
3285 for(irm=1;irm<=fGcnum->nrotm;irm++) {
3286 if (iws[iadrot+irm]>0) {
3287 jrm = fZlq[fGclink->jrotm-irm];
3288 fprintf(lun,"ROTM %3d",irm);
3289 for(k=11;k<=16;k++) fprintf(lun," %8.3f",fZq[jrm+k]);
3294 //* *** write down the volume definition
3296 strcpy(card,"! Volumes");
3297 fprintf(lun,f10000,card);
3299 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3302 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivo],4);
3304 jvo = fZlq[fGclink->jvolum-ivo];
3305 ish = Int_t (fZq[jvo+2]);
3306 nmed = Int_t (fZq[jvo+4]);
3307 npar = Int_t (fZq[jvo+5]);
3309 if (ivstak>1) for(i=0;i<npar;i++) par[i]=fZq[jvo+7+i];
3310 Gckpar (ish,npar,par);
3311 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3312 for(i=0;i<(npar-1)/6+1;i++) {
3315 for(k=0;k<(left<6?left:6);k++) fprintf(lun," %11.5f",par[i*6+k]);
3319 fprintf(lun,"VOLU '%4s' '%4s' %3d %3d\n",name,shape[ish-1],iotmed[nmed],npar);
3324 //* *** write down the division of volumes
3326 fprintf(lun,f10000,"! Divisions");
3327 for(ivstak=1;ivstak<=nvstak;ivstak++) {
3328 ivo = TMath::Abs(iws[ivstak]);
3329 jvo = fZlq[fGclink->jvolum-ivo];
3330 ish = Int_t (fZq[jvo+2]);
3331 nin = Int_t (fZq[jvo+3]);
3332 //* this volume is divided ...
3335 iaxe = Int_t ( fZq[jdiv+1]);
3336 ivin = Int_t ( fZq[jdiv+2]);
3337 ndiv = Int_t ( fZq[jdiv+3]);
3340 jvin = fZlq[fGclink->jvolum-ivin];
3341 nmed = Int_t ( fZq[jvin+4]);
3342 strncpy(mother,(char *)&fZiq[fGclink->jvolum+ivo ],4);
3344 strncpy(name,(char *)&fZiq[fGclink->jvolum+ivin],4);
3346 if ((step<=0.)||(ish>=11)) {
3347 //* volume with negative parameter or gsposp or pgon ...
3348 fprintf(lun,"DIVN '%4s' '%4s' %3d %3d\n",name,mother,ndiv,iaxe);
3349 } else if ((ndiv<=0)||(ish==10)) {
3350 //* volume with negative parameter or gsposp or para ...
3351 ndvmx = TMath::Abs(ndiv);
3352 fprintf(lun,"DIVT '%4s' '%4s' %11.5f %3d %3d %3d\n",
3353 name,mother,step,iaxe,iotmed[nmed],ndvmx);
3355 //* normal volume : all kind of division are equivalent
3356 fprintf(lun,"DVT2 '%4s' '%4s' %11.5f %3d %11.5f %3d %3d\n",
3357 name,mother,step,iaxe,c0,iotmed[nmed],ndiv);
3362 //* *** write down the the positionnement of volumes
3364 fprintf(lun,f10000,"! Positionnements\n");
3366 for(ivstak = 1;ivstak<=nvstak;ivstak++) {
3367 ivo = TMath::Abs(iws[ivstak]);
3368 strncpy(mother,(char*)&fZiq[fGclink->jvolum+ivo ],4);
3370 jvo = fZlq[fGclink->jvolum-ivo];
3371 nin = Int_t( fZq[jvo+3]);
3372 //* this volume has daughters ...
3374 for (in=1;in<=nin;in++) {
3376 ivin = Int_t (fZq[jin +2]);
3377 numb = Int_t (fZq[jin +3]);
3378 irot = Int_t (fZq[jin +4]);
3382 strcpy(konly,"ONLY");
3383 if (fZq[jin+8]!=1.) strcpy(konly,"MANY");
3384 strncpy(name,(char*)&fZiq[fGclink->jvolum+ivin],4);
3386 jvin = fZlq[fGclink->jvolum-ivin];
3387 ish = Int_t (fZq[jvin+2]);
3388 //* gspos or gsposp ?
3389 ndata = fZiq[jin-1];
3391 fprintf(lun,"POSI '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s'\n",
3392 name,numb,mother,x,y,z,irot,konly);
3394 npar = Int_t (fZq[jin+9]);
3395 for(i=0;i<npar;i++) par[i]=fZq[jin+10+i];
3396 Gckpar (ish,npar,par);
3397 fprintf(lun,"POSP '%4s' %4d '%4s' %11.5f %11.5f %11.5f %3d '%4s' %3d\n",
3398 name,numb,mother,x,y,z,irot,konly,npar);
3400 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3407 fprintf(lun,"END\n");
3410 //****** write down the materials and medias *****
3412 lun=fopen(filetme,"w");
3414 for(itm=1;itm<=fGcnum->ntmed;itm++) {
3415 if (iws[iadtmd+itm]>0) {
3416 jtm = fZlq[fGclink->jtmed-itm];
3417 strncpy(natmed,(char*)&fZiq[jtm+1],4);
3418 imat = Int_t (fZq[jtm+6]);
3419 jma = Int_t (fZlq[fGclink->jmate-imat]);
3421 Gfmate (imat,namate,a,z,dens,radl,absl,par,npar);
3422 fprintf(lun,"MATE %4d '%20s'%11.5E %11.5E %11.5E %11.5E %11.5E %3d\n",
3423 iomate[imat],namate,a,z,dens,radl,absl,npar);
3427 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3431 Gftmed(itm,natmed,nmat,isvol,ifield,fieldm,tmaxfd,stemax,deemax,epsil,stmin,par,&npar);
3432 fprintf(lun,"TMED %4d '%20s' %3d %1d %3d %11.5f %11.5f %11.5f %11.5f %11.5f %11.5f %3d\n",
3433 iotmed[itm],natmed,iomate[nmat],isvol,ifield,
3434 fieldm,tmaxfd,stemax,deemax,epsil,stmin,npar);
3438 for(i=0;i<npar;i++) fprintf(lun," %11.5f",par[i]);
3444 fprintf(lun,"END\n");
3445 printf(" *** GWEUCL *** file: %s is now written out\n",filext);
3446 printf(" *** GWEUCL *** file: %s is now written out\n",filetme);
3455 //_____________________________________________________________________________
3456 void TGeant3::Streamer(TBuffer &R__b)
3459 // Stream an object of class TGeant3.
3461 if (R__b.IsReading()) {
3462 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
3463 AliMC::Streamer(R__b);
3466 R__b.WriteVersion(TGeant3::IsA());
3467 AliMC::Streamer(R__b);