Import Geant4 9.3.0 source tree
This commit is contained in:
@@ -0,0 +1,406 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4AdjointCrossSurfChecker.cc,v 1.2 2009/11/18 18:04:11 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include"G4AdjointCrossSurfChecker.hh"
|
||||
#include"G4Step.hh"
|
||||
#include"G4StepPoint.hh"
|
||||
#include"G4PhysicalVolumeStore.hh"
|
||||
#include"G4VSolid.hh"
|
||||
#include"G4AffineTransform.hh"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointCrossSurfChecker* G4AdjointCrossSurfChecker::instance = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointCrossSurfChecker::G4AdjointCrossSurfChecker()
|
||||
{;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointCrossSurfChecker::~G4AdjointCrossSurfChecker()
|
||||
{
|
||||
delete instance;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointCrossSurfChecker* G4AdjointCrossSurfChecker::GetInstance()
|
||||
{
|
||||
if (!instance) instance = new G4AdjointCrossSurfChecker();
|
||||
return instance;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingASphere(const G4Step* aStep,G4double sphere_radius, G4ThreeVector sphere_center,G4ThreeVector& crossing_pos, G4double& cos_th , G4bool& GoingIn)
|
||||
{
|
||||
G4ThreeVector pos1= aStep->GetPreStepPoint()->GetPosition() - sphere_center;
|
||||
G4ThreeVector pos2= aStep->GetPostStepPoint()->GetPosition() - sphere_center;
|
||||
G4double r1= pos1.mag();
|
||||
G4double r2= pos2.mag();
|
||||
G4bool did_cross =false;
|
||||
|
||||
if (r1<=sphere_radius && r2>sphere_radius){
|
||||
did_cross=true;
|
||||
GoingIn=false;
|
||||
}
|
||||
else if (r2<=sphere_radius && r1>sphere_radius){
|
||||
did_cross=true;
|
||||
GoingIn=true;
|
||||
}
|
||||
|
||||
if (did_cross) {
|
||||
|
||||
G4ThreeVector dr=pos2-pos1;
|
||||
G4double r12 = r1*r1;
|
||||
G4double rdr = dr.mag();
|
||||
G4double a,b,c,d;
|
||||
a = rdr*rdr;
|
||||
b = 2.*pos1.dot(dr);
|
||||
c = r12-sphere_radius*sphere_radius;
|
||||
d=std::sqrt(b*b-4.*a*c);
|
||||
G4double l= (-b+d)/2./a;
|
||||
if (l > 1.) l=(-b-d)/2./a;
|
||||
crossing_pos=pos1+l*dr;
|
||||
cos_th = std::abs(dr.cosTheta(crossing_pos));
|
||||
|
||||
|
||||
}
|
||||
return did_cross;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::GoingInOrOutOfaVolume(const G4Step* aStep,const G4String& volume_name, G4double& , G4bool& GoingIn) //from external surface
|
||||
{
|
||||
G4bool step_at_boundary = (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary);
|
||||
G4bool did_cross =false;
|
||||
if (step_at_boundary){
|
||||
const G4VTouchable* postStepTouchable = aStep->GetPostStepPoint()->GetTouchable();
|
||||
const G4VTouchable* preStepTouchable = aStep->GetPreStepPoint()->GetTouchable();
|
||||
if (preStepTouchable && postStepTouchable && postStepTouchable->GetVolume() && preStepTouchable->GetVolume()){
|
||||
G4String post_vol_name = postStepTouchable->GetVolume()->GetName();
|
||||
G4String pre_vol_name = preStepTouchable->GetVolume()->GetName();
|
||||
|
||||
if (post_vol_name == volume_name ){
|
||||
GoingIn=true;
|
||||
did_cross=true;
|
||||
}
|
||||
else if (pre_vol_name == volume_name){
|
||||
GoingIn=false;
|
||||
did_cross=true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return did_cross;
|
||||
//still need to compute the cosine of the direction
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::GoingInOrOutOfaVolumeByExtSurface(const G4Step* aStep,const G4String& volume_name, const G4String& mother_logical_vol_name, G4double& , G4bool& GoingIn) //from external surface
|
||||
{
|
||||
G4bool step_at_boundary = (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary);
|
||||
G4bool did_cross =false;
|
||||
if (step_at_boundary){
|
||||
const G4VTouchable* postStepTouchable = aStep->GetPostStepPoint()->GetTouchable();
|
||||
const G4VTouchable* preStepTouchable = aStep->GetPreStepPoint()->GetTouchable();
|
||||
if (preStepTouchable && postStepTouchable && postStepTouchable->GetVolume() && preStepTouchable->GetVolume()){
|
||||
G4String post_vol_name = postStepTouchable->GetVolume()->GetName();
|
||||
G4String post_log_vol_name = postStepTouchable->GetVolume()->GetLogicalVolume()->GetName();
|
||||
G4String pre_vol_name = preStepTouchable->GetVolume()->GetName();
|
||||
G4String pre_log_vol_name = preStepTouchable->GetVolume()->GetLogicalVolume()->GetName();
|
||||
if (post_vol_name == volume_name && pre_log_vol_name == mother_logical_vol_name){
|
||||
GoingIn=true;
|
||||
did_cross=true;
|
||||
}
|
||||
else if (pre_vol_name == volume_name && post_log_vol_name == mother_logical_vol_name ){
|
||||
GoingIn=false;
|
||||
did_cross=true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return did_cross;
|
||||
//still need to compute the cosine of the direction
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingAGivenRegisteredSurface(const G4Step* aStep,const G4String& surface_name,G4ThreeVector& crossing_pos, G4double& cos_to_surface, G4bool& GoingIn)
|
||||
{
|
||||
G4int ind = FindRegisteredSurface(surface_name);
|
||||
G4bool did_cross = false;
|
||||
if (ind >=0){
|
||||
did_cross = CrossingAGivenRegisteredSurface(aStep, ind, crossing_pos,cos_to_surface, GoingIn);
|
||||
}
|
||||
return did_cross;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingAGivenRegisteredSurface(const G4Step* aStep, int ind,G4ThreeVector& crossing_pos, G4double& cos_to_surface, G4bool& GoingIn)
|
||||
{
|
||||
G4String surf_type = ListOfSurfaceType[ind];
|
||||
G4double radius = ListOfSphereRadius[ind];
|
||||
G4ThreeVector center = ListOfSphereCenter[ind];
|
||||
G4String vol1 = ListOfVol1Name[ind];
|
||||
G4String vol2 = ListOfVol2Name[ind];
|
||||
|
||||
G4bool did_cross = false;
|
||||
if (surf_type == "Sphere"){
|
||||
did_cross = CrossingASphere(aStep, radius, center,crossing_pos, cos_to_surface, GoingIn);
|
||||
}
|
||||
else if (surf_type == "ExternalSurfaceOfAVolume"){
|
||||
|
||||
did_cross = GoingInOrOutOfaVolumeByExtSurface(aStep, vol1, vol2, cos_to_surface, GoingIn);
|
||||
crossing_pos= aStep->GetPostStepPoint()->GetPosition();
|
||||
|
||||
}
|
||||
else if (surf_type == "BoundaryBetweenTwoVolumes"){
|
||||
did_cross = CrossingAnInterfaceBetweenTwoVolumes(aStep, vol1, vol2,crossing_pos, cos_to_surface, GoingIn);
|
||||
}
|
||||
return did_cross;
|
||||
|
||||
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingOneOfTheRegisteredSurface(const G4Step* aStep,G4String& surface_name,G4ThreeVector& crossing_pos, G4double& cos_to_surface, G4bool& GoingIn)
|
||||
{
|
||||
for (size_t i=0;i <ListOfSurfaceName.size();i++){
|
||||
if (CrossingAGivenRegisteredSurface(aStep, int(i),crossing_pos, cos_to_surface, GoingIn)){
|
||||
surface_name = ListOfSurfaceName[i];
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::CrossingAnInterfaceBetweenTwoVolumes(const G4Step* aStep,const G4String& vol1_name,const G4String& vol2_name,G4ThreeVector& , G4double& , G4bool& GoingIn)
|
||||
{
|
||||
G4bool step_at_boundary = (aStep->GetPostStepPoint()->GetStepStatus() == fGeomBoundary);
|
||||
G4bool did_cross =false;
|
||||
if (step_at_boundary){
|
||||
const G4VTouchable* postStepTouchable = aStep->GetPostStepPoint()->GetTouchable();
|
||||
const G4VTouchable* preStepTouchable = aStep->GetPreStepPoint()->GetTouchable();
|
||||
if (preStepTouchable && postStepTouchable){
|
||||
|
||||
G4String post_vol_name = postStepTouchable->GetVolume()->GetName();
|
||||
if (post_vol_name =="") post_vol_name = postStepTouchable->GetVolume()->GetLogicalVolume()->GetName();
|
||||
G4String pre_vol_name = preStepTouchable->GetVolume()->GetName();
|
||||
if (pre_vol_name =="") pre_vol_name = preStepTouchable->GetVolume()->GetLogicalVolume()->GetName();
|
||||
|
||||
|
||||
if ( pre_vol_name == vol1_name && post_vol_name == vol2_name){
|
||||
GoingIn=true;
|
||||
did_cross=true;
|
||||
}
|
||||
else if (pre_vol_name == vol2_name && post_vol_name == vol1_name){
|
||||
GoingIn=false;
|
||||
did_cross=true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return did_cross;
|
||||
//still need to compute the cosine of the direction
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::AddaSphericalSurface(const G4String& SurfaceName, G4double radius, G4ThreeVector pos, G4double& Area)
|
||||
{
|
||||
G4int ind = FindRegisteredSurface(SurfaceName);
|
||||
Area= 4.*pi*radius*radius;
|
||||
if (ind>=0) {
|
||||
ListOfSurfaceType[ind]="Sphere";
|
||||
ListOfSphereRadius[ind]=radius;
|
||||
ListOfSphereCenter[ind]=pos;
|
||||
ListOfVol1Name[ind]="";
|
||||
ListOfVol2Name[ind]="";
|
||||
AreaOfSurface[ind]=Area;
|
||||
}
|
||||
else {
|
||||
ListOfSurfaceName.push_back(SurfaceName);
|
||||
ListOfSurfaceType.push_back("Sphere");
|
||||
ListOfSphereRadius.push_back(radius);
|
||||
ListOfSphereCenter.push_back(pos);
|
||||
ListOfVol1Name.push_back("");
|
||||
ListOfVol2Name.push_back("");
|
||||
AreaOfSurface.push_back(Area);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::AddaSphericalSurfaceWithCenterAtTheCenterOfAVolume(const G4String& SurfaceName, G4double radius, const G4String& volume_name, G4ThreeVector & center, G4double& area)
|
||||
{
|
||||
|
||||
G4VPhysicalVolume* thePhysicalVolume = 0;
|
||||
G4PhysicalVolumeStore* thePhysVolStore =G4PhysicalVolumeStore::GetInstance();
|
||||
for ( unsigned int i=0; i< thePhysVolStore->size();i++){
|
||||
if ((*thePhysVolStore)[i]->GetName() == volume_name){
|
||||
thePhysicalVolume = (*thePhysVolStore)[i];
|
||||
};
|
||||
|
||||
}
|
||||
if (thePhysicalVolume){
|
||||
G4VPhysicalVolume* daughter =thePhysicalVolume;
|
||||
G4LogicalVolume* mother = thePhysicalVolume->GetMotherLogical();
|
||||
G4AffineTransform theTransformationFromPhysVolToWorld = G4AffineTransform();
|
||||
G4PhysicalVolumeStore* thePhysVolStore =G4PhysicalVolumeStore::GetInstance();
|
||||
while (mother){
|
||||
theTransformationFromPhysVolToWorld *=
|
||||
G4AffineTransform(daughter->GetFrameRotation(),daughter->GetObjectTranslation());
|
||||
/*G4cout<<"Mother "<<mother->GetName()<<std::endl;
|
||||
G4cout<<"Daughter "<<daughter->GetName()<<std::endl;
|
||||
G4cout<<daughter->GetObjectTranslation()<<std::endl;
|
||||
G4cout<<theTransformationFromPhysVolToWorld.NetTranslation()<<std::endl;*/
|
||||
for ( unsigned int i=0; i< thePhysVolStore->size();i++){
|
||||
if ((*thePhysVolStore)[i]->GetLogicalVolume() == mother){
|
||||
daughter = (*thePhysVolStore)[i];
|
||||
mother =daughter->GetMotherLogical();
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
center = theTransformationFromPhysVolToWorld.NetTranslation();
|
||||
G4cout<<"Center of the spherical surface is at the position: "<<center/cm<<" cm"<<std::endl;
|
||||
|
||||
}
|
||||
else {
|
||||
G4cout<<"The physical volume with name "<<volume_name<<" does not exist!!"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
return AddaSphericalSurface(SurfaceName, radius, center, area);
|
||||
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(const G4String& SurfaceName, const G4String& volume_name, G4double& Area)
|
||||
{
|
||||
G4int ind = FindRegisteredSurface(SurfaceName);
|
||||
|
||||
G4VPhysicalVolume* thePhysicalVolume = 0;
|
||||
G4PhysicalVolumeStore* thePhysVolStore =G4PhysicalVolumeStore::GetInstance();
|
||||
for ( unsigned int i=0; i< thePhysVolStore->size();i++){
|
||||
if ((*thePhysVolStore)[i]->GetName() == volume_name){
|
||||
thePhysicalVolume = (*thePhysVolStore)[i];
|
||||
};
|
||||
|
||||
}
|
||||
if (!thePhysicalVolume){
|
||||
G4cout<<"The physical volume with name "<<volume_name<<" does not exist!!"<<std::endl;
|
||||
return false;
|
||||
}
|
||||
Area = thePhysicalVolume->GetLogicalVolume()->GetSolid()->GetSurfaceArea();
|
||||
G4String mother_vol_name = "";
|
||||
G4LogicalVolume* theMother = thePhysicalVolume->GetMotherLogical();
|
||||
|
||||
if (theMother) mother_vol_name= theMother->GetName();
|
||||
if (ind>=0) {
|
||||
ListOfSurfaceType[ind]="ExternalSurfaceOfAVolume";
|
||||
ListOfSphereRadius[ind]=0.;
|
||||
ListOfSphereCenter[ind]=G4ThreeVector(0.,0.,0.);
|
||||
ListOfVol1Name[ind]=volume_name;
|
||||
ListOfVol2Name[ind]=mother_vol_name;
|
||||
AreaOfSurface[ind]=Area;
|
||||
}
|
||||
else {
|
||||
ListOfSurfaceName.push_back(SurfaceName);
|
||||
ListOfSurfaceType.push_back("ExternalSurfaceOfAVolume");
|
||||
ListOfSphereRadius.push_back(0.);
|
||||
ListOfSphereCenter.push_back(G4ThreeVector(0.,0.,0.));
|
||||
ListOfVol1Name.push_back(volume_name);
|
||||
ListOfVol2Name.push_back(mother_vol_name);
|
||||
AreaOfSurface.push_back(Area);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4bool G4AdjointCrossSurfChecker::AddanInterfaceBetweenTwoVolumes(const G4String& SurfaceName, const G4String& volume_name1, const G4String& volume_name2,G4double& Area)
|
||||
{
|
||||
G4int ind = FindRegisteredSurface(SurfaceName);
|
||||
Area=-1.; //the way to compute the surface is not known yet
|
||||
if (ind>=0) {
|
||||
ListOfSurfaceType[ind]="BoundaryBetweenTwoVolumes";
|
||||
ListOfSphereRadius[ind]=0.;
|
||||
ListOfSphereCenter[ind]=G4ThreeVector(0.,0.,0.);
|
||||
ListOfVol1Name[ind]=volume_name1;
|
||||
ListOfVol2Name[ind]=volume_name2;
|
||||
AreaOfSurface[ind]=Area;
|
||||
|
||||
}
|
||||
else {
|
||||
ListOfSurfaceName.push_back(SurfaceName);
|
||||
ListOfSurfaceType.push_back("BoundaryBetweenTwoVolumes");
|
||||
ListOfSphereRadius.push_back(0.);
|
||||
ListOfSphereCenter.push_back(G4ThreeVector(0.,0.,0.));
|
||||
ListOfVol1Name.push_back(volume_name1);
|
||||
ListOfVol2Name.push_back(volume_name2);
|
||||
AreaOfSurface.push_back(Area);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointCrossSurfChecker::ClearListOfSelectedSurface()
|
||||
{
|
||||
ListOfSurfaceName.clear();
|
||||
ListOfSurfaceType.clear();
|
||||
ListOfSphereRadius.clear();
|
||||
ListOfSphereCenter.clear();
|
||||
ListOfVol1Name.clear();
|
||||
ListOfVol2Name.clear();
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4int G4AdjointCrossSurfChecker::FindRegisteredSurface(const G4String& name)
|
||||
{
|
||||
G4int ind=-1;
|
||||
for (size_t i = 0; i<ListOfSurfaceName.size();i++){
|
||||
if (name == ListOfSurfaceName[i]) {
|
||||
ind = int (i);
|
||||
return ind;
|
||||
}
|
||||
}
|
||||
return ind;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4AdjointSteppingAction.cc,v 1.3 2009/11/20 14:24:34 ldesorgh Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointSteppingAction
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4AdjointSteppingAction.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "G4AdjointCrossSurfChecker.hh"
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointSteppingAction::G4AdjointSteppingAction()
|
||||
{
|
||||
theG4AdjointCrossSurfChecker = G4AdjointCrossSurfChecker::GetInstance();
|
||||
did_adj_part_reach_ext_source =false;
|
||||
theUserAdjointSteppingAction =0;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointSteppingAction::~G4AdjointSteppingAction()
|
||||
{;}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointSteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
//Apply first the user adjoint stepping action
|
||||
//---------------------------
|
||||
if (theUserAdjointSteppingAction) theUserAdjointSteppingAction->UserSteppingAction(aStep);
|
||||
|
||||
G4Track* aTrack =aStep->GetTrack();
|
||||
G4double nb_nuc=1.;
|
||||
G4ParticleDefinition* thePartDef = aTrack->GetDefinition();
|
||||
|
||||
if (thePartDef->GetParticleType() == "adjoint_nucleus"){
|
||||
nb_nuc=double(thePartDef->GetBaryonNumber());
|
||||
}
|
||||
//Kill conditions for adjoint particles reaching the maximum energy
|
||||
//-----------------------------------------------------------------
|
||||
if(aTrack->GetKineticEnergy() >= ext_sourceEMax*nb_nuc){
|
||||
aTrack->SetTrackStatus(fStopAndKill);
|
||||
did_adj_part_reach_ext_source=false;
|
||||
return;
|
||||
}
|
||||
|
||||
G4double weight_factor = aTrack->GetWeight()/prim_weight;
|
||||
|
||||
if ( (weight_factor>0 && weight_factor<=0) || weight_factor<= 1e-290 || weight_factor>1.e200)
|
||||
{
|
||||
//std::cout<<"Weight_factor problem! Value = "<<weight_factor<<std::endl;
|
||||
aTrack->SetTrackStatus(fStopAndKill);
|
||||
did_adj_part_reach_ext_source=false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Kill conditions for surface crossing
|
||||
//--------------------------------------
|
||||
|
||||
G4String surface_name;
|
||||
G4double cos_to_surface;
|
||||
G4bool GoingIn;
|
||||
G4ThreeVector crossing_pos;
|
||||
if (theG4AdjointCrossSurfChecker->CrossingOneOfTheRegisteredSurface(aStep, surface_name, crossing_pos, cos_to_surface, GoingIn) ){
|
||||
|
||||
//G4cout<<"Test_step11"<<std::endl;
|
||||
//G4cout<<surface_name<<std::endl;
|
||||
if (surface_name == "ExternalSource") {
|
||||
//Registering still needed
|
||||
did_adj_part_reach_ext_source=true;
|
||||
aTrack->SetTrackStatus(fStopAndKill);
|
||||
//now register the adjoint particles reaching the external surface
|
||||
last_momentum =aTrack->GetMomentum();
|
||||
last_ekin=aTrack->GetKineticEnergy();
|
||||
last_weight = aTrack->GetWeight();
|
||||
last_part_def = aTrack->GetDefinition();
|
||||
last_pos = crossing_pos;
|
||||
return;
|
||||
}
|
||||
else if (surface_name == "AdjointSource" && GoingIn) {
|
||||
did_adj_part_reach_ext_source=false;
|
||||
aTrack->SetTrackStatus(fStopAndKill);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RichTrajectory.cc,v 1.6 2006/10/16 13:43:43 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4RichTrajectory.cc,v 1.8 2009/11/24 10:04:14 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
@@ -55,13 +56,15 @@
|
||||
#include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
G4Allocator<G4RichTrajectory> aRichTrajectoryAllocator;
|
||||
|
||||
G4RichTrajectory::G4RichTrajectory():
|
||||
fpRichPointsContainer(0),
|
||||
fpInitialVolume(0),
|
||||
fpInitialNextVolume(0),
|
||||
fpCreatorProcess(0)
|
||||
fpCreatorProcess(0),
|
||||
fpEndingProcess(0),
|
||||
fFinalKineticEnergy(0.)
|
||||
{}
|
||||
|
||||
G4RichTrajectory::G4RichTrajectory(const G4Track* aTrack):
|
||||
@@ -74,11 +77,17 @@ G4RichTrajectory::G4RichTrajectory(const G4Track* aTrack):
|
||||
// G4RichTrajectoryPoint in the
|
||||
// RichTrajectoryPointsContainer
|
||||
{
|
||||
fpInitialVolume = aTrack->GetVolume();
|
||||
fpInitialNextVolume = aTrack->GetNextVolume();
|
||||
fpInitialVolume = aTrack->GetTouchableHandle();
|
||||
fpInitialNextVolume = aTrack->GetNextTouchableHandle();
|
||||
fpCreatorProcess = aTrack->GetCreatorProcess();
|
||||
fpRichPointsContainer = new RichTrajectoryPointsContainer;
|
||||
// On construction, set final values to initial values.
|
||||
// Final values are updated at the addition of every step - see AppendStep.
|
||||
fpFinalVolume = aTrack->GetTouchableHandle();
|
||||
fpFinalNextVolume = aTrack->GetNextTouchableHandle();
|
||||
fpEndingProcess = aTrack->GetCreatorProcess();
|
||||
fFinalKineticEnergy = aTrack->GetKineticEnergy();
|
||||
// Insert the first rich trajectory point (see note above)...
|
||||
fpRichPointsContainer = new RichTrajectoryPointsContainer;
|
||||
fpRichPointsContainer->push_back(new G4RichTrajectoryPoint(aTrack));
|
||||
}
|
||||
|
||||
@@ -88,6 +97,10 @@ G4RichTrajectory::G4RichTrajectory(G4RichTrajectory & right):
|
||||
fpInitialVolume = right.fpInitialVolume;
|
||||
fpInitialNextVolume = right.fpInitialNextVolume;
|
||||
fpCreatorProcess = right.fpCreatorProcess;
|
||||
fpFinalVolume = right.fpFinalVolume;
|
||||
fpFinalNextVolume = right.fpFinalNextVolume;
|
||||
fpEndingProcess = right.fpEndingProcess;
|
||||
fFinalKineticEnergy = right.fFinalKineticEnergy;
|
||||
fpRichPointsContainer = new RichTrajectoryPointsContainer;
|
||||
for(size_t i=0;i<right.fpRichPointsContainer->size();i++)
|
||||
{
|
||||
@@ -113,6 +126,18 @@ G4RichTrajectory::~G4RichTrajectory()
|
||||
void G4RichTrajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
fpRichPointsContainer->push_back(new G4RichTrajectoryPoint(aStep));
|
||||
// Except for first step, which is a sort of virtual step to start
|
||||
// the track, compute the final values...
|
||||
const G4Track* track = aStep->GetTrack();
|
||||
const G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
|
||||
if (track->GetCurrentStepNumber() > 0) {
|
||||
fpFinalVolume = track->GetTouchableHandle();
|
||||
fpFinalNextVolume = track->GetNextTouchableHandle();
|
||||
fpEndingProcess = postStepPoint->GetProcessDefinedStep();
|
||||
fFinalKineticEnergy =
|
||||
aStep->GetPreStepPoint()->GetKineticEnergy() -
|
||||
aStep->GetTotalEnergyDeposit();
|
||||
}
|
||||
}
|
||||
|
||||
void G4RichTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
@@ -144,12 +169,12 @@ const std::map<G4String,G4AttDef>* G4RichTrajectory::GetAttDefs() const
|
||||
|
||||
G4String ID;
|
||||
|
||||
ID = "IVN";
|
||||
(*store)[ID] = G4AttDef(ID,"Initial Volume Name",
|
||||
ID = "IVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Initial Volume Path",
|
||||
"Physics","","G4String");
|
||||
|
||||
ID = "INVN";
|
||||
(*store)[ID] = G4AttDef(ID,"Initial Next Volume Name",
|
||||
ID = "INVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Initial Next Volume Path",
|
||||
"Physics","","G4String");
|
||||
|
||||
ID = "CPN";
|
||||
@@ -160,19 +185,59 @@ const std::map<G4String,G4AttDef>* G4RichTrajectory::GetAttDefs() const
|
||||
(*store)[ID] = G4AttDef(ID,"Creator Process Type Name",
|
||||
"Physics","","G4String");
|
||||
|
||||
ID = "FVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Final Volume Path",
|
||||
"Physics","","G4String");
|
||||
|
||||
ID = "FNVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Final Next Volume Path",
|
||||
"Physics","","G4String");
|
||||
|
||||
ID = "EPN";
|
||||
(*store)[ID] = G4AttDef(ID,"Ending Process Name",
|
||||
"Physics","","G4String");
|
||||
|
||||
ID = "EPTN";
|
||||
(*store)[ID] = G4AttDef(ID,"Ending Process Type Name",
|
||||
"Physics","","G4String");
|
||||
|
||||
ID = "FKE";
|
||||
(*store)[ID] = G4AttDef(ID,"Final kinetic energy",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
|
||||
}
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
static G4String Path(const G4TouchableHandle& th)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
G4int depth = th->GetHistoryDepth();
|
||||
for (G4int i = depth; i >= 0; --i) {
|
||||
oss << th->GetVolume(i)->GetName()
|
||||
<< ':' << th->GetCopyNumber(i);
|
||||
if (i != 0) oss << '/';
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4RichTrajectory::CreateAttValues() const
|
||||
{
|
||||
// Create base class att values...
|
||||
std::vector<G4AttValue>* values = G4Trajectory::CreateAttValues();
|
||||
|
||||
values->push_back(G4AttValue("IVN",fpInitialVolume->GetName(),""));
|
||||
if (fpInitialVolume && fpInitialVolume->GetVolume()) {
|
||||
values->push_back(G4AttValue("IVPath",Path(fpInitialVolume),""));
|
||||
} else {
|
||||
values->push_back(G4AttValue("IVPath","None",""));
|
||||
}
|
||||
|
||||
values->push_back(G4AttValue("INVN",fpInitialNextVolume->GetName(),""));
|
||||
if (fpInitialNextVolume && fpInitialNextVolume->GetVolume()) {
|
||||
values->push_back(G4AttValue("INVPath",Path(fpInitialNextVolume),""));
|
||||
} else {
|
||||
values->push_back(G4AttValue("INVPath","None",""));
|
||||
}
|
||||
|
||||
if (fpCreatorProcess) {
|
||||
values->push_back(G4AttValue("CPN",fpCreatorProcess->GetProcessName(),""));
|
||||
@@ -183,6 +248,30 @@ std::vector<G4AttValue>* G4RichTrajectory::CreateAttValues() const
|
||||
values->push_back(G4AttValue("CPTN","User",""));
|
||||
}
|
||||
|
||||
if (fpFinalVolume && fpFinalVolume->GetVolume()) {
|
||||
values->push_back(G4AttValue("FVPath",Path(fpFinalVolume),""));
|
||||
} else {
|
||||
values->push_back(G4AttValue("FVPath","None",""));
|
||||
}
|
||||
|
||||
if (fpFinalNextVolume && fpFinalNextVolume->GetVolume()) {
|
||||
values->push_back(G4AttValue("FNVPath",Path(fpFinalNextVolume),""));
|
||||
} else {
|
||||
values->push_back(G4AttValue("FNVPath","None",""));
|
||||
}
|
||||
|
||||
if (fpEndingProcess) {
|
||||
values->push_back(G4AttValue("EPN",fpEndingProcess->GetProcessName(),""));
|
||||
G4ProcessType type = fpEndingProcess->GetProcessType();
|
||||
values->push_back(G4AttValue("EPTN",G4VProcess::GetProcessTypeName(type),""));
|
||||
} else {
|
||||
values->push_back(G4AttValue("EPN","User Defined",""));
|
||||
values->push_back(G4AttValue("EPTN","User",""));
|
||||
}
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("FKE",G4BestUnit(fFinalKineticEnergy,"Energy"),""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RichTrajectoryPoint.cc,v 1.3 2006/09/27 20:42:52 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4RichTrajectoryPoint.cc,v 1.5 2009/11/24 10:04:14 perl Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
@@ -60,11 +60,14 @@
|
||||
#include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
G4Allocator<G4RichTrajectoryPoint> aRichTrajectoryPointAllocator;
|
||||
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint():
|
||||
fpAuxiliaryPointVector(0),
|
||||
fTotEDep(0.),
|
||||
fRemainingEnergy(0.),
|
||||
fpProcess(0),
|
||||
fPreStepPointGlobalTime(0),
|
||||
fPostStepPointGlobalTime(0)
|
||||
@@ -74,9 +77,12 @@ G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Track* aTrack):
|
||||
G4TrajectoryPoint(aTrack->GetPosition()),
|
||||
fpAuxiliaryPointVector(0),
|
||||
fTotEDep(0.),
|
||||
fRemainingEnergy(aTrack->GetKineticEnergy()),
|
||||
fpProcess(0),
|
||||
fPreStepPointGlobalTime(aTrack->GetGlobalTime()),
|
||||
fPostStepPointGlobalTime(aTrack->GetGlobalTime())
|
||||
fPostStepPointGlobalTime(aTrack->GetGlobalTime()),
|
||||
fpPreStepPointVolume(aTrack->GetTouchableHandle()),
|
||||
fpPostStepPointVolume(aTrack->GetNextTouchableHandle())
|
||||
{}
|
||||
|
||||
G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Step* aStep):
|
||||
@@ -86,9 +92,16 @@ G4RichTrajectoryPoint::G4RichTrajectoryPoint(const G4Step* aStep):
|
||||
{
|
||||
G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
|
||||
G4StepPoint* postStepPoint = aStep->GetPostStepPoint();
|
||||
if (aStep->GetTrack()->GetCurrentStepNumber() <= 0) { // First step
|
||||
fRemainingEnergy = aStep->GetTrack()->GetKineticEnergy();
|
||||
} else {
|
||||
fRemainingEnergy = preStepPoint->GetKineticEnergy() - fTotEDep;
|
||||
}
|
||||
fpProcess = postStepPoint->GetProcessDefinedStep();
|
||||
fPreStepPointGlobalTime = preStepPoint->GetGlobalTime();
|
||||
fPostStepPointGlobalTime = postStepPoint->GetGlobalTime();
|
||||
fpPreStepPointVolume = preStepPoint->GetTouchableHandle();
|
||||
fpPostStepPointVolume = postStepPoint->GetTouchableHandle();
|
||||
|
||||
/*
|
||||
G4cout << "fpAuxiliaryPointVector "
|
||||
@@ -123,6 +136,7 @@ G4RichTrajectoryPoint::G4RichTrajectoryPoint
|
||||
G4TrajectoryPoint(right),
|
||||
fpAuxiliaryPointVector(right.fpAuxiliaryPointVector),
|
||||
fTotEDep(right.fTotEDep),
|
||||
fRemainingEnergy(right.fRemainingEnergy),
|
||||
fpProcess(right.fpProcess),
|
||||
fPreStepPointGlobalTime(right.fPreStepPointGlobalTime),
|
||||
fPostStepPointGlobalTime(right.fPostStepPointGlobalTime)
|
||||
@@ -159,6 +173,9 @@ G4RichTrajectoryPoint::GetAttDefs() const
|
||||
ID = "TED";
|
||||
(*store)[ID] = G4AttDef(ID,"Total Energy Deposit",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
ID = "RE";
|
||||
(*store)[ID] = G4AttDef(ID,"Remaining Energy",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
ID = "PDS";
|
||||
(*store)[ID] = G4AttDef(ID,"Process Defined Step",
|
||||
"Physics","","G4String");
|
||||
@@ -171,10 +188,28 @@ G4RichTrajectoryPoint::GetAttDefs() const
|
||||
ID = "PostT";
|
||||
(*store)[ID] = G4AttDef(ID,"Post-step-point global time",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
ID = "PreVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Pre-step Volume Path",
|
||||
"Physics","","G4String");
|
||||
ID = "PostVPath";
|
||||
(*store)[ID] = G4AttDef(ID,"Post-step Volume Path",
|
||||
"Physics","","G4String");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
static G4String Path(const G4TouchableHandle& th)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
G4int depth = th->GetHistoryDepth();
|
||||
for (G4int i = depth; i >= 0; --i) {
|
||||
oss << th->GetVolume(i)->GetName()
|
||||
<< ':' << th->GetCopyNumber(i);
|
||||
if (i != 0) oss << '/';
|
||||
}
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::vector<G4AttValue>* G4RichTrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
// Create base class att values...
|
||||
@@ -190,6 +225,8 @@ std::vector<G4AttValue>* G4RichTrajectoryPoint::CreateAttValues() const
|
||||
|
||||
values->push_back(G4AttValue("TED",G4BestUnit(fTotEDep,"Energy"),""));
|
||||
|
||||
values->push_back(G4AttValue("RE",G4BestUnit(fRemainingEnergy,"Energy"),""));
|
||||
|
||||
if (fpProcess) {
|
||||
values->push_back
|
||||
(G4AttValue("PDS",fpProcess->GetProcessName(),""));
|
||||
@@ -209,6 +246,18 @@ std::vector<G4AttValue>* G4RichTrajectoryPoint::CreateAttValues() const
|
||||
values->push_back
|
||||
(G4AttValue("PostT",G4BestUnit(fPostStepPointGlobalTime,"Time"),""));
|
||||
|
||||
if (fpPreStepPointVolume && fpPreStepPointVolume->GetVolume()) {
|
||||
values->push_back(G4AttValue("PreVPath",Path(fpPreStepPointVolume),""));
|
||||
} else {
|
||||
values->push_back(G4AttValue("PreVPath","None",""));
|
||||
}
|
||||
|
||||
if (fpPostStepPointVolume && fpPostStepPointVolume->GetVolume()) {
|
||||
values->push_back(G4AttValue("PostVPath",Path(fpPostStepPointVolume),""));
|
||||
} else {
|
||||
values->push_back(G4AttValue("PostVPath","None",""));
|
||||
}
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SmoothTrajectory.cc,v 1.18 2006/10/16 13:37:17 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4SmoothTrajectory.cc,v 1.19 2009/11/12 09:09:56 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
@@ -59,7 +59,7 @@ G4Allocator<G4SmoothTrajectory> aSmoothTrajectoryAllocator;
|
||||
G4SmoothTrajectory::G4SmoothTrajectory()
|
||||
: positionRecord(0), fTrackID(0), fParentID(0),
|
||||
PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
|
||||
initialMomentum( G4ThreeVector() )
|
||||
initialKineticEnergy( 0. ), initialMomentum( G4ThreeVector() )
|
||||
{;}
|
||||
|
||||
G4SmoothTrajectory::G4SmoothTrajectory(const G4Track* aTrack)
|
||||
@@ -70,6 +70,7 @@ G4SmoothTrajectory::G4SmoothTrajectory(const G4Track* aTrack)
|
||||
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
initialKineticEnergy = aTrack->GetKineticEnergy();
|
||||
initialMomentum = aTrack->GetMomentum();
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
@@ -87,6 +88,7 @@ G4SmoothTrajectory::G4SmoothTrajectory(G4SmoothTrajectory & right):G4VTrajectory
|
||||
PDGEncoding = right.PDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
initialKineticEnergy = right.initialKineticEnergy;
|
||||
initialMomentum = right.initialMomentum;
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
|
||||
@@ -146,13 +148,18 @@ const std::map<G4String,G4AttDef>* G4SmoothTrajectory::GetAttDefs() const
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
|
||||
|
||||
G4String IKE("IKE");
|
||||
(*store)[IKE] =
|
||||
G4AttDef(IKE, "Initial kinetic energy",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Momentum of track at start of trajectory",
|
||||
(*store)[IMom] = G4AttDef(IMom, "Initial momentum",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
|
||||
G4String IMag("IMag");
|
||||
(*store)[IMag] = G4AttDef
|
||||
(IMag, "Magnitude of momentum of track at start of trajectory",
|
||||
(IMag, "Initial momentum magnitude",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
|
||||
G4String NTP("NTP");
|
||||
@@ -181,6 +188,9 @@ std::vector<G4AttValue>* G4SmoothTrajectory::CreateAttValues() const
|
||||
values->push_back
|
||||
(G4AttValue("PDG",G4UIcommand::ConvertToString(PDGEncoding),""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IKE",G4BestUnit(initialKineticEnergy,"Energy"),""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMom",G4BestUnit(initialMomentum,"Energy"),""));
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SteppingManager.cc,v 1.49 2008/05/06 12:52:48 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4SteppingManager.cc,v 1.50 2009/02/27 08:09:50 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
@@ -312,7 +312,8 @@ void G4SteppingManager::SetInitialStep(G4Track* valueTrack)
|
||||
fNavigator->ResetHierarchyAndLocate( fTrack->GetPosition(),
|
||||
fTrack->GetMomentumDirection(),
|
||||
*((G4TouchableHistory*)fTrack->GetTouchableHandle()()) );
|
||||
if(newTopVolume != oldTopVolume ){
|
||||
// if(newTopVolume != oldTopVolume ){
|
||||
if(newTopVolume != oldTopVolume || oldTopVolume->GetRegularStructureId() == 1 ) {
|
||||
fTouchableHandle = fNavigator->CreateTouchableHistory();
|
||||
fTrack->SetTouchableHandle( fTouchableHandle );
|
||||
fTrack->SetNextTouchableHandle( fTouchableHandle );
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SteppingManager2.cc,v 1.35 2008/12/05 22:15:04 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4SteppingManager2.cc,v 1.37 2009/09/25 00:23:41 gum Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
//
|
||||
@@ -275,7 +275,6 @@ void G4SteppingManager::GetProcessNumber()
|
||||
void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
//////////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
// Select the rest process which has the shortest time before
|
||||
// it is invoked. In rest processes, GPIL()
|
||||
// returns the time before a process occurs.
|
||||
@@ -293,18 +292,20 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
continue;
|
||||
} // NULL means the process is inactivated by a user on fly.
|
||||
|
||||
lifeTime =
|
||||
lifeTime =
|
||||
fCurrentProcess->AtRestGPIL(
|
||||
*fTrack,
|
||||
&fCondition );
|
||||
if(fCondition==Forced){
|
||||
|
||||
if(fCondition==Forced && fCurrentProcess){
|
||||
(*fSelectedAtRestDoItVector)[ri] = Forced;
|
||||
}
|
||||
else{
|
||||
(*fSelectedAtRestDoItVector)[ri] = InActivated;
|
||||
if(lifeTime < shortestLifeTime ){
|
||||
shortestLifeTime = lifeTime;
|
||||
fAtRestDoItProcTriggered = G4int(int(ri));
|
||||
if(lifeTime < shortestLifeTime ){
|
||||
shortestLifeTime = lifeTime;
|
||||
fAtRestDoItProcTriggered = G4int(int(ri));
|
||||
(*fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] = NotForced;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,8 +315,6 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
if(NofInactiveProc==MAXofAtRestLoops){
|
||||
// G4Exception("G4SteppingManager::InvokeAtRestDoItProcs: No AtRestDoIt process is active. " );
|
||||
G4cerr << "G4SteppingManager::InvokeAtRestDoItProcs: No AtRestDoIt process is active. " << G4endl;
|
||||
} else {
|
||||
(*fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] = NotForced;
|
||||
}
|
||||
|
||||
fStep->SetStepLength( 0. ); //the particle has stopped
|
||||
@@ -329,7 +328,6 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
//
|
||||
if( (*fSelectedAtRestDoItVector)[MAXofAtRestLoops-np-1] != InActivated){
|
||||
|
||||
|
||||
fCurrentProcess = (*fAtRestDoItVector)[np];
|
||||
fParticleChange
|
||||
= fCurrentProcess->AtRestDoIt( *fTrack, *fStep);
|
||||
@@ -382,7 +380,6 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
|
||||
} //if(fSelectedAtRestDoItVector[np] != InActivated){
|
||||
} //for(size_t np=0; np < MAXofAtRestLoops; np++){
|
||||
|
||||
fStep->UpdateTrack();
|
||||
|
||||
fTrack->SetTrackStatus( fStopAndKill );
|
||||
@@ -614,4 +611,3 @@ void G4SteppingManager::ApplyProductionCut(G4Track* aSecondary)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Trajectory.cc,v 1.32 2006/10/16 13:39:35 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4Trajectory.cc,v 1.33 2009/11/12 09:09:56 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
@@ -58,7 +58,7 @@ G4Allocator<G4Trajectory> aTrajectoryAllocator;
|
||||
G4Trajectory::G4Trajectory()
|
||||
: positionRecord(0), fTrackID(0), fParentID(0),
|
||||
PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
|
||||
initialMomentum( G4ThreeVector() )
|
||||
initialKineticEnergy( 0. ), initialMomentum( G4ThreeVector() )
|
||||
{;}
|
||||
|
||||
G4Trajectory::G4Trajectory(const G4Track* aTrack)
|
||||
@@ -69,6 +69,7 @@ G4Trajectory::G4Trajectory(const G4Track* aTrack)
|
||||
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
initialKineticEnergy = aTrack->GetKineticEnergy();
|
||||
initialMomentum = aTrack->GetMomentum();
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
@@ -82,6 +83,7 @@ G4Trajectory::G4Trajectory(G4Trajectory & right):G4VTrajectory()
|
||||
PDGEncoding = right.PDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
initialKineticEnergy = right.initialKineticEnergy;
|
||||
initialMomentum = right.initialMomentum;
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
|
||||
@@ -141,13 +143,18 @@ const std::map<G4String,G4AttDef>* G4Trajectory::GetAttDefs() const
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
|
||||
|
||||
G4String IKE("IKE");
|
||||
(*store)[IKE] =
|
||||
G4AttDef(IKE, "Initial kinetic energy",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Momentum at start of trajectory",
|
||||
(*store)[IMom] = G4AttDef(IMom, "Initial momentum",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
|
||||
G4String IMag("IMag");
|
||||
(*store)[IMag] =
|
||||
G4AttDef(IMag, "Magnitude of momentum at start of trajectory",
|
||||
G4AttDef(IMag, "Initial momentum magnitude",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
|
||||
G4String NTP("NTP");
|
||||
@@ -175,6 +182,9 @@ std::vector<G4AttValue>* G4Trajectory::CreateAttValues() const
|
||||
values->push_back
|
||||
(G4AttValue("PDG",G4UIcommand::ConvertToString(PDGEncoding),""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IKE",G4BestUnit(initialKineticEnergy,"Energy"),""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMom",G4BestUnit(initialMomentum,"Energy"),""));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user