G4VProcess.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // 
00030 // --------------------------------------------------------------
00031 //      GEANT 4 class implementation file
00032 //
00033 //      History: first implementation, based on object model of
00034 //      2nd December 1995, G.Cosmo
00035 // --------------------------------------------------------------
00036 //   New Physics scheme           8 Jan. 1997  H.Kurahige
00037 // ------------------------------------------------------------
00038 //   removed thePhysicsTable           02 Aug. 1998 H.Kurashige
00039 //   Modified DumpInfo                 15 Aug. 1998 H.Kurashige
00040 
00041 #include "G4VProcess.hh"
00042 
00043 #include "G4PhysicalConstants.hh"
00044 #include "G4SystemOfUnits.hh"
00045 
00046 #include "G4PhysicsTable.hh"
00047 #include "G4MaterialTable.hh"
00048 #include "G4ElementTable.hh"
00049 #include "G4ElementVector.hh"
00050 
00051 G4VProcess::G4VProcess(const G4String& aName, G4ProcessType   aType )
00052                   : aProcessManager(0),
00053                     pParticleChange(0),
00054                     theNumberOfInteractionLengthLeft(-1.0),
00055                     currentInteractionLength(-1.0),
00056                     theInitialNumberOfInteractionLength(-1.0),
00057                     theProcessName(aName),
00058                     theProcessType(aType),
00059                     theProcessSubType(-1),
00060                     thePILfactor(1.0),
00061                     enableAtRestDoIt(true),
00062                     enableAlongStepDoIt(true),
00063                     enablePostStepDoIt(true),
00064                     verboseLevel(0)
00065 
00066 {
00067   pParticleChange = &aParticleChange;
00068 }
00069 
00070 G4VProcess::~G4VProcess()
00071 {
00072 }
00073 
00074 G4VProcess::G4VProcess(const G4VProcess& right)
00075           : aProcessManager(0),
00076             pParticleChange(0),
00077             theNumberOfInteractionLengthLeft(-1.0),
00078             currentInteractionLength(-1.0),
00079             theInitialNumberOfInteractionLength(-1.0),
00080             theProcessName(right.theProcessName),
00081             theProcessType(right.theProcessType),
00082             theProcessSubType(right.theProcessSubType),
00083             thePILfactor(1.0),
00084             enableAtRestDoIt(right.enableAtRestDoIt),
00085             enableAlongStepDoIt(right.enableAlongStepDoIt),
00086             enablePostStepDoIt(right.enablePostStepDoIt),
00087             verboseLevel(right.verboseLevel)
00088 {
00089 }
00090 
00091 
00092 void G4VProcess::ResetNumberOfInteractionLengthLeft()
00093 {
00094   theNumberOfInteractionLengthLeft =  -std::log( G4UniformRand() );
00095   theInitialNumberOfInteractionLength = theNumberOfInteractionLengthLeft; 
00096 }
00097 
00098 void G4VProcess::SubtractNumberOfInteractionLengthLeft(
00099                                   G4double previousStepSize )
00100 {
00101   if (currentInteractionLength>0.0) {
00102     theNumberOfInteractionLengthLeft -= previousStepSize/currentInteractionLength;
00103     if(theNumberOfInteractionLengthLeft<0.) {
00104        theNumberOfInteractionLengthLeft=perMillion;
00105     }          
00106 
00107   } else {
00108 #ifdef G4VERBOSE
00109     if (verboseLevel>0) {
00110       G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()";
00111       G4cerr << " [" << theProcessName << "]" <<G4endl;
00112       G4cerr << " currentInteractionLength = " << currentInteractionLength/cm << " [cm]";
00113       G4cerr << " previousStepSize = " << previousStepSize/cm << " [cm]";
00114       G4cerr << G4endl;
00115     }
00116 #endif
00117     G4String msg = "Negative currentInteractionLength for ";
00118     msg +=      theProcessName;
00119     G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft()",
00120                 "ProcMan201",EventMustBeAborted,
00121                 msg);
00122   }
00123 }
00124 
00125 void G4VProcess::StartTracking(G4Track*)
00126 {
00127   currentInteractionLength = -1.0;
00128   theNumberOfInteractionLengthLeft = -1.0;
00129   theInitialNumberOfInteractionLength=-1.0;
00130 #ifdef G4VERBOSE
00131   if (verboseLevel>2) {
00132     G4cout << "G4VProcess::StartTracking() [" << theProcessName << "]" <<G4endl;
00133   }
00134 #endif
00135 }
00136 
00137 void G4VProcess::EndTracking()
00138 {
00139 #ifdef G4VERBOSE
00140   if (verboseLevel>2) {
00141     G4cout << "G4VProcess::EndTracking() [" << theProcessName << "]" <<G4endl;
00142   }
00143 #endif
00144   theNumberOfInteractionLengthLeft = -1.0;
00145   currentInteractionLength = -1.0;
00146   theInitialNumberOfInteractionLength=-1.0;
00147 }
00148 
00149 
00150 const G4String& G4VProcess::GetProcessTypeName(G4ProcessType aType ) 
00151 {
00152   static G4String typeNotDefined= "NotDefined";
00153   static G4String typeTransportation = "Transportation";
00154   static G4String typeElectromagnetic = "Electromagnetic";
00155   static G4String typeOptical = "Optical";
00156   static G4String typeHadronic = "Hadronic";
00157   static G4String typePhotolepton_hadron = "Photolepton_hadron";
00158   static G4String typeDecay = "Decay";
00159   static G4String typeGeneral = "General";
00160   static G4String typeParameterisation = "Parameterisation";
00161   static G4String typeUserDefined = "UserDefined";
00162   static G4String noType = "------";   // Do not modify this !!!!
00163 
00164   if (aType ==   fNotDefined) {
00165     return  typeNotDefined;
00166   } else if  (aType ==   fTransportation ) {
00167     return typeTransportation;
00168   } else if  (aType ==   fElectromagnetic ) {
00169     return typeElectromagnetic;
00170   } else if  (aType ==   fOptical ) {
00171     return typeOptical;
00172   } else if  (aType ==   fHadronic ) {
00173     return typeHadronic;
00174   } else if  (aType ==   fPhotolepton_hadron ) {
00175     return typePhotolepton_hadron;
00176   } else if  (aType ==   fDecay ) {
00177     return typeDecay;
00178   } else if  (aType ==   fGeneral ) {
00179     return typeGeneral;
00180   } else if  (aType ==   fParameterisation ) {
00181     return typeParameterisation;
00182   } else if  (aType ==   fUserDefined ) {
00183     return typeUserDefined;
00184   } else {
00185     return noType;  
00186   }
00187 }
00188 
00189 G4VProcess & G4VProcess::operator=(const G4VProcess &)
00190 {
00191   G4Exception("G4VProcess::operator=","ProcMan101",
00192               JustWarning,"Assignment operator is called but NO effect");
00193   return *this;
00194 }
00195 
00196 G4int G4VProcess::operator==(const G4VProcess &right) const
00197 {
00198   return (this == &right);
00199 }
00200 
00201 G4int G4VProcess::operator!=(const G4VProcess &right) const
00202 {
00203   return (this !=  &right);
00204 }
00205 
00206 void G4VProcess::DumpInfo() const
00207 {
00208   G4cout << "Process Name " << theProcessName ;
00209   G4cout << " : Type[" << GetProcessTypeName(theProcessType) << "]";
00210   G4cout << " : SubType[" << theProcessSubType << "]"<< G4endl;
00211 }
00212 
00213 
00214 const G4String&  G4VProcess::GetPhysicsTableFileName(const G4ParticleDefinition* particle,
00215                                                      const G4String& directory,
00216                                                      const G4String& tableName,
00217                                                      G4bool ascii)
00218 {
00219   G4String thePhysicsTableFileExt;
00220   if (ascii) thePhysicsTableFileExt = ".asc";
00221   else       thePhysicsTableFileExt = ".dat";
00222 
00223   thePhysicsTableFileName = directory + "/";
00224   thePhysicsTableFileName += tableName + "." +  theProcessName + ".";
00225   thePhysicsTableFileName += particle->GetParticleName() + thePhysicsTableFileExt;
00226   
00227   return thePhysicsTableFileName;
00228 }

Generated on Mon May 27 17:50:20 2013 for Geant4 by  doxygen 1.4.7