G4ContinuousGainOfEnergy.hh

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: G4ContinuousGainOfEnergy.hh 69844 2013-05-16 09:19:33Z gcosmo $
00027 //
00029 //      Class:          G4ContinuousGainOfEnergy
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 //              -February-March 2009 Update for protons by L.Desorgher
00041 //              -July August 2009  Update for ion by L.Desorgher
00042 //
00043 //-------------------------------------------------------------
00044 //      Documentation:
00045 //              Continuous process acting on adjoint particles to compute the continuous gain of energy of charged particles when they are tracked back! 
00046 //              
00047 //
00048 #ifndef G4ContinuousGainOfEnergy_h
00049 #define G4ContinuousGainOfEnergy_h 1
00050 
00051 #include "G4VContinuousProcess.hh"
00052 #include "globals.hh"
00053 #include "G4Material.hh"
00054 #include "G4MaterialCutsCouple.hh"
00055 #include "G4Track.hh"
00056 #include "G4UnitsTable.hh"
00057 #include "G4ParticleChange.hh"
00058 #include "G4VEnergyLossProcess.hh"
00059 #include "G4ProductionCutsTable.hh"
00060 
00061 
00062 class G4Step;
00063 class G4ParticleDefinition;
00064 class G4VEmModel;
00065 class G4VEmFluctuationModel;
00066 
00067 
00068 
00069 class G4ContinuousGainOfEnergy : public G4VContinuousProcess
00070 {
00071 public:
00072 
00073   G4ContinuousGainOfEnergy(const G4String& name = "EnergyGain",
00074                          G4ProcessType type = fElectromagnetic);
00075 
00076   virtual ~G4ContinuousGainOfEnergy();
00077 
00078 
00079 protected:
00080 
00081  
00082   //------------------------------------------------------------------------
00083   // Methods with standard implementation; may be overwritten if needed 
00084   //------------------------------------------------------------------------
00085 protected:
00086 
00087  
00088   virtual G4double GetContinuousStepLimit(const G4Track& track,
00089                                                 G4double previousStepSize,
00090                                                 G4double currentMinimumStep,
00091                                                 G4double& currentSafety);
00092                                         
00093 
00094   //------------------------------------------------------------------------
00095   // Generic methods common to all processes 
00096   //------------------------------------------------------------------------
00097 public:
00098 
00099   
00100 
00101   void PreparePhysicsTable(const G4ParticleDefinition&);
00102 
00103   void BuildPhysicsTable(const G4ParticleDefinition&);
00104 
00105  
00106   G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
00107 
00108 
00109   void SetLossFluctuations(G4bool val);
00110   inline void SetIsIntegral(G4bool val){is_integral= val;}
00111   
00112   inline void SetDirectEnergyLossProcess(G4VEnergyLossProcess* aProcess){theDirectEnergyLossProcess=aProcess;};  
00113  
00114   void SetDirectParticle(G4ParticleDefinition* p);
00115 
00116 protected:
00117 
00118   
00119  
00120 
00121 private:
00122 
00123   void DefineMaterial(const G4MaterialCutsCouple* couple);
00124   void SetDynamicMassCharge(const G4Track& track, G4double energy);
00125  
00126  
00127   // hide  assignment operator
00128 
00129   G4ContinuousGainOfEnergy(G4ContinuousGainOfEnergy &);
00130   G4ContinuousGainOfEnergy & operator=(const G4ContinuousGainOfEnergy &right);
00131 
00132   
00133 private:
00134  
00135   const G4Material*  currentMaterial;
00136   const G4MaterialCutsCouple* currentCouple;
00137   size_t   currentMaterialIndex; 
00138   size_t   currentCoupleIndex; 
00139   G4double currentTcut;
00140   G4double currentCutInRange;
00141   G4double preStepKinEnergy;
00142   
00143   
00144  
00145   G4double linLossLimit; 
00146   G4bool   lossFluctuationFlag;
00147   G4bool   lossFluctuationArePossible;
00148   
00149   G4VEnergyLossProcess* theDirectEnergyLossProcess;
00150   G4ParticleDefinition* theDirectPartDef;
00151  
00152   
00153   G4bool is_integral;
00154   
00155   //adding for Ions
00156   //----------------
00157   G4bool IsIon; 
00158   G4double massRatio;
00159   G4double chargeSqRatio;
00160   G4VEmModel* currentModel; 
00161   G4double preStepChargeSqRatio;
00162   G4double preStepScaledKinEnergy;
00163   G4double preStepRange;
00164 
00165   
00166   
00167   
00168   
00169 };
00170 
00172 //
00173 inline void G4ContinuousGainOfEnergy::DefineMaterial(
00174             const G4MaterialCutsCouple* couple)
00175 {
00176   if(couple != currentCouple) {
00177     currentCouple   = couple;
00178     currentMaterial = couple->GetMaterial();
00179     currentCoupleIndex = couple->GetIndex();
00180     currentMaterialIndex = currentMaterial->GetIndex();
00181     
00182     size_t idx=1;
00183     const std::vector<G4double>* aVec = G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(idx);
00184     currentTcut=(*aVec)[currentCoupleIndex];
00185     currentCutInRange = couple->GetProductionCuts()->GetProductionCut(theDirectPartDef->GetParticleName());
00186     //G4cout<<"Define Material"<<G4endl;
00187     //if(!meanFreePath) ResetNumberOfInteractionLengthLeft();
00188   }
00189 }
00190 
00191 #endif

Generated on Mon May 27 17:47:57 2013 for Geant4 by  doxygen 1.4.7