//DetectorConstruction.hh //... private: void TestVolume(G4LogicalVolume*); //... //DetectorConstruction.cc void DetectorConstruction::TestVolume(G4LogicalVolume* logicName) { G4cout << "###############################" << G4endl; G4cout << " " << logicName->GetName() << G4endl; G4cout << "###############################" << G4endl; //Testing Volume G4double Volume = logicName->GetSolid()->GetCubicVolume(); G4cout << " Volume of " << logicName->GetName() << " = " << Volume/cm3 << " cm^3" << G4endl; //Testing Material G4String Material = logicName->GetMaterial()->GetName(); G4cout << " Material of " << logicName->GetName() << " = " << Material << G4endl; //Testing Density G4double Density = logicName->GetMaterial()->GetDensity(); G4cout << " Density of Material = " << Density*cm3/g << " g/cm^3" << G4endl; //Testing Mass G4double Mass = Volume*Density; G4cout << " Mass of " << logicName->GetName() << " = " << Mass/g << " g" << G4endl << G4endl; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......