Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/standard/src/G4UniversalFluctuation.cc

    r1337 r1340  
    2424// ********************************************************************
    2525//
    26 // $Id: G4UniversalFluctuation.cc,v 1.22 2009/03/20 18:11:23 urban Exp $
    27 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     26// $Id: G4UniversalFluctuation.cc,v 1.28 2010/10/26 10:06:12 vnivanch Exp $
     27// GEANT4 tag $Name: emstand-V09-03-24 $
    2828//
    2929// -------------------------------------------------------------------
     
    3434// File name:     G4UniversalFluctuation
    3535//
    36 // Author:        Vladimir Ivanchenko
     36// Author:        Laszlo Urban
    3737//
    3838// Creation date: 03.01.2002
     
    5757// 03-04-07 correction to get better width of eloss distr.(L.Urban)
    5858// 13-07-07 add protection for very small step or low-density material (VI)
    59 // 19-03-09 new width correction (does not depend on previous steps) (L.Urban)         
     59// 19-03-09 new width correction (does not depend on previous steps) (L.Urban)
    6060// 20-03-09 modification in the width correction (L.Urban)
     61// 14-06-10 fixed tail distribution - do not use uniform function (L.Urban)
     62// 08-08-10 width correction algorithm has bee modified -->
     63//          better results for thin targets (L.Urban)
    6164//
    6265
     
    8285  theBohrBeta2(50.0*keV/proton_mass_c2),
    8386  minLoss(10.*eV),
    84   nmaxCont1(4.),
    85   nmaxCont2(16.)
     87  nmaxCont(16.),
     88  rate(0.55),
     89  fw(4.)
    8690{
    8791  lastMaterial = 0;
     92
     93  particleMass = chargeSquare = ipotFluct = electronDensity = f1Fluct = f2Fluct
     94    = e1Fluct = e2Fluct = e1LogFluct = e2LogFluct = ipotLogFluct = e0 = esmall
     95    = e1 = e2 = 0;
    8896}
    8997
     
    118126  // shortcut for very very small loss (out of validity of the model)
    119127  //
    120   if (meanLoss < minLoss)
    121     return meanLoss;
    122 
    123   if(!particle) InitialiseMe(dp->GetDefinition());
     128  if (meanLoss < minLoss) { return meanLoss; }
     129
     130  if(!particle) { InitialiseMe(dp->GetDefinition()); }
    124131
    125132  G4double tau   = dp->GetKineticEnergy()/particleMass;
     
    174181    ipotLogFluct = material->GetIonisation()->GetLogMeanExcEnergy();
    175182    e0 = material->GetIonisation()->GetEnergy0fluct();
     183    esmall = 0.5*sqrt(e0*ipotFluct); 
    176184    lastMaterial = material;
    177  
    178     // modification of some model parameters
    179     // (this part should go to materials later)
    180     G4double p = 1.40;
    181     f2Fluct *= p;
    182     f1Fluct = 1.-f2Fluct;
    183     G4double q = 1.00;
    184     e2Fluct *= q;
    185     e2LogFluct = log(e2Fluct);
    186     e1LogFluct = (ipotLogFluct-f2Fluct*e2LogFluct)/f1Fluct;
    187     e1Fluct = exp(e1LogFluct);
     185   
    188186  }
    189187
     
    193191  G4double a1 = 0. , a2 = 0., a3 = 0. ;
    194192
    195   // cut and material dependent rate
    196   G4double rate = 1.0;
    197193  if(tmax > ipotFluct) {
    198194    G4double w2 = log(2.*electron_mass_c2*beta2*gam2)-beta2;
    199195
    200     if(w2 > ipotLogFluct && w2 > e2LogFluct) {
    201 
    202       rate = 0.03+0.23*log(log(tmax/ipotFluct));
     196    if(w2 > ipotLogFluct && w2 > e2LogFluct && tmax> ipotFluct)  {
    203197      G4double C = meanLoss*(1.-rate)/(w2-ipotLogFluct);
    204198      a1 = C*f1Fluct*(w2-e1LogFluct)/e1Fluct;
    205199      a2 = C*f2Fluct*(w2-e2LogFluct)/e2Fluct;
    206       // correction in order to get better FWHM values
    207       // ( scale parameters a1 and e1)
    208       G4double width = 1.;
    209       if(meanLoss > 10.*e1Fluct)
     200         
     201
     202  if(a1 < nmaxCont)
     203  {
     204    //small energy loss
     205    G4double sa1 = sqrt(a1);
     206    if(G4UniformRand() < exp(-sa1))
    210207      {
    211         width = 3.1623/sqrt(meanLoss/e1Fluct);
    212         if(width < a2/a1)
    213         width = a2/a1;
     208       e1 = esmall;
     209       a1 = meanLoss*(1.-rate)/e1;
     210       a2 = 0.;
     211       e2 = e2Fluct;
    214212      }
    215       a1 *= width;
    216       e1 = e1Fluct/width;
     213      else
     214      {
     215       a1 = sa1 ;   
     216       e1 = sa1*e1Fluct;
     217       e2 = e2Fluct;
     218      }
     219    }
     220    else
     221    {
     222      //not small energy loss
     223      //correction to get better fwhm value
     224      a1 /= fw;
     225      e1 = fw*e1Fluct;
    217226      e2 = e2Fluct;
    218227    }
    219   }
     228  }   
     229 }
    220230
    221231  G4double w1 = tmax/e0;
     
    223233    a3 = rate*meanLoss*(tmax-e0)/(e0*tmax*log(w1));
    224234
    225   //'nearly' Gaussian fluctuation if a1>nmaxCont2&&a2>nmaxCont2&&a3>nmaxCont2 
     235  //'nearly' Gaussian fluctuation if a1>nmaxCont&&a2>nmaxCont&&a3>nmaxCont 
    226236  G4double emean = 0.;
    227237  G4double sig2e = 0., sige = 0.;
     
    229239 
    230240  // excitation of type 1
    231   if(a1 > nmaxCont2)
     241  if(a1 > nmaxCont)
    232242  {
    233243    emean += a1*e1;
     
    243253
    244254  // excitation of type 2
    245   if(a2 > nmaxCont2)
     255  if(a2 > nmaxCont)
    246256  {
    247257    emean += a2*e2;
     
    262272    p3 = a3;
    263273    G4double alfa = 1.;
    264     if(a3 > nmaxCont2)
     274    if(a3 > nmaxCont)
    265275    {
    266        alfa            = w1*(nmaxCont2+a3)/(w1*nmaxCont2+a3);
     276       alfa            = w1*(nmaxCont+a3)/(w1*nmaxCont+a3);
    267277       G4double alfa1  = alfa*log(alfa)/(alfa-1.);
    268278       G4double namean = a3*w1*(alfa-1.)/((w1-1.)*alfa);
Note: See TracChangeset for help on using the changeset viewer.