G4RegularXTRadiator.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 
00030 #include <complex>
00031 
00032 #include "G4RegularXTRadiator.hh"
00033 #include "G4PhysicalConstants.hh"
00034 #include "Randomize.hh"
00035 
00036 #include "G4Gamma.hh"
00037 
00039 //
00040 // Constructor, destructor
00041 
00042 G4RegularXTRadiator::G4RegularXTRadiator(G4LogicalVolume *anEnvelope,
00043                                          G4Material* foilMat,G4Material* gasMat, 
00044                                          G4double a, G4double b, G4int n,
00045                                          const G4String& processName) :
00046   G4VXTRenergyLoss(anEnvelope,foilMat,gasMat,a,b,n,processName)
00047 {
00048   G4cout<<"Regular X-ray TR  radiator EM process is called"<<G4endl ;
00049 
00050   // Build energy and angular integral spectra of X-ray TR photons from
00051   // a radiator
00052 
00053   fAlphaPlate = 10000;
00054   fAlphaGas   = 1000;
00055   G4cout<<"fAlphaPlate = "<<fAlphaPlate<<" ; fAlphaGas = "<<fAlphaGas<<G4endl ;
00056 
00057   // BuildTable() ;
00058 }
00059 
00061 
00062 G4RegularXTRadiator::~G4RegularXTRadiator()
00063 {
00064   ;
00065 }
00066 
00068 //
00069 //
00070 
00071 G4double G4RegularXTRadiator::SpectralXTRdEdx(G4double energy)
00072 {
00073   G4double result, sum = 0., tmp, cof1, cof2, cofMin, cofPHC, theta2, theta2k; 
00074     G4double aMa, bMb ,sigma, dump;
00075   G4int k, kMax, kMin;
00076 
00077   aMa = fPlateThick*GetPlateLinearPhotoAbs(energy);
00078   bMb = fGasThick*GetGasLinearPhotoAbs(energy);
00079   sigma = 0.5*(aMa + bMb);
00080   dump = std::exp(-fPlateNumber*sigma);
00081   if(verboseLevel > 2)  G4cout<<" dump = "<<dump<<G4endl;  
00082   cofPHC  = 4*pi*hbarc;
00083   tmp     = (fSigma1 - fSigma2)/cofPHC/energy;  
00084   cof1    = fPlateThick*tmp;
00085   cof2    = fGasThick*tmp;
00086 
00087   cofMin  =  energy*(fPlateThick + fGasThick)/fGamma/fGamma;
00088   cofMin += (fPlateThick*fSigma1 + fGasThick*fSigma2)/energy;
00089   cofMin /= cofPHC;
00090 
00091   theta2 = cofPHC/(energy*(fPlateThick + fGasThick));
00092 
00093   //  if (fGamma < 1200) kMin = G4int(cofMin);  // 1200 ?
00094   // else               kMin = 1;
00095 
00096 
00097   kMin = G4int(cofMin);
00098   if (cofMin > kMin) kMin++;
00099 
00100   // tmp  = (fPlateThick + fGasThick)*energy*fMaxThetaTR;
00101   // tmp /= cofPHC;
00102   // kMax = G4int(tmp);
00103   // if(kMax < 0) kMax = 0;
00104   // kMax += kMin;
00105   
00106 
00107   kMax = kMin + 49; //  19; // kMin + G4int(tmp);
00108 
00109   // tmp /= fGamma;
00110   // if( G4int(tmp) < kMin ) kMin = G4int(tmp);
00111 
00112   if(verboseLevel > 2)
00113   {    
00114     G4cout<<cof1<<"     "<<cof2<<"        "<<cofMin<<G4endl;
00115     G4cout<<"kMin = "<<kMin<<";    kMax = "<<kMax<<G4endl;
00116   }
00117   for( k = kMin; k <= kMax; k++ )
00118   {
00119     tmp    = pi*fPlateThick*(k + cof2)/(fPlateThick + fGasThick);
00120     result = (k - cof1)*(k - cof1)*(k + cof2)*(k + cof2);
00121     // tmp = std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
00122     if( k == kMin && kMin == G4int(cofMin) )
00123     {
00124       sum   += 0.5*std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
00125     }
00126     else
00127     {
00128       sum   += std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result;
00129     }
00130     theta2k = std::sqrt(theta2*std::abs(k-cofMin));
00131 
00132     if(verboseLevel > 2)
00133     {    
00134       // G4cout<<"k = "<<k<<"; sqrt(theta2k) = "<<theta2k<<"; tmp = "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
00135       //     <<";    sum = "<<sum<<G4endl;  
00136       G4cout<<k<<"   "<<theta2k<<"     "<<std::sin(tmp)*std::sin(tmp)*std::abs(k-cofMin)/result
00137               <<"      "<<sum<<G4endl;  
00138     }  
00139   }
00140   result = 2*( cof1 + cof2 )*( cof1 + cof2 )*sum/energy;
00141   // result *= ( 1 - std::exp(-0.5*fPlateNumber*sigma) )/( 1 - std::exp(-0.5*sigma) );  
00142   // fPlateNumber;
00143   result *= ( 1 - dump + 2*dump*fPlateNumber ); 
00144   /*  
00145   fEnergy = energy;
00146   //  G4Integrator<G4VXTRenergyLoss,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
00147   G4Integrator<G4TransparentRegXTRadiator,G4double(G4VXTRenergyLoss::*)(G4double)> integral;
00148  
00149   tmp = integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
00150                              0.0,0.3*fMaxThetaTR) +
00151       integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
00152                              0.3*fMaxThetaTR,0.6*fMaxThetaTR) +         
00153       integral.Legendre96(this,&G4VXTRenergyLoss::SpectralAngleXTRdEdx,
00154                              0.6*fMaxThetaTR,fMaxThetaTR) ;
00155   result += tmp;
00156   */
00157   return result;
00158 }
00159 
00160 
00161 
00163 //
00164 // Approximation for radiator interference factor for the case of
00165 // fully Regular radiator. The plate and gas gap thicknesses are fixed .
00166 // The mean values of the plate and gas gap thicknesses 
00167 // are supposed to be about XTR formation zones but much less than 
00168 // mean absorption length of XTR photons in coresponding material.
00169 
00170 G4double 
00171 G4RegularXTRadiator::GetStackFactor( G4double energy, 
00172                                          G4double gamma, G4double varAngle )
00173 {
00174 
00175   // some gamma (10000/1000) like algorithm
00176 
00177   G4double result, Za, Zb, Ma, Mb;
00178   
00179   Za = GetPlateFormationZone(energy,gamma,varAngle);
00180   Zb = GetGasFormationZone(energy,gamma,varAngle);
00181 
00182   Ma = GetPlateLinearPhotoAbs(energy);
00183   Mb = GetGasLinearPhotoAbs(energy);
00184 
00185 
00186   G4complex Ca(1.0+0.5*fPlateThick*Ma/fAlphaPlate,fPlateThick/Za/fAlphaPlate); 
00187   G4complex Cb(1.0+0.5*fGasThick*Mb/fAlphaGas,fGasThick/Zb/fAlphaGas); 
00188 
00189   G4complex Ha = std::pow(Ca,-fAlphaPlate);  
00190   G4complex Hb = std::pow(Cb,-fAlphaGas);
00191   G4complex H  = Ha*Hb;
00192   
00193   G4complex F1 =   (1.0 - Ha)*(1.0 - Hb )/(1.0 - H)
00194                  * G4double(fPlateNumber);
00195 
00196   G4complex F2 =   (1.0-Ha)*(1.0-Ha)*Hb/(1.0-H)/(1.0-H)
00197                  * (1.0 - std::pow(H,fPlateNumber));
00198 
00199   G4complex R  = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle);
00200   
00201   result       = 2.0*std::real(R);
00202   
00203   return      result;
00204   
00205   /*
00206    // numerically stable but slow algorithm
00207 
00208   G4double result, Qa, Qb, Q, aZa, bZb, aMa, bMb;   // , D; 
00209  
00210   aZa = fPlateThick/GetPlateFormationZone(energy,gamma,varAngle);
00211   bZb = fGasThick/GetGasFormationZone(energy,gamma,varAngle);
00212   aMa = fPlateThick*GetPlateLinearPhotoAbs(energy);
00213   bMb = fGasThick*GetGasLinearPhotoAbs(energy);
00214   Qa = std::exp(-aMa);
00215   Qb = std::exp(-bMb);
00216   Q  = Qa*Qb;
00217   G4complex Ha( std::exp(-0.5*aMa)*std::cos(aZa),
00218                -std::exp(-0.5*aMa)*std::sin(aZa)   );  
00219   G4complex Hb( std::exp(-0.5*bMb)*std::cos(bZb),
00220                -std::exp(-0.5*bMb)*std::sin(bZb)    );
00221   G4complex H  = Ha*Hb;
00222   
00223   G4complex Hs = conj(H);
00224   D            = 1.0 /( (1 - std::sqrt(Q))*(1 - std::sqrt(Q)) + 
00225                   4*std::sqrt(Q)*std::sin(0.5*(aZa+bZb))*std::sin(0.5*(aZa+bZb)) );
00226   G4complex F1 = (1.0 - Ha)*(1.0 - Hb)*(1.0 - Hs)
00227                  * G4double(fPlateNumber)*D;
00228   G4complex F2 = (1.0-Ha)*(1.0-Ha)*Hb*(1.0-Hs)*(1.0-Hs)
00229                  * (1.0 - std::pow(H,fPlateNumber)) * D*D;
00230   G4complex R  = (F1 + F2)*OneInterfaceXTRdEdx(energy,gamma,varAngle);
00231   
00232 
00233   G4complex S(0.,0.), c(1.,0.);
00234   G4int k;
00235   for(k = 1; k < fPlateNumber; k++)
00236   {
00237     c *= H;
00238     S += ( G4double(fPlateNumber) - G4double(k) )*c; 
00239   }
00240   G4complex R  = (2.- Ha - 1./Ha)*S + (1. - Ha)*G4double(fPlateNumber);
00241             R *= OneInterfaceXTRdEdx(energy,gamma,varAngle);
00242   result       = 2.0*std::real(R); 
00243   return      result;
00244   */
00245 }
00246 
00247 
00248 //
00249 //
00251 
00252 
00253 
00254 
00255 
00256 
00257 
00258 

Generated on Mon May 27 17:49:43 2013 for Geant4 by  doxygen 1.4.7