Import Geant4 11.3.0.beta source tree
This commit is contained in:
@@ -29,18 +29,23 @@
|
||||
//
|
||||
|
||||
#include "RE04ActionInitialization.hh"
|
||||
#include "RE04PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "RE04EventAction.hh"
|
||||
//#include "RE04TrackingAction.hh"
|
||||
//#include "RE04SteppingAction.hh"
|
||||
#include "RE04PrimaryGeneratorAction.hh"
|
||||
// #include "RE04TrackingAction.hh"
|
||||
// #include "RE04SteppingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04ActionInitialization::RE04ActionInitialization()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04ActionInitialization::~RE04ActionInitialization()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04ActionInitialization::Build() const
|
||||
@@ -50,16 +55,14 @@ void RE04ActionInitialization::Build() const
|
||||
//
|
||||
SetUserAction(new RE04EventAction);
|
||||
//
|
||||
//SetUserAction(new RE04TrackingAction);
|
||||
//SetUserAction(new RE04SteppingAction);
|
||||
|
||||
// SetUserAction(new RE04TrackingAction);
|
||||
// SetUserAction(new RE04SteppingAction);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04ActionInitialization::BuildForMaster() const
|
||||
{
|
||||
//
|
||||
//G4UserRunAction* run_action = new RE04RunAction;
|
||||
//SetUserAction(run_action);
|
||||
// G4UserRunAction* run_action = new RE04RunAction;
|
||||
// SetUserAction(run_action);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,35 +29,36 @@
|
||||
//
|
||||
#include "RE04DetectorConstruction.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4UniformMagField.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4Colour.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4UniformMagField.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04DetectorConstruction::RE04DetectorConstruction()
|
||||
: G4VUserDetectorConstruction(),
|
||||
fAir(0), fWater(0), fPb(0), fWorldPhys(0), fConstructed(false)
|
||||
{;}
|
||||
: G4VUserDetectorConstruction(), fAir(0), fWater(0), fPb(0), fWorldPhys(0), fConstructed(false)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04DetectorConstruction::~RE04DetectorConstruction()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4VPhysicalVolume* RE04DetectorConstruction::Construct()
|
||||
{
|
||||
if(!fConstructed)
|
||||
{
|
||||
if (!fConstructed) {
|
||||
fConstructed = true;
|
||||
DefineMaterials();
|
||||
SetupGeometry();
|
||||
@@ -67,17 +68,17 @@ G4VPhysicalVolume* RE04DetectorConstruction::Construct()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
{
|
||||
//=====================
|
||||
// Material Definitions
|
||||
//=====================
|
||||
//
|
||||
//
|
||||
//-------- NIST Materials ----------------------------------------------------
|
||||
// Material Information imported from NIST database.
|
||||
//
|
||||
G4NistManager* pNISTman = G4NistManager::Instance();
|
||||
fAir = pNISTman->FindOrBuildMaterial("G4_AIR");
|
||||
fWater = pNISTman->FindOrBuildMaterial("G4_WATER");
|
||||
fAir = pNISTman->FindOrBuildMaterial("G4_AIR");
|
||||
fWater = pNISTman->FindOrBuildMaterial("G4_WATER");
|
||||
fPb = pNISTman->FindOrBuildMaterial("G4_Pb");
|
||||
|
||||
//
|
||||
@@ -89,30 +90,25 @@ void RE04DetectorConstruction::DefineMaterials()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04DetectorConstruction::SetupGeometry()
|
||||
{
|
||||
//
|
||||
//
|
||||
// World
|
||||
//
|
||||
G4VSolid* worldSolid = new G4Box("World",1.*m,1.*m,1.*m);
|
||||
G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid,fAir,"World");
|
||||
fWorldPhys = new G4PVPlacement(0,G4ThreeVector(),worldLogical,"World",
|
||||
0,false,0);
|
||||
|
||||
//
|
||||
// Phantom
|
||||
//
|
||||
G4VSolid* phantomSolid = new G4Box("Phantom",50.*cm,50.*cm,50.*cm);
|
||||
G4LogicalVolume* phantomLogical = new G4LogicalVolume(phantomSolid,fAir,
|
||||
"Phantom");
|
||||
new G4PVPlacement(0,G4ThreeVector(),phantomLogical,"Phantom",
|
||||
worldLogical,false,0);
|
||||
G4VSolid* worldSolid = new G4Box("World", 1. * m, 1. * m, 1. * m);
|
||||
G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid, fAir, "World");
|
||||
fWorldPhys = new G4PVPlacement(0, G4ThreeVector(), worldLogical, "World", 0, false, 0);
|
||||
|
||||
//
|
||||
//
|
||||
// Phantom
|
||||
//
|
||||
G4VSolid* phantomSolid = new G4Box("Phantom", 50. * cm, 50. * cm, 50. * cm);
|
||||
G4LogicalVolume* phantomLogical = new G4LogicalVolume(phantomSolid, fAir, "Phantom");
|
||||
new G4PVPlacement(0, G4ThreeVector(), phantomLogical, "Phantom", worldLogical, false, 0);
|
||||
|
||||
//
|
||||
// Visualization attributes
|
||||
//
|
||||
worldLogical->SetVisAttributes(G4VisAttributes::GetInvisible());
|
||||
G4VisAttributes* simpleBoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));
|
||||
G4VisAttributes* simpleBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
|
||||
simpleBoxVisAtt->SetVisibility(true);
|
||||
phantomLogical->SetVisAttributes(simpleBoxVisAtt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,45 +29,47 @@
|
||||
//
|
||||
#include "RE04EventAction.hh"
|
||||
|
||||
#include "RE04Trajectory.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4HCofThisEvent.hh"
|
||||
#include "G4VHitsCollection.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4VHitsCollection.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "RE04Trajectory.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04EventAction::RE04EventAction()
|
||||
: G4UserEventAction()
|
||||
{;}
|
||||
RE04EventAction::RE04EventAction() : G4UserEventAction()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04EventAction::~RE04EventAction()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04EventAction::BeginOfEventAction(const G4Event*)
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04EventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
G4cout << ">>> Summary of Event " << evt->GetEventID() << G4endl;
|
||||
|
||||
|
||||
// get number of stored trajectories
|
||||
G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
|
||||
G4int n_trajectories = 0;
|
||||
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
|
||||
// extract the trajectories and print them out
|
||||
G4cout << G4endl;
|
||||
for(G4int i=0; i<n_trajectories; i++)
|
||||
{
|
||||
RE04Trajectory* trj
|
||||
= (RE04Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
|
||||
for (G4int i = 0; i < n_trajectories; i++) {
|
||||
RE04Trajectory* trj = (RE04Trajectory*)((*(evt->GetTrajectoryContainer()))[i]);
|
||||
trj->ShowTrajectory();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,29 +28,33 @@
|
||||
//
|
||||
//
|
||||
#include "RE04ParallelWorldConstruction.hh"
|
||||
|
||||
#include "RE04ParallelWorldParam.hh"
|
||||
|
||||
#include "G4Box.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4PVParameterised.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04ParallelWorldConstruction
|
||||
::RE04ParallelWorldConstruction(G4String& parallelWorldName)
|
||||
:G4VUserParallelWorld(parallelWorldName),fConstructed(false)
|
||||
{;}
|
||||
RE04ParallelWorldConstruction ::RE04ParallelWorldConstruction(G4String& parallelWorldName)
|
||||
: G4VUserParallelWorld(parallelWorldName), fConstructed(false)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04ParallelWorldConstruction::~RE04ParallelWorldConstruction()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04ParallelWorldConstruction::Construct()
|
||||
{
|
||||
if(fConstructed) return;
|
||||
if (fConstructed) return;
|
||||
fConstructed = true;
|
||||
|
||||
//
|
||||
@@ -67,28 +71,24 @@ void RE04ParallelWorldConstruction::Construct()
|
||||
//
|
||||
// parallel world placement box
|
||||
//
|
||||
G4VSolid* paraBox = new G4Box("paraBox",5.0*cm,30.0*cm,5.0*cm);
|
||||
G4LogicalVolume* paraBoxLogical = new G4LogicalVolume(paraBox,water,
|
||||
"paraBox");
|
||||
new G4PVPlacement(0,G4ThreeVector(-25.0*cm,0.,0.),paraBoxLogical,
|
||||
"paraBox",worldLogical,false,0);
|
||||
G4VSolid* paraBox = new G4Box("paraBox", 5.0 * cm, 30.0 * cm, 5.0 * cm);
|
||||
G4LogicalVolume* paraBoxLogical = new G4LogicalVolume(paraBox, water, "paraBox");
|
||||
new G4PVPlacement(0, G4ThreeVector(-25.0 * cm, 0., 0.), paraBoxLogical, "paraBox", worldLogical,
|
||||
false, 0);
|
||||
|
||||
//
|
||||
// mother of parallel world parameterized volumes
|
||||
//
|
||||
G4VSolid* paraMom = new G4Box("paraMom",20.0*cm,40.0*cm,20.0*cm);
|
||||
G4LogicalVolume* paraMomLogical = new G4LogicalVolume(paraMom,0,"paraMom");
|
||||
new G4PVPlacement(0,G4ThreeVector(10.0*cm,0.,0.),paraMomLogical,"paraMom",
|
||||
worldLogical,false,0);
|
||||
G4VSolid* paraMom = new G4Box("paraMom", 20.0 * cm, 40.0 * cm, 20.0 * cm);
|
||||
G4LogicalVolume* paraMomLogical = new G4LogicalVolume(paraMom, 0, "paraMom");
|
||||
new G4PVPlacement(0, G4ThreeVector(10.0 * cm, 0., 0.), paraMomLogical, "paraMom", worldLogical,
|
||||
false, 0);
|
||||
|
||||
//
|
||||
// parallel world parameterized volumes
|
||||
//
|
||||
G4VSolid* paraPara = new G4Box("paraPara",5.0*cm,15.0*cm,10.0*cm);
|
||||
G4LogicalVolume* paraParaLogical = new G4LogicalVolume(paraPara,water,
|
||||
"paraPara");
|
||||
G4VSolid* paraPara = new G4Box("paraPara", 5.0 * cm, 15.0 * cm, 10.0 * cm);
|
||||
G4LogicalVolume* paraParaLogical = new G4LogicalVolume(paraPara, water, "paraPara");
|
||||
RE04ParallelWorldParam* param = new RE04ParallelWorldParam();
|
||||
new G4PVParameterised("paraPara",paraParaLogical,paraMomLogical,
|
||||
kXAxis, 2, param);
|
||||
|
||||
new G4PVParameterised("paraPara", paraParaLogical, paraMomLogical, kXAxis, 2, param);
|
||||
}
|
||||
|
||||
@@ -29,15 +29,13 @@
|
||||
//
|
||||
#include "RE04ParallelWorldParam.hh"
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04ParallelWorldParam::RE04ParallelWorldParam()
|
||||
: G4VPVParameterisation(),
|
||||
fWater(0), fPb(0)
|
||||
RE04ParallelWorldParam::RE04ParallelWorldParam() : G4VPVParameterisation(), fWater(0), fPb(0)
|
||||
{
|
||||
fWater = G4Material::GetMaterial("G4_WATER");
|
||||
fPb = G4Material::GetMaterial("G4_Pb");
|
||||
@@ -45,18 +43,22 @@ RE04ParallelWorldParam::RE04ParallelWorldParam()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04ParallelWorldParam::~RE04ParallelWorldParam()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04ParallelWorldParam::ComputeTransformation(const G4int copyNo,
|
||||
G4VPhysicalVolume* physVol) const
|
||||
G4VPhysicalVolume* physVol) const
|
||||
{
|
||||
G4double x = copyNo ? -10.0*cm : 10.0*cm;
|
||||
physVol->SetTranslation(G4ThreeVector(x,x,0.));
|
||||
G4double x = copyNo ? -10.0 * cm : 10.0 * cm;
|
||||
physVol->SetTranslation(G4ThreeVector(x, x, 0.));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4Material* RE04ParallelWorldParam::ComputeMaterial(const G4int copyNo,
|
||||
G4VPhysicalVolume* /*currentVol*/,const G4VTouchable* /*parentTouch*/)
|
||||
{ return copyNo ? fWater: fPb; }
|
||||
|
||||
G4VPhysicalVolume* /*currentVol*/,
|
||||
const G4VTouchable* /*parentTouch*/)
|
||||
{
|
||||
return copyNo ? fWater : fPb;
|
||||
}
|
||||
|
||||
@@ -29,30 +29,28 @@
|
||||
//
|
||||
#include "RE04PrimaryGeneratorAction.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04PrimaryGeneratorAction::RE04PrimaryGeneratorAction()
|
||||
: G4VUserPrimaryGeneratorAction(),
|
||||
fParticleGun(0)
|
||||
: G4VUserPrimaryGeneratorAction(), fParticleGun(0)
|
||||
{
|
||||
G4int n_particle = 1;
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
fParticleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
// default particle kinematic
|
||||
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4String particleName;
|
||||
G4ParticleDefinition* particle
|
||||
= particleTable->FindParticle(particleName="mu-");
|
||||
G4ParticleDefinition* particle = particleTable->FindParticle(particleName = "mu-");
|
||||
fParticleGun->SetParticleDefinition(particle);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(-75.*cm,0.,0.));
|
||||
fParticleGun->SetParticleEnergy(10.*GeV);
|
||||
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1., 0., 0.));
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(-75. * cm, 0., 0.));
|
||||
fParticleGun->SetParticleEnergy(10. * GeV);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -64,8 +62,7 @@ RE04PrimaryGeneratorAction::~RE04PrimaryGeneratorAction()
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4double y = 96.0*cm*(G4UniformRand()-0.5);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(-75.*cm,y,0.));
|
||||
G4double y = 96.0 * cm * (G4UniformRand() - 0.5);
|
||||
fParticleGun->SetParticlePosition(G4ThreeVector(-75. * cm, y, 0.));
|
||||
fParticleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,26 +29,28 @@
|
||||
//
|
||||
#include "RE04SteppingAction.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04SteppingAction::RE04SteppingAction()
|
||||
: G4UserSteppingAction()
|
||||
{;}
|
||||
RE04SteppingAction::RE04SteppingAction() : G4UserSteppingAction()
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04SteppingAction::~RE04SteppingAction()
|
||||
{;}
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04SteppingAction::UserSteppingAction(const G4Step* aStep)
|
||||
{
|
||||
const G4Track* trk = aStep->GetTrack();
|
||||
G4cout << "PreStep " << aStep->GetPreStepPoint()->GetPosition()
|
||||
<< " -- PostStep " << aStep->GetPostStepPoint()->GetPosition()
|
||||
<< " >>> Material " << trk->GetMaterial()->GetName() << G4endl;
|
||||
G4cout << "PreStep " << aStep->GetPreStepPoint()->GetPosition() << " -- PostStep "
|
||||
<< aStep->GetPostStepPoint()->GetPosition() << " >>> Material "
|
||||
<< trk->GetMaterial()->GetName() << G4endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,12 +28,14 @@
|
||||
//
|
||||
//
|
||||
#include "RE04TrackingAction.hh"
|
||||
#include "G4TrackingManager.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
#include "RE04Trajectory.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4TrackingManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
void RE04TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
{
|
||||
fpTrackingManager->SetStoreTrajectory(true);
|
||||
fpTrackingManager->SetTrajectory(new RE04Trajectory(aTrack));
|
||||
@@ -41,6 +43,6 @@ void RE04TrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04TrackingAction::PostUserTrackingAction(const G4Track* /*aTrack*/)
|
||||
{;}
|
||||
|
||||
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
@@ -28,48 +28,56 @@
|
||||
//
|
||||
//
|
||||
#include "RE04Trajectory.hh"
|
||||
|
||||
#include "RE04TrajectoryPoint.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4ThreadLocal G4Allocator<RE04Trajectory> * faTrajAllocator = 0;
|
||||
G4ThreadLocal G4Allocator<RE04Trajectory>* faTrajAllocator = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04Trajectory::RE04Trajectory()
|
||||
: G4VTrajectory(),
|
||||
fPositionRecord(0), fTrackID(0), fParentID(0),
|
||||
fPDGEncoding( 0 ), fPDGCharge(0.0), fParticleName(""),
|
||||
fInitialKineticEnergy( 0. ), fInitialMomentum( G4ThreeVector() )
|
||||
{;}
|
||||
: G4VTrajectory(),
|
||||
fPositionRecord(0),
|
||||
fTrackID(0),
|
||||
fParentID(0),
|
||||
fPDGEncoding(0),
|
||||
fPDGCharge(0.0),
|
||||
fParticleName(""),
|
||||
fInitialKineticEnergy(0.),
|
||||
fInitialMomentum(G4ThreeVector())
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04Trajectory::RE04Trajectory(const G4Track* aTrack)
|
||||
{
|
||||
G4ParticleDefinition * fpParticleDefinition = aTrack->GetDefinition();
|
||||
fParticleName = fpParticleDefinition->GetParticleName();
|
||||
fPDGCharge = fpParticleDefinition->GetPDGCharge();
|
||||
fPDGEncoding = fpParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
fInitialKineticEnergy = aTrack->GetKineticEnergy();
|
||||
fInitialMomentum = aTrack->GetMomentum();
|
||||
fPositionRecord = new TrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
fPositionRecord->push_back(new RE04TrajectoryPoint(
|
||||
aTrack->GetPosition(),aTrack->GetMaterial()));
|
||||
G4ParticleDefinition* fpParticleDefinition = aTrack->GetDefinition();
|
||||
fParticleName = fpParticleDefinition->GetParticleName();
|
||||
fPDGCharge = fpParticleDefinition->GetPDGCharge();
|
||||
fPDGEncoding = fpParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
fInitialKineticEnergy = aTrack->GetKineticEnergy();
|
||||
fInitialMomentum = aTrack->GetMomentum();
|
||||
fPositionRecord = new TrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
fPositionRecord->push_back(new RE04TrajectoryPoint(aTrack->GetPosition(), aTrack->GetMaterial()));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04Trajectory::RE04Trajectory(RE04Trajectory & right):G4VTrajectory()
|
||||
RE04Trajectory::RE04Trajectory(RE04Trajectory& right) : G4VTrajectory()
|
||||
{
|
||||
fParticleName = right.fParticleName;
|
||||
fPDGCharge = right.fPDGCharge;
|
||||
@@ -80,10 +88,8 @@ RE04Trajectory::RE04Trajectory(RE04Trajectory & right):G4VTrajectory()
|
||||
fInitialMomentum = right.fInitialMomentum;
|
||||
fPositionRecord = new TrajectoryPointContainer();
|
||||
|
||||
for(size_t i=0;i<right.fPositionRecord->size();i++)
|
||||
{
|
||||
RE04TrajectoryPoint* rightPoint
|
||||
= (RE04TrajectoryPoint*)((*(right.fPositionRecord))[i]);
|
||||
for (size_t i = 0; i < right.fPositionRecord->size(); i++) {
|
||||
RE04TrajectoryPoint* rightPoint = (RE04TrajectoryPoint*)((*(right.fPositionRecord))[i]);
|
||||
fPositionRecord->push_back(new RE04TrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
@@ -94,8 +100,8 @@ RE04Trajectory::~RE04Trajectory()
|
||||
if (fPositionRecord) {
|
||||
// fPositionRecord->clearAndDestroy();
|
||||
size_t i;
|
||||
for(i=0;i<fPositionRecord->size();i++){
|
||||
delete (*fPositionRecord)[i];
|
||||
for (i = 0; i < fPositionRecord->size(); i++) {
|
||||
delete (*fPositionRecord)[i];
|
||||
}
|
||||
fPositionRecord->clear();
|
||||
delete fPositionRecord;
|
||||
@@ -119,45 +125,38 @@ void RE04Trajectory::DrawTrajectory() const
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
const std::map<G4String,G4AttDef>* RE04Trajectory::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* RE04Trajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("RE04Trajectory",isNew);
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE04Trajectory", isNew);
|
||||
if (isNew) {
|
||||
|
||||
G4String id("ID");
|
||||
(*store)[id] = G4AttDef(id,"Track ID","Physics","","G4int");
|
||||
(*store)[id] = G4AttDef(id, "Track ID", "Physics", "", "G4int");
|
||||
|
||||
G4String pid("PID");
|
||||
(*store)[pid] = G4AttDef(pid,"Parent ID","Physics","","G4int");
|
||||
(*store)[pid] = G4AttDef(pid, "Parent ID", "Physics", "", "G4int");
|
||||
|
||||
G4String pn("PN");
|
||||
(*store)[pn] = G4AttDef(pn,"Particle Name","Physics","","G4String");
|
||||
(*store)[pn] = G4AttDef(pn, "Particle Name", "Physics", "", "G4String");
|
||||
|
||||
G4String ch("Ch");
|
||||
(*store)[ch] = G4AttDef(ch,"Charge","Physics","e+","G4double");
|
||||
(*store)[ch] = G4AttDef(ch, "Charge", "Physics", "e+", "G4double");
|
||||
|
||||
G4String pdg("PDG");
|
||||
(*store)[pdg] = G4AttDef(pdg,"PDG Encoding","Physics","","G4int");
|
||||
(*store)[pdg] = G4AttDef(pdg, "PDG Encoding", "Physics", "", "G4int");
|
||||
|
||||
G4String ike("IKE");
|
||||
(*store)[ike] =
|
||||
G4AttDef(ike, "Initial kinetic energy",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[ike] = G4AttDef(ike, "Initial kinetic energy", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String iMom("IMom");
|
||||
(*store)[iMom] = G4AttDef(iMom, "Initial momentum",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
(*store)[iMom] = G4AttDef(iMom, "Initial momentum", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
|
||||
G4String iMag("IMag");
|
||||
(*store)[iMag] =
|
||||
G4AttDef(iMag, "Initial momentum magnitude",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
(*store)[iMag] =
|
||||
G4AttDef(iMag, "Initial momentum magnitude", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String ntp("NTP");
|
||||
(*store)[ntp] = G4AttDef(ntp,"No. of points","Physics","","G4int");
|
||||
|
||||
(*store)[ntp] = G4AttDef(ntp, "No. of points", "Physics", "", "G4int");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
@@ -167,34 +166,26 @@ std::vector<G4AttValue>* RE04Trajectory::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
|
||||
values->push_back(G4AttValue("ID", G4UIcommand::ConvertToString(fTrackID), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PID",G4UIcommand::ConvertToString(fParentID),""));
|
||||
values->push_back(G4AttValue("PID", G4UIcommand::ConvertToString(fParentID), ""));
|
||||
|
||||
values->push_back(G4AttValue("PN",fParticleName,""));
|
||||
values->push_back(G4AttValue("PN", fParticleName, ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("Ch",G4UIcommand::ConvertToString(fPDGCharge),""));
|
||||
values->push_back(G4AttValue("Ch", G4UIcommand::ConvertToString(fPDGCharge), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PDG",G4UIcommand::ConvertToString(fPDGEncoding),""));
|
||||
values->push_back(G4AttValue("PDG", G4UIcommand::ConvertToString(fPDGEncoding), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IKE",G4BestUnit(fInitialKineticEnergy,"Energy"),""));
|
||||
values->push_back(G4AttValue("IKE", G4BestUnit(fInitialKineticEnergy, "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMom",G4BestUnit(fInitialMomentum,"Energy"),""));
|
||||
values->push_back(G4AttValue("IMom", G4BestUnit(fInitialMomentum, "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMag",G4BestUnit(fInitialMomentum.mag(),"Energy"),""));
|
||||
values->push_back(G4AttValue("IMag", G4BestUnit(fInitialMomentum.mag(), "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("NTP",G4UIcommand::ConvertToString(GetPointEntries()),""));
|
||||
values->push_back(G4AttValue("NTP", G4UIcommand::ConvertToString(GetPointEntries()), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
@@ -203,32 +194,29 @@ std::vector<G4AttValue>* RE04Trajectory::CreateAttValues() const
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04Trajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
fPositionRecord->push_back( new RE04TrajectoryPoint(
|
||||
aStep->GetPostStepPoint()->GetPosition(),
|
||||
aStep->GetPreStepPoint()->GetMaterial() ));
|
||||
fPositionRecord->push_back(new RE04TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition(),
|
||||
aStep->GetPreStepPoint()->GetMaterial()));
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
G4ParticleDefinition* RE04Trajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(fParticleName));
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(fParticleName));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
void RE04Trajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if(!secondTrajectory) return;
|
||||
if (!secondTrajectory) return;
|
||||
|
||||
RE04Trajectory* seco = (RE04Trajectory*)secondTrajectory;
|
||||
G4int ent = seco->GetPointEntries();
|
||||
for(G4int i=1;i<ent;i++) // initial point of the second trajectory
|
||||
// should not be merged
|
||||
{
|
||||
for (G4int i = 1; i < ent; i++) // initial point of the second trajectory
|
||||
// should not be merged
|
||||
{
|
||||
fPositionRecord->push_back((*(seco->fPositionRecord))[i]);
|
||||
// fPositionRecord->push_back(seco->fPositionRecord->removeAt(1));
|
||||
}
|
||||
delete (*seco->fPositionRecord)[0];
|
||||
seco->fPositionRecord->clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -29,63 +29,47 @@
|
||||
//
|
||||
#include "RE04TrajectoryPoint.hh"
|
||||
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
// #define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
# include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4ThreadLocal G4Allocator<RE04TrajectoryPoint> * faTrajPointAllocator = 0;
|
||||
G4ThreadLocal G4Allocator<RE04TrajectoryPoint>* faTrajPointAllocator = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04TrajectoryPoint::RE04TrajectoryPoint()
|
||||
: G4VTrajectoryPoint(),
|
||||
fPosition(G4ThreeVector(0.,0.,0.)),
|
||||
fpMaterial(0)
|
||||
{
|
||||
}
|
||||
: G4VTrajectoryPoint(), fPosition(G4ThreeVector(0., 0., 0.)), fpMaterial(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04TrajectoryPoint::RE04TrajectoryPoint(G4ThreeVector pos,
|
||||
const G4Material* mat)
|
||||
: G4VTrajectoryPoint(),
|
||||
fPosition(pos),
|
||||
fpMaterial(mat)
|
||||
{
|
||||
}
|
||||
RE04TrajectoryPoint::RE04TrajectoryPoint(G4ThreeVector pos, const G4Material* mat)
|
||||
: G4VTrajectoryPoint(), fPosition(pos), fpMaterial(mat)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04TrajectoryPoint::RE04TrajectoryPoint(const RE04TrajectoryPoint &right)
|
||||
: G4VTrajectoryPoint(),
|
||||
fPosition(right.fPosition),
|
||||
fpMaterial(right.fpMaterial)
|
||||
{
|
||||
}
|
||||
RE04TrajectoryPoint::RE04TrajectoryPoint(const RE04TrajectoryPoint& right)
|
||||
: G4VTrajectoryPoint(), fPosition(right.fPosition), fpMaterial(right.fpMaterial)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
RE04TrajectoryPoint::~RE04TrajectoryPoint()
|
||||
{
|
||||
}
|
||||
RE04TrajectoryPoint::~RE04TrajectoryPoint() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
const std::map<G4String,G4AttDef>* RE04TrajectoryPoint::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* RE04TrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("RE04TrajectoryPoint",isNew);
|
||||
std::map<G4String, G4AttDef>* store = G4AttDefStore::GetInstance("RE04TrajectoryPoint", isNew);
|
||||
if (isNew) {
|
||||
G4String pos("Pos");
|
||||
(*store)[pos] =
|
||||
G4AttDef(pos, "Position", "Physics","G4BestUnit","G4ThreeVector");
|
||||
(*store)[pos] = G4AttDef(pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
G4String mat("Mat");
|
||||
(*store)[mat] =
|
||||
G4AttDef(mat, "Mat", "Physics","Name","G4String");
|
||||
(*store)[mat] = G4AttDef(mat, "Mat", "Physics", "Name", "G4String");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
@@ -95,11 +79,11 @@ std::vector<G4AttValue>* RE04TrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back(G4AttValue("Pos",G4BestUnit(fPosition,"Length"),""));
|
||||
values->push_back(G4AttValue("Mat",fpMaterial->GetName(),""));
|
||||
values->push_back(G4AttValue("Pos", G4BestUnit(fPosition, "Length"), ""));
|
||||
values->push_back(G4AttValue("Mat", fpMaterial->GetName(), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
G4cout << G4AttCheck(values, GetAttDefs());
|
||||
#endif
|
||||
|
||||
return values;
|
||||
|
||||
Reference in New Issue
Block a user