Message: Re: GDML aux info not written out to GDML Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: GDML aux info not written out to GDML 

Forum: Persistency
Re: Question GDML aux info not written out to GDML (Jeremy McCormick)
Date: 11 Jul, 2017
From: Jeremy McCormick <Jeremy McCormick>

So it seems I need to do this manually by adding the userinfo and volume to auxiliary map from parsing the file. Not sure why this is the case, as it seems this should be done automatically, but this does work...

---------------------------------------------------------------------------

#include "G4GDMLParser.hh"

#include <vector>

using std::vector;

int main(int argc, const char* argv[])  {
    G4GDMLParser pars;
    pars.Read("detector.gdml");

    const G4GDMLAuxListType* auxList = pars.GetAuxList();
    for (G4GDMLAuxListType::const_iterator it = auxList->begin();
            it != auxList->end();
            it++) {
        std::cout << it->type << ": " << it->value << std::endl;
        pars.AddAuxiliary(*it);
    }

    const G4GDMLAuxMapType* auxMap = pars.GetAuxMap();
    for (G4GDMLAuxMapType::const_iterator it = auxMap->begin();
            it != auxMap->end();
            it++) {
        std::cout << it->first->GetName() << std::endl;
        for (vector<G4GDMLAuxStructType>::const_iterator auxIt = it->second.begin();
                auxIt != it->second.end();
                auxIt++) {
            std::cout << "  " << (*auxIt).type << ": " << (*auxIt).value << std::endl;
            pars.AddVolumeAuxiliary(*auxIt, it->first);
        }
    }

    auto wv = pars.GetWorldVolume();

    pars.Write("out.gdml", wv->GetLogicalVolume());
}

 Add Message Add Message
to: "Re: GDML aux info not written out to GDML"

 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 ]