Import Geant4 5.0.0 source tree
This commit is contained in:
@@ -0,0 +1,217 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SmoothTrajectory.cc,v 1.8 2002/11/11 13:13:02 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4SmoothTrajectory.cc
|
||||
//
|
||||
// Contact:
|
||||
// Questions and comments to this code should be sent to
|
||||
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
|
||||
// Makoto Asai (e-mail: asai@kekvax.kek.jp)
|
||||
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
|
||||
#include "G4SmoothTrajectory.hh"
|
||||
#include "G4SmoothTrajectoryPoint.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "g4std/strstream"
|
||||
|
||||
G4Allocator<G4SmoothTrajectory> aSmoothTrajectoryAllocator;
|
||||
|
||||
G4SmoothTrajectory::G4SmoothTrajectory()
|
||||
: positionRecord(0), fTrackID(0), fParentID(0),
|
||||
PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
|
||||
initialMomentum( G4ThreeVector() )
|
||||
{;}
|
||||
|
||||
G4SmoothTrajectory::G4SmoothTrajectory(const G4Track* aTrack)
|
||||
{
|
||||
G4ParticleDefinition * fpParticleDefinition = aTrack->GetDefinition();
|
||||
ParticleName = fpParticleDefinition->GetParticleName();
|
||||
PDGCharge = fpParticleDefinition->GetPDGCharge();
|
||||
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
initialMomentum = aTrack->GetMomentum();
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition()));
|
||||
|
||||
// The first point has no auxiliary points, so set the auxiliary
|
||||
// points vector to NULL (jacek 31/10/2002)
|
||||
positionRecord->push_back(new G4SmoothTrajectoryPoint(aTrack->GetPosition(), NULL));
|
||||
}
|
||||
|
||||
G4SmoothTrajectory::G4SmoothTrajectory(G4SmoothTrajectory & right)
|
||||
{
|
||||
ParticleName = right.ParticleName;
|
||||
PDGCharge = right.PDGCharge;
|
||||
PDGEncoding = right.PDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
initialMomentum = right.initialMomentum;
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
|
||||
for(size_t i=0;i<right.positionRecord->size();i++)
|
||||
{
|
||||
G4SmoothTrajectoryPoint* rightPoint = (G4SmoothTrajectoryPoint*)((*(right.positionRecord))[i]);
|
||||
positionRecord->push_back(new G4SmoothTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
G4SmoothTrajectory::~G4SmoothTrajectory()
|
||||
{
|
||||
// positionRecord->clearAndDestroy();
|
||||
size_t i;
|
||||
for(i=0;i<positionRecord->size();i++){
|
||||
delete (*positionRecord)[i];
|
||||
}
|
||||
positionRecord->clear();
|
||||
|
||||
delete positionRecord;
|
||||
}
|
||||
|
||||
void G4SmoothTrajectory::ShowTrajectory(G4std::ostream& os) const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::ShowTrajectory(os);
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
void G4SmoothTrajectory::DrawTrajectory(G4int i_mode) const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::DrawTrajectory(i_mode);
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
const G4std::map<G4String,G4AttDef>* G4SmoothTrajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
G4std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4SmoothTrajectory",isNew);
|
||||
if (isNew) {
|
||||
|
||||
G4String ID("ID");
|
||||
(*store)[ID] = G4AttDef(ID,"Track ID","Bookkeeping","","G4int");
|
||||
|
||||
G4String PID("PID");
|
||||
(*store)[PID] = G4AttDef(PID,"Parent ID","Bookkeeping","","G4int");
|
||||
|
||||
G4String PN("PN");
|
||||
(*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
|
||||
|
||||
G4String Ch("Ch");
|
||||
(*store)[Ch] = G4AttDef(Ch,"Charge","Physics","","G4double");
|
||||
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Momentum of track at start of trajectory",
|
||||
"Physics","","G4ThreeVector");
|
||||
|
||||
G4String NTP("NTP");
|
||||
(*store)[NTP] = G4AttDef(NTP,"No. of points","Physics","","G4int");
|
||||
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
G4std::vector<G4AttValue>* G4SmoothTrajectory::CreateAttValues() const
|
||||
{
|
||||
char c[100];
|
||||
G4std::ostrstream s(c,100);
|
||||
|
||||
G4std::vector<G4AttValue>* values = new G4std::vector<G4AttValue>;
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << fTrackID << G4std::ends;
|
||||
values->push_back(G4AttValue("ID",c,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << fParentID << G4std::ends;
|
||||
values->push_back(G4AttValue("PID",c,""));
|
||||
|
||||
values->push_back(G4AttValue("PN",ParticleName,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << PDGCharge << G4std::ends;
|
||||
values->push_back(G4AttValue("Ch",c,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << PDGEncoding << G4std::ends;
|
||||
values->push_back(G4AttValue("PDG",c,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << G4BestUnit(initialMomentum,"Energy") << G4std::ends;
|
||||
values->push_back(G4AttValue("IMom",c,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << GetPointEntries() << G4std::ends;
|
||||
values->push_back(G4AttValue("NTP",c,""));
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
void G4SmoothTrajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
// (jacek 30/10/2002)
|
||||
positionRecord->push_back(
|
||||
new G4SmoothTrajectoryPoint(aStep->GetPostStepPoint()->GetPosition(),
|
||||
aStep->GetPointerToVectorOfAuxiliaryPoints()));
|
||||
}
|
||||
|
||||
G4ParticleDefinition* G4SmoothTrajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
}
|
||||
|
||||
void G4SmoothTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if(!secondTrajectory) return;
|
||||
|
||||
G4SmoothTrajectory* seco = (G4SmoothTrajectory*)secondTrajectory;
|
||||
G4int ent = seco->GetPointEntries();
|
||||
for(G4int i=1;i<ent;i++) // initial point of the second trajectory should not be merged
|
||||
{
|
||||
positionRecord->push_back((*(seco->positionRecord))[i]);
|
||||
// positionRecord->push_back(seco->positionRecord->removeAt(1));
|
||||
}
|
||||
delete (*seco->positionRecord)[0];
|
||||
seco->positionRecord->clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SmoothTrajectoryPoint.cc,v 1.8 2002/12/06 12:16:44 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4SmoothTrajectoryPoint.cc
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#include "G4SmoothTrajectoryPoint.hh"
|
||||
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "g4std/strstream"
|
||||
|
||||
G4Allocator<G4SmoothTrajectoryPoint> aSmoothTrajectoryPointAllocator;
|
||||
|
||||
G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint()
|
||||
: fAuxiliaryPointVector(0)
|
||||
{
|
||||
fPosition = G4ThreeVector(0.,0.,0.);
|
||||
}
|
||||
|
||||
G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(G4ThreeVector pos)
|
||||
: fAuxiliaryPointVector(0)
|
||||
{
|
||||
fPosition = pos;
|
||||
}
|
||||
|
||||
G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(G4ThreeVector pos,
|
||||
G4std::vector<G4ThreeVector>* auxiliaryPoints)
|
||||
: fPosition(pos),
|
||||
fAuxiliaryPointVector(auxiliaryPoints)
|
||||
{}
|
||||
|
||||
G4SmoothTrajectoryPoint::G4SmoothTrajectoryPoint(const G4SmoothTrajectoryPoint &right)
|
||||
: fPosition(right.fPosition),fAuxiliaryPointVector(right.fAuxiliaryPointVector)
|
||||
{
|
||||
}
|
||||
|
||||
G4SmoothTrajectoryPoint::~G4SmoothTrajectoryPoint()
|
||||
{
|
||||
if(fAuxiliaryPointVector) {
|
||||
delete fAuxiliaryPointVector;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const G4std::map<G4String,G4AttDef>*
|
||||
G4SmoothTrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
G4std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4SmoothTrajectoryPoint",isNew);
|
||||
if (isNew) {
|
||||
G4String Pos("Pos");
|
||||
(*store)[Pos] = G4AttDef(Pos, "Step Position",
|
||||
"Physics","","G4ThreeVector");
|
||||
G4String Aux("Aux");
|
||||
(*store)[Aux] = G4AttDef(Aux, "Auxiliary Point Position",
|
||||
"Physics","","G4ThreeVector");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
G4std::vector<G4AttValue>* G4SmoothTrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
char c[100];
|
||||
G4std::ostrstream s(c,100);
|
||||
|
||||
G4std::vector<G4AttValue>* values = new G4std::vector<G4AttValue>;
|
||||
|
||||
if (fAuxiliaryPointVector) {
|
||||
G4std::vector<G4ThreeVector>::iterator iAux;
|
||||
for (iAux = fAuxiliaryPointVector->begin();
|
||||
iAux != fAuxiliaryPointVector->end(); ++iAux) {
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << G4BestUnit(*iAux,"Length") << G4std::ends;
|
||||
values->push_back(G4AttValue("Aux",c,""));
|
||||
}
|
||||
}
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << G4BestUnit(fPosition,"Length") << G4std::ends;
|
||||
values->push_back(G4AttValue("Pos",c,""));
|
||||
|
||||
return values;
|
||||
}
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SteppingManager.cc,v 1.28 2002/02/07 04:00:22 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// $Id: G4SteppingManager.cc,v 1.30 2002/12/04 23:00:50 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -71,7 +71,7 @@ G4SteppingManager::G4SteppingManager()
|
||||
else {
|
||||
fVerbose = G4VSteppingVerbose::GetInstance();
|
||||
fVerbose -> SetManager(this);
|
||||
KillVerbose = false;
|
||||
KillVerbose = false;
|
||||
}
|
||||
#endif
|
||||
SetNavigator(G4TransportationManager::GetTransportationManager()
|
||||
@@ -87,6 +87,7 @@ G4SteppingManager::G4SteppingManager()
|
||||
SetNavigator(G4TransportationManager::GetTransportationManager()
|
||||
->GetNavigatorForTracking());
|
||||
|
||||
physIntLength = DBL_MAX;
|
||||
// fTouchableHandle = new G4TouchableHistory();
|
||||
}
|
||||
|
||||
@@ -248,6 +249,17 @@ void G4SteppingManager::SetInitialStep(G4Track* valueTrack)
|
||||
fTrack = valueTrack;
|
||||
Mass = fTrack->GetDynamicParticle()->GetMass();
|
||||
|
||||
PhysicalStep = 0.;
|
||||
GeometricalStep = 0.;
|
||||
CorrectedStep = 0.;
|
||||
PreStepPointIsGeom = false;
|
||||
FirstStep = false;
|
||||
fStepStatus = fUndefined;
|
||||
|
||||
TempInitVelocity = 0.;
|
||||
TempVelocity = 0.;
|
||||
sumEnergyChange = 0.;
|
||||
|
||||
|
||||
// If the primary track has 'Suspend' or 'PostponeToNextEvent' state,
|
||||
// set the track state to 'Alive'.
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SteppingManager2.cc,v 1.5 2002/02/04 01:49:08 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// $Id: G4SteppingManager2.cc,v 1.9 2002/11/07 21:31:57 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -70,6 +70,13 @@ void G4SteppingManager::GetProcessNumber()
|
||||
MAXofPostStepLoops = pm->GetPostStepProcessVector()->entries();
|
||||
fPostStepDoItVector = pm->GetPostStepProcessVector(typeDoIt);
|
||||
fPostStepGetPhysIntVector = pm->GetPostStepProcessVector(typeGPIL);
|
||||
|
||||
if (SizeOfSelectedDoItVector<MAXofAtRestLoops ||
|
||||
SizeOfSelectedDoItVector<MAXofAlongStepLoops ||
|
||||
SizeOfSelectedDoItVector<MAXofPostStepLoops ) {
|
||||
G4Exception("G4SteppingManager::GetProcessNumber : The array size is small than the actutal number of processes. Chnage G4SteppingManager.hh and recompile is needed. " );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +126,7 @@ void G4SteppingManager::GetProcessNumber()
|
||||
for(size_t np=0; np < MAXofPostStepLoops; np++){
|
||||
fCurrentProcess = (*fPostStepGetPhysIntVector)(np);
|
||||
if (fCurrentProcess== NULL) {
|
||||
(*fSelectedPostStepDoItVector)[np] = 0;
|
||||
(*fSelectedPostStepDoItVector)[np] = InActivated;
|
||||
continue;
|
||||
} // NULL means the process is inactivated by a user on fly.
|
||||
|
||||
@@ -134,19 +141,22 @@ void G4SteppingManager::GetProcessNumber()
|
||||
|
||||
switch (fCondition) {
|
||||
case ExclusivelyForced:
|
||||
(*fSelectedPostStepDoItVector)[np] = 4;
|
||||
(*fSelectedPostStepDoItVector)[np] = ExclusivelyForced;
|
||||
fStepStatus = fExclusivelyForcedProc;
|
||||
fStep->GetPostStepPoint()
|
||||
->SetProcessDefinedStep(fCurrentProcess);
|
||||
break;
|
||||
case Conditionally:
|
||||
(*fSelectedPostStepDoItVector)[np] = 3;
|
||||
(*fSelectedPostStepDoItVector)[np] = Conditionally;
|
||||
break;
|
||||
case Forced:
|
||||
(*fSelectedPostStepDoItVector)[np] = 2;
|
||||
(*fSelectedPostStepDoItVector)[np] = Forced;
|
||||
break;
|
||||
case StronglyForced:
|
||||
(*fSelectedPostStepDoItVector)[np] = StronglyForced;
|
||||
break;
|
||||
default:
|
||||
(*fSelectedPostStepDoItVector)[np] = 0;
|
||||
(*fSelectedPostStepDoItVector)[np] = InActivated;
|
||||
if(physIntLength < PhysicalStep ){
|
||||
PhysicalStep = physIntLength;
|
||||
fStepStatus = fPostStepDoItProc;
|
||||
@@ -159,7 +169,7 @@ void G4SteppingManager::GetProcessNumber()
|
||||
}
|
||||
|
||||
if(fPostStepDoItProcTriggered<MAXofPostStepLoops)
|
||||
(*fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] = 1;
|
||||
(*fSelectedPostStepDoItVector)[fPostStepDoItProcTriggered] = NotForced;
|
||||
|
||||
|
||||
// GPIL for AlongStep
|
||||
@@ -227,7 +237,7 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
for( size_t ri=0 ; ri < MAXofAtRestLoops ; ri++ ){
|
||||
fCurrentProcess = (*fAtRestGetPhysIntVector)[ri];
|
||||
if (fCurrentProcess== NULL) {
|
||||
(*fSelectedAtRestDoItVector)[ri] = 0;
|
||||
(*fSelectedAtRestDoItVector)[ri] = InActivated;
|
||||
NofInactiveProc++;
|
||||
continue;
|
||||
} // NULL means the process is inactivated by a user on fly.
|
||||
@@ -237,11 +247,11 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
*fTrack,
|
||||
&fCondition );
|
||||
if(fCondition==Forced){
|
||||
(*fSelectedAtRestDoItVector)[ri] = 2;
|
||||
(*fSelectedAtRestDoItVector)[ri] = Forced;
|
||||
}
|
||||
else{
|
||||
(*fSelectedAtRestDoItVector)[ri] = 0;
|
||||
if(lifeTime < shortestLifeTime ){
|
||||
(*fSelectedAtRestDoItVector)[ri] = InActivated;
|
||||
if(lifeTime < shortestLifeTime ){
|
||||
shortestLifeTime = lifeTime;
|
||||
fAtRestDoItProcTriggered = G4int(int(ri));
|
||||
}
|
||||
@@ -254,7 +264,7 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
G4Exception("G4SteppingManager::InvokeAtRestDoItProcs: No AtRestDoIt process is active. " );
|
||||
}
|
||||
|
||||
(*fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] = 1;
|
||||
(*fSelectedAtRestDoItVector)[fAtRestDoItProcTriggered] = NotForced;
|
||||
|
||||
fStep->SetStepLength( 0. ); //the particle has stopped
|
||||
fTrack->SetStepLength( 0. );
|
||||
@@ -265,7 +275,7 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
// Note: DoItVector has inverse order against GetPhysIntVector
|
||||
// and SelectedAtRestDoItVector.
|
||||
//
|
||||
if( (*fSelectedAtRestDoItVector)[MAXofAtRestLoops-np-1] != 0){
|
||||
if( (*fSelectedAtRestDoItVector)[MAXofAtRestLoops-np-1] != InActivated){
|
||||
|
||||
|
||||
fCurrentProcess = (*fAtRestDoItVector)[np];
|
||||
@@ -354,7 +364,7 @@ void G4SteppingManager::InvokeAtRestDoItProcs()
|
||||
// clear ParticleChange
|
||||
fParticleChange->Clear();
|
||||
|
||||
} //if(fSelectedAtRestDoItVector[np] != 0){
|
||||
} //if(fSelectedAtRestDoItVector[np] != InActivated){
|
||||
} //for(size_t np=0; np < MAXofAtRestLoops; np++){
|
||||
|
||||
fStep->UpdateTrack();
|
||||
@@ -484,16 +494,37 @@ void G4SteppingManager::InvokePostStepDoItProcs()
|
||||
// Note: DoItVector has inverse order against GetPhysIntVector
|
||||
// and SelectedPostStepDoItVector.
|
||||
//
|
||||
size_t npGPIL = MAXofPostStepLoops-np-1;
|
||||
|
||||
G4int tmp= (*fSelectedPostStepDoItVector)[npGPIL];
|
||||
if(tmp != 0){
|
||||
G4int Cond = (*fSelectedPostStepDoItVector)[MAXofPostStepLoops-np-1];
|
||||
if(Cond != InActivated){
|
||||
if( ((Cond == NotForced) && (fStepStatus == fPostStepDoItProc)) ||
|
||||
((Cond == Forced) && (fStepStatus != fExclusivelyForcedProc)) ||
|
||||
((Cond == Conditionally) && (fStepStatus == fAlongStepDoItProc)) ||
|
||||
((Cond == ExclusivelyForced) && (fStepStatus == fExclusivelyForcedProc)) ||
|
||||
((Cond == StronglyForced) )
|
||||
) {
|
||||
|
||||
if ( ((tmp == 1) && (fStepStatus == fPostStepDoItProc)) ||
|
||||
((tmp == 2) && (fStepStatus != fExclusivelyForcedProc)) ||
|
||||
((tmp == 3) && (fStepStatus == fAlongStepDoItProc)) ||
|
||||
((tmp == 4) && (fStepStatus == fExclusivelyForcedProc)) ) {
|
||||
InvokePSDIP(np);
|
||||
}
|
||||
} //if(*fSelectedPostStepDoItVector(np)........
|
||||
|
||||
// Exit from PostStepLoop if the track has been killed,
|
||||
// but extra treatment for processes with Strongly Forced flag
|
||||
if(fTrack->GetTrackStatus() == fStopAndKill) {
|
||||
for(size_t np1=np+1; np1 < MAXofPostStepLoops; np1++){
|
||||
G4int Cond2 = (*fSelectedPostStepDoItVector)[MAXofPostStepLoops-np1-1];
|
||||
if (Cond2 == StronglyForced) {
|
||||
InvokePSDIP(np1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
} //for(size_t np=0; np < MAXofPostStepLoops; np++){
|
||||
}
|
||||
|
||||
|
||||
|
||||
void G4SteppingManager::InvokePSDIP(size_t np)
|
||||
{
|
||||
fCurrentProcess = (*fPostStepDoItVector)[np];
|
||||
fParticleChange
|
||||
= fCurrentProcess->PostStepDoIt( *fTrack, *fStep);
|
||||
@@ -586,12 +617,4 @@ void G4SteppingManager::InvokePostStepDoItProcs()
|
||||
|
||||
// clear ParticleChange
|
||||
fParticleChange->Clear();
|
||||
}
|
||||
} //if(*fSelectedPostStepDoItVector(np) != 0){
|
||||
|
||||
// Exit from PostStepLoop if the track has been killed
|
||||
if(fTrack->GetTrackStatus() == fStopAndKill) break;
|
||||
|
||||
} //for(size_t np=0; np < MAXofPostStepLoops; np++){
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SteppingVerbose.cc,v 1.10 2001/12/06 10:04:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// $Id: G4SteppingVerbose.cc,v 1.12 2002/12/12 16:16:41 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -369,6 +369,7 @@ void G4SteppingVerbose::DPSLAlongStep()
|
||||
/////////////////////////////////////////////
|
||||
{
|
||||
CopyState();
|
||||
|
||||
if( verboseLevel > 5 ){
|
||||
G4cout << " ++ProposedStep(AlongStep) = "
|
||||
<< G4std::setw( 9) << G4BestUnit(physIntLength , "Length")
|
||||
@@ -392,9 +393,9 @@ void G4SteppingVerbose::DPSLAlongStep()
|
||||
void G4SteppingVerbose::TrackingStarted()
|
||||
////////////////////////////////////////////////
|
||||
{
|
||||
|
||||
CopyState();
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
if( verboseLevel > 0 ){
|
||||
|
||||
#ifdef G4_USE_G4BESTUNIT_FOR_VERBOSE
|
||||
@@ -444,6 +445,7 @@ void G4SteppingVerbose::AlongStepDoItOneByOne()
|
||||
//////////////////////////////////////////////////////
|
||||
{
|
||||
CopyState();
|
||||
|
||||
if(verboseLevel >= 4){
|
||||
G4cout << G4endl;
|
||||
G4cout << " >>AlongStepDoIt (process by process): "
|
||||
@@ -488,6 +490,7 @@ void G4SteppingVerbose::PostStepDoItOneByOne()
|
||||
//////////////////////////////////////////////////////
|
||||
{
|
||||
CopyState();
|
||||
|
||||
if(fStepStatus != fPostStepDoItProc) return;
|
||||
|
||||
if(verboseLevel >= 4){
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TrackingManager.cc,v 1.11 2002/04/25 20:21:14 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// $Id: G4TrackingManager.cc,v 1.13 2002/08/21 22:50:52 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -44,7 +44,7 @@
|
||||
G4TrackingManager::G4TrackingManager()
|
||||
//////////////////////////////////////
|
||||
: fpUserTrackingAction(NULL), fpTrajectory(NULL),
|
||||
StoreTrajectory(false), verboseLevel(0)
|
||||
StoreTrajectory(false), verboseLevel(0), EventIsAborted(false)
|
||||
{
|
||||
fpSteppingManager = new G4SteppingManager();
|
||||
messenger = new G4TrackingMessenger(this);
|
||||
@@ -67,6 +67,7 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
// Receiving a G4Track from the EventManager, this funciton has the
|
||||
// responsibility to trace the track till it stops.
|
||||
fpTrack = apValueG4Track;
|
||||
EventIsAborted = false;
|
||||
|
||||
// Clear 2ndary particle vector
|
||||
// GimmeSecondaries()->clearAndDestroy();
|
||||
@@ -79,7 +80,7 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
GimmeSecondaries()->clear();
|
||||
|
||||
// Pre tracking user intervention process.
|
||||
fpTrajectory = NULL;
|
||||
fpTrajectory = 0;
|
||||
if( fpUserTrackingAction != NULL ) {
|
||||
fpUserTrackingAction->PreUserTrackingAction(fpTrack);
|
||||
}
|
||||
@@ -119,6 +120,9 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
if(StoreTrajectory) fpTrajectory->
|
||||
AppendStep(fpSteppingManager->GetStep());
|
||||
#endif
|
||||
if(EventIsAborted) {
|
||||
fpTrack->SetTrackStatus( fKillTrackAndSecondaries );
|
||||
}
|
||||
}
|
||||
// Inform end of tracking to physics processes
|
||||
fpTrack->GetDefinition()->GetProcessManager()->EndTracking();
|
||||
@@ -134,6 +138,7 @@ void G4TrackingManager::ProcessOneTrack(G4Track* apValueG4Track)
|
||||
#endif
|
||||
if( (!StoreTrajectory)&&fpTrajectory ) {
|
||||
delete fpTrajectory;
|
||||
fpTrajectory = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +155,7 @@ void G4TrackingManager::EventAborted()
|
||||
//////////////////////////////////////
|
||||
{
|
||||
fpTrack->SetTrackStatus( fKillTrackAndSecondaries );
|
||||
EventIsAborted = true;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4TrackingMessenger.cc,v 1.8 2001/07/11 10:08:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Trajectory.cc,v 1.14 2001/11/07 10:45:37 radoone Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// $Id: G4Trajectory.cc,v 1.20 2002/11/08 18:27:40 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
@@ -41,27 +41,21 @@
|
||||
#include "G4Trajectory.hh"
|
||||
#include "G4TrajectoryPoint.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Circle.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "g4std/strstream"
|
||||
|
||||
G4Allocator<G4Trajectory> aTrajectoryAllocator;
|
||||
|
||||
///////////////////////////////////////////
|
||||
G4Trajectory::G4Trajectory()
|
||||
: positionRecord(0), fTrackID(0), fParentID(0),
|
||||
PDGEncoding( 0 ), PDGCharge(0.0), ParticleName("")
|
||||
///////////////////////////////////////////
|
||||
{
|
||||
// Unused: G4ParticleDefinition * fpParticleDefinition = 0;
|
||||
}
|
||||
PDGEncoding( 0 ), PDGCharge(0.0), ParticleName(""),
|
||||
initialMomentum( G4ThreeVector() )
|
||||
{;}
|
||||
|
||||
///////////////////////////////////////////
|
||||
G4Trajectory::G4Trajectory(const G4Track* aTrack)
|
||||
///////////////////////////////////////////
|
||||
{
|
||||
G4ParticleDefinition * fpParticleDefinition = aTrack->GetDefinition();
|
||||
ParticleName = fpParticleDefinition->GetParticleName();
|
||||
@@ -69,22 +63,20 @@ G4Trajectory::G4Trajectory(const G4Track* aTrack)
|
||||
PDGEncoding = fpParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
// positionRecord = new G4RWTPtrOrderedVector<G4VTrajectoryPoint>;
|
||||
initialMomentum = aTrack->GetMomentum();
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
positionRecord->push_back(new G4TrajectoryPoint(aTrack->GetPosition()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////
|
||||
G4Trajectory::G4Trajectory(G4Trajectory & right)
|
||||
//////////////////////////////////////////
|
||||
{
|
||||
ParticleName = right.ParticleName;
|
||||
PDGCharge = right.PDGCharge;
|
||||
PDGEncoding = right.PDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
// positionRecord = new G4RWTPtrOrderedVector<G4VTrajectoryPoint>;
|
||||
// G4std::vector<G4VTrajectoryPoint*> *positionRecord;
|
||||
initialMomentum = right.initialMomentum;
|
||||
positionRecord = new TrajectoryPointContainer();
|
||||
|
||||
for(size_t i=0;i<right.positionRecord->size();i++)
|
||||
@@ -94,10 +86,7 @@ G4Trajectory::G4Trajectory(G4Trajectory & right)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
G4Trajectory::~G4Trajectory()
|
||||
/////////////////////////////
|
||||
{
|
||||
// positionRecord->clearAndDestroy();
|
||||
size_t i;
|
||||
@@ -109,89 +98,101 @@ G4Trajectory::~G4Trajectory()
|
||||
delete positionRecord;
|
||||
}
|
||||
|
||||
///////////////////////////////////
|
||||
void G4Trajectory::ShowTrajectory() const
|
||||
///////////////////////////////////
|
||||
void G4Trajectory::ShowTrajectory(G4std::ostream& os) const
|
||||
{
|
||||
G4cout << G4endl << "TrackID =" << fTrackID
|
||||
<< ":ParentID=" << fParentID << G4endl;
|
||||
G4cout << "Particle name : " << ParticleName
|
||||
<< " Charge : " << PDGCharge << G4endl;
|
||||
G4cout << " Current trajectory has " << positionRecord->size()
|
||||
<< " points." << G4endl;
|
||||
|
||||
for( size_t i=0 ; i < positionRecord->size() ; i++){
|
||||
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*positionRecord)[i]);
|
||||
G4cout << "Point[" << i << "]"
|
||||
<< " Position= " << aTrajectoryPoint->GetPosition() << G4endl;
|
||||
}
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::ShowTrajectory(os);
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////
|
||||
void G4Trajectory::DrawTrajectory(G4int i_mode) const
|
||||
///////////////////////////////////////////////
|
||||
{
|
||||
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
G4ThreeVector pos;
|
||||
|
||||
if(i_mode>=0)
|
||||
{
|
||||
G4Polyline pPolyline;
|
||||
for (size_t i = 0; i < positionRecord->size() ; i++) {
|
||||
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*positionRecord)[i]);
|
||||
pos = aTrajectoryPoint->GetPosition();
|
||||
pPolyline.push_back( pos );
|
||||
}
|
||||
|
||||
G4Colour colour;
|
||||
if(PDGCharge<0.)
|
||||
colour = G4Colour(1.,0.,0.);
|
||||
else if(PDGCharge>0.)
|
||||
colour = G4Colour(0.,0.,1.);
|
||||
else
|
||||
colour = G4Colour(0.,1.,0.);
|
||||
|
||||
G4VisAttributes attribs(colour);
|
||||
pPolyline.SetVisAttributes(attribs);
|
||||
if(pVVisManager) pVVisManager->Draw(pPolyline);
|
||||
}
|
||||
|
||||
if(i_mode!=0)
|
||||
{
|
||||
for(size_t j=0; j<positionRecord->size(); j++) {
|
||||
G4TrajectoryPoint* aTrajectoryPoint = (G4TrajectoryPoint*)((*positionRecord)[j]);
|
||||
pos = aTrajectoryPoint->GetPosition();
|
||||
G4Circle circle( pos );
|
||||
circle.SetScreenSize(0.001*i_mode);
|
||||
circle.SetFillStyle(G4Circle::filled);
|
||||
G4Colour colSpot(0.,0.,0.);
|
||||
G4VisAttributes attSpot(colSpot);
|
||||
circle.SetVisAttributes(attSpot);
|
||||
if(pVVisManager) pVVisManager->Draw(circle);
|
||||
}
|
||||
}
|
||||
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::DrawTrajectory(i_mode);
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
const G4std::map<G4String,G4AttDef>* G4Trajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
G4std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4Trajectory",isNew);
|
||||
if (isNew) {
|
||||
|
||||
G4String ID("ID");
|
||||
(*store)[ID] = G4AttDef(ID,"Track ID","Bookkeeping","","G4int");
|
||||
|
||||
G4String PID("PID");
|
||||
(*store)[PID] = G4AttDef(PID,"Parent ID","Bookkeeping","","G4int");
|
||||
|
||||
G4String PN("PN");
|
||||
(*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
|
||||
|
||||
G4String Ch("Ch");
|
||||
(*store)[Ch] = G4AttDef(Ch,"Charge","Physics","","G4double");
|
||||
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Momentum of track at start of trajectory",
|
||||
"Physics","","G4ThreeVector");
|
||||
|
||||
G4String NTP("NTP");
|
||||
(*store)[NTP] = G4AttDef(NTP,"No. of points","Physics","","G4int");
|
||||
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
G4std::vector<G4AttValue>* G4Trajectory::CreateAttValues() const
|
||||
{
|
||||
char c[100];
|
||||
G4std::ostrstream s(c,100);
|
||||
|
||||
G4std::vector<G4AttValue>* values = new G4std::vector<G4AttValue>;
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << fTrackID << G4std::ends;
|
||||
values->push_back(G4AttValue("ID",c,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << fParentID << G4std::ends;
|
||||
values->push_back(G4AttValue("PID",c,""));
|
||||
|
||||
values->push_back(G4AttValue("PN",ParticleName,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << PDGCharge << G4std::ends;
|
||||
values->push_back(G4AttValue("Ch",c,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << PDGEncoding << G4std::ends;
|
||||
values->push_back(G4AttValue("PDG",c,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << G4BestUnit(initialMomentum,"Energy") << G4std::ends;
|
||||
values->push_back(G4AttValue("IMom",c,""));
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << GetPointEntries() << G4std::ends;
|
||||
values->push_back(G4AttValue("NTP",c,""));
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
void G4Trajectory::AppendStep(const G4Step* aStep)
|
||||
////////////////////////////////////////////
|
||||
{
|
||||
positionRecord->push_back( new G4TrajectoryPoint(aStep->GetPostStepPoint()->
|
||||
GetPosition() ));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
G4ParticleDefinition* G4Trajectory::GetParticleDefinition()
|
||||
/////////////////////////////////////////////
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(ParticleName));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
void G4Trajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
/////////////////////////////////////////////
|
||||
{
|
||||
if(!secondTrajectory) return;
|
||||
|
||||
|
||||
@@ -21,50 +21,67 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TrajectoryPoint.cc,v 1.6 2001/07/11 10:08:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// $Id: G4TrajectoryPoint.cc,v 1.10 2002/11/08 18:28:29 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4TrajectoryPoint.cc
|
||||
//
|
||||
// Contact:
|
||||
// Questions and comments to this code should be sent to
|
||||
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
|
||||
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#include "G4TrajectoryPoint.hh"
|
||||
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "g4std/strstream"
|
||||
|
||||
G4Allocator<G4TrajectoryPoint> aTrajectoryPointAllocator;
|
||||
|
||||
//////////////////////////////////////
|
||||
G4TrajectoryPoint::G4TrajectoryPoint()
|
||||
//////////////////////////////////////
|
||||
{
|
||||
fPosition = G4ThreeVector(0.,0.,0.);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
G4TrajectoryPoint::G4TrajectoryPoint(G4ThreeVector pos)
|
||||
///////////////////////////////////////////////////////
|
||||
{
|
||||
fPosition = pos;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
G4TrajectoryPoint::G4TrajectoryPoint(const G4TrajectoryPoint &right)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
: fPosition(right.fPosition)
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
G4TrajectoryPoint::~G4TrajectoryPoint()
|
||||
///////////////////////////////////////
|
||||
{
|
||||
}
|
||||
|
||||
const G4std::map<G4String,G4AttDef>* G4TrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
G4std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("G4TrajectoryPoint",isNew);
|
||||
if (isNew) {
|
||||
G4String Pos("Pos");
|
||||
(*store)[Pos] = G4AttDef(Pos, "Position", "Physics","","G4ThreeVector");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
G4std::vector<G4AttValue>* G4TrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
char c[100];
|
||||
G4std::ostrstream s(c,100);
|
||||
|
||||
G4std::vector<G4AttValue>* values = new G4std::vector<G4AttValue>;
|
||||
|
||||
s.seekp(G4std::ios::beg);
|
||||
s << G4BestUnit(fPosition,"Length") << G4std::ends;
|
||||
values->push_back(G4AttValue("Pos",c,""));
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UserSteppingAction.cc,v 1.6 2001/07/11 10:08:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4UserTrackingAction.cc,v 1.6 2001/07/11 10:08:43 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSteppingVerbose.cc,v 1.7 2001/11/07 13:15:18 radoone Exp $
|
||||
// GEANT4 tag $Name: geant4-04-01 $
|
||||
// $Id: G4VSteppingVerbose.cc,v 1.9 2002/12/04 23:00:51 tsasaki Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -44,8 +44,17 @@
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
G4VSteppingVerbose* G4VSteppingVerbose::fInstance = 0;
|
||||
G4VSteppingVerbose::G4VSteppingVerbose(){;}
|
||||
G4VSteppingVerbose::G4VSteppingVerbose() :verboseLevel(0){;}
|
||||
G4VSteppingVerbose::~G4VSteppingVerbose(){;}
|
||||
void G4VSteppingVerbose::SetInstance(G4VSteppingVerbose* Instance)
|
||||
{
|
||||
fInstance = Instance;
|
||||
}
|
||||
G4VSteppingVerbose* G4VSteppingVerbose::GetInstance()
|
||||
{
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
void G4VSteppingVerbose::SetManager(G4SteppingManager* const fMan)
|
||||
//////////////////////////////////////////////////////////////////
|
||||
@@ -99,9 +108,6 @@ void G4VSteppingVerbose::CopyState()
|
||||
MAXofAlongStepLoops = fManager->GetMAXofAlongStepLoops();
|
||||
MAXofPostStepLoops = fManager->GetMAXofPostStepLoops();
|
||||
|
||||
currentMinimumStep = fManager->GetcurrentMinimumStep();
|
||||
numberOfInteractionLengthLeft = fManager->GetnumberOfInteractionLengthLeft();
|
||||
|
||||
fAtRestDoItProcTriggered = fManager->GetfAtRestDoItProcTriggered();
|
||||
fAlongStepDoItProcTriggered = fManager->GetfAlongStepDoItProcTriggered();
|
||||
fPostStepDoItProcTriggered = fManager->GetfPostStepDoItProcTriggered();
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * 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. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VTrajectory.cc,v 1.3 2002/12/12 13:13:27 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-05-00 $
|
||||
//
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
//
|
||||
// G4VTrajectory.cc
|
||||
//
|
||||
// Contact:
|
||||
// Questions and comments to this code should be sent to
|
||||
// Katsuya Amako (e-mail: Katsuya.Amako@kek.jp)
|
||||
// Makoto Asai (e-mail: asai@kekvax.kek.jp)
|
||||
// Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
|
||||
//
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#include "G4VTrajectory.hh"
|
||||
#include "G4VTrajectoryPoint.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Polymarker.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
void G4VTrajectory::ShowTrajectory(G4std::ostream& os) const
|
||||
{
|
||||
// Makes use of attribute values implemented in the concrete class.
|
||||
// Note: the user needs to follow with new-line or end-of-string,
|
||||
// depending on the nature of os.
|
||||
|
||||
G4std::vector<G4AttValue>* attValues = CreateAttValues();
|
||||
|
||||
if (!attValues) {
|
||||
os << "G4VTrajectory::ShowTrajectory: no attribute values defined.";
|
||||
return;
|
||||
}
|
||||
|
||||
const G4std::map<G4String,G4AttDef>* attDefs = GetAttDefs();
|
||||
if (!attDefs) {
|
||||
os << "G4VTrajectory::ShowTrajectory:"
|
||||
"\n ERROR: no attribute definitions for attribute values.";
|
||||
return;
|
||||
}
|
||||
|
||||
os << "Trajectory:";
|
||||
|
||||
G4std::vector<G4AttValue>::iterator iAttVal;
|
||||
for (iAttVal = attValues->begin();
|
||||
iAttVal != attValues->end(); ++iAttVal) {
|
||||
G4std::map<G4String,G4AttDef>::const_iterator iAttDef =
|
||||
attDefs->find(iAttVal->GetName());
|
||||
if (iAttDef == attDefs->end()) {
|
||||
os << "G4VTrajectory::ShowTrajectory:"
|
||||
"\n WARNING: no matching definition for attribute \""
|
||||
<< iAttVal->GetName() << "\", value: "
|
||||
<< iAttVal->GetValue();
|
||||
}
|
||||
else {
|
||||
os << "\n " << iAttDef->second.GetDesc() << ": "
|
||||
<< iAttVal->GetValue();
|
||||
}
|
||||
}
|
||||
|
||||
delete attValues; // AttValues must be deleted after use.
|
||||
|
||||
//Now do trajectory points...
|
||||
for (G4int i = 0; i < GetPointEntries(); i++) {
|
||||
G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
|
||||
G4std::vector<G4AttValue>* attValues
|
||||
= aTrajectoryPoint->CreateAttValues();
|
||||
if (!attValues) {
|
||||
os <<
|
||||
"\nG4VTrajectory::ShowTrajectory: no attribute values"
|
||||
" for trajectory point defined.";
|
||||
}
|
||||
else {
|
||||
const G4std::map<G4String,G4AttDef>* attDefs
|
||||
= aTrajectoryPoint->GetAttDefs();
|
||||
if (!attDefs) {
|
||||
os << "\nG4VTrajectory::ShowTrajectory:"
|
||||
"\n ERROR: no attribute definitions for attribute values"
|
||||
" for trajectory point defined.";
|
||||
}
|
||||
else {
|
||||
G4std::vector<G4AttValue>::iterator iAttVal;
|
||||
for (iAttVal = attValues->begin();
|
||||
iAttVal != attValues->end(); ++iAttVal) {
|
||||
G4std::map<G4String,G4AttDef>::const_iterator iAttDef =
|
||||
attDefs->find(iAttVal->GetName());
|
||||
if (iAttDef == attDefs->end()) {
|
||||
os << "\nG4VTrajectory::ShowTrajectory:"
|
||||
"\n WARNING: no matching definition for trajectory"
|
||||
" point attribute \""
|
||||
<< iAttVal->GetName() << "\", value: "
|
||||
<< iAttVal->GetValue();
|
||||
}
|
||||
else {
|
||||
os << "\n " << iAttDef->second.GetDesc() << ": "
|
||||
<< iAttVal->GetValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
delete attValues; // AttValues must be deleted after use.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4VTrajectory::DrawTrajectory(G4int i_mode) const
|
||||
{
|
||||
// If i_mode>=0, draws a trajectory as a polyline (blue for
|
||||
// positive, red for negative, green for neutral) and, if i_mode!=0,
|
||||
// adds markers - yellow circles for step points and magenta squares
|
||||
// for auxiliary points, if any - whose screen size in pixels is
|
||||
// given by abs(i_mode)/1000. E.g: i_mode = 5000 gives easily
|
||||
// visible markers.
|
||||
|
||||
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
|
||||
if (!pVVisManager) return;
|
||||
|
||||
const G4double markerSize = abs(i_mode)/1000;
|
||||
G4bool lineRequired (i_mode >= 0);
|
||||
G4bool markersRequired (markerSize > 0.);
|
||||
|
||||
G4Polyline trajectoryLine;
|
||||
G4Polymarker stepPoints;
|
||||
G4Polymarker auxiliaryPoints;
|
||||
|
||||
for (G4int i = 0; i < GetPointEntries() ; i++) {
|
||||
G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
|
||||
const G4std::vector<G4ThreeVector>* auxiliaries
|
||||
= aTrajectoryPoint->GetAuxiliaryPoints();
|
||||
if (auxiliaries) {
|
||||
for (size_t iAux = 0; iAux < auxiliaries->size(); ++iAux) {
|
||||
const G4ThreeVector pos((*auxiliaries)[iAux]);
|
||||
if (lineRequired) {
|
||||
trajectoryLine.push_back(pos);
|
||||
}
|
||||
if (markersRequired) {
|
||||
auxiliaryPoints.push_back(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
const G4ThreeVector pos(aTrajectoryPoint->GetPosition());
|
||||
if (lineRequired) {
|
||||
trajectoryLine.push_back(pos);
|
||||
}
|
||||
if (markersRequired) {
|
||||
stepPoints.push_back(pos);
|
||||
}
|
||||
}
|
||||
|
||||
if (lineRequired) {
|
||||
G4Colour colour;
|
||||
const G4double charge = GetCharge();
|
||||
if(charge>0.) colour = G4Colour(0.,0.,1.); // Blue = positive.
|
||||
else if(charge<0.) colour = G4Colour(1.,0.,0.); // Red = negative.
|
||||
else colour = G4Colour(0.,1.,0.); // Green = neutral.
|
||||
G4VisAttributes trajectoryLineAttribs(colour);
|
||||
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
|
||||
pVVisManager->Draw(trajectoryLine);
|
||||
}
|
||||
if (markersRequired) {
|
||||
auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
|
||||
auxiliaryPoints.SetScreenSize(markerSize);
|
||||
auxiliaryPoints.SetFillStyle(G4VMarker::filled);
|
||||
G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta
|
||||
auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
|
||||
pVVisManager->Draw(auxiliaryPoints);
|
||||
|
||||
stepPoints.SetMarkerType(G4Polymarker::circles);
|
||||
stepPoints.SetScreenSize(markerSize);
|
||||
stepPoints.SetFillStyle(G4VMarker::filled);
|
||||
G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow.
|
||||
stepPoints.SetVisAttributes(&stepPointsAttribs);
|
||||
pVVisManager->Draw(stepPoints);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user