#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" #include "G4PhysicalConstants.hh" #include "G4Isotope.hh" #include "G4Element.hh" #include "G4Material.hh" #include "G4UnitsTable.hh" DetectorConstruction::DetectorConstruction() {} DetectorConstruction::~DetectorConstruction() {} G4VPhysicalVolume* DetectorConstruction::Construct() { G4NistManager* ext = G4NistManager::Instance(); G4Element* elm1=ext->FindOrBuildElement("G4_Si"); G4Element* elm2=ext->FindOrBuildElement("G4_Li"); G4double density; density=2.33*g/cm3; G4Material* elm = new G4Material ("elm",density,2); G4double fracMass; elm->AddElement(elm1, fracMass=90.*perCent); elm->AddElement(elm2, fracMass=10.*perCent); //elm->AddElement(elm2, fracMass=10.0*perCent); 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",0); G4Material* ea = ext->FindOrBuildMaterial("G4_AIR"); //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() { G4String sdname="/sensDet"; mySD* sensDet=new mySD(sdname,"hitsCollectionName"); G4SDManager* SDMan = G4SDManager::GetSDMpointer(); SDMan->AddNewDetector(sensDet); SetSensitiveDetector("logicDet",sensDet,true); }