Message: 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

Question Import Logical Volume from GDML File fails for many Files 

Forum: Geometry
Date: 16 Aug, 2016
From: JanW <JanW>

I want to import a Logical Volume from a GDML file and add it to my World, which I already have. So I have written a Function:

    G4LogicalVolume* DetectorConstruction::GetGDMLFileAsLV(G4String fileName, 
    G4Material* material) {

        G4GDMLParser parser;
        parser.Read(fileName);

        G4LogicalVolume LogVol = *(parser.GetWorldVolume()->GetLogicalVolume());
        LogVol->SetMaterial(material);

        return LogVol;
    }

It returns me a pointer to the Logical Volume I want to include in my World. This works all quite fine, up to the point where I want to add a second volume from a second file. At this point, I get two times the same Logical Volume, even if the files I load them from differ. I am not really sure, why it is that way, I suspect that there are not really different instances of what happens, when I call "GetWorldVolume" for the two files, but rather a single point of reference, event for a new instance of a G4GDMLparser. Also, as I always get the first Logical Volume shown two times, I suspect,that after the first parser.Read(...), the second time I call the function (even in a new instance) I don't really overwrite the old data.

So I tried copying the Logical Volume, which doesn't work, as the function for copying Logical Volumes is private. So I wanted to copy the G4VSolid, which I get when I call GetSolid() on the Logical Volume. This also doesn't work, as G4VSolid is abstract. Cloning it doesn't work and now I am stuck. It would considerably ease my work if I could import several Objects from several GDML files. I also don't see, why doing so should do any harm (where, of course, I could be very wrong there).

Could you give any advise on this problem or do you have any idea on how to get around this?

Thank you very much.

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   (JanW - 16 Aug, 2016)
2 None: Re: Import Logical Volume from GDML File fails for many Files   (Witek Pokorski - 19 Aug, 2016)
3 None: Re: Import Logical Volume from GDML File fails for many Files   (Witek Pokorski - 19 Aug, 2016)
1 Idea: Re: Import Logical Volume from GDML File fails for many Files   (JanW - 21 Aug, 2016)
(_ 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: "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 ]