Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:14:09

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 // G4BOptnForceCommonTruncatedExp
0027 //
0028 // Class Description:
0029 //
0030 // A G4VBiasingOperation physics-based biasing operation. It
0031 // handles several processes together, biasing on the total
0032 // cross-section of these processes (instead of biasing them
0033 // individually).
0034 // The biasing interaction law is a truncated exponential
0035 // one, driven by the total cross-section and which extends
0036 // in the range [0,L].
0037 // Process are registered with the AddCrossSection() method.
0038 // As cross-sections are all known at the end of the
0039 // PostStepGPIL loop, the step limitation is made at the
0040 // AlongStepGPIL level.
0041 //
0042 // Author: Marc Verderi, November 2013.
0043 // --------------------------------------------------------------------
0044 #ifndef G4BOptnForceCommonTruncatedExp_hh
0045 #define G4BOptnForceCommonTruncatedExp_hh 1
0046 
0047 #include "G4VBiasingOperation.hh"
0048 #include "G4ThreeVector.hh"
0049 #include "G4ParticleChangeForNothing.hh"
0050 
0051 #include <map>
0052 
0053 class G4ILawCommonTruncatedExp;
0054 class G4ILawForceFreeFlight;
0055 
0056 class G4BOptnForceCommonTruncatedExp : public G4VBiasingOperation
0057 {
0058   public:
0059     // -- Constructor :
0060     G4BOptnForceCommonTruncatedExp(const G4String& name);
0061     // -- destructor:
0062     virtual ~G4BOptnForceCommonTruncatedExp();
0063   
0064     // -- Methods from G4VBiasingOperation interface:
0065     // -------------------------------------------
0066     // -- Used:
0067     virtual const G4VBiasingInteractionLaw*
0068     ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface*, G4ForceCondition& );
0069     virtual G4double
0070     ProposeAlongStepLimit( const G4BiasingProcessInterface* ) { return DBL_MAX; }
0071     virtual G4GPILSelection
0072     ProposeGPILSelection( const G4GPILSelection  processSelection );
0073     virtual G4VParticleChange*
0074     ApplyFinalStateBiasing( const G4BiasingProcessInterface*,
0075                             const G4Track*, const G4Step*, G4bool& );
0076     // -- Unused:
0077     virtual G4double
0078     DistanceToApplyOperation( const G4Track*,
0079                               G4double, G4ForceCondition* ) { return DBL_MAX; }
0080     virtual G4VParticleChange*
0081     GenerateBiasingFinalState(const G4Track*, const G4Step*) { return nullptr; }
0082   
0083     // -- Additional methods, specific to this class:
0084     // ----------------------------------------------
0085     // -- return concrete type of interaction laws:
0086     G4ILawCommonTruncatedExp* GetCommonTruncatedExpLaw()
0087     {
0088       return fCommonTruncatedExpLaw;
0089     }
0090     G4ILawForceFreeFlight* GetForceFreeFlightLaw()
0091     {
0092       return fForceFreeFlightLaw;
0093     }
0094 
0095     void Initialize( const G4Track* );
0096     void UpdateForStep( const G4Step*  );
0097     void Sample();
0098     const G4ThreeVector& GetInitialMomentum() const { return fInitialMomentum; }
0099     G4double GetMaximumDistance() const { return fMaximumDistance; }
0100     void ChooseProcessToApply();
0101     const G4VProcess* GetProcessToApply() const { return fProcessToApply; }
0102     void AddCrossSection( const G4VProcess*, G4double );
0103     std::size_t GetNumberOfSharing() const { return fNumberOfSharing; }
0104     void SetInteractionOccured( G4bool b ) { fInteractionOccured = b; }
0105     G4bool GetInteractionOccured() const { return fInteractionOccured; }
0106   
0107   private:
0108 
0109     G4ILawCommonTruncatedExp* fCommonTruncatedExpLaw = nullptr;
0110     G4ILawForceFreeFlight* fForceFreeFlightLaw = nullptr;
0111     G4double fTotalCrossSection = 0.0;
0112     std::map < const G4VProcess*, G4double > fCrossSections;
0113     std::size_t fNumberOfSharing = 0;
0114     const G4VProcess* fProcessToApply = nullptr;
0115     G4bool fInteractionOccured = false;
0116     G4ThreeVector fInitialMomentum;
0117     G4double fMaximumDistance = -1.0;
0118     G4ParticleChangeForNothing fDummyParticleChange;
0119 };
0120 
0121 #endif