Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4VProcess class implementation << 27 // 26 // 28 // Authors: << 27 // $Id: G4VProcess.cc,v 1.14 2006/06/29 21:08:26 gunter Exp $ 29 // - 2 December 1995, G.Cosmo - First implemen << 28 // GEANT4 tag $Name: geant4-08-01-patch-01 $ 30 // - 18 December 1996, H.Kurashige - New Physi << 29 // 31 // ------------------------------------------- << 30 // 32 << 31 // -------------------------------------------------------------- 33 #include "G4VProcess.hh" << 32 // GEANT 4 class implementation file 34 << 33 // 35 #include "G4PhysicalConstants.hh" << 34 // History: first implementation, based on object model of 36 #include "G4SystemOfUnits.hh" << 35 // 2nd December 1995, G.Cosmo >> 36 // -------------------------------------------------------------- >> 37 // New Physics scheme 8 Jan. 1997 H.Kurahige >> 38 // ------------------------------------------------------------ >> 39 // removed thePhysicsTable 02 Aug. 1998 H.Kurashige >> 40 // Modified DumpInfo 15 Aug. 1998 H.Kurashige 37 41 38 #include "G4ProcessTable.hh" << 39 #include "G4PhysicsTable.hh" 42 #include "G4PhysicsTable.hh" 40 #include "G4MaterialTable.hh" 43 #include "G4MaterialTable.hh" 41 #include "G4ElementTable.hh" 44 #include "G4ElementTable.hh" 42 #include "G4ElementVector.hh" 45 #include "G4ElementVector.hh" 43 #include "G4Log.hh" << 46 #include "G4VProcess.hh" 44 47 45 // ------------------------------------------- << 48 G4VProcess::G4VProcess(const G4String& aName, G4ProcessType aType ) 46 G4VProcess::G4VProcess(const G4String& aName, << 49 : pParticleChange(0), 47 : theProcessName(aName), theProcessType(aTyp << 50 theNumberOfInteractionLengthLeft(-1.0), >> 51 currentInteractionLength(-1.0), >> 52 theProcessName(aName), >> 53 theProcessType(aType), >> 54 thePILfactor(1.0), >> 55 verboseLevel(0) 48 { 56 { 49 pParticleChange = &aParticleChange; 57 pParticleChange = &aParticleChange; 50 fProcessTable = G4ProcessTable::GetProcessTa << 51 fProcessTable->RegisterProcess(this); << 52 } << 53 << 54 // ------------------------------------------- << 55 G4VProcess::G4VProcess() << 56 { << 57 } 58 } 58 59 59 // ------------------------------------------- << 60 G4VProcess::~G4VProcess() 60 G4VProcess::~G4VProcess() 61 { 61 { 62 fProcessTable->DeRegisterProcess(this); << 63 } 62 } 64 63 65 // ------------------------------------------- << 66 G4VProcess::G4VProcess(const G4VProcess& right 64 G4VProcess::G4VProcess(const G4VProcess& right) 67 : theProcessName(right.theProcessName), << 65 : pParticleChange(0), 68 theProcessType(right.theProcessType), << 66 theNumberOfInteractionLengthLeft(-1.0), 69 theProcessSubType(right.theProcessSubType) << 67 currentInteractionLength(-1.0), 70 verboseLevel(right.verboseLevel), << 68 theProcessName(right.theProcessName), 71 enableAtRestDoIt(right.enableAtRestDoIt), << 69 theProcessType(right.theProcessType), 72 enableAlongStepDoIt(right.enableAlongStepD << 70 thePILfactor(1.0), 73 enablePostStepDoIt(right.enablePostStepDoI << 71 verboseLevel(right.verboseLevel) 74 masterProcessShadow(right.masterProcessSha << 75 fProcessTable(right.fProcessTable) << 76 { 72 { 77 } 73 } 78 74 79 // ------------------------------------------- << 75 80 void G4VProcess::ResetNumberOfInteractionLengt << 76 void G4VProcess::SubtractNumberOfInteractionLengthLeft( >> 77 G4double previousStepSize ) 81 { 78 { 82 theNumberOfInteractionLengthLeft = -1.*G4Lo << 79 if (currentInteractionLength>0.0) { 83 theInitialNumberOfInteractionLength = theNum << 80 theNumberOfInteractionLengthLeft -= previousStepSize/currentInteractionLength; >> 81 } else { >> 82 #ifdef G4VERBOSE >> 83 if (verboseLevel>0) { >> 84 G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()"; >> 85 G4cerr << " [" << theProcessName << "]" <<G4endl; >> 86 G4cerr << " currentInteractionLength = " << currentInteractionLength/cm << " [cm]"; >> 87 G4cerr << " previousStepSize = " << previousStepSize/cm << " [cm]"; >> 88 G4cerr << G4endl; >> 89 } >> 90 #endif >> 91 G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft()", >> 92 "Negative currentInteractionLength",EventMustBeAborted,theProcessName); >> 93 } 84 } 94 } 85 95 86 // ------------------------------------------- << 87 void G4VProcess::StartTracking(G4Track*) 96 void G4VProcess::StartTracking(G4Track*) 88 { 97 { 89 currentInteractionLength = -1.0; 98 currentInteractionLength = -1.0; 90 theNumberOfInteractionLengthLeft = -1.0; 99 theNumberOfInteractionLengthLeft = -1.0; 91 theInitialNumberOfInteractionLength = -1.0; << 92 #ifdef G4VERBOSE 100 #ifdef G4VERBOSE 93 if (verboseLevel>2) << 101 if (verboseLevel>2) { 94 { << 102 G4cout << "G4VProcess::StartTracking() [" << theProcessName << "]" <<G4endl; 95 G4cout << "G4VProcess::StartTracking() - [ << 96 << G4endl; << 97 } 103 } 98 #endif 104 #endif 99 } 105 } 100 106 101 // ------------------------------------------- << 102 void G4VProcess::EndTracking() 107 void G4VProcess::EndTracking() 103 { 108 { 104 #ifdef G4VERBOSE 109 #ifdef G4VERBOSE 105 if (verboseLevel>2) << 110 if (verboseLevel>2) { 106 { << 111 G4cout << "G4VProcess::EndTracking() [" << theProcessName << "]" <<G4endl; 107 G4cout << "G4VProcess::EndTracking() - [" << 108 << G4endl; << 109 } 112 } 110 #endif 113 #endif 111 theNumberOfInteractionLengthLeft = -1.0; 114 theNumberOfInteractionLengthLeft = -1.0; 112 currentInteractionLength = -1.0; 115 currentInteractionLength = -1.0; 113 theInitialNumberOfInteractionLength=-1.0; << 114 } 116 } 115 117 116 // ------------------------------------------- << 117 namespace << 118 { << 119 static const G4String typeNotDefined = "NotD << 120 static const G4String typeTransportation = " << 121 static const G4String typeElectromagnetic = << 122 static const G4String typeOptical = "Optical << 123 static const G4String typeHadronic = "Hadron << 124 static const G4String typePhotolepton_hadron << 125 static const G4String typeDecay = "Decay"; << 126 static const G4String typeGeneral = "General << 127 static const G4String typeParameterisation = << 128 static const G4String typeUserDefined = "Use << 129 static const G4String typePhonon = "Phonon"; << 130 static const G4String noType = "------"; << 131 } << 132 118 133 // ------------------------------------------- << 134 const G4String& G4VProcess::GetProcessTypeName 119 const G4String& G4VProcess::GetProcessTypeName(G4ProcessType aType ) 135 { 120 { 136 switch (aType) << 121 static G4String typeNotDefined= "NotDefined"; 137 { << 122 static G4String typeTransportation = "Transportation"; 138 case fNotDefined: return typeNotDe << 123 static G4String typeElectromagnetic = "Electromagnetic"; 139 case fTransportation: return typeTrans << 124 static G4String typeOptical = "Optical"; 140 case fElectromagnetic: return typeElect << 125 static G4String typeHadronic = "Hadronic"; 141 case fOptical: return typeOptic << 126 static G4String typePhotolepton_hadron = "Photolepton_hadron"; 142 case fHadronic: return typeHadro << 127 static G4String typeDecay = "Decay"; 143 case fPhotolepton_hadron: return typePhoto << 128 static G4String typeGeneral = "General"; 144 case fDecay: return typeDecay << 129 static G4String typeParameterisation = "Parameterisation"; 145 case fGeneral: return typeGener << 130 static G4String typeUserDefined = "UserDefined"; 146 case fParameterisation: return typeParam << 131 static G4String noType = "------"; // Do not modify this !!!! 147 case fUserDefined: return typeUserD << 132 148 case fPhonon: return typePhono << 133 if (aType == fNotDefined) { 149 default: ; << 134 return typeNotDefined; >> 135 } else if (aType == fTransportation ) { >> 136 return typeTransportation; >> 137 } else if (aType == fElectromagnetic ) { >> 138 return typeElectromagnetic; >> 139 } else if (aType == fOptical ) { >> 140 return typeOptical; >> 141 } else if (aType == fHadronic ) { >> 142 return typeHadronic; >> 143 } else if (aType == fPhotolepton_hadron ) { >> 144 return typePhotolepton_hadron; >> 145 } else if (aType == fDecay ) { >> 146 return typeDecay; >> 147 } else if (aType == fGeneral ) { >> 148 return typeGeneral; >> 149 } else if (aType == fParameterisation ) { >> 150 return typeParameterisation; >> 151 } else if (aType == fUserDefined ) { >> 152 return typeUserDefined; >> 153 } else { >> 154 return noType; 150 } 155 } 151 return noType; << 152 } 156 } 153 157 154 // ------------------------------------------- << 158 G4VProcess & G4VProcess::operator=(const G4VProcess &) 155 const G4VProcess* G4VProcess::GetCreatorProces << 156 { 159 { 157 return this; << 160 G4Exception("G4VProcess::operator=","Illegal operation", >> 161 JustWarning,"Assignment operator is called"); >> 162 return *this; 158 } 163 } 159 164 160 // ------------------------------------------- << 165 G4int G4VProcess::operator==(const G4VProcess &right) const 161 G4bool G4VProcess::operator==(const G4VProcess << 162 { 166 { 163 return (this == &right); 167 return (this == &right); 164 } 168 } 165 169 166 // ------------------------------------------- << 170 G4int G4VProcess::operator!=(const G4VProcess &right) const 167 G4bool G4VProcess::operator!=(const G4VProcess << 168 { 171 { 169 return (this != &right); 172 return (this != &right); 170 } 173 } 171 174 172 // ------------------------------------------- << 173 void G4VProcess::DumpInfo() const 175 void G4VProcess::DumpInfo() const 174 { 176 { 175 G4cout << "Process Name " << theProcessName 177 G4cout << "Process Name " << theProcessName ; 176 G4cout << " : Type[" << GetProcessTypeName(t << 178 G4cout << " : Type[" << GetProcessTypeName(theProcessType) << "]"<< G4endl; 177 G4cout << " : SubType[" << theProcessSubType << 178 } 179 } 179 180 180 // ------------------------------------------- << 181 181 void G4VProcess::ProcessDescription(std::ostre << 182 const G4String& G4VProcess::GetPhysicsTableFileName(const G4ParticleDefinition* particle, 182 { << 183 const G4String& directory, 183 outFile << "This process has not yet been de << 184 const G4String& tableName, 184 } << 185 G4bool ascii) 185 << 186 // ------------------------------------------- << 187 const G4String& G4VProcess:: << 188 GetPhysicsTableFileName( const G4ParticleDefin << 189 const G4String& direc << 190 const G4String& table << 191 G4bool ascii ) << 192 { 186 { 193 G4String thePhysicsTableFileExt; 187 G4String thePhysicsTableFileExt; 194 if (ascii) thePhysicsTableFileExt = ".asc"; 188 if (ascii) thePhysicsTableFileExt = ".asc"; 195 else thePhysicsTableFileExt = ".dat"; 189 else thePhysicsTableFileExt = ".dat"; 196 190 197 thePhysicsTableFileName = directory + "/"; 191 thePhysicsTableFileName = directory + "/"; 198 thePhysicsTableFileName += tableName + "." + 192 thePhysicsTableFileName += tableName + "." + theProcessName + "."; 199 thePhysicsTableFileName += particle->GetPart << 193 thePhysicsTableFileName += particle->GetParticleName() + thePhysicsTableFileExt; 200 + thePhysicsTableFi << 201 194 202 return thePhysicsTableFileName; 195 return thePhysicsTableFileName; 203 } 196 } 204 197 205 // ------------------------------------------- << 206 void G4VProcess::BuildWorkerPhysicsTable(const << 207 { << 208 BuildPhysicsTable(part); << 209 } << 210 198 211 // ------------------------------------------- << 212 void G4VProcess::PrepareWorkerPhysicsTable(con << 213 { << 214 PreparePhysicsTable(part); << 215 } << 216 199 217 // ------------------------------------------- << 200 218 void G4VProcess::SetMasterProcess(G4VProcess* << 201 219 { << 202 220 masterProcessShadow = masterP; << 203 221 } << 204 >> 205 >> 206 >> 207 222 208