Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:59:09

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 // G4ParticleChangeForOccurenceBiasing
0027 //
0028 // Class Description:
0029 //
0030 // A G4VParticleChange dedicated to occurrence biasing : it
0031 // applies weights for non-interaction over a step, and for
0032 // interaction at the end of the step (if interaction occurs) on
0033 // top of a given particle change, that is the one produced by a
0034 // physics process (biased in its final state or not).
0035 //
0036 // Author: Marc Verderi, November 2013.
0037 //
0038 // --------------------------------------------------------------------
0039 #ifndef G4ParticleChangeForOccurenceBiasing_hh
0040 #define G4ParticleChangeForOccurenceBiasing_hh 1
0041 
0042 #include "G4VParticleChange.hh"
0043 
0044 class G4ParticleChangeForOccurenceBiasing : public G4VParticleChange
0045 {
0046   public:
0047 
0048     G4ParticleChangeForOccurenceBiasing(const G4String& name);
0049     ~G4ParticleChangeForOccurenceBiasing() = default;
0050 
0051     void SetOccurenceWeightForNonInteraction(G4double w)
0052       { fOccurenceWeightForNonInteraction = w; }
0053     G4double GetOccurenceWeightForNonInteraction() const
0054       { return fOccurenceWeightForNonInteraction; }
0055     void SetOccurenceWeightForInteraction(G4double w)
0056       { fOccurenceWeightForInteraction = w; }
0057     G4double GetOccurenceWeightForInteraction() const
0058       { return fOccurenceWeightForInteraction; }
0059 
0060     // -- set a wrapped particle change AND USE IT TO UPDATE this occurrence
0061     //    particle change state:
0062     void SetWrappedParticleChange(G4VParticleChange* wpc);
0063     G4VParticleChange* GetWrappedParticleChange() const
0064       { return fWrappedParticleChange; }
0065 
0066     // -- collect the secondaries from the wrapped particle change,
0067     //    apply weight correction, and clear wrapped particle change:
0068     void StealSecondaries();
0069   
0070     // -- from base class G4VParticleChange:
0071     virtual G4Step* UpdateStepForAtRest (G4Step* step);
0072     virtual G4Step* UpdateStepForAlongStep(G4Step* step);
0073     virtual G4Step* UpdateStepForPostStep (G4Step* step);
0074 
0075     const G4String& GetName() const { return fName; }
0076 
0077   private:
0078 
0079     G4String fName;
0080     G4VParticleChange* fWrappedParticleChange = nullptr;
0081     G4double fOccurenceWeightForNonInteraction = -1.0;
0082     G4double fOccurenceWeightForInteraction = -1.0;  
0083 };
0084 
0085 #endif