Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:58:07

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 // G4BOptnLeadingParticle
0027 //
0028 // Class Description:
0029 //
0030 // A G4VBiasingOperation that implements the so-called "Leading
0031 // particle biasing scheme". It is of interest in the shield problem
0032 // to estimate the flux leaking from the shield.
0033 // It works as follows:
0034 // - it is intented for hadronic inelastic interaction
0035 // - at each interaction, are kept:
0036 //     - the most energetic particle (the leading particle)
0037 //         - with unmodified weight
0038 //     - randomly one particle of each species
0039 //         - with this particle weight = n * primary_weight where
0040 //           n is the number of particles of this species
0041 //
0042 // Author: Marc Verderi, November 2019.
0043 // --------------------------------------------------------------------
0044 
0045 #ifndef G4BOptnLeadingParticle_hh
0046 #define G4BOptnLeadingParticle_hh 1
0047 
0048 #include "G4VBiasingOperation.hh"
0049 #include "G4ParticleChange.hh"
0050 
0051 class G4BOptnLeadingParticle : public G4VBiasingOperation
0052 {
0053   public:
0054 
0055     // -- Constructor :
0056     G4BOptnLeadingParticle(const G4String& name);
0057     // -- destructor:
0058     virtual ~G4BOptnLeadingParticle();
0059   
0060     // -- Methods from G4VBiasingOperation interface:
0061     // ----------------------------------------------
0062     // -- Unused:
0063     virtual const G4VBiasingInteractionLaw*
0064     ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface*,
0065                                            G4ForceCondition& ) { return nullptr; }
0066     // -- Used:
0067     virtual G4VParticleChange*
0068     ApplyFinalStateBiasing( const G4BiasingProcessInterface*, // -- Method used for this biasing. The related biasing operator
0069                             const G4Track*,                   // -- returns this biasing operation at the post step do it level
0070                             const G4Step*,                    // -- when the wrapped process has won the interaction length race.
0071                             G4bool& );                        // -- The wrapped process final state is then trimmed.
0072     // -- Unused:
0073     virtual G4double
0074     DistanceToApplyOperation( const G4Track*, G4double, G4ForceCondition* ) { return 0.0; }
0075     virtual G4VParticleChange*
0076     GenerateBiasingFinalState( const G4Track*, const G4Step* ) { return nullptr; }
0077 
0078     // -- The possibility is given to further apply a Russian roulette on tracks that are accompagnying the leading particle
0079     // -- after the classical leading particle biasing algorithm has been applied.
0080     // -- This is of interest when applying the technique to e+ -> gamma gamma for example. Given one gamma is leading,
0081     // -- the second one is alone in its category, hence selected. With the Russian roulette it is then possible to keep
0082     // -- this one randomly. This is also of interest for pi0 decays, or for brem. e- -> e- gamma where the e- or gamma
0083     // -- are alone in their category.
0084     void SetFurtherKillingProbability( G4double p ) // -- if p <= 0.0 the killing is ignored.
0085     {
0086       fRussianRouletteKillingProbability = p;
0087     }
0088     G4double GetFurtherKillingProbability() const
0089     {
0090       return fRussianRouletteKillingProbability;
0091     }
0092 
0093   private:
0094 
0095     // -- Particle change used to return the trimmed final state:
0096     G4ParticleChange fParticleChange;
0097     G4double fRussianRouletteKillingProbability = -1.0;
0098 };
0099 
0100 #endif