Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:14: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 // G4BOptnForceFreeFlight
0027 //
0028 // Class Description:
0029 //
0030 // A G4VBiasingOperation physics-based biasing operation.
0031 // If forces the physics process to not act on the track.
0032 // In this implementation (meant for the ForceCollision
0033 // operator) the free flight is done under zero weight for
0034 // the track, and the action is meant to accumulate the weight
0035 // change for making this uninteracting flight,
0036 // cumulatedWeightChange.
0037 // When the track reaches the current volume boundary, its
0038 // weight is restored with value: initialWeight * cumulatedWeightChange
0039 //
0040 // Author: Marc Verderi, November 2013.
0041 // --------------------------------------------------------------------
0042 #ifndef G4BOptnForceFreeFlight_hh
0043 #define G4BOptnForceFreeFlight_hh 1
0044 
0045 #include "G4VBiasingOperation.hh"
0046 #include "G4ForceCondition.hh"
0047 #include "G4ParticleChange.hh" // Should add a dedicated "weight change only"
0048                                // particle change
0049 class G4ILawForceFreeFlight;
0050 
0051 class G4BOptnForceFreeFlight : public G4VBiasingOperation
0052 {
0053   public:
0054 
0055     // -- Constructor :
0056     G4BOptnForceFreeFlight(const G4String& name);
0057     // -- destructor:
0058     virtual ~G4BOptnForceFreeFlight();
0059   
0060     // -- Methods from G4VBiasingOperation interface:
0061     // -------------------------------------------
0062     // -- Used:
0063     virtual const G4VBiasingInteractionLaw*
0064     ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface*,
0065                                            G4ForceCondition& );
0066     virtual void AlongMoveBy( const G4BiasingProcessInterface*,
0067                               const G4Step*, G4double );
0068     virtual G4VParticleChange*
0069     ApplyFinalStateBiasing( const G4BiasingProcessInterface*,
0070                             const G4Track*, const G4Step*, G4bool& );
0071 
0072     // -- Unused:
0073     virtual G4double DistanceToApplyOperation( const G4Track*,
0074                             G4double, G4ForceCondition* ) { return DBL_MAX; }
0075     virtual G4VParticleChange* GenerateBiasingFinalState( const G4Track*,
0076                             const G4Step* ) { return nullptr; }
0077 
0078     // -- Additional methods, specific to this class:
0079     // ----------------------------------------------
0080     // -- return concrete type of interaction law:
0081     G4ILawForceFreeFlight* GetForceFreeFlightLaw()
0082     {
0083       return fForceFreeFlightInteractionLaw;
0084     }
0085     // -- initialization for weight:
0086     void ResetInitialTrackWeight(G4double w)
0087     {
0088       fInitialTrackWeight = w;
0089       fCumulatedWeightChange = 1.0;
0090     }
0091     G4bool OperationComplete() const
0092     {
0093       return fOperationComplete;
0094     }
0095 
0096   private:
0097 
0098     G4ILawForceFreeFlight* fForceFreeFlightInteractionLaw = nullptr;
0099     G4double  fCumulatedWeightChange = -1.0,
0100               fInitialTrackWeight = -1.0;
0101     G4ParticleChange fParticleChange;
0102     G4bool fOperationComplete = true;
0103 };
0104 
0105 #endif