Skip to content
Snippets Groups Projects
Commit aa22f37a authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

WIP: add the dummy detector construction and a physics list.

parent 8fd7ae5c
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,8 @@ find_package(Geant4)
include(${Geant4_USE_FILE})
set(DetSimCore_srcs
src/*.cpp
src/DetSimAlg.cpp
src/DetectorConstruction.cpp
)
gaudi_add_module(DetSimCore ${DetSimCore_srcs}
......
......@@ -2,6 +2,11 @@
#include "G4RunManager.hh"
#include "DetectorConstruction.h"
#include "G4PhysListFactory.hh"
DECLARE_COMPONENT(DetSimAlg)
DetSimAlg::DetSimAlg(const std::string& name, ISvcLocator* pSvcLocator)
......@@ -28,8 +33,18 @@ DetSimAlg::initialize() {
return StatusCode::FAILURE;
}
runmgr->SetUserInitialization((G4VUserDetectorConstruction*)0);
runmgr->SetUserInitialization((G4VUserPhysicsList*)0);
runmgr->SetUserInitialization(new DetectorConstruction());
G4VUserPhysicsList *physicsList = nullptr;
if (m_physics_lists_name.value() == "CEPC") {
} else {
G4PhysListFactory *physListFactory = new G4PhysListFactory();
physicsList = physListFactory->GetReferencePhysList(m_physics_lists_name.value());
}
assert(physicsList);
runmgr->SetUserInitialization(physicsList);
runmgr->SetUserAction((G4VUserPrimaryGeneratorAction*)0);
// after set up the user initialization and user actions, start the initialization.
......
......@@ -26,6 +26,7 @@ private:
Gaudi::Property<std::vector<std::string>> m_run_cmds{this, "RunCmds"};
Gaudi::Property<std::vector<std::string>> m_vis_macs{this, "VisMacs"};
Gaudi::Property<std::string> m_physics_lists_name{this, "PhysicsList", "QGSP_BERT"};
private:
int i_event;
};
......
#include "DetectorConstruction.h"
#include "G4SystemOfUnits.hh"
#include "G4PhysicalConstants.hh"
#include "G4Isotope.hh"
#include "G4Element.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4Box.hh"
#include "G4Sphere.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4SDManager.hh"
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4OpticalSurface.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
DetectorConstruction::DetectorConstruction() {
}
DetectorConstruction::~DetectorConstruction() {
}
G4VPhysicalVolume*
DetectorConstruction::Construct() {
// =======================================================================
// Materials
// =======================================================================
bool any_warnings = false;
G4Material* Galactic = G4Material::GetMaterial("Galactic", any_warnings);
if (not Galactic) {
Galactic = new G4Material("Galactic", 1., 1.01*g/mole, universe_mean_density, kStateGas, 2.73*kelvin, 3.e-18*pascal);
}
// =======================================================================
// World
// =======================================================================
G4VSolid* solidWorld= new G4Box("sWorld", 60*m, 60*m, 60*m);
G4LogicalVolume* logicWorld= new G4LogicalVolume( solidWorld, Galactic, "lWorld", 0, 0, 0);
G4VPhysicalVolume* physiWorld = new G4PVPlacement(0, // no rotation
G4ThreeVector(), // at (0,0,0)
logicWorld, // its logical volume
"pWorld", // its name
0, // its mother volume
false, // no boolean operations
0); // no field specific to volume
return physiWorld;
}
#ifndef DetectorConstruction_h
#define DetectorConstruction_h
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4OpticalSurface.hh"
#include "G4Material.hh"
// A concrete detector construction class.
// The base class is Geant4's G4VUserDetectorConstruction only.
// Another Gaudi tool is used to configure & create this object.
class DetectorConstruction: public G4VUserDetectorConstruction {
public:
DetectorConstruction();
~DetectorConstruction();
public:
G4VPhysicalVolume* Construct();
private:
};
#endif
......@@ -3,7 +3,7 @@ gaudi_subdir(DetSimInterface v0r0)
# DetSimInterface (headers only)
set(DetSimInterface_srcs
src/*.cpp
src/IDetSimSvc.cpp
)
gaudi_add_library(DetSimInterface ${DetSimInterface_srcs}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment