Problem 551

Summary: material with an element added twice
Product: Geant4 Reporter: Ivana.Hrivnacova
Component: materialsAssignee: kurasige
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 5.2   
Hardware: PC   
OS: Linux   

Description Ivana.Hrivnacova 2003-11-04 06:47:24 CET
The material defined in this way:
  density = 1.29e-03*g/cm3;
  G4Material* Air = new G4Material(name="Air", density, nel=3);
  Air->AddElement(elN, .7);
  Air->AddElement(elO, .2);
  Air->AddElement(elO, .1);
is accepted without any warning during initialization, but then
it causes a segmentation fault:

Program received signal SIGSEGV, Segmentation fault.
0x4145a33b in G4VRangeToEnergyConverter::RangeLogSimpson(std::vector<G4Element*,
 std::allocator<G4Element*> > const*, double const*, double, double, double, int
) () at eval.c:41
41      eval.c: No such file or directory.
        in eval.c
(gdb) bt
#0  0x4145a33b in G4VRangeToEnergyConverter::RangeLogSimpson(std::vector<G4Eleme
nt*, std::allocator<G4Element*> > const*, double const*, double, double, double,
 int) () at eval.c:41
#1  0x41452b4f in G4RToEConvForElectron::BuildRangeVector(G4Material const*, dou
ble, double, G4PhysicsLogVector*) () at eval.c:41
#2  0x41459ed6 in G4VRangeToEnergyConverter::Convert(double, G4Material const*)
    () at eval.c:41
#3  0x4144be85 in G4ProductionCutsTable::UpdateCoupleTable() () at eval.c:41
#4  0x41191fc2 in G4RunManager::BuildPhysicsTables() () at eval.c:41
#5  0x411911b9 in G4RunManager::RunInitialization() () at eval.c:41
#6  0x41190ed7 in G4RunManager::BeamOn(int, char const*, int) () at eval.c:41
#7  0x4119a8db in G4RunMessenger::SetNewValue(G4UIcommand*, G4String) ()
    at eval.c:41

This case can happen when defining materials via G3toG4 tool,
if a material is defined as a mixture of materials defined via effective Z,
with two components with Z diffent only in decimals:
 // 60% SiO2 , 40% G10FR4
 // PC board
 Float_t apcb[3]  = { 28.0855,15.9994,17.749 };
 Float_t zpcb[3]  = { 14.,8.,8.875 };
 Float_t wpcb[3]  = { .28,.32,.4 };
 Float_t denspcb  = 1.8;

As G3toG4 takes int(Z) when searching the element,
it will add twice the element with Z=8 for the material
with values above.

Is the above material definition legal in Geant4?
If not, there could be better added a check for such a case.

Related to that, the question is whether there could be done
something better than to replace Zeff defined by a user with integer Z
(what currently does g3tog4)?

Thank you for clarification of this,

Ivana Hrivnacova
Comment 1 kurasige 2003-11-07 23:50:59 CET
*** This bug has been marked as a duplicate of 525 ***
*** 'kurasige@phys.sci.kobe-u.ac.jp' will be responsible for this bug. ***