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.16 2007/11/15 04:10:18 kurasige Exp $ 29 // - 2 December 1995, G.Cosmo - First implemen << 28 // GEANT4 tag $Name: geant4-09-03-patch-02 $ 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), 48 { << 51 currentInteractionLength(-1.0), 49 pParticleChange = &aParticleChange; << 52 theProcessName(aName), 50 fProcessTable = G4ProcessTable::GetProcessTa << 53 theProcessType(aType), 51 fProcessTable->RegisterProcess(this); << 54 theProcessSubType(-1), 52 } << 55 thePILfactor(1.0), >> 56 enableAtRestDoIt(true), >> 57 enableAlongStepDoIt(true), >> 58 enablePostStepDoIt(true), >> 59 verboseLevel(0) 53 60 54 // ------------------------------------------- << 55 G4VProcess::G4VProcess() << 56 { 61 { >> 62 pParticleChange = &aParticleChange; 57 } 63 } 58 64 59 // ------------------------------------------- << 60 G4VProcess::~G4VProcess() 65 G4VProcess::~G4VProcess() 61 { 66 { 62 fProcessTable->DeRegisterProcess(this); << 63 } 67 } 64 68 65 // ------------------------------------------- << 66 G4VProcess::G4VProcess(const G4VProcess& right 69 G4VProcess::G4VProcess(const G4VProcess& right) 67 : theProcessName(right.theProcessName), << 70 : pParticleChange(0), 68 theProcessType(right.theProcessType), << 71 theNumberOfInteractionLengthLeft(-1.0), 69 theProcessSubType(right.theProcessSubType) << 72 currentInteractionLength(-1.0), 70 verboseLevel(right.verboseLevel), << 73 theProcessName(right.theProcessName), 71 enableAtRestDoIt(right.enableAtRestDoIt), << 74 theProcessType(right.theProcessType), 72 enableAlongStepDoIt(right.enableAlongStepD << 75 theProcessSubType(right.theProcessSubType), 73 enablePostStepDoIt(right.enablePostStepDoI << 76 thePILfactor(1.0), 74 masterProcessShadow(right.masterProcessSha << 77 enableAtRestDoIt(right.enableAtRestDoIt), 75 fProcessTable(right.fProcessTable) << 78 enableAlongStepDoIt(right.enableAlongStepDoIt), >> 79 enablePostStepDoIt(right.enablePostStepDoIt), >> 80 verboseLevel(right.verboseLevel) 76 { 81 { 77 } 82 } 78 83 79 // ------------------------------------------- << 84 80 void G4VProcess::ResetNumberOfInteractionLengt << 85 void G4VProcess::SubtractNumberOfInteractionLengthLeft( 81 { << 86 G4double previousStepSize ) 82 theNumberOfInteractionLengthLeft = -1.*G4Lo << 87 { 83 theInitialNumberOfInteractionLength = theNum << 88 if (currentInteractionLength>0.0) { >> 89 theNumberOfInteractionLengthLeft -= previousStepSize/currentInteractionLength; >> 90 if(theNumberOfInteractionLengthLeft<0.) { >> 91 theNumberOfInteractionLengthLeft=perMillion; >> 92 } >> 93 >> 94 } else { >> 95 #ifdef G4VERBOSE >> 96 if (verboseLevel>0) { >> 97 G4cerr << "G4VProcess::SubtractNumberOfInteractionLengthLeft()"; >> 98 G4cerr << " [" << theProcessName << "]" <<G4endl; >> 99 G4cerr << " currentInteractionLength = " << currentInteractionLength/cm << " [cm]"; >> 100 G4cerr << " previousStepSize = " << previousStepSize/cm << " [cm]"; >> 101 G4cerr << G4endl; >> 102 } >> 103 #endif >> 104 G4Exception("G4VProcess::SubtractNumberOfInteractionLengthLeft()", >> 105 "Negative currentInteractionLength",EventMustBeAborted,theProcessName); >> 106 } 84 } 107 } 85 108 86 // ------------------------------------------- << 87 void G4VProcess::StartTracking(G4Track*) 109 void G4VProcess::StartTracking(G4Track*) 88 { 110 { 89 currentInteractionLength = -1.0; 111 currentInteractionLength = -1.0; 90 theNumberOfInteractionLengthLeft = -1.0; 112 theNumberOfInteractionLengthLeft = -1.0; 91 theInitialNumberOfInteractionLength = -1.0; << 92 #ifdef G4VERBOSE 113 #ifdef G4VERBOSE 93 if (verboseLevel>2) << 114 if (verboseLevel>2) { 94 { << 115 G4cout << "G4VProcess::StartTracking() [" << theProcessName << "]" <<G4endl; 95 G4cout << "G4VProcess::StartTracking() - [ << 96 << G4endl; << 97 } 116 } 98 #endif 117 #endif 99 } 118 } 100 119 101 // ------------------------------------------- << 102 void G4VProcess::EndTracking() 120 void G4VProcess::EndTracking() 103 { 121 { 104 #ifdef G4VERBOSE 122 #ifdef G4VERBOSE 105 if (verboseLevel>2) << 123 if (verboseLevel>2) { 106 { << 124 G4cout << "G4VProcess::EndTracking() [" << theProcessName << "]" <<G4endl; 107 G4cout << "G4VProcess::EndTracking() - [" << 108 << G4endl; << 109 } 125 } 110 #endif 126 #endif 111 theNumberOfInteractionLengthLeft = -1.0; 127 theNumberOfInteractionLengthLeft = -1.0; 112 currentInteractionLength = -1.0; 128 currentInteractionLength = -1.0; 113 theInitialNumberOfInteractionLength=-1.0; << 114 } 129 } 115 130 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 131 133 // ------------------------------------------- << 134 const G4String& G4VProcess::GetProcessTypeName 132 const G4String& G4VProcess::GetProcessTypeName(G4ProcessType aType ) 135 { 133 { 136 switch (aType) << 134 static G4String typeNotDefined= "NotDefined"; 137 { << 135 static G4String typeTransportation = "Transportation"; 138 case fNotDefined: return typeNotDe << 136 static G4String typeElectromagnetic = "Electromagnetic"; 139 case fTransportation: return typeTrans << 137 static G4String typeOptical = "Optical"; 140 case fElectromagnetic: return typeElect << 138 static G4String typeHadronic = "Hadronic"; 141 case fOptical: return typeOptic << 139 static G4String typePhotolepton_hadron = "Photolepton_hadron"; 142 case fHadronic: return typeHadro << 140 static G4String typeDecay = "Decay"; 143 case fPhotolepton_hadron: return typePhoto << 141 static G4String typeGeneral = "General"; 144 case fDecay: return typeDecay << 142 static G4String typeParameterisation = "Parameterisation"; 145 case fGeneral: return typeGener << 143 static G4String typeUserDefined = "UserDefined"; 146 case fParameterisation: return typeParam << 144 static G4String noType = "------"; // Do not modify this !!!! 147 case fUserDefined: return typeUserD << 145 148 case fPhonon: return typePhono << 146 if (aType == fNotDefined) { 149 default: ; << 147 return typeNotDefined; >> 148 } else if (aType == fTransportation ) { >> 149 return typeTransportation; >> 150 } else if (aType == fElectromagnetic ) { >> 151 return typeElectromagnetic; >> 152 } else if (aType == fOptical ) { >> 153 return typeOptical; >> 154 } else if (aType == fHadronic ) { >> 155 return typeHadronic; >> 156 } else if (aType == fPhotolepton_hadron ) { >> 157 return typePhotolepton_hadron; >> 158 } else if (aType == fDecay ) { >> 159 return typeDecay; >> 160 } else if (aType == fGeneral ) { >> 161 return typeGeneral; >> 162 } else if (aType == fParameterisation ) { >> 163 return typeParameterisation; >> 164 } else if (aType == fUserDefined ) { >> 165 return typeUserDefined; >> 166 } else { >> 167 return noType; 150 } 168 } 151 return noType; << 152 } 169 } 153 170 154 // ------------------------------------------- << 171 G4VProcess & G4VProcess::operator=(const G4VProcess &) 155 const G4VProcess* G4VProcess::GetCreatorProces << 156 { 172 { 157 return this; << 173 G4Exception("G4VProcess::operator=","Illegal operation", >> 174 JustWarning,"Assignment operator is called"); >> 175 return *this; 158 } 176 } 159 177 160 // ------------------------------------------- << 178 G4int G4VProcess::operator==(const G4VProcess &right) const 161 G4bool G4VProcess::operator==(const G4VProcess << 162 { 179 { 163 return (this == &right); 180 return (this == &right); 164 } 181 } 165 182 166 // ------------------------------------------- << 183 G4int G4VProcess::operator!=(const G4VProcess &right) const 167 G4bool G4VProcess::operator!=(const G4VProcess << 168 { 184 { 169 return (this != &right); 185 return (this != &right); 170 } 186 } 171 187 172 // ------------------------------------------- << 173 void G4VProcess::DumpInfo() const 188 void G4VProcess::DumpInfo() const 174 { 189 { 175 G4cout << "Process Name " << theProcessName 190 G4cout << "Process Name " << theProcessName ; 176 G4cout << " : Type[" << GetProcessTypeName(t 191 G4cout << " : Type[" << GetProcessTypeName(theProcessType) << "]"; 177 G4cout << " : SubType[" << theProcessSubType 192 G4cout << " : SubType[" << theProcessSubType << "]"<< G4endl; 178 } 193 } 179 194 180 // ------------------------------------------- << 195 181 void G4VProcess::ProcessDescription(std::ostre << 196 const G4String& G4VProcess::GetPhysicsTableFileName(const G4ParticleDefinition* particle, 182 { << 197 const G4String& directory, 183 outFile << "This process has not yet been de << 198 const G4String& tableName, 184 } << 199 G4bool ascii) 185 << 186 // ------------------------------------------- << 187 const G4String& G4VProcess:: << 188 GetPhysicsTableFileName( const G4ParticleDefin << 189 const G4String& direc << 190 const G4String& table << 191 G4bool ascii ) << 192 { 200 { 193 G4String thePhysicsTableFileExt; 201 G4String thePhysicsTableFileExt; 194 if (ascii) thePhysicsTableFileExt = ".asc"; 202 if (ascii) thePhysicsTableFileExt = ".asc"; 195 else thePhysicsTableFileExt = ".dat"; 203 else thePhysicsTableFileExt = ".dat"; 196 204 197 thePhysicsTableFileName = directory + "/"; 205 thePhysicsTableFileName = directory + "/"; 198 thePhysicsTableFileName += tableName + "." + 206 thePhysicsTableFileName += tableName + "." + theProcessName + "."; 199 thePhysicsTableFileName += particle->GetPart << 207 thePhysicsTableFileName += particle->GetParticleName() + thePhysicsTableFileExt; 200 + thePhysicsTableFi << 201 208 202 return thePhysicsTableFileName; 209 return thePhysicsTableFileName; 203 } 210 } 204 211 205 // ------------------------------------------- << 206 void G4VProcess::BuildWorkerPhysicsTable(const << 207 { << 208 BuildPhysicsTable(part); << 209 } << 210 212 211 // ------------------------------------------- << 212 void G4VProcess::PrepareWorkerPhysicsTable(con << 213 { << 214 PreparePhysicsTable(part); << 215 } << 216 213 217 // ------------------------------------------- << 214 218 void G4VProcess::SetMasterProcess(G4VProcess* << 215 219 { << 216 220 masterProcessShadow = masterP; << 217 221 } << 218 >> 219 >> 220 >> 221 222 222