source: trunk/source/processes/electromagnetic/adjoint/include/G4ContinuousGainOfEnergy.hh

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

tag geant4.9.4 beta 1 + modifs locales

File size: 6.1 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// $Id: G4ContinuousGainOfEnergy.hh,v 1.4 2009/11/20 10:31:20 ldesorgh Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-01 $
28//
29/////////////////////////////////////////////////////////////////////////////////
30//      Class:          G4ContinuousGainOfEnergy
31//      Author:         L. Desorgher
32//      Organisation:   SpaceIT GmbH
33//      Contract:       ESA contract 21435/08/NL/AT
34//      Customer:       ESA/ESTEC
35/////////////////////////////////////////////////////////////////////////////////
36//
37// CHANGE HISTORY
38// --------------
39//      ChangeHistory:
40//              -10 May 2007 creation by L. Desorgher 
41//              -February-March 2009 Update for protons by L.Desorgher
42//              -July August 2009  Update for ion by L.Desorgher
43//
44//-------------------------------------------------------------
45//      Documentation:
46//              Continuous process acting on adjoint particles to compute the continuous gain of energy of charged particles when they are tracked back!
47//             
48//
49#ifndef G4ContinuousGainOfEnergy_h
50#define G4ContinuousGainOfEnergy_h 1
51
52#include "G4VContinuousProcess.hh"
53#include "globals.hh"
54#include "G4Material.hh"
55#include "G4MaterialCutsCouple.hh"
56#include "G4Track.hh"
57#include "G4UnitsTable.hh"
58#include "G4ParticleChange.hh"
59#include "G4VEnergyLossProcess.hh"
60#include "G4ProductionCutsTable.hh"
61
62
63class G4Step;
64class G4ParticleDefinition;
65class G4VEmModel;
66class G4VEmFluctuationModel;
67
68
69
70class G4ContinuousGainOfEnergy : public G4VContinuousProcess
71{
72public:
73
74  G4ContinuousGainOfEnergy(const G4String& name = "EnergyGain",
75                         G4ProcessType type = fElectromagnetic);
76
77  virtual ~G4ContinuousGainOfEnergy();
78
79
80protected:
81
82 
83  //------------------------------------------------------------------------
84  // Methods with standard implementation; may be overwritten if needed
85  //------------------------------------------------------------------------
86protected:
87
88 
89  virtual G4double GetContinuousStepLimit(const G4Track& track,
90                                                G4double previousStepSize,
91                                                G4double currentMinimumStep,
92                                                G4double& currentSafety);
93                                       
94
95  //------------------------------------------------------------------------
96  // Generic methods common to all processes
97  //------------------------------------------------------------------------
98public:
99
100 
101
102  void PreparePhysicsTable(const G4ParticleDefinition&);
103
104  void BuildPhysicsTable(const G4ParticleDefinition&);
105
106 
107  G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&);
108
109
110  void SetLossFluctuations(G4bool val);
111  inline void SetIsIntegral(G4bool val){is_integral= val;}
112 
113  inline void SetDirectEnergyLossProcess(G4VEnergyLossProcess* aProcess){theDirectEnergyLossProcess=aProcess;}; 
114 
115  void SetDirectParticle(G4ParticleDefinition* p);
116
117protected:
118
119 
120 
121
122private:
123
124  void DefineMaterial(const G4MaterialCutsCouple* couple);
125  void SetDynamicMassCharge(const G4Track& track, G4double energy);
126 
127 
128  // hide  assignment operator
129
130  G4ContinuousGainOfEnergy(G4ContinuousGainOfEnergy &);
131  G4ContinuousGainOfEnergy & operator=(const G4ContinuousGainOfEnergy &right);
132
133 
134private:
135 
136  const G4Material*  currentMaterial;
137  const G4MaterialCutsCouple* currentCouple;
138  size_t   currentMaterialIndex; 
139  size_t   currentCoupleIndex; 
140  G4double currentTcut;
141  G4double currentCutInRange;
142  G4double preStepKinEnergy;
143 
144 
145 
146  G4double linLossLimit; 
147  G4bool   lossFluctuationFlag;
148  G4bool   lossFluctuationArePossible;
149 
150  G4VEnergyLossProcess* theDirectEnergyLossProcess;
151  G4ParticleDefinition* theDirectPartDef;
152 
153 
154  G4bool is_integral;
155 
156  //adding for Ions
157  //----------------
158  G4bool IsIon; 
159  G4double massRatio;
160  G4double chargeSqRatio;
161  G4VEmModel* currentModel; 
162  G4double preStepChargeSqRatio;
163  G4double preStepScaledKinEnergy;
164
165 
166 
167 
168 
169};
170
171///////////////////////////////////////////////////////
172//
173inline void G4ContinuousGainOfEnergy::DefineMaterial(
174            const G4MaterialCutsCouple* couple)
175{
176  if(couple != currentCouple) {
177    currentCouple   = couple;
178    currentMaterial = couple->GetMaterial();
179    currentCoupleIndex = couple->GetIndex();
180    currentMaterialIndex = currentMaterial->GetIndex();
181   
182    size_t idx=1;
183    const std::vector<G4double>* aVec = G4ProductionCutsTable::GetProductionCutsTable()->GetEnergyCutsVector(idx);
184    currentTcut=(*aVec)[currentCoupleIndex];
185    currentCutInRange = couple->GetProductionCuts()->GetProductionCut(theDirectPartDef->GetParticleName());
186    //G4cout<<"Define Material"<<G4endl;
187    //if(!meanFreePath) ResetNumberOfInteractionLengthLeft();
188  }
189}
190
191#endif
Note: See TracBrowser for help on using the repository browser.