Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-18 07:41:30

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 /// \file GB03BOptnSplitOrKillOnBoundary.hh
0027 /// \brief Definition of the GB03BOptnSplitOrKillOnBoundary class
0028 
0029 #ifndef GB03BOptnSplitOrKillOnBoundary_hh
0030 #define GB03BOptnSplitOrKillOnBoundary_hh 1
0031 
0032 #include "G4ParticleChange.hh"
0033 #include "G4ParticleChangeForNothing.hh"
0034 #include "G4VBiasingOperation.hh"
0035 class G4LogicalVolume;
0036 
0037 class GB03BOptnSplitOrKillOnBoundary : public G4VBiasingOperation
0038 {
0039   public:
0040     // -- Constructor :
0041     GB03BOptnSplitOrKillOnBoundary(G4String name);
0042     // -- destructor:
0043     ~GB03BOptnSplitOrKillOnBoundary() override;
0044 
0045   public:
0046     // ----------------------------------------------
0047     // -- Methods from G4VBiasingOperation interface:
0048     // ----------------------------------------------
0049     // -- Unused:
0050     const G4VBiasingInteractionLaw*
0051     ProvideOccurenceBiasingInteractionLaw(const G4BiasingProcessInterface*,
0052                                           G4ForceCondition&) override
0053     {
0054       return nullptr;
0055     }
0056     G4VParticleChange* ApplyFinalStateBiasing(const G4BiasingProcessInterface*, const G4Track*,
0057                                               const G4Step*, G4bool&) override
0058     {
0059       return nullptr;
0060     }
0061 
0062     // -- Used methods ("non-physics biasing methods"):
0063     // ------------------------------------------------
0064     // -- Method to return the distance or the condition under which
0065     // -- requesting the biasing. The "condition" flag will be indeed
0066     // -- used to apply the operation on the geometry boundary.
0067     G4double DistanceToApplyOperation(const G4Track*, G4double,
0068                                       G4ForceCondition* condition) override;
0069     // -- Method the generate the final state, ie, either the final states
0070     // -- corresponding to the splitting or killing cases:
0071     G4VParticleChange* GenerateBiasingFinalState(const G4Track*, const G4Step*) override;
0072 
0073     // -- Specific to this example:
0074     // ----------------------------
0075     // -- Set the integer splitting factor (should be >= 2):
0076     // -- This determines also the killing probability : 1/splittingFactor
0077     void SetSplittingFactor(G4int splittingFactor) { fSplittingFactor = splittingFactor; }
0078     // -- An "invention" (?) of this example: defines a probability
0079     // -- to apply the splitting(killing) techniques:
0080     // --   - If proba == 1, the technique is applied normally
0081     // --   - if proba < 1 (say 70%) then the splitting(killing) is
0082     // --     applied in only 70% of the cases.
0083     // -- This "trick" is useful when the desired splitting factor
0084     // -- would rather be a non-integer value, ie in case where:
0085     // --    splittingFactor = k   is (a bit) too small
0086     // --    splittingFactor = k+1 is (a bit) too large
0087     // -- then the proba can allow to tune an in between application
0088     // -- of the technique.
0089     // -- Specially useful when wanting to split between "1 and 2".
0090     void SetApplyProbability(G4double proba) { fApplyProbability = proba; }
0091 
0092     G4int GetSplittingFactor() const { return fSplittingFactor; }
0093     G4double GetApplyProbability() const { return fApplyProbability; }
0094 
0095   private:
0096     G4ParticleChange fParticleChange;
0097     G4ParticleChangeForNothing fParticleChangeForNothing;
0098     G4int fSplittingFactor;
0099     G4double fApplyProbability;
0100 };
0101 
0102 #endif