Import Geant4 9.4.0 source tree
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# CMakeLists.txt
|
||||
# Module : G4scoring
|
||||
# Package: Geant4.src.G4processes.G4scoring
|
||||
#
|
||||
# CMakeLists.txt for building a single granular library.
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: CMakeLists.txt,v 1.1 2010/09/29 19:09:35 bmorgan Exp $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if(GEANT4_BUILD_GRANULAR_LIBS)
|
||||
include(Geant4MacroLibraryTargets)
|
||||
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
|
||||
endif()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: GNUmakefile,v 1.3 2006/11/28 16:47:59 ahoward Exp $
|
||||
# $Id: GNUmakefile,v 1.6 2010/12/15 10:22:42 gcosmo Exp $
|
||||
# ------------------------------------------------------------
|
||||
# GNUmakefile for scoring process library.
|
||||
# ------------------------------------------------------------
|
||||
@@ -23,6 +23,7 @@ CPPFLAGS += \
|
||||
-I$(G4BASE)/track/include \
|
||||
-I$(G4BASE)/processes/management/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/utils/include \
|
||||
-I$(G4BASE)/processes/electromagnetic/muons/include \
|
||||
-I$(G4BASE)/processes/cuts/include \
|
||||
-I$(G4BASE)/particles/management/include \
|
||||
-I$(G4BASE)/materials/include \
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.18 2008/09/07 17:12:38 asaim Exp $
|
||||
$Id: History,v 1.23 2010/12/15 13:55:06 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,20 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
December 15, 2010 G.Cosmo (procscore-V09-03-02)
|
||||
- Fixed creation of touchable-history to allow DLL builds on Windows.
|
||||
|
||||
November 26, 2010 G.Cosmo (procscore-V09-03-01)
|
||||
- Fixed compilation warnings for unused parameters.
|
||||
|
||||
November 23, 2010 J.Apostolakis (procscore-V09-03-00)
|
||||
- G4ScoreSplittingProcess spread values for all steps
|
||||
in a Voxel-based "Regular" volume.
|
||||
Requires tag in run, "run-V09-03-08".
|
||||
|
||||
November 18, 2010 J.Apostolakis
|
||||
- Added G4EnergySplitter (created by Pedro Arce)
|
||||
|
||||
September 7th, 2008 M.Asai (procscore-V09-01-01)
|
||||
- Correction of incorrect modification in the previous tag.
|
||||
|
||||
|
||||
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#ifndef G4EnergySplitter_h
|
||||
#define G4EnergySplitter_h 1
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// (Description)
|
||||
//
|
||||
// Class to calculate the split of energy in voxels when G4RegularNavigation is used
|
||||
// It takes into account energy loss and multiple scattering corrections as the particles loses energies from voxel to voxel
|
||||
//
|
||||
// Created: 2010-11-09 Pedro Arce
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#include "globals.hh"
|
||||
class G4PhantomParameterisation;
|
||||
class G4EnergyLossForExtrapolator;
|
||||
class G4VPhysicalVolume;
|
||||
class G4Material;
|
||||
class G4Step;
|
||||
#include <vector>
|
||||
|
||||
class G4EnergySplitter
|
||||
{
|
||||
public: // with description
|
||||
G4EnergySplitter();
|
||||
virtual ~G4EnergySplitter();
|
||||
|
||||
G4int SplitEnergyInVolumes(const G4Step* aStep ); // Calculates the energy spliting, and dumps it into theEnergies. Returns number of steps
|
||||
|
||||
inline void GetLastVoxelID( G4int& voxelID);
|
||||
inline void GetFirstVoxelID( G4int& voxelID);
|
||||
inline void GetVoxelID( G4int stepNo, G4int& voxelID );
|
||||
inline void GetVoxelIDAndLength( G4int stepNo, G4int& voxelID, G4double& stepLength );
|
||||
inline void GetLengthAndEnergyDeposited( G4int stepNo, G4int& voxelID, G4double& stepLength, G4double &energyLoss);
|
||||
inline void GetLengthAndInitialEnergy( G4double &preStepEnergy, G4int stepNo, G4int& voxelID, G4double& stepLength, G4double &initialEnergy);
|
||||
|
||||
inline void SetNIterations( G4int niter );
|
||||
|
||||
inline G4Material* GetVoxelMaterial( G4int stepNo );
|
||||
|
||||
private:
|
||||
inline void GetStepLength( G4int stepNo, G4double& stepLength );
|
||||
|
||||
void GetPhantomParam(G4bool mustExist);
|
||||
G4bool IsPhantomVolume( G4VPhysicalVolume* pv );
|
||||
|
||||
G4EnergyLossForExtrapolator* theElossExt;
|
||||
|
||||
G4int theNIterations;
|
||||
|
||||
std::vector<G4double> theEnergies;
|
||||
|
||||
G4PhantomParameterisation* thePhantomParam;
|
||||
|
||||
};
|
||||
|
||||
#include "G4EnergySplitter.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,106 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "G4RegularNavigationHelper.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4PhantomParameterisation.hh"
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline void G4EnergySplitter::GetLastVoxelID( G4int& voxelID)
|
||||
{
|
||||
voxelID = (*(G4RegularNavigationHelper::theStepLengths.begin())).first;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline void G4EnergySplitter::GetFirstVoxelID( G4int& voxelID)
|
||||
{
|
||||
voxelID = (*(G4RegularNavigationHelper::theStepLengths.rbegin())).first;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline void G4EnergySplitter::GetVoxelID( G4int stepNo, G4int& voxelID )
|
||||
{
|
||||
if( stepNo < 0 || stepNo >= G4int(G4RegularNavigationHelper::theStepLengths.size()) ) {
|
||||
G4Exception("G4EnergySplitter::GetVoxelID",
|
||||
"Invalid stepNo, smaller than 0 or bigger or equal to number of voxels traversed",
|
||||
FatalErrorInArgument,
|
||||
G4String("stepNo = " + G4UIcommand::ConvertToString(stepNo) + ", number of voxels = " + G4UIcommand::ConvertToString(G4int(G4RegularNavigationHelper::theStepLengths.size())) ).c_str());
|
||||
}
|
||||
std::vector< std::pair<G4int,G4double> >::const_iterator ite = G4RegularNavigationHelper::theStepLengths.begin();
|
||||
advance( ite, stepNo );
|
||||
voxelID = (*ite).first;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline void G4EnergySplitter::GetStepLength( G4int stepNo, G4double& stepLength )
|
||||
{
|
||||
std::vector< std::pair<G4int,G4double> >::const_iterator ite = G4RegularNavigationHelper::theStepLengths.begin();
|
||||
advance( ite, stepNo );
|
||||
stepLength = (*ite).second;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline void G4EnergySplitter::GetVoxelIDAndLength( G4int stepNo, G4int& voxelID, G4double& stepLength )
|
||||
{
|
||||
GetVoxelID( stepNo, voxelID );
|
||||
GetStepLength( stepNo, stepLength);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline void G4EnergySplitter::GetLengthAndEnergyDeposited( G4int stepNo, G4int& voxelID, G4double& stepLength, G4double &energyLoss)
|
||||
{
|
||||
GetVoxelIDAndLength( stepNo, voxelID, stepLength );
|
||||
|
||||
energyLoss = theEnergies[stepNo];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline void G4EnergySplitter::GetLengthAndInitialEnergy( G4double &preStepEnergy, G4int stepNo, G4int& voxelID, G4double& stepLength, G4double &initialEnergy)
|
||||
{
|
||||
GetVoxelIDAndLength( stepNo, voxelID, stepLength );
|
||||
|
||||
initialEnergy = preStepEnergy;
|
||||
for( G4int ii = 0; ii < stepNo; ii++ ){
|
||||
initialEnergy -= theEnergies[stepNo];
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline void G4EnergySplitter::SetNIterations( G4int niter )
|
||||
{
|
||||
theNIterations = niter;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
inline G4Material* G4EnergySplitter::GetVoxelMaterial( G4int stepNo )
|
||||
{
|
||||
if( !thePhantomParam ) GetPhantomParam(TRUE);
|
||||
G4int voxelID;
|
||||
GetVoxelID( stepNo, voxelID );
|
||||
return thePhantomParam->GetMaterial( voxelID );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ScoreSplittingProcess.hh,v 1.4 2010/11/22 14:30:49 japost Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
// G4ScoreSplittingProcess.hh
|
||||
//
|
||||
// Description:
|
||||
// This process is used to split the length and energy
|
||||
// of a step in a regular structure into sub-steps, and to
|
||||
// call the scorers for each sub-volume.
|
||||
// It invokes sensitive detectors assigned in the *mass*
|
||||
// world.
|
||||
//
|
||||
// Design and first implementation: J. Apostolakis / M.Asai 2010
|
||||
//---------------------------------------------------------------
|
||||
|
||||
|
||||
#ifndef G4ScoreSplittingProcess_h
|
||||
#define G4ScoreSplittingProcess_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
class G4Step;
|
||||
class G4Navigator;
|
||||
class G4TransportationManager;
|
||||
class G4PathFinder;
|
||||
class G4VTouchable;
|
||||
class G4VPhysicalVolume;
|
||||
class G4ParticleChange;
|
||||
class G4EnergySplitter;
|
||||
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4FieldTrack.hh"
|
||||
#include "G4TouchableHandle.hh"
|
||||
class G4TouchableHistory;
|
||||
// #include "G4TouchableHistory.hh"
|
||||
|
||||
//------------------------------------------
|
||||
//
|
||||
// G4ScoreSplittingProcess class
|
||||
//
|
||||
//------------------------------------------
|
||||
|
||||
|
||||
// Class Description:
|
||||
|
||||
class G4ScoreSplittingProcess : public G4VProcess
|
||||
{
|
||||
public: // with description
|
||||
|
||||
//------------------------
|
||||
// Constructor/Destructor
|
||||
//------------------------
|
||||
|
||||
G4ScoreSplittingProcess(const G4String& processName = "ScoreSplittingProc",
|
||||
G4ProcessType theType = fParameterisation);
|
||||
virtual ~G4ScoreSplittingProcess();
|
||||
|
||||
//--------------------------------------------------------------
|
||||
// Process interface
|
||||
//--------------------------------------------------------------
|
||||
|
||||
void StartTracking(G4Track*);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// GetPhysicalInteractionLength() and DoIt() methods for AtRest
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
G4double AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& ,
|
||||
G4ForceCondition*
|
||||
);
|
||||
|
||||
G4VParticleChange* AtRestDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// GetPhysicalInteractionLength() and DoIt() methods for AlongStep
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
G4double AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track&,
|
||||
G4double ,
|
||||
G4double ,
|
||||
G4double&,
|
||||
G4GPILSelection*
|
||||
);
|
||||
|
||||
G4VParticleChange* AlongStepDoIt(
|
||||
const G4Track& ,
|
||||
const G4Step&
|
||||
);
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// GetPhysicalInteractionLength() and DoIt() methods for PostStep
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
|
||||
G4double previousStepSize,
|
||||
G4ForceCondition* condition);
|
||||
|
||||
G4VParticleChange* PostStepDoIt(const G4Track& ,const G4Step& );
|
||||
|
||||
private:
|
||||
G4TouchableHistory* CreateTouchableForSubStep( G4int newVoxelNum, G4ThreeVector newPosition );
|
||||
|
||||
private:
|
||||
void CopyStepStart(const G4Step & step);
|
||||
|
||||
G4Step * fSplitStep;
|
||||
G4StepPoint *fSplitPreStepPoint;
|
||||
G4StepPoint *fSplitPostStepPoint;
|
||||
|
||||
G4VParticleChange dummyParticleChange;
|
||||
G4ParticleChange xParticleChange;
|
||||
|
||||
// G4TransportationManager* fTransportationManager;
|
||||
// G4PathFinder* fPathFinder;
|
||||
|
||||
// -------------------------------
|
||||
// Touchables for the Split Step
|
||||
// -------------------------------
|
||||
G4TouchableHandle fOldTouchableH;
|
||||
G4TouchableHandle fNewTouchableH;
|
||||
|
||||
// Memory of Touchables of full step
|
||||
G4TouchableHandle fInitialTouchableH;
|
||||
G4TouchableHandle fFinalTouchableH;
|
||||
|
||||
G4EnergySplitter *fpEnergySplitter;
|
||||
|
||||
// ******************************************************
|
||||
// For TESTS:
|
||||
// ******************************************************
|
||||
public:
|
||||
void Verbose(const G4Step&) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,87 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# sources.cmake
|
||||
# Module : G4scoring
|
||||
# Package: Geant4.src.G4processes.G4scoring
|
||||
#
|
||||
# Sources description for a library.
|
||||
# Lists the sources and headers of the code explicitely.
|
||||
# Lists include paths needed.
|
||||
# Lists the internal granular and global dependencies of the library.
|
||||
# Source specific properties should be added at the end.
|
||||
#
|
||||
# Generated on : 24/9/2010
|
||||
#
|
||||
# $Id: sources.cmake,v 1.3 2010/11/29 18:01:57 bmorgan Exp $
|
||||
# GEANT4 Tag $Name: geant4-09-04 $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# List external includes needed.
|
||||
include_directories(${CLHEP_INCLUDE_DIRS})
|
||||
|
||||
# List internal includes needed.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/detector/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/digits_hits/hits/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/biasing/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/magneticfield/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/navigation/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/cuts/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/electromagnetic/muons/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/electromagnetic/utils/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/processes/transportation/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
include(Geant4MacroDefineModule)
|
||||
GEANT4_DEFINE_MODULE(NAME G4scoring
|
||||
HEADERS
|
||||
G4EnergySplitter.hh
|
||||
G4EnergySplitter.icc
|
||||
G4ParallelWorldScoringProcess.hh
|
||||
G4ScoreSplittingProcess.hh
|
||||
SOURCES
|
||||
G4EnergySplitter.cc
|
||||
G4ParallelWorldScoringProcess.cc
|
||||
G4ScoreSplittingProcess.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4cuts
|
||||
G4detector
|
||||
G4muons
|
||||
G4emutils
|
||||
G4geombias
|
||||
G4geometrymng
|
||||
G4globman
|
||||
G4hits
|
||||
G4intercoms
|
||||
G4magneticfield
|
||||
G4materials
|
||||
G4navigation
|
||||
G4partman
|
||||
G4procman
|
||||
G4track
|
||||
G4transportation
|
||||
G4volumes
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4digits_hits
|
||||
G4geometry
|
||||
G4global
|
||||
G4intercoms
|
||||
G4materials
|
||||
G4particles
|
||||
G4track
|
||||
LINK_LIBRARIES
|
||||
)
|
||||
|
||||
# List any source specific properties here
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "G4EnergySplitter.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4RegularNavigationHelper.hh"
|
||||
#include "G4EnergyLossForExtrapolator.hh"
|
||||
#include "G4EmCalculator.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// (Description)
|
||||
//
|
||||
// Created:
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
G4EnergySplitter::G4EnergySplitter()
|
||||
{
|
||||
theElossExt = new G4EnergyLossForExtrapolator(0);
|
||||
thePhantomParam = 0;
|
||||
theNIterations = 2;
|
||||
}
|
||||
|
||||
G4EnergySplitter::~G4EnergySplitter()
|
||||
{;}
|
||||
|
||||
G4int G4EnergySplitter::SplitEnergyInVolumes(const G4Step* aStep )
|
||||
{
|
||||
theEnergies.clear();
|
||||
|
||||
G4double edep = aStep->GetTotalEnergyDeposit();
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
G4bool verbose = 1;
|
||||
if( verbose ) G4cout << "G4EnergySplitter::SplitEnergyInVolumes totalEdepo " << aStep->GetTotalEnergyDeposit()
|
||||
<< " Nsteps " << G4RegularNavigationHelper::theStepLengths.size() << G4endl;
|
||||
#endif
|
||||
if( G4RegularNavigationHelper::theStepLengths.size() == 0 ||
|
||||
aStep->GetTrack()->GetDefinition()->GetPDGCharge() == 0) { // we are only counting dose deposit
|
||||
return theEnergies.size();
|
||||
}
|
||||
if( G4RegularNavigationHelper::theStepLengths.size() == 1 ) {
|
||||
theEnergies.push_back(edep);
|
||||
return theEnergies.size();
|
||||
}
|
||||
|
||||
if( !thePhantomParam ) GetPhantomParam(TRUE);
|
||||
|
||||
if( aStep == 0 ) return FALSE; // it is 0 when called by GmScoringMgr after last event
|
||||
|
||||
//----- Distribute energy deposited in voxels
|
||||
std::vector< std::pair<G4int,G4double> > rnsl = G4RegularNavigationHelper::theStepLengths;
|
||||
|
||||
const G4ParticleDefinition* part = aStep->GetTrack()->GetDefinition();
|
||||
G4double kinEnergyPreOrig = aStep->GetPreStepPoint()->GetKineticEnergy();
|
||||
G4double kinEnergyPre = kinEnergyPreOrig;
|
||||
|
||||
G4double stepLength = aStep->GetStepLength();
|
||||
G4double slSum = 0.;
|
||||
unsigned int ii;
|
||||
for( ii = 0; ii < rnsl.size(); ii++ ){
|
||||
G4double sl = rnsl[ii].second;
|
||||
slSum += sl;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter1 step length geom " << sl << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if( verbose )
|
||||
G4cout << "G4EnergySplitter RN: step length geom TOTAL " << slSum
|
||||
<< " true TOTAL " << stepLength
|
||||
<< " ratio " << stepLength/slSum
|
||||
<< " Energy " << aStep->GetPreStepPoint()->GetKineticEnergy()
|
||||
<< " Material " << aStep->GetPreStepPoint()->GetMaterial()->GetName()
|
||||
<< " Number of geom steps " << rnsl.size() << G4endl;
|
||||
#endif
|
||||
//----- No iterations to correct elost and msc => distribute energy deposited according to geometrical step length in each voxel
|
||||
if( theNIterations == 0 ) {
|
||||
for( unsigned int ii = 0; ii < rnsl.size(); ii++ ){
|
||||
G4double sl = G4RegularNavigationHelper::theStepLengths[ii].second;
|
||||
G4double edepStep = edep * sl/slSum; //divide edep along steps, proportional to step length
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii
|
||||
<< " edep " << edepStep << G4endl;
|
||||
#endif
|
||||
|
||||
theEnergies.push_back(edepStep);
|
||||
|
||||
}
|
||||
} else { // 1 or more iterations demanded
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
// print corrected energy at iteration 0
|
||||
if(verbose) {
|
||||
G4double slSum = 0.;
|
||||
for( ii = 0; ii < rnsl.size(); ii++ ){
|
||||
G4double sl = rnsl[ii].second;
|
||||
slSum += sl;
|
||||
}
|
||||
for( ii = 0; ii < rnsl.size(); ii++ ){
|
||||
G4cout << "G4EnergySplitter::SplitEnergyInVolumes "<< ii
|
||||
<< " RN: iter0 corrected energy lost " << edep*rnsl[ii].second/slSum
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
G4double slRatio = stepLength/slSum;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes RN: iter 0, step ratio " << slRatio << G4endl;
|
||||
#endif
|
||||
|
||||
//--- energy at each interaction
|
||||
G4EmCalculator emcalc;
|
||||
G4double totalELost = 0.;
|
||||
std::vector<G4double> stepLengths;
|
||||
for( int iiter = 1; iiter <= theNIterations; iiter++ ) {
|
||||
//--- iter1: distribute true step length in each voxel: geom SL in each voxel is multiplied by a constant so that the sum gives the total true step length
|
||||
if( iiter == 1 ) {
|
||||
for( ii = 0; ii < rnsl.size(); ii++ ){
|
||||
G4double sl = rnsl[ii].second;
|
||||
stepLengths.push_back( sl * slRatio );
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter" << iiter << " corrected step length " << sl*slRatio << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
for( ii = 0; ii < rnsl.size(); ii++ ){
|
||||
const G4Material* mate = thePhantomParam->GetMaterial( rnsl[ii].first );
|
||||
G4double dEdx = 0.;
|
||||
if( kinEnergyPre > 0. ) { //t check this
|
||||
dEdx = emcalc.GetDEDX(kinEnergyPre, part, mate);
|
||||
}
|
||||
G4double elost = stepLengths[ii] * dEdx;
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter1 energy lost " << elost
|
||||
<< " energy at interaction " << kinEnergyPre
|
||||
<< " = stepLength " << stepLengths[ii]
|
||||
<< " * dEdx " << dEdx << G4endl;
|
||||
#endif
|
||||
kinEnergyPre -= elost;
|
||||
theEnergies.push_back( elost );
|
||||
totalELost += elost;
|
||||
}
|
||||
|
||||
} else{
|
||||
//------ 2nd and other iterations
|
||||
//----- Get step lengths corrected by changing geom2true correction
|
||||
//-- Get ratios for each energy
|
||||
slSum = 0.;
|
||||
kinEnergyPre = kinEnergyPreOrig;
|
||||
for( ii = 0; ii < rnsl.size(); ii++ ){
|
||||
const G4Material* mate = thePhantomParam->GetMaterial( rnsl[ii].first );
|
||||
stepLengths[ii] = theElossExt->TrueStepLength( kinEnergyPre, rnsl[ii].second , mate, part );
|
||||
kinEnergyPre -= theEnergies[ii];
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii
|
||||
<< " RN: iter" << iiter << " step length geom " << stepLengths[ii]
|
||||
<< " geom2true " << rnsl[ii].second / stepLengths[ii] << G4endl;
|
||||
#endif
|
||||
|
||||
slSum += stepLengths[ii];
|
||||
}
|
||||
|
||||
//Correct step lengths so that they sum the total step length
|
||||
G4double slratio = aStep->GetStepLength()/slSum;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes" << ii << " RN: iter" << iiter << " step ratio " << slRatio << G4endl;
|
||||
#endif
|
||||
for( ii = 0; ii < rnsl.size(); ii++ ){
|
||||
stepLengths[ii] *= slratio;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter" << iiter << " corrected step length " << stepLengths[ii] << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
//---- Recalculate energy lost with this new step lengths
|
||||
G4double kinEnergyPre = aStep->GetPreStepPoint()->GetKineticEnergy();
|
||||
totalELost = 0.;
|
||||
for( ii = 0; ii < rnsl.size(); ii++ ){
|
||||
const G4Material* mate = thePhantomParam->GetMaterial( rnsl[ii].first );
|
||||
G4double dEdx = 0.;
|
||||
if( kinEnergyPre > 0. ) {
|
||||
dEdx = emcalc.GetDEDX(kinEnergyPre, part, mate);
|
||||
}
|
||||
G4double elost = stepLengths[ii] * dEdx;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter" << iiter << " energy lost " << elost
|
||||
<< " energy at interaction " << kinEnergyPre
|
||||
<< " = stepLength " << stepLengths[ii]
|
||||
<< " * dEdx " << dEdx << G4endl;
|
||||
#endif
|
||||
kinEnergyPre -= elost;
|
||||
theEnergies[ii] = elost;
|
||||
totalELost += elost;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//correct energies so that they reproduce the real step energy lost
|
||||
G4double enerRatio = (edep/totalELost);
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes"<< ii << " RN: iter" << iiter << " energy ratio " << enerRatio << G4endl;
|
||||
#endif
|
||||
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
G4double elostTot = 0.;
|
||||
#endif
|
||||
for( ii = 0; ii < theEnergies.size(); ii++ ){
|
||||
theEnergies[ii] *= enerRatio;
|
||||
#ifdef VERBOSE_ENERSPLIT
|
||||
elostTot += theEnergies[ii];
|
||||
if(verbose) G4cout << "G4EnergySplitter::SplitEnergyInVolumes "<< ii << " RN: iter" << iiter << " corrected energy lost " << theEnergies[ii]
|
||||
<< " orig elost " << theEnergies[ii]/enerRatio
|
||||
<< " energy before interaction " << kinEnergyPreOrig-elostTot+theEnergies[ii]
|
||||
<< " energy after interaction " << kinEnergyPreOrig-elostTot
|
||||
<< G4endl;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return theEnergies.size();
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
void G4EnergySplitter::GetPhantomParam(G4bool mustExist)
|
||||
{
|
||||
G4PhysicalVolumeStore* pvs = G4PhysicalVolumeStore::GetInstance();
|
||||
std::vector<G4VPhysicalVolume*>::iterator cite;
|
||||
for( cite = pvs->begin(); cite != pvs->end(); cite++ ) {
|
||||
// G4cout << " PV " << (*cite)->GetName() << " " << (*cite)->GetTranslation() << G4endl;
|
||||
if( IsPhantomVolume( *cite ) ) {
|
||||
const G4PVParameterised* pvparam = static_cast<const G4PVParameterised*>(*cite);
|
||||
G4VPVParameterisation* param = pvparam->GetParameterisation();
|
||||
// if( static_cast<const G4PhantomParameterisation*>(param) ){
|
||||
// if( static_cast<const G4PhantomParameterisation*>(param) ){
|
||||
// G4cout << "G4PhantomParameterisation volume found " << (*cite)->GetName() << G4endl;
|
||||
thePhantomParam = static_cast<G4PhantomParameterisation*>(param);
|
||||
}
|
||||
}
|
||||
|
||||
if( !thePhantomParam && mustExist ) G4Exception("GmRegularParamUtils::GetPhantomParam: No G4PhantomParameterisation found ");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
G4bool G4EnergySplitter::IsPhantomVolume( G4VPhysicalVolume* pv )
|
||||
{
|
||||
EAxis axis;
|
||||
G4int nReplicas;
|
||||
G4double width,offset;
|
||||
G4bool consuming;
|
||||
pv->GetReplicationData(axis,nReplicas,width,offset,consuming);
|
||||
EVolume type = (consuming) ? kReplica : kParameterised;
|
||||
if( type == kParameterised && pv->GetRegularStructureId() == 1 ) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,390 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ScoreSplittingProcess.cc,v 1.9 2010/12/15 13:55:35 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-04 $
|
||||
//
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4ScoreSplittingProcess.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4ParticleChange.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4VSensitiveDetector.hh"
|
||||
|
||||
#include "G4EnergySplitter.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
|
||||
//--------------------------------
|
||||
// Constructor with name and type:
|
||||
//--------------------------------
|
||||
G4ScoreSplittingProcess::
|
||||
G4ScoreSplittingProcess(const G4String& processName,G4ProcessType theType)
|
||||
:G4VProcess(processName,theType),
|
||||
fOldTouchableH(), fNewTouchableH(), fInitialTouchableH(), fFinalTouchableH()
|
||||
{
|
||||
pParticleChange = &xParticleChange;
|
||||
|
||||
fSplitStep = new G4Step();
|
||||
fSplitPreStepPoint = fSplitStep->GetPreStepPoint();
|
||||
fSplitPostStepPoint = fSplitStep->GetPostStepPoint();
|
||||
|
||||
if (verboseLevel>0)
|
||||
{
|
||||
G4cout << GetProcessName() << " is created " << G4endl;
|
||||
}
|
||||
fpEnergySplitter = new G4EnergySplitter();
|
||||
}
|
||||
|
||||
// -----------
|
||||
// Destructor:
|
||||
// -----------
|
||||
G4ScoreSplittingProcess::~G4ScoreSplittingProcess()
|
||||
{
|
||||
delete fSplitStep;
|
||||
delete fpEnergySplitter;
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
//
|
||||
// StartTracking
|
||||
//
|
||||
//------------------------------------------------------
|
||||
void G4ScoreSplittingProcess::StartTracking(G4Track* trk)
|
||||
{
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// Setup initial touchables for the first step
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
const G4Step* pStep= trk->GetStep();
|
||||
|
||||
fOldTouchableH = trk->GetTouchableHandle();
|
||||
*fSplitPreStepPoint = *(pStep->GetPreStepPoint()); // Best to copy, so as to initialise
|
||||
fSplitPreStepPoint->SetTouchableHandle(fOldTouchableH);
|
||||
fNewTouchableH = fOldTouchableH;
|
||||
*fSplitPostStepPoint= *(pStep->GetPostStepPoint()); // Best to copy, so as to initialise
|
||||
fSplitPostStepPoint->SetTouchableHandle(fNewTouchableH);
|
||||
|
||||
/// Initialize
|
||||
fSplitPreStepPoint ->SetStepStatus(fUndefined);
|
||||
fSplitPostStepPoint->SetStepStatus(fUndefined);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//
|
||||
// PostStepGetPhysicalInteractionLength()
|
||||
//
|
||||
//----------------------------------------------------------
|
||||
G4double
|
||||
G4ScoreSplittingProcess::PostStepGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/,
|
||||
G4double /*previousStepSize*/,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
// This process must be invoked anyway to score the hit
|
||||
// - to do the scoring if the current volume is a regular structure, or
|
||||
// - else to toggle the flag so that the SteppingManager does the scoring.
|
||||
*condition = StronglyForced;
|
||||
|
||||
// Future optimisation: check whether in regular structure.
|
||||
// If it is in regular structure, be StronglyForced
|
||||
// If not in regular structure,
|
||||
// ask to be called only if SteppingControl is AvoidHitInvocation
|
||||
// in order to reset it to NormalCondition
|
||||
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
//
|
||||
// PostStepDoIt()
|
||||
//
|
||||
//------------------------------------
|
||||
G4VParticleChange* G4ScoreSplittingProcess::PostStepDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step& step)
|
||||
{
|
||||
G4VPhysicalVolume* pCurrentVolume= track.GetVolume();
|
||||
G4LogicalVolume* pLogicalVolume= pCurrentVolume->GetLogicalVolume();
|
||||
G4VSensitiveDetector* ptrSD = pLogicalVolume->GetSensitiveDetector();
|
||||
|
||||
pParticleChange->Initialize(track);
|
||||
if( ( ! pCurrentVolume->IsRegularStructure() ) || ( !ptrSD ) ) {
|
||||
// Set the flag to make sure that Stepping Manager does the scoring
|
||||
pParticleChange->ProposeSteppingControl( NormalCondition );
|
||||
} else {
|
||||
G4ThreeVector preStepPosition, postStepPosition, direction, finalPostStepPosition;
|
||||
pParticleChange->ProposeSteppingControl( AvoidHitInvocation );
|
||||
|
||||
G4double totalEnergyDeposit= step.GetTotalEnergyDeposit();
|
||||
G4StepStatus fullStepStatus= step.GetPostStepPoint()->GetStepStatus();
|
||||
|
||||
CopyStepStart(step);
|
||||
fSplitPreStepPoint->SetSensitiveDetector(ptrSD);
|
||||
fOldTouchableH = fInitialTouchableH;
|
||||
fNewTouchableH= fOldTouchableH;
|
||||
*fSplitPostStepPoint= *(step.GetPreStepPoint());
|
||||
|
||||
// Split the energy
|
||||
// ----------------
|
||||
G4int numberVoxelsInStep= fpEnergySplitter->SplitEnergyInVolumes( &step );
|
||||
|
||||
preStepPosition= step.GetPreStepPoint()->GetPosition();
|
||||
finalPostStepPosition= step.GetPostStepPoint()->GetPosition();
|
||||
direction= (finalPostStepPosition - preStepPosition).unit();
|
||||
|
||||
fFinalTouchableH= track.GetNextTouchableHandle();
|
||||
|
||||
postStepPosition= preStepPosition;
|
||||
// Loop over the sub-parts of this step
|
||||
G4int iStep;
|
||||
for ( iStep=0; iStep < numberVoxelsInStep; iStep++ ){
|
||||
G4int idVoxel= -1; // Voxel ID
|
||||
G4double stepLength=0.0, energyLoss= 0.0;
|
||||
|
||||
*fSplitPreStepPoint = *fSplitPostStepPoint;
|
||||
fOldTouchableH = fNewTouchableH;
|
||||
|
||||
preStepPosition= postStepPosition;
|
||||
fSplitPreStepPoint->SetPosition( preStepPosition );
|
||||
fSplitPreStepPoint->SetTouchableHandle(fOldTouchableH);
|
||||
|
||||
fpEnergySplitter->GetLengthAndEnergyDeposited( iStep, idVoxel, stepLength, energyLoss);
|
||||
|
||||
// Correct the material, so that the track->GetMaterial gives correct answer
|
||||
pLogicalVolume->SetMaterial( fpEnergySplitter->GetVoxelMaterial( iStep) ); // idVoxel) );
|
||||
|
||||
postStepPosition= preStepPosition + stepLength * direction;
|
||||
fSplitPostStepPoint->SetPosition(postStepPosition);
|
||||
|
||||
// Load the Step with the new values
|
||||
fSplitStep->SetStepLength(stepLength);
|
||||
fSplitStep->SetTotalEnergyDeposit(energyLoss);
|
||||
if( iStep < numberVoxelsInStep -1 ){
|
||||
fSplitStep->GetPostStepPoint()->SetStepStatus( fGeomBoundary );
|
||||
G4int nextVoxelId= -1;
|
||||
fpEnergySplitter->GetVoxelID( iStep+1, nextVoxelId );
|
||||
|
||||
// Create new "next" touchable for each section ??
|
||||
G4VTouchable* fNewTouchablePtr=
|
||||
CreateTouchableForSubStep( nextVoxelId, postStepPosition );
|
||||
fNewTouchableH= G4TouchableHandle(fNewTouchablePtr);
|
||||
fSplitPostStepPoint->SetTouchableHandle( fNewTouchableH );
|
||||
} else {
|
||||
fSplitStep->GetPostStepPoint()->SetStepStatus( fullStepStatus );
|
||||
fSplitPostStepPoint->SetTouchableHandle( fFinalTouchableH );
|
||||
}
|
||||
|
||||
|
||||
// As first approximation, split the NIEL in the same fractions as the energy deposit
|
||||
G4double eLossFraction;
|
||||
eLossFraction= (totalEnergyDeposit>0.0) ? energyLoss / totalEnergyDeposit : 1.0 ;
|
||||
fSplitStep->SetNonIonizingEnergyDeposit(step.GetNonIonizingEnergyDeposit()*eLossFraction);
|
||||
|
||||
fSplitPostStepPoint->SetSensitiveDetector( ptrSD );
|
||||
|
||||
// Call the Sensitive Detector
|
||||
ptrSD->Hit(fSplitStep);
|
||||
|
||||
if (verboseLevel>1) Verbose(step);
|
||||
}
|
||||
}
|
||||
|
||||
// This must change the Stepping Control
|
||||
return pParticleChange;
|
||||
}
|
||||
|
||||
G4TouchableHistory*
|
||||
G4ScoreSplittingProcess::CreateTouchableForSubStep( G4int newVoxelNum, G4ThreeVector )
|
||||
{
|
||||
// G4cout << " Creating touchable handle for voxel-no " << newVoxelNum << G4endl;
|
||||
|
||||
G4TouchableHistory* oldTouchableHistory= dynamic_cast<G4TouchableHistory*>(fOldTouchableH());
|
||||
G4TouchableHistory* ptrTouchableHistory= G4TransportationManager::GetTransportationManager()->
|
||||
GetNavigatorForTracking()->CreateTouchableHistory(oldTouchableHistory->GetHistory());
|
||||
|
||||
// Change the history
|
||||
G4NavigationHistory* ptrNavHistory= const_cast<G4NavigationHistory*>(ptrTouchableHistory->GetHistory());
|
||||
G4VPhysicalVolume* curPhysicalVol= ptrNavHistory->GetTopVolume();
|
||||
|
||||
EVolume curVolumeType= ptrNavHistory->GetTopVolumeType();
|
||||
if( curVolumeType == kParameterised )
|
||||
{
|
||||
ptrNavHistory->BackLevel();
|
||||
// G4VPVParameterised parameterisedPV= pNewMother
|
||||
G4VPVParameterisation* curParamstn= curPhysicalVol->GetParameterisation();
|
||||
|
||||
// From G4ParameterisedNavigation::IdentifyAndPlaceSolid() inline method
|
||||
G4VSolid* sampleSolid = curParamstn->ComputeSolid(newVoxelNum, curPhysicalVol);
|
||||
sampleSolid->ComputeDimensions(curParamstn, newVoxelNum, curPhysicalVol);
|
||||
curParamstn->ComputeTransformation(newVoxelNum, curPhysicalVol);
|
||||
|
||||
ptrNavHistory->NewLevel( curPhysicalVol, kParameterised, newVoxelNum );
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cout << " Current volume type is not Parameterised. " << G4endl;
|
||||
G4Exception("G4ScoreSplittingProcess::CreateTouchableForSubStep",
|
||||
"ErrorRegularParamaterisation", JustWarning,
|
||||
"Score Splitting Process is used for Regular Structure - but did not find one here.");
|
||||
}
|
||||
return ptrTouchableHistory;
|
||||
}
|
||||
|
||||
void G4ScoreSplittingProcess::CopyStepStart(const G4Step & step)
|
||||
{
|
||||
fSplitStep->SetTrack(step.GetTrack());
|
||||
fSplitStep->SetStepLength(step.GetStepLength());
|
||||
fSplitStep->SetTotalEnergyDeposit(step.GetTotalEnergyDeposit());
|
||||
fSplitStep->SetNonIonizingEnergyDeposit(step.GetNonIonizingEnergyDeposit());
|
||||
fSplitStep->SetControlFlag(step.GetControlFlag());
|
||||
|
||||
*fSplitPreStepPoint = *(step.GetPreStepPoint());
|
||||
|
||||
fInitialTouchableH= (step.GetPreStepPoint()) ->GetTouchableHandle();
|
||||
fFinalTouchableH = (step.GetPostStepPoint())->GetTouchableHandle();
|
||||
}
|
||||
|
||||
void G4ScoreSplittingProcess::Verbose(const G4Step& step) const
|
||||
{
|
||||
G4cout << "In mass geometry ------------------------------------------------" << G4endl;
|
||||
G4cout << " StepLength : " << step.GetStepLength()/mm << " TotalEnergyDeposit : "
|
||||
<< step.GetTotalEnergyDeposit()/MeV << G4endl;
|
||||
G4cout << " PreStepPoint : "
|
||||
<< step.GetPreStepPoint()->GetPhysicalVolume()->GetName() << " - ";
|
||||
if(step.GetPreStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << step.GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << step.GetPreStepPoint()->GetPosition() << G4endl;
|
||||
G4cout << " PostStepPoint : ";
|
||||
if(step.GetPostStepPoint()->GetPhysicalVolume())
|
||||
{ G4cout << step.GetPostStepPoint()->GetPhysicalVolume()->GetName(); }
|
||||
else
|
||||
{ G4cout << "OutOfWorld"; }
|
||||
G4cout << " - ";
|
||||
if(step.GetPostStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << step.GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << step.GetPostStepPoint()->GetPosition() << G4endl;
|
||||
|
||||
G4cout << "In ghost geometry ------------------------------------------------" << G4endl;
|
||||
G4cout << " StepLength : " << fSplitStep->GetStepLength()/mm
|
||||
<< " TotalEnergyDeposit : "
|
||||
<< fSplitStep->GetTotalEnergyDeposit()/MeV << G4endl;
|
||||
G4cout << " PreStepPoint : "
|
||||
<< fSplitStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() << " ["
|
||||
<< fSplitStep->GetPreStepPoint()->GetTouchable()->GetReplicaNumber()
|
||||
<< " ]" << " - ";
|
||||
if(fSplitStep->GetPreStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << fSplitStep->GetPreStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << fSplitStep->GetPreStepPoint()->GetPosition() << G4endl;
|
||||
G4cout << " PostStepPoint : ";
|
||||
if(fSplitStep->GetPostStepPoint()->GetPhysicalVolume())
|
||||
{
|
||||
G4cout << fSplitStep->GetPostStepPoint()->GetPhysicalVolume()->GetName() << " ["
|
||||
<< fSplitStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber()
|
||||
<< " ]";
|
||||
}
|
||||
else
|
||||
{ G4cout << "OutOfWorld"; }
|
||||
G4cout << " - ";
|
||||
if(fSplitStep->GetPostStepPoint()->GetProcessDefinedStep())
|
||||
{ G4cout << fSplitStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName(); }
|
||||
else
|
||||
{ G4cout << "NoProcessAssigned"; }
|
||||
G4cout << G4endl;
|
||||
G4cout << " " << fSplitStep->GetPostStepPoint()->GetPosition() << " == "
|
||||
<< fSplitStep->GetTrack()->GetMomentumDirection()
|
||||
<< G4endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//
|
||||
// AtRestGetPhysicalInteractionLength()
|
||||
//
|
||||
//----------------------------------------------------------
|
||||
G4double
|
||||
G4ScoreSplittingProcess::AtRestGetPhysicalInteractionLength(
|
||||
const G4Track& /*track*/,
|
||||
G4ForceCondition* condition)
|
||||
{
|
||||
*condition = NotForced; // Was Forced
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------
|
||||
// AlongStepGetPhysicalInteractionLength
|
||||
//---------------------------------------
|
||||
G4double G4ScoreSplittingProcess::AlongStepGetPhysicalInteractionLength(
|
||||
const G4Track& , // track,
|
||||
G4double , // previousStepSize,
|
||||
G4double , // currentMinimumStep,
|
||||
G4double& , // proposedSafety,
|
||||
G4GPILSelection* selection)
|
||||
{
|
||||
*selection = NotCandidateForSelection;
|
||||
return DBL_MAX;
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
// AlongStepDoIt()
|
||||
//------------------------------------
|
||||
|
||||
G4VParticleChange* G4ScoreSplittingProcess::AlongStepDoIt(
|
||||
const G4Track& track, const G4Step& )
|
||||
{
|
||||
// Dummy ParticleChange ie: does nothing
|
||||
// Expecting G4Transportation to move the track
|
||||
dummyParticleChange.Initialize(track);
|
||||
return &dummyParticleChange;
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
// AtRestDoIt()
|
||||
//------------------------------------
|
||||
G4VParticleChange* G4ScoreSplittingProcess::AtRestDoIt(
|
||||
const G4Track& track,
|
||||
const G4Step&)
|
||||
{
|
||||
pParticleChange->Initialize(track);
|
||||
return pParticleChange;
|
||||
}
|
||||
Reference in New Issue
Block a user