Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:11

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 #ifndef G4ElectronIonPair_h
0027 #define G4ElectronIonPair_h 1
0028 
0029 // -------------------------------------------------------------
0030 //
0031 // GEANT4 Class header file
0032 //
0033 //
0034 // File name:     G4ElectronIonPair
0035 //
0036 // Author:        Vladimir Ivanchenko
0037 //
0038 // Creation date: 08.07.2008
0039 //
0040 // Modifications:
0041 //
0042 //
0043 // Class Description:
0044 //   Compution on number of electon-ion or electorn-hole pairs
0045 //   at the step of a particle and sampling ionisation points 
0046 //   in space
0047 //
0048 // Based on ICRU Report 31, 1979
0049 // "Average Energy Required to Produce an Ion Pair" 
0050 //
0051 // 06.04.2010 V. Grichine, substitute Gauss by Gamma for ionisation 
0052 //                         distribution at fixed energy deposition
0053 // 
0054 // -------------------------------------------------------------
0055 
0056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0058 
0059 #include "globals.hh"
0060 #include "G4Step.hh"
0061 #include "G4ParticleDefinition.hh"
0062 #include "G4ThreeVector.hh"
0063 #include "G4VProcess.hh"
0064 #include "Randomize.hh"
0065 #include <vector>
0066 
0067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0068 
0069 class G4Material;
0070 
0071 class G4ElectronIonPair
0072 {
0073 public: 
0074 
0075   explicit G4ElectronIonPair(G4int verb);
0076 
0077   virtual ~G4ElectronIonPair();
0078 
0079   // compute mean number of ionisation points at a step
0080   G4double MeanNumberOfIonsAlongStep(const G4ParticleDefinition*, 
0081                      const G4Material*,
0082                      G4double edepTotal,
0083                      G4double edepNIEL = 0.0);
0084 
0085   inline G4double MeanNumberOfIonsAlongStep(const G4Step*); 
0086 
0087   inline G4int SampleNumberOfIonsAlongStep(const G4Step*); 
0088 
0089   // returns pointer to the new vector of positions of
0090   // ionisation points in the World coordinate system 
0091   std::vector<G4ThreeVector>* SampleIonsAlongStep(const G4Step*);
0092 
0093   // compute number of holes in the atom after PostStep interaction
0094   G4int ResidualeChargePostStep(const G4ParticleDefinition*,
0095                 const G4TrackVector* secondary = nullptr,
0096                 G4int processSubType = -1) const;
0097 
0098   inline G4int ResidualeChargePostStep(const G4Step*) const;
0099 
0100   // find mean energies per ionisation 
0101   G4double FindG4MeanEnergyPerIonPair(const G4Material*) const;
0102 
0103   // dump mean energies per ionisation used in run time
0104   void DumpMeanEnergyPerIonPair() const;
0105 
0106   // dump G4 list
0107   void DumpG4MeanEnergyPerIonPair() const;
0108 
0109   inline void SetVerbose(G4int);
0110 
0111   // hide assignment operator
0112   G4ElectronIonPair & operator=(const G4ElectronIonPair &right) = delete;
0113   G4ElectronIonPair(const G4ElectronIonPair&) = delete;
0114 
0115 private:
0116 
0117   void Initialise();
0118 
0119   G4double FindMeanEnergyPerIonPair(const G4Material*) const;
0120 
0121   // cache
0122   const G4Material*  curMaterial;
0123   G4double           curMeanEnergy;
0124 
0125   G4double invFanoFactor;
0126   
0127   G4int    verbose;             
0128   G4int    nMaterials;
0129 
0130   // list of G4 NIST materials with mean energy per ion defined 
0131   std::vector<G4double>  g4MatData;
0132   std::vector<G4String>  g4MatNames;
0133 };
0134 
0135 inline G4double 
0136 G4ElectronIonPair::MeanNumberOfIonsAlongStep(const G4Step* step) 
0137 {
0138   return MeanNumberOfIonsAlongStep(step->GetTrack()->GetParticleDefinition(),
0139                    step->GetPreStepPoint()->GetMaterial(),
0140                    step->GetTotalEnergyDeposit(),
0141                    step->GetNonIonizingEnergyDeposit());
0142 }
0143 
0144 inline G4int 
0145 G4ElectronIonPair::SampleNumberOfIonsAlongStep(const G4Step* step) 
0146 {
0147   // use gamma distribution with mean value n=meanion and 
0148   // dispersion D=meanion/invFanoFactor
0149   G4double meanion = MeanNumberOfIonsAlongStep(step);
0150   return G4lrint(G4RandGamma::shoot(meanion*invFanoFactor,invFanoFactor));
0151 } 
0152 
0153 inline G4int 
0154 G4ElectronIonPair::ResidualeChargePostStep(const G4Step* step) const
0155 {
0156   G4int subtype = -1;
0157   const G4VProcess* proc = step->GetPostStepPoint()->GetProcessDefinedStep();
0158   if(proc) { subtype = proc->GetProcessSubType(); }
0159   return ResidualeChargePostStep(step->GetTrack()->GetParticleDefinition(),
0160                  step->GetSecondary(),
0161                  subtype);
0162 }
0163 
0164 inline void G4ElectronIonPair::SetVerbose(G4int val)
0165 {
0166   verbose = val;
0167 }
0168 
0169 #endif
0170