Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-30 08:57:59

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 // G4WeightWindowAlgorithm
0027 // 
0028 // Class description:
0029 //
0030 // Implementation of a weight window algorithm. 
0031 // The arguments in the constructor configure the algorithm:
0032 //   - upperLimitFactor: the factor defining the upper weight limit 
0033 //      W_u = upperLimitFactor * W_l (W_l lower weight bound)
0034 //   - survivalFactor: used in calculating the survival weight
0035 //      W_s = survivalFactor * W_l
0036 //   - maxNumberOfSplits: the maximal number of splits allowed
0037 //     to be created in one go, and the reciprocal of the minimal
0038 //     survival probability in case of Russian roulette
0039 //
0040 // In case of upperLimitFactor=survivalFactor=1 the algorithm becomes
0041 // the expected weight algorithm of the importance sampling technique.
0042 //
0043 // See also G4VWeightWindowAlgorithm.
0044 
0045 // Author: Michael Dressel (CERN), 2003
0046 // ----------------------------------------------------------------------
0047 #ifndef G4WEIGHTWINDOWALGORITHM_HH
0048 #define G4WEIGHTWINDOWALGORITHM_HH
0049 
0050 #include "G4Nsplit_Weight.hh"
0051 #include "G4VWeightWindowAlgorithm.hh"
0052 
0053 /**
0054  * @brief G4WeightWindowAlgorithm is a concrete implementation of a weight
0055  * window algorithm.
0056  */
0057 
0058 class G4WeightWindowAlgorithm : public G4VWeightWindowAlgorithm
0059 {
0060   public:
0061   
0062     /**
0063      * Constructor. The arguments configure the algorithm.
0064      * In case of upperLimitFactor=survivalFactor=1 the algorithm becomes
0065      * the expected weight algorithm of the importance sampling technique.
0066      *  @param[in] upperLimitFactor The factor defining the upper weight limit 
0067      *             W_u = upperLimitFactor * W_l (W_l lower weight bound).
0068      *  @param[in] survivalFactor uUsed in calculating the survival weight
0069      *             W_s = survivalFactor * W_l.
0070      *  @param[in] maxNumberOfSplits The maximal number of splits allowed
0071      *             to be created in one go, and the reciprocal of the minimal
0072      *             survival probability in case of Russian roulette.
0073      */
0074     G4WeightWindowAlgorithm(G4double upperLimitFactor = 5,
0075                             G4double survivalFactor = 3,
0076                             G4int maxNumberOfSplits = 5);
0077   
0078     /**
0079      * Default Destructor.
0080      */
0081     ~G4WeightWindowAlgorithm() override = default;
0082 
0083     /**
0084      * Calculates the number of tracks and their weight according
0085      * to the initial track weight and the lower energy bound.
0086      */
0087     G4Nsplit_Weight Calculate(G4double init_w,
0088                               G4double lowerWeightBound) const override;
0089 
0090   private:
0091 
0092     G4double fUpperLimitFactor = 0.0;
0093     G4double fSurvivalFactor = 0.0;
0094     G4int fMaxNumberOfSplits = 0;
0095 };
0096 
0097 #endif