I define water by G4material on example RE04, The program is compiled on my computer, However, this error can be seen when running in Terminal window, and The program does not output. ERROR: ***************************************************** Sorry Peter, The program is compiled on my computer, However, this error can be seen when running in Terminal window, and The program does not output. Thanks. Hamid *************************************************************************************** -------- EEEE ------- G4Exception-START -------- EEEE ------- *** G4Exception : GeomMgt0002 issued by : G4Region::ScanVolumeTree() Logical volume <PhantomPhantom2> does not have a valid material pointer. A logical volume belonging to the (tracking) world volume must have a valid material.Check your geometry construction. *** Fatal Exception *** core dump *** -------- EEEE -------- G4Exception-END --------- EEEE ------- ********************************************************************* I sent the attached file "RE04DetectorContruction.cc" Please advise me. Thanks. Hamid Akbari
Created attachment 352 [details] RE04Detector
Please post source code rather than unknown binary file. This error message says the logical volume "PhantomPhantom2" does not have a valid pointer to a material. This is not a problem of Geant4 but a bug in the user's code. Please post your DetectorConstruction source code to HyperNews.
(In reply to comment #2) > Please post source code rather than unknown binary file. > This error message says the logical volume "PhantomPhantom2" does not have a > valid pointer to a material. This is not a problem of Geant4 but a bug in the > user's code. Please post your DetectorConstruction source code to HyperNews. Hi, In fact My purpose is the definition of heavy water that I've hit a problem. DetectorConstruction.cc ******************************************************************************* #include "RE04DetectorConstruction.hh" #include "G4NistManager.hh" #include "G4Material.hh" #include "G4Box.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4UniformMagField.hh" #include "G4TransportationManager.hh" #include "G4FieldManager.hh" #include "G4VisAttributes.hh" #include "G4Colour.hh" #include "G4Element.hh" #include "G4Isotope.hh" #include "G4Tubs.hh" #include "G4SubtractionSolid.hh" #include "G4SystemOfUnits.hh" #include "G4ios.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... RE04DetectorConstruction::RE04DetectorConstruction() : fAir(0), fWater(0), fPb(0), fWorldPhys(0), fConstructed(false) {;} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... RE04DetectorConstruction::~RE04DetectorConstruction() {;} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* RE04DetectorConstruction::Construct() { if(!fConstructed) { fConstructed = true; DefineMaterials(); SetupGeometry(); } return fWorldPhys; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void RE04DetectorConstruction::DefineMaterials() { G4String symbol; G4double a, z, density; G4int ncomponents; G4int natoms; G4double abundance; G4int n; //===================== // Material Definitions //===================== // //-------- NIST Materials ---------------------------------------------------- // Material Information imported from NIST database. // G4NistManager* pNISTman = G4NistManager::Instance(); fAir = pNISTman->FindOrBuildMaterial("G4_AIR"); fWater = pNISTman->FindOrBuildMaterial("G4_WATER"); fPb = pNISTman->FindOrBuildMaterial("G4_Pb"); fW = pNISTman->FindOrBuildMaterial("G4_W"); fBe = pNISTman->FindOrBuildMaterial("G4_Be"); // Define elements G4Element* O = new G4Element("Oxygen", symbol="O", z=8.0, a=16.00*g/mole); G4Isotope* iso_H2 = new G4Isotope("H2",z=1,n=2,a=2.014*g/mole); G4Element* ele_D = new G4Element("Deuterium Atom","D",ncomponents=1); ele_D->AddIsotope(iso_H2, abundance = 100.*perCent); // Define water G4Material* water = new G4Material("Water", density= 1.107*mg/cm3, ncomponents=2); water->AddElement(ele_D, natoms=2); water->AddElement(O, natoms=1); // Print all the materials defined. G4cout << G4endl << "The materials defined are : " << G4endl << G4endl; G4cout << *(G4Material::GetMaterialTable()) << G4endl; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void RE04DetectorConstruction::SetupGeometry() { // // World // G4VSolid* worldSolid = new G4Box("World",1.*m,1.*m,1.*m); G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid,fAir,"World"); fWorldPhys = new G4PVPlacement(0,G4ThreeVector(),worldLogical,"World", 0,false,0); /////////////////////////////////////////////////////////////////////////////// G4Tubs* targetTubs = new G4Tubs("Target_Solid", // Name 0.*cm, // Inner radius 0.65*cm, // Outer radius 0.255*cm, // Half length in z 0.*deg, // Starting phi angle 360.*deg); // Segment angle G4LogicalVolume* targetLogical = new G4LogicalVolume(targetTubs, // Solid fW, // Material "Target_Logical"); // Name new G4PVPlacement(0, // Rotation matrix pointer G4ThreeVector(0.,0., 0*cm), // Translation vector targetLogical, // Logical volume "Target_Physical", // Name worldLogical, // Mother volume false, // Unused boolean 0); // Copy number ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// // water G4Tubs* target3Tubs = new G4Tubs("Target_Solid", // Name 0.*cm, // Inner radius 32*cm, // Outer radius 4.5*cm, // Half length in z 0.*deg, // Starting phi angle 360.*deg); // Segment angle ///////////////////////////////////////////////////////////////////////////// ///// phantom6 __ water tank//// G4SubtractionSolid* target4 = new G4SubtractionSolid("PhantomPhantom1", target3Tubs,targetTubs,0,G4ThreeVector(0.*cm,0.*cm,-3.99*cm)); G4LogicalVolume* target4Logical = new G4LogicalVolume(target4, water, "PhantomPhantom2"); new G4PVPlacement(0, // Rotation matrix pointer G4ThreeVector(0.,0.,3.99*cm), // Translation vector target4Logical, // Logical volume "PhantomPhantom3", // Name worldLogical, // Mother volume false, // Unused boolean 0); // Copy number /////////////////////////////////////////////////////////////////////////// // // Visualization attributes // worldLogical->SetVisAttributes(G4VisAttributes::Invisible); G4VisAttributes* simpleBox3VisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0)); simpleBox3VisAtt->SetVisibility(true); targetLogical->SetVisAttributes(simpleBox3VisAtt); /////////////////////////////////////////////////////////////////// ///// phantom6 G4VisAttributes* simpleBox4VisAtt= new G4VisAttributes(G4Colour(135/255. , 206/255. , 235/255)); simpleBox4VisAtt->SetVisibility(true); target4Logical->SetVisAttributes(simpleBox4VisAtt); } **************************************************************
Obviously, the variable "water" defined in DefineMaterial() method is local scope and it is **NOT** identical to the variable "water" appears in SetupGeometry() method. Please note that this is a Geant4 bug reporting system and this system is **NOT** meant to be used for debugging user's code. Please use HyperNews for further discussion.