Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/standard/src/G4PAIySection.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 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/standard/src/G4PAIySection.cc (Version 11.3.0) and /processes/electromagnetic/standard/src/G4PAIySection.cc (Version 9.6.p4)


  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$
 26 //                                                 27 //
 27 //                                                 28 // 
 28 // G4PAIySection.cc -- class implementation fi     29 // G4PAIySection.cc -- class implementation file
 29 //                                                 30 //
 30 // GEANT 4 class implementation file               31 // GEANT 4 class implementation file
 31 //                                                 32 //
 32 // For information related to this code, pleas     33 // For information related to this code, please, contact
 33 // the Geant4 Collaboration.                       34 // the Geant4 Collaboration.
 34 //                                                 35 //
 35 // R&D: Vladimir.Grichine@cern.ch                  36 // R&D: Vladimir.Grichine@cern.ch
 36 //                                                 37 //
 37 // History:                                        38 // History:
 38 //                                                 39 //
 39 // 01.10.07, V.Ivanchenko create using V.Grich     40 // 01.10.07, V.Ivanchenko create using V.Grichine G4PAIxSection class
 40 // 26.07.09, V.Ivanchenko added protection for     41 // 26.07.09, V.Ivanchenko added protection for mumerical exceptions for 
 41 //              low-density materials              42 //              low-density materials
 42 // 21.11.10 V. Grichine bug fixed in Initialis     43 // 21.11.10 V. Grichine bug fixed in Initialise for reading sandia table from
 43 //            material. Warning: the table is      44 //            material. Warning: the table is tuned for photo-effect not PAI model.
 44 // 23.06.13 V.Grichine arrays->G4DataVectors   << 
 45 //                                                 45 //
 46                                                    46 
 47 #include "G4PAIySection.hh"                        47 #include "G4PAIySection.hh"
 48                                                    48 
 49 #include "globals.hh"                              49 #include "globals.hh"
 50 #include "G4PhysicalConstants.hh"                  50 #include "G4PhysicalConstants.hh"
 51 #include "G4SystemOfUnits.hh"                      51 #include "G4SystemOfUnits.hh"
 52 #include "G4ios.hh"                                52 #include "G4ios.hh"
 53 #include "G4Poisson.hh"                            53 #include "G4Poisson.hh"
 54 #include "G4Material.hh"                           54 #include "G4Material.hh"
 55 #include "G4MaterialCutsCouple.hh"                 55 #include "G4MaterialCutsCouple.hh"
 56 #include "G4SandiaTable.hh"                        56 #include "G4SandiaTable.hh"
 57 #include "G4Exp.hh"                            << 
 58 #include "G4Log.hh"                            << 
 59                                                    57 
 60 using namespace std;                               58 using namespace std;
 61                                                    59 
 62 // Local class constants                           60 // Local class constants
 63                                                    61 
 64 const G4double G4PAIySection::fDelta = 0.005;      62 const G4double G4PAIySection::fDelta = 0.005; // energy shift from interval border
 65 const G4double G4PAIySection::fError = 0.005;      63 const G4double G4PAIySection::fError = 0.005; // error in lin-log approximation
 66                                                    64 
 67 const G4int G4PAIySection::fMaxSplineSize = 50     65 const G4int G4PAIySection::fMaxSplineSize = 500;  // Max size of output spline
 68                                                <<  66                                                     // arrays
 69                                                    67 
 70 //////////////////////////////////////////////     68 //////////////////////////////////////////////////////////////////
 71 //                                                 69 //
 72 // Constructor                                     70 // Constructor
 73 //                                                 71 //
 74                                                    72 
 75 G4PAIySection::G4PAIySection()                     73 G4PAIySection::G4PAIySection()
 76 {                                                  74 {
 77   fSandia = nullptr;                           <<  75   fSandia = 0;
 78   fDensity = fElectronDensity = fNormalization     76   fDensity = fElectronDensity = fNormalizationCof = fLowEnergyCof = 0.0;
 79   fIntervalNumber = fSplineNumber = 0;             77   fIntervalNumber = fSplineNumber = 0;
 80   fVerbose = 0;                                    78   fVerbose = 0;
 81                                                <<  79   for(G4int i=0; i<500; ++i) {
 82   betaBohr = fine_structure_const;             <<  80     fSplineEnergy[i] = 0.0;
 83   G4double cofBetaBohr = 4.0;                  <<  81     fRePartDielectricConst[i] = 0.0;
 84   G4double betaBohr2 = fine_structure_const*fi <<  82     fImPartDielectricConst[i] = 0.0;
 85   betaBohr4 = betaBohr2*betaBohr2*cofBetaBohr; <<  83     fIntegralTerm[i] = 0.0;
 86                                                <<  84     fDifPAIySection[i] = 0.0;
 87   fSplineEnergy          = G4DataVector(fMaxSp <<  85     fdNdxCerenkov[i] = 0.0;
 88   fRePartDielectricConst = G4DataVector(fMaxSp <<  86     fdNdxPlasmon[i] = 0.0;
 89   fImPartDielectricConst = G4DataVector(fMaxSp <<  87     fIntegralPAIySection[i] = 0.0;
 90   fIntegralTerm          = G4DataVector(fMaxSp <<  88     fIntegralPAIdEdx[i] = 0.0;
 91   fDifPAIySection        = G4DataVector(fMaxSp <<  89     fIntegralCerenkov[i] = 0.0;
 92   fdNdxCerenkov          = G4DataVector(fMaxSp <<  90     fIntegralPlasmon[i] = 0.0;
 93   fdNdxPlasmon           = G4DataVector(fMaxSp <<  91     for(G4int j=0; j<112; ++j) { fPAItable[i][j] = 0.0; }
 94   fIntegralPAIySection   = G4DataVector(fMaxSp << 
 95   fIntegralPAIdEdx       = G4DataVector(fMaxSp << 
 96   fIntegralCerenkov      = G4DataVector(fMaxSp << 
 97   fIntegralPlasmon       = G4DataVector(fMaxSp << 
 98                                                << 
 99   for( G4int i = 0; i < 500; ++i )             << 
100   {                                            << 
101     for( G4int j = 0; j < 112; ++j ) { fPAItab << 
102   }                                                92   }
103 }                                                  93 }
104                                                    94 
105 //////////////////////////////////////////////     95 ////////////////////////////////////////////////////////////////////////////
106 //                                                 96 //
107 //                                             <<  97 // Destructor
108                                                    98 
109 G4double G4PAIySection::GetLorentzFactor(G4int <<  99 G4PAIySection::~G4PAIySection()
110 {                                              << 100 {}
111    return fLorentzFactor[j];                   << 
112 }                                              << 
113                                                   101 
114 //////////////////////////////////////////////    102 ////////////////////////////////////////////////////////////////////////
115 //                                                103 //
116 // Constructor with beta*gamma square value ca << 104 // Test Constructor with beta*gamma square value
117                                                   105 
118 void G4PAIySection::Initialize( const G4Materi    106 void G4PAIySection::Initialize( const G4Material* material,
119                                 G4double maxEn << 107         G4double maxEnergyTransfer,
120                                 G4double betaG << 108         G4double betaGammaSq)
121                                 G4SandiaTable* << 
122 {                                                 109 {
123   if(fVerbose > 0)                             << 
124   {                                            << 
125     G4cout<<G4endl;                            << 
126     G4cout<<"G4PAIySection::Initialize(...,G4S << 
127     G4cout<<G4endl;                            << 
128   }                                            << 
129   G4int i, j;                                     110   G4int i, j;
130                                                << 111   G4double energy;   
131   fSandia          = sandia;                   << 112   // fVerbose = 1;   
132   fIntervalNumber  = sandia->GetMaxInterval(); << 
133   fDensity         = material->GetDensity();      113   fDensity         = material->GetDensity();
134   fElectronDensity = material->GetElectronDens    114   fElectronDensity = material->GetElectronDensity();
                                                   >> 115   //G4int numberOfElements = material->GetNumberOfElements();
135                                                   116 
136   // fIntervalNumber--;                        << 117   fSandia = material->GetSandiaTable();
137                                                   118 
138   if( fVerbose > 0 )                           << 119   fIntervalNumber = fSandia->GetMaxInterval();
139   {                                            << 120 
140     G4cout<<"fDensity = "<<fDensity<<"\t"<<fEl << 121   fIntervalNumber--;
141           <<fIntervalNumber<< " (beta*gamma)^2 << 
142   }                                            << 
143   fEnergyInterval = G4DataVector(fIntervalNumb << 
144   fA1             = G4DataVector(fIntervalNumb << 
145   fA2             = G4DataVector(fIntervalNumb << 
146   fA3             = G4DataVector(fIntervalNumb << 
147   fA4             = G4DataVector(fIntervalNumb << 
148                                                   122 
149   for( i = 1; i <= fIntervalNumber; ++i )      << 123   for( i = 1; i <= fIntervalNumber; i++ )
150   {                                               124   {
151     if ( sandia->GetSandiaMatTablePAI(i-1,0) < << 125     energy = fSandia->GetSandiaMatTablePAI(i-1,0); //vmg 20.11.10
152     {                                          << 126 
153       fIntervalNumber--;                       << 127     if( energy >= maxEnergyTransfer || i > fIntervalNumber )
154       continue;                                << 
155     }                                          << 
156     if( ( sandia->GetSandiaMatTablePAI(i-1,0)  << 
157         || i >= fIntervalNumber )              << 
158     {                                             128     {
159       fEnergyInterval[i] = maxEnergyTransfer;     129       fEnergyInterval[i] = maxEnergyTransfer;
160       fIntervalNumber = i;                        130       fIntervalNumber = i;
161       break;                                      131       break;
162     }                                             132     }
163     fEnergyInterval[i] = sandia->GetSandiaMatT << 133     fEnergyInterval[i] = energy;
164     fA1[i]             = sandia->GetSandiaMatT << 134     fA1[i]             = fSandia->GetSandiaMatTablePAI(i-1,1);
165     fA2[i]             = sandia->GetSandiaMatT << 135     fA2[i]             = fSandia->GetSandiaMatTablePAI(i-1,2);
166     fA3[i]             = sandia->GetSandiaMatT << 136     fA3[i]             = fSandia->GetSandiaMatTablePAI(i-1,3);
167     fA4[i]             = sandia->GetSandiaMatT << 137     fA4[i]             = fSandia->GetSandiaMatTablePAI(i-1,4);
168                                                << 138 
169     if( fVerbose > 0 ) {                       << 139     if( fVerbose > 0 && std::fabs( betaGammaSq - 8. ) < 0.4 )
170       G4cout<<i<<"\t"<<fEnergyInterval[i]/keV< << 140     {
171             <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4en << 141   G4cout<<i<<"\t"<<fEnergyInterval[i]/keV<<" keV \t"<<fA1[i]<<"\t"<<fA2[i] <<"\t"<<fA3[i] <<"\t"<<fA4[i]<<G4endl;
172     }                                             142     }
173   }                                            << 143   } 
174   if( fVerbose > 0 ) {                         << 144 
175     G4cout<<"last i = "<<i<<"; "<<"fIntervalNu << 145   
176           <<fIntervalNumber<<G4endl;           << 
177   }                                            << 
178   if( fEnergyInterval[fIntervalNumber] != maxE    146   if( fEnergyInterval[fIntervalNumber] != maxEnergyTransfer )
179   {                                               147   {
180       fIntervalNumber++;                       << 148     fIntervalNumber++;
181       fEnergyInterval[fIntervalNumber] = maxEn << 149     fEnergyInterval[fIntervalNumber] = maxEnergyTransfer;
182   }                                            << 150     fA1[fIntervalNumber] = fA1[fIntervalNumber-1];
183   if( fVerbose > 0 )                           << 151     fA2[fIntervalNumber] = fA2[fIntervalNumber-1];
184   {                                            << 152     fA3[fIntervalNumber] = fA3[fIntervalNumber-1];
185     for( i = 1; i <= fIntervalNumber; ++i )    << 153     fA4[fIntervalNumber] = fA4[fIntervalNumber-1];
186     {                                          << 
187       G4cout<<i<<"\t"<<fEnergyInterval[i]/keV< << 
188         <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl;  << 
189     }                                          << 
190   }                                            << 
191   if( fVerbose > 0 ) {                         << 
192     G4cout<<"Now checking, if two borders are  << 
193   }                                               154   }
194   for( i = 1; i < fIntervalNumber; ++i )       << 155 
                                                   >> 156    // Now checking, if two borders are too close together
                                                   >> 157   for( i = 1; i < fIntervalNumber; i++ )
195   {                                               158   {
196     if( fEnergyInterval[i+1]-fEnergyInterval[i << 159   // G4cout<<fEnergyInterval[i]<<"\t"<<fA1[i]<<"\t"<<fA2[i]<<"\t"
197          1.5*fDelta*(fEnergyInterval[i+1]+fEne << 160   //   <<fA3[i]<<"\t"<<fA4[i]<<G4endl;
198     else                                       << 161     if(fEnergyInterval[i+1]-fEnergyInterval[i] <
                                                   >> 162            1.5*fDelta*(fEnergyInterval[i+1]+fEnergyInterval[i]))
199     {                                             163     {
200       for( j = i; j < fIntervalNumber; j++ )      164       for( j = i; j < fIntervalNumber; j++ )
201       {                                           165       {
202               fEnergyInterval[j] = fEnergyInte << 166   fEnergyInterval[j] = fEnergyInterval[j+1];
203               fA1[j]             = fA1[j+1];   << 167   fA1[j] = fA1[j+1];
204               fA2[j]             = fA2[j+1];   << 168   fA2[j] = fA2[j+1];
205               fA3[j]             = fA3[j+1];   << 169   fA3[j] = fA3[j+1];
206               fA4[j]             = fA4[j+1];   << 170   fA4[j] = fA4[j+1];
207       }                                           171       }
208       fIntervalNumber--;                          172       fIntervalNumber--;
                                                   >> 173       i--;
209     }                                             174     }
210   }                                               175   }
211   if( fVerbose > 0 )                           << 176   if( fVerbose > 0 && std::fabs( betaGammaSq - 8. ) < 0.4 )
212   {                                               177   {
213     for( i = 1; i <= fIntervalNumber; ++i )    << 178     G4cout<<"Sandia cofs in G4PAIySection::Initialize(), mat = "<<material->GetName()<<G4endl;
214     {                                          << 179     G4cout<<"for bg2 = "<<betaGammaSq<<", Tmax = "<< maxEnergyTransfer/keV<<" keV"<<G4endl;
215       G4cout<<i<<"\t"<<fEnergyInterval[i]/keV< << 180     G4cout<<"energy \t"<<"a1 \t"<<"a2 \t"<<"a3 \t"<<"a4 \t"<<G4endl;
216         <<fA3[i]<<"\t"<<fA4[i]<<"\t"<<G4endl;  << 181 
217     }                                          << 182       for( j = 1; j < fIntervalNumber; j++ )
                                                   >> 183       {
                                                   >> 184   G4cout<<j<<"\t"<<fEnergyInterval[j]/keV<<" keV \t"<<fA1[j]<<"\t"<<fA2[j] <<"\t"<<fA3[j] <<"\t"<<fA4[j]<<G4endl;
                                                   >> 185       }
218   }                                               186   }
219   // Preparation of fSplineEnergy array corres << 
220                                                   187 
221   ComputeLowEnergyCof(material);               << 188       // Preparation of fSplineEnergy array corresponding to min ionisation, G~4
222                                                << 189       
223   G4double   betaGammaSqRef =                     190   G4double   betaGammaSqRef = 
224     fLorentzFactor[fRefGammaNumber]*fLorentzFa << 191      fLorentzFactor[fRefGammaNumber]*fLorentzFactor[fRefGammaNumber] - 1;
225                                                << 192       
                                                   >> 193   ComputeLowEnergyCof(material);            
226   NormShift(betaGammaSqRef);                      194   NormShift(betaGammaSqRef);             
227   SplainPAI(betaGammaSqRef);                      195   SplainPAI(betaGammaSqRef);
228                                                   196       
229   // Preparation of integral PAI cross section << 197    // Preparation of integral PAI cross section for input betaGammaSq
230                                                   198    
231   for( i = 1; i <= fSplineNumber; ++i )        << 199   for( i = 1; i <= fSplineNumber; i++ )
232   {                                               200   {
233      fDifPAIySection[i] = DifPAIySection(i,bet << 201     fDifPAIySection[i] = DifPAIySection(i,betaGammaSq);
234                                                << 202     fdNdxCerenkov[i]   = PAIdNdxCerenkov(i,betaGammaSq);
235      if( fVerbose > 0 ) G4cout<<i<<"; dNdxPAI  << 203     fdNdxPlasmon[i]    = PAIdNdxPlasmon(i,betaGammaSq);
236   }                                               204   }
237   IntegralPAIySection();                       << 205   IntegralPAIySection();
                                                   >> 206   IntegralCerenkov();
                                                   >> 207   IntegralPlasmon();
238 }                                                 208 }
239                                                   209 
240 //////////////////////////////////////////////    210 /////////////////////////////////////////////////////////////////////////
241 //                                                211 //
242 // Compute low energy cof. It reduces PAI xsc     212 // Compute low energy cof. It reduces PAI xsc for Lorentz factors less than 4.
243 //                                                213 //
244                                                   214 
245 void G4PAIySection::ComputeLowEnergyCof(const     215 void G4PAIySection::ComputeLowEnergyCof(const G4Material* material)
246 {                                                 216 {    
247   G4int i, numberOfElements = (G4int)material- << 217   G4int i, numberOfElements = material->GetNumberOfElements();
248   G4double sumZ = 0., sumCof = 0.;                218   G4double sumZ = 0., sumCof = 0.; 
249                                                   219 
250   static const G4double p0 =  1.20923e+00;     << 220   const G4double p0 =  1.20923e+00; 
251   static const G4double p1 =  3.53256e-01;     << 221   const G4double p1 =  3.53256e-01; 
252   static const G4double p2 = -1.45052e-03;     << 222   const G4double p2 = -1.45052e-03; 
253                                                   223   
254   G4double* thisMaterialZ   = new G4double[num    224   G4double* thisMaterialZ   = new G4double[numberOfElements];
255   G4double* thisMaterialCof = new G4double[num    225   G4double* thisMaterialCof = new G4double[numberOfElements];
256                                                   226    
257   for( i = 0; i < numberOfElements; ++i )      << 227   for( i = 0; i < numberOfElements; i++ )
258   {                                               228   {
259     thisMaterialZ[i] = material->GetElement(i)    229     thisMaterialZ[i] = material->GetElement(i)->GetZ();
260     sumZ += thisMaterialZ[i];                     230     sumZ += thisMaterialZ[i];
261     thisMaterialCof[i] = p0+p1*thisMaterialZ[i    231     thisMaterialCof[i] = p0+p1*thisMaterialZ[i]+p2*thisMaterialZ[i]*thisMaterialZ[i];   
262   }                                               232   }
263   for( i = 0; i < numberOfElements; ++i )      << 233   for( i = 0; i < numberOfElements; i++ )
264   {                                               234   {
265     sumCof += thisMaterialCof[i]*thisMaterialZ    235     sumCof += thisMaterialCof[i]*thisMaterialZ[i]/sumZ;
266   }                                               236   }
267   fLowEnergyCof = sumCof;                         237   fLowEnergyCof = sumCof;
268   delete [] thisMaterialZ;                        238   delete [] thisMaterialZ;
269   delete [] thisMaterialCof;                      239   delete [] thisMaterialCof;
270   // G4cout<<"fLowEnergyCof = "<<fLowEnergyCof    240   // G4cout<<"fLowEnergyCof = "<<fLowEnergyCof<<G4endl;
271 }                                                 241 }
272                                                   242 
                                                   >> 243 
                                                   >> 244 
                                                   >> 245 
273 //////////////////////////////////////////////    246 /////////////////////////////////////////////////////////////////////////
274 //                                                247 //
275 // General control function for class G4PAIySe    248 // General control function for class G4PAIySection
276 //                                                249 //
277                                                   250 
278 void G4PAIySection::InitPAI()                     251 void G4PAIySection::InitPAI()
279 {                                                 252 {    
280    G4int i;                                       253    G4int i;
281    G4double betaGammaSq = fLorentzFactor[fRefG    254    G4double betaGammaSq = fLorentzFactor[fRefGammaNumber]*
282                           fLorentzFactor[fRefG    255                           fLorentzFactor[fRefGammaNumber] - 1;
283                                                   256 
284    // Preparation of integral PAI cross sectio    257    // Preparation of integral PAI cross section for reference gamma
285                                                   258    
286    NormShift(betaGammaSq);                        259    NormShift(betaGammaSq);             
287    SplainPAI(betaGammaSq);                        260    SplainPAI(betaGammaSq);
288                                                   261 
289    IntegralPAIySection();                         262    IntegralPAIySection();
290    IntegralCerenkov();                            263    IntegralCerenkov();
291    IntegralPlasmon();                             264    IntegralPlasmon();
292                                                   265 
293    for( i = 0; i<= fSplineNumber; ++i)         << 266    for(i = 0; i<=fSplineNumber; i++)
294    {                                              267    {
295      fPAItable[i][fRefGammaNumber] = fIntegral << 268       fPAItable[i][fRefGammaNumber] = fIntegralPAIySection[i];
296                                                << 269       if(i != 0) 
297      if(i != 0)  fPAItable[i][0] = fSplineEner << 270       {
                                                   >> 271    fPAItable[i][0] = fSplineEnergy[i];
                                                   >> 272       }
298    }                                              273    }
299    fPAItable[0][0] = fSplineNumber;               274    fPAItable[0][0] = fSplineNumber;
300                                                   275    
301    for( G4int j = 1; j < 112; ++j)       // fo << 276    for(G4int j = 1; j < 112; j++)       // for other gammas
302    {                                              277    {
303       if( j == fRefGammaNumber ) continue;        278       if( j == fRefGammaNumber ) continue;
304                                                   279       
305       betaGammaSq = fLorentzFactor[j]*fLorentz    280       betaGammaSq = fLorentzFactor[j]*fLorentzFactor[j] - 1;
306                                                   281       
307       for(i = 1; i <= fSplineNumber; ++i)      << 282       for(i = 1; i <= fSplineNumber; i++)
308       {                                           283       {
309          fDifPAIySection[i] = DifPAIySection(i    284          fDifPAIySection[i] = DifPAIySection(i,betaGammaSq);
310          fdNdxCerenkov[i]   = PAIdNdxCerenkov(    285          fdNdxCerenkov[i]   = PAIdNdxCerenkov(i,betaGammaSq);
311          fdNdxPlasmon[i]    = PAIdNdxPlasmon(i    286          fdNdxPlasmon[i]    = PAIdNdxPlasmon(i,betaGammaSq);
312       }                                           287       }
313       IntegralPAIySection();                      288       IntegralPAIySection();
314       IntegralCerenkov();                         289       IntegralCerenkov();
315       IntegralPlasmon();                          290       IntegralPlasmon();
316                                                   291       
317       for(i = 0; i <= fSplineNumber; ++i)      << 292       for(i = 0; i <= fSplineNumber; i++)
318       {                                           293       {
319         fPAItable[i][j] = fIntegralPAIySection << 294          fPAItable[i][j] = fIntegralPAIySection[i];
320       }                                           295       }
321    }                                              296    } 
                                                   >> 297 
322 }                                                 298 }  
323                                                   299 
324 //////////////////////////////////////////////    300 ///////////////////////////////////////////////////////////////////////
325 //                                                301 //
326 // Shifting from borders to intervals Creation    302 // Shifting from borders to intervals Creation of first energy points
327 //                                                303 //
328                                                   304 
329 void G4PAIySection::NormShift(G4double betaGam    305 void G4PAIySection::NormShift(G4double betaGammaSq)
330 {                                                 306 {
331   G4int i, j;                                     307   G4int i, j;
332                                                   308 
333   for( i = 1; i <= fIntervalNumber-1; ++i)     << 309   for( i = 1; i <= fIntervalNumber-1; i++ )
334   {                                               310   {
335     for( j = 1; j <= 2; ++j)                   << 311     for( j = 1; j <= 2; j++ )
336     {                                             312     {
337       fSplineNumber = (i-1)*2 + j;                313       fSplineNumber = (i-1)*2 + j;
338                                                   314 
339       if( j == 1 ) fSplineEnergy[fSplineNumber    315       if( j == 1 ) fSplineEnergy[fSplineNumber] = fEnergyInterval[i  ]*(1+fDelta);
340       else         fSplineEnergy[fSplineNumber    316       else         fSplineEnergy[fSplineNumber] = fEnergyInterval[i+1]*(1-fDelta); 
341       //    G4cout<<"cn = "<<fSplineNumber<<";    317       //    G4cout<<"cn = "<<fSplineNumber<<"; "<<"energy = "
342       //  <<fSplineEnergy[fSplineNumber]<<G4en    318       //  <<fSplineEnergy[fSplineNumber]<<G4endl;
343     }                                             319     }
344   }                                               320   }
345   fIntegralTerm[1]=RutherfordIntegral(1,fEnerg    321   fIntegralTerm[1]=RutherfordIntegral(1,fEnergyInterval[1],fSplineEnergy[1]);
346                                                   322 
347   j = 1;                                          323   j = 1;
348                                                   324 
349   for(i=2;i<=fSplineNumber;++i)                << 325   for(i=2;i<=fSplineNumber;i++)
350   {                                               326   {
351     if(fSplineEnergy[i]<fEnergyInterval[j+1])     327     if(fSplineEnergy[i]<fEnergyInterval[j+1])
352     {                                             328     {
353          fIntegralTerm[i] = fIntegralTerm[i-1]    329          fIntegralTerm[i] = fIntegralTerm[i-1] + 
354                             RutherfordIntegral << 330                       RutherfordIntegral(j,fSplineEnergy[i-1],
355                                                   331                                                  fSplineEnergy[i]   );
356     }                                             332     }
357     else                                          333     else
358     {                                             334     {
359        G4double x = RutherfordIntegral(j,fSpli    335        G4double x = RutherfordIntegral(j,fSplineEnergy[i-1],
360                                            fEn    336                                            fEnergyInterval[j+1]   );
361          j++;                                     337          j++;
362          fIntegralTerm[i] = fIntegralTerm[i-1]    338          fIntegralTerm[i] = fIntegralTerm[i-1] + x + 
363                             RutherfordIntegral << 339                       RutherfordIntegral(j,fEnergyInterval[j],
364                                                   340                                                  fSplineEnergy[i]    );
365     }                                             341     }
366     // G4cout<<i<<"\t"<<fSplineEnergy[i]<<"\t"    342     // G4cout<<i<<"\t"<<fSplineEnergy[i]<<"\t"<<fIntegralTerm[i]<<"\n"<<G4endl;
367   }                                               343   } 
368   static const G4double nfactor =              << 344   fNormalizationCof = 2*pi*pi*hbarc*hbarc*fine_structure_const/electron_mass_c2;
369     2*pi*pi*hbarc*hbarc*fine_structure_const/e << 345   fNormalizationCof *= fElectronDensity/fIntegralTerm[fSplineNumber];
370   fNormalizationCof = nfactor*fElectronDensity << 
371                                                   346 
372   // G4cout<<"fNormalizationCof = "<<fNormaliz    347   // G4cout<<"fNormalizationCof = "<<fNormalizationCof<<G4endl;
373                                                   348 
374   // Calculation of PAI differrential cross-se << 349     // Calculation of PAI differrential cross-section (1/(keV*cm))
375   // in the energy points near borders of ener << 350     // in the energy points near borders of energy intervals
376                                                   351 
377   for(G4int k=1; k<=fIntervalNumber-1; ++k)    << 352    for(G4int k=1;k<=fIntervalNumber-1;k++)
378    {                                              353    {
379      for(j=1; j<=2; ++j)                       << 354       for(j=1;j<=2;j++)
380       {                                           355       {
381          i = (k-1)*2 + j;                         356          i = (k-1)*2 + j;
382          fImPartDielectricConst[i] = fNormaliz    357          fImPartDielectricConst[i] = fNormalizationCof*
383                                      ImPartDie << 358                                ImPartDielectricConst(k,fSplineEnergy[i]);
384          fRePartDielectricConst[i] = fNormaliz    359          fRePartDielectricConst[i] = fNormalizationCof*
385                                      RePartDie << 360                                RePartDielectricConst(fSplineEnergy[i]);
386          fIntegralTerm[i] *= fNormalizationCof    361          fIntegralTerm[i] *= fNormalizationCof;
387                                                   362 
388          fDifPAIySection[i] = DifPAIySection(i    363          fDifPAIySection[i] = DifPAIySection(i,betaGammaSq);
389          fdNdxCerenkov[i]   = PAIdNdxCerenkov(    364          fdNdxCerenkov[i]   = PAIdNdxCerenkov(i,betaGammaSq);
390          fdNdxPlasmon[i]    = PAIdNdxPlasmon(i    365          fdNdxPlasmon[i]    = PAIdNdxPlasmon(i,betaGammaSq);
391       }                                           366       }
392    }                                              367    }
393                                                   368 
394 }  // end of NormShift                            369 }  // end of NormShift 
395                                                   370 
396 //////////////////////////////////////////////    371 /////////////////////////////////////////////////////////////////////////
397 //                                                372 //
398 // Creation of new energy points as geometrica    373 // Creation of new energy points as geometrical mean of existing
399 // one, calculation PAI_cs for them, while the    374 // one, calculation PAI_cs for them, while the error of logarithmic
400 // linear approximation would be smaller than     375 // linear approximation would be smaller than 'fError'
401                                                   376 
402 void G4PAIySection::SplainPAI(G4double betaGam    377 void G4PAIySection::SplainPAI(G4double betaGammaSq)
403 {                                                 378 {
404    G4int k = 1;                                   379    G4int k = 1;
405    G4int i = 1;                                   380    G4int i = 1;
406                                                   381 
407    while ( (i < fSplineNumber) && (fSplineNumb    382    while ( (i < fSplineNumber) && (fSplineNumber < fMaxSplineSize-1) )
408    {                                              383    {
409       if(fSplineEnergy[i+1] > fEnergyInterval[    384       if(fSplineEnergy[i+1] > fEnergyInterval[k+1])
410       {                                           385       {
411           k++;   // Here next energy point is     386           k++;   // Here next energy point is in next energy interval
412           ++i;                                 << 387     i++;
413           continue;                               388           continue;
414       }                                           389       }
415       // Shifting of arrayes for inserting the << 390                  // Shifting of arrayes for inserting the geometrical 
416       // average of 'i' and 'i+1' energy point << 391            // average of 'i' and 'i+1' energy points to 'i+1' place
417       fSplineNumber++;                            392       fSplineNumber++;
418                                                   393 
419       for(G4int j = fSplineNumber; j >= i+2; j    394       for(G4int j = fSplineNumber; j >= i+2; j-- )
420       {                                           395       {
421          fSplineEnergy[j]          = fSplineEn    396          fSplineEnergy[j]          = fSplineEnergy[j-1];
422          fImPartDielectricConst[j] = fImPartDi    397          fImPartDielectricConst[j] = fImPartDielectricConst[j-1];
423          fRePartDielectricConst[j] = fRePartDi << 398    fRePartDielectricConst[j] = fRePartDielectricConst[j-1];
424          fIntegralTerm[j]          = fIntegral << 399    fIntegralTerm[j]          = fIntegralTerm[j-1];
425                                                   400 
426          fDifPAIySection[j] = fDifPAIySection[ << 401    fDifPAIySection[j] = fDifPAIySection[j-1];
427          fdNdxCerenkov[j]   = fdNdxCerenkov[j-    402          fdNdxCerenkov[j]   = fdNdxCerenkov[j-1];
428          fdNdxPlasmon[j]    = fdNdxPlasmon[j-1    403          fdNdxPlasmon[j]    = fdNdxPlasmon[j-1];
429       }                                           404       }
430       G4double x1  = fSplineEnergy[i];            405       G4double x1  = fSplineEnergy[i];
431       G4double x2  = fSplineEnergy[i+1];          406       G4double x2  = fSplineEnergy[i+1];
432       G4double yy1 = fDifPAIySection[i];          407       G4double yy1 = fDifPAIySection[i];
433       G4double y2  = fDifPAIySection[i+1];        408       G4double y2  = fDifPAIySection[i+1];
434                                                   409 
435       G4double en1 = sqrt(x1*x2);                 410       G4double en1 = sqrt(x1*x2);
436       fSplineEnergy[i+1] = en1;                   411       fSplineEnergy[i+1] = en1;
437                                                   412 
438       // Calculation of logarithmic linear app << 413      // Calculation of logarithmic linear approximation
439       // in this (enr) energy point, which num << 414      // in this (enr) energy point, which number is 'i+1' now
440                                                   415 
441       G4double a = log10(y2/yy1)/log10(x2/x1);    416       G4double a = log10(y2/yy1)/log10(x2/x1);
442       G4double b = log10(yy1) - a*log10(x1);      417       G4double b = log10(yy1) - a*log10(x1);
443       G4double y = a*log10(en1) + b;              418       G4double y = a*log10(en1) + b;
444       y = pow(10.,y);                             419       y = pow(10.,y);
445                                                   420 
446       // Calculation of the PAI dif. cross-sec << 421      // Calculation of the PAI dif. cross-section at this point
447                                                   422 
448       fImPartDielectricConst[i+1] = fNormaliza    423       fImPartDielectricConst[i+1] = fNormalizationCof*
449                                     ImPartDiel << 424                               ImPartDielectricConst(k,fSplineEnergy[i+1]);
450       fRePartDielectricConst[i+1] = fNormaliza    425       fRePartDielectricConst[i+1] = fNormalizationCof*
451                                     RePartDiel << 426                               RePartDielectricConst(fSplineEnergy[i+1]);
452       fIntegralTerm[i+1] = fIntegralTerm[i] +     427       fIntegralTerm[i+1] = fIntegralTerm[i] + fNormalizationCof*
453                            RutherfordIntegral( << 428                      RutherfordIntegral(k,fSplineEnergy[i],
454                                                   429                                                 fSplineEnergy[i+1]);
455                                                   430 
456       fDifPAIySection[i+1] = DifPAIySection(i+    431       fDifPAIySection[i+1] = DifPAIySection(i+1,betaGammaSq);
457       fdNdxCerenkov[i+1]   = PAIdNdxCerenkov(i    432       fdNdxCerenkov[i+1]   = PAIdNdxCerenkov(i+1,betaGammaSq);
458       fdNdxPlasmon[i+1]    = PAIdNdxPlasmon(i+    433       fdNdxPlasmon[i+1]    = PAIdNdxPlasmon(i+1,betaGammaSq);
459                                                   434 
460                   // Condition for next divisi << 435       // Condition for next division of this segment or to pass
461                   // to higher energies        << 436       // to higher energies
462                                                   437 
463       G4double x = 2*(fDifPAIySection[i+1] - y    438       G4double x = 2*(fDifPAIySection[i+1] - y)/(fDifPAIySection[i+1] + y);
464                                                   439 
465       G4double delta = 2.*(fSplineEnergy[i+1]- << 
466         /(fSplineEnergy[i+1]+fSplineEnergy[i]) << 
467                                                << 
468       if( x < 0 )                                 440       if( x < 0 ) 
469       {                                           441       {
470          x = -x;                               << 442    x = -x;
471       }                                           443       }
472       if( x > fError && fSplineNumber < fMaxSp << 444       if( x > fError && fSplineNumber < fMaxSplineSize-1 )
473       {                                           445       {
474          continue;  // next division           << 446    continue;  // next division
475       }                                           447       }
476       i += 2;  // pass to next segment            448       i += 2;  // pass to next segment
477                                                   449 
478       // Loop checking, 03-Aug-2015, Vladimir  << 
479    }   // close 'while'                           450    }   // close 'while'
480                                                   451 
481 }  // end of SplainPAI                            452 }  // end of SplainPAI 
482                                                   453 
483                                                   454 
484 //////////////////////////////////////////////    455 ////////////////////////////////////////////////////////////////////
485 //                                                456 //
486 // Integration over electrons that could be co    457 // Integration over electrons that could be considered
487 // quasi-free at energy transfer of interest      458 // quasi-free at energy transfer of interest
488                                                   459 
489 G4double G4PAIySection::RutherfordIntegral( G4    460 G4double G4PAIySection::RutherfordIntegral( G4int k,
490                                             G4 << 461                     G4double x1,
491                                                << 462                       G4double x2   )
492 {                                                 463 {
493    G4double  c1, c2, c3;                          464    G4double  c1, c2, c3;
494    // G4cout<<"RI: x1 = "<<x1<<"; "<<"x2 = "<< << 465    // G4cout<<"RI: x1 = "<<x1<<"; "<<"x2 = "<<x2<<G4endl;   
495    G4double x12 = x1*x2;                       << 466    c1 = (x2 - x1)/x1/x2;
496    c1 = (x2 - x1)/x12;                         << 467    c2 = (x2 - x1)*(x2 + x1)/x1/x1/x2/x2;
497    c2 = (x2 - x1)*(x2 + x1)/(x12*x12);         << 468    c3 = (x2 - x1)*(x1*x1 + x1*x2 + x2*x2)/x1/x1/x1/x2/x2/x2;
498    c3 = (x2 - x1)*(x1*x1 + x1*x2 + x2*x2)/(x12 << 
499    // G4cout<<" RI: c1 = "<<c1<<"; "<<"c2 = "<    469    // G4cout<<" RI: c1 = "<<c1<<"; "<<"c2 = "<<c2<<"; "<<"c3 = "<<c3<<G4endl;   
500                                                   470    
501    return  fA1[k]*log(x2/x1) + fA2[k]*c1 + fA3    471    return  fA1[k]*log(x2/x1) + fA2[k]*c1 + fA3[k]*c2/2 + fA4[k]*c3/3;
502                                                   472 
503 }   // end of RutherfordIntegral                  473 }   // end of RutherfordIntegral 
504                                                   474 
505                                                   475 
506 //////////////////////////////////////////////    476 /////////////////////////////////////////////////////////////////
507 //                                                477 //
508 // Imaginary part of dielectric constant          478 // Imaginary part of dielectric constant
509 // (G4int k - interval number, G4double en1 -     479 // (G4int k - interval number, G4double en1 - energy point)
510                                                   480 
511 G4double G4PAIySection::ImPartDielectricConst( << 481 G4double G4PAIySection::ImPartDielectricConst( G4int    k ,
                                                   >> 482                              G4double energy1 )
512 {                                                 483 {
513    G4double energy2,energy3,energy4,result;       484    G4double energy2,energy3,energy4,result;
514                                                   485 
515    energy2 = energy1*energy1;                     486    energy2 = energy1*energy1;
516    energy3 = energy2*energy1;                     487    energy3 = energy2*energy1;
517    energy4 = energy3*energy1;                     488    energy4 = energy3*energy1;
518                                                   489    
519    result = fA1[k]/energy1+fA2[k]/energy2+fA3[    490    result = fA1[k]/energy1+fA2[k]/energy2+fA3[k]/energy3+fA4[k]/energy4;  
520    result *=hbarc/energy1;                        491    result *=hbarc/energy1;
521                                                   492    
522    return result;                                 493    return result;
523                                                   494 
524 }  // end of ImPartDielectricConst                495 }  // end of ImPartDielectricConst 
525                                                   496 
526                                                   497 
527 //////////////////////////////////////////////    498 //////////////////////////////////////////////////////////////////////////////
528 //                                                499 //
529 // Real part of dielectric constant minus unit    500 // Real part of dielectric constant minus unit: epsilon_1 - 1
530 // (G4double enb - energy point)                  501 // (G4double enb - energy point)
531 //                                                502 //
532                                                   503 
533 G4double G4PAIySection::RePartDielectricConst(    504 G4double G4PAIySection::RePartDielectricConst(G4double enb)
534 {                                                 505 {       
535    G4double x0, x02, x03, x04, x05, x1, x2, xx    506    G4double x0, x02, x03, x04, x05, x1, x2, xx1 ,xx2 , xx12,
536             c1, c2, c3, cof1, cof2, xln1, xln2    507             c1, c2, c3, cof1, cof2, xln1, xln2, xln3, result;
537                                                   508 
538    x0 = enb;                                      509    x0 = enb;
539    result = 0;                                    510    result = 0;
540                                                   511    
541    for(G4int i=1;i<=fIntervalNumber-1;++i)     << 512    for(G4int i=1;i<=fIntervalNumber-1;i++)
542    {                                              513    {
543       x1 = fEnergyInterval[i];                    514       x1 = fEnergyInterval[i];
544       x2 = fEnergyInterval[i+1];                  515       x2 = fEnergyInterval[i+1];
545       xx1 = x1 - x0;                              516       xx1 = x1 - x0;
546       xx2 = x2 - x0;                              517       xx2 = x2 - x0;
547       xx12 = xx2/xx1;                             518       xx12 = xx2/xx1;
548                                                   519       
549       if(xx12<0.)                              << 520       if(xx12<0)
550       {                                           521       {
551          xx12 = -xx12;                         << 522    xx12 = -xx12;
552       }                                           523       }
553       xln1 = log(x2/x1);                          524       xln1 = log(x2/x1);
554       xln2 = log(xx12);                           525       xln2 = log(xx12);
555       xln3 = log((x2 + x0)/(x1 + x0));            526       xln3 = log((x2 + x0)/(x1 + x0));
556       x02 = x0*x0;                                527       x02 = x0*x0;
557       x03 = x02*x0;                               528       x03 = x02*x0;
558       x04 = x03*x0;                               529       x04 = x03*x0;
559       x05 = x04*x0;                               530       x05 = x04*x0;
560       G4double x12 = x1*x2;                    << 531       c1  = (x2 - x1)/x1/x2;
561       c1  = (x2 - x1)/x12;                     << 532       c2  = (x2 - x1)*(x2 +x1)/x1/x1/x2/x2;
562       c2  = (x2 - x1)*(x2 +x1)/(x12*x12);      << 533       c3  = (x2 -x1)*(x1*x1 + x1*x2 + x2*x2)/x1/x1/x1/x2/x2/x2;
563       c3  = (x2 -x1)*(x1*x1 + x1*x2 + x2*x2)/( << 
564                                                   534 
565       result -= (fA1[i]/x02 + fA3[i]/x04)*xln1    535       result -= (fA1[i]/x02 + fA3[i]/x04)*xln1;
566       result -= (fA2[i]/x02 + fA4[i]/x04)*c1;     536       result -= (fA2[i]/x02 + fA4[i]/x04)*c1;
567       result -= fA3[i]*c2/2/x02;                  537       result -= fA3[i]*c2/2/x02;
568       result -= fA4[i]*c3/3/x02;                  538       result -= fA4[i]*c3/3/x02;
569                                                   539 
570       cof1 = fA1[i]/x02 + fA3[i]/x04;             540       cof1 = fA1[i]/x02 + fA3[i]/x04;
571       cof2 = fA2[i]/x03 + fA4[i]/x05;             541       cof2 = fA2[i]/x03 + fA4[i]/x05;
572                                                   542 
573       result += 0.5*(cof1 +cof2)*xln2;            543       result += 0.5*(cof1 +cof2)*xln2;
574       result += 0.5*(cof1 - cof2)*xln3;           544       result += 0.5*(cof1 - cof2)*xln3;
575    }                                              545    } 
576    result *= 2*hbarc/pi;                          546    result *= 2*hbarc/pi;
577                                                   547    
578    return result;                                 548    return result;
579                                                   549 
580 }   // end of RePartDielectricConst               550 }   // end of RePartDielectricConst 
581                                                   551 
582 //////////////////////////////////////////////    552 //////////////////////////////////////////////////////////////////////
583 //                                                553 //
584 // PAI differential cross-section in terms of     554 // PAI differential cross-section in terms of
585 // simplified Allison's equation                  555 // simplified Allison's equation
586 //                                                556 //
587                                                   557 
588 G4double G4PAIySection::DifPAIySection( G4int     558 G4double G4PAIySection::DifPAIySection( G4int              i ,
589                                         G4doub    559                                         G4double betaGammaSq  )
590 {                                                 560 {        
591    G4double beta, be2,cof,x1,x2,x3,x4,x5,x6,x7 << 561   G4double beta, be2,cof,x1,x2,x3,x4,x5,x6,x7,x8,result;
                                                   >> 562    //G4double beta, be4;
                                                   >> 563    //G4double be4;
                                                   >> 564    G4double betaBohr = fine_structure_const;
                                                   >> 565    // G4double betaBohr2 = fine_structure_const*fine_structure_const;
                                                   >> 566    // G4double betaBohr4 = betaBohr2*betaBohr2*4.0;
592    be2 = betaGammaSq/(1 + betaGammaSq);           567    be2 = betaGammaSq/(1 + betaGammaSq);
593    beta = std::sqrt(be2);                      << 568    //be4 = be2*be2;
                                                   >> 569    beta = sqrt(be2);
594    cof = 1;                                       570    cof = 1;
595    x1 = log(2*electron_mass_c2/fSplineEnergy[i    571    x1 = log(2*electron_mass_c2/fSplineEnergy[i]);
596                                                   572 
597    if( betaGammaSq < 0.01 ) x2 = log(be2);        573    if( betaGammaSq < 0.01 ) x2 = log(be2);
598    else                                           574    else
599    {                                              575    {
600      x2 = -log( (1/betaGammaSq - fRePartDielec    576      x2 = -log( (1/betaGammaSq - fRePartDielectricConst[i])*
601                 (1/betaGammaSq - fRePartDielec << 577           (1/betaGammaSq - fRePartDielectricConst[i]) + 
602                 fImPartDielectricConst[i]*fImP << 578           fImPartDielectricConst[i]*fImPartDielectricConst[i] )/2;
603    }                                              579    }
604    if( fImPartDielectricConst[i] == 0.0 ||beta    580    if( fImPartDielectricConst[i] == 0.0 ||betaGammaSq < 0.01 )
605    {                                              581    {
606      x6=0;                                        582      x6=0;
607    }                                              583    }
608    else                                           584    else
609    {                                              585    {
610      x3 = -fRePartDielectricConst[i] + 1/betaG    586      x3 = -fRePartDielectricConst[i] + 1/betaGammaSq;
611      x5 = -1 - fRePartDielectricConst[i] +        587      x5 = -1 - fRePartDielectricConst[i] +
612           be2*((1 +fRePartDielectricConst[i])*    588           be2*((1 +fRePartDielectricConst[i])*(1 + fRePartDielectricConst[i]) +
613           fImPartDielectricConst[i]*fImPartDie << 589     fImPartDielectricConst[i]*fImPartDielectricConst[i]);
614                                                   590 
615      x7 = std::atan2(fImPartDielectricConst[i] << 591      x7 = atan2(fImPartDielectricConst[i],x3);
616      x6 = x5 * x7;                                592      x6 = x5 * x7;
617    }                                              593    }
                                                   >> 594     // if(fImPartDielectricConst[i] == 0) x6 = 0;
                                                   >> 595    
618    x4 = ((x1 + x2)*fImPartDielectricConst[i] +    596    x4 = ((x1 + x2)*fImPartDielectricConst[i] + x6)/hbarc;
                                                   >> 597    //   if( x4 < 0.0 ) x4 = 0.0;
619    x8 = (1 + fRePartDielectricConst[i])*(1 + f    598    x8 = (1 + fRePartDielectricConst[i])*(1 + fRePartDielectricConst[i]) + 
620         fImPartDielectricConst[i]*fImPartDiele    599         fImPartDielectricConst[i]*fImPartDielectricConst[i];
621                                                   600 
622    result = (x4 + cof*fIntegralTerm[i]/fSpline    601    result = (x4 + cof*fIntegralTerm[i]/fSplineEnergy[i]/fSplineEnergy[i]);
623    result = std::max(result, 1.0e-8);          << 602    if(result < 1.0e-8) result = 1.0e-8;
624    result *= fine_structure_const/(be2*pi);    << 603    result *= fine_structure_const/be2/pi;
625    // low energy correction                       604    // low energy correction
626                                                   605 
627    G4double lowCof = fLowEnergyCof; // 6.0 ; /    606    G4double lowCof = fLowEnergyCof; // 6.0 ; // Ar ~ 4.; -> fLowCof as f(Z1,Z2)? 
628                                                   607 
629    result *= (1 - std::exp(-beta/(betaBohr*low << 608    result *= (1 - exp(-beta/betaBohr/lowCof));
                                                   >> 609 
                                                   >> 610    //   result *= (1-exp(-beta/betaBohr))*(1-exp(-beta/betaBohr));
                                                   >> 611    //  result *= (1-exp(-be2/betaBohr2));
                                                   >> 612    // result *= (1-exp(-be4/betaBohr4));
                                                   >> 613    //   if(fDensity >= 0.1)
630    if(x8 > 0.)                                    614    if(x8 > 0.)
631    {                                              615    { 
632      result /= x8;                             << 616       result /= x8;
633    }                                              617    }
634    return result;                                 618    return result;
635                                                   619 
636 } // end of DifPAIySection                        620 } // end of DifPAIySection 
637                                                   621 
638 //////////////////////////////////////////////    622 //////////////////////////////////////////////////////////////////////////
639 //                                                623 //
640 // Calculation od dN/dx of collisions with cre    624 // Calculation od dN/dx of collisions with creation of Cerenkov pseudo-photons
641                                                   625 
642 G4double G4PAIySection::PAIdNdxCerenkov( G4int << 626 G4double G4PAIySection::PAIdNdxCerenkov( G4int    i ,
                                                   >> 627                                          G4double betaGammaSq  )
643 {                                                 628 {        
644    G4double logarithm, x3, x5, argument, modul    629    G4double logarithm, x3, x5, argument, modul2, dNdxC; 
645    G4double be2, be4;                          << 630    G4double be2, be4, betaBohr2,betaBohr4,cofBetaBohr;
                                                   >> 631 
                                                   >> 632    //G4double cof         = 1.0;
                                                   >> 633    cofBetaBohr = 4.0;
                                                   >> 634    betaBohr2   = fine_structure_const*fine_structure_const;
                                                   >> 635    betaBohr4   = betaBohr2*betaBohr2*cofBetaBohr;
646                                                   636 
647    be2 = betaGammaSq/(1 + betaGammaSq);           637    be2 = betaGammaSq/(1 + betaGammaSq);
648    be4 = be2*be2;                                 638    be4 = be2*be2;
649                                                   639 
650    if( betaGammaSq < 0.01 ) logarithm = log(1.    640    if( betaGammaSq < 0.01 ) logarithm = log(1.0+betaGammaSq); // 0.0;
651    else                                           641    else
652    {                                              642    {
653      logarithm = -std::log( (1/betaGammaSq - f << 643      logarithm  = -log( (1/betaGammaSq - fRePartDielectricConst[i])*
654                         (1/betaGammaSq - fRePa << 644                   (1/betaGammaSq - fRePartDielectricConst[i]) + 
655                         fImPartDielectricConst << 645                   fImPartDielectricConst[i]*fImPartDielectricConst[i] )*0.5;
656      logarithm += std::log(1+1.0/betaGammaSq); << 646      logarithm += log(1+1.0/betaGammaSq);
657    }                                              647    }
658                                                   648 
659    if( fImPartDielectricConst[i] == 0.0 || bet    649    if( fImPartDielectricConst[i] == 0.0 || betaGammaSq < 0.01 )
660    {                                              650    {
661      argument = 0.0;                              651      argument = 0.0;
662    }                                              652    }
663    else                                           653    else
664    {                                              654    {
665      x3 = -fRePartDielectricConst[i] + 1.0/bet    655      x3 = -fRePartDielectricConst[i] + 1.0/betaGammaSq;
666      x5 = -1.0 - fRePartDielectricConst[i] +      656      x5 = -1.0 - fRePartDielectricConst[i] +
667           be2*((1.0 +fRePartDielectricConst[i]    657           be2*((1.0 +fRePartDielectricConst[i])*(1.0 + fRePartDielectricConst[i]) +
668           fImPartDielectricConst[i]*fImPartDie << 658     fImPartDielectricConst[i]*fImPartDielectricConst[i]);
669      if( x3 == 0.0 ) argument = 0.5*pi;           659      if( x3 == 0.0 ) argument = 0.5*pi;
670      else            argument = std::atan2(fIm << 660      else            argument = atan2(fImPartDielectricConst[i],x3);
671      argument *= x5 ;                             661      argument *= x5 ;
672    }                                              662    }   
673    dNdxC = ( logarithm*fImPartDielectricConst[    663    dNdxC = ( logarithm*fImPartDielectricConst[i] + argument )/hbarc;
674                                                   664   
675    if(dNdxC < 1.0e-8) dNdxC = 1.0e-8;             665    if(dNdxC < 1.0e-8) dNdxC = 1.0e-8;
676                                                   666 
677    dNdxC *= fine_structure_const/be2/pi;          667    dNdxC *= fine_structure_const/be2/pi;
678                                                   668 
679    dNdxC *= (1 - std::exp(-be4/betaBohr4));    << 669    dNdxC *= (1-exp(-be4/betaBohr4));
680                                                   670 
                                                   >> 671    //   if(fDensity >= 0.1)
                                                   >> 672    // { 
681    modul2 = (1.0 + fRePartDielectricConst[i])*    673    modul2 = (1.0 + fRePartDielectricConst[i])*(1.0 + fRePartDielectricConst[i]) + 
682                     fImPartDielectricConst[i]*    674                     fImPartDielectricConst[i]*fImPartDielectricConst[i];
683    if(modul2 > 0.)                                675    if(modul2 > 0.)
684      {                                            676      {
685        dNdxC /= modul2;                           677        dNdxC /= modul2;
686      }                                            678      }
687    return dNdxC;                                  679    return dNdxC;
688                                                   680 
689 } // end of PAIdNdxCerenkov                       681 } // end of PAIdNdxCerenkov 
690                                                   682 
691 //////////////////////////////////////////////    683 //////////////////////////////////////////////////////////////////////////
692 //                                                684 //
693 // Calculation od dN/dx of collisions with cre    685 // Calculation od dN/dx of collisions with creation of longitudinal EM
694 // excitations (plasmons, delta-electrons)        686 // excitations (plasmons, delta-electrons)
695                                                   687 
696 G4double G4PAIySection::PAIdNdxPlasmon( G4int  << 688 G4double G4PAIySection::PAIdNdxPlasmon( G4int    i ,
                                                   >> 689                                         G4double betaGammaSq  )
697 {                                                 690 {        
698    G4double cof, resonance, modul2, dNdxP;        691    G4double cof, resonance, modul2, dNdxP;
699    G4double be2, be4;                          << 692    G4double be2, be4, betaBohr2, betaBohr4, cofBetaBohr;
700                                                   693 
701    cof = 1;                                       694    cof = 1;
                                                   >> 695    cofBetaBohr = 4.0;
                                                   >> 696    betaBohr2   = fine_structure_const*fine_structure_const;
                                                   >> 697    betaBohr4   = betaBohr2*betaBohr2*cofBetaBohr;
702                                                   698 
703    be2 = betaGammaSq/(1 + betaGammaSq);           699    be2 = betaGammaSq/(1 + betaGammaSq);
704    be4 = be2*be2;                                 700    be4 = be2*be2;
705                                                   701  
706    resonance = std::log(2*electron_mass_c2*be2 << 702    resonance = log(2*electron_mass_c2*be2/fSplineEnergy[i]);  
707    resonance *= fImPartDielectricConst[i]/hbar    703    resonance *= fImPartDielectricConst[i]/hbarc;
708                                                   704 
                                                   >> 705 
709    dNdxP = ( resonance + cof*fIntegralTerm[i]/    706    dNdxP = ( resonance + cof*fIntegralTerm[i]/fSplineEnergy[i]/fSplineEnergy[i] );
710                                                   707 
711    dNdxP = std::max(dNdxP, 1.0e-8);            << 708    if( dNdxP < 1.0e-8 ) dNdxP = 1.0e-8;
712                                                   709 
713    dNdxP *= fine_structure_const/be2/pi;          710    dNdxP *= fine_structure_const/be2/pi;
714    dNdxP *= (1 - std::exp(-be4/betaBohr4));    << 711    dNdxP *= (1-exp(-be4/betaBohr4));
715                                                   712 
                                                   >> 713 //   if( fDensity >= 0.1 )
                                                   >> 714 //   { 
716    modul2 = (1 + fRePartDielectricConst[i])*(1    715    modul2 = (1 + fRePartDielectricConst[i])*(1 + fRePartDielectricConst[i]) + 
717      fImPartDielectricConst[i]*fImPartDielectr    716      fImPartDielectricConst[i]*fImPartDielectricConst[i];
718    if(modul2 > 0.)                                717    if(modul2 > 0.)
719      {                                            718      { 
720        dNdxP /= modul2;                           719        dNdxP /= modul2;
721      }                                            720      }
722    return dNdxP;                                  721    return dNdxP;
723                                                   722 
724 } // end of PAIdNdxPlasmon                        723 } // end of PAIdNdxPlasmon 
725                                                   724 
726 //////////////////////////////////////////////    725 ////////////////////////////////////////////////////////////////////////
727 //                                                726 //
728 // Calculation of the PAI integral cross-secti    727 // Calculation of the PAI integral cross-section
729 // fIntegralPAIySection[1] = specific primary     728 // fIntegralPAIySection[1] = specific primary ionisation, 1/cm
730 // and fIntegralPAIySection[0] = mean energy l    729 // and fIntegralPAIySection[0] = mean energy loss per cm  in keV/cm
731                                                   730 
732 void G4PAIySection::IntegralPAIySection()         731 void G4PAIySection::IntegralPAIySection()
733 {                                                 732 {
734   fIntegralPAIySection[fSplineNumber] = 0;        733   fIntegralPAIySection[fSplineNumber] = 0;
735   fIntegralPAIdEdx[fSplineNumber]     = 0;        734   fIntegralPAIdEdx[fSplineNumber]     = 0;
736   fIntegralPAIySection[0]             = 0;        735   fIntegralPAIySection[0]             = 0;
737   G4int k = fIntervalNumber -1;                   736   G4int k = fIntervalNumber -1;
738                                                   737 
739   for(G4int i = fSplineNumber-1; i >= 1; i--)     738   for(G4int i = fSplineNumber-1; i >= 1; i--)
740   {                                               739   {
741     if(fSplineEnergy[i] >= fEnergyInterval[k])    740     if(fSplineEnergy[i] >= fEnergyInterval[k])
742     {                                             741     {
743       fIntegralPAIySection[i] = fIntegralPAIyS    742       fIntegralPAIySection[i] = fIntegralPAIySection[i+1] + SumOverInterval(i);
744       fIntegralPAIdEdx[i] = fIntegralPAIdEdx[i    743       fIntegralPAIdEdx[i] = fIntegralPAIdEdx[i+1] + SumOverIntervaldEdx(i);
745     }                                             744     }
746     else                                          745     else
747     {                                             746     {
748       fIntegralPAIySection[i] = fIntegralPAIyS    747       fIntegralPAIySection[i] = fIntegralPAIySection[i+1] + 
749                                    SumOverBord << 748                              SumOverBorder(i+1,fEnergyInterval[k]);
750       fIntegralPAIdEdx[i] = fIntegralPAIdEdx[i    749       fIntegralPAIdEdx[i] = fIntegralPAIdEdx[i+1] + 
751                                    SumOverBord << 750                              SumOverBorderdEdx(i+1,fEnergyInterval[k]);
752       k--;                                        751       k--;
753     }                                             752     }
754   }                                               753   }
755 }   // end of IntegralPAIySection                 754 }   // end of IntegralPAIySection 
756                                                   755 
757 //////////////////////////////////////////////    756 ////////////////////////////////////////////////////////////////////////
758 //                                                757 //
759 // Calculation of the PAI Cerenkov integral cr    758 // Calculation of the PAI Cerenkov integral cross-section
760 // fIntegralCrenkov[1] = specific Crenkov ioni    759 // fIntegralCrenkov[1] = specific Crenkov ionisation, 1/cm
761 // and fIntegralCerenkov[0] = mean Cerenkov lo    760 // and fIntegralCerenkov[0] = mean Cerenkov loss per cm  in keV/cm
762                                                   761 
763 void G4PAIySection::IntegralCerenkov()            762 void G4PAIySection::IntegralCerenkov()
764 {                                                 763 {
765   G4int i, k;                                     764   G4int i, k;
766    fIntegralCerenkov[fSplineNumber] = 0;          765    fIntegralCerenkov[fSplineNumber] = 0;
767    fIntegralCerenkov[0] = 0;                      766    fIntegralCerenkov[0] = 0;
768    k = fIntervalNumber -1;                        767    k = fIntervalNumber -1;
769                                                   768 
770    for( i = fSplineNumber-1; i >= 1; i-- )        769    for( i = fSplineNumber-1; i >= 1; i-- )
771    {                                              770    {
772       if(fSplineEnergy[i] >= fEnergyInterval[k    771       if(fSplineEnergy[i] >= fEnergyInterval[k])
773       {                                           772       {
774         fIntegralCerenkov[i] = fIntegralCerenk    773         fIntegralCerenkov[i] = fIntegralCerenkov[i+1] + SumOverInterCerenkov(i);
775         // G4cout<<"int: i = "<<i<<"; sumC = " << 774   // G4cout<<"int: i = "<<i<<"; sumC = "<<fIntegralCerenkov[i]<<G4endl;
776       }                                           775       }
777       else                                        776       else
778       {                                           777       {
779         fIntegralCerenkov[i] = fIntegralCerenk    778         fIntegralCerenkov[i] = fIntegralCerenkov[i+1] + 
780                                    SumOverBord << 779                              SumOverBordCerenkov(i+1,fEnergyInterval[k]);
781         k--;                                   << 780   k--;
782         // G4cout<<"bord: i = "<<i<<"; sumC =  << 781   // G4cout<<"bord: i = "<<i<<"; sumC = "<<fIntegralCerenkov[i]<<G4endl;
783       }                                           782       }
784    }                                              783    }
785                                                   784 
786 }   // end of IntegralCerenkov                    785 }   // end of IntegralCerenkov 
787                                                   786 
788 //////////////////////////////////////////////    787 ////////////////////////////////////////////////////////////////////////
789 //                                                788 //
790 // Calculation of the PAI Plasmon integral cro    789 // Calculation of the PAI Plasmon integral cross-section
791 // fIntegralPlasmon[1] = splasmon primary ioni    790 // fIntegralPlasmon[1] = splasmon primary ionisation, 1/cm
792 // and fIntegralPlasmon[0] = mean plasmon loss    791 // and fIntegralPlasmon[0] = mean plasmon loss per cm  in keV/cm
793                                                   792 
794 void G4PAIySection::IntegralPlasmon()             793 void G4PAIySection::IntegralPlasmon()
795 {                                                 794 {
796    fIntegralPlasmon[fSplineNumber] = 0;           795    fIntegralPlasmon[fSplineNumber] = 0;
797    fIntegralPlasmon[0] = 0;                       796    fIntegralPlasmon[0] = 0;
798    G4int k = fIntervalNumber -1;                  797    G4int k = fIntervalNumber -1;
799    for(G4int i=fSplineNumber-1;i>=1;i--)          798    for(G4int i=fSplineNumber-1;i>=1;i--)
800    {                                              799    {
801       if(fSplineEnergy[i] >= fEnergyInterval[k    800       if(fSplineEnergy[i] >= fEnergyInterval[k])
802       {                                           801       {
803         fIntegralPlasmon[i] = fIntegralPlasmon    802         fIntegralPlasmon[i] = fIntegralPlasmon[i+1] + SumOverInterPlasmon(i);
804       }                                           803       }
805       else                                        804       else
806       {                                           805       {
807         fIntegralPlasmon[i] = fIntegralPlasmon    806         fIntegralPlasmon[i] = fIntegralPlasmon[i+1] + 
808                                    SumOverBord << 807                              SumOverBordPlasmon(i+1,fEnergyInterval[k]);
809         k--;                                   << 808   k--;
810       }                                           809       }
811    }                                              810    }
                                                   >> 811 
812 }   // end of IntegralPlasmon                     812 }   // end of IntegralPlasmon
813                                                   813 
814 //////////////////////////////////////////////    814 //////////////////////////////////////////////////////////////////////
815 //                                                815 //
816 // Calculation the PAI integral cross-section     816 // Calculation the PAI integral cross-section inside
817 // of interval of continuous values of photo-i    817 // of interval of continuous values of photo-ionisation
818 // cross-section. Parameter  'i' is the number    818 // cross-section. Parameter  'i' is the number of interval.
819                                                   819 
820 G4double G4PAIySection::SumOverInterval( G4int    820 G4double G4PAIySection::SumOverInterval( G4int i )
821 {                                                 821 {         
822    G4double x0,x1,y0,yy1,a,b,c,result;            822    G4double x0,x1,y0,yy1,a,b,c,result;
823                                                   823 
824    x0 = fSplineEnergy[i];                         824    x0 = fSplineEnergy[i];
825    x1 = fSplineEnergy[i+1];                       825    x1 = fSplineEnergy[i+1];
826                                                << 
827    if( std::abs( 2.*(x1-x0)/(x1+x0) ) < 1.e-6) << 
828                                                << 
829    y0 = fDifPAIySection[i];                       826    y0 = fDifPAIySection[i];
830    yy1 = fDifPAIySection[i+1];                    827    yy1 = fDifPAIySection[i+1];
831    //G4cout << "## x0= " << x0 << " x1= " << x << 
832    c = x1/x0;                                     828    c = x1/x0;
833    //G4cout << "c= " << c << " y0= " << y0 <<  << 
834    a = log10(yy1/y0)/log10(c);                    829    a = log10(yy1/y0)/log10(c);
835    //G4cout << "a= " << a << G4endl;           << 830    // b = log10(y0) - a*log10(x0);
836                                                << 831    b = y0/pow(x0,a);
837    b = 0.0;                                    << 
838    if(a < 20.) b = y0/pow(x0,a);               << 
839                                                << 
840    a += 1;                                        832    a += 1;
841    if(a == 0)                                     833    if(a == 0) 
842    {                                              834    {
843       result = b*log(x1/x0);                      835       result = b*log(x1/x0);
844    }                                              836    }
845    else                                           837    else
846    {                                              838    {
847       result = y0*(x1*pow(c,a-1) - x0)/a;         839       result = y0*(x1*pow(c,a-1) - x0)/a;
848    }                                              840    }
849    a++;                                           841    a++;
850    if(a == 0)                                     842    if(a == 0) 
851    {                                              843    {
852       fIntegralPAIySection[0] += b*log(x1/x0);    844       fIntegralPAIySection[0] += b*log(x1/x0);
853    }                                              845    }
854    else                                           846    else
855    {                                              847    {
856       fIntegralPAIySection[0] += y0*(x1*x1*pow    848       fIntegralPAIySection[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
857    }                                              849    }
858    return result;                                 850    return result;
859                                                   851 
860 } //  end of SumOverInterval                      852 } //  end of SumOverInterval
861                                                   853 
862 /////////////////////////////////                 854 /////////////////////////////////
863                                                   855 
864 G4double G4PAIySection::SumOverIntervaldEdx( G    856 G4double G4PAIySection::SumOverIntervaldEdx( G4int i )
865 {                                                 857 {         
866    G4double x0,x1,y0,yy1,a,b,c,result;            858    G4double x0,x1,y0,yy1,a,b,c,result;
867                                                   859 
868    x0 = fSplineEnergy[i];                         860    x0 = fSplineEnergy[i];
869    x1 = fSplineEnergy[i+1];                       861    x1 = fSplineEnergy[i+1];
870                                                << 
871    if( std::abs( 2.*(x1-x0)/(x1+x0) ) < 1.e-6) << 
872                                                << 
873    y0 = fDifPAIySection[i];                       862    y0 = fDifPAIySection[i];
874    yy1 = fDifPAIySection[i+1];                    863    yy1 = fDifPAIySection[i+1];
875    c = x1/x0;                                     864    c = x1/x0;
876    a = log10(yy1/y0)/log10(c);                    865    a = log10(yy1/y0)/log10(c);
877                                                << 866    // b = log10(y0) - a*log10(x0);
878    b = 0.0;                                    << 867    b = y0/pow(x0,a);
879    if(a < 20.) b = y0/pow(x0,a);               << 
880                                                << 
881    a += 2;                                        868    a += 2;
882    if(a == 0)                                     869    if(a == 0) 
883    {                                              870    {
884      result = b*log(x1/x0);                       871      result = b*log(x1/x0);
885    }                                              872    }
886    else                                           873    else
887    {                                              874    {
888      result = y0*(x1*x1*pow(c,a-2) - x0*x0)/a;    875      result = y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
889    }                                              876    }
890    return result;                                 877    return result;
891                                                   878 
892 } //  end of SumOverInterval                      879 } //  end of SumOverInterval
893                                                   880 
894 //////////////////////////////////////////////    881 //////////////////////////////////////////////////////////////////////
895 //                                                882 //
896 // Calculation the PAI Cerenkov integral cross    883 // Calculation the PAI Cerenkov integral cross-section inside
897 // of interval of continuous values of photo-i    884 // of interval of continuous values of photo-ionisation Cerenkov
898 // cross-section. Parameter  'i' is the number    885 // cross-section. Parameter  'i' is the number of interval.
899                                                   886 
900 G4double G4PAIySection::SumOverInterCerenkov(     887 G4double G4PAIySection::SumOverInterCerenkov( G4int i )
901 {                                                 888 {         
902    G4double x0,x1,y0,yy1,a,c,result;              889    G4double x0,x1,y0,yy1,a,c,result;
903                                                   890 
904    x0  = fSplineEnergy[i];                        891    x0  = fSplineEnergy[i];
905    x1  = fSplineEnergy[i+1];                      892    x1  = fSplineEnergy[i+1];
906                                                << 
907    if( std::abs( 2.*(x1-x0)/(x1+x0) ) < 1.e-6) << 
908                                                << 
909    y0  = fdNdxCerenkov[i];                        893    y0  = fdNdxCerenkov[i];
910    yy1 = fdNdxCerenkov[i+1];                      894    yy1 = fdNdxCerenkov[i+1];
911    // G4cout<<"SumC, i = "<<i<<"; x0 ="<<x0<<"    895    // G4cout<<"SumC, i = "<<i<<"; x0 ="<<x0<<"; x1 = "<<x1
912    //   <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4en    896    //   <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4endl;
913                                                   897 
914    c = x1/x0;                                     898    c = x1/x0;
915    a = log10(yy1/y0)/log10(c);                    899    a = log10(yy1/y0)/log10(c);
916    G4double b = 0.0;                              900    G4double b = 0.0;
917    if(a < 20.) b = y0/pow(x0,a);                  901    if(a < 20.) b = y0/pow(x0,a);
918                                                   902 
919    a += 1.0;                                      903    a += 1.0;
920    if(a == 0) result = b*log(c);                  904    if(a == 0) result = b*log(c);
921    else       result = y0*(x1*pow(c,a-1) - x0)    905    else       result = y0*(x1*pow(c,a-1) - x0)/a;   
922    a += 1.0;                                      906    a += 1.0;
923                                                   907 
924    if( a == 0 ) fIntegralCerenkov[0] += b*log(    908    if( a == 0 ) fIntegralCerenkov[0] += b*log(x1/x0);
925    else         fIntegralCerenkov[0] += y0*(x1    909    else         fIntegralCerenkov[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
926    //  G4cout<<"a = "<<a<<"; b = "<<b<<"; resu    910    //  G4cout<<"a = "<<a<<"; b = "<<b<<"; result = "<<result<<G4endl;   
927    return result;                                 911    return result;
928                                                   912 
929 } //  end of SumOverInterCerenkov                 913 } //  end of SumOverInterCerenkov
930                                                   914 
931 //////////////////////////////////////////////    915 //////////////////////////////////////////////////////////////////////
932 //                                                916 //
933 // Calculation the PAI Plasmon integral cross-    917 // Calculation the PAI Plasmon integral cross-section inside
934 // of interval of continuous values of photo-i    918 // of interval of continuous values of photo-ionisation Plasmon
935 // cross-section. Parameter  'i' is the number    919 // cross-section. Parameter  'i' is the number of interval.
936                                                   920 
937 G4double G4PAIySection::SumOverInterPlasmon( G    921 G4double G4PAIySection::SumOverInterPlasmon( G4int i )
938 {                                                 922 {         
939   G4double x0,x1,y0,yy1,a,c,result;               923   G4double x0,x1,y0,yy1,a,c,result;
940                                                   924 
941    x0  = fSplineEnergy[i];                        925    x0  = fSplineEnergy[i];
942    x1  = fSplineEnergy[i+1];                      926    x1  = fSplineEnergy[i+1];
943                                                << 
944    if( std::abs( 2.*(x1-x0)/(x1+x0) ) < 1.e-6) << 
945                                                << 
946    y0  = fdNdxPlasmon[i];                         927    y0  = fdNdxPlasmon[i];
947    yy1 = fdNdxPlasmon[i+1];                       928    yy1 = fdNdxPlasmon[i+1];
948    c = x1/x0;                                     929    c = x1/x0;
949    a = log10(yy1/y0)/log10(c);                    930    a = log10(yy1/y0)/log10(c);
950                                                   931 
951    G4double b = 0.0;                              932    G4double b = 0.0;
952    if(a < 20.) b = y0/pow(x0,a);                  933    if(a < 20.) b = y0/pow(x0,a);
953                                                   934 
954    a += 1.0;                                      935    a += 1.0;
955    if(a == 0) result = b*log(x1/x0);              936    if(a == 0) result = b*log(x1/x0);
956    else       result = y0*(x1*pow(c,a-1) - x0)    937    else       result = y0*(x1*pow(c,a-1) - x0)/a;   
957    a += 1.0;                                      938    a += 1.0;
958                                                   939 
959    if( a == 0 ) fIntegralPlasmon[0] += b*log(x    940    if( a == 0 ) fIntegralPlasmon[0] += b*log(x1/x0);
960    else         fIntegralPlasmon[0] += y0*(x1*    941    else         fIntegralPlasmon[0] += y0*(x1*x1*pow(c,a-2) - x0*x0)/a;
961                                                   942    
962    return result;                                 943    return result;
963                                                   944 
964 } //  end of SumOverInterPlasmon                  945 } //  end of SumOverInterPlasmon
965                                                   946 
966 //////////////////////////////////////////////    947 ///////////////////////////////////////////////////////////////////////////////
967 //                                                948 //
968 // Integration of PAI cross-section for the ca    949 // Integration of PAI cross-section for the case of
969 // passing across border between intervals        950 // passing across border between intervals
970                                                   951 
971 G4double G4PAIySection::SumOverBorder( G4int      952 G4double G4PAIySection::SumOverBorder( G4int      i , 
972                                        G4doubl    953                                        G4double en0    )
973 {                                                 954 {               
974   G4double x0,x1,y0,yy1,a,d,e0,result;         << 955   G4double x0,x1,y0,yy1,a,/*c,*/d,e0,result;
975                                                   956 
976    e0 = en0;                                      957    e0 = en0;
977    x0 = fSplineEnergy[i];                         958    x0 = fSplineEnergy[i];
978    x1 = fSplineEnergy[i+1];                       959    x1 = fSplineEnergy[i+1];
979    y0 = fDifPAIySection[i];                       960    y0 = fDifPAIySection[i];
980    yy1 = fDifPAIySection[i+1];                    961    yy1 = fDifPAIySection[i+1];
981                                                   962 
                                                   >> 963    //c = x1/x0;
982    d = e0/x0;                                     964    d = e0/x0;   
983    a = log10(yy1/y0)/log10(x1/x0);                965    a = log10(yy1/y0)/log10(x1/x0);
984                                                   966 
985    G4double b = 0.0;                              967    G4double b = 0.0;
986    if(a < 20.) b = y0/pow(x0,a);                  968    if(a < 20.) b = y0/pow(x0,a);
987                                                   969    
988    a += 1;                                        970    a += 1;
989    if(a == 0)                                     971    if(a == 0)
990    {                                              972    {
991       result = b*log(x0/e0);                      973       result = b*log(x0/e0);
992    }                                              974    }
993    else                                           975    else
994    {                                              976    {
995       result = y0*(x0 - e0*pow(d,a-1))/a;         977       result = y0*(x0 - e0*pow(d,a-1))/a;
996    }                                              978    }
997    a++;                                           979    a++;
998    if(a == 0)                                     980    if(a == 0)
999    {                                              981    {
1000       fIntegralPAIySection[0] += b*log(x0/e0)    982       fIntegralPAIySection[0] += b*log(x0/e0);
1001    }                                             983    }
1002    else                                          984    else 
1003    {                                             985    {
1004       fIntegralPAIySection[0] += y0*(x0*x0 -     986       fIntegralPAIySection[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
1005    }                                             987    }
1006    x0 = fSplineEnergy[i - 1];                    988    x0 = fSplineEnergy[i - 1];
1007    x1 = fSplineEnergy[i - 2];                    989    x1 = fSplineEnergy[i - 2];
1008    y0 = fDifPAIySection[i - 1];                  990    y0 = fDifPAIySection[i - 1];
1009    yy1 = fDifPAIySection[i - 2];                 991    yy1 = fDifPAIySection[i - 2];
1010                                                  992 
1011    //c = x1/x0;                                  993    //c = x1/x0;
1012    d = e0/x0;                                    994    d = e0/x0;   
1013    a = log10(yy1/y0)/log10(x1/x0);               995    a = log10(yy1/y0)/log10(x1/x0);
1014                                               << 996    //  b0 = log10(y0) - a*log10(x0);
1015    b = 0.0;                                   << 997    b = y0/pow(x0,a);
1016    if(a < 20.) b = y0/pow(x0,a);              << 
1017                                               << 
1018    a += 1;                                       998    a += 1;
1019    if(a == 0)                                    999    if(a == 0)
1020    {                                             1000    {
1021       result += b*log(e0/x0);                    1001       result += b*log(e0/x0);
1022    }                                             1002    }
1023    else                                          1003    else
1024    {                                             1004    {
1025       result += y0*(e0*pow(d,a-1) - x0)/a;       1005       result += y0*(e0*pow(d,a-1) - x0)/a;
1026    }                                             1006    }
1027    a++;                                          1007    a++;
1028    if(a == 0)                                    1008    if(a == 0) 
1029    {                                             1009    {
1030       fIntegralPAIySection[0] += b*log(e0/x0)    1010       fIntegralPAIySection[0] += b*log(e0/x0);
1031    }                                             1011    }
1032    else                                          1012    else
1033    {                                             1013    {
1034       fIntegralPAIySection[0] += y0*(e0*e0*po    1014       fIntegralPAIySection[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
1035    }                                             1015    }
1036    return result;                                1016    return result;
1037                                                  1017 
1038 }                                                1018 } 
1039                                                  1019 
1040 /////////////////////////////////////////////    1020 ///////////////////////////////////////////////////////////////////////
1041                                                  1021 
1042 G4double G4PAIySection::SumOverBorderdEdx( G4    1022 G4double G4PAIySection::SumOverBorderdEdx( G4int      i , 
1043                                        G4doub    1023                                        G4double en0    )
1044 {                                                1024 {               
1045   G4double x0,x1,y0,yy1,a,/*c,*/d,e0,result;     1025   G4double x0,x1,y0,yy1,a,/*c,*/d,e0,result;
1046                                                  1026 
1047    e0 = en0;                                     1027    e0 = en0;
1048    x0 = fSplineEnergy[i];                        1028    x0 = fSplineEnergy[i];
1049    x1 = fSplineEnergy[i+1];                      1029    x1 = fSplineEnergy[i+1];
1050    y0 = fDifPAIySection[i];                      1030    y0 = fDifPAIySection[i];
1051    yy1 = fDifPAIySection[i+1];                   1031    yy1 = fDifPAIySection[i+1];
1052                                                  1032 
                                                   >> 1033    //c = x1/x0;
1053    d = e0/x0;                                    1034    d = e0/x0;   
1054    a = log10(yy1/y0)/log10(x1/x0);               1035    a = log10(yy1/y0)/log10(x1/x0);
1055                                                  1036    
1056    G4double b = 0.0;                             1037    G4double b = 0.0;
1057    if(a < 20.) b = y0/pow(x0,a);                 1038    if(a < 20.) b = y0/pow(x0,a);
1058                                                  1039    
1059    a += 2;                                       1040    a += 2;
1060    if(a == 0)                                    1041    if(a == 0)
1061    {                                             1042    {
1062       result = b*log(x0/e0);                     1043       result = b*log(x0/e0);
1063    }                                             1044    }
1064    else                                          1045    else 
1065    {                                             1046    {
1066       result = y0*(x0*x0 - e0*e0*pow(d,a-2))/    1047       result = y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
1067    }                                             1048    }
1068    x0 = fSplineEnergy[i - 1];                    1049    x0 = fSplineEnergy[i - 1];
1069    x1 = fSplineEnergy[i - 2];                    1050    x1 = fSplineEnergy[i - 2];
1070    y0 = fDifPAIySection[i - 1];                  1051    y0 = fDifPAIySection[i - 1];
1071    yy1 = fDifPAIySection[i - 2];                 1052    yy1 = fDifPAIySection[i - 2];
1072                                                  1053 
                                                   >> 1054    //c = x1/x0;
1073    d = e0/x0;                                    1055    d = e0/x0;   
1074    a = log10(yy1/y0)/log10(x1/x0);               1056    a = log10(yy1/y0)/log10(x1/x0);
1075                                                  1057 
1076    b = 0.0;                                   << 
1077    if(a < 20.) b = y0/pow(x0,a);                 1058    if(a < 20.) b = y0/pow(x0,a);
1078                                                  1059 
1079    a += 2;                                       1060    a += 2;
1080    if(a == 0)                                    1061    if(a == 0) 
1081    {                                             1062    {
1082       result += b*log(e0/x0);                    1063       result += b*log(e0/x0);
1083    }                                             1064    }
1084    else                                          1065    else
1085    {                                             1066    {
1086       result += y0*(e0*e0*pow(d,a-2) - x0*x0)    1067       result += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
1087    }                                             1068    }
1088    return result;                                1069    return result;
                                                   >> 1070 
1089 }                                                1071 } 
1090                                                  1072 
1091 /////////////////////////////////////////////    1073 ///////////////////////////////////////////////////////////////////////////////
1092 //                                               1074 //
1093 // Integration of Cerenkov cross-section for     1075 // Integration of Cerenkov cross-section for the case of
1094 // passing across border between intervals       1076 // passing across border between intervals
1095                                                  1077 
1096 G4double G4PAIySection::SumOverBordCerenkov(     1078 G4double G4PAIySection::SumOverBordCerenkov( G4int      i , 
1097                                                  1079                                              G4double en0    )
1098 {                                                1080 {               
1099    G4double x0,x1,y0,yy1,a,e0,c,d,result;        1081    G4double x0,x1,y0,yy1,a,e0,c,d,result;
1100                                                  1082 
1101    e0 = en0;                                     1083    e0 = en0;
1102    x0 = fSplineEnergy[i];                        1084    x0 = fSplineEnergy[i];
1103    x1 = fSplineEnergy[i+1];                      1085    x1 = fSplineEnergy[i+1];
1104    y0 = fdNdxCerenkov[i];                        1086    y0 = fdNdxCerenkov[i];
1105    yy1 = fdNdxCerenkov[i+1];                     1087    yy1 = fdNdxCerenkov[i+1];
1106                                                  1088 
1107    //  G4cout<<G4endl;                           1089    //  G4cout<<G4endl;
1108    //G4cout<<"SumBordC, i = "<<i<<"; en0 = "<    1090    //G4cout<<"SumBordC, i = "<<i<<"; en0 = "<<en0<<"; x0 ="<<x0<<"; x1 = "<<x1
1109    //     <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G    1091    //     <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4endl;
1110    c = x1/x0;                                    1092    c = x1/x0;
1111    d = e0/x0;                                    1093    d = e0/x0;
1112    a = log10(yy1/y0)/log10(c);                   1094    a = log10(yy1/y0)/log10(c);
1113                                                  1095  
1114    G4double b = 0.0;                             1096    G4double b = 0.0;
1115    if(a < 20.) b = y0/pow(x0,a);                 1097    if(a < 20.) b = y0/pow(x0,a);
1116                                                  1098    
1117    a += 1.0;                                     1099    a += 1.0;
1118    if( a == 0 ) result = b*log(x0/e0);           1100    if( a == 0 ) result = b*log(x0/e0);
1119    else         result = y0*(x0 - e0*pow(d,a-    1101    else         result = y0*(x0 - e0*pow(d,a-1))/a;   
1120    a += 1.0;                                     1102    a += 1.0;
1121                                                  1103 
1122    if( a == 0 ) fIntegralCerenkov[0] += b*log    1104    if( a == 0 ) fIntegralCerenkov[0] += b*log(x0/e0);
1123    else         fIntegralCerenkov[0] += y0*(x    1105    else         fIntegralCerenkov[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
1124                                                  1106 
1125    //G4cout<<"a = "<<a<<"; b = "<<b<<"; resul    1107    //G4cout<<"a = "<<a<<"; b = "<<b<<"; result = "<<result<<G4endl;
1126                                                  1108    
1127    x0  = fSplineEnergy[i - 1];                   1109    x0  = fSplineEnergy[i - 1];
1128    x1  = fSplineEnergy[i - 2];                   1110    x1  = fSplineEnergy[i - 2];
1129    y0  = fdNdxCerenkov[i - 1];                   1111    y0  = fdNdxCerenkov[i - 1];
1130    yy1 = fdNdxCerenkov[i - 2];                   1112    yy1 = fdNdxCerenkov[i - 2];
1131                                                  1113 
1132    //G4cout<<"x0 ="<<x0<<"; x1 = "<<x1           1114    //G4cout<<"x0 ="<<x0<<"; x1 = "<<x1
1133    //    <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4    1115    //    <<"; y0 = "<<y0<<"; yy1 = "<<yy1<<G4endl;
1134                                                  1116 
1135    c = x1/x0;                                    1117    c = x1/x0;
1136    d = e0/x0;                                    1118    d = e0/x0;
1137    a  = log10(yy1/y0)/log10(x1/x0);              1119    a  = log10(yy1/y0)/log10(x1/x0);
1138                                                  1120   
1139    //   G4cout << "a= " << a << G4endl;          1121    //   G4cout << "a= " << a << G4endl;
                                                   >> 1122    if(a < 20.) b = y0/pow(x0,a);
                                                   >> 1123 
1140    if(a > 20.0) b = 0.0;                         1124    if(a > 20.0) b = 0.0;
1141    else         b = y0/pow(x0,a);             << 1125    else         b = y0/pow(x0,a);  // pow(10.,b0);
1142                                                  1126 
1143    //G4cout << "b= " << b << G4endl;             1127    //G4cout << "b= " << b << G4endl;
1144                                                  1128 
1145    a += 1.0;                                     1129    a += 1.0;
1146    if( a == 0 ) result += b*log(e0/x0);          1130    if( a == 0 ) result += b*log(e0/x0);
1147    else         result += y0*(e0*pow(d,a-1) -    1131    else         result += y0*(e0*pow(d,a-1) - x0 )/a;
1148    a += 1.0;                                     1132    a += 1.0;
1149    //G4cout << "result= " << result << G4endl    1133    //G4cout << "result= " << result << G4endl;
1150                                                  1134 
1151    if( a == 0 )   fIntegralCerenkov[0] += b*l    1135    if( a == 0 )   fIntegralCerenkov[0] += b*log(e0/x0);
1152    else           fIntegralCerenkov[0] += y0*    1136    else           fIntegralCerenkov[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
1153                                                  1137 
1154    //G4cout<<"a = "<<a<<"; b = "<<b<<"; resul    1138    //G4cout<<"a = "<<a<<"; b = "<<b<<"; result = "<<result<<G4endl;    
1155                                                  1139 
1156    return result;                                1140    return result;
                                                   >> 1141 
1157 }                                                1142 } 
1158                                                  1143 
1159 /////////////////////////////////////////////    1144 ///////////////////////////////////////////////////////////////////////////////
1160 //                                               1145 //
1161 // Integration of Plasmon cross-section for t    1146 // Integration of Plasmon cross-section for the case of
1162 // passing across border between intervals       1147 // passing across border between intervals
1163                                                  1148 
1164 G4double G4PAIySection::SumOverBordPlasmon( G    1149 G4double G4PAIySection::SumOverBordPlasmon( G4int      i , 
1165                                                  1150                                              G4double en0    )
1166 {                                                1151 {               
1167    G4double x0,x1,y0,yy1,a,c,d,e0,result;        1152    G4double x0,x1,y0,yy1,a,c,d,e0,result;
1168                                                  1153 
1169    e0 = en0;                                     1154    e0 = en0;
1170    x0 = fSplineEnergy[i];                        1155    x0 = fSplineEnergy[i];
1171    x1 = fSplineEnergy[i+1];                      1156    x1 = fSplineEnergy[i+1];
1172    y0 = fdNdxPlasmon[i];                         1157    y0 = fdNdxPlasmon[i];
1173    yy1 = fdNdxPlasmon[i+1];                      1158    yy1 = fdNdxPlasmon[i+1];
1174                                                  1159 
1175    c = x1/x0;                                    1160    c = x1/x0;
1176    d = e0/x0;                                    1161    d = e0/x0;   
1177    a = log10(yy1/y0)/log10(c);                   1162    a = log10(yy1/y0)/log10(c);
1178                                                  1163 
1179    G4double b = 0.0;                             1164    G4double b = 0.0;
1180    if(a < 20.) b = y0/pow(x0,a);                 1165    if(a < 20.) b = y0/pow(x0,a);
1181                                                  1166    
1182    a += 1.0;                                     1167    a += 1.0;
1183    if( a == 0 ) result = b*log(x0/e0);           1168    if( a == 0 ) result = b*log(x0/e0);
1184    else         result = y0*(x0 - e0*pow(d,a-    1169    else         result = y0*(x0 - e0*pow(d,a-1))/a;   
1185    a += 1.0;                                     1170    a += 1.0;
1186                                                  1171 
1187    if( a == 0 ) fIntegralPlasmon[0] += b*log(    1172    if( a == 0 ) fIntegralPlasmon[0] += b*log(x0/e0);
1188    else         fIntegralPlasmon[0] += y0*(x0    1173    else         fIntegralPlasmon[0] += y0*(x0*x0 - e0*e0*pow(d,a-2))/a;
1189                                                  1174    
1190    x0 = fSplineEnergy[i - 1];                    1175    x0 = fSplineEnergy[i - 1];
1191    x1 = fSplineEnergy[i - 2];                    1176    x1 = fSplineEnergy[i - 2];
1192    y0 = fdNdxPlasmon[i - 1];                     1177    y0 = fdNdxPlasmon[i - 1];
1193    yy1 = fdNdxPlasmon[i - 2];                    1178    yy1 = fdNdxPlasmon[i - 2];
1194                                                  1179 
1195    c = x1/x0;                                    1180    c = x1/x0;
1196    d = e0/x0;                                    1181    d = e0/x0;
1197    a = log10(yy1/y0)/log10(c);                   1182    a = log10(yy1/y0)/log10(c);
1198                                                  1183  
1199    if(a < 20.) b = y0/pow(x0,a);                 1184    if(a < 20.) b = y0/pow(x0,a);
1200                                                  1185 
1201    a += 1.0;                                     1186    a += 1.0;
1202    if( a == 0 ) result += b*log(e0/x0);          1187    if( a == 0 ) result += b*log(e0/x0);
1203    else         result += y0*(e0*pow(d,a-1) -    1188    else         result += y0*(e0*pow(d,a-1) - x0)/a;
1204    a += 1.0;                                     1189    a += 1.0;
1205                                                  1190 
1206    if( a == 0 )   fIntegralPlasmon[0] += b*lo    1191    if( a == 0 )   fIntegralPlasmon[0] += b*log(e0/x0);
1207    else           fIntegralPlasmon[0] += y0*(    1192    else           fIntegralPlasmon[0] += y0*(e0*e0*pow(d,a-2) - x0*x0)/a;
1208                                                  1193    
1209    return result;                                1194    return result;
1210                                                  1195 
1211 }                                                1196 } 
1212                                                  1197 
1213 /////////////////////////////////////////////    1198 /////////////////////////////////////////////////////////////////////////
1214 //                                               1199 //
1215 //                                               1200 //
1216                                                  1201 
1217 G4double G4PAIySection::GetStepEnergyLoss( G4    1202 G4double G4PAIySection::GetStepEnergyLoss( G4double step )
1218 {                                                1203 {  
1219   G4int iTransfer ;                              1204   G4int iTransfer ;
1220   G4long numOfCollisions;                        1205   G4long numOfCollisions;
1221   G4double loss = 0.0;                           1206   G4double loss = 0.0;
1222   G4double meanNumber, position;                 1207   G4double meanNumber, position;
1223                                                  1208 
1224   // G4cout<<" G4PAIySection::GetStepEnergyLo    1209   // G4cout<<" G4PAIySection::GetStepEnergyLoss "<<G4endl;
1225                                                  1210 
1226                                                  1211 
1227                                                  1212 
1228   meanNumber = fIntegralPAIySection[1]*step;     1213   meanNumber = fIntegralPAIySection[1]*step;
1229   numOfCollisions = G4Poisson(meanNumber);       1214   numOfCollisions = G4Poisson(meanNumber);
1230                                                  1215 
1231   //   G4cout<<"numOfCollisions = "<<numOfCol    1216   //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl;
1232                                                  1217 
1233   while(numOfCollisions)                         1218   while(numOfCollisions)
1234   {                                              1219   {
1235     position = fIntegralPAIySection[1]*G4Unif    1220     position = fIntegralPAIySection[1]*G4UniformRand();
1236                                                  1221 
1237     for( iTransfer=1; iTransfer<=fSplineNumbe    1222     for( iTransfer=1; iTransfer<=fSplineNumber; iTransfer++ )
1238     {                                            1223     {
1239         if( position >= fIntegralPAIySection[    1224         if( position >= fIntegralPAIySection[iTransfer] ) break;
1240     }                                            1225     }
1241     loss += fSplineEnergy[iTransfer] ;           1226     loss += fSplineEnergy[iTransfer] ;
1242     numOfCollisions--;                           1227     numOfCollisions--;
1243     // Loop checking, 03-Aug-2015, Vladimir I << 
1244   }                                              1228   }
1245   // G4cout<<"PAI energy loss = "<<loss/keV<<    1229   // G4cout<<"PAI energy loss = "<<loss/keV<<" keV"<<G4endl; 
1246                                                  1230 
1247   return loss;                                   1231   return loss;
1248 }                                                1232 }
1249                                                  1233 
1250 /////////////////////////////////////////////    1234 /////////////////////////////////////////////////////////////////////////
1251 //                                               1235 //
1252 //                                               1236 //
1253                                                  1237 
1254 G4double G4PAIySection::GetStepCerenkovLoss(     1238 G4double G4PAIySection::GetStepCerenkovLoss( G4double step )
1255 {                                                1239 {  
1256   G4int iTransfer ;                              1240   G4int iTransfer ;
1257   G4long numOfCollisions;                        1241   G4long numOfCollisions;
1258   G4double loss = 0.0;                           1242   G4double loss = 0.0;
1259   G4double meanNumber, position;                 1243   G4double meanNumber, position;
1260                                                  1244 
1261   // G4cout<<" G4PAIySection::GetStepCreLosnk    1245   // G4cout<<" G4PAIySection::GetStepCreLosnkovs "<<G4endl;
1262                                                  1246 
1263                                                  1247 
1264                                                  1248 
1265   meanNumber = fIntegralCerenkov[1]*step;        1249   meanNumber = fIntegralCerenkov[1]*step;
1266   numOfCollisions = G4Poisson(meanNumber);       1250   numOfCollisions = G4Poisson(meanNumber);
1267                                                  1251 
1268   //   G4cout<<"numOfCollisions = "<<numOfCol    1252   //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl;
1269                                                  1253 
1270   while(numOfCollisions)                         1254   while(numOfCollisions)
1271   {                                              1255   {
1272     position = fIntegralCerenkov[1]*G4Uniform    1256     position = fIntegralCerenkov[1]*G4UniformRand();
1273                                                  1257 
1274     for( iTransfer=1; iTransfer<=fSplineNumbe    1258     for( iTransfer=1; iTransfer<=fSplineNumber; iTransfer++ )
1275     {                                            1259     {
1276         if( position >= fIntegralCerenkov[iTr    1260         if( position >= fIntegralCerenkov[iTransfer] ) break;
1277     }                                            1261     }
1278     loss += fSplineEnergy[iTransfer] ;           1262     loss += fSplineEnergy[iTransfer] ;
1279     numOfCollisions--;                           1263     numOfCollisions--;
1280     // Loop checking, 03-Aug-2015, Vladimir I << 
1281   }                                              1264   }
1282   // G4cout<<"PAI Cerenkov loss = "<<loss/keV    1265   // G4cout<<"PAI Cerenkov loss = "<<loss/keV<<" keV"<<G4endl; 
1283                                                  1266 
1284   return loss;                                   1267   return loss;
1285 }                                                1268 }
1286                                                  1269 
1287 /////////////////////////////////////////////    1270 /////////////////////////////////////////////////////////////////////////
1288 //                                               1271 //
1289 //                                               1272 //
1290                                                  1273 
1291 G4double G4PAIySection::GetStepPlasmonLoss( G    1274 G4double G4PAIySection::GetStepPlasmonLoss( G4double step )
1292 {                                                1275 {  
1293   G4int iTransfer ;                              1276   G4int iTransfer ;
1294   G4long numOfCollisions;                        1277   G4long numOfCollisions;
1295   G4double loss = 0.0;                           1278   G4double loss = 0.0;
1296   G4double meanNumber, position;                 1279   G4double meanNumber, position;
1297                                                  1280 
1298   // G4cout<<" G4PAIySection::GetStepCreLosnk    1281   // G4cout<<" G4PAIySection::GetStepCreLosnkovs "<<G4endl;
1299                                                  1282 
1300                                                  1283 
1301                                                  1284 
1302   meanNumber = fIntegralPlasmon[1]*step;         1285   meanNumber = fIntegralPlasmon[1]*step;
1303   numOfCollisions = G4Poisson(meanNumber);       1286   numOfCollisions = G4Poisson(meanNumber);
1304                                                  1287 
1305   //   G4cout<<"numOfCollisions = "<<numOfCol    1288   //   G4cout<<"numOfCollisions = "<<numOfCollisions<<G4endl;
1306                                                  1289 
1307   while(numOfCollisions)                         1290   while(numOfCollisions)
1308   {                                              1291   {
1309     position = fIntegralPlasmon[1]*G4UniformR    1292     position = fIntegralPlasmon[1]*G4UniformRand();
1310                                                  1293 
1311     for( iTransfer=1; iTransfer<=fSplineNumbe    1294     for( iTransfer=1; iTransfer<=fSplineNumber; iTransfer++ )
1312     {                                            1295     {
1313         if( position >= fIntegralPlasmon[iTra    1296         if( position >= fIntegralPlasmon[iTransfer] ) break;
1314     }                                            1297     }
1315     loss += fSplineEnergy[iTransfer] ;           1298     loss += fSplineEnergy[iTransfer] ;
1316     numOfCollisions--;                           1299     numOfCollisions--;
1317     // Loop checking, 03-Aug-2015, Vladimir I << 
1318   }                                              1300   }
1319   // G4cout<<"PAI Plasmon loss = "<<loss/keV<    1301   // G4cout<<"PAI Plasmon loss = "<<loss/keV<<" keV"<<G4endl; 
1320                                                  1302 
1321   return loss;                                   1303   return loss;
1322 }                                                1304 }
1323                                                  1305 
1324 /////////////////////////////////////////////    1306 /////////////////////////////////////////////////////////////////////////////
1325 //                                               1307 //
1326                                                  1308 
1327 void G4PAIySection::CallError(G4int i, const     1309 void G4PAIySection::CallError(G4int i, const G4String& methodName) const
1328 {                                                1310 {
1329   G4String head = "G4PAIySection::" + methodN    1311   G4String head = "G4PAIySection::" + methodName + "()";
1330   G4ExceptionDescription ed;                     1312   G4ExceptionDescription ed;
1331   ed << "Wrong index " << i << " fSplineNumbe << 1313   ed << "Wrong index " << i << " fSplineNumber= " << fSplineNumber << G4endl;
1332   G4Exception(head,"pai001",FatalException,ed    1314   G4Exception(head,"pai001",FatalException,ed);
1333 }                                                1315 }
1334                                                  1316 
1335 /////////////////////////////////////////////    1317 /////////////////////////////////////////////////////////////////////////////
1336 //                                               1318 //
1337 // Init  array of Lorentz factors                1319 // Init  array of Lorentz factors
1338 //                                               1320 //
1339                                                  1321 
1340 G4int G4PAIySection::fNumberOfGammas = 111;      1322 G4int G4PAIySection::fNumberOfGammas = 111;
1341                                                  1323 
1342 const G4double G4PAIySection::fLorentzFactor[    1324 const G4double G4PAIySection::fLorentzFactor[112] =     // fNumberOfGammas+1
1343 {                                                1325 {
1344 0.0,                                             1326 0.0,
1345 1.094989e+00, 1.107813e+00, 1.122369e+00, 1.1    1327 1.094989e+00, 1.107813e+00, 1.122369e+00, 1.138890e+00, 1.157642e+00,
1346 1.178925e+00, 1.203082e+00, 1.230500e+00, 1.2    1328 1.178925e+00, 1.203082e+00, 1.230500e+00, 1.261620e+00, 1.296942e+00, // 10
1347 1.337032e+00, 1.382535e+00, 1.434181e+00, 1.4    1329 1.337032e+00, 1.382535e+00, 1.434181e+00, 1.492800e+00, 1.559334e+00,
1348 1.634850e+00, 1.720562e+00, 1.817845e+00, 1.9    1330 1.634850e+00, 1.720562e+00, 1.817845e+00, 1.928263e+00, 2.053589e+00, // 20
1349 2.195835e+00, 2.357285e+00, 2.540533e+00, 2.7    1331 2.195835e+00, 2.357285e+00, 2.540533e+00, 2.748522e+00, 2.984591e+00,
1350 3.252533e+00, 3.556649e+00, 3.901824e+00, 4.2    1332 3.252533e+00, 3.556649e+00, 3.901824e+00, 4.293602e+00, 4.738274e+00, // 30
1351 5.242981e+00, 5.815829e+00, 6.466019e+00, 7.2    1333 5.242981e+00, 5.815829e+00, 6.466019e+00, 7.203990e+00, 8.041596e+00,
1352 8.992288e+00, 1.007133e+01, 1.129606e+01, 1.2    1334 8.992288e+00, 1.007133e+01, 1.129606e+01, 1.268614e+01, 1.426390e+01, // 40
1353 1.605467e+01, 1.808721e+01, 2.039417e+01, 2.3    1335 1.605467e+01, 1.808721e+01, 2.039417e+01, 2.301259e+01, 2.598453e+01,
1354 2.935771e+01, 3.318630e+01, 3.753180e+01, 4.2    1336 2.935771e+01, 3.318630e+01, 3.753180e+01, 4.246399e+01, 4.806208e+01, // 50
1355 5.441597e+01, 6.162770e+01, 6.981310e+01, 7.9    1337 5.441597e+01, 6.162770e+01, 6.981310e+01, 7.910361e+01, 8.964844e+01,
1356 1.016169e+02, 1.152013e+02, 1.306197e+02, 1.4    1338 1.016169e+02, 1.152013e+02, 1.306197e+02, 1.481198e+02, 1.679826e+02, // 60
1357 1.905270e+02, 2.161152e+02, 2.451581e+02, 2.7    1339 1.905270e+02, 2.161152e+02, 2.451581e+02, 2.781221e+02, 3.155365e+02,
1358 3.580024e+02, 4.062016e+02, 4.609081e+02, 5.2    1340 3.580024e+02, 4.062016e+02, 4.609081e+02, 5.230007e+02, 5.934765e+02, // 70
1359 6.734672e+02, 7.642575e+02, 8.673056e+02, 9.8    1341 6.734672e+02, 7.642575e+02, 8.673056e+02, 9.842662e+02, 1.117018e+03,
1360 1.267692e+03, 1.438709e+03, 1.632816e+03, 1.8    1342 1.267692e+03, 1.438709e+03, 1.632816e+03, 1.853128e+03, 2.103186e+03, // 80
1361 2.387004e+03, 2.709140e+03, 3.074768e+03, 3.4    1343 2.387004e+03, 2.709140e+03, 3.074768e+03, 3.489760e+03, 3.960780e+03,
1362 4.495394e+03, 5.102185e+03, 5.790900e+03, 6.5    1344 4.495394e+03, 5.102185e+03, 5.790900e+03, 6.572600e+03, 7.459837e+03, // 90
1363 8.466860e+03, 9.609843e+03, 1.090714e+04, 1.2    1345 8.466860e+03, 9.609843e+03, 1.090714e+04, 1.237959e+04, 1.405083e+04,
1364 1.594771e+04, 1.810069e+04, 2.054434e+04, 2.3    1346 1.594771e+04, 1.810069e+04, 2.054434e+04, 2.331792e+04, 2.646595e+04, // 100
1365 3.003901e+04, 3.409446e+04, 3.869745e+04, 4.3    1347 3.003901e+04, 3.409446e+04, 3.869745e+04, 4.392189e+04, 4.985168e+04,
1366 5.658206e+04, 6.422112e+04, 7.289153e+04, 8.2    1348 5.658206e+04, 6.422112e+04, 7.289153e+04, 8.273254e+04, 9.390219e+04, // 110
1367 1.065799e+05                                     1349 1.065799e+05
1368 };                                               1350 };
1369                                                  1351 
1370 /////////////////////////////////////////////    1352 ///////////////////////////////////////////////////////////////////////
1371 //                                               1353 //
1372 // The number of gamma for creation of  splin    1354 // The number of gamma for creation of  spline (near ion-min , G ~ 4 )
1373 //                                               1355 //
1374                                                  1356 
1375 const G4int G4PAIySection::fRefGammaNumber =  << 1357 const
                                                   >> 1358 G4int G4PAIySection::fRefGammaNumber = 29; 
1376                                                  1359 
                                                   >> 1360    
1377 //                                               1361 //   
1378 // end of G4PAIySection implementation file      1362 // end of G4PAIySection implementation file 
1379 //                                               1363 //
1380 /////////////////////////////////////////////    1364 ////////////////////////////////////////////////////////////////////////////
1381                                                  1365 
1382                                                  1366