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.4.p2)


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