ROOT  6.06/09
Reference Guide
TVirtualMC.h
Go to the documentation of this file.
1 // @(#)root/vmc:$Name: $:$Id$
2 // Authors: Ivana Hrivnacova, Rene Brun, Federico Carminati 13/04/2002
3 
4 /*************************************************************************
5  * Copyright (C) 2006, Rene Brun and Fons Rademakers. *
6  * Copyright (C) 2002, ALICE Experiment at CERN. *
7  * All rights reserved. *
8  * *
9  * For the licensing terms see $ROOTSYS/LICENSE. *
10  * For the list of contributors see $ROOTSYS/README/CREDITS. *
11  *************************************************************************/
12 
13 #ifndef ROOT_TVirtualMC
14 #define ROOT_TVirtualMC
15 
16 ///////////////////////////////////////////////////////////////////////////////
17 // //
18 // //
19 // Abstract Monte Carlo interface //
20 // //
21 // //
22 ///////////////////////////////////////////////////////////////////////////////
23 
24 #include "TMCProcess.h"
25 #include "TMCParticleType.h"
26 #include "TMCOptical.h"
27 #include "TMCtls.h"
28 #include "TVirtualMCApplication.h"
29 #include "TVirtualMCStack.h"
30 #include "TVirtualMCDecayer.h"
31 #include "TVirtualMagField.h"
32 #include "TRandom.h"
33 #include "TString.h"
34 #include "TError.h"
35 
36 class TLorentzVector;
37 class TGeoHMatrix;
38 class TArrayI;
39 class TArrayD;
40 
41 class TVirtualMC : public TNamed {
42 
43 public:
44  // Standard constructor
45  // isRootGeometrySupported = True if implementation of TVirtualMC
46  // supports geometry defined with TGeo
47  TVirtualMC(const char *name, const char *title,
48  Bool_t isRootGeometrySupported = kFALSE);
49 
50  // Default constructor
51  TVirtualMC();
52 
53  // Destructor
54  virtual ~TVirtualMC();
55 
56  // Static access method
57  static TVirtualMC* GetMC();
58 
59  //
60  // ------------------------------------------------
61  // methods for building/management of geometry
62  // ------------------------------------------------
63  //
64 
65  // Info about supporting geometry defined via Root
66  virtual Bool_t IsRootGeometrySupported() const = 0;
67 
68  //
69  // functions from GCONS
70  // ------------------------------------------------
71  //
72 
73  // Define a material
74  // kmat number assigned to the material
75  // name material name
76  // a atomic mass in au
77  // z atomic number
78  // dens density in g/cm3
79  // absl absorption length in cm;
80  // if >=0 it is ignored and the program
81  // calculates it, if <0. -absl is taken
82  // radl radiation length in cm
83  // if >=0 it is ignored and the program
84  // calculates it, if <0. -radl is taken
85  // buf pointer to an array of user words
86  // nwbuf number of user words
87  virtual void Material(Int_t& kmat, const char* name, Double_t a,
88  Double_t z, Double_t dens, Double_t radl, Double_t absl,
89  Float_t* buf, Int_t nwbuf) = 0;
90 
91  // The same as previous but in double precision
92  virtual void Material(Int_t& kmat, const char* name, Double_t a,
93  Double_t z, Double_t dens, Double_t radl, Double_t absl,
94  Double_t* buf, Int_t nwbuf) = 0;
95 
96  // Define mixture or compound
97  // with a number kmat composed by the basic nlmat materials defined
98  // by arrays a, z and wmat
99  //
100  // If nlmat > 0 then wmat contains the proportion by
101  // weights of each basic material in the mixture.
102  //
103  // If nlmat < 0 then wmat contains the number of atoms
104  // of a given kind into the molecule of the compound.
105  // In this case, wmat in output is changed to relative
106  // weights.
107  virtual void Mixture(Int_t& kmat, const char *name, Float_t *a,
108  Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat) = 0;
109 
110  // The same as previous but in double precision
111  virtual void Mixture(Int_t& kmat, const char *name, Double_t *a,
112  Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat) = 0;
113 
114  // Define a medium.
115  // kmed tracking medium number assigned
116  // name tracking medium name
117  // nmat material number
118  // isvol sensitive volume flag
119  // ifield magnetic field:
120  // - ifield = 0 if no magnetic field;
121  // - ifield = -1 if user decision in guswim;
122  // - ifield = 1 if tracking performed with g3rkuta;
123  // - ifield = 2 if tracking performed with g3helix;
124  // - ifield = 3 if tracking performed with g3helx3.
125  // fieldm max. field value (kilogauss)
126  // tmaxfd max. angle due to field (deg/step)
127  // stemax max. step allowed
128  // deemax max. fraction of energy lost in a step
129  // epsil tracking precision (cm)
130  // stmin min. step due to continuous processes (cm)
131  // ubuf pointer to an array of user words
132  // nbuf number of user words
133  virtual void Medium(Int_t& kmed, const char *name, Int_t nmat,
134  Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd,
135  Double_t stemax, Double_t deemax, Double_t epsil,
136  Double_t stmin, Float_t* ubuf, Int_t nbuf) = 0;
137 
138  // The same as previous but in double precision
139  virtual void Medium(Int_t& kmed, const char *name, Int_t nmat,
140  Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd,
141  Double_t stemax, Double_t deemax, Double_t epsil,
142  Double_t stmin, Double_t* ubuf, Int_t nbuf) = 0;
143 
144  // Define a rotation matrix
145  // krot rotation matrix number assigned
146  // thetaX polar angle for axis X
147  // phiX azimuthal angle for axis X
148  // thetaY polar angle for axis Y
149  // phiY azimuthal angle for axis Y
150  // thetaZ polar angle for axis Z
151  // phiZ azimuthal angle for axis Z
152  virtual void Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
153  Double_t thetaY, Double_t phiY, Double_t thetaZ,
154  Double_t phiZ) = 0;
155 
156  // Change the value of cut or mechanism param
157  // to a new value parval for tracking medium itmed.
158  // In Geant3, the data structure JTMED contains the standard tracking
159  // parameters (CUTS and flags to control the physics processes) which
160  // are used by default for all tracking media.
161  // It is possible to redefine individually with this function any of these
162  // parameters for a given tracking medium.
163  // itmed tracking medium number
164  // param is a character string (variable name)
165  // parval must be given as a floating point.
166  virtual void Gstpar(Int_t itmed, const char *param, Double_t parval) = 0;
167 
168  //
169  // functions from GGEOM
170  // ------------------------------------------------
171  //
172 
173  // Create a new volume
174  // name Volume name
175  // shape Volume type
176  // nmed Tracking medium number
177  // np Number of shape parameters
178  // upar Vector containing shape parameters
179  virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
180  Float_t *upar, Int_t np) = 0;
181 
182  // The same as previous but in double precision
183  virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
184  Double_t *upar, Int_t np) = 0;
185 
186  // Create a new volume by dividing an existing one.
187  // It divides a previously defined volume
188  // name Volume name
189  // mother Mother volume name
190  // ndiv Number of divisions
191  // iaxis Axis value:
192  // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS.
193  virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv,
194  Int_t iaxis) = 0;
195 
196  // Create a new volume by dividing an existing one.
197  // Divide mother into ndiv divisions called name
198  // along axis iaxis starting at coordinate value c0i.
199  // The new volume created will be medium number numed.
200  virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv,
201  Int_t iaxis, Double_t c0i, Int_t numed) = 0;
202 
203  // Create a new volume by dividing an existing one
204  // Divide mother into divisions called name along
205  // axis iaxis in steps of step. If not exactly divisible
206  // will make as many as possible and will center them
207  // with respect to the mother. Divisions will have medium
208  // number numed. If numed is 0, numed of mother is taken.
209  // ndvmx is the expected maximum number of divisions
210  // (If 0, no protection tests are performed in Geant3)
211  virtual void Gsdvt(const char *name, const char *mother, Double_t step,
212  Int_t iaxis, Int_t numed, Int_t ndvmx) = 0;
213 
214  // Create a new volume by dividing an existing one
215  // Divides mother into divisions called name along
216  // axis iaxis starting at coordinate value c0 with step
217  // size step.
218  // The new volume created will have medium number numed.
219  // If numed is 0, numed of mother is taken.
220  // ndvmx is the expected maximum number of divisions
221  // (If 0, no protection tests are performed in Geant3)
222  virtual void Gsdvt2(const char *name, const char *mother, Double_t step,
223  Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) = 0;
224 
225  // Flag volume name whose contents will have to be ordered
226  // along axis iax, by setting the search flag to -iax
227  // (Geant3 only)
228  virtual void Gsord(const char *name, Int_t iax) = 0;
229 
230  // Position a volume into an existing one.
231  // It positions a previously defined volume in the mother.
232  // name Volume name
233  // nr Copy number of the volume
234  // mother Mother volume name
235  // x X coord. of the volume in mother ref. sys.
236  // y Y coord. of the volume in mother ref. sys.
237  // z Z coord. of the volume in mother ref. sys.
238  // irot Rotation matrix number w.r.t. mother ref. sys.
239  // konly ONLY/MANY flag
240  virtual void Gspos(const char *name, Int_t nr, const char *mother,
241  Double_t x, Double_t y, Double_t z, Int_t irot,
242  const char *konly="ONLY") = 0;
243 
244  // Place a copy of generic volume name with user number
245  // nr inside mother, with its parameters upar(1..np)
246  virtual void Gsposp(const char *name, Int_t nr, const char *mother,
247  Double_t x, Double_t y, Double_t z, Int_t irot,
248  const char *konly, Float_t *upar, Int_t np) = 0;
249 
250  // The same as previous but in double precision
251  virtual void Gsposp(const char *name, Int_t nr, const char *mother,
252  Double_t x, Double_t y, Double_t z, Int_t irot,
253  const char *konly, Double_t *upar, Int_t np) = 0;
254 
255  // Helper function for resolving MANY.
256  // Specify the ONLY volume that overlaps with the
257  // specified MANY and has to be substracted.
258  // (Geant4 only)
259  virtual void Gsbool(const char* onlyVolName, const char* manyVolName) = 0;
260 
261  // Define the tables for UV photon tracking in medium itmed.
262  // Please note that it is the user's responsibility to
263  // provide all the coefficients:
264  // itmed Tracking medium number
265  // npckov Number of bins of each table
266  // ppckov Value of photon momentum (in GeV)
267  // absco Absorption coefficients
268  // dielectric: absorption length in cm
269  // metals : absorption fraction (0<=x<=1)
270  // effic Detection efficiency for UV photons
271  // rindex Refraction index (if=0 metal)
272  virtual void SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
273  Float_t *absco, Float_t *effic, Float_t *rindex) = 0;
274 
275  // The same as previous but in double precision
276  virtual void SetCerenkov(Int_t itmed, Int_t npckov, Double_t *ppckov,
277  Double_t *absco, Double_t *effic, Double_t *rindex) = 0;
278 
279  //
280  // functions for definition of surfaces
281  // and material properties for optical physics
282  // ------------------------------------------------
283  //
284 
285  // Define the optical surface
286  // name surface name
287  // model selection of model (see #EMCOpSurfaceModel values)
288  // surfaceType surface type (see #EMCOpSurfaceType values)
289  // surfaceFinish surface quality (see #EMCOpSurfaceType values)
290  // sigmaAlpha an unified model surface parameter
291  // (Geant4 only)
292  virtual void DefineOpSurface(const char* name,
293  EMCOpSurfaceModel model,
294  EMCOpSurfaceType surfaceType,
295  EMCOpSurfaceFinish surfaceFinish,
296  Double_t sigmaAlpha) = 0;
297 
298  // Define the optical surface border
299  // name border surface name
300  // vol1Name first volume name
301  // vol1CopyNo first volume copy number
302  // vol2Name second volume name
303  // vol2CopyNo second volume copy number
304  // opSurfaceName name of optical surface which this border belongs to
305  // (Geant4 only)
306  virtual void SetBorderSurface(const char* name,
307  const char* vol1Name, int vol1CopyNo,
308  const char* vol2Name, int vol2CopyNo,
309  const char* opSurfaceName) = 0;
310 
311  // Define the optical skin surface
312  // name skin surface name
313  // volName volume name
314  // opSurfaceName name of optical surface which this border belongs to
315  // (Geant4 only)
316  virtual void SetSkinSurface(const char* name,
317  const char* volName,
318  const char* opSurfaceName) = 0;
319 
320  // Define material property via a table of values
321  // itmed tracking medium id
322  // propertyName property name
323  // np number of bins of the table
324  // pp value of photon momentum (in GeV)
325  // values property values
326  // (Geant4 only)
327  virtual void SetMaterialProperty(
328  Int_t itmed, const char* propertyName,
329  Int_t np, Double_t* pp, Double_t* values) = 0;
330 
331  // Define material property via a value
332  // itmed tracking medium id
333  // propertyName property name
334  // value property value
335  // (Geant4 only)
336  virtual void SetMaterialProperty(
337  Int_t itmed, const char* propertyName,
338  Double_t value) = 0;
339 
340  // Define optical surface property via a table of values
341  // surfaceName optical surface name
342  // propertyName property name
343  // np number of bins of the table
344  // pp value of photon momentum (in GeV)
345  // values property values
346  // (Geant4 only)
347  virtual void SetMaterialProperty(
348  const char* surfaceName, const char* propertyName,
349  Int_t np, Double_t* pp, Double_t* values) = 0;
350 
351  //
352  // functions for access to geometry
353  // ------------------------------------------------
354  //
355 
356  // Return the transformation matrix between the volume specified by
357  // the path volumePath and the top or master volume.
358  virtual Bool_t GetTransformation(const TString& volumePath,
359  TGeoHMatrix& matrix) = 0;
360 
361  // Return the name of the shape (shapeType) and its parameters par
362  // for the volume specified by the path volumePath .
363  virtual Bool_t GetShape(const TString& volumePath,
364  TString& shapeType, TArrayD& par) = 0;
365 
366  // Return the material parameters for the material specified by
367  // the material Id
368  virtual Bool_t GetMaterial(Int_t imat, TString& name,
369  Double_t& a, Double_t& z, Double_t& density,
370  Double_t& radl, Double_t& inter, TArrayD& par) = 0;
371 
372  // Return the material parameters for the volume specified by
373  // the volumeName.
374  virtual Bool_t GetMaterial(const TString& volumeName,
375  TString& name, Int_t& imat,
376  Double_t& a, Double_t& z, Double_t& density,
377  Double_t& radl, Double_t& inter, TArrayD& par) = 0;
378 
379  // Return the medium parameters for the volume specified by the
380  // volumeName.
381  virtual Bool_t GetMedium(const TString& volumeName,
382  TString& name, Int_t& imed,
383  Int_t& nmat, Int_t& isvol, Int_t& ifield,
384  Double_t& fieldm, Double_t& tmaxfd, Double_t& stemax,
385  Double_t& deemax, Double_t& epsil, Double_t& stmin,
386  TArrayD& par) = 0;
387 
388  // Write out the geometry of the detector in EUCLID file format
389  // filnam file name - will be with the extension .euc *
390  // topvol volume name of the starting node
391  // number copy number of topvol (relevant for gsposp)
392  // nlevel number of levels in the tree structure
393  // to be written out, starting from topvol
394  // (Geant3 only)
395  // Deprecated
396  virtual void WriteEuclid(const char* filnam, const char* topvol,
397  Int_t number, Int_t nlevel) = 0;
398 
399  // Set geometry from Root (built via TGeo)
400  virtual void SetRootGeometry() = 0;
401 
402  // Activate the parameters defined in tracking media
403  // (DEEMAX, STMIN, STEMAX), which are, be default, ignored.
404  // In Geant4 case, only STEMAX is taken into account.
405  // In FLUKA, all tracking media parameters are ignored.
406  virtual void SetUserParameters(Bool_t isUserParameters) = 0;
407 
408  //
409  // get methods
410  // ------------------------------------------------
411  //
412 
413  // Return the unique numeric identifier for volume name volName
414  virtual Int_t VolId(const char* volName) const = 0;
415 
416  // Return the volume name for a given volume identifier id
417  virtual const char* VolName(Int_t id) const = 0;
418 
419  // Return the unique numeric identifier for medium name mediumName
420  virtual Int_t MediumId(const char* mediumName) const = 0;
421 
422  // Return total number of volumes in the geometry
423  virtual Int_t NofVolumes() const = 0;
424 
425  // Return material number for a given volume id
426  virtual Int_t VolId2Mate(Int_t id) const = 0;
427 
428  // Return number of daughters of the volume specified by volName
429  virtual Int_t NofVolDaughters(const char* volName) const = 0;
430 
431  // Return the name of i-th daughter of the volume specified by volName
432  virtual const char* VolDaughterName(const char* volName, Int_t i) const = 0;
433 
434  // Return the copyNo of i-th daughter of the volume specified by volName
435  virtual Int_t VolDaughterCopyNo(const char* volName, Int_t i) const = 0;
436 
437  //
438  // ------------------------------------------------
439  // methods for physics management
440  // ------------------------------------------------
441  //
442 
443  //
444  // set methods
445  // ------------------------------------------------
446  //
447 
448  // Set transport cuts for particles
449  virtual Bool_t SetCut(const char* cutName, Double_t cutValue) = 0;
450 
451  // Set process control
452  virtual Bool_t SetProcess(const char* flagName, Int_t flagValue) = 0;
453 
454  // Set a user defined particle
455  // Function is ignored if particle with specified pdg
456  // already exists and error report is printed.
457  // pdg PDG encoding
458  // name particle name
459  // mcType VMC Particle type
460  // mass mass [GeV]
461  // charge charge [eplus]
462  // lifetime time of life [s]
463  // pType particle type as in Geant4
464  // width width [GeV]
465  // iSpin spin
466  // iParity parity
467  // iConjugation conjugation
468  // iIsospin isospin
469  // iIsospinZ isospin - #rd component
470  // gParity gParity
471  // lepton lepton number
472  // baryon baryon number
473  // stable stability
474  // shortlived is shorlived?
475  // subType particle subType as in Geant4
476  // antiEncoding anti encoding
477  // magMoment magnetic moment
478  // excitation excitation energy [GeV]
479  virtual Bool_t DefineParticle(Int_t pdg, const char* name,
480  TMCParticleType mcType,
481  Double_t mass, Double_t charge, Double_t lifetime) = 0;
482 
483  // Set a user defined particle
484  // Function is ignored if particle with specified pdg
485  // already exists and error report is printed.
486  // pdg PDG encoding
487  // name particle name
488  // mcType VMC Particle type
489  // mass mass [GeV]
490  // charge charge [eplus]
491  // lifetime time of life [s]
492  // pType particle type as in Geant4
493  // width width [GeV]
494  // iSpin spin
495  // iParity parity
496  // iConjugation conjugation
497  // iIsospin isospin
498  // iIsospinZ isospin - #rd component
499  // gParity gParity
500  // lepton lepton number
501  // baryon baryon number
502  // stable stability
503  // shortlived is shorlived?
504  // subType particle subType as in Geant4
505  // antiEncoding anti encoding
506  // magMoment magnetic moment
507  // excitation excitation energy [GeV]
508  virtual Bool_t DefineParticle(Int_t pdg, const char* name,
509  TMCParticleType mcType,
510  Double_t mass, Double_t charge, Double_t lifetime,
511  const TString& pType, Double_t width,
512  Int_t iSpin, Int_t iParity, Int_t iConjugation,
513  Int_t iIsospin, Int_t iIsospinZ, Int_t gParity,
514  Int_t lepton, Int_t baryon,
515  Bool_t stable, Bool_t shortlived = kFALSE,
516  const TString& subType = "",
517  Int_t antiEncoding = 0, Double_t magMoment = 0.0,
518  Double_t excitation = 0.0) = 0;
519 
520  // Set a user defined ion.
521  // name ion name
522  // Z atomic number
523  // A atomic mass
524  // Q charge [eplus}
525  // excitation excitation energy [GeV]
526  // mass mass [GeV] (if not specified by user, approximative
527  // mass is calculated)
528  virtual Bool_t DefineIon(const char* name, Int_t Z, Int_t A,
529  Int_t Q, Double_t excEnergy, Double_t mass = 0.) = 0;
530 
531  // Set a user phase space decay for a particle
532  // pdg particle PDG encoding
533  // bratios the array with branching ratios (in %)
534  // mode[6][3] the array with daughters particles PDG codes for each
535  // decay channel
536  virtual Bool_t SetDecayMode(Int_t pdg, Float_t bratio[6], Int_t mode[6][3]) = 0;
537 
538  // Calculate X-sections
539  // (Geant3 only)
540  // Deprecated
541  virtual Double_t Xsec(char*, Double_t, Int_t, Int_t) = 0;
542 
543  //
544  // particle table usage
545  // ------------------------------------------------
546  //
547 
548  // Return MC specific code from a PDG and pseudo ENDF code (pdg)
549  virtual Int_t IdFromPDG(Int_t pdg) const =0;
550 
551  // Return PDG code and pseudo ENDF code from MC specific code (id)
552  virtual Int_t PDGFromId(Int_t id) const =0;
553 
554  //
555  // get methods
556  // ------------------------------------------------
557  //
558 
559  // Return name of the particle specified by pdg.
560  virtual TString ParticleName(Int_t pdg) const = 0;
561 
562  // Return mass of the particle specified by pdg.
563  virtual Double_t ParticleMass(Int_t pdg) const = 0;
564 
565  // Return charge (in e units) of the particle specified by pdg.
566  virtual Double_t ParticleCharge(Int_t pdg) const = 0;
567 
568  // Return life time of the particle specified by pdg.
569  virtual Double_t ParticleLifeTime(Int_t pdg) const = 0;
570 
571  // Return VMC type of the particle specified by pdg.
572  virtual TMCParticleType ParticleMCType(Int_t pdg) const = 0;
573  //
574  // ------------------------------------------------
575  // methods for step management
576  // ------------------------------------------------
577  //
578 
579  //
580  // action methods
581  // ------------------------------------------------
582  //
583 
584  // Stop the transport of the current particle and skip to the next
585  virtual void StopTrack() = 0;
586 
587  // Stop simulation of the current event and skip to the next
588  virtual void StopEvent() = 0;
589 
590  // Stop simulation of the current event and set the abort run flag to true
591  virtual void StopRun() = 0;
592 
593  //
594  // set methods
595  // ------------------------------------------------
596  //
597 
598  // Set the maximum step allowed till the particle is in the current medium
599  virtual void SetMaxStep(Double_t) = 0;
600 
601  // Set the maximum number of steps till the particle is in the current medium
602  virtual void SetMaxNStep(Int_t) = 0;
603 
604  // Force the decays of particles to be done with Pythia
605  // and not with the Geant routines.
606  virtual void SetUserDecay(Int_t pdg) = 0;
607 
608  // Force the decay time of the current particle
609  virtual void ForceDecayTime(Float_t) = 0;
610 
611  //
612  // tracking volume(s)
613  // ------------------------------------------------
614  //
615 
616  // Return the current volume ID and copy number
617  virtual Int_t CurrentVolID(Int_t& copyNo) const =0;
618 
619  // Return the current volume off upward in the geometrical tree
620  // ID and copy number
621  virtual Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const =0;
622 
623  // Return the current volume name
624  virtual const char* CurrentVolName() const =0;
625 
626  // Return the current volume off upward in the geometrical tree
627  // name and copy number'
628  // if name=0 no name is returned
629  virtual const char* CurrentVolOffName(Int_t off) const =0;
630 
631  // Return the path in geometry tree for the current volume
632  virtual const char* CurrentVolPath() = 0;
633 
634  // If track is on a geometry boundary, fill the normal vector of the crossing
635  // volume surface and return true, return false otherwise
637  Double_t &x, Double_t &y, Double_t &z) const = 0;
638 
639  // Return the parameters of the current material during transport
640  virtual Int_t CurrentMaterial(Float_t &a, Float_t &z,
641  Float_t &dens, Float_t &radl, Float_t &absl) const =0;
642 
643  // Return the number of the current medium
644  virtual Int_t CurrentMedium() const = 0;
645  // new function (to replace GetMedium() const)
646 
647  // Return the number of the current event
648  virtual Int_t CurrentEvent() const =0;
649 
650  // Computes coordinates xd in daughter reference system
651  // from known coordinates xm in mother reference system.
652  // xm coordinates in mother reference system (input)
653  // xd coordinates in daughter reference system (output)
654  // iflag
655  // - IFLAG = 1 convert coordinates
656  // - IFLAG = 2 convert direction cosines
657  virtual void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag) = 0;
658 
659  // The same as previous but in double precision
660  virtual void Gmtod(Double_t* xm, Double_t* xd, Int_t iflag) = 0;
661 
662  // Computes coordinates xm in mother reference system
663  // from known coordinates xd in daughter reference system.
664  // xd coordinates in daughter reference system (input)
665  // xm coordinates in mother reference system (output)
666  // iflag
667  // - IFLAG = 1 convert coordinates
668  // - IFLAG = 2 convert direction cosines
669  virtual void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag)= 0 ;
670 
671  // The same as previous but in double precision
672  virtual void Gdtom(Double_t* xd, Double_t* xm, Int_t iflag)= 0 ;
673 
674  // Return the maximum step length in the current medium
675  virtual Double_t MaxStep() const =0;
676 
677  // Return the maximum number of steps allowed in the current medium
678  virtual Int_t GetMaxNStep() const = 0;
679 
680  //
681  // get methods
682  // tracking particle
683  // dynamic properties
684  // ------------------------------------------------
685  //
686 
687  // Return the current position in the master reference frame of the
688  // track being transported
689  virtual void TrackPosition(TLorentzVector& position) const =0;
690 
691  // Return the current position in the master reference frame of the
692  // track being transported
693  virtual void TrackPosition(Double_t &x, Double_t &y, Double_t &z) const =0;
694 
695  // Return the direction and the momentum (GeV/c) of the track
696  // currently being transported
697  virtual void TrackMomentum(TLorentzVector& momentum) const =0;
698 
699  // Return the direction and the momentum (GeV/c) of the track
700  // currently being transported
701  virtual void TrackMomentum(Double_t &px, Double_t &py, Double_t &pz, Double_t &etot) const =0;
702 
703  // Return the length in centimeters of the current step (in cm)
704  virtual Double_t TrackStep() const =0;
705 
706  // Return the length of the current track from its origin (in cm)
707  virtual Double_t TrackLength() const =0;
708 
709  // Return the current time of flight of the track being transported
710  virtual Double_t TrackTime() const =0;
711 
712  // Return the energy lost in the current step
713  virtual Double_t Edep() const =0;
714 
715  //
716  // get methods
717  // tracking particle
718  // static properties
719  // ------------------------------------------------
720  //
721 
722  // Return the PDG of the particle transported
723  virtual Int_t TrackPid() const =0;
724 
725  // Return the charge of the track currently transported
726  virtual Double_t TrackCharge() const =0;
727 
728  // Return the mass of the track currently transported
729  virtual Double_t TrackMass() const =0;
730 
731  // Return the total energy of the current track
732  virtual Double_t Etot() const =0;
733 
734  //
735  // get methods - track status
736  // ------------------------------------------------
737  //
738 
739  // Return true when the track performs the first step
740  virtual Bool_t IsNewTrack() const =0;
741 
742  // Return true if the track is not at the boundary of the current volume
743  virtual Bool_t IsTrackInside() const =0;
744 
745  // Return true if this is the first step of the track in the current volume
746  virtual Bool_t IsTrackEntering() const =0;
747 
748  // Return true if this is the last step of the track in the current volume
749  virtual Bool_t IsTrackExiting() const =0;
750 
751  // Return true if the track is out of the setup
752  virtual Bool_t IsTrackOut() const =0;
753 
754  // Return true if the current particle has disappeared
755  // either because it decayed or because it underwent
756  // an inelastic collision
757  virtual Bool_t IsTrackDisappeared() const =0;
758 
759  // Return true if the track energy has fallen below the threshold
760  virtual Bool_t IsTrackStop() const =0;
761 
762  // Return true if the current particle is alive and will continue to be
763  // transported
764  virtual Bool_t IsTrackAlive() const=0;
765 
766  //
767  // get methods - secondaries
768  // ------------------------------------------------
769  //
770 
771  // Return the number of secondary particles generated in the current step
772  virtual Int_t NSecondaries() const=0;
773 
774  // Return the parameters of the secondary track number isec produced
775  // in the current step
776  virtual void GetSecondary(Int_t isec, Int_t& particleId,
777  TLorentzVector& position, TLorentzVector& momentum) =0;
778 
779  // Return the VMC code of the process that has produced the secondary
780  // particles in the current step
781  virtual TMCProcess ProdProcess(Int_t isec) const =0;
782 
783  // Return the array of the VMC code of the processes active in the current
784  // step
785  virtual Int_t StepProcesses(TArrayI &proc) const = 0;
786 
787  // Return the information about the transport order needed by the stack
788  virtual Bool_t SecondariesAreOrdered() const = 0;
789 
790 
791  //
792  // ------------------------------------------------
793  // Control methods
794  // ------------------------------------------------
795  //
796 
797  // Initialize MC
798  virtual void Init() = 0;
799 
800  // Initialize MC physics
801  virtual void BuildPhysics() = 0;
802 
803  // Process one event
804  // Deprecated
805  virtual void ProcessEvent() = 0;
806 
807  // Process one run and return true if run has finished successfully,
808  // return false in other cases (run aborted by user)
809  virtual Bool_t ProcessRun(Int_t nevent) = 0;
810 
811  // Set switches for lego transport
812  virtual void InitLego() = 0;
813 
814  // (In)Activate collecting TGeo tracks
815  virtual void SetCollectTracks(Bool_t collectTracks) = 0;
816 
817  // Return the info if collecting tracks is activated
818  virtual Bool_t IsCollectTracks() const = 0;
819 
820  // Return the info if multi-threading is supported/activated
821  virtual Bool_t IsMT() const { return kFALSE; }
822 
823  //
824  // ------------------------------------------------
825  // Set methods
826  // ------------------------------------------------
827  //
828 
829  // Set the particle stack
830  virtual void SetStack(TVirtualMCStack* stack);
831 
832  // Set the external decayer
833  virtual void SetExternalDecayer(TVirtualMCDecayer* decayer);
834 
835  // Set the random number generator
836  virtual void SetRandom(TRandom* random);
837 
838  // Set the magnetic field
839  virtual void SetMagField(TVirtualMagField* field);
840 
841  //
842  // ------------------------------------------------
843  // Get methods
844  // ------------------------------------------------
845  //
846 
847  // Return the particle stack
848  virtual TVirtualMCStack* GetStack() const { return fStack; }
849 
850  // Return the external decayer
851  virtual TVirtualMCDecayer* GetDecayer() const { return fDecayer; }
852 
853  // Return the random number generator
854  virtual TRandom* GetRandom() const { return fRandom; }
855 
856  // Return the magnetic field
857  virtual TVirtualMagField* GetMagField() const { return fMagField; }
858 
859 protected:
860  TVirtualMCApplication* fApplication; //! User MC application
861 
862 private:
863  TVirtualMC(const TVirtualMC &mc);
864  TVirtualMC & operator=(const TVirtualMC &);
865 
866 #if !defined(__CINT__)
867  static TMCThreadLocal TVirtualMC* fgMC; // Monte Carlo singleton instance
868 #else
869  static TVirtualMC* fgMC; // Monte Carlo singleton instance
870 #endif
871 
872  TVirtualMCStack* fStack; //! Particles stack
873  TVirtualMCDecayer* fDecayer; //! External decayer
874  TRandom* fRandom; //! Random number generator
875  TVirtualMagField* fMagField;//! Magnetic field
876 
877  ClassDef(TVirtualMC,1) //Interface to Monte Carlo
878 };
879 
880 #define gMC (TVirtualMC::GetMC())
881 
882 #endif //ROOT_TVirtualMC
883 
virtual Bool_t IsTrackExiting() const =0
virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, Int_t iaxis)=0
virtual void SetUserParameters(Bool_t isUserParameters)=0
virtual Bool_t SetCut(const char *cutName, Double_t cutValue)=0
double par[1]
Definition: unuranDistr.cxx:38
virtual Int_t VolDaughterCopyNo(const char *volName, Int_t i) const =0
virtual void Init()=0
virtual void Gsord(const char *name, Int_t iax)=0
virtual TVirtualMCStack * GetStack() const
Definition: TVirtualMC.h:848
virtual Double_t Etot() const =0
virtual Double_t ParticleLifeTime(Int_t pdg) const =0
TVirtualMCStack * fStack
Definition: TVirtualMC.h:872
virtual TMCProcess ProdProcess(Int_t isec) const =0
TMCParticleType
virtual Int_t VolId2Mate(Int_t id) const =0
float Float_t
Definition: RtypesCore.h:53
EMCOpSurfaceModel
Definition: TMCOptical.h:20
TVirtualMC & operator=(const TVirtualMC &)
virtual void Material(Int_t &kmat, const char *name, Double_t a, Double_t z, Double_t dens, Double_t radl, Double_t absl, Float_t *buf, Int_t nwbuf)=0
virtual const char * VolName(Int_t id) const =0
virtual Int_t IdFromPDG(Int_t pdg) const =0
virtual void Gspos(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot, const char *konly="ONLY")=0
TRandom * fRandom
External decayer.
Definition: TVirtualMC.h:874
virtual Int_t CurrentMedium() const =0
virtual void SetMaxNStep(Int_t)=0
virtual void StopTrack()=0
TVirtualMCDecayer * fDecayer
Particles stack.
Definition: TVirtualMC.h:873
virtual Int_t MediumId(const char *mediumName) const =0
virtual Double_t ParticleMass(Int_t pdg) const =0
static TMCThreadLocal TVirtualMC * fgMC
Definition: TVirtualMC.h:867
Basic string class.
Definition: TString.h:137
virtual Bool_t GetMaterial(Int_t imat, TString &name, Double_t &a, Double_t &z, Double_t &density, Double_t &radl, Double_t &inter, TArrayD &par)=0
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TArc * a
Definition: textangle.C:12
virtual Double_t TrackTime() const =0
virtual void TrackMomentum(TLorentzVector &momentum) const =0
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void SetRootGeometry()=0
virtual void InitLego()=0
virtual TVirtualMCDecayer * GetDecayer() const
Definition: TVirtualMC.h:851
virtual Bool_t DefineIon(const char *name, Int_t Z, Int_t A, Int_t Q, Double_t excEnergy, Double_t mass=0.)=0
virtual Double_t TrackCharge() const =0
virtual void StopRun()=0
static double A[]
virtual Bool_t CurrentBoundaryNormal(Double_t &x, Double_t &y, Double_t &z) const =0
virtual Int_t GetMaxNStep() const =0
virtual void ForceDecayTime(Float_t)=0
virtual void Gdtom(Float_t *xd, Float_t *xm, Int_t iflag)=0
Array of integers (32 bits per element).
Definition: TArrayI.h:29
virtual const char * CurrentVolName() const =0
EMCOpSurfaceFinish
Definition: TMCOptical.h:34
virtual Bool_t GetShape(const TString &volumePath, TString &shapeType, TArrayD &par)=0
virtual ~TVirtualMC()
Destructor.
Definition: TVirtualMC.cxx:80
virtual Bool_t IsTrackAlive() const =0
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:254
TVirtualMC()
Default constructor.
Definition: TVirtualMC.cxx:65
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:29
virtual void TrackPosition(TLorentzVector &position) const =0
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
virtual Bool_t GetTransformation(const TString &volumePath, TGeoHMatrix &matrix)=0
virtual void Gsbool(const char *onlyVolName, const char *manyVolName)=0
virtual Int_t NSecondaries() const =0
virtual void DefineOpSurface(const char *name, EMCOpSurfaceModel model, EMCOpSurfaceType surfaceType, EMCOpSurfaceFinish surfaceFinish, Double_t sigmaAlpha)=0
virtual void Gmtod(Float_t *xm, Float_t *xd, Int_t iflag)=0
virtual void WriteEuclid(const char *filnam, const char *topvol, Int_t number, Int_t nlevel)=0
virtual Int_t CurrentVolOffID(Int_t off, Int_t &copyNo) const =0
virtual void SetCollectTracks(Bool_t collectTracks)=0
virtual Int_t CurrentEvent() const =0
virtual void SetBorderSurface(const char *name, const char *vol1Name, int vol1CopyNo, const char *vol2Name, int vol2CopyNo, const char *opSurfaceName)=0
virtual Double_t Edep() const =0
virtual Bool_t SecondariesAreOrdered() const =0
virtual Bool_t IsTrackInside() const =0
virtual Int_t CurrentVolID(Int_t &copyNo) const =0
virtual Int_t StepProcesses(TArrayI &proc) const =0
virtual Double_t TrackStep() const =0
virtual void Gsposp(const char *name, Int_t nr, const char *mother, Double_t x, Double_t y, Double_t z, Int_t irot, const char *konly, Float_t *upar, Int_t np)=0
TVirtualMCApplication * fApplication
Definition: TVirtualMC.h:860
TVirtualMagField * fMagField
Random number generator.
Definition: TVirtualMC.h:875
virtual Double_t TrackLength() const =0
virtual Double_t TrackMass() const =0
virtual Bool_t IsNewTrack() const =0
virtual Int_t PDGFromId(Int_t id) const =0
virtual Double_t MaxStep() const =0
virtual void GetSecondary(Int_t isec, Int_t &particleId, TLorentzVector &position, TLorentzVector &momentum)=0
virtual Bool_t IsTrackDisappeared() const =0
virtual void SetUserDecay(Int_t pdg)=0
virtual void SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov, Float_t *absco, Float_t *effic, Float_t *rindex)=0
virtual const char * CurrentVolOffName(Int_t off) const =0
virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, Float_t *upar, Int_t np)=0
virtual Bool_t SetProcess(const char *flagName, Int_t flagValue)=0
virtual void StopEvent()=0
virtual Bool_t ProcessRun(Int_t nevent)=0
virtual const char * CurrentVolPath()=0
virtual void Mixture(Int_t &kmat, const char *name, Float_t *a, Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat)=0
virtual void SetSkinSurface(const char *name, const char *volName, const char *opSurfaceName)=0
virtual Double_t ParticleCharge(Int_t pdg) const =0
virtual void SetMaterialProperty(Int_t itmed, const char *propertyName, Int_t np, Double_t *pp, Double_t *values)=0
virtual Bool_t IsMT() const
Definition: TVirtualMC.h:821
virtual TString ParticleName(Int_t pdg) const =0
#define TMCThreadLocal
Definition: TMCtls.h:59
virtual void SetMagField(TVirtualMagField *field)
Set magnetic field.
Definition: TVirtualMC.cxx:133
virtual void ProcessEvent()=0
double Double_t
Definition: RtypesCore.h:55
virtual void SetRandom(TRandom *random)
Set random number generator.
Definition: TVirtualMC.cxx:122
virtual TMCParticleType ParticleMCType(Int_t pdg) const =0
Double_t y[n]
Definition: legend1.C:17
virtual Bool_t IsCollectTracks() const =0
virtual Double_t Xsec(char *, Double_t, Int_t, Int_t)=0
virtual const char * VolDaughterName(const char *volName, Int_t i) const =0
virtual void BuildPhysics()=0
Array of doubles (64 bits per element).
Definition: TArrayD.h:29
TMCProcess
Definition: TMCProcess.h:22
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual Bool_t DefineParticle(Int_t pdg, const char *name, TMCParticleType mcType, Double_t mass, Double_t charge, Double_t lifetime)=0
virtual Bool_t IsTrackEntering() const =0
virtual void Gsdvt(const char *name, const char *mother, Double_t step, Int_t iaxis, Int_t numed, Int_t ndvmx)=0
virtual void SetExternalDecayer(TVirtualMCDecayer *decayer)
Set external decayer.
Definition: TVirtualMC.cxx:112
virtual void Gstpar(Int_t itmed, const char *param, Double_t parval)=0
virtual Int_t CurrentMaterial(Float_t &a, Float_t &z, Float_t &dens, Float_t &radl, Float_t &absl) const =0
virtual void SetStack(TVirtualMCStack *stack)
Set particles stack.
Definition: TVirtualMC.cxx:102
virtual Bool_t IsTrackOut() const =0
virtual Int_t TrackPid() const =0
virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, Int_t iaxis, Double_t c0i, Int_t numed)=0
virtual void SetMaxStep(Double_t)=0
virtual void Medium(Int_t &kmed, const char *name, Int_t nmat, Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, Double_t stemax, Double_t deemax, Double_t epsil, Double_t stmin, Float_t *ubuf, Int_t nbuf)=0
virtual Int_t NofVolumes() const =0
virtual Bool_t SetDecayMode(Int_t pdg, Float_t bratio[6], Int_t mode[6][3])=0
virtual void Gsdvt2(const char *name, const char *mother, Double_t step, Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx)=0
std::complex< float_v > Z
Definition: main.cpp:120
virtual void Matrix(Int_t &krot, Double_t thetaX, Double_t phiX, Double_t thetaY, Double_t phiY, Double_t thetaZ, Double_t phiZ)=0
virtual Int_t VolId(const char *volName) const =0
virtual TRandom * GetRandom() const
Definition: TVirtualMC.h:854
float value
Definition: math.cpp:443
virtual Bool_t GetMedium(const TString &volumeName, TString &name, Int_t &imed, Int_t &nmat, Int_t &isvol, Int_t &ifield, Double_t &fieldm, Double_t &tmaxfd, Double_t &stemax, Double_t &deemax, Double_t &epsil, Double_t &stmin, TArrayD &par)=0
virtual TVirtualMagField * GetMagField() const
Definition: TVirtualMC.h:857
virtual Int_t NofVolDaughters(const char *volName) const =0
static double Q[]
static TVirtualMC * GetMC()
static: return virtual MC object
Definition: TVirtualMC.cxx:92
virtual Bool_t IsTrackStop() const =0
virtual Bool_t IsRootGeometrySupported() const =0
EMCOpSurfaceType
Definition: TMCOptical.h:26