Added tetahedron to DetectorConstruction. ParticleNumber now is 100.
This commit is contained in:
parent
5f8e2a8698
commit
db0bf22c79
|
@ -20,6 +20,7 @@
|
|||
#include "G4Material.hh"
|
||||
#include "G4SubtractionSolid.hh"
|
||||
#include "Parameters.hh"
|
||||
#include "G4Tet.hh"
|
||||
|
||||
class MedtechDetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <stdio.h>
|
||||
#include "G4UserSteppingAction.hh"
|
||||
#include "MedtechEventAction.hh"
|
||||
#include "G4Gamma.hh"
|
||||
|
||||
class MedtechSteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "MedtechDetectorConstruction.hh"
|
||||
#include "MedtechActionInitialization.hh"
|
||||
#include "Parameters.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
|
||||
int main(int argc,char** argv)
|
||||
|
|
|
@ -25,8 +25,9 @@ G4VPhysicalVolume* MedtechDetectorConstruction::Construct()
|
|||
G4NistManager *manager = G4NistManager::Instance();
|
||||
G4Material *air = manager -> FindOrBuildMaterial("G4_AIR");
|
||||
G4Material *targetMaterial = manager -> FindOrBuildMaterial("G4_Pb");
|
||||
G4Material *collMaterial = manager -> FindOrBuildMaterial("G4_W");
|
||||
//G4Material *collMaterial = manager -> FindOrBuildMaterial("G4_W");
|
||||
G4Material *boxMaterial = manager -> FindOrBuildMaterial("G4_W");
|
||||
G4Material *tetMaterial = manager -> FindOrBuildMaterial("G4_Fe");
|
||||
//End of Material Section
|
||||
|
||||
//Physical world
|
||||
|
@ -59,25 +60,6 @@ G4VPhysicalVolume* MedtechDetectorConstruction::Construct()
|
|||
//End of Target box
|
||||
|
||||
//Collimator
|
||||
G4Box *solidColl = new G4Box("Collimator 1", 0.25*m, 0.25*m, 0.1*cm);
|
||||
G4LogicalVolume *logicColl = new G4LogicalVolume(solidColl, collMaterial, "Collimator 1", 0, 0, 0);
|
||||
G4PVPlacement *physicalColl = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(0.5*m, 0, 10*cm), //at (0,0,0)
|
||||
logicColl, //it's logical volume
|
||||
"Collimator 1", //it's name
|
||||
logicWorld, //it's mother volume
|
||||
false, //no boolean operations
|
||||
0); //no particular field
|
||||
|
||||
G4LogicalVolume *logicColl2 = new G4LogicalVolume(solidColl, collMaterial, "Collimator 2", 0, 0, 0);
|
||||
G4PVPlacement *physicalColl2 = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(-0.5*m, 0, 10*cm), //at (0,0,0)
|
||||
logicColl2, //it's logical volume
|
||||
"Collimator 2", //it's name
|
||||
logicWorld, //it's mother volume
|
||||
false, //no boolean operations
|
||||
0); //no particular field
|
||||
|
||||
G4double box_size = parameter -> GetBoxSize();
|
||||
G4Box *solidB1 = new G4Box("B1", 25*cm, 25*cm, 1*cm);
|
||||
G4Box *solidB2 = new G4Box("B2", box_size*cm, box_size*cm, 1.5*cm);
|
||||
|
@ -85,11 +67,24 @@ G4VPhysicalVolume* MedtechDetectorConstruction::Construct()
|
|||
G4SubtractionSolid *Box = new G4SubtractionSolid("Box", solidB1, solidB2);
|
||||
G4LogicalVolume *logicBox = new G4LogicalVolume(Box, boxMaterial, "Box", 0, 0, 0);
|
||||
G4PVPlacement *physicalBox = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(0, 0, 5*cm),
|
||||
G4ThreeVector(0, 0, 10*cm),
|
||||
logicBox,
|
||||
"Box",
|
||||
logicWorld,
|
||||
false,
|
||||
0);
|
||||
//End of Collimator
|
||||
|
||||
//Cone
|
||||
G4Tet *solidTet = new G4Tet("solidTet", G4ThreeVector(0, 0, 1*cm), G4ThreeVector(-5*cm, -5*cm, 0), G4ThreeVector(5*cm, -5*cm, 0), G4ThreeVector(0, 5*cm, 0));
|
||||
G4LogicalVolume *logicTet = new G4LogicalVolume(solidTet, tetMaterial, "Tet", 0, 0, 0);
|
||||
G4PVPlacement *physicalTet = new G4PVPlacement(0,
|
||||
G4ThreeVector(0,0,3*cm),
|
||||
logicTet,
|
||||
"Tet",
|
||||
logicWorld,
|
||||
false,
|
||||
0);
|
||||
|
||||
return physicalWorld;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ MedtechPrimaryGeneratorAction::MedtechPrimaryGeneratorAction()
|
|||
{
|
||||
Parameters *param = Parameters::getInstance();
|
||||
|
||||
G4int numberOfParticles = 1;
|
||||
G4int numberOfParticles = 100;
|
||||
particleGun = new G4ParticleGun(numberOfParticles);
|
||||
G4ParticleTable *particleTable = G4ParticleTable::GetParticleTable();
|
||||
G4ParticleDefinition *particle = particleTable -> FindParticle("e-");
|
||||
|
|
|
@ -31,6 +31,42 @@ void MedtechSteppingAction::UserSteppingAction(const G4Step* step)
|
|||
= step->GetPreStepPoint()->GetTouchableHandle()
|
||||
->GetVolume()->GetLogicalVolume();
|
||||
|
||||
G4Track *fTrack = step -> GetTrack();
|
||||
G4int trackID = fTrack -> GetTrackID();
|
||||
|
||||
G4double postTime = step->GetPostStepPoint()->GetLocalTime();
|
||||
|
||||
if(fTrack->GetTrackStatus()!=fAlive) { return; } /// check if it is alive
|
||||
|
||||
G4VPhysicalVolume* prevolume = step -> GetPreStepPoint() -> GetTouchableHandle() -> GetVolume();
|
||||
G4VPhysicalVolume* postvolume = step -> GetPostStepPoint() -> GetTouchableHandle() -> GetVolume();
|
||||
|
||||
G4double preX = step->GetPreStepPoint()->GetPosition().x();
|
||||
G4double preY = step->GetPreStepPoint()->GetPosition().y();
|
||||
G4double preZ = step->GetPreStepPoint()->GetPosition().z();
|
||||
G4double prekinE = step->GetPreStepPoint()->GetKineticEnergy();
|
||||
|
||||
G4double postX = step->GetPostStepPoint()->GetPosition().x();
|
||||
G4double postY = step->GetPostStepPoint()->GetPosition().y();
|
||||
G4double postZ = step->GetPostStepPoint()->GetPosition().z();
|
||||
G4double postkinE = step->GetPostStepPoint()->GetKineticEnergy();
|
||||
|
||||
G4String preName = prevolume -> GetName();
|
||||
G4String postName = postvolume -> GetName();
|
||||
G4String procN;
|
||||
|
||||
G4ParticleDefinition *particle = fTrack -> GetDefinition();
|
||||
|
||||
if(fTrack -> GetCreatorProcess() != 0)
|
||||
{
|
||||
procN = fTrack -> GetCreatorProcess() -> GetProcessName();
|
||||
if(postName == "Target")
|
||||
{
|
||||
fTrack -> SetTrackStatus(fStopAndKill);
|
||||
}
|
||||
G4cout << "X: " << postX << " Y: " << postY << " KinE: " << postkinE << " Particle: " << fTrack -> GetDefinition() << G4endl;
|
||||
}
|
||||
|
||||
// check if we are in scoring volume
|
||||
if (volume != fScoringVolume) return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue