G4VTransitionRadiation.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // G4VTransitionRadiation class -- implementation file
00030 
00031 // GEANT 4 class implementation file --- Copyright CERN 1995
00032 // CERN Geneva Switzerland
00033 
00034 // History:
00035 // 29.02.04 V.Ivanchenko create
00036 // 28.07.05, P.Gumplinger add G4ProcessType to constructor
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   // Fill temporary vectors
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   // Check POstStepPoint condition
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 

Generated on Mon May 27 17:50:23 2013 for Geant4 by  doxygen 1.4.7