[819] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
[963] | 27 | // $Id: G4VProcess.cc,v 1.16 2007/11/15 04:10:18 kurasige Exp $ |
---|
[1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[819] | 29 | // |
---|
| 30 | // |
---|
| 31 | // -------------------------------------------------------------- |
---|
| 32 | // GEANT 4 class implementation file |
---|
| 33 | // |
---|
| 34 | // History: first implementation, based on object model of |
---|
| 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 |
---|
| 41 | |
---|
| 42 | #include "G4PhysicsTable.hh" |
---|
| 43 | #include "G4MaterialTable.hh" |
---|
| 44 | #include "G4ElementTable.hh" |
---|
| 45 | #include "G4ElementVector.hh" |
---|
| 46 | #include "G4VProcess.hh" |
---|
| 47 | |
---|
| 48 | G4VProcess::G4VProcess(const G4String& aName, G4ProcessType aType ) |
---|
| 49 | : pParticleChange(0), |
---|
| 50 | theNumberOfInteractionLengthLeft(-1.0), |
---|
| 51 | currentInteractionLength(-1.0), |
---|
| 52 | theProcessName(aName), |
---|
| 53 | theProcessType(aType), |
---|
[963] | 54 | theProcessSubType(-1), |
---|
[819] | 55 | thePILfactor(1.0), |
---|
[963] | 56 | enableAtRestDoIt(true), |
---|
| 57 | enableAlongStepDoIt(true), |
---|
| 58 | enablePostStepDoIt(true), |
---|
[819] | 59 | verboseLevel(0) |
---|
[963] | 60 | |
---|
[819] | 61 | { |
---|
| 62 | pParticleChange = &aParticleChange; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | G4VProcess::~G4VProcess() |
---|
| 66 | { |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | G4VProcess::G4VProcess(const G4VProcess& right) |
---|
| 70 | : pParticleChange(0), |
---|
| 71 | theNumberOfInteractionLengthLeft(-1.0), |
---|
| 72 | currentInteractionLength(-1.0), |
---|
| 73 | theProcessName(right.theProcessName), |
---|
| 74 | theProcessType(right.theProcessType), |
---|
[963] | 75 | theProcessSubType(right.theProcessSubType), |
---|
[819] | 76 | thePILfactor(1.0), |
---|
[963] | 77 | enableAtRestDoIt(right.enableAtRestDoIt), |
---|
| 78 | enableAlongStepDoIt(right.enableAlongStepDoIt), |
---|
| 79 | enablePostStepDoIt(right.enablePostStepDoIt), |
---|
| 80 | verboseLevel(right.verboseLevel) |
---|
[819] | 81 | { |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | void G4VProcess::SubtractNumberOfInteractionLengthLeft( |
---|
| 86 | G4double previousStepSize ) |
---|
| 87 | { |
---|
| 88 | if (currentInteractionLength>0.0) { |
---|
| 89 | theNumberOfInteractionLengthLeft -= previousStepSize/currentInteractionLength; |
---|
| 90 | if(theNumberOfInteractionLengthLeft<0.) { |
---|
[963] | 91 | theNumberOfInteractionLengthLeft=perMillion; |
---|
[819] | 92 | } |
---|
[963] | 93 | |
---|
[819] | 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 | } |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | void G4VProcess::StartTracking(G4Track*) |
---|
| 110 | { |
---|
| 111 | currentInteractionLength = -1.0; |
---|
| 112 | theNumberOfInteractionLengthLeft = -1.0; |
---|
| 113 | #ifdef G4VERBOSE |
---|
| 114 | if (verboseLevel>2) { |
---|
| 115 | G4cout << "G4VProcess::StartTracking() [" << theProcessName << "]" <<G4endl; |
---|
| 116 | } |
---|
| 117 | #endif |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | void G4VProcess::EndTracking() |
---|
| 121 | { |
---|
| 122 | #ifdef G4VERBOSE |
---|
| 123 | if (verboseLevel>2) { |
---|
| 124 | G4cout << "G4VProcess::EndTracking() [" << theProcessName << "]" <<G4endl; |
---|
| 125 | } |
---|
| 126 | #endif |
---|
| 127 | theNumberOfInteractionLengthLeft = -1.0; |
---|
| 128 | currentInteractionLength = -1.0; |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | const G4String& G4VProcess::GetProcessTypeName(G4ProcessType aType ) |
---|
| 133 | { |
---|
| 134 | static G4String typeNotDefined= "NotDefined"; |
---|
| 135 | static G4String typeTransportation = "Transportation"; |
---|
| 136 | static G4String typeElectromagnetic = "Electromagnetic"; |
---|
| 137 | static G4String typeOptical = "Optical"; |
---|
| 138 | static G4String typeHadronic = "Hadronic"; |
---|
| 139 | static G4String typePhotolepton_hadron = "Photolepton_hadron"; |
---|
| 140 | static G4String typeDecay = "Decay"; |
---|
| 141 | static G4String typeGeneral = "General"; |
---|
| 142 | static G4String typeParameterisation = "Parameterisation"; |
---|
| 143 | static G4String typeUserDefined = "UserDefined"; |
---|
| 144 | static G4String noType = "------"; // Do not modify this !!!! |
---|
| 145 | |
---|
| 146 | if (aType == fNotDefined) { |
---|
| 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; |
---|
| 168 | } |
---|
| 169 | } |
---|
| 170 | |
---|
| 171 | G4VProcess & G4VProcess::operator=(const G4VProcess &) |
---|
| 172 | { |
---|
| 173 | G4Exception("G4VProcess::operator=","Illegal operation", |
---|
| 174 | JustWarning,"Assignment operator is called"); |
---|
| 175 | return *this; |
---|
| 176 | } |
---|
| 177 | |
---|
| 178 | G4int G4VProcess::operator==(const G4VProcess &right) const |
---|
| 179 | { |
---|
| 180 | return (this == &right); |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | G4int G4VProcess::operator!=(const G4VProcess &right) const |
---|
| 184 | { |
---|
| 185 | return (this != &right); |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | void G4VProcess::DumpInfo() const |
---|
| 189 | { |
---|
| 190 | G4cout << "Process Name " << theProcessName ; |
---|
[963] | 191 | G4cout << " : Type[" << GetProcessTypeName(theProcessType) << "]"; |
---|
| 192 | G4cout << " : SubType[" << theProcessSubType << "]"<< G4endl; |
---|
[819] | 193 | } |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | const G4String& G4VProcess::GetPhysicsTableFileName(const G4ParticleDefinition* particle, |
---|
| 197 | const G4String& directory, |
---|
| 198 | const G4String& tableName, |
---|
| 199 | G4bool ascii) |
---|
| 200 | { |
---|
| 201 | G4String thePhysicsTableFileExt; |
---|
| 202 | if (ascii) thePhysicsTableFileExt = ".asc"; |
---|
| 203 | else thePhysicsTableFileExt = ".dat"; |
---|
| 204 | |
---|
| 205 | thePhysicsTableFileName = directory + "/"; |
---|
| 206 | thePhysicsTableFileName += tableName + "." + theProcessName + "."; |
---|
| 207 | thePhysicsTableFileName += particle->GetParticleName() + thePhysicsTableFileExt; |
---|
| 208 | |
---|
| 209 | return thePhysicsTableFileName; |
---|
| 210 | } |
---|
| 211 | |
---|
| 212 | |
---|
| 213 | |
---|
| 214 | |
---|
| 215 | |
---|
| 216 | |
---|
| 217 | |
---|
| 218 | |
---|
| 219 | |
---|
| 220 | |
---|
| 221 | |
---|