Message: Re: Import Logical Volume from GDML File fails for many Files Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: Import Logical Volume from GDML File fails for many Files 

Forum: Geometry
Re: Question Import Logical Volume from GDML File fails for many Files (JanW)
Re: None Re: Import Logical Volume from GDML File fails for many Files (Witek Pokorski)
Date: 21 Aug, 2016
From: JanW <JanW>

Hi,

thank you for your answer. I tried the example with two explicit different parsers. Alas, it still behaves the described way. The file that is parsed with the first instance is the file that seems to be handled by all instances of the GDML parser.

Looking at the source code for the GDML parser, it seems to make some sense (At least code-wise speaking). All GDML parser instances refer to the same XML parser instance. Why this prevents reading in a new file, I don't know.

However, I found some crude workaround (maybe "bodge" is more a appropriate description) for my problem: I am merging my GDML files with a python script. I then parse this file before any definition of a solid in my DetectorConstruction.

-- Luckily for me, the solids that are defined in the GDML file are even translated to Geant4 solids, when they are not "linked" to the GDML's world volume. This makes the script really simple. --

And now for the bodgy part. I call the G4SolidStore:

    G4SolidStore* solids = G4SolidStore::GetInstance();

and now I can iterate through the solids loaded and pick the ones I need for my setup:

    int i;
    for (i=0; i < solids->size(); ++i)
    {
      G4VSolid* psol = (*solids)[i];
      G4cout << "Solid-id:" << i << " Name: " << psol->GetName() << G4endl;
    }
    G4LogicalVolume* logVol   = new G4LogicalVolume((*solids)[0], Pb,"Target",0,0,0);

For some reason, I have to pick them by their "id", as it doesn't work with the name from GetName. But at the moment, this is only an minor drawback to me and might probably be solved. The solution is of course something, that easily breaks if one changes the XML file. Or if a solid is loaded before the XML file is loaded. Whenever something happens with the global solid store, the geometry probably starts behaving in unexpected ways.

Best regards Jan

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

1 None: Re: Import Logical Volume from GDML File fails for many Files   (Witek Pokorski - 29 Aug, 2016)
(_ None: Re: Import Logical Volume from GDML File fails for many Files   (JanW - 29 Aug, 2016)
 Add Message Add Message
to: "Re: Import Logical Volume from GDML File fails for many Files"

 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 ]