| 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 | //
|
|---|
| 27 | // $Id: G4VRestDiscreteProcess.hh,v 1.9 2007/11/15 04:10:18 kurasige Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // ------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 class header file
|
|---|
| 33 | //
|
|---|
| 34 | //
|
|---|
| 35 | // Class Description
|
|---|
| 36 | // Abstract class which defines the public behavior of
|
|---|
| 37 | // rest + discrete physics interactions.
|
|---|
| 38 | //
|
|---|
| 39 | // ------------------------------------------------------------
|
|---|
| 40 | // New Physics scheme 8 Mar. 1997 H.Kurahige
|
|---|
| 41 | // ------------------------------------------------------------
|
|---|
| 42 | // modified for new ParticleChange 12 Mar. 1998 H.Kurashige
|
|---|
| 43 | // Fixed a bug in PostStepGetPhysicalInteractionLength
|
|---|
| 44 | // 15 Apr. 2002 H.Kurashige
|
|---|
| 45 | //
|
|---|
| 46 |
|
|---|
| 47 | #ifndef G4VRestDiscreteProcess_h
|
|---|
| 48 | #define G4VRestDiscreteProcess_h 1
|
|---|
| 49 |
|
|---|
| 50 | #include "globals.hh"
|
|---|
| 51 | #include "G4ios.hh"
|
|---|
| 52 |
|
|---|
| 53 | #include "G4VProcess.hh"
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | class G4VRestDiscreteProcess : public G4VProcess
|
|---|
| 57 | {
|
|---|
| 58 | // Abstract class which defines the public behavior of
|
|---|
| 59 | // rest + discrete physics interactions.
|
|---|
| 60 | public:
|
|---|
| 61 |
|
|---|
| 62 | G4VRestDiscreteProcess(const G4String& ,
|
|---|
| 63 | G4ProcessType aType = fNotDefined );
|
|---|
| 64 | G4VRestDiscreteProcess(G4VRestDiscreteProcess &);
|
|---|
| 65 |
|
|---|
| 66 | virtual ~G4VRestDiscreteProcess();
|
|---|
| 67 |
|
|---|
| 68 | public :// with description
|
|---|
| 69 | virtual G4double PostStepGetPhysicalInteractionLength(
|
|---|
| 70 | const G4Track& track,
|
|---|
| 71 | G4double previousStepSize,
|
|---|
| 72 | G4ForceCondition* condition
|
|---|
| 73 | );
|
|---|
| 74 |
|
|---|
| 75 | virtual G4VParticleChange* PostStepDoIt(
|
|---|
| 76 | const G4Track& ,
|
|---|
| 77 | const G4Step&
|
|---|
| 78 | );
|
|---|
| 79 |
|
|---|
| 80 | virtual G4double AtRestGetPhysicalInteractionLength(
|
|---|
| 81 | const G4Track& ,
|
|---|
| 82 | G4ForceCondition*
|
|---|
| 83 | );
|
|---|
| 84 |
|
|---|
| 85 | virtual G4VParticleChange* AtRestDoIt(
|
|---|
| 86 | const G4Track& ,
|
|---|
| 87 | const G4Step&
|
|---|
| 88 | );
|
|---|
| 89 |
|
|---|
| 90 | // no operation in AlongStepDoIt
|
|---|
| 91 | virtual G4double AlongStepGetPhysicalInteractionLength(
|
|---|
| 92 | const G4Track&,
|
|---|
| 93 | G4double ,
|
|---|
| 94 | G4double ,
|
|---|
| 95 | G4double& ,
|
|---|
| 96 | G4GPILSelection*
|
|---|
| 97 | ){ return -1.0; };
|
|---|
| 98 |
|
|---|
| 99 | // no operation in AlongStepDoIt
|
|---|
| 100 | virtual G4VParticleChange* AlongStepDoIt(
|
|---|
| 101 | const G4Track& ,
|
|---|
| 102 | const G4Step&
|
|---|
| 103 | ) {return 0;};
|
|---|
| 104 |
|
|---|
| 105 | protected:// with description
|
|---|
| 106 | virtual G4double GetMeanFreePath(const G4Track& aTrack,
|
|---|
| 107 | G4double previousStepSize,
|
|---|
| 108 | G4ForceCondition* condition
|
|---|
| 109 | )=0;
|
|---|
| 110 | // Calculates from the macroscopic cross section a mean
|
|---|
| 111 | // free path, the value is returned in units of distance.
|
|---|
| 112 |
|
|---|
| 113 | virtual G4double GetMeanLifeTime(const G4Track& aTrack,G4ForceCondition* condition)=0;
|
|---|
| 114 | // Calculates the mean life-time (i.e. for decays) of the
|
|---|
| 115 | // particle at rest due to the occurence of the given process,
|
|---|
| 116 | // or converts the probability of interaction (i.e. for
|
|---|
| 117 | // annihilation) into the life-time of the particle for the
|
|---|
| 118 | // occurence of the given process.
|
|---|
| 119 |
|
|---|
| 120 | private:
|
|---|
| 121 | // hide default constructor and assignment operator as private
|
|---|
| 122 | G4VRestDiscreteProcess();
|
|---|
| 123 | G4VRestDiscreteProcess & operator=(const G4VRestDiscreteProcess &right);
|
|---|
| 124 |
|
|---|
| 125 | };
|
|---|
| 126 |
|
|---|
| 127 | // -----------------------------------------
|
|---|
| 128 | // inlined function members implementation
|
|---|
| 129 | // -----------------------------------------
|
|---|
| 130 | #include "Randomize.hh"
|
|---|
| 131 | #include "G4Step.hh"
|
|---|
| 132 | #include "G4Track.hh"
|
|---|
| 133 | #include "G4MaterialTable.hh"
|
|---|
| 134 | #include "G4VParticleChange.hh"
|
|---|
| 135 |
|
|---|
| 136 | inline
|
|---|
| 137 | G4double G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength(
|
|---|
| 138 | const G4Track& track,
|
|---|
| 139 | G4double previousStepSize,
|
|---|
| 140 | G4ForceCondition* condition
|
|---|
| 141 | )
|
|---|
| 142 | {
|
|---|
| 143 | if ( (previousStepSize < 0.0) || (theNumberOfInteractionLengthLeft<=0.0)) {
|
|---|
| 144 | // beggining of tracking (or just after DoIt of this process)
|
|---|
| 145 | ResetNumberOfInteractionLengthLeft();
|
|---|
| 146 | } else if ( previousStepSize > 0.0) {
|
|---|
| 147 | // subtract NumberOfInteractionLengthLeft
|
|---|
| 148 | SubtractNumberOfInteractionLengthLeft(previousStepSize);
|
|---|
| 149 | } else {
|
|---|
| 150 | // zero step
|
|---|
| 151 | // DO NOTHING
|
|---|
| 152 | }
|
|---|
| 153 |
|
|---|
| 154 | // condition is set to "Not Forced"
|
|---|
| 155 | *condition = NotForced;
|
|---|
| 156 |
|
|---|
| 157 | // get mean free path
|
|---|
| 158 | currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition);
|
|---|
| 159 |
|
|---|
| 160 | G4double value;
|
|---|
| 161 | if (currentInteractionLength <DBL_MAX) {
|
|---|
| 162 | value = theNumberOfInteractionLengthLeft * currentInteractionLength;
|
|---|
| 163 | } else {
|
|---|
| 164 | value = DBL_MAX;
|
|---|
| 165 | }
|
|---|
| 166 | #ifdef G4VERBOSE
|
|---|
| 167 | if (verboseLevel>1){
|
|---|
| 168 | G4cout << "G4VRestDiscreteProcess::PostStepGetPhysicalInteractionLength ";
|
|---|
| 169 | G4cout << "[ " << GetProcessName() << "]" <<G4endl;
|
|---|
| 170 | track.GetDynamicParticle()->DumpInfo();
|
|---|
| 171 | G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
|
|---|
| 172 | G4cout << "InteractionLength= " << value/cm <<"[cm] " <<G4endl;
|
|---|
| 173 | }
|
|---|
| 174 | #endif
|
|---|
| 175 | return value;
|
|---|
| 176 | }
|
|---|
| 177 |
|
|---|
| 178 | inline G4VParticleChange* G4VRestDiscreteProcess::PostStepDoIt(
|
|---|
| 179 | const G4Track& ,
|
|---|
| 180 | const G4Step&
|
|---|
| 181 | )
|
|---|
| 182 | {
|
|---|
| 183 | // reset NumberOfInteractionLengthLeft
|
|---|
| 184 | ClearNumberOfInteractionLengthLeft();
|
|---|
| 185 |
|
|---|
| 186 | return pParticleChange;
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | inline G4double G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength(
|
|---|
| 190 | const G4Track& track,
|
|---|
| 191 | G4ForceCondition* condition
|
|---|
| 192 | )
|
|---|
| 193 | {
|
|---|
| 194 | // beggining of tracking
|
|---|
| 195 | ResetNumberOfInteractionLengthLeft();
|
|---|
| 196 |
|
|---|
| 197 | // condition is set to "Not Forced"
|
|---|
| 198 | *condition = NotForced;
|
|---|
| 199 |
|
|---|
| 200 | // get mean life time
|
|---|
| 201 | currentInteractionLength = GetMeanLifeTime(track, condition);
|
|---|
| 202 |
|
|---|
| 203 | #ifdef G4VERBOSE
|
|---|
| 204 | if ((currentInteractionLength <0.0) || (verboseLevel>2)){
|
|---|
| 205 | G4cout << "G4VRestDiscreteProcess::AtRestGetPhysicalInteractionLength ";
|
|---|
| 206 | G4cout << "[ " << GetProcessName() << "]" <<G4endl;
|
|---|
| 207 | track.GetDynamicParticle()->DumpInfo();
|
|---|
| 208 | G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
|
|---|
| 209 | G4cout << "MeanLifeTime = " << currentInteractionLength/ns << "[ns]" <<G4endl;
|
|---|
| 210 | }
|
|---|
| 211 | #endif
|
|---|
| 212 |
|
|---|
| 213 | return theNumberOfInteractionLengthLeft * currentInteractionLength;
|
|---|
| 214 | }
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 | inline G4VParticleChange* G4VRestDiscreteProcess::AtRestDoIt(
|
|---|
| 218 | const G4Track&,
|
|---|
| 219 | const G4Step&
|
|---|
| 220 | )
|
|---|
| 221 | {
|
|---|
| 222 | // clear NumberOfInteractionLengthLeft
|
|---|
| 223 | ClearNumberOfInteractionLengthLeft();
|
|---|
| 224 |
|
|---|
| 225 | return pParticleChange;
|
|---|
| 226 | }
|
|---|
| 227 |
|
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 | #endif
|
|---|
| 231 |
|
|---|