ROOT->GDML volume name issue

Hello,

I am converting a geometry in ROOT to GDML. However when I do this the names of the volumes in the GDML file receive numbers following them for example CPT in the root description becomes CPT_38400112 in the GDML file. I do not understand where these numbers come from but I do not want them. How is it possible to export to GDML without any change of the names?

Cheers,
Nathan

I still dont know why the gdml conversion process from root add’s these numbers to every variable, and therefore the only solution I came up with was a perl script something like…


#!/usr/bin/perl -w

open (OLDFILE, "old_file.gdml");

open (NEWFILE, '>new_file.gdml');

while (<OLDFILE>) {

 $pattern = '([C]+[P]+[T]+\d)([_]+\d+\d+\d+\d+\d+\d+\d+\d)';

    if (/$pattern/)
     { print "Grabbed pattern: \$1 = $1 \$2 = $2 \n";
s/$2//g;
     }
 print NEWFILE $_;
}

close OLDFILE;

close NEWFILE;

This doesnt give much insight into why gdml adds these numbers but is a solution for anyone else who comes across this.

Hi,
The TGeo->GDML interface is not maintained any more by the author. The plan is to rewrite it from the scratch in C++.

Regards,

I guess, maybe they want to remove duplicated references.
I think, we can define some name which cannot be renamed while writing GDML file.

I found that the number after the volume name is the object’s address.

    def getNodes(self, volume):
        nd = volume.GetNdaughters()
        if nd:
            for i in range(nd):
                currentNode = volume.GetNode(i)
                nextVol = currentNode.GetVolume()
                index = str(nextVol.GetNumber())+"_"+str(libPyROOT.AddressOf(nex
tVol)[0])
                self.volsUseCount[index] = self.volsUseCount[index]+1
                self.nodes.append(currentNode)
                self.getNodes(nextVol)
                self.nodeCount = self.nodeCount+1
                if self.nodeCount%10000==0:
                    print '[ZEROTH STAGE] Analysing node: ', self.nodeCount

Maybe we can create a new ROOTwriter derived from the original one, then change it as needed.

Hi,
Your help would be quite welcome. We are not maintaining anymore the python writer. The pointers are used to avoid name clashes since in geometry one can have different objects sharing the same name. This is the easiest solution.

Cheers,