Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:19

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