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[ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/xrays/src/G4TransitionRadiation.cc (Version 11.3.0) and /processes/electromagnetic/xrays/src/G4TransitionRadiation.cc (Version 10.2.p3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: G4TransitionRadiation.cc 68037 2013-03-13 14:15:08Z gcosmo $
                                                   >>  27 //
 26 // G4TransitionRadiation class -- implementati     28 // G4TransitionRadiation class -- implementation file
 27                                                    29 
 28 // GEANT 4 class implementation file --- Copyr     30 // GEANT 4 class implementation file --- Copyright CERN 1995
                                                   >>  31 // CERN Geneva Switzerland
 29                                                    32 
 30 // For information related to this code, pleas     33 // For information related to this code, please, contact
 31 // CERN, CN Division, ASD Group                    34 // CERN, CN Division, ASD Group
 32 // History:                                        35 // History:
 33 // 1st version 11.09.97 V. Grichine (Vladimir.     36 // 1st version 11.09.97 V. Grichine (Vladimir.Grichine@cern.ch )
 34 // 2nd version 16.12.97 V. Grichine                37 // 2nd version 16.12.97 V. Grichine
 35 // 3rd version 28.07.05, P.Gumplinger add G4Pr     38 // 3rd version 28.07.05, P.Gumplinger add G4ProcessType to constructor
 36                                                    39 
 37 //#include <cmath>                             << 
 38                                                    40 
 39 #include "G4TransitionRadiation.hh"            <<  41 #include <cmath>
 40                                                    42 
                                                   >>  43 #include "G4TransitionRadiation.hh"
                                                   >>  44 #include "G4Material.hh"
 41 #include "G4EmProcessSubType.hh"                   45 #include "G4EmProcessSubType.hh"
 42                                                    46 
                                                   >>  47 // Local constants
                                                   >>  48 
                                                   >>  49 const G4int   G4TransitionRadiation::fSympsonNumber = 100 ;
                                                   >>  50 const G4int   G4TransitionRadiation::fGammaNumber = 15 ;
                                                   >>  51 const G4int   G4TransitionRadiation::fPointNumber = 100 ;
                                                   >>  52 
                                                   >>  53 
 43 //////////////////////////////////////////////     54 ///////////////////////////////////////////////////////////////////////
                                                   >>  55 //
 44 // Constructor for selected couple of material     56 // Constructor for selected couple of materials
 45 G4TransitionRadiation::G4TransitionRadiation(c <<  57 //
 46                                              G <<  58 
                                                   >>  59 G4TransitionRadiation::
                                                   >>  60 G4TransitionRadiation( const G4String& processName, G4ProcessType type )
 47   : G4VDiscreteProcess(processName, type)          61   : G4VDiscreteProcess(processName, type)
 48 {                                                  62 {
 49   SetProcessSubType(fTransitionRadiation);         63   SetProcessSubType(fTransitionRadiation);
 50   fMatIndex1 = fMatIndex2 = 0;                     64   fMatIndex1 = fMatIndex2 = 0;
 51                                                    65 
 52   fGamma = fEnergy = fVarAngle = fMinEnergy =  <<  66   fGamma = fEnergy = fVarAngle = fMinEnergy = fMaxEnergy = fMaxTheta = fSigma1 = fSigma2 = 0.0;
 53   fSigma1 = fSigma2 = 0.0;                     << 
 54 }                                                  67 }
 55                                                    68 
 56 //////////////////////////////////////////////     69 //////////////////////////////////////////////////////////////////////
                                                   >>  70 //
 57 // Destructor                                      71 // Destructor
 58 G4TransitionRadiation::~G4TransitionRadiation( <<  72 //
 59                                                    73 
 60 void G4TransitionRadiation::ProcessDescription <<  74 G4TransitionRadiation::~G4TransitionRadiation()
 61 {                                              <<  75 {}
 62   out << "Base class for simulation of x-ray t << 
 63 }                                              << 
 64                                                    76 
 65 G4bool G4TransitionRadiation::IsApplicable(    <<  77 G4bool 
 66   const G4ParticleDefinition& aParticleType)   <<  78 G4TransitionRadiation::IsApplicable(const G4ParticleDefinition& aParticleType)
 67 {                                                  79 {
 68   return (aParticleType.GetPDGCharge() != 0.0) <<  80   return ( aParticleType.GetPDGCharge() != 0.0 );
 69 }                                                  81 }
 70                                                    82 
 71 G4double G4TransitionRadiation::GetMeanFreePat <<  83 G4double G4TransitionRadiation::GetMeanFreePath(const G4Track&,
 72                                                <<  84             G4double,
                                                   >>  85             G4ForceCondition* condition)
 73 {                                                  86 {
 74   *condition = Forced;                             87   *condition = Forced;
 75   return DBL_MAX;  // so TR doesn't limit mean <<  88   return DBL_MAX;      // so TR doesn't limit mean free path
 76 }                                                  89 }
 77                                                    90 
 78 G4VParticleChange* G4TransitionRadiation::Post     91 G4VParticleChange* G4TransitionRadiation::PostStepDoIt(const G4Track&,
 79                                                <<  92                    const G4Step&)
 80 {                                                  93 {
 81   ClearNumberOfInteractionLengthLeft();            94   ClearNumberOfInteractionLengthLeft();
 82   return &aParticleChange;                         95   return &aParticleChange;
 83 }                                                  96 }
 84                                                    97 
 85 //////////////////////////////////////////////     98 ///////////////////////////////////////////////////////////////////
                                                   >>  99 //
 86 // Sympson integral of TR spectral-angle densi    100 // Sympson integral of TR spectral-angle density over energy between
 87 // the limits energy 1 and energy2 at fixed va    101 // the limits energy 1 and energy2 at fixed varAngle = 1 - std::cos(Theta)
 88 G4double G4TransitionRadiation::IntegralOverEn << 102 
 89                                                << 103 G4double
 90                                                << 104 G4TransitionRadiation::IntegralOverEnergy( G4double energy1,
 91 {                                              << 105                                            G4double energy2,
 92   G4int i;                                     << 106                                            G4double varAngle     )  const
 93   G4double h, sumEven = 0.0, sumOdd = 0.0;     << 107 {
 94   h = 0.5 * (energy2 - energy1) / fSympsonNumb << 108   G4int i ;
 95   for(i = 1; i < fSympsonNumber; i++)          << 109   G4double h , sumEven = 0.0 , sumOdd = 0.0 ;
                                                   >> 110   h = 0.5*(energy2 - energy1)/fSympsonNumber ;
                                                   >> 111   for(i=1;i<fSympsonNumber;i++)
 96   {                                               112   {
 97     sumEven += SpectralAngleTRdensity(energy1  << 113     sumEven += SpectralAngleTRdensity(energy1 + 2*i*h,varAngle)  ;
 98     sumOdd += SpectralAngleTRdensity(energy1 + << 114     sumOdd  += SpectralAngleTRdensity(energy1 + (2*i - 1)*h,varAngle) ;
 99   }                                               115   }
100   sumOdd +=                                    << 116   sumOdd += SpectralAngleTRdensity(energy1 + (2*fSympsonNumber - 1)*h,varAngle) ;
101     SpectralAngleTRdensity(energy1 + (2 * fSym << 117   return h*(  SpectralAngleTRdensity(energy1,varAngle)
102   return h *                                   << 118             + SpectralAngleTRdensity(energy2,varAngle)
103          (SpectralAngleTRdensity(energy1, varA << 119             + 4.0*sumOdd + 2.0*sumEven    )/3.0 ;
104           SpectralAngleTRdensity(energy2, varA << 
105           2.0 * sumEven) /                     << 
106          3.0;                                  << 
107 }                                                 120 }
108                                                   121 
                                                   >> 122 
                                                   >> 123 
109 //////////////////////////////////////////////    124 ///////////////////////////////////////////////////////////////////
                                                   >> 125 //
110 // Sympson integral of TR spectral-angle densi    126 // Sympson integral of TR spectral-angle density over energy between
111 // the limits varAngle1 and varAngle2 at fixed    127 // the limits varAngle1 and varAngle2 at fixed energy
112 G4double G4TransitionRadiation::IntegralOverAn << 128 
113                                                << 129 G4double
114                                                << 130 G4TransitionRadiation::IntegralOverAngle( G4double energy,
115 {                                              << 131                                           G4double varAngle1,
116   G4int i;                                     << 132                                           G4double varAngle2     ) const
117   G4double h, sumEven = 0.0, sumOdd = 0.0;     << 133 {
118   h = 0.5 * (varAngle2 - varAngle1) / fSympson << 134   G4int i ;
119   for(i = 1; i < fSympsonNumber; ++i)          << 135   G4double h , sumEven = 0.0 , sumOdd = 0.0 ;
                                                   >> 136   h = 0.5*(varAngle2 - varAngle1)/fSympsonNumber ;
                                                   >> 137   for(i=1;i<fSympsonNumber;i++)
120   {                                               138   {
121     sumEven += SpectralAngleTRdensity(energy,  << 139     sumEven += SpectralAngleTRdensity(energy,varAngle1 + 2*i*h)  ;
122     sumOdd += SpectralAngleTRdensity(energy, v << 140     sumOdd  += SpectralAngleTRdensity(energy,varAngle1 + (2*i - 1)*h) ;
123   }                                               141   }
124   sumOdd +=                                    << 142   sumOdd += SpectralAngleTRdensity(energy,varAngle1 + (2*fSympsonNumber - 1)*h) ;
125     SpectralAngleTRdensity(energy, varAngle1 + << 
126                                                   143 
127   return h *                                   << 144   return h*(  SpectralAngleTRdensity(energy,varAngle1)
128          (SpectralAngleTRdensity(energy, varAn << 145             + SpectralAngleTRdensity(energy,varAngle2)
129           SpectralAngleTRdensity(energy, varAn << 146             + 4.0*sumOdd + 2.0*sumEven    )/3.0 ;
130           2.0 * sumEven) /                     << 
131          3.0;                                  << 
132 }                                                 147 }
133                                                   148 
134 //////////////////////////////////////////////    149 ///////////////////////////////////////////////////////////////////
                                                   >> 150 //
135 // The number of transition radiation photons     151 // The number of transition radiation photons generated in the
136 // angle interval between varAngle1 and varAng    152 // angle interval between varAngle1 and varAngle2
137 G4double G4TransitionRadiation::AngleIntegralD << 153 //
138   G4double varAngle1, G4double varAngle2) cons << 154 
139 {                                              << 155 G4double G4TransitionRadiation::
140   G4int i;                                     << 156 AngleIntegralDistribution( G4double varAngle1,
141   G4double h, sumEven = 0.0, sumOdd = 0.0;     << 157                            G4double varAngle2     )   const
142   h = 0.5 * (varAngle2 - varAngle1) / fSympson << 158 {
143   for(i = 1; i < fSympsonNumber; ++i)          << 159   G4int i ;
                                                   >> 160   G4double h , sumEven = 0.0 , sumOdd = 0.0 ;
                                                   >> 161   h = 0.5*(varAngle2 - varAngle1)/fSympsonNumber ;
                                                   >> 162   for(i=1;i<fSympsonNumber;i++)
144   {                                               163   {
145     sumEven += IntegralOverEnergy(fMinEnergy,  << 164    sumEven += IntegralOverEnergy(fMinEnergy,
146                                   fMinEnergy + << 165                                  fMinEnergy +0.3*(fMaxEnergy-fMinEnergy),
147                                   varAngle1 +  << 166                                  varAngle1 + 2*i*h)
148                IntegralOverEnergy(fMinEnergy + << 167             + IntegralOverEnergy(fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
149                                   fMaxEnergy,  << 168                                  fMaxEnergy,
150     sumOdd += IntegralOverEnergy(fMinEnergy,   << 169                                  varAngle1 + 2*i*h);
151                                  fMinEnergy +  << 170    sumOdd  += IntegralOverEnergy(fMinEnergy,
152                                  varAngle1 + ( << 171                                  fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
153               IntegralOverEnergy(fMinEnergy +  << 172                                  varAngle1 + (2*i - 1)*h)
154                                  fMaxEnergy, v << 173             + IntegralOverEnergy(fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
                                                   >> 174                                  fMaxEnergy,
                                                   >> 175                                  varAngle1 + (2*i - 1)*h) ;
155   }                                               176   }
156   sumOdd +=                                    << 177   sumOdd += IntegralOverEnergy(fMinEnergy,
157     IntegralOverEnergy(fMinEnergy, fMinEnergy  << 178                                fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
158                        varAngle1 + (2 * fSymps << 179                                varAngle1 + (2*fSympsonNumber - 1)*h)
159     IntegralOverEnergy(fMinEnergy + 0.3 * (fMa << 180           + IntegralOverEnergy(fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
160                        varAngle1 + (2 * fSymps << 181                                fMaxEnergy,
161                                                << 182                                varAngle1 + (2*fSympsonNumber - 1)*h) ;
162   return h *                                   << 183 
163          (IntegralOverEnergy(fMinEnergy,       << 184   return h*(IntegralOverEnergy(fMinEnergy,
164                              fMinEnergy + 0.3  << 185                                fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
165                              varAngle1) +      << 186                                varAngle1)
166           IntegralOverEnergy(fMinEnergy + 0.3  << 187           + IntegralOverEnergy(fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
167                              fMaxEnergy, varAn << 188                                fMaxEnergy,
168           IntegralOverEnergy(fMinEnergy,       << 189                                varAngle1)
169                              fMinEnergy + 0.3  << 190           + IntegralOverEnergy(fMinEnergy,
170                              varAngle2) +      << 191                                fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
171           IntegralOverEnergy(fMinEnergy + 0.3  << 192                                varAngle2)
172                              fMaxEnergy, varAn << 193           + IntegralOverEnergy(fMinEnergy + 0.3*(fMaxEnergy - fMinEnergy),
173           4.0 * sumOdd + 2.0 * sumEven) /      << 194                                fMaxEnergy,
174          3.0;                                  << 195                                varAngle2)
                                                   >> 196             + 4.0*sumOdd + 2.0*sumEven    )/3.0 ;
175 }                                                 197 }
176                                                   198 
177 //////////////////////////////////////////////    199 ///////////////////////////////////////////////////////////////////
                                                   >> 200 //
178 // The number of transition radiation photons,    201 // The number of transition radiation photons, generated in the
179 // energy interval between energy1 and energy2    202 // energy interval between energy1 and energy2
180 G4double G4TransitionRadiation::EnergyIntegral << 203 //
181   G4double energy1, G4double energy2) const    << 204 
182 {                                              << 205 G4double G4TransitionRadiation::
183   G4int i;                                     << 206 EnergyIntegralDistribution( G4double energy1,
184   G4double h, sumEven = 0.0, sumOdd = 0.0;     << 207                             G4double energy2     )  const
185   h = 0.5 * (energy2 - energy1) / fSympsonNumb << 208 {
186   for(i = 1; i < fSympsonNumber; ++i)          << 209   G4int i ;
                                                   >> 210   G4double h , sumEven = 0.0 , sumOdd = 0.0 ;
                                                   >> 211   h = 0.5*(energy2 - energy1)/fSympsonNumber ;
                                                   >> 212   for(i=1;i<fSympsonNumber;i++)
187   {                                               213   {
188     sumEven +=                                 << 214    sumEven += IntegralOverAngle(energy1 + 2*i*h,0.0,0.01*fMaxTheta )
189       IntegralOverAngle(energy1 + 2 * i * h, 0 << 215             + IntegralOverAngle(energy1 + 2*i*h,0.01*fMaxTheta,fMaxTheta);
190       IntegralOverAngle(energy1 + 2 * i * h, 0 << 216    sumOdd  += IntegralOverAngle(energy1 + (2*i - 1)*h,0.0,0.01*fMaxTheta)
191     sumOdd +=                                  << 217             + IntegralOverAngle(energy1 + (2*i - 1)*h,0.01*fMaxTheta,fMaxTheta) ;
192       IntegralOverAngle(energy1 + (2 * i - 1)  << 
193       IntegralOverAngle(energy1 + (2 * i - 1)  << 
194   }                                               218   }
195   sumOdd += IntegralOverAngle(energy1 + (2 * f << 219   sumOdd += IntegralOverAngle(energy1 + (2*fSympsonNumber - 1)*h,
196                               0.01 * fMaxTheta << 220                               0.0,0.01*fMaxTheta)
197             IntegralOverAngle(energy1 + (2 * f << 221           + IntegralOverAngle(energy1 + (2*fSympsonNumber - 1)*h,
198                               0.01 * fMaxTheta << 222                               0.01*fMaxTheta,fMaxTheta) ;
199                                                << 223 
200   return h *                                   << 224   return h*(IntegralOverAngle(energy1,0.0,0.01*fMaxTheta)
201          (IntegralOverAngle(energy1, 0.0, 0.01 << 225           + IntegralOverAngle(energy1,0.01*fMaxTheta,fMaxTheta)
202           IntegralOverAngle(energy1, 0.01 * fM << 226           + IntegralOverAngle(energy2,0.0,0.01*fMaxTheta)
203           IntegralOverAngle(energy2, 0.0, 0.01 << 227           + IntegralOverAngle(energy2,0.01*fMaxTheta,fMaxTheta)
204           IntegralOverAngle(energy2, 0.01 * fM << 228             + 4.0*sumOdd + 2.0*sumEven    )/3.0 ;
205           4.0 * sumOdd + 2.0 * sumEven) /      << 
206          3.0;                                  << 
207 }                                                 229 }
                                                   >> 230 
                                                   >> 231 
                                                   >> 232 
                                                   >> 233 
                                                   >> 234 // end of G4TransitionRadiation implementation file --------------------------
208                                                   235