G4VAdjointReverseReaction.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 // $Id: G4VAdjointReverseReaction.cc 69844 2013-05-16 09:19:33Z gcosmo $
00027 //
00028 #include "G4VAdjointReverseReaction.hh"
00029 #include "G4SystemOfUnits.hh"
00030 #include "G4AdjointCSManager.hh"
00031 #include "G4AdjointCSMatrix.hh"
00032 #include "G4AdjointInterpolator.hh"
00033 #include "G4AdjointCSMatrix.hh"
00034 #include "G4VEmAdjointModel.hh"
00035 #include "G4ElementTable.hh"
00036 #include "G4Element.hh"
00037 #include "G4Material.hh"
00038 #include "G4MaterialCutsCouple.hh"
00039 #include "G4AdjointCSManager.hh"
00040 #include "G4ParticleChange.hh"
00041 #include "G4AdjointElectron.hh"
00042 
00043 
00044 G4VAdjointReverseReaction::
00045 	G4VAdjointReverseReaction(G4String process_name, G4bool whichScatCase):
00046                         G4VDiscreteProcess(process_name)
00047 {theAdjointCSManager = G4AdjointCSManager::GetAdjointCSManager();
00048  IsScatProjToProjCase=whichScatCase;
00049  fParticleChange=new G4ParticleChange();
00050  IsFwdCSUsed=false;
00051  IsIntegralModeUsed=false;
00052  lastCS=0.;
00053 }
00055 //
00056 G4VAdjointReverseReaction::
00057 	~G4VAdjointReverseReaction()
00058 { if (fParticleChange) delete fParticleChange;
00059 }                       
00061 //
00062 void G4VAdjointReverseReaction::PreparePhysicsTable(const G4ParticleDefinition&)
00063 {;
00064 }
00066 //
00067 void G4VAdjointReverseReaction::BuildPhysicsTable(const G4ParticleDefinition&)
00068 {
00069 
00070  theAdjointCSManager->BuildCrossSectionMatrices(); //do not worry it will be done just once
00071  theAdjointCSManager->BuildTotalSigmaTables();
00072 
00073 }
00075 //
00076 G4VParticleChange* G4VAdjointReverseReaction::PostStepDoIt(const G4Track& track, const G4Step&  )
00077 { 
00078   
00079   
00080   
00081   fParticleChange->Initialize(track);
00082  
00083  /* if (IsFwdCSUsed && IsIntegralModeUsed){ //INtegral mode still unstable
00084          G4double Tkin = step.GetPostStepPoint()->GetKineticEnergy();
00085          G4double fwdCS = theAdjointCSManager->GetTotalForwardCS(track.GetDefinition(), Tkin, track.GetMaterialCutsCouple());
00086          //G4cout<<"lastCS "<<lastCS<<G4endl;
00087          if (fwdCS<lastCS*G4UniformRand()) { // the reaction does not take place, same integral method as the one used for forward ionisation in  G4 
00088                 ClearNumberOfInteractionLengthLeft();
00089                 return fParticleChange;
00090          } 
00091          
00092   }
00093  */
00094  
00095   theAdjointEMModel->SampleSecondaries(track,
00096                                        IsScatProjToProjCase,
00097                                         fParticleChange);
00098   
00099   ClearNumberOfInteractionLengthLeft();
00100   return fParticleChange;
00101                         
00102    
00103   
00104 }
00106 //
00107 G4double G4VAdjointReverseReaction::GetMeanFreePath(const G4Track& track,
00108                                                                                      G4double ,
00109                                                                                      G4ForceCondition* condition)
00110 { *condition = NotForced;
00111   G4double preStepKinEnergy = track.GetKineticEnergy();
00112   
00113   /*G4double Sigma =
00114                 theAdjointEMModel->AdjointCrossSection(track.GetMaterialCutsCouple(),preStepKinEnergy,IsScatProjToProjCase);*/
00115                 
00116   G4double Sigma =
00117                 theAdjointEMModel->GetAdjointCrossSection(track.GetMaterialCutsCouple(),preStepKinEnergy,IsScatProjToProjCase); 
00118   G4double fwd_TotCS;
00119   Sigma *=  theAdjointCSManager->GetCrossSectionCorrection(track.GetDefinition(),preStepKinEnergy,track.GetMaterialCutsCouple(),IsFwdCSUsed, fwd_TotCS);
00120   //G4cout<<fwd_TotCS<<G4endl;
00121   /*if (IsFwdCSUsed && IsIntegralModeUsed){ //take the maximum cross section only for charged particle          
00122         G4double e_sigma_max, sigma_max;
00123         theAdjointCSManager->GetMaxFwdTotalCS(track.GetDefinition(),
00124                                      track.GetMaterialCutsCouple(), e_sigma_max, sigma_max);
00125         if (e_sigma_max > preStepKinEnergy){
00126                 Sigma*=sigma_max/fwd_TotCS;
00127         }                    
00128   }
00129   */            
00130 
00131   G4double mean_free_path = 1.e60 *mm; 
00132   if (Sigma>0) mean_free_path = 1./Sigma;
00133   lastCS=Sigma;
00134   
00135   /*G4cout<<"Sigma  "<<Sigma<<G4endl;
00136   G4cout<<"mean_free_path [mm] "<<mean_free_path/mm<<G4endl;
00137   */
00138   
00139 
00140   return mean_free_path;
00141 }                                        

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