source: trunk/source/processes/electromagnetic/xrays/src/G4VTransitionRadiation.cc @ 1354

Last change on this file since 1354 was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 5.4 KB
Line 
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,v 1.6 2010/06/16 15:34:15 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30// G4VTransitionRadiation class -- implementation file
31
32// GEANT 4 class implementation file --- Copyright CERN 1995
33// CERN Geneva Switzerland
34
35// History:
36// 29.02.04 V.Ivanchenko create
37// 28.07.05, P.Gumplinger add G4ProcessType to constructor
38
39#include "G4VTransitionRadiation.hh"
40#include "G4ParticleDefinition.hh"
41#include "G4VTRModel.hh"
42#include "G4Material.hh"
43#include "G4Region.hh"
44#include "G4TransportationManager.hh"
45
46///////////////////////////////////////////////////////////////////////
47
48G4VTransitionRadiation::G4VTransitionRadiation( const G4String& processName,
49                                                      G4ProcessType type )
50  : G4VDiscreteProcess(processName, type),
51  nSteps(0),
52  gammaMin(100),
53  cosDThetaMax(std::cos(0.1))
54{
55  Clear();
56}
57
58///////////////////////////////////////////////////////////////////////
59
60G4VTransitionRadiation::~G4VTransitionRadiation()
61{
62  Clear();
63}
64
65///////////////////////////////////////////////////////////////////////
66
67void G4VTransitionRadiation::Clear()
68{
69  materials.clear();
70  steps.clear();
71  normals.clear();
72  nSteps = 0;
73}
74
75///////////////////////////////////////////////////////////////////////
76
77G4VParticleChange* G4VTransitionRadiation::PostStepDoIt(
78                                     const G4Track& track,
79                                     const G4Step& step)
80{
81
82  // Fill temporary vectors
83
84  const G4Material* material = track.GetMaterial();
85  G4double length = step.GetStepLength();
86  G4ThreeVector direction = track.GetMomentumDirection();
87
88  if(nSteps == 0) {
89
90    nSteps = 1;
91    materials.push_back(material);
92    steps.push_back(length);
93    const G4StepPoint* point = step.GetPreStepPoint();
94    startingPosition = point->GetPosition();
95    startingDirection = point->GetMomentumDirection();
96    G4bool valid = true;
97    G4ThreeVector n = G4TransportationManager::GetTransportationManager()
98                    ->GetNavigatorForTracking()->GetLocalExitNormal(&valid);
99    if(valid) normals.push_back(n);
100    else      normals.push_back(direction);
101
102  } else {
103
104    if(material == materials[nSteps-1]) {
105      steps[nSteps-1] += length;
106    } else {
107      nSteps++;
108      materials.push_back(material);
109      steps.push_back(length);
110      G4bool valid = true;
111      G4ThreeVector n = G4TransportationManager::GetTransportationManager()
112                      ->GetNavigatorForTracking()->GetLocalExitNormal(&valid);
113      if(valid) normals.push_back(n);
114      else      normals.push_back(direction);
115    }
116  }
117
118  // Check POstStepPoint condition
119
120  if(track.GetTrackStatus() == fStopAndKill ||
121     track.GetVolume()->GetLogicalVolume()->GetRegion() != region ||
122     startingDirection.x()*direction.x() +
123     startingDirection.y()*direction.y() +
124     startingDirection.z()*direction.z() < cosDThetaMax)
125  {
126     if(model) {
127       model->GenerateSecondaries(*pParticleChange, materials, steps,
128                                  normals, startingPosition, track);
129     }
130     Clear();
131  }
132
133  return pParticleChange;
134}
135
136///////////////////////////////////////////////////////////////////////
137
138G4bool G4VTransitionRadiation::IsApplicable(
139                                const G4ParticleDefinition& aParticle)
140{
141  return ( aParticle.GetPDGCharge() != 0.0 );
142}
143
144///////////////////////////////////////////////////////////////////////
145
146
147void G4VTransitionRadiation::SetRegion(const G4Region* reg)
148{
149  region = reg;
150}
151
152///////////////////////////////////////////////////////////////////////
153
154void G4VTransitionRadiation::SetModel(G4VTRModel* m)
155{
156  model = m;
157}
158
159///////////////////////////////////////////////////////////////////////
160
161void G4VTransitionRadiation::PrintInfoDefinition()
162{
163  if(model) model->PrintInfo();
164}
165
166///////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.