Message: Unused G4VPhysicalVolume variable Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Unused G4VPhysicalVolume variable 

Keywords: geometry unused variable
Forum: Geometry
Date: 12 Apr, 2007
From: Gabriel Barros <Gabriel Barros>

Hi.

I'm begginer with GEANT4.
I'm doing a simulation with NE213 scintillator.
I have used example novice n06 as base for my geometry.

When I compile the program, I get this message:

Compiling PNOptHadDetectorConstruction.cc ...
src/PNOptHadDetectorConstruction.cc: In member function 'virtual G4VPhysicalVolume* PNOptHadDetectorConstruction::Construct()':
src/PNOptHadDetectorConstruction.cc:188: warning: unused variable 'Cell_phys'
src/PNOptHadDetectorConstruction.cc:199: warning: unused variable 'Scint_phys'
Creating shared library /home/gabriel/geant4/tmp/Linux-g++/par_neut_opt_had/libpar_neut_opt_had.so ...
Creating/replacing object files in /home/gabriel/geant4/tmp/Linux-g++/par_neut_opt_had/libpar_neut_opt_had.a ...
ar: creating /home/gabriel/geant4/tmp/Linux-g++/par_neut_opt_had/libpar_neut_opt_had.a
Using granular libraries ...
Linking par_neut_opt_had ...
... Done!

I can run the code, but I'm affraid that these unused variables can be bad for my simulate.

Above I put the .hh and .cc files for the geometry.

Any suggest about this?

Thanks,
Gabriel Barros.

=-=-=-=-=-=-=-=-=-=-= CODE .hh

#ifndef PNOptHadDetectorConstruction_h
#define PNOptHadDetectorConstruction_h 1

#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

class PNOptHadDetectorConstruction : public G4VUserDetectorConstruction
{
  public:
    PNOptHadDetectorConstruction();
   ~PNOptHadDetectorConstruction();

  public:
    G4VPhysicalVolume* Construct();

  private:
    G4double nwall_x;
    G4double nwall_y;
    G4double nwall_z;

    G4double cell_x;
    G4double cell_y;
    G4double cell_z;
    
    G4double scint_x;
    G4double scint_y;
    G4double scint_z;
    
};

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

#endif /*PNOptHadDetectorConstruction_h*/

=-=-=-=-=-=-=-=-=-=-= CODE .cc
#include "PNOptHadDetectorConstruction.hh"

#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

PNOptHadDetectorConstruction::PNOptHadDetectorConstruction()
{
  nwall_x = nwall_y = nwall_z = 0.*m;
  cell_x = cell_y = cell_z = 0.*m;
  scint_x = scint_y = scint_z = 0.*m;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

PNOptHadDetectorConstruction::~PNOptHadDetectorConstruction(){;}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

G4VPhysicalVolume* PNOptHadDetectorConstruction::Construct()
{
// ---------- Detector Dimensions ----------
  
  // ----- Neutron Wall -----
  nwall_x = 3.0*m;
  nwall_y = 3.0*m;
  nwall_z = 3.0*m;
  
  // ----- Cell -----
  cell_x = 2.0*m + 3.*mm;
  cell_y = 8.2*cm + 3.*mm;
  cell_z = 8.2*cm + 3.*mm;
  
  // -----Scint Cell -----
  scint_x = 2.0*m;
  scint_y = 8.2*cm;
  scint_z = 8.2*cm;

//	------------- Materials -------------

  G4double a, z, density;
  G4int nelements, natoms;
  G4String symbol;
  
  // ----- Elements -----
  G4Element* H  = new G4Element("Hydrogen",symbol="H" , z= 1., a= 1.01*g/mole);
  G4Element* C  = new G4Element("Carbon"  ,symbol="C" , z= 6., a= 12.01*g/mole);
  G4Element* N  = new G4Element("Nitrogen",symbol="N" , z= 7., a= 14.01*g/mole);
  G4Element* O  = new G4Element("Oxygen"  ,symbol="O" , z= 8., a= 16.00*g/mole);

  // ----- Air -----
  density = 1.29*mg/cm3;
  nelements = 2;
  G4Material* Air = new G4Material("Air", density, nelements);
  Air->AddElement(N, 70.*perCent);
  Air->AddElement(O, 30.*perCent);

  // ----- BC-501A -----
  //Xileno CAS# 133-20-7
  //Dimethylbenezene (Dimetilbenzeno) = C6H4(CH3)2
  density = 874*mg/cm3;
  nelements = 2;
  G4Material* BC501A = new G4Material("BC501A", density, nelements);
  BC501A->AddElement(H, natoms = 10);
  BC501A->AddElement(C, natoms = 8);
  
  // ----- Glass -----
  density=1.032*g/cm3;
  nelements = 2;
  G4Material* Glass = new G4Material("Glass", density, nelements);
  Glass->AddElement(C,91.533*perCent);
  Glass->AddElement(H,8.467*perCent);
    
  // Print all the materials defined.
  G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
  G4cout << *(G4Material::GetMaterialTable()) << G4endl;


// ---------- Generate & Add Material Properties Table ------------

  const G4int entries = 32;
  G4double PhotonEnergy[entries] = {  3.27*eV, 3.25*eV, 3.24*eV, 3.21*eV, 3.20*eV, 3.18*eV, 3.17*eV, 3.15*eV, 3.13*eV, 3.11*eV, 3.09*eV, 3.06*eV, 3.03*eV, 3.00*eV, 2.95*eV, 2.91*eV, 2.89*eV, 2.87*eV, 2.82*eV, 2.79*eV, 2.75*eV, 2.73*eV, 2.72*eV, 2.69*eV, 2.65*eV, 2.63*eV, 2.57*eV, 2.53*eV, 2.49*eV, 2.46*eV, 2.42*eV, 2.39*eV };


  // BC501A
  G4MaterialPropertiesTable* MPTBC501A = new G4MaterialPropertiesTable();

  G4double slowcomp[entries] = { 0.03, 0.09, 0.14, 0.24, 0.31, 0.38, 0.45, 0.50, 0.56, 0.63, 0.69, 0.76, 0.85, 0.90, 1.02, 0.94, 0.88, 0.82, 0.79, 0.73, 0.66, 0.60, 0.55, 0.49, 0.43, 0.39, 0.30, 0.23, 0.17, 0.12, 0.07, 0.04 };
  
  G4double refracindex[entries]= { 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505, 1.505 };
  
  G4double absorption[entries] = {1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, 1.0*m, };

//   G4double refracindex = 1.505;
//   G4double absorption = 4.*m;
  G4double fastdecay = 3.16*ns;
  G4double slowdecay = 270.*ns;
  G4double yieldratio = 0.098;
  G4double timeresol = 1.0;
  G4double scintyield = 1.7/MeV;
  
  MPTBC501A->AddProperty("SLOWCOMP", PhotonEnergy, slowcomp, entries);
  MPTBC501A->AddProperty("RINDEX", PhotonEnergy, refracindex, entries);
  MPTBC501A->AddProperty("ABSLENGTH", PhotonEnergy, absorption, entries);

//   MPTBC501A->AddConstProperty("RINDEX", refracindex);
//   MPTBC501A->AddConstProperty("ABSLENGTH", absorption);
  MPTBC501A->AddConstProperty("FASTDECAY", fastdecay);
  MPTBC501A->AddConstProperty("SLOWDECAY", slowdecay);
  MPTBC501A->AddConstProperty("RESOLUTIONSCALE", timeresol);
  MPTBC501A->AddConstProperty("YIELDRATIO", yieldratio);
  MPTBC501A->AddConstProperty("SCINTILLATIONYIELD", scintyield);
  
  BC501A->SetMaterialPropertiesTable(MPTBC501A);
  
  // Air
  G4double RefractiveIndex2[entries] =
            { 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
              1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
              1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
              1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
              1.00, 1.00, 1.00, 1.00 };

  G4MaterialPropertiesTable* myMPT2 = new G4MaterialPropertiesTable();
  myMPT2->AddProperty("RINDEX", PhotonEnergy, RefractiveIndex2, entries);
  
  Air->SetMaterialPropertiesTable(myMPT2);

//
//	------------- Volumes --------------

// The Neutron Wall
//
  G4Box* nwall_box = new G4Box("World_box",nwall_x/2.0,nwall_y/2.0,nwall_z/2.0);

  G4LogicalVolume* nwall_log
    = new G4LogicalVolume(nwall_box,Air,"World_log",0,0,0);

  G4VPhysicalVolume* nwall_phys
    = new G4PVPlacement(0,G4ThreeVector(),nwall_log,"World_phys",0,false,0);

// The Neutron Wall's Cell
//	
  G4Box* Cell_box = new G4Box("Cell_box",cell_x/2.,cell_y/2.,cell_z/2.);

  G4LogicalVolume* Cell_log
    = new G4LogicalVolume(Cell_box,Glass,"Cell_log");

  G4VPhysicalVolume* Cell_phys
    = new G4PVPlacement(0,G4ThreeVector(),Cell_log,"Cell_phys",
                        nwall_log,false,0);

// The Neutron Wall's Scintillator
//	
  G4Box* Scint_box = new G4Box("Scint_box",scint_x/2.,scint_y/2.,scint_z/2.);

  G4LogicalVolume* Scint_log
    = new G4LogicalVolume(Scint_box,BC501A,"Scint_log",0,0,0);

  G4VPhysicalVolume* Scint_phys
    = new G4PVPlacement(0,G4ThreeVector(),Scint_log,"Scint_phys",
                        Cell_log,false,0);


//always return the physical World
  return nwall_phys;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Unused G4VPhysicalVolume variable   (John Allison - 16 Apr, 2007)
 Add Message Add Message
to: "Unused G4VPhysicalVolume variable"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]