Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
+12 -1
View File
@@ -1,4 +1,4 @@
$Id: History 77477 2013-11-25 09:42:24Z gcosmo $
$Id: History 86417 2014-11-11 08:52:10Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,17 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
November 10th, 2014 M. Verderi
- Fix G4BiasingOperatorStateNotifier::Notify(...) to detect
start of run.
- tag : proc-biasmng-V10-00-01
November 7th, 2014 M. Verderi
- G4VBiasingOperation : suppression of DenyProcessPostStepDoIt(...)
as redondant and special case of ApplyFinalStateBiasing(...).
tag : proc-biasmng-V10-00-00
November 22nd, 2013 A.Howard
- Moved G4VProcessPlacer and G4ProcessPlacer from importance
@@ -64,9 +64,6 @@ private:
G4BiasingOperationManager();
static G4VectorCache<G4VBiasingOperation*> fBiasingOperationVector;
static G4MapCache<G4VBiasingOperation*,std::size_t > fBiasingOperationIDtoPointerMap;
//static G4BiasingOperationManager* fInstance;
//static std::vector< G4VBiasingOperation* > fBiasingOperationVector;
//static std::map < G4VBiasingOperation*, std::size_t > fBiasingOperationIDtoPointerMap;
};
#endif
@@ -62,7 +62,6 @@ public:
private:
G4BiasingTrackDataStore();
//static G4BiasingTrackDataStore* fInstance;
std::map < const G4Track*, G4BiasingTrackData* > fTrackDataStore;
};
@@ -55,6 +55,8 @@
//
// Author: M.Verderi (LLR), November 2013
// - 05/11/13 : first implementation
// - 07/11/14 : suppress DenyProcessPostStepDoIt(...) as redondant
// and special case of ApplyFinalStateBiasing(...)
// ---------------------------------------------------------------------
@@ -114,15 +116,11 @@ public:
// ------ callingProcess argument.
// ------ - the returned law will have to have been sampled prior to be returned as it will be
// ------ asked for its GetSampledInteractionLength() by the callingProcess.
virtual const G4VBiasingInteractionLaw* ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface* /* callingProcess */ ) = 0;
// ------ o Additionnal method for PostStep occurence:
// ------ - operation can propose a force condition in the PostStepGPIL
// ------ - this condition superseedes the wrapped process condition (taken as default condition)
// ------ - it is called after above ProvideOccurenceBiasingInteractionLaw(...) by the same calling process.
virtual G4ForceCondition ProposeForceCondition( const G4ForceCondition wrappedProcessCondition )
{
return wrappedProcessCondition;
}
// ------ - the operation can propose a force condition in the PostStepGPIL (the passed value
// ------ to the operation is the one of the wrapped process, if proposeForceCondition is
// ------ unchanged, this same value will be used as the biasing foroce condition)
virtual const G4VBiasingInteractionLaw* ProvideOccurenceBiasingInteractionLaw( const G4BiasingProcessInterface* /* callingProcess */ ,
G4ForceCondition& /* proposeForceCondition */ ) = 0;
// ----
// ---- I.2) Methods called in at the AlongStepGetPhysicalInteractionLength(...) level :
// ----
@@ -150,11 +148,13 @@ public:
// ------ - has to return true if interaction is denied by the operation
// ------ - the primary is left unchanged in this case
// ------ - but its weight becomes the one given by proposedTrackWeight.
virtual G4bool DenyProcessPostStepDoIt( const G4BiasingProcessInterface* /* callingProcess */,
const G4Track* /* track */,
const G4Step* /* step */,
G4double& /* proposedTrackWeight */ )
{return false;}
// DEPRECATED
// virtual G4bool DenyProcessPostStepDoIt( const G4BiasingProcessInterface* /* callingProcess */,
// const G4Track* /* track */,
// const G4Step* /* step */,
// G4double& /* proposedTrackWeight */ )
// {return false;}
// ---- II. Biasing of the process post step final state:
@@ -163,13 +163,19 @@ public:
// ------ holds by the G4BiasingProcessInterface callingProcess.
// ------ User has full freedom for the particle change returned, and is reponsible for
// ------ the correctness of weights set to tracks.
// ------ The forcedBiasedFinalState should be left as is (ie false) in general. In this
// ------ way, if an occurence biasing is also applied in the step, the weight correction
// ------ for it will be applied. If returned forceBiasedFinalState is returned true, then
// ------ the returned particle change will be returned as is to the stepping. Full
// ------ responsibility of the weight correctness is taken by the biasing operation.
// ------ The wrappedProcess can be accessed through the G4BiasingProcessInterface if needed.
// ------ This can be used in conjonction with an occurence biasing, provided this final
// ------ state biasing is uncorrelated with the occurence biasing (as single multiplication
// ------ of weights occur between these two biasings).
virtual G4VParticleChange* ApplyFinalStateBiasing( const G4BiasingProcessInterface* /* callingProcess */,
const G4Track* /* track */,
const G4Step* /* step */) = 0;
virtual G4VParticleChange* ApplyFinalStateBiasing( const G4BiasingProcessInterface* /* callingProcess */,
const G4Track* /* track */,
const G4Step* /* step */,
G4bool& /* forceBiasedFinalState */) = 0;
// ---- III. Biasing of the process along step final state:
@@ -183,12 +183,20 @@ class G4Track;
class G4BiasingProcessInterface;
class G4LogicalVolume;
class G4VParticleChange;
class G4BiasingOperatorStateNotifier;
#include <map>
#include <vector>
#include "G4BiasingAppliedCase.hh"
#include "G4Cache.hh"
class G4VBiasingOperator {
// -- State machine used to inform operators
// -- about run starting.
// -- Defined at the end of this file.
friend class G4BiasingOperatorStateNotifier;
public:
// ---------------
// -- Constructor:
@@ -314,6 +322,9 @@ private:
static G4VectorCache<G4VBiasingOperator* > fOperators;
// static std::vector < G4VBiasingOperator* > fOperators;
// -- thread local:
static G4Cache< G4BiasingOperatorStateNotifier* > fStateNotifier;
// -- For this operator:
std::vector< const G4LogicalVolume* > fRootVolumes;
@@ -335,4 +346,17 @@ private:
};
// -- state machine to get biasing operators
// -- messaged at the beginning of runs:
#include "G4VStateDependent.hh"
class G4BiasingOperatorStateNotifier : public G4VStateDependent {
public:
G4BiasingOperatorStateNotifier();
~G4BiasingOperatorStateNotifier();
public:
G4bool Notify(G4ApplicationState requestedState);
private:
G4ApplicationState fPreviousState;
};
#endif
@@ -31,13 +31,17 @@
G4MapCache< const G4LogicalVolume*, G4VBiasingOperator* > G4VBiasingOperator::fLogicalToSetupMap;
G4VectorCache< G4VBiasingOperator* > G4VBiasingOperator::fOperators;
G4VectorCache< G4VBiasingOperator* > G4VBiasingOperator::fOperators;
G4Cache< G4BiasingOperatorStateNotifier* > G4VBiasingOperator::fStateNotifier(0);
G4VBiasingOperator::G4VBiasingOperator(G4String name)
: fName(name)
{
fOperators.Push_back(this);
if ( fStateNotifier.Get() == 0 ) fStateNotifier.Put( new G4BiasingOperatorStateNotifier() );
}
G4VBiasingOperator::~G4VBiasingOperator()
@@ -74,42 +78,21 @@ G4VBiasingOperator* G4VBiasingOperator::GetBiasingOperator(const G4LogicalVolume
G4VBiasingOperation* G4VBiasingOperator::GetProposedOccurenceBiasingOperation(const G4Track* track, const G4BiasingProcessInterface* callingProcess)
{
fOccurenceBiasingOperation = ProposeOccurenceBiasingOperation(track, callingProcess);
// G4cout << GetName() << " Occurence : ";
// if ( fOccurenceBiasingOperation ) G4cout << fOccurenceBiasingOperation->GetName() << G4endl;
// else G4cout << " (none) " << G4endl;
return fOccurenceBiasingOperation;
}
G4VBiasingOperation* G4VBiasingOperator::GetProposedFinalStateBiasingOperation(const G4Track* track, const G4BiasingProcessInterface* callingProcess)
{
fFinalStateBiasingOperation = ProposeFinalStateBiasingOperation(track, callingProcess);
// G4cout << GetName() << " Final State : ";
// if ( fFinalStateBiasingOperation ) G4cout << fFinalStateBiasingOperation->GetName() << G4endl;
// else G4cout << " (none) " << G4endl;
return fFinalStateBiasingOperation;
}
G4VBiasingOperation* G4VBiasingOperator::GetProposedNonPhysicsBiasingOperation(const G4Track* track, const G4BiasingProcessInterface* callingProcess)
{
fNonPhysicsBiasingOperation = ProposeNonPhysicsBiasingOperation(track, callingProcess);
// G4cout << GetName() << " Non Physics : ";
// if ( fNonPhysicsBiasingOperation ) G4cout << fNonPhysicsBiasingOperation->GetName() << G4endl;
// else G4cout << " (none) " << G4endl;
return fNonPhysicsBiasingOperation;
}
// void G4VBiasingOperator::RegisterSecondariesBirth( G4VBiasingOperation* operation, const G4VParticleChange* pChange )
// {
// for (G4int i2nd = 0; i2nd < pChange->GetNumberOfSecondaries (); i2nd++)
// RegisterSecondaryBirth( operation, pChange->GetSecondary (i2nd) );
// }
// void G4VBiasingOperator::RegisterSecondaryBirth( G4VBiasingOperation* operation, const G4Track* track )
// {
// // G4cout << " --> Registering operation, track = " << operation->GetName() << " " << track << G4endl;
// fSecondaryBirthOperation[track] = operation;
// }
const G4VBiasingOperation* G4VBiasingOperator::GetBirthOperation( const G4Track* track )
{
const G4BiasingTrackData* biasingData = G4BiasingTrackDataStore::GetInstance()->GetBiasingTrackData(track);
@@ -124,17 +107,6 @@ void G4VBiasingOperator::ReportOperationApplied( const G4BiasingProcessInterface
const G4VParticleChange* particleChangeProduced )
{
fPreviousBiasingAppliedCase = biasingCase;
// if ( operationApplied != 0 )
// {
// if ( operationApplied->GetRememberSecondaries() )
// {
// for (G4int i2nd = 0; i2nd < particleChangeProduced->GetNumberOfSecondaries (); i2nd++)
// new G4BiasingTrackData( particleChangeProduced->GetSecondary (i2nd),
// operationApplied,
// this,
// callingProcess);
// }
// }
fPreviousAppliedOccurenceBiasingOperation = 0;
fPreviousAppliedFinalStateBiasingOperation = 0;
fPreviousAppliedNonPhysicsBiasingOperation = 0;
@@ -174,17 +146,6 @@ void G4VBiasingOperator::ReportOperationApplied( const G4BiasingProcessInterface
const G4VParticleChange* particleChangeProduced )
{
fPreviousBiasingAppliedCase = biasingCase;
// G4VBiasingOperation* operation(finalStateOperationApplied != 0 ? finalStateOperationApplied : occurenceOperationApplied);
// G4bool remember = occurenceOperationApplied->GetRememberSecondaries();
// if ( finalStateOperationApplied != 0 ) remember = remember || finalStateOperationApplied->GetRememberSecondaries();
// if ( remember )
// {
// for (G4int i2nd = 0; i2nd < particleChangeProduced->GetNumberOfSecondaries (); i2nd++)
// new G4BiasingTrackData( particleChangeProduced->GetSecondary (i2nd),
// operation,
// this,
// callingProcess);
// }
fPreviousAppliedOccurenceBiasingOperation = occurenceOperationApplied;
fPreviousAppliedFinalStateBiasingOperation = finalStateOperationApplied;
OperationApplied( callingProcess, biasingCase, occurenceOperationApplied, weightForOccurenceInteraction, finalStateOperationApplied, particleChangeProduced );
@@ -239,3 +200,29 @@ void G4VBiasingOperator::OperationApplied( const G4BiasingProcessInterface*, G4B
G4VBiasingOperation*, G4double,
G4VBiasingOperation*, const G4VParticleChange* )
{}
// ----------------------------------------------------------------------------
// -- state machine to get biasing operators messaged at the beginning of runs:
// ----------------------------------------------------------------------------
G4BiasingOperatorStateNotifier::G4BiasingOperatorStateNotifier()
: G4VStateDependent()
{
fPreviousState = G4State_PreInit;
}
G4BiasingOperatorStateNotifier::~G4BiasingOperatorStateNotifier()
{}
G4bool G4BiasingOperatorStateNotifier::Notify( G4ApplicationState requestedState )
{
if ( ( fPreviousState == G4State_Idle ) && ( requestedState == G4State_GeomClosed ) )
{
for ( size_t i = 0 ; i < G4VBiasingOperator::fOperators.Size() ; i++ ) G4VBiasingOperator::fOperators[i]->StartRun();
}
fPreviousState = requestedState;
return true;
}