#include "DetectorConstruction.hh" #include "G4RunManager.hh" #include "G4SDManager.hh" #include "G4NistManager.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "globals.hh" #include "G4Box.hh" #include "G4VPhysicalVolume.hh" #include "G4SystemOfUnits.hh" #include "G4Tubs.hh" #include "G4UnionSolid.hh" #include "mySD.hh" DetectorConstruction::DetectorConstruction() {} DetectorConstruction::~DetectorConstruction() {} G4VPhysicalVolume* DetectorConstruction::Construct() { G4NistManager* ext = G4NistManager::Instance(); //G4Material* elm = ext->FindOrBuildElement("G4_Fe"); G4Material* elm = ext->FindOrBuildMaterial("G4_Si"); G4Box* Det=new G4Box("Det",0.5*mm,1.*mm,2.*mm); G4Tubs* cyl=new G4Tubs("cycl",0.*mm,2.*mm,5.*mm,0.*deg,360.*deg); //G4UnionSolid* fus = new G4UnionSolid("Box+Cylinder", Det, cyl); G4LogicalVolume* logicDet=new G4LogicalVolume(Det,elm,"logicDet"); G4Material* ea = ext->FindOrBuildMaterial("G4_WATER"); //G4Box* Hor=new G4Box("Hor",.*cm,4.*cm,6.*cm); G4LogicalVolume* logicEA=new G4LogicalVolume(cyl,ea,"logicEA"); G4VPhysicalVolume* physDet=new G4PVPlacement(nullptr,G4ThreeVector(0.*mm,0.*mm,0.*mm),logicDet,"physDet",logicEA,false,0,true); G4VPhysicalVolume* world=new G4PVPlacement(nullptr,G4ThreeVector(0.,0.,0.),logicEA,"world",nullptr,false,0,true); return world; } void DetectorConstruction::ConstructSDandField() { mySD* sensDet=new mySD("sensDet"); G4SDManager* SDMan = G4SDManager::GetSDMpointer(); SDMan->AddNewDetector(sensDet); logicDet->SetSensitiveDetector(sensDet); }