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