Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VBiasingInteractionLaw.hh
Go to the documentation of this file.
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 //
27 // $Id: $
28 //
29 // --------------------------------------------------------------------
30 // GEANT 4 class header file
31 //
32 // Class Description:
33 //
34 // An abstract class to model interaction laws, not necessarily.
35 // exponential ones.
36 // These laws, p(l), are caraterized by their:
37 // - non-interaction probability over l:
38 // P_NI(l) = 1 - integral(0,l) p(s) ds
39 // - effective cross-section at l:
40 // sigma_eff(l) = p(l)/P_NI(l) (several forms exist)
41 // If several laws compete, the resulting net law has:
42 // - an non-interaction probability over a lenght l which
43 // is the product of the individual non-interaction probabilities.
44 // - an effective cross-section which is the
45 // sum on the individual effective cross-sections.
46 //
47 // ----------------G4VBiasingInteractionLaw ----------------
48 //
49 // Author: M.Verderi (LLR), November 2013
50 // - 05/11/13 : First Implementation
51 // --------------------------------------------------------------------
52 
53 
54 #ifndef G4VBiasingInteractionLaw_hh
55 #define G4VBiasingInteractionLaw_hh 1
56 
57 #include "globals.hh"
58 #include <vector>
59 
61 
63 public:
64  G4VBiasingInteractionLaw(G4String name) : fName(name), fSampledInteractionLength(DBL_MAX) {}
66 
67 public:
68  const G4String& GetName() const { return fName; }
69 
70  // ----------------------------
71  // -- Interface to sub-classes:
72  // ----------------------------
73 protected:
74  // -- Sample the distribution for point like interaction (PostStep ones)
75  virtual G4double SampleInteractionLength() = 0;
76 public:
77  // -- Compute non-interaction probability and effective cross-section:
78  // -- (probability of interaction over dl = effective_cross-section* dl)
79  virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const = 0;
80  virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const = 0;
81 protected:
82  // -- Convenience method, used in many daughters classes :
83  // -- update the distribution for a made step of truePathLength size:
84  virtual G4double UpdateInteractionLengthForStep(G4double /* truePathLength */) { return DBL_MAX; }
85 public:
86  // -- Methods to deal with singularities : null cross sections or infinite ones.
87  // -- In such cases, weight can not always be computed.
88  // -- Tells if this interaction law has singularities:
89  virtual G4bool IsSingular() const {return false;}
90  // -- method interrogated only in case interaction law is IsSingular() == true:
91  virtual G4bool IsEffectiveCrossSectionInfinite() const {return false;}
92 
93 
94  // -----------------------------------------
95  // -- public interface to protected methods:
96  // -----------------------------------------
97 public:
99  {
100  fSampledInteractionLength = SampleInteractionLength();
101  return fSampledInteractionLength;
102  }
104  {
105  fSampledInteractionLength = UpdateInteractionLengthForStep(truePathLength);
106  return fSampledInteractionLength;
107  }
108  G4double GetSampledInteractionLength() const { return fSampledInteractionLength; }
109 
110 
111 private:
112  G4String fName;
113  G4double fSampledInteractionLength;
114 };
115 
116 #endif
const XML_Char * name
Definition: expat.h:151
virtual G4double UpdateInteractionLengthForStep(G4double)
virtual G4double SampleInteractionLength()=0
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const =0
bool G4bool
Definition: G4Types.hh:79
virtual G4bool IsSingular() const
virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const =0
G4double UpdateForStep(G4double truePathLength)
G4double GetSampledInteractionLength() const
const G4String & GetName() const
virtual G4bool IsEffectiveCrossSectionInfinite() const
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83