00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include "G4VTransitionRadiation.hh"
00039 #include "G4ParticleDefinition.hh"
00040 #include "G4VTRModel.hh"
00041 #include "G4Material.hh"
00042 #include "G4Region.hh"
00043 #include "G4TransportationManager.hh"
00044
00046
00047 G4VTransitionRadiation::G4VTransitionRadiation( const G4String& processName,
00048 G4ProcessType type )
00049 : G4VDiscreteProcess(processName, type),
00050 region(0),
00051 model(0),
00052 nSteps(0),
00053 gammaMin(100),
00054 cosDThetaMax(std::cos(0.1))
00055 {
00056 Clear();
00057 }
00058
00060
00061 G4VTransitionRadiation::~G4VTransitionRadiation()
00062 {
00063 Clear();
00064 }
00065
00067
00068 void G4VTransitionRadiation::Clear()
00069 {
00070 materials.clear();
00071 steps.clear();
00072 normals.clear();
00073 nSteps = 0;
00074 }
00075
00077
00078 G4VParticleChange* G4VTransitionRadiation::PostStepDoIt(
00079 const G4Track& track,
00080 const G4Step& step)
00081 {
00082
00083
00084
00085 const G4Material* material = track.GetMaterial();
00086 G4double length = step.GetStepLength();
00087 G4ThreeVector direction = track.GetMomentumDirection();
00088
00089 if(nSteps == 0) {
00090
00091 nSteps = 1;
00092 materials.push_back(material);
00093 steps.push_back(length);
00094 const G4StepPoint* point = step.GetPreStepPoint();
00095 startingPosition = point->GetPosition();
00096 startingDirection = point->GetMomentumDirection();
00097 G4bool valid = true;
00098 G4ThreeVector n = G4TransportationManager::GetTransportationManager()
00099 ->GetNavigatorForTracking()->GetLocalExitNormal(&valid);
00100 if(valid) normals.push_back(n);
00101 else normals.push_back(direction);
00102
00103 } else {
00104
00105 if(material == materials[nSteps-1]) {
00106 steps[nSteps-1] += length;
00107 } else {
00108 nSteps++;
00109 materials.push_back(material);
00110 steps.push_back(length);
00111 G4bool valid = true;
00112 G4ThreeVector n = G4TransportationManager::GetTransportationManager()
00113 ->GetNavigatorForTracking()->GetLocalExitNormal(&valid);
00114 if(valid) normals.push_back(n);
00115 else normals.push_back(direction);
00116 }
00117 }
00118
00119
00120
00121 if(track.GetTrackStatus() == fStopAndKill ||
00122 track.GetVolume()->GetLogicalVolume()->GetRegion() != region ||
00123 startingDirection.x()*direction.x() +
00124 startingDirection.y()*direction.y() +
00125 startingDirection.z()*direction.z() < cosDThetaMax)
00126 {
00127 if(model) {
00128 model->GenerateSecondaries(*pParticleChange, materials, steps,
00129 normals, startingPosition, track);
00130 }
00131 Clear();
00132 }
00133
00134 return pParticleChange;
00135 }
00136
00138
00139 G4bool G4VTransitionRadiation::IsApplicable(
00140 const G4ParticleDefinition& aParticle)
00141 {
00142 return ( aParticle.GetPDGCharge() != 0.0 );
00143 }
00144
00146
00147
00148 void G4VTransitionRadiation::SetRegion(const G4Region* reg)
00149 {
00150 region = reg;
00151 }
00152
00154
00155 void G4VTransitionRadiation::SetModel(G4VTRModel* mod)
00156 {
00157 model = mod;
00158 }
00159
00161
00162 void G4VTransitionRadiation::PrintInfoDefinition()
00163 {
00164 if(model) model->PrintInfo();
00165 }
00166