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5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/biasing/management/include/G4VBiasingOperation.hh (Version 11.3.0) and /processes/biasing/management/include/G4VBiasingOperation.hh (Version 11.0)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4VBiasingOperation                         <<  26 //
                                                   >>  27 //
                                                   >>  28 // --------------------------------------------------------------------
                                                   >>  29 // Geant4 class header file 
 27 //                                                 30 //
 28 // Class Description:                              31 // Class Description:
 29 //                                                 32 //
 30 // An abstract class to model the behavior of      33 // An abstract class to model the behavior of any type of biasing :
 31 // physics-based biasing (change of physics pr     34 // physics-based biasing (change of physics process behavior) or non-
 32 // physics-based one, like splitting, killing.     35 // physics-based one, like splitting, killing.
 33 //                                                 36 //
 34 // o The change of behavior of a physics proce     37 // o The change of behavior of a physics process can be:
 35 //     - a change of the PostStep interaction      38 //     - a change of the PostStep interaction probabilty, so-called
 36 //       occurrence biasing                        39 //       occurrence biasing
 37 //     - a change in final state production        40 //     - a change in final state production
 38 //     - both, provided above two are uncorrel     41 //     - both, provided above two are uncorrelated.
 39 // o The change of occurrence is driven by pro     42 // o The change of occurrence is driven by providing a biasing interaction
 40 //   law (G4VBiasingInteractionLaw) that is us     43 //   law (G4VBiasingInteractionLaw) that is used in place of the analog
 41 //   exponential law.                              44 //   exponential law.
 42 //   This change of occurrence is controlled t     45 //   This change of occurrence is controlled through many handles.
 43 // o The change in final state production is m     46 // o The change in final state production is made through one single
 44 //   method the user is fully responsible of.      47 //   method the user is fully responsible of.
 45 //                                                 48 //
 46 // o Non-physics-based biasing is controlled b     49 // o Non-physics-based biasing is controlled by two methods : one to
 47 //   specify where this biasing should happen,     50 //   specify where this biasing should happen, and one for generating
 48 //   the related final-state.                      51 //   the related final-state.
 49 //                                                 52 //
 50 // Author: Marc Verderi (LLR), November 2013   <<  53 //      ----------------G4VBiasingOperation ----------------
 51 // ------------------------------------------- <<  54 //
                                                   >>  55 // Author: M.Verderi (LLR), November 2013
                                                   >>  56 // - 05/11/13 : first implementation
                                                   >>  57 // - 07/11/14 : suppress DenyProcessPostStepDoIt(...) as redondant
                                                   >>  58 //              and special case of ApplyFinalStateBiasing(...) 
                                                   >>  59 // ---------------------------------------------------------------------
                                                   >>  60 
                                                   >>  61 
                                                   >>  62 
 52 #ifndef G4VBiasingOperation_hh                     63 #ifndef G4VBiasingOperation_hh
 53 #define G4VBiasingOperation_hh 1                   64 #define G4VBiasingOperation_hh 1
 54                                                    65 
 55 #include "globals.hh"                              66 #include "globals.hh"
 56 #include "G4ForceCondition.hh"                 << 
 57 #include "G4GPILSelection.hh"                  << 
 58                                                << 
 59 class G4VParticleChange;                           67 class G4VParticleChange;
 60 class G4Track;                                     68 class G4Track;
 61 class G4Step;                                      69 class G4Step;
 62 class G4VBiasingInteractionLaw;                    70 class G4VBiasingInteractionLaw;
 63 class G4VProcess;                                  71 class G4VProcess;
 64 class G4BiasingProcessInterface;                   72 class G4BiasingProcessInterface;
                                                   >>  73 #include "G4ForceCondition.hh"
                                                   >>  74 #include "G4GPILSelection.hh"
                                                   >>  75 
                                                   >>  76 class G4VBiasingOperation {
                                                   >>  77 public:
                                                   >>  78   // ---------------
                                                   >>  79   // -- Constructor:
                                                   >>  80   // ---------------
                                                   >>  81   //
                                                   >>  82   // -- Constructor for biasing operations:
                                                   >>  83   // -----------------------------------
                                                   >>  84   // -- Operation is given a name.
                                                   >>  85   G4VBiasingOperation(G4String name);
                                                   >>  86 
                                                   >>  87   // -- destructor:
                                                   >>  88   virtual ~G4VBiasingOperation();
                                                   >>  89 
                                                   >>  90 public:
                                                   >>  91   // -----------------------------
                                                   >>  92   // -- Interface to sub-classes :
                                                   >>  93   // -----------------------------
                                                   >>  94   // --
                                                   >>  95   // *************************************
                                                   >>  96   // ** Methods for physics-based biasing:
                                                   >>  97   // *************************************
                                                   >>  98   // --
                                                   >>  99   // ---- I. Biasing of the process occurrence:
                                                   >> 100   // -----------------------------------------
                                                   >> 101   // ---- The biasing of the process occurrence regards the occurrence of the PostStepDoIt
                                                   >> 102   // ---- behavior. But the weight is manipulated by both AlongStep methods (weight for
                                                   >> 103   // ---- non-interaction) and PostStep methods (weight for interaction). For this
                                                   >> 104   // ---- reason, occurrence biasing is handled by both AlongStep and PostStep methods.
                                                   >> 105   // ----
                                                   >> 106   // ---- If the operation is returned to the G4BiasingProcessInterface process by the
                                                   >> 107   // ---- ProposeOccurenceBiasingOperation(...)/GetProposedOccurenceBiasingOperation(...) method
                                                   >> 108   // ---- of the biasing operator, all methods below will be called for this operation.
                                                   >> 109   // ----
                                                   >> 110   // ---- I.1) Methods called in at the PostStepGetPhysicalInteractionLength(...) level :
                                                   >> 111   // ---- 
                                                   >> 112   // ------ o Main and mandatory method for biasing of the PostStep process biasing occurrence :
                                                   >> 113   // ------   - propose an interaction law to be substituted to the process that is biased
                                                   >> 114   // ------   - the operation is told which is the G4BiasingProcessInterface calling it with
                                                   >> 115   // ------     callingProcess argument.
                                                   >> 116   // ------   - the returned law will have to have been sampled prior to be returned as it will be
                                                   >> 117   // ------     asked for its GetSampledInteractionLength() by the callingProcess.
                                                   >> 118   // ------   - the operation can propose a force condition in the PostStepGPIL (the passed value
                                                   >> 119   // ------     to the operation is the one of the wrapped process, if proposeForceCondition is
                                                   >> 120   // ------     unchanged, this same value will be used as the biasing foroce condition)
                                                   >> 121   virtual const G4VBiasingInteractionLaw* ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface* /* callingProcess */ ,
                                                   >> 122                      G4ForceCondition&                /* proposeForceCondition */ ) = 0;
                                                   >> 123   // ----
                                                   >> 124   // ---- I.2) Methods called in at the AlongStepGetPhysicalInteractionLength(...) level :
                                                   >> 125   // ---- 
                                                   >> 126   // ------ o Operation can optionnally limit GPIL Along Step:
                                                   >> 127   virtual G4double                                        ProposeAlongStepLimit( const G4BiasingProcessInterface* /* callingProcess */ ) { return DBL_MAX; }
                                                   >> 128   // ------ o Operation can propose a GPILSelection in the AlongStepGPIL
                                                   >> 129   // ------   this selection superseeded the wrapped process selection
                                                   >> 130   // ------   if the wrapped process exists, and if has along methods:
                                                   >> 131   virtual G4GPILSelection                                  ProposeGPILSelection( const G4GPILSelection wrappedProcessSelection )
                                                   >> 132   {return wrappedProcessSelection;}
                                                   >> 133   
                                                   >> 134   // ----
                                                   >> 135   // ---- I.3) Methods called in at the AlongStepDoIt(...) level :
                                                   >> 136   // ---- 
                                                   >> 137   // ------ o Helper method to inform the operation of the move made in the along, and related non-interaction weight
                                                   >> 138   // ------   applied to the primary track for this move:
                                                   >> 139   virtual void                                                      AlongMoveBy( const G4BiasingProcessInterface*           /* callingProcess */,
                                                   >> 140                      const G4Step*                                        /* step */,
                                                   >> 141                      G4double                          /* weightForNonInteraction */ ) {}
                                                   >> 142 
                                                   >> 143 
                                                   >> 144   // ---- II. Biasing of the process post step final state:
                                                   >> 145   // ------------------------------------------------------
                                                   >> 146   // ------ Mandatory method for biasing of the PostStepDoIt of the wrapped process
                                                   >> 147   // ------ holds by the G4BiasingProcessInterface callingProcess.
                                                   >> 148   // ------ User has full freedom for the particle change returned, and is reponsible for
                                                   >> 149   // ------ the correctness of weights set to tracks.
                                                   >> 150   // ------ The forcedBiasedFinalState should be left as is (ie false) in general. In this
                                                   >> 151   // ------ way, if an occurrence biasing is also applied in the step, the weight correction
                                                   >> 152   // ------ for it will be applied. If returned forceBiasedFinalState is returned true, then
                                                   >> 153   // ------ the returned particle change will be returned as is to the stepping. Full
                                                   >> 154   // ------ responsibility of the weight correctness is taken by the biasing operation.
                                                   >> 155   // ------ The wrappedProcess can be accessed through the G4BiasingProcessInterface if needed.
                                                   >> 156   // ------ This can be used in conjunction with an occurrence biasing, provided this final
                                                   >> 157   // ------ state biasing is uncorrelated with the occurrence biasing (as single multiplication
                                                   >> 158   // ------ of weights occur between these two biasings).
                                                   >> 159   virtual G4VParticleChange*  ApplyFinalStateBiasing( const G4BiasingProcessInterface*       /* callingProcess */,
                                                   >> 160                   const G4Track*                                  /* track */,
                                                   >> 161                   const G4Step*                                    /* step */,
                                                   >> 162                   G4bool&                          /* forceBiasedFinalState */) = 0;
                                                   >> 163 
                                                   >> 164   
                                                   >> 165   // ---- III. Biasing of the process along step final state:
                                                   >> 166   // --------------------------------------------------------
                                                   >> 167   // ---- Unprovided for now : requires significant developments.
                                                   >> 168 
                                                   >> 169 
                                                   >> 170 
                                                   >> 171   // ***************************************************
                                                   >> 172   // -- Methods for non-physics-based biasing operation:
                                                   >> 173   // ***************************************************
                                                   >> 174   // ----
                                                   >> 175   // ---- If the operation is returned to the G4BiasingProcessInterface process by the
                                                   >> 176   // ---- ProposeNonPhysicsBiasingOperation(...)/GetProposedNonPhysicsBiasingOperation(...) method
                                                   >> 177   // ---- of the biasing operator, all methods below will be called for this operation.
                                                   >> 178   // -----
                                                   >> 179   // ---- 1) Method called in at the PostStepGetPhysicalInteractionLength(...) level :
                                                   >> 180   // ---- 
                                                   >> 181   // ---- o Return to the distance at which the operation should be applied, or may
                                                   >> 182   // ----   play with the force condition flags.
                                                   >> 183   virtual G4double           DistanceToApplyOperation( const G4Track*               /* track */,
                                                   >> 184                    G4double          /* previousStepSize */,
                                                   >> 185                    G4ForceCondition*        /* condition */) = 0;
                                                   >> 186   // ----
                                                   >> 187   // ---- 2) Method called in at the PostStepDoIt(...) level :
                                                   >> 188   // ---- 
                                                   >> 189   // ---- o Generate the final state for biasing (eg: splitting, killing, etc.)
                                                   >> 190   virtual G4VParticleChange* GenerateBiasingFinalState( const G4Track*               /* track */,
                                                   >> 191               const G4Step*                 /* step */) = 0;
                                                   >> 192   
                                                   >> 193 
                                                   >> 194   // ----------------------------------------
                                                   >> 195   // -- public interface and utility methods:
                                                   >> 196   // ----------------------------------------
                                                   >> 197 public:
                                                   >> 198   const G4String&       GetName() const {return fName;}
                                                   >> 199   std::size_t       GetUniqueID() const {return fUniqueID;}
 65                                                   200 
 66 class G4VBiasingOperation                      << 
 67 {                                              << 
 68   public:                                      << 
 69                                                << 
 70     // -- Constructor:                         << 
 71     G4VBiasingOperation(const G4String& name); << 
 72                                                << 
 73     // -- destructor:                          << 
 74     virtual ~G4VBiasingOperation() = default;  << 
 75                                                << 
 76     // -----------------------------           << 
 77     // -- Interface to sub-classes :           << 
 78     // -----------------------------           << 
 79     // --                                      << 
 80     // *************************************   << 
 81     // ** Methods for physics-based biasing:   << 
 82     // *************************************   << 
 83     // --                                      << 
 84     // ---- I. Biasing of the process occurren << 
 85     // --------------------------------------- << 
 86     // ---- The biasing of the process occurre << 
 87     // ---- behavior. But the weight is manipu << 
 88     // ---- non-interaction) and PostStep meth << 
 89     // ---- reason, occurrence biasing is hand << 
 90     // ----                                    << 
 91     // ---- If the operation is returned to th << 
 92     // ---- ProposeOccurenceBiasingOperation(. << 
 93     // ---- of the biasing operator, all metho << 
 94     // ----                                    << 
 95     // ---- I.1) Methods called in at the Post << 
 96     // ----                                    << 
 97     // ------ o Main and mandatory method for  << 
 98     // ------   - propose an interaction law t << 
 99     // ------   - the operation is told which  << 
100     // ------     callingProcess argument.     << 
101     // ------   - the returned law will have t << 
102     // ------     asked for its GetSampledInte << 
103     // ------   - the operation can propose a  << 
104     // ------     to the operation is the one  << 
105     // ------     unchanged, this same value w << 
106     virtual const G4VBiasingInteractionLaw*    << 
107     ProvideOccurenceBiasingInteractionLaw( con << 
108                                            G4F << 
109     // ----                                    << 
110     // ---- I.2) Methods called in at the Alon << 
111     // ----                                    << 
112     // ------ o Operation can optionnally limi << 
113     virtual G4double ProposeAlongStepLimit( co << 
114       { return DBL_MAX; }                      << 
115                                                << 
116     // ------ o Operation can propose a GPILSe << 
117     // ------   this selection superseeded the << 
118     // ------   if the wrapped process exists, << 
119     virtual G4GPILSelection ProposeGPILSelecti << 
120       { return wrappedProcessSelection; }      << 
121                                                   201   
122     // ----                                    << 202 private:
123     // ---- I.3) Methods called in at the Alon << 203   const G4String             fName;
124     // ----                                    << 204   // -- better would be to have fUniqueID const, but pb on windows with constructor.
125     // ------ o Helper method to inform the op << 205   std::size_t            fUniqueID;
126     // ------   applied to the primary track f << 
127     virtual void AlongMoveBy( const G4BiasingP << 
128                               const G4Step* /* << 
129                                     G4double / << 
130                                                << 
131     // ---- II. Biasing of the process post st << 
132     // --------------------------------------- << 
133     // ------ Mandatory method for biasing of  << 
134     // ------ holds by the G4BiasingProcessInt << 
135     // ------ User has full freedom for the pa << 
136     // ------ the correctness of weights set t << 
137     // ------ The forcedBiasedFinalState shoul << 
138     // ------ way, if an occurrence biasing is << 
139     // ------ for it will be applied. If retur << 
140     // ------ the returned particle change wil << 
141     // ------ responsibility of the weight cor << 
142     // ------ The wrappedProcess can be access << 
143     // ------ This can be used in conjunction  << 
144     // ------ state biasing is uncorrelated wi << 
145     // ------ of weights occur between these t << 
146     virtual G4VParticleChange* ApplyFinalState << 
147                                                << 
148                                                << 
149                                                << 
150                                                << 
151     // ---- III. Biasing of the process along  << 
152     // --------------------------------------- << 
153     // ---- Unprovided for now : requires sign << 
154                                                << 
155     // *************************************** << 
156     // -- Methods for non-physics-based biasin << 
157     // *************************************** << 
158     // ----                                    << 
159     // ---- If the operation is returned to th << 
160     // ---- ProposeNonPhysicsBiasingOperation( << 
161     // ---- of the biasing operator, all metho << 
162     // -----                                   << 
163     // ---- 1) Method called in at the PostSte << 
164     // ----                                    << 
165     // ---- o Return to the distance at which  << 
166     // ----   play with the force condition fl << 
167     virtual G4double DistanceToApplyOperation( << 
168                                                << 
169                                                << 
170     // ----                                    << 
171     // ---- 2) Method called in at the PostSte << 
172     // ----                                    << 
173     // ---- o Generate the final state for bia << 
174     virtual G4VParticleChange* GenerateBiasing << 
175                                                << 
176                                                << 
177     // --------------------------------------- << 
178     // -- public interface and utility methods << 
179     // --------------------------------------- << 
180                                                << 
181     const G4String& GetName() const { return f << 
182     std::size_t GetUniqueID() const { return f << 
183                                                << 
184   private:                                     << 
185                                                << 
186     const G4String fName;                      << 
187     // -- better would be to have fUniqueID co << 
188     std::size_t fUniqueID;                     << 
189 };                                                206 };
190                                                   207 
191 #endif                                            208 #endif
192                                                   209