Import Geant4 10.0.0 source tree
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4BOptnChangeCrossSection
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingOperation to change a process cross-section.
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
|
||||
|
||||
#ifndef G4BOptnChangeCrossSection_hh
|
||||
#define G4BOptnChangeCrossSection_hh 1
|
||||
|
||||
#include "G4VBiasingOperation.hh"
|
||||
class G4InteractionLawPhysical;
|
||||
|
||||
class G4BOptnChangeCrossSection : public G4VBiasingOperation {
|
||||
public:
|
||||
// -- Constructor :
|
||||
G4BOptnChangeCrossSection(G4String name);
|
||||
// -- destructor:
|
||||
virtual ~G4BOptnChangeCrossSection();
|
||||
|
||||
public:
|
||||
// -- Methods from G4VBiasingOperation interface:
|
||||
// ----------------------------------------------
|
||||
// -- Used:
|
||||
virtual const G4VBiasingInteractionLaw* ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface* );
|
||||
|
||||
// -- Unused:
|
||||
virtual G4VParticleChange* ApplyFinalStateBiasing( const G4BiasingProcessInterface*,
|
||||
const G4Track*,
|
||||
const G4Step* ) {return 0;}
|
||||
virtual G4double DistanceToApplyOperation( const G4Track*,
|
||||
G4double,
|
||||
G4ForceCondition*) {return DBL_MAX;}
|
||||
virtual G4VParticleChange* GenerateBiasingFinalState( const G4Track*,
|
||||
const G4Step* ) {return 0;}
|
||||
|
||||
public:
|
||||
// -- Additional methods, specific to this class:
|
||||
// ----------------------------------------------
|
||||
// -- return concrete type of interaction law:
|
||||
G4InteractionLawPhysical* GetBiasedExponentialLaw() {return fBiasedExponentialLaw;}
|
||||
// -- set biased cross-section:
|
||||
void SetBiasedCrossSection(G4double xst);
|
||||
G4double GetBiasedCrossSection() const;
|
||||
// -- Sample underneath distribution:
|
||||
void Sample();
|
||||
// -- Update for a made step, without resampling:
|
||||
void UpdateForStep( G4double stepLength );
|
||||
// -- set/get if interaction occured.
|
||||
// -- Interaction flag turned off in "Sample()" method.
|
||||
G4bool GetInteractionOccured() const { return fInteractionOccured; }
|
||||
void SetInteractionOccured() { fInteractionOccured = true; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
G4InteractionLawPhysical* fBiasedExponentialLaw;
|
||||
G4bool fInteractionOccured;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4BOptnCloning
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingOperation to clone a track, allowing to set
|
||||
// weight arbitrary weights.
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
|
||||
|
||||
#ifndef G4BOptnCloning_hh
|
||||
#define G4BOptnCloning_hh 1
|
||||
|
||||
#include "G4VBiasingOperation.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
|
||||
class G4BOptnCloning : public G4VBiasingOperation {
|
||||
public:
|
||||
// -- Constructor :
|
||||
G4BOptnCloning(G4String name);
|
||||
// -- destructor:
|
||||
virtual ~G4BOptnCloning();
|
||||
|
||||
public:
|
||||
// -- Methods from G4VBiasingOperation interface:
|
||||
// -------------------------------------------
|
||||
// -- Unsed:
|
||||
virtual const G4VBiasingInteractionLaw* ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface* ) {return 0;}
|
||||
virtual G4VParticleChange* ApplyFinalStateBiasing( const G4BiasingProcessInterface*,
|
||||
const G4Track*,
|
||||
const G4Step* ) {return 0;}
|
||||
// -- Used:
|
||||
virtual G4double DistanceToApplyOperation( const G4Track*,
|
||||
G4double,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
*condition = NotForced; return 0; // -- acts immediately
|
||||
}
|
||||
virtual G4VParticleChange* GenerateBiasingFinalState( const G4Track*,
|
||||
const G4Step* );
|
||||
|
||||
public:
|
||||
// -- Additional methods, specific to this class:
|
||||
// ----------------------------------------------
|
||||
void SetCloneWeights(G4double clone1Weight, G4double clone2Weight) {fClone1W = clone1Weight ; fClone2W = clone2Weight;}
|
||||
|
||||
private:
|
||||
G4double fClone1W, fClone2W;
|
||||
G4ParticleChange fParticleChange;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,118 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4BOptnForceCommonTruncatedExp
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingOperation physics-based biasing operation. It
|
||||
// handles several processes together, biasing on the total
|
||||
// cross-section of these processes (instead of biasing them
|
||||
// individually).
|
||||
// The biasing interaction law is a truncated exponential
|
||||
// one, driven by the total cross-section and which extends
|
||||
// in the range [0,L].
|
||||
// Process are registered with the AddCrossSection method.
|
||||
// As cross-sections are all known at the end of the
|
||||
// PostStepGPIL loop, the step limitation is made at the
|
||||
// AlongStepGPIL level.
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
|
||||
|
||||
#ifndef G4BOptnForceCommonTruncatedExp_hh
|
||||
#define G4BOptnForceCommonTruncatedExp_hh 1
|
||||
|
||||
#include "G4VBiasingOperation.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
class G4ILawCommonTruncatedExp;
|
||||
#include <map>
|
||||
|
||||
class G4BOptnForceCommonTruncatedExp : public G4VBiasingOperation {
|
||||
public:
|
||||
// -- Constructor :
|
||||
G4BOptnForceCommonTruncatedExp(G4String name);
|
||||
// -- destructor:
|
||||
virtual ~G4BOptnForceCommonTruncatedExp();
|
||||
|
||||
public:
|
||||
// -- Methods from G4VBiasingOperation interface:
|
||||
// -------------------------------------------
|
||||
// -- Used:
|
||||
virtual const G4VBiasingInteractionLaw* ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface* );
|
||||
virtual G4ForceCondition ProposeForceCondition( const G4ForceCondition processCondition );
|
||||
virtual G4bool DenyProcessPostStepDoIt( const G4BiasingProcessInterface*, const G4Track*, const G4Step*, G4double& );
|
||||
virtual G4double ProposeAlongStepLimit( const G4BiasingProcessInterface* );
|
||||
virtual G4GPILSelection ProposeGPILSelection( const G4GPILSelection processSelection );
|
||||
|
||||
// -- Unused:
|
||||
virtual G4VParticleChange* ApplyFinalStateBiasing( const G4BiasingProcessInterface*,
|
||||
const G4Track*,
|
||||
const G4Step* ) {return 0;}
|
||||
virtual G4double DistanceToApplyOperation( const G4Track*,
|
||||
G4double,
|
||||
G4ForceCondition*) {return DBL_MAX;}
|
||||
virtual G4VParticleChange* GenerateBiasingFinalState( const G4Track*,
|
||||
const G4Step* ) {return 0;}
|
||||
|
||||
public:
|
||||
// -- Additional methods, specific to this class:
|
||||
// ----------------------------------------------
|
||||
// -- return concrete type of interaction law:
|
||||
G4ILawCommonTruncatedExp* GetCommonTruncatedExpLaw()
|
||||
{
|
||||
return fCommonTruncatedExpLaw;
|
||||
}
|
||||
void Initialize( const G4Track* );
|
||||
void UpdateForStep( const G4Step* );
|
||||
void Sample();
|
||||
const G4ThreeVector& GetInitialMomentum() const { return fInitialMomentum; }
|
||||
G4double GetMaximumDistance() const { return fMaximumDistance;}
|
||||
void ChooseProcessToApply();
|
||||
const G4VProcess* GetProcessToApply() const { return fProcessToApply; }
|
||||
void AddCrossSection( const G4VProcess*, G4double );
|
||||
G4double GetTriggeredProcessXSfraction();
|
||||
void PostStepInteractionOccured( const G4VProcess* );
|
||||
void SetInteractionOccured( G4bool b ) { fInteractionOccured = b; }
|
||||
G4bool GetInteractionOccured() const { return fInteractionOccured; }
|
||||
|
||||
private:
|
||||
G4ILawCommonTruncatedExp* fCommonTruncatedExpLaw;
|
||||
G4double fTotalCrossSection;
|
||||
std::map < const G4VProcess*, G4double > fCrossSections;
|
||||
size_t fNumberOfSharing;
|
||||
//G4bool fFirstCallToDeny;
|
||||
const G4VProcess* fProcessToApply;
|
||||
G4bool fInteractionOccured;
|
||||
G4ThreeVector fInitialMomentum;
|
||||
G4double fMaximumDistance;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4BOptnForceFreeFlight
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingOperation physics-based biasing operation.
|
||||
// If forces the physics process to not act on the track.
|
||||
// In this implementation (meant for the ForceCollision
|
||||
// operator) the free flight is done under zero weight for
|
||||
// the track, and the action is meant to accumulate the weight
|
||||
// change for making this uninteracting flight,
|
||||
// cumulatedWeightChange.
|
||||
// When the track reaches the current volume boundary, its
|
||||
// weight is restore with value :
|
||||
// initialWeight * cumulatedWeightChange
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
#ifndef G4BOptnForceFreeFlight_hh
|
||||
#define G4BOptnForceFreeFlight_hh 1
|
||||
|
||||
#include "G4VBiasingOperation.hh"
|
||||
#include "G4ForceCondition.hh"
|
||||
class G4ILawForceFreeFlight;
|
||||
|
||||
class G4BOptnForceFreeFlight : public G4VBiasingOperation {
|
||||
public:
|
||||
// -- Constructor :
|
||||
G4BOptnForceFreeFlight(G4String name);
|
||||
// -- destructor:
|
||||
virtual ~G4BOptnForceFreeFlight();
|
||||
|
||||
public:
|
||||
// -- Methods from G4VBiasingOperation interface:
|
||||
// -------------------------------------------
|
||||
// -- Used:
|
||||
virtual const G4VBiasingInteractionLaw* ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface* );
|
||||
virtual G4ForceCondition ProposeForceCondition( const G4ForceCondition ) {return Forced;}
|
||||
virtual G4bool DenyProcessPostStepDoIt( const G4BiasingProcessInterface*, const G4Track*, const G4Step*, G4double& );
|
||||
virtual void AlongMoveBy( const G4BiasingProcessInterface*, const G4Step*, G4double );
|
||||
|
||||
// -- Unused:
|
||||
virtual G4VParticleChange* ApplyFinalStateBiasing( const G4BiasingProcessInterface*,
|
||||
const G4Track*,
|
||||
const G4Step* ) {return 0;}
|
||||
virtual G4double DistanceToApplyOperation( const G4Track*,
|
||||
G4double,
|
||||
G4ForceCondition*) {return DBL_MAX;}
|
||||
virtual G4VParticleChange* GenerateBiasingFinalState( const G4Track*,
|
||||
const G4Step* ) {return 0;}
|
||||
|
||||
|
||||
public:
|
||||
// -- Additional methods, specific to this class:
|
||||
// ----------------------------------------------
|
||||
// -- return concrete type of interaction law:
|
||||
G4ILawForceFreeFlight* GetForceFreeFlightLaw() {
|
||||
return fForceFreeFlightInteractionLaw;
|
||||
}
|
||||
// -- initialization for weight:
|
||||
void ResetInitialTrackWeight(G4double w) {fInitialTrackWeight = w; fCumulatedWeightChange = 1.0;}
|
||||
|
||||
private:
|
||||
G4ILawForceFreeFlight* fForceFreeFlightInteractionLaw;
|
||||
G4double fCumulatedWeightChange, fInitialTrackWeight;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4BOptrForceCollision
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingOperator that implements a "force collision" a la
|
||||
// MCNP. This is meant for neutral particles.
|
||||
// When the track enters the volume, it is cloned. One copy makes
|
||||
// a forced free flight up to the volume exit. The other copy makes
|
||||
// a forced collision inside the volume.
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
|
||||
|
||||
#ifndef G4BOptrForceCollision_hh
|
||||
#define G4BOptrForceCollision_hh 1
|
||||
|
||||
#include "G4VBiasingOperator.hh"
|
||||
class G4BOptnForceFreeFlight;
|
||||
class G4BOptnForceCommonTruncatedExp;
|
||||
class G4BOptnCloning;
|
||||
class G4VProcess;
|
||||
class G4BiasingProcessInterface;
|
||||
class G4ParticleDefinition;
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4BOptrForceCollision : public G4VBiasingOperator {
|
||||
public:
|
||||
G4BOptrForceCollision(G4String particleToForce, G4String name="ForceCollision");
|
||||
G4BOptrForceCollision(const G4ParticleDefinition* particleToForce, G4String name="ForceCollision");
|
||||
~G4BOptrForceCollision();
|
||||
|
||||
private:
|
||||
// -- Mandatory from base class :
|
||||
virtual G4VBiasingOperation* ProposeOccurenceBiasingOperation(const G4Track* track, const G4BiasingProcessInterface* callingProcess);
|
||||
virtual G4VBiasingOperation* ProposeFinalStateBiasingOperation(const G4Track*, const G4BiasingProcessInterface*) {return 0;}
|
||||
virtual G4VBiasingOperation* ProposeNonPhysicsBiasingOperation(const G4Track* track, const G4BiasingProcessInterface* callingProcess);
|
||||
// -- optional methods from base class:
|
||||
public:
|
||||
virtual void StartTracking( const G4Track* track );
|
||||
virtual void ExitBiasing( const G4Track*, const G4BiasingProcessInterface* );
|
||||
|
||||
using G4VBiasingOperator::OperationApplied; // -- informs compiler of multiple OperationApplied symbols
|
||||
// -- in base class, to avoid warning messages for hidden functions
|
||||
// -- in case only one function if overloaded.
|
||||
// -- single operation applied (whatever operation):
|
||||
virtual void OperationApplied( const G4BiasingProcessInterface* callingProcess, G4BiasingAppliedCase biasingCase,
|
||||
G4VBiasingOperation* operationApplied, const G4VParticleChange* particleChangeProduced );
|
||||
|
||||
private:
|
||||
std::map< const G4BiasingProcessInterface*, G4BOptnForceFreeFlight* > fFreeFlightOperations;
|
||||
G4BOptnForceCommonTruncatedExp* fSharedForceInteractionOperation;
|
||||
G4BOptnCloning* fCloningOperation;
|
||||
G4double fInitialTrackWeight;
|
||||
//G4double fWeightToRestore;
|
||||
std::vector < const G4VProcess* > fProcesses;
|
||||
const G4VProcess *fFirstProcess, *fLastProcess;
|
||||
G4bool fSetup;
|
||||
const G4ParticleDefinition* fParticle;
|
||||
G4VBiasingOperation* fPreviousOperationApplied;
|
||||
G4ThreeVector fPreviousMomentum;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4BiasingHelper
|
||||
//
|
||||
// Class Description:
|
||||
// A utility class to help configuring code for biasing.
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
// Initial version Sep. 2013 M. Verderi
|
||||
|
||||
|
||||
#ifndef G4BiasingHelper_h
|
||||
#define G4BiasingHelper_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
class G4ProcessManager;
|
||||
|
||||
#include <vector>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class G4BiasingHelper
|
||||
{
|
||||
public:
|
||||
// -- Substitute, in the process manager passed, physics process "physicsProcessToBias"
|
||||
// -- with a version wrapped by a G4BiasingProcessInterface wrapped, to put this physics
|
||||
// -- process under biasing.
|
||||
// -- Only processes of process type 2 (EM), 3 (Optical), 4 (Had.) and 6 (Decay) will be
|
||||
// -- wrapped.
|
||||
// -- A name for this wrapped process can be given (otherwise a default one is provided:
|
||||
// -- e.g. for process "phot" this will be "biasWrapper(phot)").
|
||||
static G4bool ActivatePhysicsBiasing(G4ProcessManager* pmanager, G4String physicsProcessToBias,
|
||||
G4String wrappedName = "");
|
||||
// -- Insert, in the process manager passed, a G4BiasingProcessInterface process that
|
||||
// -- will deal with non-modifying physics biasing (splitting, killing). A name for
|
||||
// -- this process can be passed, otherwise the default name "biasWrapper(0)" is used.
|
||||
static void ActivateNonPhysicsBiasing(G4ProcessManager* pmanager,
|
||||
G4String nonPhysicsProcessName = "");
|
||||
};
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,268 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
// G4BiasingProcessInterface
|
||||
//
|
||||
// Class Description:
|
||||
// A wrapper process making the interface between the tracking
|
||||
// and the G4VBiasingOperator objects attached to volumes.
|
||||
// If this process holds a physics process, it forwards
|
||||
// tracking calls to this process in volume where not biasing
|
||||
// occurs. In volumes with biasing (with a G4VBiasingOperator
|
||||
// attached) the process gets what to do messaging the biasing
|
||||
// operator :
|
||||
// - at the PostStepGPIL level, for getting an occurence biasing
|
||||
// operation. If such an operation is returned to the process
|
||||
// this operation will be messaged at several places.
|
||||
// - at the PostStepDoIt level, to get a possible final state
|
||||
// biasing operation
|
||||
// If the process does not hold a physics process, it is meant
|
||||
// as handling "non physics" biasing operations: pure splitting
|
||||
// or pure kiling for example (ie not brem splitting).
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
// Initial version Sep. 2013 M. Verderi
|
||||
|
||||
#ifndef G4BiasingProcessInterface_h
|
||||
#define G4BiasingProcessInterface_h
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4Cache.hh"
|
||||
|
||||
class G4VBiasingInteractionLaw;
|
||||
class G4InteractionLawPhysical;
|
||||
class G4VBiasingOperator;
|
||||
class G4VBiasingOperation;
|
||||
class G4ParticleChangeForOccurenceBiasing;
|
||||
class G4ParticleChange;
|
||||
class G4ParticleChangeForNothing;
|
||||
|
||||
class G4BiasingProcessInterface : public G4VProcess {
|
||||
public:
|
||||
// --------------------------------------------------------------------------------
|
||||
// -- constructor for dealing with biasing options not affecting physics processes:
|
||||
// --------------------------------------------------------------------------------
|
||||
G4BiasingProcessInterface( G4String name = "biasWrapper(0)" );
|
||||
// ---------------------------------------------------------------
|
||||
// -- constructor to transform the behaviour of a physics process:
|
||||
// ---------------------------------------------------------------
|
||||
// -- wrappedProcess pointer MUST NOT be null.
|
||||
G4BiasingProcessInterface(G4VProcess* wrappedProcess,
|
||||
G4bool wrappedIsAtRest, G4bool wrappedIsAlongStep, G4bool wrappedIsPostStep,
|
||||
G4String useThisName = "");
|
||||
~G4BiasingProcessInterface();
|
||||
// -- pointer of wrapped physics process:
|
||||
G4VProcess* GetWrappedProcess() const {return fWrappedProcess;}
|
||||
|
||||
// ---------------------
|
||||
// -- Biasing interface:
|
||||
// ---------------------
|
||||
// -- Helper methods:
|
||||
// ------------------
|
||||
// -- Current step and previous step biasing operator, if any:
|
||||
G4VBiasingOperator* GetCurrentBiasingOperator() const {return fCurrentBiasingOperator; }
|
||||
G4VBiasingOperator* GetPreviousBiasingOperator() const {return fPreviousBiasingOperator; }
|
||||
// -- current and previous operation:
|
||||
G4VBiasingOperation* GetCurrentOccurenceBiasingOperation() const { return fOccurenceBiasingOperation; }
|
||||
G4VBiasingOperation* GetPreviousOccurenceBiasingOperation() const { return fPreviousOccurenceBiasingOperation; }
|
||||
G4VBiasingOperation* GetCurrentFinalStateBiasingOperation() const { return fFinalStateBiasingOperation; }
|
||||
G4VBiasingOperation* GetPreviousFinalStateBiasingOperation() const { return fPreviousFinalStateBiasingOperation; }
|
||||
G4VBiasingOperation* GetCurrentNonPhysicsBiasingOperation() const { return fNonPhysicsBiasingOperation; }
|
||||
G4VBiasingOperation* GetPreviousNonPhysicsBiasingOperation() const { return fPreviousNonPhysicsBiasingOperation; }
|
||||
|
||||
|
||||
|
||||
// ------------------
|
||||
// -- Helper methods:
|
||||
// ------------------
|
||||
// ---- Tell is this process is first/last in the PostStep GPIL and DoIt lists.
|
||||
// ---- If physOnly is true, only wrapper for physics processes are considered,
|
||||
// ---- otherwise all G4BiasingProcessInterface processes of this particle are
|
||||
// ---- considered.
|
||||
// ---- These methods just return the corresponding flag values setup at
|
||||
// ---- initialization phase by the next four ones.
|
||||
// ---- Will not be updated if processes are activate/unactivated on the fly.
|
||||
// ---- Use next methods (less fast) instead in this case.
|
||||
G4bool GetIsFirstPostStepGPILInterface(G4bool physOnly = true) const;
|
||||
G4bool GetIsLastPostStepGPILInterface(G4bool physOnly = true) const;
|
||||
G4bool GetIsFirstPostStepDoItInterface(G4bool physOnly = true) const;
|
||||
G4bool GetIsLastPostStepDoItInterface(G4bool physOnly = true) const;
|
||||
// ---- Determine if the process is first/last in the PostStep GPIL and DoIt lists.
|
||||
G4bool IsFirstPostStepGPILInterface(G4bool physOnly = true) const;
|
||||
G4bool IsLastPostStepGPILInterface(G4bool physOnly = true) const;
|
||||
G4bool IsFirstPostStepDoItInterface(G4bool physOnly = true) const;
|
||||
G4bool IsLastPostStepDoItInterface(G4bool physOnly = true) const;
|
||||
// -- Information about wrapped process:
|
||||
G4bool GetWrappedProcessIsAtRest() const { return fWrappedProcessIsAtRest; }
|
||||
G4bool GetWrappedProcessIsAlong() const { return fWrappedProcessIsAlong; }
|
||||
G4bool GetWrappedProcessIsPost() const { return fWrappedProcessIsPost; }
|
||||
|
||||
|
||||
// -- Information methods:
|
||||
G4double GetPreviousStepSize() const { return fPreviousStepSize;}
|
||||
G4double GetCurrentMinimumStep() const { return fCurrentMinimumStep;}
|
||||
G4double GetProposedSafety() const { return fProposedSafety;}
|
||||
void SetProposedSafety(G4double sft) { fProposedSafety = sft;}
|
||||
// -- return the actual PostStep and AlongStep limits returned by the process to the tracking :
|
||||
G4double GetPostStepGPIL() const { return fBiasingPostStepGPIL; }
|
||||
G4double GetAlongStepGPIL() const { return fWrappedProcessAlongStepGPIL; }
|
||||
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// -- G4VProcess interface --
|
||||
// --------------------------------------------------------------
|
||||
public:
|
||||
// -- Start/End tracking:
|
||||
void StartTracking(G4Track* track);
|
||||
void EndTracking();
|
||||
|
||||
// -- PostStep methods:
|
||||
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition);
|
||||
virtual G4VParticleChange* PostStepDoIt(const G4Track& track,
|
||||
const G4Step& step);
|
||||
// -- AlongStep methods:
|
||||
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4double currentMinimumStep,
|
||||
G4double& proposedSafety,
|
||||
G4GPILSelection* selection);
|
||||
virtual G4VParticleChange* AlongStepDoIt(const G4Track& track,
|
||||
const G4Step& step);
|
||||
// -- AtRest methods
|
||||
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track&,
|
||||
G4ForceCondition*);
|
||||
virtual G4VParticleChange* AtRestDoIt(const G4Track&,
|
||||
const G4Step&);
|
||||
|
||||
virtual G4bool IsApplicable(const G4ParticleDefinition& pd);
|
||||
virtual void BuildPhysicsTable(const G4ParticleDefinition& pd);
|
||||
virtual void PreparePhysicsTable(const G4ParticleDefinition& pd);
|
||||
virtual G4bool StorePhysicsTable(const G4ParticleDefinition* pd,
|
||||
const G4String& s, G4bool f);
|
||||
virtual G4bool RetrievePhysicsTable(const G4ParticleDefinition* pd,
|
||||
const G4String& s, G4bool f);
|
||||
// --
|
||||
virtual void SetProcessManager(const G4ProcessManager*);
|
||||
virtual const G4ProcessManager* GetProcessManager();
|
||||
// --
|
||||
virtual void ResetNumberOfInteractionLengthLeft();
|
||||
// virtual void ClearNumberOfInteractionLengthLeft();
|
||||
// --
|
||||
// virtual void DumpInfo() const;
|
||||
|
||||
virtual void SetMasterProcess(G4VProcess* masterP);
|
||||
virtual void BuildWorkerPhysicsTable(const G4ParticleDefinition& pd);
|
||||
virtual void PrepareWorkerPhysicsTable(const G4ParticleDefinition& pd);
|
||||
|
||||
|
||||
private:
|
||||
// ---- Setup first/last flags:
|
||||
void SetUpFirstLastFlags();
|
||||
void ResetForUnbiasedTracking();
|
||||
|
||||
G4Track* fCurrentTrack;
|
||||
G4double fPreviousStepSize;
|
||||
G4double fCurrentMinimumStep;
|
||||
G4double fProposedSafety;
|
||||
|
||||
G4VBiasingOperator* fCurrentBiasingOperator;
|
||||
G4VBiasingOperator* fPreviousBiasingOperator;
|
||||
G4VBiasingOperation* fOccurenceBiasingOperation;
|
||||
G4VBiasingOperation* fFinalStateBiasingOperation;
|
||||
G4VBiasingOperation* fNonPhysicsBiasingOperation;
|
||||
G4VBiasingOperation* fPreviousOccurenceBiasingOperation;
|
||||
G4VBiasingOperation* fPreviousFinalStateBiasingOperation;
|
||||
G4VBiasingOperation* fPreviousNonPhysicsBiasingOperation;
|
||||
|
||||
G4bool fResetWrappedProcessInteractionLength;
|
||||
|
||||
G4VProcess* fWrappedProcess;
|
||||
const G4bool fIsPhysicsBasedBiasing;
|
||||
const G4bool fWrappedProcessIsAtRest;
|
||||
const G4bool fWrappedProcessIsAlong;
|
||||
const G4bool fWrappedProcessIsPost;
|
||||
|
||||
|
||||
G4double fWrappedProcessPostStepGPIL;
|
||||
G4double fBiasingPostStepGPIL;
|
||||
G4double fWrappedProcessInteractionLength; // -- inverse of analog cross-section
|
||||
G4ForceCondition fWrappedProcessForceCondition;
|
||||
G4ForceCondition fBiasingForceCondition;
|
||||
G4double fWrappedProcessAlongStepGPIL;
|
||||
G4double fBiasingAlongStepGPIL;
|
||||
G4GPILSelection fWrappedProcessGPILSelection;
|
||||
G4GPILSelection fBiasingGPILSelection;
|
||||
|
||||
const G4VBiasingInteractionLaw* fBiasingInteractionLaw;
|
||||
const G4VBiasingInteractionLaw* fPreviousBiasingInteractionLaw;
|
||||
G4InteractionLawPhysical* fPhysicalInteractionLaw;
|
||||
G4ParticleChangeForOccurenceBiasing* fOccurenceBiasingParticleChange;
|
||||
G4ParticleChange* fParticleChange; // -- to be changed with a light version for weight only
|
||||
G4ParticleChangeForNothing* fDummyParticleChange;
|
||||
G4bool fFirstLastFlags[8];
|
||||
G4int IdxFirstLast(G4int firstLast, G4int GPILDoIt, G4int physAll) const
|
||||
{
|
||||
// -- be careful : all arguments are *assumed* to be 0 or 1. No check
|
||||
// -- for that is provided. Should be of pure internal usage.
|
||||
return 4*firstLast + 2*GPILDoIt + physAll;
|
||||
}
|
||||
// -- TO DO : let some common operation be done only once, by the first
|
||||
// -- process in GPIL. Nothing done yet, may help to reduce overhead.
|
||||
// -- For example each process instance fetch for the current operator,
|
||||
// -- which could be done once, and with pointer shared.
|
||||
// -- Idea is to have a class containing the data members shared among
|
||||
// -- the instances.
|
||||
// -- Could make these shared data members shared only per particle type
|
||||
// -- (at present, with a single static, any instance of a process shares
|
||||
// -- its members with any other instance, regardless of particle type.)
|
||||
G4bool fIamFirstGPIL;
|
||||
|
||||
|
||||
// -- MUST be **thread local**:
|
||||
static G4Cache<G4bool> fResetInteractionLaws;
|
||||
static G4Cache<G4bool> fCommonStart;
|
||||
static G4Cache<G4bool> fCommonEnd;
|
||||
|
||||
// -- Maintain lists of interfaces attached to a same particle (ie
|
||||
// -- to a same G4ProcessManager ).
|
||||
// -- This is used when biasing operations in different processes need to
|
||||
// -- cooperate (like for knowing the total cross-section for example).
|
||||
std::vector< G4BiasingProcessInterface* >* fCoInterfaces;
|
||||
// -- thread local:
|
||||
static G4MapCache< const G4ProcessManager*,
|
||||
std::vector< G4BiasingProcessInterface* > > fManagerInterfaceMap;
|
||||
const G4ProcessManager* fProcessManager;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,97 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4ILawCommonTruncatedExp
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingInteractionLaw representing a truncated exponential
|
||||
// law : an exponential law acting on [0,L] segment. This law is
|
||||
// Common as it collects several process cross-sections, which sum
|
||||
// is used to drive the law.
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
|
||||
#ifndef G4ILawCommonTruncatedExp_hh
|
||||
#define G4ILawCommonTruncatedExp_hh 1
|
||||
|
||||
#include "G4VBiasingInteractionLaw.hh"
|
||||
#include "G4ILawTruncatedExp.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4BOptnForceCommonTruncatedExp;
|
||||
|
||||
class G4ILawCommonTruncatedExp : public G4VBiasingInteractionLaw
|
||||
{
|
||||
public:
|
||||
G4ILawCommonTruncatedExp(G4String name = "expSharedForceInteractionLaw");
|
||||
virtual ~G4ILawCommonTruncatedExp();
|
||||
|
||||
public:
|
||||
virtual G4bool IsSingular() const
|
||||
{return fExpInteractionLaw.IsSingular();}
|
||||
virtual G4bool IsEffectiveCrossSectionInfinite() const
|
||||
{return fExpInteractionLaw.IsEffectiveCrossSectionInfinite();}
|
||||
private:
|
||||
// -- sample the distribution:
|
||||
// -- in this case, cheat by returning DBL_MAX, to let operation proposing the
|
||||
// -- step length in the alongGPIL
|
||||
virtual G4double SampleInteractionLength();
|
||||
// -- move by true path length, this position becomes the new initial point
|
||||
// -- in this case, cheat by returning DBL_MAX, to let operation proposing the
|
||||
// -- step length in the alongGPIL
|
||||
virtual G4double UpdateInteractionLengthForStep(G4double truePathLength);
|
||||
public:
|
||||
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const;
|
||||
virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const;
|
||||
|
||||
public:
|
||||
void SetNumberOfSharing(G4int n) { fNumberOfSharing = n; }
|
||||
G4int GetNumberOfSharing() const { return fNumberOfSharing; }
|
||||
void SetForceCrossSection( G4double xs ) { fExpInteractionLaw.SetForceCrossSection( xs ); }
|
||||
void reset();
|
||||
void SetMaximumDistance(G4double d) { fExpInteractionLaw.SetMaximumDistance(d); }
|
||||
G4double GetMaximumDistance() const {return fExpInteractionLaw.GetMaximumDistance();}
|
||||
G4double GetInteractionDistance() const {return fExpInteractionLaw.GetInteractionDistance();}
|
||||
void SetOperation( G4BOptnForceCommonTruncatedExp* operation) {fOperation = operation;}
|
||||
|
||||
private:
|
||||
G4ILawTruncatedExp fExpInteractionLaw;
|
||||
//G4bool fIsSingular;
|
||||
G4int fNumberOfSharing;
|
||||
//G4bool fFirstInitializationCall;
|
||||
G4bool fFirstUpdateCall;
|
||||
G4bool fFirstSamplingCall;
|
||||
G4double fInteractionDistance;
|
||||
// TRICKY
|
||||
G4BOptnForceCommonTruncatedExp* fOperation;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4ILawForceFreeFlight
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingInteractionLaw representing the "interaction" law
|
||||
// for a force free flight, ie, a particle which does not interact.
|
||||
// It is a limit case for which the non-interaction probability over
|
||||
// a segment is always 1, and the effective cross-section always
|
||||
// zero.
|
||||
// This singular behavior is signaled by the IsSingular()
|
||||
// method returning always true.
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
#ifndef G4ILawForceFreeFlight_hh
|
||||
#define G4ILawForceFreeFlight_hh 1
|
||||
|
||||
#include "G4VBiasingInteractionLaw.hh"
|
||||
|
||||
class G4ILawForceFreeFlight : public G4VBiasingInteractionLaw
|
||||
{
|
||||
public:
|
||||
G4ILawForceFreeFlight(G4String name = "forceFreeFlightLaw");
|
||||
virtual ~G4ILawForceFreeFlight();
|
||||
|
||||
public:
|
||||
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const;
|
||||
virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const;
|
||||
// -- sample the distribution
|
||||
virtual G4double SampleInteractionLength();
|
||||
// -- move by true path length, this position becomes the new initial point
|
||||
virtual G4double UpdateInteractionLengthForStep(G4double truePathLength);
|
||||
virtual G4bool IsSingular() const {return true;}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4ILawTruncatedExp
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingInteractionLaw representing a truncated exponential
|
||||
// law : an exponential law acting on [0,L] segment. The law is
|
||||
// driven by a cross-section.
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
|
||||
#ifndef G4ILawTruncatedExp_hh
|
||||
#define G4ILawTruncatedExp_hh 1
|
||||
|
||||
#include "G4VBiasingInteractionLaw.hh"
|
||||
|
||||
class G4ILawTruncatedExp : public G4VBiasingInteractionLaw
|
||||
{
|
||||
public:
|
||||
G4ILawTruncatedExp(G4String name = "expForceInteractionLaw");
|
||||
virtual ~G4ILawTruncatedExp();
|
||||
|
||||
public:
|
||||
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const;
|
||||
virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const;
|
||||
// -- sample the distribution
|
||||
virtual G4double SampleInteractionLength();
|
||||
// -- move by true path length, this position becomes the new initial point
|
||||
virtual G4double UpdateInteractionLengthForStep(G4double truePathLength);
|
||||
virtual G4bool IsSingular() const {return fIsSingular;}
|
||||
|
||||
public:
|
||||
void SetForceCrossSection(G4double xs);
|
||||
|
||||
public:
|
||||
void SetMaximumDistance(G4double d) { fMaximumDistance = d;}
|
||||
G4double GetMaximumDistance() const { return fMaximumDistance;}
|
||||
G4double GetInteractionDistance() const { return fInteractionDistance; }
|
||||
|
||||
private:
|
||||
G4double fMaximumDistance;
|
||||
G4double fCrossSection;
|
||||
G4double fCrossSectionDefined;
|
||||
G4bool fIsSingular;
|
||||
G4double fInteractionDistance;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4InteractionLawPhysical
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VBiasingInteractionLaw representing the usual
|
||||
// physical exponential law, of constant cross-section of the step.
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
|
||||
#ifndef G4InteractionLawPhysical_hh
|
||||
#define G4InteractionLawPhysical_hh 1
|
||||
|
||||
#include "G4VBiasingInteractionLaw.hh"
|
||||
|
||||
class G4InteractionLawPhysical : public G4VBiasingInteractionLaw
|
||||
{
|
||||
public:
|
||||
G4InteractionLawPhysical(G4String name = "exponentialLaw");
|
||||
virtual ~G4InteractionLawPhysical();
|
||||
|
||||
public:
|
||||
void SetPhysicalCrossSection(G4double crossSection);
|
||||
G4double GetPhysicalCrossSection() const {return fCrossSection;}
|
||||
|
||||
public:
|
||||
virtual G4double ComputeEffectiveCrossSectionAt(G4double length) const;
|
||||
virtual G4double ComputeNonInteractionProbabilityAt(G4double length) const;
|
||||
// -- sample the distribution
|
||||
virtual G4double SampleInteractionLength();
|
||||
// -- move by true path length, this position becomes the new initial point
|
||||
virtual G4double UpdateInteractionLengthForStep(G4double truePathLength);
|
||||
|
||||
|
||||
private:
|
||||
G4double fCrossSection;
|
||||
G4bool fCrossSectionDefined;
|
||||
G4double fNumberOfInteractionLength;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4ParticleChangeForNothing
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VParticleChange used in case of no interaction.
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
|
||||
#ifndef G4ParticleChangeForNothing_hh
|
||||
#define G4ParticleChangeForNothing_hh 1
|
||||
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
class G4ParticleChangeForNothing : public G4VParticleChange {
|
||||
public:
|
||||
G4ParticleChangeForNothing() : G4VParticleChange() {}
|
||||
~G4ParticleChangeForNothing() {}
|
||||
|
||||
public:
|
||||
// -- from base class G4VParticleChange:
|
||||
virtual void Initialize(const G4Track &track)
|
||||
{
|
||||
theStatusChange = track.GetTrackStatus();
|
||||
theNumberOfSecondaries = 0;
|
||||
}
|
||||
virtual G4Step* UpdateStepForAtRest (G4Step* step) {return step;}
|
||||
virtual G4Step* UpdateStepForAlongStep(G4Step* step) {return step;}
|
||||
virtual G4Step* UpdateStepForPostStep (G4Step* step) {return step;}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: $
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4ParticleChangeForOccurenceBiasing
|
||||
//
|
||||
// Class Description:
|
||||
// A G4VParticleChange dedicated to occurence biasing : it
|
||||
// applies weights for non-interaction over a step, and for
|
||||
// interaction at the end of the step (if interaction occurs) on
|
||||
// top of a given particle change, that is the one produced by a
|
||||
// physics process (biased in its final state or not).
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
// Initial version Nov. 2013 M. Verderi
|
||||
#ifndef G4ParticleChangeForOccurenceBiasing_hh
|
||||
#define G4ParticleChangeForOccurenceBiasing_hh 1
|
||||
|
||||
#include "G4VParticleChange.hh"
|
||||
|
||||
class G4ParticleChangeForOccurenceBiasing : public G4VParticleChange {
|
||||
public:
|
||||
G4ParticleChangeForOccurenceBiasing(G4String name);
|
||||
~G4ParticleChangeForOccurenceBiasing();
|
||||
|
||||
public:
|
||||
void SetOccurenceWeightForNonInteraction(G4double w) {fOccurenceWeightForNonInteraction = w;}
|
||||
G4double GetOccurenceWeightForNonInteraction() const {return fOccurenceWeightForNonInteraction;}
|
||||
void SetOccurenceWeightForInteraction(G4double w) {fOccurenceWeightForInteraction = w;}
|
||||
G4double GetOccurenceWeightForInteraction() const {return fOccurenceWeightForInteraction;}
|
||||
|
||||
public:
|
||||
// -- set a wrapped particle change AND USE IT TO UPDATE this occurence particle change state:
|
||||
void SetWrappedParticleChange(G4VParticleChange* wpc);
|
||||
G4VParticleChange* GetWrappedParticleChange() const {return fWrappedParticleChange;}
|
||||
public:
|
||||
// -- collect the secondaries from the wrapped particle change, apply weight correction, and clear wrapped particle change:
|
||||
void StealSecondaries();
|
||||
|
||||
public:
|
||||
// -- from base class G4VParticleChange:
|
||||
virtual G4Step* UpdateStepForAtRest (G4Step* step);
|
||||
virtual G4Step* UpdateStepForAlongStep(G4Step* step);
|
||||
virtual G4Step* UpdateStepForPostStep (G4Step* step);
|
||||
|
||||
public:
|
||||
const G4String& GetName() const {return fName;}
|
||||
|
||||
private:
|
||||
G4String fName;
|
||||
G4VParticleChange* fWrappedParticleChange;
|
||||
G4double fOccurenceWeightForNonInteraction;
|
||||
G4double fOccurenceWeightForInteraction;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user