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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/G4RegularXTRadiator.cc (Version 11.3.0) and /processes/electromagnetic/xrays/src/G4RegularXTRadiator.cc (Version 10.0.p1)


  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 //
                                                   >>  27 // $Id: G4RegularXTRadiator.cc 68037 2013-03-13 14:15:08Z gcosmo $
                                                   >>  28 //
                                                   >>  29 
                                                   >>  30 #include <complex>
 26                                                    31 
 27 #include "G4RegularXTRadiator.hh"                  32 #include "G4RegularXTRadiator.hh"
                                                   >>  33 #include "G4PhysicalConstants.hh"
                                                   >>  34 #include "Randomize.hh"
 28                                                    35 
 29 #include "G4Gamma.hh"                              36 #include "G4Gamma.hh"
 30 #include "G4PhysicalConstants.hh"              << 
 31                                                    37 
 32 //////////////////////////////////////////////     38 ////////////////////////////////////////////////////////////////////////////
                                                   >>  39 //
 33 // Constructor, destructor                         40 // Constructor, destructor
 34 G4RegularXTRadiator::G4RegularXTRadiator(G4Log <<  41 
 35                                          G4Mat <<  42 G4RegularXTRadiator::G4RegularXTRadiator(G4LogicalVolume *anEnvelope,
 36                                          G4Mat <<  43            G4Material* foilMat,G4Material* gasMat, 
 37                                          G4dou <<  44                                          G4double a, G4double b, G4int n,
 38                                          const <<  45                                          const G4String& processName) :
 39   : G4VXTRenergyLoss(anEnvelope, foilMat, gasM <<  46   G4VXTRenergyLoss(anEnvelope,foilMat,gasMat,a,b,n,processName)
 40 {                                                  47 {
 41   G4cout << "Regular X-ray TR radiator EM proc <<  48   G4cout<<"Regular X-ray TR  radiator EM process is called"<<G4endl ;
 42                                                    49 
 43   // Build energy and angular integral spectra     50   // Build energy and angular integral spectra of X-ray TR photons from
 44   // a radiator                                    51   // a radiator
 45                                                    52 
 46   fAlphaPlate = 10000;                             53   fAlphaPlate = 10000;
 47   fAlphaGas   = 1000;                              54   fAlphaGas   = 1000;
 48   G4cout << "fAlphaPlate = " << fAlphaPlate << <<  55   G4cout<<"fAlphaPlate = "<<fAlphaPlate<<" ; fAlphaGas = "<<fAlphaGas<<G4endl ;
 49          << G4endl;                            <<  56 
                                                   >>  57   // BuildTable() ;
 50 }                                                  58 }
 51                                                    59 
 52 //////////////////////////////////////////////     60 ///////////////////////////////////////////////////////////////////////////
 53 G4RegularXTRadiator::~G4RegularXTRadiator() =  << 
 54                                                    61 
 55 void G4RegularXTRadiator::ProcessDescription(s <<  62 G4RegularXTRadiator::~G4RegularXTRadiator()
 56 {                                                  63 {
 57   out << "Simulation of X-ray transition radia <<  64   ;
 58          "relativistic charged particles cross << 
 59          "two materials. Thicknesses of plates << 
 60 }                                                  65 }
 61                                                    66 
 62 //////////////////////////////////////////////     67 ///////////////////////////////////////////////////////////////////////////
                                                   >>  68 //
                                                   >>  69 //
                                                   >>  70 
 63 G4double G4RegularXTRadiator::SpectralXTRdEdx(     71 G4double G4RegularXTRadiator::SpectralXTRdEdx(G4double energy)
 64 {                                                  72 {
 65   G4double result, sum = 0., tmp, cof1, cof2,  <<  73   G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC, theta2, theta2k; 
 66   G4double aMa, bMb, sigma, dump;              <<  74     G4double aMa, bMb ,sigma, dump;
 67   G4int k, kMax, kMin;                             75   G4int k, kMax, kMin;
 68                                                    76 
 69   aMa   = fPlateThick * GetPlateLinearPhotoAbs <<  77   aMa = fPlateThick*GetPlateLinearPhotoAbs(energy);
 70   bMb   = fGasThick * GetGasLinearPhotoAbs(ene <<  78   bMb = fGasThick*GetGasLinearPhotoAbs(energy);
 71   sigma = 0.5 * (aMa + bMb);                   <<  79   sigma = 0.5*(aMa + bMb);
 72   dump  = std::exp(-fPlateNumber * sigma);     <<  80   dump = std::exp(-fPlateNumber*sigma);
 73   if(verboseLevel > 2)                         <<  81   if(verboseLevel > 2)  G4cout<<" dump = "<<dump<<G4endl;  
 74     G4cout << " dump = " << dump << G4endl;    <<  82   cofPHC  = 4*pi*hbarc;
 75   cofPHC = 4 * pi * hbarc;                     <<  83   tmp     = (fSigma1 - fSigma2)/cofPHC/energy;  
 76   tmp    = (fSigma1 - fSigma2) / cofPHC / ener <<  84   cof1    = fPlateThick*tmp;
 77   cof1   = fPlateThick * tmp;                  <<  85   cof2    = fGasThick*tmp;
 78   cof2   = fGasThick * tmp;                    << 
 79                                                    86 
 80   cofMin = energy * (fPlateThick + fGasThick)  <<  87   cofMin  =  energy*(fPlateThick + fGasThick)/fGamma/fGamma;
 81   cofMin += (fPlateThick * fSigma1 + fGasThick <<  88   cofMin += (fPlateThick*fSigma1 + fGasThick*fSigma2)/energy;
 82   cofMin /= cofPHC;                                89   cofMin /= cofPHC;
 83                                                    90 
 84   theta2 = cofPHC / (energy * (fPlateThick + f <<  91   theta2 = cofPHC/(energy*(fPlateThick + fGasThick));
                                                   >>  92 
                                                   >>  93   //  if (fGamma < 1200) kMin = G4int(cofMin);  // 1200 ?
                                                   >>  94   // else               kMin = 1;
                                                   >>  95 
 85                                                    96 
 86   kMin = G4int(cofMin);                            97   kMin = G4int(cofMin);
 87   if(cofMin > kMin)                            <<  98   if (cofMin > kMin) kMin++;
 88     kMin++;                                    <<  99 
                                                   >> 100   // tmp  = (fPlateThick + fGasThick)*energy*fMaxThetaTR;
                                                   >> 101   // tmp /= cofPHC;
                                                   >> 102   // kMax = G4int(tmp);
                                                   >> 103   // if(kMax < 0) kMax = 0;
                                                   >> 104   // kMax += kMin;
                                                   >> 105   
 89                                                   106 
 90   kMax = kMin + 49;                            << 107   kMax = kMin + 49; //  19; // kMin + G4int(tmp);
                                                   >> 108 
                                                   >> 109   // tmp /= fGamma;
                                                   >> 110   // if( G4int(tmp) < kMin ) kMin = G4int(tmp);
 91                                                   111 
 92   if(verboseLevel > 2)                            112   if(verboseLevel > 2)
 93   {                                            << 113   {    
 94     G4cout << cof1 << "     " << cof2 << "     << 114     G4cout<<cof1<<"     "<<cof2<<"        "<<cofMin<<G4endl;
 95     G4cout << "kMin = " << kMin << ";    kMax  << 115     G4cout<<"kMin = "<<kMin<<";    kMax = "<<kMax<<G4endl;
 96   }                                               116   }
 97   for(k = kMin; k <= kMax; ++k)                << 117   for( k = kMin; k <= kMax; k++ )
 98   {                                               118   {
 99     tmp    = pi * fPlateThick * (k + cof2) / ( << 119     tmp    = pi*fPlateThick*(k + cof2)/(fPlateThick + fGasThick);
100     result = (k - cof1) * (k - cof1) * (k + co << 120     result = (k - cof1)*(k - cof1)*(k + cof2)*(k + cof2);
101     if(k == kMin && kMin == G4int(cofMin))     << 121     // tmp = std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
                                                   >> 122     if( k == kMin && kMin == G4int(cofMin) )
102     {                                             123     {
103       sum +=                                   << 124       sum   += 0.5*std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
104         0.5 * std::sin(tmp) * std::sin(tmp) *  << 
105     }                                             125     }
106     else                                          126     else
107     {                                             127     {
108       sum += std::sin(tmp) * std::sin(tmp) * s << 128       sum   += std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
109     }                                             129     }
110     theta2k = std::sqrt(theta2 * std::abs(k -  << 130     theta2k = std::sqrt(theta2*std::abs(k-cofMin));
111                                                   131 
112     if(verboseLevel > 2)                          132     if(verboseLevel > 2)
113     {                                          << 133     {    
114       G4cout << k << "   " << theta2k << "     << 134       // G4cout<<"k = "<<k<<"; sqrt(theta2k) = "<<theta2k<<"; tmp = "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
115              << std::sin(tmp) * std::sin(tmp)  << 135       //     <<";    sum = "<<sum<<G4endl;  
116              << "      " << sum << G4endl;     << 136       G4cout<<k<<"   "<<theta2k<<"     "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
117     }                                          << 137               <<"      "<<sum<<G4endl;  
                                                   >> 138     }  
118   }                                               139   }
119   result = 2 * (cof1 + cof2) * (cof1 + cof2) * << 140   result = 2*( cof1 + cof2 )*( cof1 + cof2 )*sum/energy;
120   result *= (1 - dump + 2 * dump * fPlateNumbe << 141   // result *= ( 1 - std::exp(-0.5*fPlateNumber*sigma) )/( 1 - std::exp(-0.5*sigma) );  
121                                                << 142   // fPlateNumber;
                                                   >> 143   result *= ( 1 - dump + 2*dump*fPlateNumber ); 
                                                   >> 144   /*  
                                                   >> 145   fEnergy = energy;
                                                   >> 146   //  G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
                                                   >> 147   G4Integrator<G4TransparentRegXTRadiator,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
                                                   >> 148  
                                                   >> 149   tmp = integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
                                                   >> 150                              0.0,0.3*fMaxThetaTR) +
                                                   >> 151       integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
                                                   >> 152                              0.3*fMaxThetaTR,0.6*fMaxThetaTR) +         
                                                   >> 153       integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
                                                   >> 154                              0.6*fMaxThetaTR,fMaxThetaTR) ;
                                                   >> 155   result += tmp;
                                                   >> 156   */
122   return result;                                  157   return result;
123 }                                                 158 }
124                                                   159 
                                                   >> 160 
                                                   >> 161 
125 //////////////////////////////////////////////    162 ///////////////////////////////////////////////////////////////////////////
                                                   >> 163 //
126 // Approximation for radiator interference fac    164 // Approximation for radiator interference factor for the case of
127 // fully Regular radiator. The plate and gas g << 165 // fully Regular radiator. The plate and gas gap thicknesses are fixed .
128 // The mean values of the plate and gas gap th << 166 // The mean values of the plate and gas gap thicknesses 
129 // are supposed to be about XTR formation zone << 167 // are supposed to be about XTR formation zones but much less than 
130 // mean absorption length of XTR photons in co << 168 // mean absorption length of XTR photons in coresponding material.
131                                                << 169 
132 G4double G4RegularXTRadiator::GetStackFactor(G << 170 G4double 
133                                              G << 171 G4RegularXTRadiator::GetStackFactor( G4double energy, 
                                                   >> 172                                          G4double gamma, G4double varAngle )
134 {                                                 173 {
                                                   >> 174 
135   // some gamma (10000/1000) like algorithm       175   // some gamma (10000/1000) like algorithm
136                                                   176 
137   G4double result, Za, Zb, Ma, Mb;                177   G4double result, Za, Zb, Ma, Mb;
138                                                << 178   
139   Za = GetPlateFormationZone(energy, gamma, va << 179   Za = GetPlateFormationZone(energy,gamma,varAngle);
140   Zb = GetGasFormationZone(energy, gamma, varA << 180   Zb = GetGasFormationZone(energy,gamma,varAngle);
141                                                   181 
142   Ma = GetPlateLinearPhotoAbs(energy);            182   Ma = GetPlateLinearPhotoAbs(energy);
143   Mb = GetGasLinearPhotoAbs(energy);              183   Mb = GetGasLinearPhotoAbs(energy);
144                                                   184 
145   G4complex Ca(1.0 + 0.5 * fPlateThick * Ma /  << 
146                fPlateThick / Za / fAlphaPlate) << 
147   G4complex Cb(1.0 + 0.5 * fGasThick * Mb / fA << 
148                fGasThick / Zb / fAlphaGas);    << 
149                                                   185 
150   G4complex Ha = std::pow(Ca, -fAlphaPlate);   << 186   G4complex Ca(1.0+0.5*fPlateThick*Ma/fAlphaPlate,fPlateThick/Za/fAlphaPlate); 
151   G4complex Hb = std::pow(Cb, -fAlphaGas);     << 187   G4complex Cb(1.0+0.5*fGasThick*Mb/fAlphaGas,fGasThick/Zb/fAlphaGas); 
152   G4complex H  = Ha * Hb;                      << 188 
                                                   >> 189   G4complex Ha = std::pow(Ca,-fAlphaPlate);  
                                                   >> 190   G4complex Hb = std::pow(Cb,-fAlphaGas);
                                                   >> 191   G4complex H  = Ha*Hb;
                                                   >> 192   
                                                   >> 193   G4complex F1 =   (1.0 - Ha)*(1.0 - Hb )/(1.0 - H)
                                                   >> 194                  * G4double(fPlateNumber);
                                                   >> 195 
                                                   >> 196   G4complex F2 =   (1.0-Ha)*(1.0-Ha)*Hb/(1.0-H)/(1.0-H)
                                                   >> 197                  * (1.0 - std::pow(H,fPlateNumber));
                                                   >> 198 
                                                   >> 199   G4complex R  = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle);
                                                   >> 200   
                                                   >> 201   result       = 2.0*std::real(R);
                                                   >> 202   
                                                   >> 203   return      result;
                                                   >> 204   
                                                   >> 205   /*
                                                   >> 206    // numerically stable but slow algorithm
                                                   >> 207 
                                                   >> 208   G4double result, Qa, Qb, Q, aZa, bZb, aMa, bMb;   // , D; 
                                                   >> 209  
                                                   >> 210   aZa = fPlateThick/GetPlateFormationZone(energy,gamma,varAngle);
                                                   >> 211   bZb = fGasThick/GetGasFormationZone(energy,gamma,varAngle);
                                                   >> 212   aMa = fPlateThick*GetPlateLinearPhotoAbs(energy);
                                                   >> 213   bMb = fGasThick*GetGasLinearPhotoAbs(energy);
                                                   >> 214   Qa = std::exp(-aMa);
                                                   >> 215   Qb = std::exp(-bMb);
                                                   >> 216   Q  = Qa*Qb;
                                                   >> 217   G4complex Ha( std::exp(-0.5*aMa)*std::cos(aZa),
                                                   >> 218                -std::exp(-0.5*aMa)*std::sin(aZa)   );  
                                                   >> 219   G4complex Hb( std::exp(-0.5*bMb)*std::cos(bZb),
                                                   >> 220                -std::exp(-0.5*bMb)*std::sin(bZb)    );
                                                   >> 221   G4complex H  = Ha*Hb;
                                                   >> 222   
                                                   >> 223   G4complex Hs = conj(H);
                                                   >> 224   D            = 1.0 /( (1 - std::sqrt(Q))*(1 - std::sqrt(Q)) + 
                                                   >> 225                   4*std::sqrt(Q)*std::sin(0.5*(aZa+bZb))*std::sin(0.5*(aZa+bZb)) );
                                                   >> 226   G4complex F1 = (1.0 - Ha)*(1.0 - Hb)*(1.0 - Hs)
                                                   >> 227                  * G4double(fPlateNumber)*D;
                                                   >> 228   G4complex F2 = (1.0-Ha)*(1.0-Ha)*Hb*(1.0-Hs)*(1.0-Hs)
                                                   >> 229                  * (1.0 - std::pow(H,fPlateNumber)) * D*D;
                                                   >> 230   G4complex R  = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle);
                                                   >> 231   
                                                   >> 232 
                                                   >> 233   G4complex S(0.,0.), c(1.,0.);
                                                   >> 234   G4int k;
                                                   >> 235   for(k = 1; k < fPlateNumber; k++)
                                                   >> 236   {
                                                   >> 237     c *= H;
                                                   >> 238     S += ( G4double(fPlateNumber) - G4double(k) )*c; 
                                                   >> 239   }
                                                   >> 240   G4complex R  = (2.- Ha - 1./Ha)*S + (1. - Ha)*G4double(fPlateNumber);
                                                   >> 241             R *= OneInterfaceXTRdEdx(energy,gamma,varAngle);
                                                   >> 242   result       = 2.0*std::real(R); 
                                                   >> 243   return      result;
                                                   >> 244   */
                                                   >> 245 }
                                                   >> 246 
                                                   >> 247 
                                                   >> 248 //
                                                   >> 249 //
                                                   >> 250 ////////////////////////////////////////////////////////////////////////////
                                                   >> 251 
                                                   >> 252 
                                                   >> 253 
153                                                   254 
154   G4complex F1 = (1.0 - Ha) * (1.0 - Hb) / (1. << 
155                                                   255 
156   G4complex F2 = (1.0 - Ha) * (1.0 - Ha) * Hb  << 
157                  (1.0 - std::pow(H, fPlateNumb << 
158                                                   256 
159   G4complex R = (F1 + F2) * OneInterfaceXTRdEd << 
160                                                   257 
161   result = 2.0 * std::real(R);                 << 
162                                                   258 
163   return result;                               << 
164 }                                              << 
165                                                   259