Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:59:41

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 // G4VBiasingInteractionLaw
0027 //
0028 // Class Description:
0029 //
0030 // An abstract class to model interaction laws, not necessarily.
0031 // exponential ones.
0032 // These laws, p(l), are caraterized by their:
0033 //    - non-interaction probability over l:
0034 //      P_NI(l) = 1 - integral(0,l) p(s) ds
0035 //    - effective cross-section at l:
0036 //      sigma_eff(l) = p(l)/P_NI(l) (several forms exist)
0037 // If several laws compete, the resulting net law has:
0038 //    - an non-interaction probability over a lenght l which
0039 //      is the product of the individual non-interaction probabilities.
0040 //    - an effective cross-section which is the
0041 //      sum on the individual effective cross-sections.
0042 //
0043 // Author: M.Verderi (LLR), November 2013
0044 // --------------------------------------------------------------------
0045 #ifndef G4VBiasingInteractionLaw_hh
0046 #define G4VBiasingInteractionLaw_hh 1
0047 
0048 #include "globals.hh"
0049 #include <vector>
0050 
0051 class G4BiasingProcessInterface;
0052 
0053 class G4VBiasingInteractionLaw
0054 {
0055   public:
0056 
0057     G4VBiasingInteractionLaw(const G4String& name)
0058       : fName(name), fSampledInteractionLength(DBL_MAX) {}
0059     virtual ~G4VBiasingInteractionLaw() = default;
0060 
0061     const G4String& GetName() const { return fName; }
0062 
0063     // -- Compute non-interaction probability and effective cross-section:
0064     // -- (probability of interaction over dl =  effective_cross-section* dl)
0065     virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const = 0;
0066     virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const = 0;
0067 
0068     // -- Methods to deal with singularities : null cross sections or infinite ones.
0069     // -- In such cases, weight can not always be computed.
0070     // -- Tells if this interaction law has singularities:
0071     virtual G4bool IsSingular() const { return false; }
0072     // -- method interrogated only in case interaction law is IsSingular() == true:
0073     virtual G4bool IsEffectiveCrossSectionInfinite() const { return false; }
0074 
0075     // -----------------------------------------
0076     // -- public interface to protected methods:
0077     // -----------------------------------------
0078     G4double Sample()
0079     {
0080       fSampledInteractionLength = SampleInteractionLength();
0081       return fSampledInteractionLength;
0082     }
0083     G4double UpdateForStep(G4double truePathLength)
0084     {
0085       fSampledInteractionLength = UpdateInteractionLengthForStep(truePathLength);
0086       return fSampledInteractionLength;
0087     }
0088     G4double GetSampledInteractionLength() const
0089     {
0090       return fSampledInteractionLength;
0091     }
0092 
0093   protected:
0094 
0095     // -- Sample the distribution for point like interaction (PostStep ones)
0096     virtual G4double SampleInteractionLength() = 0;
0097 
0098     // -- Convenience method, used in many daughters classes :
0099     // -- update the distribution for a made step of truePathLength size:
0100     virtual G4double UpdateInteractionLengthForStep(G4double /* truePathLength */)
0101       { return DBL_MAX; }
0102 
0103   private:
0104 
0105     G4String fName;
0106     G4double fSampledInteractionLength;
0107 };
0108 
0109 #endif