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 // G4VDiscreteProcess << 23 >> 24 // >> 25 // $Id: G4VDiscreteProcess.hh,v 1.7 2003/03/25 06:22:23 kurasige Exp $ >> 26 // GEANT4 tag $Name: geant4-06-00 $ >> 27 // >> 28 // >> 29 // ------------------------------------------------------------ >> 30 // GEANT 4 class header file >> 31 // >> 32 // History: first implementation, based on object model of >> 33 // 2nd December 1995, G.Cosmo >> 34 // add G4VDiscreteProcess(const G4String&) 24 Jul 1996, Hisaya kurashige 27 // 35 // 28 // Class description: << 36 // Class Description >> 37 // Abstract class which defines the public behavior of >> 38 // discrete physics interactions. >> 39 // >> 40 // ------------------------------------------------------------ >> 41 // New Physics scheme 18 Dec. 1996 H.Kurahige >> 42 // ------------------------------------------------------------ >> 43 // modified for new ParticleChange 12 Mar. 1998 H.Kurashige >> 44 // Fixed a bug in PostStepGetPhysicalInteractionLength >> 45 // 15 Apr. 2002 H.Kurashige 29 // 46 // 30 // Abstract class which defines the public beh << 31 // discrete physics interactions. << 32 47 33 // Authors: << 48 #ifndef G4VDiscreteProcess_h 34 // - 2 December 1995, G.Cosmo - First implemen << 49 #define G4VDiscreteProcess_h 1 35 // - 18 December 1996, H.Kurashige - New Physi << 36 // ------------------------------------------- << 37 #ifndef G4VDiscreteProcess_hh << 38 #define G4VDiscreteProcess_hh 1 << 39 50 40 #include "globals.hh" 51 #include "globals.hh" 41 #include "G4ios.hh" 52 #include "G4ios.hh" 42 53 43 #include "G4VProcess.hh" 54 #include "G4VProcess.hh" 44 55 45 class G4VDiscreteProcess : public G4VProcess 56 class G4VDiscreteProcess : public G4VProcess 46 { 57 { >> 58 // Abstract class which defines the public behavior of >> 59 // discrete physics interactions. 47 public: 60 public: 48 61 49 G4VDiscreteProcess(const G4String& aName, << 62 G4VDiscreteProcess(const G4String& , 50 G4ProcessType aType = f << 63 G4ProcessType aType = fNotDefined ); 51 G4VDiscreteProcess(G4VDiscreteProcess&); << 64 G4VDiscreteProcess(G4VDiscreteProcess &); 52 << 53 virtual ~G4VDiscreteProcess(); << 54 65 55 G4VDiscreteProcess& operator=(const G4VDis << 66 virtual ~G4VDiscreteProcess(); 56 67 57 virtual G4double PostStepGetPhysicalIntera << 68 public :// with description >> 69 virtual G4double PostStepGetPhysicalInteractionLength( 58 const G4Track& tr 70 const G4Track& track, 59 G4double previous << 71 G4double previousStepSize, 60 G4ForceCondition* << 72 G4ForceCondition* condition 61 ); << 73 ); >> 74 >> 75 virtual G4VParticleChange* PostStepDoIt( >> 76 const G4Track& , >> 77 const G4Step& >> 78 ); 62 79 63 virtual G4VParticleChange* PostStepDoIt( << 80 // no operation in AtRestDoIt and AlongStepDoIt 64 const G4Track& , << 81 virtual G4double AlongStepGetPhysicalInteractionLength( 65 const G4Step& << 66 ); << 67 << 68 // No operation in AtRestDoIt and AlongSte << 69 // << 70 virtual G4double AlongStepGetPhysicalInter << 71 const G4Track&, 82 const G4Track&, 72 G4double , << 83 G4double , 73 G4double , << 84 G4double , 74 G4double& , << 85 G4double& , 75 G4GPILSelection* 86 G4GPILSelection* 76 ) { return -1.0; } << 87 ){ return -1.0; }; 77 << 78 virtual G4double AtRestGetPhysicalInteract << 79 const G4Track& , << 80 G4ForceCondition* << 81 ) { return -1.0; } << 82 88 83 // No operation in AtRestDoIt and AlongSte << 89 virtual G4double AtRestGetPhysicalInteractionLength( 84 // << 85 virtual G4VParticleChange* AtRestDoIt( << 86 const G4Track& , 90 const G4Track& , 87 const G4Step& << 91 G4ForceCondition* 88 ) { return nullptr << 92 ) { return -1.0; }; 89 93 90 virtual G4VParticleChange* AlongStepDoIt( << 94 // no operation in AtRestDoIt and AlongStepDoIt 91 const G4Track& , << 95 virtual G4VParticleChange* AtRestDoIt( 92 const G4Step& << 96 const G4Track& , 93 ) { return nullptr << 97 const G4Step& 94 << 98 ) {return 0;}; 95 // cross section in the unit of inverse le << 99 96 // function of kinetic energy << 100 virtual G4VParticleChange* AlongStepDoIt( 97 virtual G4double GetCrossSection( << 101 const G4Track& , 98 const G4double, << 102 const G4Step& 99 const G4MaterialC << 103 ) {return 0;}; 100 ) { return 0.0; } << 101 << 102 // minimal energy for non-zero cross secti << 103 virtual G4double MinPrimaryEnergy( << 104 const G4ParticleD << 105 const G4Material* << 106 ) { return 0.0; } << 107 104 108 protected: << 105 protected:// with description 109 << 106 virtual G4double GetMeanFreePath(const G4Track& aTrack, 110 virtual G4double GetMeanFreePath( const G4 << 107 G4double previousStepSize, 111 G4double << 108 G4ForceCondition* condition 112 G4ForceC << 109 )=0; 113 // Calculates from the macroscopic cross << 110 // Calculates from the macroscopic cross section a mean 114 // free path, the value is returned in u << 111 // free path, the value is returned in units of distance. 115 112 116 private: 113 private: >> 114 // hide default constructor and assignment operator as private >> 115 G4VDiscreteProcess(); >> 116 G4VDiscreteProcess & operator=(const G4VDiscreteProcess &right); 117 117 118 G4VDiscreteProcess(); << 119 // Hidden default constructor << 120 }; 118 }; 121 119 >> 120 // ----------------------------------------- >> 121 // inlined function members implementation >> 122 // ----------------------------------------- >> 123 #include "G4Step.hh" >> 124 #include "G4Track.hh" >> 125 #include "G4MaterialTable.hh" >> 126 #include "G4VParticleChange.hh" >> 127 >> 128 inline G4double G4VDiscreteProcess::PostStepGetPhysicalInteractionLength( >> 129 const G4Track& track, >> 130 G4double previousStepSize, >> 131 G4ForceCondition* condition >> 132 ) >> 133 { >> 134 if ( (previousStepSize <=0.0) || (theNumberOfInteractionLengthLeft<=0.0)) { >> 135 // beggining of tracking (or just after DoIt of this process) >> 136 ResetNumberOfInteractionLengthLeft(); >> 137 } else { >> 138 // subtract NumberOfInteractionLengthLeft >> 139 SubtractNumberOfInteractionLengthLeft(previousStepSize); >> 140 if(theNumberOfInteractionLengthLeft<0.) >> 141 theNumberOfInteractionLengthLeft=perMillion; >> 142 } >> 143 >> 144 // condition is set to "Not Forced" >> 145 *condition = NotForced; >> 146 >> 147 // get mean free path >> 148 currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition); >> 149 >> 150 #ifdef G4VERBOSE >> 151 if ((currentInteractionLength <=0.0) || (verboseLevel>2)){ >> 152 G4cout << "G4VDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 153 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 154 track.GetDynamicParticle()->DumpInfo(); >> 155 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 156 G4cout << "MeanFreePath = " << currentInteractionLength/cm << "[cm]" <<G4endl; >> 157 } >> 158 #endif >> 159 >> 160 >> 161 G4double value; >> 162 if (currentInteractionLength <DBL_MAX) { >> 163 value = theNumberOfInteractionLengthLeft * currentInteractionLength; >> 164 } else { >> 165 value = DBL_MAX; >> 166 } >> 167 #ifdef G4VERBOSE >> 168 if (verboseLevel>1){ >> 169 G4cout << "G4VDiscreteProcess::PostStepGetPhysicalInteractionLength "; >> 170 G4cout << "[ " << GetProcessName() << "]" <<G4endl; >> 171 track.GetDynamicParticle()->DumpInfo(); >> 172 G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl; >> 173 G4cout << "InteractionLength= " << value/cm <<"[cm] " <<G4endl; >> 174 } >> 175 #endif >> 176 return value; >> 177 } >> 178 >> 179 inline G4VParticleChange* G4VDiscreteProcess::PostStepDoIt( >> 180 const G4Track& , >> 181 const G4Step& >> 182 ) >> 183 { >> 184 // clear NumberOfInteractionLengthLeft >> 185 ClearNumberOfInteractionLengthLeft(); >> 186 >> 187 return pParticleChange; >> 188 } >> 189 >> 190 122 #endif 191 #endif >> 192 >> 193 >> 194 123 195