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 // $Id: G4AdjointAlongStepWeightCorrection.hh 69844 2013-05-16 09:19:33Z gcosmo $ 00027 // 00029 // Class: G4AdjointAlongStepWeightCorrection 00030 // Author: L. Desorgher 00031 // Organisation: SpaceIT GmbH 00032 // Contract: ESA contract 21435/08/NL/AT 00033 // Customer: ESA/ESTEC 00035 // 00036 // CHANGE HISTORY 00037 // -------------- 00038 // ChangeHistory: 00039 // 10 May 2007 creation by L. Desorgher 00040 // October 2009 implementation of the mode where the total adjoint and forward cross sections are equivalent. L. Desorgher 00041 // 00042 //------------------------------------------------------------- 00043 // Documentation: 00044 // Continuous processes acting on adjoint particles to correct continuously their weight during the adjoint reverse tracking. 00045 // Thi process is needed whene the adjoint cross section are not scaled such that the total adjoint cross section match the total forward cross section. 00046 // By default the mode where the total adjoint cross section is equal to the total forward cross section is used an therefore this along step weight 00047 // correction factor is 1. 00048 // However in some cases (some energy ranges) the total forward cross section or the total adjoint cross section can be null, in this case the along step 00049 // weight correction is neede and is given by exp(-(Sigma_tot_adj-Sigma_tot_fwd).dx) 00050 // 00051 // 00052 // 00053 00054 00055 #ifndef G4AdjointAlongStepWeightCorrection_h 00056 #define G4AdjointAlongStepWeightCorrection_h 1 00057 00058 #include "G4VContinuousProcess.hh" 00059 #include "globals.hh" 00060 #include "G4Material.hh" 00061 #include "G4MaterialCutsCouple.hh" 00062 #include "G4Track.hh" 00063 #include "G4ParticleChange.hh" 00064 00065 class G4Step; 00066 class G4ParticleDefinition; 00067 00068 00069 00070 class G4AdjointAlongStepWeightCorrection : public G4VContinuousProcess 00071 { 00072 public: 00073 00074 G4AdjointAlongStepWeightCorrection(const G4String& name = "ContinuousWeightCorrection", 00075 G4ProcessType type = fElectromagnetic); 00076 00077 virtual ~G4AdjointAlongStepWeightCorrection(); 00078 00079 00080 protected: 00081 virtual G4double GetContinuousStepLimit(const G4Track& track, 00082 G4double previousStepSize, 00083 G4double currentMinimumStep, 00084 G4double& currentSafety); 00085 00086 00087 //------------------------------------------------------------------------ 00088 // Generic methods common to all processes 00089 //------------------------------------------------------------------------ 00090 public: 00091 00092 void PreparePhysicsTable(const G4ParticleDefinition&); 00093 00094 void BuildPhysicsTable(const G4ParticleDefinition&); 00095 00096 G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&); 00097 00098 00099 private: 00100 00101 void DefineMaterial(const G4MaterialCutsCouple* couple); 00102 00103 00104 00105 G4AdjointAlongStepWeightCorrection(G4AdjointAlongStepWeightCorrection &); 00106 G4AdjointAlongStepWeightCorrection & operator=(const G4AdjointAlongStepWeightCorrection &right); 00107 00108 00109 00110 protected: 00111 00112 G4ParticleChange* fParticleChange; 00113 00114 00115 private: 00116 00117 const G4Material* currentMaterial; 00118 const G4MaterialCutsCouple* currentCouple; 00119 size_t currentMaterialIndex; 00120 G4double preStepKinEnergy; 00121 00122 }; 00123 00124 inline void G4AdjointAlongStepWeightCorrection::DefineMaterial( 00125 const G4MaterialCutsCouple* couple) 00126 { 00127 if(couple != currentCouple) { 00128 currentCouple = couple; 00129 currentMaterial = couple->GetMaterial(); 00130 currentMaterialIndex = couple->GetIndex(); 00131 00132 } 00133 } 00134 00135 00136 00137 #endif