| [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 | //
|
|---|
| [1340] | 27 | // $Id: G4SynchrotronRadiationInMat.cc,v 1.5 2010/10/14 18:38:21 vnivanch Exp $
|
|---|
| 28 | // GEANT4 tag $Name: xrays-V09-03-05 $
|
|---|
| [819] | 29 | //
|
|---|
| 30 | // --------------------------------------------------------------
|
|---|
| 31 | // GEANT 4 class implementation file
|
|---|
| 32 | // CERN Geneva Switzerland
|
|---|
| 33 | //
|
|---|
| 34 | // History: first implementation,
|
|---|
| 35 | // 21-5-98 V.Grichine
|
|---|
| 36 | // 28-05-01, V.Ivanchenko minor changes to provide ANSI -wall compilation
|
|---|
| 37 | // 04.03.05, V.Grichine: get local field interface
|
|---|
| 38 | // 19-05-06, V.Ivanchenko rename from G4SynchrotronRadiation
|
|---|
| 39 | //
|
|---|
| 40 | //
|
|---|
| 41 | ///////////////////////////////////////////////////////////////////////////
|
|---|
| 42 |
|
|---|
| 43 | #include "G4SynchrotronRadiationInMat.hh"
|
|---|
| 44 | #include "G4Integrator.hh"
|
|---|
| [1340] | 45 | #include "G4EmProcessSubType.hh"
|
|---|
| [819] | 46 |
|
|---|
| 47 | ////////////////////////////////////////////////////////////////////
|
|---|
| 48 | //
|
|---|
| 49 | // Constant for calculation of mean free path
|
|---|
| 50 | //
|
|---|
| 51 |
|
|---|
| 52 | const G4double
|
|---|
| [1337] | 53 | G4SynchrotronRadiationInMat::fLambdaConst = std::sqrt(3.0)*electron_mass_c2/
|
|---|
| [819] | 54 | (2.5*fine_structure_const*eplus*c_light) ;
|
|---|
| 55 |
|
|---|
| 56 | /////////////////////////////////////////////////////////////////////
|
|---|
| 57 | //
|
|---|
| 58 | // Constant for calculation of characterictic energy
|
|---|
| 59 | //
|
|---|
| 60 |
|
|---|
| 61 | const G4double
|
|---|
| 62 | G4SynchrotronRadiationInMat::fEnergyConst = 1.5*c_light*c_light*eplus*hbar_Planck/
|
|---|
| 63 | electron_mass_c2 ;
|
|---|
| 64 |
|
|---|
| 65 | ////////////////////////////////////////////////////////////////////
|
|---|
| 66 | //
|
|---|
| 67 | // Array of integral probability of synchrotron photons:
|
|---|
| 68 | //
|
|---|
| 69 | // the corresponding energy = 0.0001*i*i*(characteristic energy)
|
|---|
| 70 | //
|
|---|
| 71 |
|
|---|
| 72 | const G4double
|
|---|
| 73 | G4SynchrotronRadiationInMat::fIntegralProbabilityOfSR[200] =
|
|---|
| 74 | {
|
|---|
| 75 | 1.000000e+00, 9.428859e-01, 9.094095e-01, 8.813971e-01, 8.565154e-01,
|
|---|
| 76 | 8.337008e-01, 8.124961e-01, 7.925217e-01, 7.735517e-01, 7.554561e-01,
|
|---|
| 77 | 7.381233e-01, 7.214521e-01, 7.053634e-01, 6.898006e-01, 6.747219e-01,
|
|---|
| 78 | 6.600922e-01, 6.458793e-01, 6.320533e-01, 6.185872e-01, 6.054579e-01,
|
|---|
| 79 | 5.926459e-01, 5.801347e-01, 5.679103e-01, 5.559604e-01, 5.442736e-01,
|
|---|
| 80 | 5.328395e-01, 5.216482e-01, 5.106904e-01, 4.999575e-01, 4.894415e-01,
|
|---|
| 81 | 4.791351e-01, 4.690316e-01, 4.591249e-01, 4.494094e-01, 4.398800e-01,
|
|---|
| 82 | 4.305320e-01, 4.213608e-01, 4.123623e-01, 4.035325e-01, 3.948676e-01,
|
|---|
| 83 | 3.863639e-01, 3.780179e-01, 3.698262e-01, 3.617858e-01, 3.538933e-01,
|
|---|
| 84 | 3.461460e-01, 3.385411e-01, 3.310757e-01, 3.237474e-01, 3.165536e-01,
|
|---|
| 85 | 3.094921e-01, 3.025605e-01, 2.957566e-01, 2.890784e-01, 2.825237e-01,
|
|---|
| 86 | 2.760907e-01, 2.697773e-01, 2.635817e-01, 2.575020e-01, 2.515365e-01,
|
|---|
| 87 | 2.456834e-01, 2.399409e-01, 2.343074e-01, 2.287812e-01, 2.233607e-01,
|
|---|
| 88 | 2.180442e-01, 2.128303e-01, 2.077174e-01, 2.027040e-01, 1.977885e-01,
|
|---|
| 89 | 1.929696e-01, 1.882457e-01, 1.836155e-01, 1.790775e-01, 1.746305e-01,
|
|---|
| 90 | 1.702730e-01, 1.660036e-01, 1.618212e-01, 1.577243e-01, 1.537117e-01,
|
|---|
| 91 | 1.497822e-01, 1.459344e-01, 1.421671e-01, 1.384791e-01, 1.348691e-01,
|
|---|
| 92 | 1.313360e-01, 1.278785e-01, 1.244956e-01, 1.211859e-01, 1.179483e-01,
|
|---|
| 93 | 1.147818e-01, 1.116850e-01, 1.086570e-01, 1.056966e-01, 1.028026e-01,
|
|---|
| 94 | 9.997405e-02, 9.720975e-02, 9.450865e-02, 9.186969e-02, 8.929179e-02,
|
|---|
| 95 | 8.677391e-02, 8.431501e-02, 8.191406e-02, 7.957003e-02, 7.728192e-02,
|
|---|
| 96 | 7.504872e-02, 7.286944e-02, 7.074311e-02, 6.866874e-02, 6.664538e-02,
|
|---|
| 97 | 6.467208e-02, 6.274790e-02, 6.087191e-02, 5.904317e-02, 5.726079e-02,
|
|---|
| 98 | 5.552387e-02, 5.383150e-02, 5.218282e-02, 5.057695e-02, 4.901302e-02,
|
|---|
| 99 | 4.749020e-02, 4.600763e-02, 4.456450e-02, 4.315997e-02, 4.179325e-02,
|
|---|
| 100 | 4.046353e-02, 3.917002e-02, 3.791195e-02, 3.668855e-02, 3.549906e-02,
|
|---|
| 101 | 3.434274e-02, 3.321884e-02, 3.212665e-02, 3.106544e-02, 3.003452e-02,
|
|---|
| 102 | 2.903319e-02, 2.806076e-02, 2.711656e-02, 2.619993e-02, 2.531021e-02,
|
|---|
| 103 | 2.444677e-02, 2.360897e-02, 2.279620e-02, 2.200783e-02, 2.124327e-02,
|
|---|
| 104 | 2.050194e-02, 1.978324e-02, 1.908662e-02, 1.841151e-02, 1.775735e-02,
|
|---|
| 105 | 1.712363e-02, 1.650979e-02, 1.591533e-02, 1.533973e-02, 1.478250e-02,
|
|---|
| 106 | 1.424314e-02, 1.372117e-02, 1.321613e-02, 1.272755e-02, 1.225498e-02,
|
|---|
| 107 | 1.179798e-02, 1.135611e-02, 1.092896e-02, 1.051609e-02, 1.011712e-02,
|
|---|
| 108 | 9.731635e-03, 9.359254e-03, 8.999595e-03, 8.652287e-03, 8.316967e-03,
|
|---|
| 109 | 7.993280e-03, 7.680879e-03, 7.379426e-03, 7.088591e-03, 6.808051e-03,
|
|---|
| 110 | 6.537491e-03, 6.276605e-03, 6.025092e-03, 5.782661e-03, 5.549027e-03,
|
|---|
| 111 | 5.323912e-03, 5.107045e-03, 4.898164e-03, 4.697011e-03, 4.503336e-03,
|
|---|
| 112 | 4.316896e-03, 4.137454e-03, 3.964780e-03, 3.798649e-03, 3.638843e-03,
|
|---|
| 113 | 3.485150e-03, 3.337364e-03, 3.195284e-03, 3.058715e-03, 2.927469e-03,
|
|---|
| 114 | 2.801361e-03, 2.680213e-03, 2.563852e-03, 2.452110e-03, 2.344824e-03
|
|---|
| 115 | };
|
|---|
| 116 |
|
|---|
| 117 | ///////////////////////////////////////////////////////////////////////
|
|---|
| 118 | //
|
|---|
| 119 | // Constructor
|
|---|
| 120 | //
|
|---|
| 121 |
|
|---|
| 122 | G4SynchrotronRadiationInMat::G4SynchrotronRadiationInMat(const G4String& processName,
|
|---|
| 123 | G4ProcessType type):G4VDiscreteProcess (processName, type),
|
|---|
| 124 | LowestKineticEnergy (10.*keV),
|
|---|
| 125 | HighestKineticEnergy (100.*TeV),
|
|---|
| 126 | TotBin(200),
|
|---|
| 127 | theGamma (G4Gamma::Gamma() ),
|
|---|
| 128 | theElectron ( G4Electron::Electron() ),
|
|---|
| 129 | thePositron ( G4Positron::Positron() ), fAlpha(0.0), fRootNumber(80),
|
|---|
| 130 | fVerboseLevel( verboseLevel )
|
|---|
| 131 | {
|
|---|
| 132 | G4TransportationManager* transportMgr = G4TransportationManager::GetTransportationManager();
|
|---|
| 133 |
|
|---|
| 134 | fFieldPropagator = transportMgr->GetPropagatorInField();
|
|---|
| [1340] | 135 | SetProcessSubType(fSynchrotronRadiation);
|
|---|
| [819] | 136 |
|
|---|
| 137 | }
|
|---|
| 138 |
|
|---|
| 139 | /////////////////////////////////////////////////////////////////////////
|
|---|
| 140 | //
|
|---|
| 141 | // Destructor
|
|---|
| 142 | //
|
|---|
| 143 |
|
|---|
| 144 | G4SynchrotronRadiationInMat::~G4SynchrotronRadiationInMat()
|
|---|
| [1340] | 145 | {}
|
|---|
| [819] | 146 |
|
|---|
| 147 |
|
|---|
| 148 | /////////////////////////////// METHODS /////////////////////////////////
|
|---|
| 149 | //
|
|---|
| 150 | //
|
|---|
| 151 | // Production of synchrotron X-ray photon
|
|---|
| 152 | // GEANT4 internal units.
|
|---|
| 153 | //
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 | G4double
|
|---|
| 157 | G4SynchrotronRadiationInMat::GetMeanFreePath( const G4Track& trackData,
|
|---|
| 158 | G4double,
|
|---|
| 159 | G4ForceCondition* condition)
|
|---|
| 160 | {
|
|---|
| 161 | // gives the MeanFreePath in GEANT4 internal units
|
|---|
| 162 | G4double MeanFreePath;
|
|---|
| 163 |
|
|---|
| 164 | const G4DynamicParticle* aDynamicParticle = trackData.GetDynamicParticle();
|
|---|
| 165 | // G4Material* aMaterial = trackData.GetMaterial();
|
|---|
| 166 |
|
|---|
| 167 | //G4bool isOutRange ;
|
|---|
| 168 |
|
|---|
| 169 | *condition = NotForced ;
|
|---|
| 170 |
|
|---|
| 171 | G4double gamma = aDynamicParticle->GetTotalEnergy()/
|
|---|
| 172 | aDynamicParticle->GetMass();
|
|---|
| 173 |
|
|---|
| 174 | G4double particleCharge = aDynamicParticle->GetDefinition()->GetPDGCharge();
|
|---|
| 175 |
|
|---|
| 176 | G4double KineticEnergy = aDynamicParticle->GetKineticEnergy();
|
|---|
| 177 |
|
|---|
| 178 | if ( KineticEnergy < LowestKineticEnergy || gamma < 1.0e3 ) MeanFreePath = DBL_MAX;
|
|---|
| 179 | else
|
|---|
| 180 | {
|
|---|
| 181 |
|
|---|
| 182 | G4ThreeVector FieldValue;
|
|---|
| 183 | const G4Field* pField = 0;
|
|---|
| 184 |
|
|---|
| 185 | G4FieldManager* fieldMgr=0;
|
|---|
| 186 | G4bool fieldExertsForce = false;
|
|---|
| 187 |
|
|---|
| 188 | if( (particleCharge != 0.0) )
|
|---|
| 189 | {
|
|---|
| 190 | fieldMgr = fFieldPropagator->FindAndSetFieldManager( trackData.GetVolume() );
|
|---|
| 191 |
|
|---|
| 192 | if ( fieldMgr != 0 )
|
|---|
| 193 | {
|
|---|
| 194 | // If the field manager has no field, there is no field !
|
|---|
| 195 |
|
|---|
| 196 | fieldExertsForce = ( fieldMgr->GetDetectorField() != 0 );
|
|---|
| 197 | }
|
|---|
| 198 | }
|
|---|
| 199 | if ( fieldExertsForce )
|
|---|
| 200 | {
|
|---|
| 201 | pField = fieldMgr->GetDetectorField() ;
|
|---|
| 202 | G4ThreeVector globPosition = trackData.GetPosition();
|
|---|
| 203 |
|
|---|
| 204 | G4double globPosVec[3], FieldValueVec[3];
|
|---|
| 205 |
|
|---|
| 206 | globPosVec[0] = globPosition.x();
|
|---|
| 207 | globPosVec[1] = globPosition.y();
|
|---|
| 208 | globPosVec[2] = globPosition.z();
|
|---|
| 209 |
|
|---|
| 210 | pField->GetFieldValue( globPosVec, FieldValueVec );
|
|---|
| 211 |
|
|---|
| 212 | FieldValue = G4ThreeVector( FieldValueVec[0],
|
|---|
| 213 | FieldValueVec[1],
|
|---|
| 214 | FieldValueVec[2] );
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
|
|---|
| 218 | G4ThreeVector unitMomentum = aDynamicParticle->GetMomentumDirection();
|
|---|
| 219 | G4ThreeVector unitMcrossB = FieldValue.cross(unitMomentum) ;
|
|---|
| 220 | G4double perpB = unitMcrossB.mag() ;
|
|---|
| 221 | G4double beta = aDynamicParticle->GetTotalMomentum()/
|
|---|
| 222 | (aDynamicParticle->GetTotalEnergy() );
|
|---|
| 223 |
|
|---|
| 224 | if( perpB > 0.0 ) MeanFreePath = fLambdaConst*beta/perpB;
|
|---|
| 225 | else MeanFreePath = DBL_MAX;
|
|---|
| 226 | }
|
|---|
| 227 | else MeanFreePath = DBL_MAX;
|
|---|
| 228 | }
|
|---|
| 229 | if(fVerboseLevel > 0)
|
|---|
| 230 | {
|
|---|
| 231 | G4cout<<"G4SynchrotronRadiationInMat::MeanFreePath = "<<MeanFreePath/m<<" m"<<G4endl;
|
|---|
| 232 | }
|
|---|
| 233 | return MeanFreePath;
|
|---|
| 234 | }
|
|---|
| 235 |
|
|---|
| 236 | ////////////////////////////////////////////////////////////////////////////////
|
|---|
| 237 | //
|
|---|
| 238 | //
|
|---|
| 239 |
|
|---|
| 240 | G4VParticleChange*
|
|---|
| 241 | G4SynchrotronRadiationInMat::PostStepDoIt(const G4Track& trackData,
|
|---|
| 242 | const G4Step& stepData )
|
|---|
| 243 |
|
|---|
| 244 | {
|
|---|
| 245 | aParticleChange.Initialize(trackData);
|
|---|
| 246 |
|
|---|
| 247 | const G4DynamicParticle* aDynamicParticle=trackData.GetDynamicParticle();
|
|---|
| 248 |
|
|---|
| 249 | G4double gamma = aDynamicParticle->GetTotalEnergy()/
|
|---|
| 250 | (aDynamicParticle->GetMass() );
|
|---|
| 251 |
|
|---|
| 252 | if(gamma <= 1.0e3 )
|
|---|
| 253 | {
|
|---|
| 254 | return G4VDiscreteProcess::PostStepDoIt(trackData,stepData);
|
|---|
| 255 | }
|
|---|
| 256 | G4double particleCharge = aDynamicParticle->GetDefinition()->GetPDGCharge();
|
|---|
| 257 |
|
|---|
| 258 | G4ThreeVector FieldValue;
|
|---|
| 259 | const G4Field* pField = 0 ;
|
|---|
| 260 |
|
|---|
| 261 | G4FieldManager* fieldMgr=0;
|
|---|
| 262 | G4bool fieldExertsForce = false;
|
|---|
| 263 |
|
|---|
| 264 | if( (particleCharge != 0.0) )
|
|---|
| 265 | {
|
|---|
| 266 | fieldMgr = fFieldPropagator->FindAndSetFieldManager( trackData.GetVolume() );
|
|---|
| 267 | if ( fieldMgr != 0 )
|
|---|
| 268 | {
|
|---|
| 269 | // If the field manager has no field, there is no field !
|
|---|
| 270 |
|
|---|
| 271 | fieldExertsForce = ( fieldMgr->GetDetectorField() != 0 );
|
|---|
| 272 | }
|
|---|
| 273 | }
|
|---|
| 274 | if ( fieldExertsForce )
|
|---|
| 275 | {
|
|---|
| 276 | pField = fieldMgr->GetDetectorField() ;
|
|---|
| 277 | G4ThreeVector globPosition = trackData.GetPosition() ;
|
|---|
| 278 | G4double globPosVec[3], FieldValueVec[3] ;
|
|---|
| 279 | globPosVec[0] = globPosition.x() ;
|
|---|
| 280 | globPosVec[1] = globPosition.y() ;
|
|---|
| 281 | globPosVec[2] = globPosition.z() ;
|
|---|
| 282 |
|
|---|
| 283 | pField->GetFieldValue( globPosVec, FieldValueVec ) ;
|
|---|
| 284 | FieldValue = G4ThreeVector( FieldValueVec[0],
|
|---|
| 285 | FieldValueVec[1],
|
|---|
| 286 | FieldValueVec[2] );
|
|---|
| 287 |
|
|---|
| 288 | G4ThreeVector unitMomentum = aDynamicParticle->GetMomentumDirection();
|
|---|
| 289 | G4ThreeVector unitMcrossB = FieldValue.cross(unitMomentum);
|
|---|
| 290 | G4double perpB = unitMcrossB.mag() ;
|
|---|
| 291 | if(perpB > 0.0)
|
|---|
| 292 | {
|
|---|
| 293 | // M-C of synchrotron photon energy
|
|---|
| 294 |
|
|---|
| 295 | G4double energyOfSR = GetRandomEnergySR(gamma,perpB);
|
|---|
| 296 |
|
|---|
| 297 | if(fVerboseLevel > 0)
|
|---|
| 298 | {
|
|---|
| 299 | G4cout<<"SR photon energy = "<<energyOfSR/keV<<" keV"<<G4endl;
|
|---|
| 300 | }
|
|---|
| 301 | // check against insufficient energy
|
|---|
| 302 |
|
|---|
| 303 | if( energyOfSR <= 0.0 )
|
|---|
| 304 | {
|
|---|
| 305 | return G4VDiscreteProcess::PostStepDoIt(trackData,stepData);
|
|---|
| 306 | }
|
|---|
| 307 | G4double kineticEnergy = aDynamicParticle->GetKineticEnergy();
|
|---|
| 308 | G4ParticleMomentum
|
|---|
| 309 | particleDirection = aDynamicParticle->GetMomentumDirection();
|
|---|
| 310 |
|
|---|
| 311 | // M-C of its direction
|
|---|
| 312 |
|
|---|
| 313 | G4double Teta = G4UniformRand()/gamma ; // Very roughly
|
|---|
| 314 |
|
|---|
| 315 | G4double Phi = twopi * G4UniformRand() ;
|
|---|
| 316 |
|
|---|
| [1337] | 317 | G4double dirx = std::sin(Teta)*std::cos(Phi) ,
|
|---|
| 318 | diry = std::sin(Teta)*std::sin(Phi) ,
|
|---|
| 319 | dirz = std::cos(Teta) ;
|
|---|
| [819] | 320 |
|
|---|
| 321 | G4ThreeVector gammaDirection ( dirx, diry, dirz);
|
|---|
| 322 | gammaDirection.rotateUz(particleDirection);
|
|---|
| 323 |
|
|---|
| 324 | // polarization of new gamma
|
|---|
| 325 |
|
|---|
| [1337] | 326 | // G4double sx = std::cos(Teta)*std::cos(Phi);
|
|---|
| 327 | // G4double sy = std::cos(Teta)*std::sin(Phi);
|
|---|
| 328 | // G4double sz = -std::sin(Teta);
|
|---|
| [819] | 329 |
|
|---|
| 330 | G4ThreeVector gammaPolarization = FieldValue.cross(gammaDirection);
|
|---|
| 331 | gammaPolarization = gammaPolarization.unit();
|
|---|
| 332 |
|
|---|
| 333 | // (sx, sy, sz);
|
|---|
| 334 | // gammaPolarization.rotateUz(particleDirection);
|
|---|
| 335 |
|
|---|
| 336 | // create G4DynamicParticle object for the SR photon
|
|---|
| 337 |
|
|---|
| 338 | G4DynamicParticle* aGamma= new G4DynamicParticle ( G4Gamma::Gamma(),
|
|---|
| 339 | gammaDirection,
|
|---|
| 340 | energyOfSR );
|
|---|
| 341 | aGamma->SetPolarization( gammaPolarization.x(),
|
|---|
| 342 | gammaPolarization.y(),
|
|---|
| 343 | gammaPolarization.z() );
|
|---|
| 344 |
|
|---|
| 345 |
|
|---|
| 346 | aParticleChange.SetNumberOfSecondaries(1);
|
|---|
| 347 | aParticleChange.AddSecondary(aGamma);
|
|---|
| 348 |
|
|---|
| 349 | // Update the incident particle
|
|---|
| 350 |
|
|---|
| 351 | G4double newKinEnergy = kineticEnergy - energyOfSR ;
|
|---|
| 352 |
|
|---|
| 353 | if (newKinEnergy > 0.)
|
|---|
| 354 | {
|
|---|
| 355 | aParticleChange.ProposeMomentumDirection( particleDirection );
|
|---|
| 356 | aParticleChange.ProposeEnergy( newKinEnergy );
|
|---|
| 357 | aParticleChange.ProposeLocalEnergyDeposit (0.);
|
|---|
| 358 | }
|
|---|
| 359 | else
|
|---|
| 360 | {
|
|---|
| 361 | aParticleChange.ProposeEnergy( 0. );
|
|---|
| 362 | aParticleChange.ProposeLocalEnergyDeposit (0.);
|
|---|
| 363 | G4double charge = aDynamicParticle->GetDefinition()->GetPDGCharge();
|
|---|
| 364 | if (charge<0.)
|
|---|
| 365 | {
|
|---|
| 366 | aParticleChange.ProposeTrackStatus(fStopAndKill) ;
|
|---|
| 367 | }
|
|---|
| 368 | else
|
|---|
| 369 | {
|
|---|
| 370 | aParticleChange.ProposeTrackStatus(fStopButAlive) ;
|
|---|
| 371 | }
|
|---|
| 372 | }
|
|---|
| 373 | }
|
|---|
| 374 | else
|
|---|
| 375 | {
|
|---|
| 376 | return G4VDiscreteProcess::PostStepDoIt(trackData,stepData);
|
|---|
| 377 | }
|
|---|
| 378 | }
|
|---|
| 379 | return G4VDiscreteProcess::PostStepDoIt(trackData,stepData);
|
|---|
| 380 | }
|
|---|
| 381 |
|
|---|
| 382 |
|
|---|
| 383 | G4double
|
|---|
| 384 | G4SynchrotronRadiationInMat::GetPhotonEnergy( const G4Track& trackData,
|
|---|
| 385 | const G4Step& )
|
|---|
| 386 |
|
|---|
| 387 | {
|
|---|
| 388 | G4int i ;
|
|---|
| 389 | G4double energyOfSR = -1.0 ;
|
|---|
| 390 | //G4Material* aMaterial=trackData.GetMaterial() ;
|
|---|
| 391 |
|
|---|
| 392 | const G4DynamicParticle* aDynamicParticle=trackData.GetDynamicParticle();
|
|---|
| 393 |
|
|---|
| 394 | G4double gamma = aDynamicParticle->GetTotalEnergy()/
|
|---|
| 395 | (aDynamicParticle->GetMass() ) ;
|
|---|
| 396 |
|
|---|
| 397 | G4double particleCharge = aDynamicParticle->GetDefinition()->GetPDGCharge();
|
|---|
| 398 |
|
|---|
| 399 | G4ThreeVector FieldValue;
|
|---|
| 400 | const G4Field* pField = 0 ;
|
|---|
| 401 |
|
|---|
| 402 | G4FieldManager* fieldMgr=0;
|
|---|
| 403 | G4bool fieldExertsForce = false;
|
|---|
| 404 |
|
|---|
| 405 | if( (particleCharge != 0.0) )
|
|---|
| 406 | {
|
|---|
| 407 | fieldMgr = fFieldPropagator->FindAndSetFieldManager( trackData.GetVolume() );
|
|---|
| 408 | if ( fieldMgr != 0 )
|
|---|
| 409 | {
|
|---|
| 410 | // If the field manager has no field, there is no field !
|
|---|
| 411 |
|
|---|
| 412 | fieldExertsForce = ( fieldMgr->GetDetectorField() != 0 );
|
|---|
| 413 | }
|
|---|
| 414 | }
|
|---|
| 415 | if ( fieldExertsForce )
|
|---|
| 416 | {
|
|---|
| 417 | pField = fieldMgr->GetDetectorField();
|
|---|
| 418 | G4ThreeVector globPosition = trackData.GetPosition();
|
|---|
| 419 | G4double globPosVec[3], FieldValueVec[3];
|
|---|
| 420 |
|
|---|
| 421 | globPosVec[0] = globPosition.x();
|
|---|
| 422 | globPosVec[1] = globPosition.y();
|
|---|
| 423 | globPosVec[2] = globPosition.z();
|
|---|
| 424 |
|
|---|
| 425 | pField->GetFieldValue( globPosVec, FieldValueVec );
|
|---|
| 426 | FieldValue = G4ThreeVector( FieldValueVec[0],
|
|---|
| 427 | FieldValueVec[1],
|
|---|
| 428 | FieldValueVec[2] );
|
|---|
| 429 |
|
|---|
| 430 | G4ThreeVector unitMomentum = aDynamicParticle->GetMomentumDirection();
|
|---|
| 431 | G4ThreeVector unitMcrossB = FieldValue.cross(unitMomentum) ;
|
|---|
| 432 | G4double perpB = unitMcrossB.mag();
|
|---|
| 433 | if( perpB > 0.0 )
|
|---|
| 434 | {
|
|---|
| 435 | // M-C of synchrotron photon energy
|
|---|
| 436 |
|
|---|
| 437 | G4double random = G4UniformRand() ;
|
|---|
| 438 | for(i=0;i<200;i++)
|
|---|
| 439 | {
|
|---|
| 440 | if(random >= fIntegralProbabilityOfSR[i]) break ;
|
|---|
| 441 | }
|
|---|
| 442 | energyOfSR = 0.0001*i*i*fEnergyConst*gamma*gamma*perpB ;
|
|---|
| 443 |
|
|---|
| 444 | // check against insufficient energy
|
|---|
| 445 |
|
|---|
| 446 | if(energyOfSR <= 0.0)
|
|---|
| 447 | {
|
|---|
| 448 | return -1.0 ;
|
|---|
| 449 | }
|
|---|
| 450 | //G4double kineticEnergy = aDynamicParticle->GetKineticEnergy();
|
|---|
| 451 | //G4ParticleMomentum
|
|---|
| 452 | //particleDirection = aDynamicParticle->GetMomentumDirection();
|
|---|
| 453 |
|
|---|
| 454 | // Gamma production cut in this material
|
|---|
| 455 | //G4double
|
|---|
| 456 | //gammaEnergyCut = (G4Gamma::GetCutsInEnergy())[aMaterial->GetIndex()];
|
|---|
| 457 |
|
|---|
| 458 | // SR photon has energy more than the current material cut
|
|---|
| 459 | // M-C of its direction
|
|---|
| 460 |
|
|---|
| 461 | //G4double Teta = G4UniformRand()/gamma ; // Very roughly
|
|---|
| 462 |
|
|---|
| 463 | //G4double Phi = twopi * G4UniformRand() ;
|
|---|
| 464 | }
|
|---|
| 465 | else
|
|---|
| 466 | {
|
|---|
| 467 | return -1.0 ;
|
|---|
| 468 | }
|
|---|
| 469 | }
|
|---|
| 470 | return energyOfSR ;
|
|---|
| 471 | }
|
|---|
| 472 |
|
|---|
| 473 | /////////////////////////////////////////////////////////////////////////////////
|
|---|
| 474 | //
|
|---|
| 475 | //
|
|---|
| 476 |
|
|---|
| 477 | G4double G4SynchrotronRadiationInMat::GetRandomEnergySR(G4double gamma, G4double perpB)
|
|---|
| 478 | {
|
|---|
| 479 | G4int i, iMax;
|
|---|
| 480 | G4double energySR, random, position;
|
|---|
| 481 |
|
|---|
| 482 | iMax = 200;
|
|---|
| 483 | random = G4UniformRand();
|
|---|
| 484 |
|
|---|
| 485 | for( i = 0; i < iMax; i++ )
|
|---|
| 486 | {
|
|---|
| 487 | if( random >= fIntegralProbabilityOfSR[i] ) break;
|
|---|
| 488 | }
|
|---|
| 489 | if(i <= 0 ) position = G4UniformRand(); // 0.
|
|---|
| 490 | else if( i>= iMax) position = G4double(iMax);
|
|---|
| 491 | else position = i + G4UniformRand(); // -1
|
|---|
| 492 | //
|
|---|
| 493 | // it was in initial implementation:
|
|---|
| 494 | // energyOfSR = 0.0001*i*i*fEnergyConst*gamma*gamma*perpB ;
|
|---|
| 495 |
|
|---|
| 496 | energySR = 0.0001*position*position*fEnergyConst*gamma*gamma*perpB;
|
|---|
| 497 |
|
|---|
| 498 | if( energySR < 0. ) energySR = 0.;
|
|---|
| 499 |
|
|---|
| 500 | return energySR;
|
|---|
| 501 | }
|
|---|
| 502 |
|
|---|
| 503 | /////////////////////////////////////////////////////////////////////////
|
|---|
| 504 | //
|
|---|
| 505 | // return
|
|---|
| 506 |
|
|---|
| 507 | G4double G4SynchrotronRadiationInMat::GetProbSpectrumSRforInt( G4double t)
|
|---|
| 508 | {
|
|---|
| 509 | G4double result, hypCos2, hypCos=std::cosh(t);
|
|---|
| 510 |
|
|---|
| 511 | hypCos2 = hypCos*hypCos;
|
|---|
| 512 | result = std::cosh(5.*t/3.)*std::exp(t-fKsi*hypCos); // fKsi > 0. !
|
|---|
| 513 | result /= hypCos2;
|
|---|
| 514 | return result;
|
|---|
| 515 | }
|
|---|
| 516 |
|
|---|
| 517 | ///////////////////////////////////////////////////////////////////////////
|
|---|
| 518 | //
|
|---|
| 519 | // return the probability to emit SR photon with relative energy
|
|---|
| 520 | // energy/energy_c >= ksi
|
|---|
| 521 | // for ksi <= 0. P = 1., however the method works for ksi > 0 only!
|
|---|
| 522 |
|
|---|
| 523 | G4double G4SynchrotronRadiationInMat::GetIntProbSR( G4double ksi)
|
|---|
| 524 | {
|
|---|
| 525 | if (ksi <= 0.) return 1.0;
|
|---|
| 526 | fKsi = ksi; // should be > 0. !
|
|---|
| 527 | G4int n;
|
|---|
| 528 | G4double result, a;
|
|---|
| 529 |
|
|---|
| 530 | a = fAlpha; // always = 0.
|
|---|
| 531 | n = fRootNumber; // around default = 80
|
|---|
| 532 |
|
|---|
| 533 | G4Integrator<G4SynchrotronRadiationInMat, G4double(G4SynchrotronRadiationInMat::*)(G4double)> integral;
|
|---|
| 534 |
|
|---|
| 535 | result = integral.Laguerre(this,
|
|---|
| 536 | &G4SynchrotronRadiationInMat::GetProbSpectrumSRforInt, a, n);
|
|---|
| 537 |
|
|---|
| 538 | result *= 3./5./pi;
|
|---|
| 539 |
|
|---|
| 540 | return result;
|
|---|
| 541 | }
|
|---|
| 542 |
|
|---|
| 543 | /////////////////////////////////////////////////////////////////////////
|
|---|
| 544 | //
|
|---|
| 545 | // return an auxiliary function for K_5/3 integral representation
|
|---|
| 546 |
|
|---|
| 547 | G4double G4SynchrotronRadiationInMat::GetProbSpectrumSRforEnergy( G4double t)
|
|---|
| 548 | {
|
|---|
| 549 | G4double result, hypCos=std::cosh(t);
|
|---|
| 550 |
|
|---|
| 551 | result = std::cosh(5.*t/3.)*std::exp(t - fKsi*hypCos); // fKsi > 0. !
|
|---|
| 552 | result /= hypCos;
|
|---|
| 553 | return result;
|
|---|
| 554 | }
|
|---|
| 555 |
|
|---|
| 556 | ///////////////////////////////////////////////////////////////////////////
|
|---|
| 557 | //
|
|---|
| 558 | // return the probability to emit SR photon energy with relative energy
|
|---|
| 559 | // energy/energy_c >= ksi
|
|---|
| 560 | // for ksi <= 0. P = 1., however the method works for ksi > 0 only!
|
|---|
| 561 |
|
|---|
| 562 | G4double G4SynchrotronRadiationInMat::GetEnergyProbSR( G4double ksi)
|
|---|
| 563 | {
|
|---|
| 564 | if (ksi <= 0.) return 1.0;
|
|---|
| 565 | fKsi = ksi; // should be > 0. !
|
|---|
| 566 | G4int n;
|
|---|
| 567 | G4double result, a;
|
|---|
| 568 |
|
|---|
| 569 | a = fAlpha; // always = 0.
|
|---|
| 570 | n = fRootNumber; // around default = 80
|
|---|
| 571 |
|
|---|
| 572 | G4Integrator<G4SynchrotronRadiationInMat, G4double(G4SynchrotronRadiationInMat::*)(G4double)> integral;
|
|---|
| 573 |
|
|---|
| 574 | result = integral.Laguerre(this,
|
|---|
| 575 | &G4SynchrotronRadiationInMat::GetProbSpectrumSRforEnergy, a, n);
|
|---|
| 576 |
|
|---|
| 577 | result *= 9.*std::sqrt(3.)*ksi/8./pi;
|
|---|
| 578 |
|
|---|
| 579 | return result;
|
|---|
| 580 | }
|
|---|
| 581 |
|
|---|
| 582 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 583 | //
|
|---|
| 584 | //
|
|---|
| 585 |
|
|---|
| 586 | G4double G4SynchrotronRadiationInMat::GetIntegrandForAngleK( G4double t)
|
|---|
| 587 | {
|
|---|
| 588 | G4double result, hypCos=std::cosh(t);
|
|---|
| 589 |
|
|---|
| 590 | result = std::cosh(fOrderAngleK*t)*std::exp(t - fEta*hypCos); // fEta > 0. !
|
|---|
| 591 | result /= hypCos;
|
|---|
| 592 | return result;
|
|---|
| 593 | }
|
|---|
| 594 |
|
|---|
| 595 | //////////////////////////////////////////////////////////////////////////
|
|---|
| 596 | //
|
|---|
| 597 | // Return K 1/3 or 2/3 for angular distribution
|
|---|
| 598 |
|
|---|
| 599 | G4double G4SynchrotronRadiationInMat::GetAngleK( G4double eta)
|
|---|
| 600 | {
|
|---|
| 601 | fEta = eta; // should be > 0. !
|
|---|
| 602 | G4int n;
|
|---|
| 603 | G4double result, a;
|
|---|
| 604 |
|
|---|
| 605 | a = fAlpha; // always = 0.
|
|---|
| 606 | n = fRootNumber; // around default = 80
|
|---|
| 607 |
|
|---|
| 608 | G4Integrator<G4SynchrotronRadiationInMat, G4double(G4SynchrotronRadiationInMat::*)(G4double)> integral;
|
|---|
| 609 |
|
|---|
| 610 | result = integral.Laguerre(this,
|
|---|
| 611 | &G4SynchrotronRadiationInMat::GetIntegrandForAngleK, a, n);
|
|---|
| 612 |
|
|---|
| 613 | return result;
|
|---|
| 614 | }
|
|---|
| 615 |
|
|---|
| 616 | /////////////////////////////////////////////////////////////////////////
|
|---|
| 617 | //
|
|---|
| 618 | // Relative angle diff distribution for given fKsi, which is set externally
|
|---|
| 619 |
|
|---|
| 620 | G4double G4SynchrotronRadiationInMat::GetAngleNumberAtGammaKsi( G4double gpsi)
|
|---|
| 621 | {
|
|---|
| 622 | G4double result, funK, funK2, gpsi2 = gpsi*gpsi;
|
|---|
| 623 |
|
|---|
| 624 | fPsiGamma = gpsi;
|
|---|
| 625 | fEta = 0.5*fKsi*(1 + gpsi2)*std::sqrt(1 + gpsi2);
|
|---|
| 626 |
|
|---|
| 627 | fOrderAngleK = 1./3.;
|
|---|
| 628 | funK = GetAngleK(fEta);
|
|---|
| 629 | funK2 = funK*funK;
|
|---|
| 630 |
|
|---|
| 631 | result = gpsi2*funK2/(1 + gpsi2);
|
|---|
| 632 |
|
|---|
| 633 | fOrderAngleK = 2./3.;
|
|---|
| 634 | funK = GetAngleK(fEta);
|
|---|
| 635 | funK2 = funK*funK;
|
|---|
| 636 |
|
|---|
| 637 | result += funK2;
|
|---|
| 638 | result *= (1 + gpsi2)*fKsi;
|
|---|
| 639 |
|
|---|
| 640 | return result;
|
|---|
| 641 | }
|
|---|
| 642 |
|
|---|
| 643 |
|
|---|
| 644 | ///////////////////// end of G4SynchrotronRadiationInMat.cc
|
|---|
| 645 |
|
|---|