00001 // @(#)root/vmc:$Name: $:$Id: TVirtualMC.h 34836 2010-08-18 09:52:27Z ivana $ 00002 // Authors: Ivana Hrivnacova, Rene Brun, Federico Carminati 13/04/2002 00003 00004 /************************************************************************* 00005 * Copyright (C) 2006, Rene Brun and Fons Rademakers. * 00006 * Copyright (C) 2002, ALICE Experiment at CERN. * 00007 * All rights reserved. * 00008 * * 00009 * For the licensing terms see $ROOTSYS/LICENSE. * 00010 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00011 *************************************************************************/ 00012 00013 #ifndef ROOT_TVirtualMC 00014 #define ROOT_TVirtualMC 00015 00016 /////////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // // 00019 // Abstract Monte Carlo interface // 00020 // // 00021 // // 00022 /////////////////////////////////////////////////////////////////////////////// 00023 00024 #include "TMCProcess.h" 00025 #include "TMCParticleType.h" 00026 #include "TMCOptical.h" 00027 #include "TVirtualMCApplication.h" 00028 #include "TVirtualMCStack.h" 00029 #include "TVirtualMCDecayer.h" 00030 #include "TVirtualMagField.h" 00031 #include "TRandom.h" 00032 #include "TString.h" 00033 #include "TError.h" 00034 00035 class TLorentzVector; 00036 class TGeoHMatrix; 00037 class TArrayI; 00038 class TArrayD; 00039 00040 class TVirtualMC : public TNamed { 00041 00042 public: 00043 // Standard constructor 00044 // isRootGeometrySupported = True if implementation of TVirtualMC 00045 // supports geometry defined with TGeo 00046 TVirtualMC(const char *name, const char *title, 00047 Bool_t isRootGeometrySupported = kFALSE); 00048 00049 // Default constructor 00050 TVirtualMC(); 00051 00052 // Destructor 00053 virtual ~TVirtualMC(); 00054 00055 // Static access method 00056 static TVirtualMC* GetMC(); 00057 00058 // 00059 // ------------------------------------------------ 00060 // methods for building/management of geometry 00061 // ------------------------------------------------ 00062 // 00063 00064 // Info about supporting geometry defined via Root 00065 virtual Bool_t IsRootGeometrySupported() const { return kFALSE; } 00066 // make this function =0 with next release 00067 00068 // 00069 // functions from GCONS 00070 // ------------------------------------------------ 00071 // 00072 00073 // Return parameters for material specified by material number imat 00074 virtual void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, 00075 Float_t &dens, Float_t &radl, Float_t &absl, 00076 Float_t* ubuf, Int_t& nbuf) = 0; 00077 00078 // Return parameters for material specified by material number imat 00079 // (in double precision) 00080 virtual void Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z, 00081 Double_t &dens, Double_t &radl, Double_t &absl, 00082 Double_t* ubuf, Int_t& nbuf) = 0; 00083 00084 // Check the parameters of a tracking medium 00085 virtual void Gckmat(Int_t imed, char* name) = 0; 00086 00087 00088 // Define a material 00089 // kmat number assigned to the material 00090 // name material name 00091 // a atomic mass in au 00092 // z atomic number 00093 // dens density in g/cm3 00094 // absl absorption length in cm; 00095 // if >=0 it is ignored and the program 00096 // calculates it, if <0. -absl is taken 00097 // radl radiation length in cm 00098 // if >=0 it is ignored and the program 00099 // calculates it, if <0. -radl is taken 00100 // buf pointer to an array of user words 00101 // nwbuf number of user words 00102 virtual void Material(Int_t& kmat, const char* name, Double_t a, 00103 Double_t z, Double_t dens, Double_t radl, Double_t absl, 00104 Float_t* buf, Int_t nwbuf) = 0; 00105 00106 // The same as previous but in double precision 00107 virtual void Material(Int_t& kmat, const char* name, Double_t a, 00108 Double_t z, Double_t dens, Double_t radl, Double_t absl, 00109 Double_t* buf, Int_t nwbuf) = 0; 00110 00111 // Define mixture or compound 00112 // with a number kmat composed by the basic nlmat materials defined 00113 // by arrays a, z and wmat 00114 // 00115 // If nlmat > 0 then wmat contains the proportion by 00116 // weights of each basic material in the mixture. 00117 // 00118 // If nlmat < 0 then wmat contains the number of atoms 00119 // of a given kind into the molecule of the compound. 00120 // In this case, wmat in output is changed to relative 00121 // weights. 00122 virtual void Mixture(Int_t& kmat, const char *name, Float_t *a, 00123 Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat) = 0; 00124 00125 // The same as previous but in double precision 00126 virtual void Mixture(Int_t& kmat, const char *name, Double_t *a, 00127 Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat) = 0; 00128 00129 // Define a medium. 00130 // kmed tracking medium number assigned 00131 // name tracking medium name 00132 // nmat material number 00133 // isvol sensitive volume flag 00134 // ifield magnetic field: 00135 // - ifield = 0 if no magnetic field; 00136 // - ifield = -1 if user decision in guswim; 00137 // - ifield = 1 if tracking performed with g3rkuta; 00138 // - ifield = 2 if tracking performed with g3helix; 00139 // - ifield = 3 if tracking performed with g3helx3. 00140 // fieldm max. field value (kilogauss) 00141 // tmaxfd max. angle due to field (deg/step) 00142 // stemax max. step allowed 00143 // deemax max. fraction of energy lost in a step 00144 // epsil tracking precision (cm) 00145 // stmin min. step due to continuous processes (cm) 00146 // ubuf pointer to an array of user words 00147 // nbuf number of user words 00148 virtual void Medium(Int_t& kmed, const char *name, Int_t nmat, 00149 Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 00150 Double_t stemax, Double_t deemax, Double_t epsil, 00151 Double_t stmin, Float_t* ubuf, Int_t nbuf) = 0; 00152 00153 // The same as previous but in double precision 00154 virtual void Medium(Int_t& kmed, const char *name, Int_t nmat, 00155 Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 00156 Double_t stemax, Double_t deemax, Double_t epsil, 00157 Double_t stmin, Double_t* ubuf, Int_t nbuf) = 0; 00158 00159 // Define a rotation matrix 00160 // krot rotation matrix number assigned 00161 // thetaX polar angle for axis X 00162 // phiX azimuthal angle for axis X 00163 // thetaY polar angle for axis Y 00164 // phiY azimuthal angle for axis Y 00165 // thetaZ polar angle for axis Z 00166 // phiZ azimuthal angle for axis Z 00167 virtual void Matrix(Int_t& krot, Double_t thetaX, Double_t phiX, 00168 Double_t thetaY, Double_t phiY, Double_t thetaZ, 00169 Double_t phiZ) = 0; 00170 00171 // Change the value of cut or mechanism param 00172 // to a new value parval for tracking medium itmed. 00173 // In Geant3, the data structure JTMED contains the standard tracking 00174 // parameters (CUTS and flags to control the physics processes) which 00175 // are used by default for all tracking media. 00176 // It is possible to redefine individually with this function any of these 00177 // parameters for a given tracking medium. 00178 // itmed tracking medium number 00179 // param is a character string (variable name) 00180 // parval must be given as a floating point. 00181 virtual void Gstpar(Int_t itmed, const char *param, Double_t parval) = 0; 00182 00183 // 00184 // functions from GGEOM 00185 // ------------------------------------------------ 00186 // 00187 00188 // Create a new volume 00189 // name Volume name 00190 // shape Volume type 00191 // nmed Tracking medium number 00192 // np Number of shape parameters 00193 // upar Vector containing shape parameters 00194 virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, 00195 Float_t *upar, Int_t np) = 0; 00196 00197 // The same as previous but in double precision 00198 virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, 00199 Double_t *upar, Int_t np) = 0; 00200 00201 // Create a new volume by dividing an existing one. 00202 // It divides a previously defined volume 00203 // name Volume name 00204 // mother Mother volume name 00205 // ndiv Number of divisions 00206 // iaxis Axis value: 00207 // X,Y,Z of CAXIS will be translated to 1,2,3 for IAXIS. 00208 virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, 00209 Int_t iaxis) = 0; 00210 00211 // Create a new volume by dividing an existing one. 00212 // Divide mother into ndiv divisions called name 00213 // along axis iaxis starting at coordinate value c0i. 00214 // The new volume created will be medium number numed. 00215 virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, 00216 Int_t iaxis, Double_t c0i, Int_t numed) = 0; 00217 00218 // Create a new volume by dividing an existing one 00219 // Divide mother into divisions called name along 00220 // axis iaxis in steps of step. If not exactly divisible 00221 // will make as many as possible and will center them 00222 // with respect to the mother. Divisions will have medium 00223 // number numed. If numed is 0, numed of mother is taken. 00224 // ndvmx is the expected maximum number of divisions 00225 // (If 0, no protection tests are performed in Geant3) 00226 virtual void Gsdvt(const char *name, const char *mother, Double_t step, 00227 Int_t iaxis, Int_t numed, Int_t ndvmx) = 0; 00228 00229 // Create a new volume by dividing an existing one 00230 // Divides mother into divisions called name along 00231 // axis iaxis starting at coordinate value c0 with step 00232 // size step. 00233 // The new volume created will have medium number numed. 00234 // If numed is 0, numed of mother is taken. 00235 // ndvmx is the expected maximum number of divisions 00236 // (If 0, no protection tests are performed in Geant3) 00237 virtual void Gsdvt2(const char *name, const char *mother, Double_t step, 00238 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) = 0; 00239 00240 // Flag volume name whose contents will have to be ordered 00241 // along axis iax, by setting the search flag to -iax 00242 // (Geant3 only) 00243 virtual void Gsord(const char *name, Int_t iax) = 0; 00244 00245 // Position a volume into an existing one. 00246 // It positions a previously defined volume in the mother. 00247 // name Volume name 00248 // nr Copy number of the volume 00249 // mother Mother volume name 00250 // x X coord. of the volume in mother ref. sys. 00251 // y Y coord. of the volume in mother ref. sys. 00252 // z Z coord. of the volume in mother ref. sys. 00253 // irot Rotation matrix number w.r.t. mother ref. sys. 00254 // konly ONLY/MANY flag 00255 virtual void Gspos(const char *name, Int_t nr, const char *mother, 00256 Double_t x, Double_t y, Double_t z, Int_t irot, 00257 const char *konly="ONLY") = 0; 00258 00259 // Place a copy of generic volume name with user number 00260 // nr inside mother, with its parameters upar(1..np) 00261 virtual void Gsposp(const char *name, Int_t nr, const char *mother, 00262 Double_t x, Double_t y, Double_t z, Int_t irot, 00263 const char *konly, Float_t *upar, Int_t np) = 0; 00264 00265 // The same as previous but in double precision 00266 virtual void Gsposp(const char *name, Int_t nr, const char *mother, 00267 Double_t x, Double_t y, Double_t z, Int_t irot, 00268 const char *konly, Double_t *upar, Int_t np) = 0; 00269 00270 // Helper function for resolving MANY. 00271 // Specify the ONLY volume that overlaps with the 00272 // specified MANY and has to be substracted. 00273 // (Geant4 only) 00274 virtual void Gsbool(const char* onlyVolName, const char* manyVolName) = 0; 00275 00276 // Define the tables for UV photon tracking in medium itmed. 00277 // Please note that it is the user's responsibility to 00278 // provide all the coefficients: 00279 // itmed Tracking medium number 00280 // npckov Number of bins of each table 00281 // ppckov Value of photon momentum (in GeV) 00282 // absco Absorption coefficients 00283 // dielectric: absorption length in cm 00284 // metals : absorption fraction (0<=x<=1) 00285 // effic Detection efficiency for UV photons 00286 // rindex Refraction index (if=0 metal) 00287 virtual void SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov, 00288 Float_t *absco, Float_t *effic, Float_t *rindex) = 0; 00289 00290 // The same as previous but in double precision 00291 virtual void SetCerenkov(Int_t itmed, Int_t npckov, Double_t *ppckov, 00292 Double_t *absco, Double_t *effic, Double_t *rindex) = 0; 00293 00294 // 00295 // functions for definition of surfaces 00296 // and material properties for optical physics 00297 // ------------------------------------------------ 00298 // 00299 00300 // Define the optical surface 00301 // name surface name 00302 // model selection of model (see #EMCOpSurfaceModel values) 00303 // surfaceType surface type (see #EMCOpSurfaceType values) 00304 // surfaceFinish surface quality (see #EMCOpSurfaceType values) 00305 // sigmaAlpha an unified model surface parameter 00306 // (Geant4 only) 00307 virtual void DefineOpSurface(const char* name, 00308 EMCOpSurfaceModel model, 00309 EMCOpSurfaceType surfaceType, 00310 EMCOpSurfaceFinish surfaceFinish, 00311 Double_t sigmaAlpha) = 0; 00312 00313 // Define the optical surface border 00314 // name border surface name 00315 // vol1Name first volume name 00316 // vol1CopyNo first volume copy number 00317 // vol2Name second volume name 00318 // vol2CopyNo second volume copy number 00319 // opSurfaceName name of optical surface which this border belongs to 00320 // (Geant4 only) 00321 virtual void SetBorderSurface(const char* name, 00322 const char* vol1Name, int vol1CopyNo, 00323 const char* vol2Name, int vol2CopyNo, 00324 const char* opSurfaceName) = 0; 00325 00326 // Define the optical skin surface 00327 // name skin surface name 00328 // volName volume name 00329 // opSurfaceName name of optical surface which this border belongs to 00330 // (Geant4 only) 00331 virtual void SetSkinSurface(const char* name, 00332 const char* volName, 00333 const char* opSurfaceName) = 0; 00334 00335 // Define material property via a table of values 00336 // itmed tracking medium id 00337 // propertyName property name 00338 // np number of bins of the table 00339 // pp value of photon momentum (in GeV) 00340 // values property values 00341 // (Geant4 only) 00342 virtual void SetMaterialProperty( 00343 Int_t itmed, const char* propertyName, 00344 Int_t np, Double_t* pp, Double_t* values) = 0; 00345 00346 // Define material property via a value 00347 // itmed tracking medium id 00348 // propertyName property name 00349 // value property value 00350 // (Geant4 only) 00351 virtual void SetMaterialProperty( 00352 Int_t itmed, const char* propertyName, 00353 Double_t value) = 0; 00354 00355 // Define optical surface property via a table of values 00356 // surfaceName optical surface name 00357 // propertyName property name 00358 // np number of bins of the table 00359 // pp value of photon momentum (in GeV) 00360 // values property values 00361 // (Geant4 only) 00362 virtual void SetMaterialProperty( 00363 const char* surfaceName, const char* propertyName, 00364 Int_t np, Double_t* pp, Double_t* values) = 0; 00365 00366 // 00367 // functions for access to geometry 00368 // ------------------------------------------------ 00369 // 00370 00371 // Return the transformation matrix between the volume specified by 00372 // the path volumePath and the top or master volume. 00373 virtual Bool_t GetTransformation(const TString& volumePath, 00374 TGeoHMatrix& matrix) = 0; 00375 00376 // Return the name of the shape (shapeType) and its parameters par 00377 // for the volume specified by the path volumePath . 00378 virtual Bool_t GetShape(const TString& volumePath, 00379 TString& shapeType, TArrayD& par) = 0; 00380 00381 // Return the material parameters for the volume specified by 00382 // the volumeName. 00383 virtual Bool_t GetMaterial(const TString& volumeName, 00384 TString& name, Int_t& imat, 00385 Double_t& a, Double_t& z, Double_t& density, 00386 Double_t& radl, Double_t& inter, TArrayD& par) = 0; 00387 00388 // Return the medium parameters for the volume specified by the 00389 // volumeName. 00390 virtual Bool_t GetMedium(const TString& volumeName, 00391 TString& name, Int_t& imed, 00392 Int_t& nmat, Int_t& isvol, Int_t& ifield, 00393 Double_t& fieldm, Double_t& tmaxfd, Double_t& stemax, 00394 Double_t& deemax, Double_t& epsil, Double_t& stmin, 00395 TArrayD& par) = 0; 00396 00397 // 00398 // functions for drawing 00399 // to be removed with complete move to TGeo 00400 // ------------------------------------------------ 00401 // 00402 00403 // Deprecated - Geant3 00404 virtual void DrawOneSpec(const char* name) = 0; 00405 // Deprecated - Geant3 00406 virtual void Gsatt(const char* name, const char* att, Int_t val) = 0; 00407 // Deprecated - Geant3 00408 virtual void Gdraw(const char*,Double_t theta = 30, Double_t phi = 30, 00409 Double_t psi = 0, Double_t u0 = 10, Double_t v0 = 10, 00410 Double_t ul = 0.01, Double_t vl = 0.01) = 0; 00411 00412 // Write out the geometry of the detector in EUCLID file format 00413 // filnam file name - will be with the extension .euc * 00414 // topvol volume name of the starting node 00415 // number copy number of topvol (relevant for gsposp) 00416 // nlevel number of levels in the tree structure 00417 // to be written out, starting from topvol 00418 // (Geant3 only) 00419 virtual void WriteEuclid(const char* filnam, const char* topvol, 00420 Int_t number, Int_t nlevel) = 0; 00421 00422 // Set geometry from Root (built via TGeo) 00423 virtual void SetRootGeometry() = 0; 00424 00425 // Activate the parameters defined in tracking media 00426 // (DEEMAX, STMIN, STEMAX), which are, be default, ignored. 00427 // In Geant4 case, only STEMAX is taken into account. 00428 // In FLUKA, all tracking media parameters are ignored. 00429 virtual void SetUserParameters(Bool_t isUserParameters) = 0; 00430 00431 // 00432 // get methods 00433 // ------------------------------------------------ 00434 // 00435 00436 // Return the unique numeric identifier for volume name volName 00437 virtual Int_t VolId(const char* volName) const = 0; 00438 00439 // Return the volume name for a given volume identifier id 00440 virtual const char* VolName(Int_t id) const = 0; 00441 00442 // Return the unique numeric identifier for medium name mediumName 00443 virtual Int_t MediumId(const char* mediumName) const = 0; 00444 00445 // Return total number of volumes in the geometry 00446 virtual Int_t NofVolumes() const = 0; 00447 00448 // Return material number for a given volume id 00449 virtual Int_t VolId2Mate(Int_t id) const = 0; 00450 00451 // Return number of daughters of the volume specified by volName 00452 virtual Int_t NofVolDaughters(const char* volName) const = 0; 00453 00454 // Return the name of i-th daughter of the volume specified by volName 00455 virtual const char* VolDaughterName(const char* volName, Int_t i) const = 0; 00456 00457 // Return the copyNo of i-th daughter of the volume specified by volName 00458 virtual Int_t VolDaughterCopyNo(const char* volName, Int_t i) const = 0; 00459 00460 // 00461 // ------------------------------------------------ 00462 // methods for physics management 00463 // ------------------------------------------------ 00464 // 00465 00466 // 00467 // set methods 00468 // ------------------------------------------------ 00469 // 00470 00471 // Set transport cuts for particles 00472 virtual Bool_t SetCut(const char* cutName, Double_t cutValue) = 0; 00473 00474 // Set process control 00475 virtual Bool_t SetProcess(const char* flagName, Int_t flagValue) = 0; 00476 00477 // Set a user defined particle 00478 // Function is ignored if particle with specified pdg 00479 // already exists and error report is printed. 00480 // pdg PDG encoding 00481 // name particle name 00482 // mcType VMC Particle type 00483 // mass mass [GeV] 00484 // charge charge [eplus] 00485 // lifetime time of life [s] 00486 // pType particle type as in Geant4 00487 // width width [GeV] 00488 // iSpin spin 00489 // iParity parity 00490 // iConjugation conjugation 00491 // iIsospin isospin 00492 // iIsospinZ isospin - #rd component 00493 // gParity gParity 00494 // lepton lepton number 00495 // baryon baryon number 00496 // stable stability 00497 // shortlived is shorlived? 00498 // subType particle subType as in Geant4 00499 // antiEncoding anti encoding 00500 // magMoment magnetic moment 00501 // excitation excitation energy [GeV] 00502 virtual Bool_t DefineParticle(Int_t pdg, const char* name, 00503 TMCParticleType mcType, 00504 Double_t mass, Double_t charge, Double_t lifetime) = 0; 00505 00506 // Set a user defined particle 00507 // Function is ignored if particle with specified pdg 00508 // already exists and error report is printed. 00509 // pdg PDG encoding 00510 // name particle name 00511 // mcType VMC Particle type 00512 // mass mass [GeV] 00513 // charge charge [eplus] 00514 // lifetime time of life [s] 00515 // pType particle type as in Geant4 00516 // width width [GeV] 00517 // iSpin spin 00518 // iParity parity 00519 // iConjugation conjugation 00520 // iIsospin isospin 00521 // iIsospinZ isospin - #rd component 00522 // gParity gParity 00523 // lepton lepton number 00524 // baryon baryon number 00525 // stable stability 00526 // shortlived is shorlived? 00527 // subType particle subType as in Geant4 00528 // antiEncoding anti encoding 00529 // magMoment magnetic moment 00530 // excitation excitation energy [GeV] 00531 virtual Bool_t DefineParticle(Int_t pdg, const char* name, 00532 TMCParticleType mcType, 00533 Double_t mass, Double_t charge, Double_t lifetime, 00534 const TString& pType, Double_t width, 00535 Int_t iSpin, Int_t iParity, Int_t iConjugation, 00536 Int_t iIsospin, Int_t iIsospinZ, Int_t gParity, 00537 Int_t lepton, Int_t baryon, 00538 Bool_t stable, Bool_t shortlived = kFALSE, 00539 const TString& subType = "", 00540 Int_t antiEncoding = 0, Double_t magMoment = 0.0, 00541 Double_t excitation = 0.0) = 0; 00542 00543 // Set a user defined ion. 00544 // name ion name 00545 // Z atomic number 00546 // A atomic mass 00547 // Q charge [eplus} 00548 // excitation excitation energy [GeV] 00549 // mass mass [GeV] (if not specified by user, approximative 00550 // mass is calculated) 00551 virtual Bool_t DefineIon(const char* name, Int_t Z, Int_t A, 00552 Int_t Q, Double_t excEnergy, Double_t mass = 0.) = 0; 00553 00554 // Set a user phase space decay for a particle 00555 // pdg particle PDG encoding 00556 // bratios the array with branching ratios (in %) 00557 // mode[6][3] the array with daughters particles PDG codes for each 00558 // decay channel 00559 virtual Bool_t SetDecayMode(Int_t pdg, Float_t bratio[6], Int_t mode[6][3]) = 0; 00560 00561 // Calculate X-sections 00562 // (Geant3 only) 00563 virtual Double_t Xsec(char*, Double_t, Int_t, Int_t) = 0; 00564 00565 // 00566 // particle table usage 00567 // ------------------------------------------------ 00568 // 00569 00570 // Return MC specific code from a PDG and pseudo ENDF code (pdg) 00571 virtual Int_t IdFromPDG(Int_t pdg) const =0; 00572 00573 // Return PDG code and pseudo ENDF code from MC specific code (id) 00574 virtual Int_t PDGFromId(Int_t id) const =0; 00575 00576 // 00577 // get methods 00578 // ------------------------------------------------ 00579 // 00580 00581 // Return name of the particle specified by pdg. 00582 virtual TString ParticleName(Int_t pdg) const = 0; 00583 00584 // Return mass of the particle specified by pdg. 00585 virtual Double_t ParticleMass(Int_t pdg) const = 0; 00586 00587 // Return charge (in e units) of the particle specified by pdg. 00588 virtual Double_t ParticleCharge(Int_t pdg) const = 0; 00589 00590 // Return life time of the particle specified by pdg. 00591 virtual Double_t ParticleLifeTime(Int_t pdg) const = 0; 00592 00593 // Return VMC type of the particle specified by pdg. 00594 virtual TMCParticleType ParticleMCType(Int_t pdg) const = 0; 00595 // 00596 // ------------------------------------------------ 00597 // methods for step management 00598 // ------------------------------------------------ 00599 // 00600 00601 // 00602 // action methods 00603 // ------------------------------------------------ 00604 // 00605 00606 // Stop the transport of the current particle and skip to the next 00607 virtual void StopTrack() = 0; 00608 00609 // Stop simulation of the current event and skip to the next 00610 virtual void StopEvent() = 0; 00611 00612 // Stop simulation of the current event and set the abort run flag to true 00613 virtual void StopRun() = 0; 00614 00615 // 00616 // set methods 00617 // ------------------------------------------------ 00618 // 00619 00620 // Set the maximum step allowed till the particle is in the current medium 00621 virtual void SetMaxStep(Double_t) = 0; 00622 00623 // Set the maximum number of steps till the particle is in the current medium 00624 virtual void SetMaxNStep(Int_t) = 0; 00625 00626 // Force the decays of particles to be done with Pythia 00627 // and not with the Geant routines. 00628 virtual void SetUserDecay(Int_t pdg) = 0; 00629 00630 // Force the decay time of the current particle 00631 virtual void ForceDecayTime(Float_t) = 0; 00632 00633 // 00634 // tracking volume(s) 00635 // ------------------------------------------------ 00636 // 00637 00638 // Return the current volume ID and copy number 00639 virtual Int_t CurrentVolID(Int_t& copyNo) const =0; 00640 00641 // Return the current volume off upward in the geometrical tree 00642 // ID and copy number 00643 virtual Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const =0; 00644 00645 // Return the current volume name 00646 virtual const char* CurrentVolName() const =0; 00647 00648 // Return the current volume off upward in the geometrical tree 00649 // name and copy number' 00650 // if name=0 no name is returned 00651 virtual const char* CurrentVolOffName(Int_t off) const =0; 00652 00653 // Return the path in geometry tree for the current volume 00654 virtual const char* CurrentVolPath() = 0; 00655 00656 // If track is on a geometry boundary, fill the normal vector of the crossing volume 00657 // surface and return true, return false otherwise 00658 virtual Bool_t CurrentBoundaryNormal(Double_t &x, Double_t &y, Double_t &z) const; 00659 00660 // Return the parameters of the current material during transport 00661 virtual Int_t CurrentMaterial(Float_t &a, Float_t &z, 00662 Float_t &dens, Float_t &radl, Float_t &absl) const =0; 00663 00664 // Return the number of the current medium 00665 virtual Int_t CurrentMedium() const = 0; 00666 // new function (to replace GetMedium() const) 00667 00668 // Return the number of the current event 00669 virtual Int_t CurrentEvent() const =0; 00670 00671 // Computes coordinates xd in daughter reference system 00672 // from known coordinates xm in mother reference system. 00673 // xm coordinates in mother reference system (input) 00674 // xd coordinates in daughter reference system (output) 00675 // iflag 00676 // - IFLAG = 1 convert coordinates 00677 // - IFLAG = 2 convert direction cosines 00678 virtual void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag) = 0; 00679 00680 // The same as previous but in double precision 00681 virtual void Gmtod(Double_t* xm, Double_t* xd, Int_t iflag) = 0; 00682 00683 // Computes coordinates xm in mother reference system 00684 // from known coordinates xd in daughter reference system. 00685 // xd coordinates in daughter reference system (input) 00686 // xm coordinates in mother reference system (output) 00687 // iflag 00688 // - IFLAG = 1 convert coordinates 00689 // - IFLAG = 2 convert direction cosines 00690 virtual void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag)= 0 ; 00691 00692 // The same as previous but in double precision 00693 virtual void Gdtom(Double_t* xd, Double_t* xm, Int_t iflag)= 0 ; 00694 00695 // Return the maximum step length in the current medium 00696 virtual Double_t MaxStep() const =0; 00697 00698 // Return the maximum number of steps allowed in the current medium 00699 virtual Int_t GetMaxNStep() const = 0; 00700 00701 // 00702 // get methods 00703 // tracking particle 00704 // dynamic properties 00705 // ------------------------------------------------ 00706 // 00707 00708 // Return the current position in the master reference frame of the 00709 // track being transported 00710 virtual void TrackPosition(TLorentzVector& position) const =0; 00711 00712 // Return the current position in the master reference frame of the 00713 // track being transported 00714 virtual void TrackPosition(Double_t &x, Double_t &y, Double_t &z) const =0; 00715 00716 // Return the direction and the momentum (GeV/c) of the track 00717 // currently being transported 00718 virtual void TrackMomentum(TLorentzVector& momentum) const =0; 00719 00720 // Return the direction and the momentum (GeV/c) of the track 00721 // currently being transported 00722 virtual void TrackMomentum(Double_t &px, Double_t &py, Double_t &pz, Double_t &etot) const =0; 00723 00724 // Return the length in centimeters of the current step (in cm) 00725 virtual Double_t TrackStep() const =0; 00726 00727 // Return the length of the current track from its origin (in cm) 00728 virtual Double_t TrackLength() const =0; 00729 00730 // Return the current time of flight of the track being transported 00731 virtual Double_t TrackTime() const =0; 00732 00733 // Return the energy lost in the current step 00734 virtual Double_t Edep() const =0; 00735 00736 // 00737 // get methods 00738 // tracking particle 00739 // static properties 00740 // ------------------------------------------------ 00741 // 00742 00743 // Return the PDG of the particle transported 00744 virtual Int_t TrackPid() const =0; 00745 00746 // Return the charge of the track currently transported 00747 virtual Double_t TrackCharge() const =0; 00748 00749 // Return the mass of the track currently transported 00750 virtual Double_t TrackMass() const =0; 00751 00752 // Return the total energy of the current track 00753 virtual Double_t Etot() const =0; 00754 00755 // 00756 // get methods - track status 00757 // ------------------------------------------------ 00758 // 00759 00760 // Return true when the track performs the first step 00761 virtual Bool_t IsNewTrack() const =0; 00762 00763 // Return true if the track is not at the boundary of the current volume 00764 virtual Bool_t IsTrackInside() const =0; 00765 00766 // Return true if this is the first step of the track in the current volume 00767 virtual Bool_t IsTrackEntering() const =0; 00768 00769 // Return true if this is the last step of the track in the current volume 00770 virtual Bool_t IsTrackExiting() const =0; 00771 00772 // Return true if the track is out of the setup 00773 virtual Bool_t IsTrackOut() const =0; 00774 00775 // Return true if the current particle has disappeared 00776 // either because it decayed or because it underwent 00777 // an inelastic collision 00778 virtual Bool_t IsTrackDisappeared() const =0; 00779 00780 // Return true if the track energy has fallen below the threshold 00781 virtual Bool_t IsTrackStop() const =0; 00782 00783 // Return true if the current particle is alive and will continue to be 00784 // transported 00785 virtual Bool_t IsTrackAlive() const=0; 00786 00787 // 00788 // get methods - secondaries 00789 // ------------------------------------------------ 00790 // 00791 00792 // Return the number of secondary particles generated in the current step 00793 virtual Int_t NSecondaries() const=0; 00794 00795 // Return the parameters of the secondary track number isec produced 00796 // in the current step 00797 virtual void GetSecondary(Int_t isec, Int_t& particleId, 00798 TLorentzVector& position, TLorentzVector& momentum) =0; 00799 00800 // Return the VMC code of the process that has produced the secondary 00801 // particles in the current step 00802 virtual TMCProcess ProdProcess(Int_t isec) const =0; 00803 00804 // Return the array of the VMC code of the processes active in the current 00805 // step 00806 virtual Int_t StepProcesses(TArrayI &proc) const = 0; 00807 00808 // Return the information about the transport order needed by the stack 00809 virtual Bool_t SecondariesAreOrdered() const = 0; 00810 00811 // 00812 // ------------------------------------------------ 00813 // Geant3 specific methods 00814 // !!! to be removed with move to TGeo 00815 // ------------------------------------------------ 00816 // 00817 00818 // Set/modify the drawing options. 00819 // Deprecated - G3 only 00820 virtual void Gdopt(const char*,const char*) = 0; 00821 00822 // This function allows subtractions (via boolean operation) of BOX shape 00823 // from any part of the detector, therefore showing its inner contents 00824 // Deprecated - G3 only 00825 virtual void SetClipBox(const char*,Double_t=-9999,Double_t=0, Double_t=-9999, 00826 Double_t=0,Double_t=-9999,Double_t=0) = 0; 00827 00828 // Deprecated - G3 only 00829 virtual void DefaultRange() = 0; 00830 00831 // Deprecated - G3 only 00832 virtual void Gdhead(Int_t, const char*, Double_t=0) = 0; 00833 00834 // Deprecated - G3 only 00835 virtual void Gdman(Double_t, Double_t, const char*) = 0; 00836 00837 // 00838 // ------------------------------------------------ 00839 // Control methods 00840 // ------------------------------------------------ 00841 // 00842 00843 // Initialize MC 00844 virtual void Init() = 0; 00845 00846 // Initialize MC physics 00847 virtual void BuildPhysics() = 0; 00848 00849 // Process one event 00850 virtual void ProcessEvent() = 0; 00851 00852 // Process one run and return true if run has finished successfully, 00853 // return false in other cases (run aborted by user) 00854 virtual Bool_t ProcessRun(Int_t nevent) = 0; 00855 00856 // Set switches for lego transport 00857 virtual void InitLego() = 0; 00858 00859 // (In)Activate collecting TGeo tracks 00860 virtual void SetCollectTracks(Bool_t collectTracks); 00861 00862 // Return the info if collecting tracks is activated 00863 virtual Bool_t IsCollectTracks() const; 00864 00865 // 00866 // ------------------------------------------------ 00867 // Set methods 00868 // ------------------------------------------------ 00869 // 00870 00871 // Set the particle stack 00872 virtual void SetStack(TVirtualMCStack* stack); 00873 00874 // Set the external decayer 00875 virtual void SetExternalDecayer(TVirtualMCDecayer* decayer); 00876 00877 // Set the random number generator 00878 virtual void SetRandom(TRandom* random); 00879 00880 // Set the magnetic field 00881 virtual void SetMagField(TVirtualMagField* field); 00882 00883 // 00884 // ------------------------------------------------ 00885 // Get methods 00886 // ------------------------------------------------ 00887 // 00888 00889 // Return the particle stack 00890 virtual TVirtualMCStack* GetStack() const { return fStack; } 00891 00892 // Return the external decayer 00893 virtual TVirtualMCDecayer* GetDecayer() const { return fDecayer; } 00894 00895 // Return the random number generator 00896 virtual TRandom* GetRandom() const { return fRandom; } 00897 00898 // Return the magnetic field 00899 virtual TVirtualMagField* GetMagField() const { return fMagField; } 00900 00901 protected: 00902 TVirtualMCApplication* fApplication; //! User MC application 00903 00904 private: 00905 TVirtualMC(const TVirtualMC &mc); 00906 TVirtualMC & operator=(const TVirtualMC &); 00907 00908 static TVirtualMC* fgMC; // Monte Carlo singleton instance 00909 00910 TVirtualMCStack* fStack; //! Particles stack 00911 TVirtualMCDecayer* fDecayer; //! External decayer 00912 TRandom* fRandom; //! Random number generator 00913 TVirtualMagField* fMagField;//! Magnetic field 00914 00915 ClassDef(TVirtualMC,1) //Interface to Monte Carlo 00916 }; 00917 00918 // new functions 00919 00920 inline Bool_t TVirtualMC::CurrentBoundaryNormal(Double_t& /*x*/, Double_t& /*y*/, Double_t& /*z*/) const { 00921 // If track is on a geometry boundary, fill the normal vector of the crossing volume 00922 // surface and return true, return false otherwise 00923 Warning("CurrentBoundaryNormal", "New function - not yet implemented."); 00924 return kFALSE; 00925 } 00926 00927 00928 inline void TVirtualMC::SetCollectTracks(Bool_t /*collectTracks*/) { 00929 // Activate collecting tracks 00930 // Currently working only with TGeant3TGeo 00931 Warning("SetCollectTracks", "New function - not yet implemented."); 00932 } 00933 00934 inline Bool_t TVirtualMC::IsCollectTracks() const { 00935 // Return the info if collecting tracks is activated 00936 Warning("IsCollectTracks", "New function - not yet implemented."); 00937 return kFALSE; 00938 } 00939 00940 R__EXTERN TVirtualMC *gMC; 00941 00942 #endif //ROOT_TVirtualMC 00943