Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:57:02

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 // G4VBiasingOperation
0027 //
0028 // Class Description:
0029 //
0030 // An abstract class to model the behavior of any type of biasing :
0031 // physics-based biasing (change of physics process behavior) or non-
0032 // physics-based one, like splitting, killing.
0033 //
0034 // o The change of behavior of a physics process can be:
0035 //     - a change of the PostStep interaction probabilty, so-called
0036 //       occurrence biasing
0037 //     - a change in final state production
0038 //     - both, provided above two are uncorrelated.
0039 // o The change of occurrence is driven by providing a biasing interaction
0040 //   law (G4VBiasingInteractionLaw) that is used in place of the analog
0041 //   exponential law.
0042 //   This change of occurrence is controlled through many handles.
0043 // o The change in final state production is made through one single
0044 //   method the user is fully responsible of.
0045 //
0046 // o Non-physics-based biasing is controlled by two methods : one to
0047 //   specify where this biasing should happen, and one for generating
0048 //   the related final-state.
0049 //
0050 // Author: Marc Verderi (LLR), November 2013
0051 // --------------------------------------------------------------------
0052 #ifndef G4VBiasingOperation_hh
0053 #define G4VBiasingOperation_hh 1
0054 
0055 #include "globals.hh"
0056 #include "G4ForceCondition.hh"
0057 #include "G4GPILSelection.hh"
0058 
0059 class G4VParticleChange;
0060 class G4Track;
0061 class G4Step;
0062 class G4VBiasingInteractionLaw;
0063 class G4VProcess;
0064 class G4BiasingProcessInterface;
0065 
0066 class G4VBiasingOperation
0067 {
0068   public:
0069 
0070     // -- Constructor:
0071     G4VBiasingOperation(const G4String& name);
0072 
0073     // -- destructor:
0074     virtual ~G4VBiasingOperation() = default;
0075 
0076     // -----------------------------
0077     // -- Interface to sub-classes :
0078     // -----------------------------
0079     // --
0080     // *************************************
0081     // ** Methods for physics-based biasing:
0082     // *************************************
0083     // --
0084     // ---- I. Biasing of the process occurrence:
0085     // -----------------------------------------
0086     // ---- The biasing of the process occurrence regards the occurrence of the PostStepDoIt
0087     // ---- behavior. But the weight is manipulated by both AlongStep methods (weight for
0088     // ---- non-interaction) and PostStep methods (weight for interaction). For this
0089     // ---- reason, occurrence biasing is handled by both AlongStep and PostStep methods.
0090     // ----
0091     // ---- If the operation is returned to the G4BiasingProcessInterface process by the
0092     // ---- ProposeOccurenceBiasingOperation(...)/GetProposedOccurenceBiasingOperation(...) method
0093     // ---- of the biasing operator, all methods below will be called for this operation.
0094     // ----
0095     // ---- I.1) Methods called in at the PostStepGetPhysicalInteractionLength(...) level :
0096     // ---- 
0097     // ------ o Main and mandatory method for biasing of the PostStep process biasing occurrence :
0098     // ------   - propose an interaction law to be substituted to the process that is biased
0099     // ------   - the operation is told which is the G4BiasingProcessInterface calling it with
0100     // ------     callingProcess argument.
0101     // ------   - the returned law will have to have been sampled prior to be returned as it will be
0102     // ------     asked for its GetSampledInteractionLength() by the callingProcess.
0103     // ------   - the operation can propose a force condition in the PostStepGPIL (the passed value
0104     // ------     to the operation is the one of the wrapped process, if proposeForceCondition is
0105     // ------     unchanged, this same value will be used as the biasing foroce condition)
0106     virtual const G4VBiasingInteractionLaw*
0107     ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface* /* callingProcess */ ,
0108                                            G4ForceCondition& /* proposeForceCondition */ ) = 0;
0109     // ----
0110     // ---- I.2) Methods called in at the AlongStepGetPhysicalInteractionLength(...) level :
0111     // ---- 
0112     // ------ o Operation can optionnally limit GPIL Along Step:
0113     virtual G4double ProposeAlongStepLimit( const G4BiasingProcessInterface* /* callingProcess */ )
0114       { return DBL_MAX; }
0115 
0116     // ------ o Operation can propose a GPILSelection in the AlongStepGPIL
0117     // ------   this selection superseeded the wrapped process selection
0118     // ------   if the wrapped process exists, and if has along methods:
0119     virtual G4GPILSelection ProposeGPILSelection( const G4GPILSelection wrappedProcessSelection )
0120       { return wrappedProcessSelection; }
0121   
0122     // ----
0123     // ---- I.3) Methods called in at the AlongStepDoIt(...) level :
0124     // ---- 
0125     // ------ o Helper method to inform the operation of the move made in the along, and related non-interaction weight
0126     // ------   applied to the primary track for this move:
0127     virtual void AlongMoveBy( const G4BiasingProcessInterface* /* callingProcess */,
0128                               const G4Step* /* step */,
0129                                     G4double /* weightForNonInteraction */ ) {}
0130 
0131     // ---- II. Biasing of the process post step final state:
0132     // ------------------------------------------------------
0133     // ------ Mandatory method for biasing of the PostStepDoIt of the wrapped process
0134     // ------ holds by the G4BiasingProcessInterface callingProcess.
0135     // ------ User has full freedom for the particle change returned, and is reponsible for
0136     // ------ the correctness of weights set to tracks.
0137     // ------ The forcedBiasedFinalState should be left as is (ie false) in general. In this
0138     // ------ way, if an occurrence biasing is also applied in the step, the weight correction
0139     // ------ for it will be applied. If returned forceBiasedFinalState is returned true, then
0140     // ------ the returned particle change will be returned as is to the stepping. Full
0141     // ------ responsibility of the weight correctness is taken by the biasing operation.
0142     // ------ The wrappedProcess can be accessed through the G4BiasingProcessInterface if needed.
0143     // ------ This can be used in conjunction with an occurrence biasing, provided this final
0144     // ------ state biasing is uncorrelated with the occurrence biasing (as single multiplication
0145     // ------ of weights occur between these two biasings).
0146     virtual G4VParticleChange* ApplyFinalStateBiasing( const G4BiasingProcessInterface*       /* callingProcess */,
0147                                                        const G4Track* /* track */,
0148                                                        const G4Step* /* step */,
0149                                                              G4bool& /* forceBiasedFinalState */) = 0;
0150 
0151     // ---- III. Biasing of the process along step final state:
0152     // --------------------------------------------------------
0153     // ---- Unprovided for now : requires significant developments.
0154 
0155     // ***************************************************
0156     // -- Methods for non-physics-based biasing operation:
0157     // ***************************************************
0158     // ----
0159     // ---- If the operation is returned to the G4BiasingProcessInterface process by the
0160     // ---- ProposeNonPhysicsBiasingOperation(...)/GetProposedNonPhysicsBiasingOperation(...) method
0161     // ---- of the biasing operator, all methods below will be called for this operation.
0162     // -----
0163     // ---- 1) Method called in at the PostStepGetPhysicalInteractionLength(...) level :
0164     // ---- 
0165     // ---- o Return to the distance at which the operation should be applied, or may
0166     // ----   play with the force condition flags.
0167     virtual G4double DistanceToApplyOperation( const G4Track* /* track */,
0168                                                      G4double /* previousStepSize */,
0169                                                      G4ForceCondition* /* condition */) = 0;
0170     // ----
0171     // ---- 2) Method called in at the PostStepDoIt(...) level :
0172     // ---- 
0173     // ---- o Generate the final state for biasing (eg: splitting, killing, etc.)
0174     virtual G4VParticleChange* GenerateBiasingFinalState( const G4Track*               /* track */,
0175                                                           const G4Step* /* step */) = 0;
0176 
0177     // ----------------------------------------
0178     // -- public interface and utility methods:
0179     // ----------------------------------------
0180 
0181     const G4String& GetName() const { return fName; }
0182     std::size_t GetUniqueID() const { return fUniqueID; }
0183 
0184   private:
0185 
0186     const G4String fName;
0187     // -- better would be to have fUniqueID const, but pb on windows with constructor.
0188     std::size_t fUniqueID;
0189 };
0190 
0191 #endif