Basic DetectorConstruction
This commit is contained in:
parent
e39ae5befd
commit
f5a9c031af
|
@ -0,0 +1,35 @@
|
||||||
|
//
|
||||||
|
// MedtechDetectorConstruction.hh
|
||||||
|
// medtech
|
||||||
|
//
|
||||||
|
// Created by Baranyai David on 2018. 04. 01..
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef MedtechDetectorConstruction_hh
|
||||||
|
#define MedtechDetectorConstruction_hh
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "G4VUserDetectorConstruction.hh"
|
||||||
|
#include "G4Box.hh"
|
||||||
|
#include "globals.hh"
|
||||||
|
#include "G4SystemOfUnits.hh"
|
||||||
|
#include "G4LogicalVolume.hh"
|
||||||
|
#include "G4PVPlacement.hh"
|
||||||
|
#include "G4ThreeVector.hh"
|
||||||
|
#include "G4NistManager.hh"
|
||||||
|
#include "G4Material.hh"
|
||||||
|
|
||||||
|
class MedtechDetectorConstruction : public G4VUserDetectorConstruction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MedtechDetectorConstruction();
|
||||||
|
virtual ~MedtechDetectorConstruction();
|
||||||
|
virtual G4VPhysicalVolume* Construct();
|
||||||
|
|
||||||
|
G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
G4LogicalVolume* fScoringVolume;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* MedtechDetectorConstruction_hh */
|
|
@ -0,0 +1,79 @@
|
||||||
|
//
|
||||||
|
// MedtechDetectorConstruction.cc
|
||||||
|
// medtech
|
||||||
|
//
|
||||||
|
// Created by Baranyai David on 2018. 04. 01..
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "MedtechDetectorConstruction.hh"
|
||||||
|
|
||||||
|
MedtechDetectorConstruction::MedtechDetectorConstruction() : G4VUserDetectorConstruction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MedtechDetectorConstruction::~MedtechDetectorConstruction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
G4VPhysicalVolume* MedtechDetectorConstruction::Construct()
|
||||||
|
{
|
||||||
|
//Material Section
|
||||||
|
G4NistManager *manager = G4NistManager::Instance();
|
||||||
|
G4Material *air = manager -> FindOrBuildMaterial("G4_AIR");
|
||||||
|
G4Material *targetMaterial = manager -> FindOrBuildMaterial("G4_Pb");
|
||||||
|
G4Material *collMaterial = manager -> FindOrBuildMaterial("G4_W");
|
||||||
|
//End of Material Section
|
||||||
|
|
||||||
|
//Physical world
|
||||||
|
G4int world_xyz = 1*m; // world is 1m x 1m x 2m for each
|
||||||
|
G4Box *solidWorld = new G4Box("World",0.5*world_xyz,0.5*world_xyz,4*m); //define a box for world
|
||||||
|
|
||||||
|
G4LogicalVolume *logicWorld = new G4LogicalVolume(solidWorld, air, "World", 0, 0, 0); //define a logical volume for world
|
||||||
|
|
||||||
|
G4PVPlacement *physicalWorld = new G4PVPlacement(0, //no rotation
|
||||||
|
G4ThreeVector(), //at (0,0,0)
|
||||||
|
logicWorld, //it's logical volume
|
||||||
|
"World", //it's name
|
||||||
|
0, //it's mother volume
|
||||||
|
false, //no boolean operations
|
||||||
|
0); //no magnetic field
|
||||||
|
//End of Physical world
|
||||||
|
|
||||||
|
//Target box
|
||||||
|
G4Box *solidTarget = new G4Box("Target", 1*m, 1*m, 0.1*cm);
|
||||||
|
|
||||||
|
G4LogicalVolume *logicTarget = new G4LogicalVolume(solidTarget, targetMaterial, "Collimator", 0, 0, 0);
|
||||||
|
|
||||||
|
G4PVPlacement *physicalTarget = new G4PVPlacement(0, //no rotation
|
||||||
|
G4ThreeVector(0, 0, 4*m), //at (0,0,0)
|
||||||
|
logicTarget, //it's logical volume
|
||||||
|
"Target", //it's name
|
||||||
|
logicWorld, //it's mother volume
|
||||||
|
false, //no boolean operations
|
||||||
|
0); //no particular field
|
||||||
|
//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, 2*m), //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, 2*m), //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
|
||||||
|
|
||||||
|
return physicalWorld;
|
||||||
|
}
|
Loading…
Reference in New Issue