Geant4  10.03
G4VTransitionRadiation.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4VTransitionRadiation.cc 97385 2016-06-02 09:59:53Z gcosmo $
28 //
29 // G4VTransitionRadiation class -- implementation file
30 
31 // GEANT 4 class implementation file --- Copyright CERN 1995
32 // CERN Geneva Switzerland
33 
34 // History:
35 // 29.02.04 V.Ivanchenko create
36 // 28.07.05, P.Gumplinger add G4ProcessType to constructor
37 
39 #include "G4ParticleDefinition.hh"
40 #include "G4VTRModel.hh"
41 #include "G4Material.hh"
42 #include "G4Region.hh"
44 #include "G4EmProcessSubType.hh"
45 
47 
49  G4ProcessType type )
50  : G4VDiscreteProcess(processName, type),
51  region(nullptr),
52  model(nullptr),
53  nSteps(0),
54  gammaMin(100.),
55  cosDThetaMax(std::cos(0.1))
56 {
58  Clear();
59 }
60 
62 
64 {
65  Clear();
66 }
67 
69 
71 {
72  materials.clear();
73  steps.clear();
74  normals.clear();
75  nSteps = 0;
76 }
77 
79 
81  const G4Track& track,
82  const G4Step& step)
83 {
84 
85  // Fill temporary vectors
86 
87  const G4Material* material = track.GetMaterial();
88  G4double length = step.GetStepLength();
89  G4ThreeVector direction = track.GetMomentumDirection();
90 
91  if(nSteps == 0) {
92 
93  nSteps = 1;
94  materials.push_back(material);
95  steps.push_back(length);
96  const G4StepPoint* point = step.GetPreStepPoint();
97  startingPosition = point->GetPosition();
99  G4bool valid = true;
102  if(valid) normals.push_back(n);
103  else normals.push_back(direction);
104 
105  } else {
106 
107  if(material == materials[nSteps-1]) {
108  steps[nSteps-1] += length;
109  } else {
110  nSteps++;
111  materials.push_back(material);
112  steps.push_back(length);
113  G4bool valid = true;
116  if(valid) normals.push_back(n);
117  else normals.push_back(direction);
118  }
119  }
120 
121  // Check POstStepPoint condition
122 
123  if(track.GetTrackStatus() == fStopAndKill ||
124  track.GetVolume()->GetLogicalVolume()->GetRegion() != region ||
125  startingDirection.x()*direction.x() +
126  startingDirection.y()*direction.y() +
127  startingDirection.z()*direction.z() < cosDThetaMax)
128  {
129  if(model) {
131  normals, startingPosition, track);
132  }
133  Clear();
134  }
135 
136  return pParticleChange;
137 }
138 
140 
142  const G4ParticleDefinition& aParticle)
143 {
144  return ( aParticle.GetPDGCharge() != 0.0 );
145 }
146 
148 
149 
151 {
152  region = reg;
153 }
154 
156 
158 {
159  model = mod;
160 }
161 
163 
165 {
166  if(model) model->PrintInfo();
167 }
168 
virtual G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &step) override
virtual void PrintInfo()
Definition: G4VTRModel.hh:71
CLHEP::Hep3Vector G4ThreeVector
G4double GetStepLength() const
G4TrackStatus GetTrackStatus() const
G4Navigator * GetNavigatorForTracking() const
G4Region * GetRegion() const
static const G4double reg
G4VTransitionRadiation(const G4String &processName="TR", G4ProcessType type=fElectromagnetic)
G4StepPoint * GetPreStepPoint() const
virtual void GenerateSecondaries(G4VParticleChange &pChange, std::vector< const G4Material * > &materials, std::vector< G4double > &steps, std::vector< G4ThreeVector > &normals, G4ThreeVector &startingPosition, const G4Track &track)
const G4ThreeVector & GetMomentumDirection() const
std::vector< G4ThreeVector > normals
virtual G4ThreeVector GetLocalExitNormal(G4bool *valid)
const G4ThreeVector & GetPosition() const
bool G4bool
Definition: G4Types.hh:79
void SetProcessSubType(G4int)
Definition: G4VProcess.hh:432
Definition: G4Step.hh:76
const G4int n
G4Material * GetMaterial() const
static G4TransportationManager * GetTransportationManager()
virtual G4bool IsApplicable(const G4ParticleDefinition &aParticleType) override
const G4ThreeVector & GetMomentumDirection() const
G4LogicalVolume * GetLogicalVolume() const
G4VParticleChange * pParticleChange
Definition: G4VProcess.hh:283
G4VPhysicalVolume * GetVolume() const
double G4double
Definition: G4Types.hh:76
std::vector< const G4Material * > materials
G4double GetPDGCharge() const
std::vector< G4double > steps
void SetRegion(const G4Region *reg)
G4ProcessType