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