Ignore:
Timestamp:
Apr 6, 2009, 12:21:12 PM (15 years ago)
Author:
garnier
Message:

update processes

Location:
trunk/source/processes/electromagnetic/xrays
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/xrays/GNUmakefile

    r819 r961  
    1 # $Id: GNUmakefile,v 1.6 2006/04/05 13:34:23 vnivanch Exp $
     1# $Id: GNUmakefile,v 1.7 2008/06/13 01:06:31 gum Exp $
    22# --------------------------------------------------------------------
    33# GNUmakefile for electromagnetic sub-library.  John Allison, 25/6/98.
     
    2424            -I$(G4BASE)/processes/management/include \
    2525            -I$(G4BASE)/processes/cuts/include \
     26            -I$(G4BASE)/processes/electromagnetic/utils/include \
    2627            -I$(G4BASE)/particles/management/include \
    2728            -I$(G4BASE)/particles/bosons/include \
  • trunk/source/processes/electromagnetic/xrays/History

    r819 r961  
    1 $Id: History,v 1.62 2007/11/02 20:56:36 gum Exp $
     1$Id: History,v 1.69 2008/11/14 20:47:11 gum Exp $
    22-------------------------------------------------------------------
    33
     
    1818     ----------------------------------------------------------
    1919
     2014 November 08: P. Gumplinger (xrays-V09-01-06)
     21- Do not calculate a step limit coming from G4Cerenkov when the
     22  minimum beta for a particle to radiate in the material (vacuum)
     23  is already 1; fix G4Cerenkov.cc
     24
     2512 November 08: V. Ivanchenko (xrays-V09-01-05)
     26- exclude G4MscRadiation from the release
     27
     2821 October 08: P. Gumplinger (xrays-V09-01-04)
     29- Add SetProcessSubType(G4EmProcessSubType) to G4Cerenkov.cc
     30  and G4Scintillation. Modify G4Cerenkov to allow for
     31  MaxBetaChangePerStep, sets PostStepGetPhysicalInteractionLength to
     32  where the particle would drop below the Cerenkov threshold in the
     33  current material. The Cerenkov photon origins are now sampled
     34  according to the linear decrease in the MeanNumberOfPhotons over
     35  the step. G4Cerenkov now inherits from G4VProcess. For this to work
     36  tracking-V09-01-03 or newer is required.
     37
     3804 July 08: P. Gumplinger (xrays-V09-01-03)
     39- In G4Scintillation and G4Cerenkov now
     40  SetTouchableHandle(aStep.GetPreStepPoint()->GetTouchableHandle())
     41  for the secondaries in the DoIt.
     42
     4306 June 08: P. Gumplinger (xrays-V09-01-02)
     44- G4Scintillation: make now use of G4EmSaturation to implement the
     45  Birks Correction.
     46
     4705 June 08: P. Gumplinger (xrays-V09-01-01)
     48- G4Scintillation, G4Cerenkov
     49  trivial name changes: momentum->energy, momenta->energies
     50
     5105 February 08: P. Gumplinger
     52- G4BirkScintillation class was removed and scintillation with Birk's law
     53  was added to the G4Scintillation class directly.
     54
     5501 February 08: V. Grichine
     56- G4BirkScintillation class was added. The class implements the scintillation
     57  process with Birk's law
     58 
    205902 November 07: P. Gumplinger (xrays-V09-00-03)
    2160- G4Cerenkov constructor add warning printout about the change
  • trunk/source/processes/electromagnetic/xrays/include/G4Cerenkov.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Cerenkov.hh,v 1.9 2007/09/30 22:17:04 gum Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4Cerenkov.hh,v 1.10 2008/10/22 01:17:36 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    6060#include "G4ParticleMomentum.hh"
    6161#include "G4Step.hh"
    62 #include "G4VDiscreteProcess.hh"
     62#include "G4VProcess.hh"
    6363#include "G4OpticalPhoton.hh"
    6464#include "G4DynamicParticle.hh"
     
    7777/////////////////////
    7878
    79 class G4Cerenkov : public G4VDiscreteProcess 
     79class G4Cerenkov : public G4VProcess
    8080{
    8181
     
    116116        // condition for the DoIt to be invoked at every step.
    117117
     118        G4double PostStepGetPhysicalInteractionLength(const G4Track& aTrack,
     119                                                      G4double ,
     120                                                      G4ForceCondition* );
     121        // Returns the discrete step limit and sets the 'StronglyForced'
     122        // condition for the DoIt to be invoked at every step.
     123
    118124        G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
    119125                                        const G4Step&  aStep);
    120126        // This is the method implementing the Cerenkov process.
     127
     128        //  no operation in  AtRestDoIt and  AlongStepDoIt
     129        virtual G4double AlongStepGetPhysicalInteractionLength(
     130                               const G4Track&,
     131                               G4double  ,
     132                               G4double  ,
     133                               G4double& ,
     134                               G4GPILSelection*
     135                              ) { return -1.0; };
     136
     137        virtual G4double AtRestGetPhysicalInteractionLength(
     138                               const G4Track& ,
     139                               G4ForceCondition*
     140                              ) { return -1.0; };
     141
     142        //  no operation in  AtRestDoIt and  AlongStepDoIt
     143        virtual G4VParticleChange* AtRestDoIt(
     144                               const G4Track& ,
     145                               const G4Step&
     146                              ) {return 0;};
     147
     148        virtual G4VParticleChange* AlongStepDoIt(
     149                               const G4Track& ,
     150                               const G4Step&
     151                              ) {return 0;};
    121152
    122153        void SetTrackSecondariesFirst(const G4bool state);
     
    125156        // been tracked, the tracking of the primary resumes.
    126157       
     158        void SetMaxBetaChangePerStep(const G4double d);
     159        // Set the maximum allowed change in beta = v/c in % (perCent)
     160        // per step.
     161
    127162        void SetMaxNumPhotonsPerStep(const G4int NumPhotons);
    128163        // Set the maximum number of Cerenkov photons allowed to be
     
    166201
    167202        G4bool fTrackSecondariesFirst;
    168         G4int  fMaxPhotons;
     203        G4double fMaxBetaChange;
     204        G4int  fMaxPhotons;
    169205};
    170206
     
    190226
    191227inline
     228void G4Cerenkov::SetMaxBetaChangePerStep(const G4double value)
     229{
     230        fMaxBetaChange = value*perCent;
     231}
     232
     233inline
    192234void G4Cerenkov::SetMaxNumPhotonsPerStep(const G4int NumPhotons)
    193235{
     
    208250}
    209251
    210 inline G4PhysicsTable* G4Cerenkov::GetPhysicsTable() const
     252inline
     253G4PhysicsTable* G4Cerenkov::GetPhysicsTable() const
    211254{
    212255  return thePhysicsTable;
  • trunk/source/processes/electromagnetic/xrays/include/G4ForwardXrayTR.hh

    r819 r961  
    2626//
    2727// $Id: G4ForwardXrayTR.hh,v 1.14 2006/06/29 19:55:33 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4ForwardXrayTR -- header file
  • trunk/source/processes/electromagnetic/xrays/include/G4GammaXTRadiator.hh

    r819 r961  
    2626//
    2727// $Id: G4GammaXTRadiator.hh,v 1.4 2006/06/29 19:55:35 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/include/G4RegularXTRadiator.hh

    r819 r961  
    2626//
    2727// $Id: G4RegularXTRadiator.hh,v 1.3 2006/06/29 19:55:37 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/include/G4Scintillation.hh

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Scintillation.hh,v 1.13 2006/06/29 19:55:39 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4Scintillation.hh,v 1.15 2008/06/13 01:04:49 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
     
    7272#include "G4PhysicsOrderedFreeVector.hh"
    7373
     74#include "G4EmSaturation.hh"
     75
    7476// Class Description:
    7577// RestDiscrete Process - Generation of Scintillation Photons.
     
    170172        // Returns the address of the slow scintillation integral table.
    171173
     174        void AddSaturation(G4EmSaturation* sat) { emSaturation = sat; }
     175        // Adds Birks Saturation to the process.
     176
     177        G4EmSaturation* GetSaturation() const { return emSaturation; }
     178        // Returns the Birks Saturation.
     179
    172180        void DumpPhysicsTable() const;
    173181        // Prints the fast and slow scintillation integral tables.
    174182
    175 private:
     183protected:
    176184
    177185        void BuildThePhysicsTable();
     
    183191        ///////////////////////
    184192
    185 protected:
    186193
    187194        G4PhysicsTable* theSlowIntegralTable;
    188195        G4PhysicsTable* theFastIntegralTable;
    189196
     197
     198
     199        G4bool fTrackSecondariesFirst;
     200
     201        G4double YieldFactor;
     202
     203        G4double ExcitationRatio;
     204
    190205private:
    191206
    192         G4bool fTrackSecondariesFirst;
    193 
    194         G4double YieldFactor;
    195 
    196         G4double ExcitationRatio;
     207        G4EmSaturation* emSaturation;
    197208
    198209};
  • trunk/source/processes/electromagnetic/xrays/include/G4StrawTubeXTRadiator.hh

    r819 r961  
    2626//
    2727// $Id: G4StrawTubeXTRadiator.hh,v 1.4 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/include/G4SynchrotronRadiation.hh

    r819 r961  
    2626//
    2727// $Id: G4SynchrotronRadiation.hh,v 1.4 2006/06/29 19:55:43 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// ------------------------------------------------------------
  • trunk/source/processes/electromagnetic/xrays/include/G4SynchrotronRadiationInMat.hh

    r819 r961  
    2626//
    2727// $Id: G4SynchrotronRadiationInMat.hh,v 1.2 2006/06/29 19:55:45 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// ------------------------------------------------------------
  • trunk/source/processes/electromagnetic/xrays/include/G4TransitionRadiation.hh

    r819 r961  
    2626//
    2727// $Id: G4TransitionRadiation.hh,v 1.9 2006/06/29 19:55:47 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4TransitionRadiation  -- header file
  • trunk/source/processes/electromagnetic/xrays/include/G4TransparentRegXTRadiator.hh

    r819 r961  
    2626//
    2727// $Id: G4TransparentRegXTRadiator.hh,v 1.2 2006/06/29 19:55:49 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/include/G4VTRModel.hh

    r819 r961  
    2626//
    2727// $Id: G4VTRModel.hh,v 1.3 2006/06/29 19:55:51 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4VTRModel  -- header file
  • trunk/source/processes/electromagnetic/xrays/include/G4VTransitionRadiation.hh

    r819 r961  
    2626//
    2727// $Id: G4VTransitionRadiation.hh,v 1.3 2006/06/29 19:55:53 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4VTransitionRadiation  -- header file
  • trunk/source/processes/electromagnetic/xrays/include/G4VXTRenergyLoss.hh

    r819 r961  
    2626//
    2727// $Id: G4VXTRenergyLoss.hh,v 1.24 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030//
  • trunk/source/processes/electromagnetic/xrays/src/G4Cerenkov.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Cerenkov.cc,v 1.23 2007/10/15 20:05:23 gum Exp $
    28 // GEANT4 tag $Name: $
     27// $Id: G4Cerenkov.cc,v 1.26 2008/11/14 20:16:51 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
     
    6565#include "G4ios.hh"
    6666#include "G4Poisson.hh"
     67#include "G4EmProcessSubType.hh"
     68
     69#include "G4LossTableManager.hh"
     70#include "G4MaterialCutsCouple.hh"
     71#include "G4ParticleDefinition.hh"
     72
    6773#include "G4Cerenkov.hh"
    6874
     
    8692
    8793G4Cerenkov::G4Cerenkov(const G4String& processName, G4ProcessType type)
    88            : G4VDiscreteProcess(processName, type)
     94           : G4VProcess(processName, type)
    8995{
    9096        G4cout << "G4Cerenkov::G4Cerenkov constructor" << G4endl;
    91         G4cout << "NOTE: this is now a G4VDiscreteProcess!" << G4endl;
     97        G4cout << "NOTE: this is now a G4VProcess!" << G4endl;
    9298        G4cout << "Required change in UserPhysicsList: " << G4endl;
    9399        G4cout << "change: pmanager->AddContinuousProcess(theCerenkovProcess);" << G4endl;
     
    95101        G4cout << "        pmanager->SetProcessOrdering(theCerenkovProcess,idxPostStep);" << G4endl;
    96102
     103        SetProcessSubType(fCerenkov);
     104
    97105        fTrackSecondariesFirst = false;
     106        fMaxBetaChange = 0.;
    98107        fMaxPhotons = 0;
    99108
     
    141150
    142151{
    143 
    144152        //////////////////////////////////////////////////////
    145153        // Should we ensure that the material is dispersive?
     
    160168        G4MaterialPropertiesTable* aMaterialPropertiesTable =
    161169                               aMaterial->GetMaterialPropertiesTable();
    162         if (!aMaterialPropertiesTable)
    163            return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     170        if (!aMaterialPropertiesTable) return pParticleChange;
    164171
    165172        const G4MaterialPropertyVector* Rindex =
    166173                aMaterialPropertiesTable->GetProperty("RINDEX");
    167         if (!Rindex)
    168            return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     174        if (!Rindex) return pParticleChange;
    169175
    170176        // particle charge
     
    184190                aParticleChange.SetNumberOfSecondaries(0);
    185191 
    186                 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     192                return pParticleChange;
    187193
    188194        }
     
    201207                aParticleChange.SetNumberOfSecondaries(0);
    202208               
    203                 return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     209                return pParticleChange;
    204210        }
    205211
     
    215221        ////////////////////////////////////////////////////////////////
    216222
    217         G4double Pmin = Rindex->GetMinPhotonMomentum();
    218         G4double Pmax = Rindex->GetMaxPhotonMomentum();
     223        G4double Pmin = Rindex->GetMinPhotonEnergy();
     224        G4double Pmax = Rindex->GetMaxPhotonEnergy();
    219225        G4double dp = Pmax - Pmin;
    220226
     
    226232        G4double maxSin2 = (1.0 - maxCos) * (1.0 + maxCos);
    227233
     234        const G4double beta1 = pPreStepPoint ->GetBeta();
     235        const G4double beta2 = pPostStepPoint->GetBeta();
     236
     237        G4double MeanNumberOfPhotons1 =
     238                     GetAverageNumberOfPhotons(charge,beta1,aMaterial,Rindex);
     239        G4double MeanNumberOfPhotons2 =
     240                     GetAverageNumberOfPhotons(charge,beta2,aMaterial,Rindex);
     241
    228242        for (G4int i = 0; i < NumPhotons; i++) {
    229243
    230                 // Determine photon momentum
     244                // Determine photon energy
    231245
    232246                G4double rand;
    233                 G4double sampledMomentum, sampledRI;
     247                G4double sampledEnergy, sampledRI;
    234248                G4double cosTheta, sin2Theta;
    235249               
    236                 // sample a momentum
     250                // sample an energy
    237251
    238252                do {
    239253                        rand = G4UniformRand();
    240                         sampledMomentum = Pmin + rand * dp;
    241                         sampledRI = Rindex->GetProperty(sampledMomentum);
     254                        sampledEnergy = Pmin + rand * dp;
     255                        sampledRI = Rindex->GetProperty(sampledEnergy);
    242256                        cosTheta = BetaInverse / sampledRI; 
    243257
     
    256270                G4double cosPhi = cos(phi);
    257271
    258                 // calculate x,y, and z components of photon momentum
     272                // calculate x,y, and z components of photon energy
    259273                // (in coord system with primary particle direction
    260274                //  aligned with the z axis)
     
    299313                                      photonPolarization.z());
    300314
    301                 aCerenkovPhoton->SetKineticEnergy(sampledMomentum);
     315                aCerenkovPhoton->SetKineticEnergy(sampledEnergy);
    302316
    303317                // Generate new G4Track object:
    304318
    305                 rand = G4UniformRand();
    306 
    307                 G4double delta = rand * aStep.GetStepLength();
     319                G4double delta, NumberOfPhotons, N;
     320
     321                do {
     322                   rand = G4UniformRand();
     323                   delta = rand * aStep.GetStepLength();
     324                   NumberOfPhotons = MeanNumberOfPhotons1 - delta *
     325                                (MeanNumberOfPhotons1-MeanNumberOfPhotons2)/
     326                                              aStep.GetStepLength();
     327                   N = G4UniformRand() *
     328                       std::max(MeanNumberOfPhotons1,MeanNumberOfPhotons2);
     329                } while (N > NumberOfPhotons);
     330
    308331                G4double deltaTime = delta /
    309332                       ((pPreStepPoint->GetVelocity()+
     
    318341                new G4Track(aCerenkovPhoton,aSecondaryTime,aSecondaryPosition);
    319342
    320                 aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
     343                aSecondaryTrack->SetTouchableHandle(
     344                                 aStep.GetPreStepPoint()->GetTouchableHandle());
    321345
    322346                aSecondaryTrack->SetParentID(aTrack.GetTrackID());
     
    330354        }
    331355
    332         return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
     356        return pParticleChange;
    333357}
    334358
     
    372396               
    373397                      // Retrieve the first refraction index in vector
    374                       // of (photon momentum, refraction index) pairs
     398                      // of (photon energy, refraction index) pairs
    375399
    376400                      theRefractionIndexVector->ResetIterator();
     
    382406                      if (currentRI > 1.0) {
    383407
    384                          // Create first (photon momentum, Cerenkov Integral)
     408                         // Create first (photon energy, Cerenkov Integral)
    385409                         // pair 
    386410
    387411                         G4double currentPM = theRefractionIndexVector->
    388                                                  GetPhotonMomentum();
     412                                                 GetPhotonEnergy();
    389413                         G4double currentCAI = 0.0;
    390414
     
    398422                         G4double prevRI  = currentRI;
    399423
    400                          // loop over all (photon momentum, refraction index)
     424                         // loop over all (photon energy, refraction index)
    401425                         // pairs stored for this material 
    402426
     
    407431
    408432                                currentPM = theRefractionIndexVector->
    409                                                 GetPhotonMomentum();
     433                                                GetPhotonEnergy();
    410434
    411435                                currentCAI = 0.5*(1.0/(prevRI*prevRI) +
     
    441465//
    442466
    443 G4double G4Cerenkov::GetMeanFreePath(const G4Track& aTrack,
     467G4double G4Cerenkov::GetMeanFreePath(const G4Track&,
     468                                           G4double,
     469                                           G4ForceCondition*)
     470{
     471        return 1.;
     472}
     473
     474G4double G4Cerenkov::PostStepGetPhysicalInteractionLength(
     475                                           const G4Track& aTrack,
    444476                                           G4double,
    445477                                           G4ForceCondition* condition)
    446478{
    447         *condition = StronglyForced;
    448 
    449         // If user has defined an average maximum number of photons to
    450         // be generated in a Step, then return the Step length for that
    451         // number of photons.
    452  
    453         if (fMaxPhotons <= 0) return DBL_MAX;
     479        *condition = NotForced;
     480        G4double StepLimit = DBL_MAX;
    454481
    455482        const G4DynamicParticle* aParticle = aTrack.GetDynamicParticle();
    456483        const G4Material* aMaterial = aTrack.GetMaterial();
    457 
    458         G4MaterialPropertiesTable* aMaterialPropertiesTable =
    459                                aMaterial->GetMaterialPropertiesTable();
    460         if (!aMaterialPropertiesTable) return DBL_MAX;
    461 
    462         const G4MaterialPropertyVector* Rindex =
    463                 aMaterialPropertiesTable->GetProperty("RINDEX");
    464         if (!Rindex) return DBL_MAX;
    465 
    466         // particle charge
    467         const G4double charge = aParticle->GetDefinition()->GetPDGCharge();
     484        const G4MaterialCutsCouple* couple = aTrack.GetMaterialCutsCouple();
     485
     486        const G4double kineticEnergy = aParticle->GetKineticEnergy();
     487        const G4ParticleDefinition* particleType = aParticle->GetDefinition();
     488        const G4double mass = particleType->GetPDGMass();
    468489
    469490        // particle beta
    470491        const G4double beta = aParticle->GetTotalMomentum() /
    471492                              aParticle->GetTotalEnergy();
    472 
    473         G4double MeanNumberOfPhotons =
    474                  GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
    475 
    476         if(MeanNumberOfPhotons <= 0.0) return DBL_MAX;
    477 
    478         G4double StepLimit = fMaxPhotons / MeanNumberOfPhotons;
    479 
    480         return StepLimit;
     493        // particle gamma
     494        const G4double gamma = 1./std::sqrt(1.-beta*beta);
     495
     496        G4MaterialPropertiesTable* aMaterialPropertiesTable =
     497                            aMaterial->GetMaterialPropertiesTable();
     498
     499        const G4MaterialPropertyVector* Rindex = NULL;
     500
     501        if (aMaterialPropertiesTable)
     502                     Rindex = aMaterialPropertiesTable->GetProperty("RINDEX");
     503
     504        G4double nMax;
     505        if (Rindex) {
     506           nMax = Rindex->GetMaxProperty();
     507        } else {
     508           return StepLimit;
     509        }
     510
     511        G4double BetaMin = 1./nMax;
     512        if ( BetaMin >= 1. ) return StepLimit;
     513
     514        G4double GammaMin = 1./std::sqrt(1.-BetaMin*BetaMin);
     515
     516        if (gamma < GammaMin ) return StepLimit;
     517
     518        G4double kinEmin = mass*(GammaMin-1.);
     519
     520        G4double RangeMin = G4LossTableManager::Instance()->
     521                                                   GetRange(particleType,
     522                                                            kinEmin,
     523                                                            couple);
     524        G4double Range    = G4LossTableManager::Instance()->
     525                                                   GetRange(particleType,
     526                                                            kineticEnergy,
     527                                                            couple);
     528
     529        G4double Step = Range - RangeMin;
     530        if (Step < 1.*um ) return StepLimit;
     531
     532        if (Step > 0. && Step < StepLimit) StepLimit = Step;
     533
     534        // If user has defined an average maximum number of photons to
     535        // be generated in a Step, then calculate the Step length for
     536        // that number of photons.
     537 
     538        if (fMaxPhotons > 0) {
     539
     540           // particle charge
     541           const G4double charge = aParticle->
     542                                   GetDefinition()->GetPDGCharge();
     543
     544           G4double MeanNumberOfPhotons =
     545                    GetAverageNumberOfPhotons(charge,beta,aMaterial,Rindex);
     546
     547           G4double Step = 0.;
     548           if (MeanNumberOfPhotons > 0.0) Step = fMaxPhotons /
     549                                                 MeanNumberOfPhotons;
     550
     551           if (Step > 0. && Step < StepLimit) StepLimit = Step;
     552        }
     553
     554        // If user has defined an maximum allowed change in beta per step
     555        if (fMaxBetaChange > 0.) {
     556
     557           G4double dedx = G4LossTableManager::Instance()->
     558                                                   GetDEDX(particleType,
     559                                                           kineticEnergy,
     560                                                           couple);
     561
     562           G4double deltaGamma = gamma -
     563                                 1./std::sqrt(1.-beta*beta*
     564                                                 (1.-fMaxBetaChange)*
     565                                                 (1.-fMaxBetaChange));
     566
     567           G4double Step = mass * deltaGamma / dedx;
     568
     569           if (Step > 0. && Step < StepLimit) StepLimit = Step;
     570
     571        }
     572
     573        *condition = StronglyForced;
     574        return StepLimit;
    481575}
    482576
     
    512606        if(!(CerenkovAngleIntegrals->IsFilledVectorExist()))return 0.0;
    513607
    514         // Min and Max photon momenta
    515         G4double Pmin = Rindex->GetMinPhotonMomentum();
    516         G4double Pmax = Rindex->GetMaxPhotonMomentum();
     608        // Min and Max photon energies
     609        G4double Pmin = Rindex->GetMinPhotonEnergy();
     610        G4double Pmax = Rindex->GetMaxPhotonEnergy();
    517611
    518612        // Min and Max Refraction Indices
     
    541635        // If n(Pmin) < 1/Beta, and n(Pmax) >= 1/Beta, then
    542636        // we need to find a P such that the value of n(P) == 1/Beta.
    543         // Interpolation is performed by the GetPhotonMomentum() and
     637        // Interpolation is performed by the GetPhotonEnergy() and
    544638        // GetProperty() methods of the G4MaterialPropertiesTable and
    545639        // the GetValue() method of G4PhysicsVector. 
    546640
    547641        else {
    548                 Pmin = Rindex->GetPhotonMomentum(BetaInverse);
     642                Pmin = Rindex->GetPhotonEnergy(BetaInverse);
    549643                dp = Pmax - Pmin;
    550644
  • trunk/source/processes/electromagnetic/xrays/src/G4ForwardXrayTR.cc

    r819 r961  
    2626//
    2727// $Id: G4ForwardXrayTR.cc,v 1.14 2007/05/11 14:23:04 gcosmo Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4ForwardXrayTR class -- implementation file
  • trunk/source/processes/electromagnetic/xrays/src/G4GammaXTRadiator.cc

    r819 r961  
    2626//
    2727// $Id: G4GammaXTRadiator.cc,v 1.5 2006/06/29 19:56:07 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/xrays/src/G4RegularXTRadiator.cc

    r819 r961  
    2626//
    2727// $Id: G4RegularXTRadiator.cc,v 1.9 2006/06/29 19:56:09 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/xrays/src/G4Scintillation.cc

    r819 r961  
    2525//
    2626//
    27 // $Id: G4Scintillation.cc,v 1.26 2006/06/29 19:56:11 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-01-patch-02 $
     27// $Id: G4Scintillation.cc,v 1.30 2008/10/22 01:19:11 gum Exp $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
     
    6464
    6565#include "G4ios.hh"
     66#include "G4EmProcessSubType.hh"
     67
    6668#include "G4Scintillation.hh"
    6769
     
    8890                  : G4VRestDiscreteProcess(processName, type)
    8991{
     92        SetProcessSubType(fScintillation);
     93
    9094        fTrackSecondariesFirst = false;
    9195
     
    101105
    102106        BuildThePhysicsTable();
     107
     108        emSaturation = NULL;
    103109}
    104110
     
    180186        G4double ScintillationYield = aMaterialPropertiesTable->
    181187                                      GetConstProperty("SCINTILLATIONYIELD");
     188        ScintillationYield *= YieldFactor;
     189
    182190        G4double ResolutionScale    = aMaterialPropertiesTable->
    183191                                      GetConstProperty("RESOLUTIONSCALE");
    184192
    185         ScintillationYield = YieldFactor * ScintillationYield;
    186 
    187         G4double MeanNumberOfPhotons = ScintillationYield * TotalEnergyDeposit;
     193        // Birks law saturation:
     194
     195        G4double constBirks = 0.0;
     196
     197        constBirks = aMaterial->GetIonisation()->GetBirksConstant();
     198
     199        G4double MeanNumberOfPhotons;
     200
     201        if (emSaturation) {
     202           MeanNumberOfPhotons = ScintillationYield*
     203                              (emSaturation->VisibleEnergyDeposition(&aStep));
     204        } else {
     205           MeanNumberOfPhotons = ScintillationYield*TotalEnergyDeposit;
     206        }
    188207
    189208        G4int NumPhotons;
    190         if (MeanNumberOfPhotons > 10.) {
     209
     210        if (MeanNumberOfPhotons > 10.)
     211        {
    191212          G4double sigma = ResolutionScale * sqrt(MeanNumberOfPhotons);
    192213          NumPhotons = G4int(G4RandGauss::shoot(MeanNumberOfPhotons,sigma)+0.5);
    193214        }
    194         else {
     215        else
     216        {
    195217          NumPhotons = G4int(G4Poisson(MeanNumberOfPhotons));
    196218        }
    197219
    198         if (NumPhotons <= 0) {
    199 
     220        if (NumPhotons <= 0)
     221        {
    200222           // return unchanged particle and no secondaries
    201223
     
    274296            for (G4int i = 0; i < Num; i++) {
    275297
    276                 // Determine photon momentum
     298                // Determine photon energy
    277299
    278300                G4double CIIvalue = G4UniformRand()*CIImax;
    279                 G4double sampledMomentum =
     301                G4double sampledEnergy =
    280302                              ScintillationIntegral->GetEnergy(CIIvalue);
    281303
    282304                if (verboseLevel>1) {
    283                    G4cout << "sampledMomentum = " << sampledMomentum << G4endl;
     305                   G4cout << "sampledEnergy = " << sampledEnergy << G4endl;
    284306                   G4cout << "CIIvalue =        " << CIIvalue << G4endl;
    285307                }
     
    330352                                      photonPolarization.z());
    331353
    332                 aScintillationPhoton->SetKineticEnergy(sampledMomentum);
     354                aScintillationPhoton->SetKineticEnergy(sampledEnergy);
    333355
    334356                // Generate new G4Track object:
     
    358380                new G4Track(aScintillationPhoton,aSecondaryTime,aSecondaryPosition);
    359381
    360                 aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
     382                aSecondaryTrack->SetTouchableHandle(
     383                                 aStep.GetPreStepPoint()->GetTouchableHandle());
     384                // aSecondaryTrack->SetTouchableHandle((G4VTouchable*)0);
    361385
    362386                aSecondaryTrack->SetParentID(aTrack.GetTrackID());
     
    417441               
    418442                      // Retrieve the first intensity point in vector
    419                       // of (photon momentum, intensity) pairs
     443                      // of (photon energy, intensity) pairs
    420444
    421445                      theFastLightVector->ResetIterator();
     
    427451                      if (currentIN >= 0.0) {
    428452
    429                          // Create first (photon momentum, Scintillation
     453                         // Create first (photon energy, Scintillation
    430454                         // Integral pair 
    431455
    432456                         G4double currentPM = theFastLightVector->
    433                                                  GetPhotonMomentum();
     457                                                 GetPhotonEnergy();
    434458
    435459                         G4double currentCII = 0.0;
     
    444468                         G4double prevIN  = currentIN;
    445469
    446                          // loop over all (photon momentum, intensity)
     470                         // loop over all (photon energy, intensity)
    447471                         // pairs stored for this material 
    448472
     
    450474                         {
    451475                                currentPM = theFastLightVector->
    452                                                 GetPhotonMomentum();
     476                                                GetPhotonEnergy();
    453477
    454478                                currentIN=theFastLightVector-> 
     
    477501
    478502                      // Retrieve the first intensity point in vector
    479                       // of (photon momentum, intensity) pairs
     503                      // of (photon energy, intensity) pairs
    480504
    481505                      theSlowLightVector->ResetIterator();
     
    487511                      if (currentIN >= 0.0) {
    488512
    489                          // Create first (photon momentum, Scintillation
     513                         // Create first (photon energy, Scintillation
    490514                         // Integral pair
    491515
    492516                         G4double currentPM = theSlowLightVector->
    493                                                  GetPhotonMomentum();
     517                                                 GetPhotonEnergy();
    494518
    495519                         G4double currentCII = 0.0;
     
    504528                         G4double prevIN  = currentIN;
    505529
    506                          // loop over all (photon momentum, intensity)
     530                         // loop over all (photon energy, intensity)
    507531                         // pairs stored for this material
    508532
     
    510534                         {
    511535                                currentPM = theSlowLightVector->
    512                                                 GetPhotonMomentum();
     536                                                GetPhotonEnergy();
    513537
    514538                                currentIN=theSlowLightVector->
  • trunk/source/processes/electromagnetic/xrays/src/G4StrawTubeXTRadiator.cc

    r819 r961  
    2626//
    2727// $Id: G4StrawTubeXTRadiator.cc,v 1.6 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/xrays/src/G4SynchrotronRadiation.cc

    r819 r961  
    2626//
    2727// $Id: G4SynchrotronRadiation.cc,v 1.5 2006/06/29 19:56:15 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/xrays/src/G4SynchrotronRadiationInMat.cc

    r819 r961  
    2626//
    2727// $Id: G4SynchrotronRadiationInMat.cc,v 1.2 2006/06/29 19:56:17 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// --------------------------------------------------------------
  • trunk/source/processes/electromagnetic/xrays/src/G4TransitionRadiation.cc

    r819 r961  
    2626//
    2727// $Id: G4TransitionRadiation.cc,v 1.7 2006/06/29 19:56:19 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4TransitionRadiation class -- implementation file
  • trunk/source/processes/electromagnetic/xrays/src/G4TransparentRegXTRadiator.cc

    r819 r961  
    2626//
    2727// $Id: G4TransparentRegXTRadiator.cc,v 1.11 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030
  • trunk/source/processes/electromagnetic/xrays/src/G4VTransitionRadiation.cc

    r819 r961  
    2626//
    2727// $Id: G4VTransitionRadiation.cc,v 1.5 2006/06/29 19:56:23 gunter Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// G4VTransitionRadiation class -- implementation file
  • trunk/source/processes/electromagnetic/xrays/src/G4VXTRenergyLoss.cc

    r819 r961  
    2626//
    2727// $Id: G4VXTRenergyLoss.cc,v 1.44 2007/09/29 17:49:34 vnivanch Exp $
    28 // GEANT4 tag $Name: $
     28// GEANT4 tag $Name: geant4-09-02-ref-02 $
    2929//
    3030// History:
Note: See TracChangeset for help on using the changeset viewer.