Message: G4GDMLRead::GenerateName strips arbitrarily the logical volumes' names Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question G4GDMLRead::GenerateName strips arbitrarily the logical volumes' names 

Forum: Persistency
Date: 27 May, 2010
From: Francois Mauger <Francois Mauger>


I'm developping a G4 application using the GDML parser to build
the geometry of a detector.
My GDML source file is generated by a home-made external library using 
some specific names for logical volumes. I definitely want to preserve
these names within the G4 geometry tree.

Examples of names:

  a) tracker_cell_44x44

  b) calo_scin_block_270x270

Unfortunately, I checked that the G4GDMLRead::StripNames method
is invoked in the code, corrupting the names
I use for my volumes as soon as the "0x" string is found within the 
corresponding name.

Having a look at the code, for me it looks it's a bad trick used 
as a convenience for specific usage but not generic at all.
The XML syntax has already some constraints to take into account
while naming objects. It is enough as is and there is no need to add some
arbitrary rules (not documented as far as I know).

Unless there is a very good reason to preserve this behaviour
(some side-effect out of my understanding)
for me it should be removed from the library, or at least 
deactivated on demand using some global:

*** proposal for G4GDMLRead.hh:
  class G4GDMLRead
  public:  // with description
   static bool perform_strip_names;

*** proposal for
  bool G4GDMLRead::perform_strip_names = true;


  G4String G4GDMLRead::Strip(const G4String& name) const
    if (! G4GDMLRead::perform_strip_names) return name;
    G4String sname(name);
    return sname.remove(sname.find("0x"));

  void G4GDMLRead::StripName(G4String& name) const
    if (! G4GDMLRead::perform_strip_names) return;

*** Usage in user's code:

  G4GDMLRead::perform_strip_names = false;
  G4GDMLParser parser;
  parser.Read ("my_geom.gdml");

My questions are:

1) is there any good reason to preserve this behaviour ?
2) is there a plan to enable the user to bypass this issue without
   hacking the source code ?

Thanks a lot for feedback.

Francois Mauger
Laboratoire de Physique Corpusculaire de Caen et Universite de Caen
ENSICAEN - 6, Boulevard du Marechal Juin, 14050 CAEN Cedex, FRANCE
tel.: (0/+33) 2 31 45 25 12
fax: (0/+33) 2 31 45 25 49

 Add Message Add Message
to: "G4GDMLRead::GenerateName strips arbitrarily the logical volumes' names"

 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 ]