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