3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
8 ////////////////////////////////////////////////
9 // C++ interface to Geant3 basic routines //
10 ////////////////////////////////////////////////
14 //______________________________________________________________
16 // Geant3 prototypes for commons
18 //______________________________________________________________
22 // COMMON/QUEST/IQUEST(100)
28 // COMMON/GCBANK/NZEBRA,GVERSN,ZVERSN,IXSTOR,IXDIV,IXCONS,FENDQ(16)
29 // + ,LMAIN,LR1,WS(KWBANK)
43 // COMMON/GCLINK/JDIGI ,JDRAW ,JHEAD ,JHITS ,JKINE ,JMATE ,JPART
44 // + ,JROTM ,JRUNG ,JSET ,JSTAK ,JGSTAT,JTMED ,JTRACK,JVERTX
45 // + ,JVOLUM,JXYZ ,JGPAR ,JGPAR2,JSKLT
71 // COMMON/GCFLAG/IDEBUG,IDEMIN,IDEMAX,ITEST,IDRUN,IDEVT,IEORUN
72 // + ,IEOTRI,IEVENT,ISWIT(10),IFINIT(20),NEVENT,NRNDM(2)
90 // COMMON/GCKINE/IKINE,PKINE(10),ITRA,ISTAK,IVERT,IPART,ITRTYP
91 // + ,NAPART(5),AMASS,CHARGE,TLIFE,VERT(3),PVERT(4),IPAOLD
110 // COMMON/GCKING/KCASE,NGKINE,GKIN(5,MXGKIN),
111 // + TOFD(MXGKIN),IFLGK(MXGKIN)
116 Float_t gkin[MXGKIN][5];
122 // COMMON/GCKIN2/NGPHOT,XPHOT(11,MXPHOT)
126 Float_t xphot[MXPHOT][11];
130 // COMMON/GCKIN3/GPOS(3,MXGKIN)
132 Float_t gpos[MXGKIN][3];
136 // COMMON/GCMATE/NMAT,NAMATE(5),A,Z,DENS,RADL,ABSL
148 // COMMON/GCTMED/NUMED,NATMED(5),ISVOL,IFIELD,FIELDM,TMAXFD,STEMAX
149 // + ,DEEMAX,EPSIL,STMIN,CFIELD,PREC,IUPD,ISTPAR,NUMOLD
170 // PARAMETER (MAXMEC=30)
171 // COMMON/GCTRAK/VECT(7),GETOT,GEKIN,VOUT(7),NMEC,LMEC(MAXMEC)
172 // + ,NAMEC(MAXMEC),NSTEP ,MAXNST,DESTEP,DESTEL,SAFETY,SLENG
173 // + ,STEP ,SNEXT ,SFIELD,TOFG ,GEKRAT,UPWGHT,IGNEXT,INWVOL
174 // + ,ISTOP ,IGAUTO,IEKBIN, ILOSL, IMULL,INGOTO,NLDOWN,NLEVIN
211 // COMMON/GCVOLU/NLEVEL,NAMES(15),NUMBER(15),
212 // +LVOLUM(15),LINDEX(15),INFROM,NLEVMX,NLDEV(15),LINMX(15),
213 // +GTRAN(3,15),GRMAT(10,15),GONLY(15),GLX(3)
224 Float_t gtran[15][3];
225 Float_t grmat[15][10];
231 // COMMON/GCSETS/IHSET,IHDET,ISET,IDET,IDTYPE,NVNAME,NUMBV(20)
243 // COMMON/GCNUM/NMATE ,NVOLUM,NROTM,NTMED,NTMULT,NTRACK,NPART
244 // + ,NSTMAX,NVERTX,NHEAD,NBIT
260 // COMMON/GCCUTS/CUTGAM,CUTELE,CUTNEU,CUTHAD,CUTMUO,BCUTE,BCUTM
261 // + ,DCUTE ,DCUTM ,PPCUTM,TOFMAX,GCUTS(5)
278 // COMMON/GCMULO/SINMUL(101),COSMUL(101),SQRMUL(101),OMCMOL,CHCMOL
279 // + ,EKMIN,EKMAX,NEKBIN,NEK1,EKINV,GEKA,GEKB,EKBIN(200),ELOW(200)
298 // COMMON/GCPHYS/IPAIR,SPAIR,SLPAIR,ZINTPA,STEPPA
299 // + ,ICOMP,SCOMP,SLCOMP,ZINTCO,STEPCO
300 // + ,IPHOT,SPHOT,SLPHOT,ZINTPH,STEPPH
301 // + ,IPFIS,SPFIS,SLPFIS,ZINTPF,STEPPF
302 // + ,IDRAY,SDRAY,SLDRAY,ZINTDR,STEPDR
303 // + ,IANNI,SANNI,SLANNI,ZINTAN,STEPAN
304 // + ,IBREM,SBREM,SLBREM,ZINTBR,STEPBR
305 // + ,IHADR,SHADR,SLHADR,ZINTHA,STEPHA
306 // + ,IMUNU,SMUNU,SLMUNU,ZINTMU,STEPMU
307 // + ,IDCAY,SDCAY,SLIFE ,SUMLIF,DPHYS1
308 // + ,ILOSS,SLOSS,SOLOSS,STLOSS,DPHYS2
309 // + ,IMULS,SMULS,SOMULS,STMULS,DPHYS3
310 // + ,IRAYL,SRAYL,SLRAYL,ZINTRA,STEPRA
380 // COMMON/GCPHLT/ILABS,SLABS,SLLABS,ZINTLA,STEPLA
394 // COMMON/GCOPTI/IOPTIM
400 // COMMON/GCTLIT/THRIND,PMIN,DP,DNDL,JMIN,ITCKOV,IMCKOV,NPCKOV
413 // COMMON/GCVDMA/NVMANY,MANYLE(20),MANYNA(20,15),
414 // +MANYNU(20,15),NFMANY,MYCOUN,IMYSE,RAYTRA,VECCOS(3)
423 // COMMON/GCTPOL/POLAR(3), NAMEC1(MAXME1)
426 Int_t namec1[MAXME1];
429 /************************************************************************
431 * Commons for GEANE *
433 ************************************************************************/
437 // PARAMETER (MXPRED = 10)
438 // DOUBLE PRECISION ERDTRP
439 // REAL ERRIN, ERROUT, ERTRSP, ERXIN, ERXOUT, ERPIN,
441 // INTEGER NEPRED, INLIST, ILPRED, IEPRED
442 // COMMON /ERTRIO/ ERDTRP(5,5,MXPRED), ERRIN(15), ERROUT(15,MXPRED),
443 // + ERTRSP(5,5,MXPRED), ERXIN( 3), ERXOUT( 3,MXPRED),
444 // + ERPIN(3), ERPOUT(3,MXPRED), NEPRED,INLIST,ILPRED,
450 Double_t erdtrp[MXPRED*5*5];
452 Float_t errout[MXPRED*15];
453 Float_t ertrsp[MXPRED*5*5];
455 Float_t erxout[MXPRED*3];
457 Float_t erpout[MXPRED*3];
465 // CHARACTER*8 CHOPTI
466 // LOGICAL LEEXAC, LELENG, LEONLY, LEPLAN, LEPOIN, LEVOLU
467 // REAL ERPLI, ERPLO, ERLENG
468 // INTEGER NAMEER, NUMVER, IOVLER
469 // COMMON /EROPTS/ ERPLI(3,2), ERPLO(3,4,MXPRED), ERLENG(MXPRED),
470 // + NAMEER(MXPRED), NUMVER(MXPRED), IOVLER(MXPRED),
471 // + LEEXAC, LELENG, LEONLY, LEPLAN, LEPOIN, LEVOLU
472 // COMMON /EROPTC/CHOPTI
476 Float_t erplo[MXPRED*3*4];
477 Float_t erleng[MXPRED];
478 Int_t nameer[MXPRED];
479 Int_t numver[MXPRED];
480 Int_t iovler[MXPRED];
494 // DOUBLE PRECISION EI, EF, ASDSC
495 // COMMON /ERWORK/ EI(15), EF(15), ASDSC(5,5),
496 // + XI(3), PPI(3), HI(9),
497 // + XF(3), PF(3), HF(9),
498 // + CHTR, DEDX2, BACKTR, CUTEK, TLGCM2, TLRAD
518 /************************************************************************
520 * Commons for GEANE *
522 ************************************************************************/
524 class TGeant3 : public AliMC {
527 Int_t fNextVol; // Iterator for GeomIter
529 //--------------Declarations for ZEBRA---------------------
563 //Put here all volume names
565 char (*fVolNames)[5]; //! Names of geant volumes as C++ chars
567 enum {kMaxParticles = 100};
571 Int_t fPDGCode[kMaxParticles];
575 TGeant3(const char *title, Int_t nwgeant=0);
576 virtual ~TGeant3() {if(fVolNames) {
580 virtual void LoadAddress();
582 ///////////////////////////////////////////////////////////////////////
585 // Here are the service routines from the geometry //
586 // which could be implemented also in other geometries //
589 ///////////////////////////////////////////////////////////////////////
592 Int_t CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens, Float_t &radl, Float_t &absl) const;
593 Int_t NextVolUp(Text_t *name, Int_t ©);
594 Int_t CurrentVolID(Int_t ©) const;
595 Int_t CurrentVolOffID(Int_t off, Int_t ©) const;
596 const char* CurrentVolName() const;
597 const char *CurrentVolOffName(Int_t off) const;
598 Int_t VolId(const Text_t *name) const;
599 Int_t IdFromPDG(Int_t pdg) const;
600 Int_t PDGFromId(Int_t pdg) const;
601 void DefineParticles();
602 const char* VolName(Int_t id) const;
603 Float_t Xsec(char*, Float_t, Int_t, Int_t);
604 void TrackPosition(TLorentzVector &xyz) const;
605 void TrackMomentum(TLorentzVector &xyz) const;
606 Int_t NofVolumes() const;
607 Float_t TrackTime() const;
608 Float_t TrackCharge() const;
609 Float_t TrackMass() const;
610 Float_t TrackStep() const;
611 Float_t TrackLength() const;
612 Int_t TrackPid() const;
613 Bool_t IsNewTrack() const;
614 Bool_t IsTrackInside() const;
615 Bool_t IsTrackEntering() const;
616 Bool_t IsTrackExiting() const;
617 Bool_t IsTrackOut() const;
618 Bool_t IsTrackDisappeared() const;
619 Bool_t IsTrackStop() const;
620 Bool_t IsTrackAlive() const;
621 Int_t NSecondaries() const;
622 Int_t CurrentEvent() const;
623 const char* ProdProcess() const;
624 void GetSecondary(Int_t, Int_t&, TLorentzVector&, TLorentzVector&);
627 Float_t MaxStep() const;
628 void SetMaxStep(Float_t maxstep);
629 void SetMaxNStep(Int_t maxnstp);
630 Int_t GetMaxNStep() const;
631 void SetCut(const char* cutName, Float_t cutValue);
632 void SetProcess(const char* flagName, Int_t flagValue);
633 // void GetParticle(const Int_t pdg, char *name, Float_t &mass) const;
634 virtual Int_t GetMedium() const;
635 virtual Float_t Edep() const;
636 virtual Float_t Etot() const;
637 virtual void Rndm(Float_t* r, const Int_t n) const;
638 virtual void Material(Int_t&, const char*, Float_t, Float_t, Float_t, Float_t,
639 Float_t, Float_t* buf=0, Int_t nwbuf=0);
640 virtual void Mixture(Int_t&, const char*, Float_t*, Float_t*, Float_t, Int_t, Float_t*);
641 virtual void Medium(Int_t&, const char*, Int_t, Int_t, Int_t, Float_t, Float_t,
642 Float_t, Float_t, Float_t, Float_t, Float_t* ubuf=0, Int_t nbuf=0);
643 virtual void Matrix(Int_t&, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t);
645 /////////////////////////////////////////////////////////////////////////////////////////////
648 // Here are the interface functions with GEANT3.21 //
651 /////////////////////////////////////////////////////////////////////////////////////////////
653 // access functions to commons
655 virtual Quest_t* Quest() const {return fQuest;}
656 virtual Gcbank_t* Gcbank() const {return fGcbank;}
657 virtual Gclink_t* Gclink() const {return fGclink;}
658 virtual Gccuts_t* Gccuts() const {return fGccuts;}
659 virtual Gcmulo_t* Gcmulo() const {return fGcmulo;}
660 virtual Gcmate_t* Gcmate() const {return fGcmate;}
661 virtual Gctpol_t* Gctpol() const {return fGctpol;}
662 virtual Gcnum_t* Gcnum() const {return fGcnum;}
663 virtual Gcsets_t* Gcsets() const {return fGcsets;}
664 virtual Gcopti_t* Gcopti() const {return fGcopti;}
665 virtual Gctlit_t* Gctlit() const {return fGctlit;}
666 virtual Gcvdma_t* Gcvdma() const {return fGcvdma;}
667 virtual Gcvolu_t* Gcvolu() const {return fGcvolu;}
668 virtual Gckine_t* Gckine() const {return fGckine;}
669 virtual Gcflag_t* Gcflag() const {return fGcflag;}
670 virtual Gctmed_t* Gctmed() const {return fGctmed;}
671 virtual Gcphys_t* Gcphys() const {return fGcphys;}
672 virtual Gcphlt_t* Gcphlt() const {return fGcphlt;}
673 virtual Gcking_t* Gcking() const {return fGcking;}
674 virtual Gckin2_t* Gckin2() const {return fGckin2;}
675 virtual Gckin3_t* Gckin3() const {return fGckin3;}
676 virtual Gctrak_t* Gctrak() const {return fGctrak;}
677 virtual Int_t* Iq() const {return fZiq;}
678 virtual Int_t* Lq() const {return fZlq;}
679 virtual Float_t* Q() const {return fZq;}
682 // Access to GEANE commons
684 virtual Ertrio_t* Ertrio() const {return fErtrio;}
685 virtual Eropts_t* Eropts() const {return fEropts;}
686 virtual Eroptc_t* Eroptc() const {return fEroptc;}
687 virtual Erwork_t* Erwork() const {return fErwork;}
691 // functions from GBASE
692 virtual void Gpcxyz();
693 virtual void Ggclos();
694 virtual void Gfile(const char *filename, const char *option="I");
695 virtual void Glast();
696 virtual void Gprint(const char *name);
698 virtual void Gtrig();
699 virtual void Gtrigc();
700 virtual void Gtrigi();
701 virtual void Gwork(Int_t nwork);
702 virtual void Gzinit();
704 // functions from GCONS
705 virtual void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, Float_t &dens,
706 Float_t &radl, Float_t &absl, Float_t* ubuf, Int_t& nbuf);
707 virtual void Gfpart(Int_t ipart, char *name, Int_t &itrtyp,
708 Float_t &amass, Float_t &charge, Float_t &tlife);
709 virtual void Gftmed(Int_t numed, char *name, Int_t &nmat, Int_t &isvol,
710 Int_t &ifield, Float_t &fieldm, Float_t &tmaxfd,
711 Float_t &stemax, Float_t &deemax, Float_t &epsil,
712 Float_t &stmin, Float_t *buf=0, Int_t *nbuf=0);
713 virtual void Gftmat(Int_t imate, Int_t ipart, char *chmeca, Int_t kdim,
714 Float_t* tkin, Float_t* value, Float_t* pcut,
716 virtual Float_t Gbrelm(Float_t z, Float_t t, Float_t cut);
717 virtual Float_t Gprelm(Float_t z, Float_t t, Float_t cut);
718 virtual void Gmate();
719 virtual void Gpart();
720 virtual void Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
721 Float_t *absco, Float_t *effic, Float_t *rindex);
722 virtual void Gsdk(Int_t ipart, Float_t *bratio, Int_t *mode);
723 virtual void Gsmate(Int_t imat, const char *name, Float_t a, Float_t z,
724 Float_t dens, Float_t radl, Float_t absl);
725 virtual void Gsmixt(Int_t imat, const char *name, Float_t *a, Float_t *z,
726 Float_t dens, Int_t nlmat, Float_t *wmat);
727 virtual void Gspart(Int_t ipart, const char *name, Int_t itrtyp,
728 Float_t amass, Float_t charge, Float_t tlife);
729 virtual void Gstmed(Int_t numed, const char *name, Int_t nmat, Int_t isvol,
730 Int_t ifield, Float_t fieldm, Float_t tmaxfd,
731 Float_t stemax, Float_t deemax, Float_t epsil,
733 virtual void Gstpar(Int_t itmed, const char *param, Float_t parval);
735 // functions from GKINE
736 virtual void Gfkine(Int_t itra, Float_t *vert, Float_t *pvert,
737 Int_t &ipart, Int_t &nvert);
738 virtual void Gfvert(Int_t nvtx, Float_t *v, Int_t &ntbeam, Int_t &nttarg, Float_t &tofg);
739 virtual Int_t Gskine(Float_t *plab, Int_t ipart, Int_t nv, Float_t *ubuf=0, Int_t nwbuf=0);
740 virtual Int_t Gsvert(Float_t *v, Int_t ntbeam, Int_t nttarg, Float_t *ubuf=0, Int_t nwbuf=0);
742 // functions from GPHYS
743 virtual void Gphysi();
745 // functions from GTRAK
746 virtual void Gdebug();
747 virtual void Gekbin();
748 virtual void Gfinds();
749 virtual void Gsking(Int_t igk);
750 virtual void Gskpho(Int_t igk);
751 virtual void Gsstak(Int_t iflag);
752 virtual void Gsxyz();
753 virtual void Gtrack();
754 virtual void Gtreve();
755 virtual void Gtreve_root();
756 virtual void Grndm(Float_t *rvec, const Int_t len) const;
757 virtual void Grndmq(Int_t &is1, Int_t &is2, const Int_t iseq, const Text_t *chopt);
759 // functions from GGEOM
760 virtual void Gdxyz(Int_t );
761 virtual void Gdcxyz();
763 // functions from GGEOM
764 virtual void Gdtom(Float_t *xd, Float_t *xm, Int_t iflag);
765 virtual void Glmoth(const char* iudet, Int_t iunum, Int_t &nlev,
766 Int_t *lvols, Int_t *lindx);
767 virtual void Gmedia(Float_t *x, Int_t &numed);
768 virtual void Gmtod(Float_t *xm, Float_t *xd, Int_t iflag);
769 virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, Int_t iaxis);
770 virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, Int_t iaxis, Float_t c0i, Int_t numed);
771 virtual void Gsdvs(const char *name, const char *mother, Float_t step, Int_t iaxis, Int_t numed);
772 virtual void Gsdvs2(const char *name, const char *mother, Float_t step, Int_t iaxis, Float_t c0, Int_t numed);
773 virtual void Gsdvt(const char *name, const char *mother, Float_t step, Int_t iaxis, Int_t numed, Int_t ndvmx);
774 virtual void Gsdvt2(const char *name, const char *mother, Float_t step, Int_t iaxis,
775 Float_t c0, Int_t numed, Int_t ndvmx);
776 virtual void Gsord(const char *name, Int_t iax);
777 virtual void Gspos(const char *name, Int_t nr, const char *mother,
778 Float_t x, Float_t y, Float_t z, Int_t irot, const char *konly="ONLY");
779 virtual void Gsposp(const char *name, Int_t nr, const char *mother,
780 Float_t x, Float_t y, Float_t z, Int_t irot, const char *konly, Float_t *upar, Int_t np);
781 virtual void Gsrotm(Int_t nmat, Float_t theta1, Float_t phi1, Float_t theta2, Float_t phi2,
782 Float_t theta3, Float_t phi3);
783 virtual void Gprotm(Int_t nmat=0);
784 virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
785 Float_t *upar, Int_t np);
786 virtual void Gsatt(const char *name, const char *att, Int_t val);
787 virtual void Gfpara(const char *name, Int_t number, Int_t intext, Int_t& npar,
788 Int_t& natt, Float_t* par, Float_t* att);
789 virtual void Gckpar(Int_t, Int_t, Float_t*);
790 virtual void Gckmat(Int_t, char*);
792 // functions from GDRAW
793 virtual void DefaultRange();
794 virtual void InitHIGZ();
795 virtual void Gdopen(Int_t view);
796 virtual void Gdclose();
797 virtual void Gdelete(Int_t view);
798 virtual void Gdshow(Int_t view);
799 virtual void Gdopt(const char *name,const char *value);
800 virtual void Gdraw(const char *name,Float_t theta=30, Float_t phi=30, Float_t psi=0,Float_t u0=10,Float_t v0=10,Float_t ul=0.01,Float_t vl=0.01);
801 virtual void Gdrawc(const char *name,Int_t axis=1, Float_t cut=0,Float_t u0=10,Float_t v0=10,Float_t ul=0.01,Float_t vl=0.01);
802 virtual void Gdrawx(const char *name,Float_t cutthe, Float_t cutphi, Float_t cutval,
803 Float_t theta=30, Float_t phi=30,Float_t u0=10,Float_t v0=10,Float_t ul=0.01,Float_t vl=0.01);
804 virtual void Gdhead(Int_t isel, const char *name, Float_t chrsiz=0.6);
805 virtual void Gdman(Float_t u0, Float_t v0, const char *type="MAN");
806 virtual void Gdspec(const char *name);
807 virtual void DrawOneSpec(const char *name);
808 virtual void Gdtree(const char *name,Int_t levmax=15,Int_t ispec=0);
809 virtual void GdtreeParent(const char *name,Int_t levmax=15,Int_t ispec=0);
811 virtual void WriteEuclid(const char*, const char*, Int_t, Int_t);
813 virtual void SetABAN(Int_t par=1);
814 virtual void SetANNI(Int_t par=1);
815 virtual void SetAUTO(Int_t par=1);
816 virtual void SetBOMB(Float_t bomb=1);
817 virtual void SetBREM(Int_t par=1);
818 virtual void SetCKOV(Int_t par=1);
819 virtual void SetClipBox(const char *name,Float_t xmin=-9999,Float_t xmax=0, Float_t ymin=-9999,Float_t ymax=0,Float_t zmin=-9999,Float_t zmax=0);
820 virtual void SetCOMP(Int_t par=1);
821 virtual void SetCUTS(Float_t cutgam,Float_t cutele,Float_t cutneu,Float_t cuthad,
822 Float_t cutmuo ,Float_t bcute ,Float_t bcutm ,Float_t dcute ,
823 Float_t dcutm ,Float_t ppcutm, Float_t tofmax);
824 virtual void SetDCAY(Int_t par=1);
825 virtual void SetDEBU(Int_t emin=1, Int_t emax=999, Int_t emod=1);
826 virtual void SetDRAY(Int_t par=1);
827 virtual void SetERAN(Float_t ekmin=1.e-5, Float_t ekmax=1.e4,
829 virtual void SetHADR(Int_t par=1);
830 virtual void SetKINE(Int_t kine, Float_t xk1=0, Float_t xk2=0, Float_t xk3=0, Float_t xk4=0,
831 Float_t xk5=0, Float_t xk6=0, Float_t xk7=0, Float_t xk8=0, Float_t xk9=0,
833 virtual void SetLOSS(Int_t par=2);
834 virtual void SetMULS(Int_t par=1);
835 virtual void SetMUNU(Int_t par=1);
836 virtual void SetOPTI(Int_t par=2);
837 virtual void SetPAIR(Int_t par=1);
838 virtual void SetPFIS(Int_t par=1);
839 virtual void SetPHOT(Int_t par=1);
840 virtual void SetRAYL(Int_t par=1);
841 virtual void SetSTRA(Int_t par=0);
842 virtual void SetSWIT(Int_t sw, Int_t val=1);
843 virtual void SetTRIG(Int_t nevents=1);
844 virtual void SetUserDecay(Int_t ipart);
846 virtual void Vname(const char *name, char *vname);
848 virtual void InitLego();
850 // Routines from GEANE
852 virtual void Ertrgo();
853 virtual void Ertrak(const Float_t *const x1, const Float_t *const p1,
854 const Float_t *x2, const Float_t *p2,
855 Int_t ipa, Option_t *chopt);
859 virtual void FinishGeometry();
860 virtual void BuildPhysics();
862 ClassDef(TGeant3,1) //C++ interface to Geant basic routines