All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions | Variables
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 "larreco/Genfit/TGeant3/TGeant3TGeo.h"
#include "TGeoManager.h"
#include "TGeoMatrix.h"
#include "TGeoMCGeometry.h"
#include "larreco/Genfit/TGeant3/TCallf77.h"
#include "TVirtualMCDecayer.h"
#include "TPDGCode.h"

Go to the source code of this file.

Macros

#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
 
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 &)
 

Macro Definition Documentation

#define g3brelm   g3brelm_

Definition at line 413 of file TGeant3TGeo.cxx.

#define g3prelm   g3prelm_

Definition at line 414 of file TGeant3TGeo.cxx.

#define g3smate   g3smate_

Definition at line 406 of file TGeant3TGeo.cxx.

#define g3smixt   g3smixt_

Definition at line 407 of file TGeant3TGeo.cxx.

#define g3stmed   g3stmed_

Definition at line 408 of file TGeant3TGeo.cxx.

#define g3treve   g3treve_

Definition at line 409 of file TGeant3TGeo.cxx.

#define gcomad   gcomad_

Definition at line 411 of file TGeant3TGeo.cxx.

#define gtreveroot   gtreveroot_

Definition at line 497 of file TGeant3TGeo.cxx.

#define gtreveroot   gtreveroot_

Definition at line 497 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 2305 of file TGeant3TGeo.cxx.

2306 {
2307 // Computes the normal to the next crossed surface, assuming that
2308 // FindNextBoundary() was already called.
2309  ierr = 0;
2310  Double_t *dblnorm = gGeoManager->FindNormalFast();
2311  if (!dblnorm) {
2312  ierr = 1;
2313  return;
2314  }
2315  norm[0] = -dblnorm[0];
2316  norm[1] = -dblnorm[1];
2317  norm[2] = -dblnorm[2];
2318 }
auto norm(Vector const &v)
Return norm of the specified vector.
void ginvolTGeo ( Float_t *  x,
Int_t &  isame 
)

Definition at line 2133 of file TGeant3TGeo.cxx.

2134 {
2135  if (gGeoManager->IsSameLocation(x[0], x[1], x[2])) isame = 1;
2136  else isame = 0;
2137 }
list x
Definition: train.py:276
void glvoluTGeo ( Int_t &  nlev,
Int_t *  lnam,
Int_t *  lnum,
Int_t &  ier 
)

Definition at line 2209 of file TGeant3TGeo.cxx.

2210 {
2211  //
2212  // nlev number of levels deap into the volume tree
2213  // size of the arrays lnam and lnum
2214  // lnam an integer array whos 4 bytes contain the askii code for the
2215  // volume names
2216  // lnum an integer array containing the copy numbers for that specific
2217  // volume
2218  //
2219  // This routine fills the volume parameters in common /gcvolu/ for a
2220  // physical tree, specified by the list lnam and lnum of volume names
2221  // and numbers, and for all its ascendants up to level 1. This routine
2222  // is optimised and does not re-compute the part of the history already
2223  // available in GCVOLU. This means that if it is used in user programs
2224  // outside the usual framework of the tracking, the user has to initialize
2225  // to zero NLEVEL in the common GCVOLU. It return 0 if there were no
2226  // problems in make the call.
2227  //
2228  TGeoVolume *vol = gGeoManager->GetTopVolume();
2229  TGeoVolume *vdaughter = 0;
2230  TGeoNode *node = 0;
2231  Int_t nd;
2232  Bool_t found = kFALSE;
2233  ier = 0;
2234  gGeoManager->CdTop();
2235  if (nlev<1) nlev = 1;
2236  gcvolu->nlevel = nlev;
2237  if (nlev==1) return;
2238  Int_t *lvol = gcvol1->lvolu1;
2239  memcpy(gcvolu->names, lnam, nlev*sizeof(Int_t));
2240  memcpy(gcvolu->number, lnum, nlev*sizeof(Int_t));
2241  memcpy(gcvolu->lvolum, lvol, nlev*sizeof(Int_t));
2242 // for (Int_t i=0;i<nlev;i++) printf(" #%i: %i %i %i\n", i, lnam[i], lnum[i],lvol[i]);
2243 
2244  for (Int_t i=1; i<nlev; i++) {
2245  nd = vol->GetNdaughters();
2246  found = kFALSE;
2247  for (Int_t id=0; id<nd; id++) {
2248  node = vol->GetNode(id);
2249  vdaughter = node->GetVolume();
2250  if (vdaughter->GetNumber() == lvol[i]) {
2251  if (node->GetNumber()==lnum[i]) {
2252  found = kTRUE;
2253  gGeoManager->CdDown(id);
2254  vol = vdaughter;
2255  break;
2256  }
2257  }
2258  }
2259  if (!found) {
2260  printf("### ERROR in TGeant3TGeo::glvoluTGeo(): cannot restore path\n");
2261  ier = 1;
2262  return;
2263  }
2264  }
2265 }
Int_t number[15]
Definition: TGeant3.h:287
Int_t lvolu1[15]
Definition: TGeant3TGeo.h:29
Gcvol1_t * gcvol1
Int_t names[15]
Definition: TGeant3.h:286
R__EXTERN Gcvolu_t * gcvolu
Int_t lvolum[15]
Definition: TGeant3.h:288
Int_t nlevel
Definition: TGeant3.h:285
void gmediaTGeo ( Float_t *  x,
Int_t &  numed,
Int_t &   
)

Definition at line 2164 of file TGeant3TGeo.cxx.

2165 {
2166  gCurrentNode = gGeoManager->FindNode(x[0],x[1],x[2]);
2167  if (gGeoManager->IsOutside()) {
2168  numed=0;
2169  } else {
2170  gcvolu->nlevel = 1 + gGeoManager->GetLevel();
2171  gGeoManager->GetBranchNames(gcvolu->names);
2172  gGeoManager->GetBranchNumbers(gcvolu->number,gcvolu->lvolum);
2173  TGeoVolume *vol = gCurrentNode->GetVolume();
2174  if (vol) {
2175  TGeoMedium *medium = vol->GetMedium();
2176  if (medium) numed = medium->GetId();
2177  } else {
2178  printf("ERROR: gmedia: NULL volume\n");
2179  }
2180  }
2181 }
Int_t number[15]
Definition: TGeant3.h:287
Int_t names[15]
Definition: TGeant3.h:286
TGeoNode * gCurrentNode
R__EXTERN Gcvolu_t * gcvolu
Int_t lvolum[15]
Definition: TGeant3.h:288
Int_t nlevel
Definition: TGeant3.h:285
list x
Definition: train.py:276
void gtmanyTGeo ( Int_t &  level1)

Definition at line 2184 of file TGeant3TGeo.cxx.

2185 {
2186  if (level1==1) {
2187  Int_t nlevel = gcvolu->nlevel;
2188 // printf("gtmanyTGeo nlevel=%i %s\n",nlevel,gGeoManager->GetPath());
2189  gcvol1->nlevl1 = nlevel;
2190  if (nlevel>0) {
2191  memcpy(gcvol1->names1, gcvolu->names, nlevel*sizeof(Int_t));
2192  memcpy(gcvol1->numbr1, gcvolu->number, nlevel*sizeof(Int_t));
2193  memcpy(gcvol1->lvolu1, gcvolu->lvolum, nlevel*sizeof(Int_t));
2194  }
2195  }
2196 }
Int_t numbr1[15]
Definition: TGeant3TGeo.h:28
Int_t number[15]
Definition: TGeant3.h:287
Int_t lvolu1[15]
Definition: TGeant3TGeo.h:29
Gcvol1_t * gcvol1
Int_t names1[15]
Definition: TGeant3TGeo.h:27
Int_t names[15]
Definition: TGeant3.h:286
R__EXTERN Gcvolu_t * gcvolu
Int_t lvolum[15]
Definition: TGeant3.h:288
Int_t nlevel
Definition: TGeant3.h:285
Int_t nlevl1
Definition: TGeant3TGeo.h:26
void gtmediTGeo ( Float_t *  x,
Int_t &  numed 
)

Definition at line 2141 of file TGeant3TGeo.cxx.

2142 {
2143  gcchan->lsamvl = kTRUE;
2144  gCurrentNode = gGeoManager->FindNode(x[0],x[1],x[2]);
2145  gcchan->lsamvl = gGeoManager->IsSameLocation();
2146  if (gGeoManager->IsOutside()) {
2147  numed=0;
2148  } else {
2149  gcvolu->nlevel = 1 + gGeoManager->GetLevel();
2150  gGeoManager->GetBranchNames(gcvolu->names);
2151  gGeoManager->GetBranchNumbers(gcvolu->number,gcvolu->lvolum);
2152  TGeoVolume *vol = gCurrentNode->GetVolume();
2153  if (vol) {
2154  TGeoMedium *medium = vol->GetMedium();
2155  if (medium) numed = medium->GetId();
2156  } else {
2157  printf("ERROR: gtmedi: NULL volume\n");
2158  }
2159  }
2160 }
Int_t number[15]
Definition: TGeant3.h:287
Int_t names[15]
Definition: TGeant3.h:286
TGeoNode * gCurrentNode
R__EXTERN Gcvolu_t * gcvolu
Int_t lsamvl
Definition: TGeant3.h:632
Int_t lvolum[15]
Definition: TGeant3.h:288
Int_t nlevel
Definition: TGeant3.h:285
R__EXTERN Gcchan_t * gcchan
list x
Definition: train.py:276
void gtnextTGeo ( )

Definition at line 2269 of file TGeant3TGeo.cxx.

2270 {
2271  Float_t *x = gctrak->vect;
2272  Double_t step = gctrak->step;
2273  Int_t itrtyp = gckine->itrtyp;
2274  gGeoManager->SetCurrentPoint(x[0],x[1],x[2]);
2275  gGeoManager->SetCurrentDirection(x[3],x[4],x[5]);
2276  if (step<=0) {
2277  gctrak->safety = 0.;
2278  gctrak->snext = 0.;
2279  gctrak->ignext = 0;
2280  return;
2281  }
2282  // Find distance to next boundary. Global matrix computed only if
2283  // gtnext is called by gtckov.
2284  if (itrtyp==7) gGeoManager->FindNextBoundary(-step);
2285  else gGeoManager->FindNextBoundary(step);
2286  gctrak->safety = gGeoManager->GetSafeDistance();
2287  Double_t snext = gGeoManager->GetStep();
2288  if (snext<=0) {
2289  gctrak->safety = 0.;
2290  gctrak->snext = 0.;
2291  gctrak->ignext = 1;
2292  return;
2293  }
2294  if (snext < step) {
2295  gctrak->snext = snext;
2296  gctrak->ignext = 1;
2297  } else {
2298  gctrak->ignext = 0;
2299  gctrak->snext = gctrak->step;
2300  }
2301 }
Float_t safety
Definition: TGeant3.h:258
Int_t ignext
Definition: TGeant3.h:266
Float_t vect[7]
Definition: TGeant3.h:247
Float_t step
Definition: TGeant3.h:260
R__EXTERN Gctrak_t * gctrak
Float_t snext
Definition: TGeant3.h:261
list x
Definition: train.py:276
R__EXTERN Gckine_t * gckine
Int_t itrtyp
Definition: TGeant3.h:169
void gtonlyTGeo ( Int_t &  isOnly)

Definition at line 2199 of file TGeant3TGeo.cxx.

2200 {
2201  //with Geant3, return gonly(nlevel);
2202 // if (gGeoManager->IsCurrentOverlapping()) isOnly = 0;
2203 // else isOnly = 1;
2204  // With TGeo, G3 is seeing a ONLY geometry
2205  isOnly = 1;
2206 }
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 &)

Definition at line 536 of file TGeant3TGeo.cxx.

R__EXTERN void(* fginvol) (Float_t *, Int_t &)

Definition at line 529 of file TGeant3TGeo.cxx.

R__EXTERN void(* fglvolu) (Int_t &nlev, Int_t *lnam, Int_t *lnum, Int_t &ier)

Definition at line 534 of file TGeant3TGeo.cxx.

R__EXTERN void(* fgmedia) (Float_t *, Int_t &, Int_t &)

Definition at line 533 of file TGeant3TGeo.cxx.

R__EXTERN void(* fgtmany) (Int_t &)

Definition at line 531 of file TGeant3TGeo.cxx.

R__EXTERN void(* fgtmedi) (Float_t *, Int_t &)

Definition at line 530 of file TGeant3TGeo.cxx.

R__EXTERN void(* fgtnext) ()

Definition at line 535 of file TGeant3TGeo.cxx.

R__EXTERN void(* fgtonly) (Int_t &)

Definition at line 532 of file TGeant3TGeo.cxx.

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 518 of file TGeant3TGeo.cxx.

Gcvol1_t* gcvol1 = 0

Definition at line 517 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.