TGeant3TGeo.cxx File Reference

#include <ctype.h>
#include <stdlib.h>
#include "TROOT.h"
#include "TParticle.h"
#include "TDatabasePDG.h"
#include "TLorentzVector.h"
#include "TArrayI.h"
#include "TArrayD.h"
#include "TGeant3TGeo.h"
#include "TGeoManager.h"
#include "TGeoMatrix.h"
#include "TGeoMCGeometry.h"
#include "TCallf77.h"
#include "TVirtualMCDecayer.h"
#include "TPDGCode.h"

Go to the source code of this file.

Defines

#define g3smate   g3smate_
#define g3smixt   g3smixt_
#define g3stmed   g3stmed_
#define g3treve   g3treve_
#define gtreveroot   gtreveroot_
#define gcomad   gcomad_
#define g3brelm   g3brelm_
#define g3prelm   g3prelm_
#define gtreveroot   gtreveroot_

Functions

void type_of_call g3treve ()
void type_of_call gtreveroot ()
void type_of_call g3smate (const Int_t &, DEFCHARD, Float_t &, Float_t &, Float_t &, Float_t &, Float_t &, Float_t *, Int_t &DEFCHARL)
void type_of_call g3smixt (const Int_t &, DEFCHARD, const Float_t *, const Float_t *, const Float_t &, const Int_t &, Float_t *DEFCHARL)
void type_of_call g3stmed (const Int_t &, DEFCHARD, Int_t &, Int_t &, Int_t &, Float_t &, Float_t &, Float_t &, Float_t &, Float_t &, Float_t &, Float_t *, Int_t &DEFCHARL)
void type_of_call gcomad (DEFCHARD, Int_t *&DEFCHARL)
type_of_call void ginvolTGeo (Float_t *, Int_t &)
type_of_call void gtmediTGeo (Float_t *, Int_t &)
type_of_call void gtmanyTGeo (Int_t &)
type_of_call void gtonlyTGeo (Int_t &)
type_of_call void gmediaTGeo (Float_t *, Int_t &, Int_t &)
type_of_call void glvoluTGeo (Int_t &nlev, Int_t *lnam, Int_t *lnum, Int_t &ier)
type_of_call void gtnextTGeo ()
type_of_call void ggperpTGeo (Float_t *, Float_t *, Int_t &)

Variables

Gcvol1_tgcvol1 = 0
TGeoNode * gCurrentNode = 0
TGeant3TGeogeant3tgeo = 0
R__EXTERN Gctrak_tgctrak
R__EXTERN Gcvolu_tgcvolu
R__EXTERN Gckine_tgckine
R__EXTERN TGeant3geant3
R__EXTERN Gcchan_tgcchan
R__EXTERN Int_t count_ginvol
R__EXTERN Int_t count_gmedia
R__EXTERN Int_t count_gtmedi
R__EXTERN Int_t count_gtnext
R__EXTERN void(* fginvol )(Float_t *, Int_t &)
R__EXTERN void(* fgtmedi )(Float_t *, Int_t &)
R__EXTERN void(* fgtmany )(Int_t &)
R__EXTERN void(* fgtonly )(Int_t &)
R__EXTERN void(* fgmedia )(Float_t *, Int_t &, Int_t &)
R__EXTERN void(* fglvolu )(Int_t &nlev, Int_t *lnam, Int_t *lnum, Int_t &ier)
R__EXTERN void(* fgtnext )()
R__EXTERN void(* fggperp )(Float_t *, Float_t *, Int_t &)

Define Documentation

#define g3brelm   g3brelm_

Definition at line 412 of file TGeant3TGeo.cxx.

#define g3prelm   g3prelm_

Definition at line 413 of file TGeant3TGeo.cxx.

#define g3smate   g3smate_

Definition at line 405 of file TGeant3TGeo.cxx.

#define g3smixt   g3smixt_

Definition at line 406 of file TGeant3TGeo.cxx.

#define g3stmed   g3stmed_

Definition at line 407 of file TGeant3TGeo.cxx.

#define g3treve   g3treve_

Definition at line 408 of file TGeant3TGeo.cxx.

#define gcomad   gcomad_

Definition at line 410 of file TGeant3TGeo.cxx.

#define gtreveroot   gtreveroot_

Definition at line 496 of file TGeant3TGeo.cxx.

#define gtreveroot   gtreveroot_

Definition at line 496 of file TGeant3TGeo.cxx.


Function Documentation

void type_of_call g3smate ( const Int_t &  ,
DEFCHARD  ,
Float_t &  ,
Float_t &  ,
Float_t &  ,
Float_t &  ,
Float_t &  ,
Float_t *  ,
Int_t &  DEFCHARL 
)
void type_of_call g3smixt ( const Int_t &  ,
DEFCHARD  ,
const Float_t *  ,
const Float_t *  ,
const Float_t &  ,
const Int_t &  ,
Float_t *  DEFCHARL 
)
void type_of_call g3stmed ( const Int_t &  ,
DEFCHARD  ,
Int_t &  ,
Int_t &  ,
Int_t &  ,
Float_t &  ,
Float_t &  ,
Float_t &  ,
Float_t &  ,
Float_t &  ,
Float_t &  ,
Float_t *  ,
Int_t &  DEFCHARL 
)
void type_of_call g3treve (  ) 
void type_of_call gcomad ( DEFCHARD  ,
Int_t *&  DEFCHARL 
)
void ggperpTGeo ( Float_t *  ,
Float_t *  norm,
Int_t &  ierr 
)

Definition at line 2351 of file TGeant3TGeo.cxx.

References gGeoManager, and TGeant3::TrackPosition().

Referenced by TGeant3TGeo::TGeant3TGeo().

02352 {
02353 // Computes the normal to the next crossed surface, assuming that
02354 // FindNextBoundary() was already called.
02355    ierr = 0;
02356    // Make sure that the geometry has the current point
02357    Double_t pt[3];
02358    geant3tgeo->TrackPosition(pt[0], pt[1], pt[2]);
02359    gGeoManager->SetCurrentPoint(pt);
02360    Double_t *dblnorm = gGeoManager->FindNormalFast();
02361    if (!dblnorm) {
02362       ierr = 1;
02363       return;
02364    }
02365    norm[0] = -dblnorm[0];
02366    norm[1] = -dblnorm[1];
02367    norm[2] = -dblnorm[2];
02368 }

void ginvolTGeo ( Float_t *  x,
Int_t &  isame 
)

Definition at line 2179 of file TGeant3TGeo.cxx.

References gGeoManager.

Referenced by TGeant3TGeo::TGeant3TGeo().

02180 {
02181    if (gGeoManager->IsSameLocation(x[0], x[1], x[2])) isame = 1;
02182    else isame = 0;
02183 }

void glvoluTGeo ( Int_t &  nlev,
Int_t *  lnam,
Int_t *  lnum,
Int_t &  ier 
)

Definition at line 2255 of file TGeant3TGeo.cxx.

References gcvolu, gGeoManager, Gcvol1_t::lvolu1, Gcvolu_t::lvolum, Gcvolu_t::names, Gcvolu_t::nlevel, and Gcvolu_t::number.

Referenced by TGeant3TGeo::TGeant3TGeo().

02256 {
02257   //
02258   //  nlev   number of levels deap into the volume tree
02259   //         size of the arrays lnam and lnum
02260   //  lnam   an integer array whos 4 bytes contain the askii code for the
02261   //         volume names
02262   //  lnum   an integer array containing the copy numbers for that specific
02263   //         volume
02264   //
02265   //  This routine fills the volume parameters in common /gcvolu/ for a
02266   //  physical tree, specified by the list lnam and lnum of volume names
02267   //  and numbers, and for all its ascendants up to level 1. This routine
02268   //  is optimised and does not re-compute the part of the history already
02269   //  available in GCVOLU. This means that if it is used in user programs
02270   //  outside the usual framework of the tracking, the user has to initialize
02271   //  to zero NLEVEL in the common GCVOLU. It return 0 if there were no
02272   //  problems in make the call.
02273   //
02274    TGeoVolume *vol = gGeoManager->GetTopVolume();
02275    TGeoVolume *vdaughter = 0;
02276    TGeoNode *node = 0;
02277    Int_t nd;
02278    Bool_t found = kFALSE;
02279    ier = 0;
02280    gGeoManager->CdTop();
02281    if (nlev<1) nlev = 1;
02282    gcvolu->nlevel = nlev;
02283    if (nlev==1) return;
02284    Int_t *lvol = gcvol1->lvolu1;
02285    memcpy(gcvolu->names, lnam,  nlev*sizeof(Int_t));
02286    memcpy(gcvolu->number, lnum, nlev*sizeof(Int_t));
02287    memcpy(gcvolu->lvolum, lvol, nlev*sizeof(Int_t));
02288 //   for (Int_t i=0;i<nlev;i++) printf(" #%i: %i  %i  %i\n", i, lnam[i], lnum[i],lvol[i]);
02289    
02290    for (Int_t i=1; i<nlev; i++) {
02291       nd = vol->GetNdaughters();
02292       found = kFALSE;
02293       for (Int_t id=0; id<nd; id++) {
02294          node = vol->GetNode(id);
02295          vdaughter = node->GetVolume();
02296          if (vdaughter->GetNumber() == lvol[i]) {
02297             if (node->GetNumber()==lnum[i]) {
02298                found = kTRUE;
02299                gGeoManager->CdDown(id);
02300                vol = vdaughter;
02301                break;
02302             } 
02303          }
02304       }
02305       if (!found) {
02306          printf("### ERROR in TGeant3TGeo::glvoluTGeo(): cannot restore path\n");
02307          ier = 1;
02308          return;
02309       }           
02310    }   
02311 }

void gmediaTGeo ( Float_t *  x,
Int_t &  numed,
Int_t &   
)

Definition at line 2210 of file TGeant3TGeo.cxx.

References gCurrentNode, gcvolu, gGeoManager, Gcvolu_t::lvolum, medium, Gcvolu_t::names, Gcvolu_t::nlevel, and Gcvolu_t::number.

Referenced by TGeant3TGeo::TGeant3TGeo().

02211 {
02212    gCurrentNode = gGeoManager->FindNode(x[0],x[1],x[2]);
02213    if (gGeoManager->IsOutside()) {
02214       numed=0;
02215    } else {
02216       gcvolu->nlevel = 1 + gGeoManager->GetLevel();
02217       gGeoManager->GetBranchNames(gcvolu->names);
02218       gGeoManager->GetBranchNumbers(gcvolu->number,gcvolu->lvolum);
02219       TGeoVolume *vol = gCurrentNode->GetVolume();
02220       if (vol) {
02221          TGeoMedium *medium = vol->GetMedium();
02222          if (medium) numed = medium->GetId();
02223       } else {
02224          printf("ERROR: gmedia: NULL volume\n");
02225       }
02226    }
02227 }

void gtmanyTGeo ( Int_t &  level1  ) 

Definition at line 2230 of file TGeant3TGeo.cxx.

References gcvolu, Gcvol1_t::lvolu1, Gcvolu_t::lvolum, Gcvolu_t::names, Gcvol1_t::names1, Gcvolu_t::nlevel, Gcvol1_t::nlevl1, Gcvolu_t::number, and Gcvol1_t::numbr1.

Referenced by TGeant3TGeo::TGeant3TGeo().

02231 {
02232    if (level1==1) {
02233       Int_t nlevel = gcvolu->nlevel;
02234 //      printf("gtmanyTGeo nlevel=%i %s\n",nlevel,gGeoManager->GetPath());
02235       gcvol1->nlevl1 = nlevel;
02236       if (nlevel>0) {
02237          memcpy(gcvol1->names1, gcvolu->names, nlevel*sizeof(Int_t));
02238          memcpy(gcvol1->numbr1, gcvolu->number, nlevel*sizeof(Int_t));
02239          memcpy(gcvol1->lvolu1, gcvolu->lvolum, nlevel*sizeof(Int_t));
02240       }  
02241    }   
02242 }

void gtmediTGeo ( Float_t *  x,
Int_t &  numed 
)

Definition at line 2187 of file TGeant3TGeo.cxx.

References gcchan, gCurrentNode, gcvolu, gGeoManager, Gcchan_t::lsamvl, Gcvolu_t::lvolum, medium, Gcvolu_t::names, Gcvolu_t::nlevel, and Gcvolu_t::number.

Referenced by TGeant3TGeo::TGeant3TGeo().

02188 {
02189    gcchan->lsamvl = kTRUE;
02190    gCurrentNode = gGeoManager->FindNode(x[0],x[1],x[2]);
02191    gcchan->lsamvl = gGeoManager->IsSameLocation();
02192    if (gGeoManager->IsOutside()) {
02193       numed=0;
02194    } else {
02195       gcvolu->nlevel = 1 + gGeoManager->GetLevel();
02196       gGeoManager->GetBranchNames(gcvolu->names);
02197       gGeoManager->GetBranchNumbers(gcvolu->number,gcvolu->lvolum);
02198       TGeoVolume *vol = gCurrentNode->GetVolume();
02199       if (vol) {
02200          TGeoMedium *medium = vol->GetMedium();
02201          if (medium) numed = medium->GetId();
02202       } else {
02203          printf("ERROR: gtmedi: NULL volume\n");
02204       }
02205    }
02206 }

void gtnextTGeo (  ) 

Definition at line 2315 of file TGeant3TGeo.cxx.

References gckine, gctrak, gGeoManager, Gctrak_t::ignext, TGeant3TGeo::IsComputeNextMatrix(), Gckine_t::itrtyp, Gctrak_t::safety, Gctrak_t::snext, Gctrak_t::step, and Gctrak_t::vect.

Referenced by TGeant3TGeo::TGeant3TGeo().

02316 {
02317    Float_t *x = gctrak->vect;
02318    Double_t step = gctrak->step;
02319    Int_t itrtyp = gckine->itrtyp;
02320    gGeoManager->SetCurrentPoint(x[0],x[1],x[2]);
02321    gGeoManager->SetCurrentDirection(x[3],x[4],x[5]);
02322    if (step<=0) {
02323       gctrak->safety = 0.;
02324       gctrak->snext = 0.;
02325       gctrak->ignext = 0;
02326       return;
02327    }
02328    // Find distance to next boundary. Global matrix computed only if
02329    // gtnext is called by gtckov.
02330    if (itrtyp==7 || geant3tgeo->IsComputeNextMatrix()) gGeoManager->FindNextBoundary(-step);
02331    else           gGeoManager->FindNextBoundary(step);
02332    gctrak->safety = gGeoManager->GetSafeDistance();
02333    Double_t snext  = gGeoManager->GetStep();
02334    if (snext<=0) {
02335       gctrak->safety = 0.;
02336       gctrak->snext = 0.;
02337       gctrak->ignext = 1;
02338       return;
02339    }
02340    if (snext < step) {
02341       gctrak->snext  = snext;
02342       gctrak->ignext = 1;
02343    } else {
02344       gctrak->ignext = 0;
02345       gctrak->snext = gctrak->step;
02346    }
02347 }

void gtonlyTGeo ( Int_t &  isOnly  ) 

Definition at line 2245 of file TGeant3TGeo.cxx.

Referenced by TGeant3TGeo::TGeant3TGeo().

02246 {
02247    //with Geant3, return gonly(nlevel);
02248 //   if (gGeoManager->IsCurrentOverlapping()) isOnly = 0;
02249 //   else isOnly = 1;
02250    // With TGeo, G3 is seeing a ONLY geometry
02251    isOnly = 1;
02252 }

void type_of_call gtreveroot (  ) 

Variable Documentation

R__EXTERN Int_t count_ginvol

Definition at line 524 of file TGeant3TGeo.cxx.

R__EXTERN Int_t count_gmedia

Definition at line 525 of file TGeant3TGeo.cxx.

R__EXTERN Int_t count_gtmedi

Definition at line 526 of file TGeant3TGeo.cxx.

R__EXTERN Int_t count_gtnext

Definition at line 527 of file TGeant3TGeo.cxx.

R__EXTERN void(* fggperp)(Float_t *, Float_t *, Int_t &)
R__EXTERN void(* fginvol)(Float_t *, Int_t &)
R__EXTERN void(* fglvolu)(Int_t &nlev, Int_t *lnam, Int_t *lnum, Int_t &ier)
R__EXTERN void(* fgmedia)(Float_t *, Int_t &, Int_t &)
R__EXTERN void(* fgtmany)(Int_t &)
R__EXTERN void(* fgtmedi)(Float_t *, Int_t &)
R__EXTERN void(* fgtnext)()
R__EXTERN void(* fgtonly)(Int_t &)
R__EXTERN Gcchan_t* gcchan

Definition at line 523 of file TGeant3TGeo.cxx.

R__EXTERN Gckine_t* gckine

Definition at line 521 of file TGeant3TGeo.cxx.

R__EXTERN Gctrak_t* gctrak

Definition at line 519 of file TGeant3TGeo.cxx.

TGeoNode* gCurrentNode = 0

Definition at line 517 of file TGeant3TGeo.cxx.

Referenced by TGeant3TGeo::Gmedia(), gmediaTGeo(), and gtmediTGeo().

Definition at line 516 of file TGeant3TGeo.cxx.

R__EXTERN Gcvolu_t* gcvolu

Definition at line 520 of file TGeant3TGeo.cxx.

R__EXTERN TGeant3* geant3

Definition at line 522 of file TGeant3TGeo.cxx.

Definition at line 518 of file TGeant3TGeo.cxx.


Generated on 8 Jul 2019 for loon by  doxygen 1.6.1