Problem 388

Summary: Heprep (XML) file error in particle trajectories
Product: Geant4 Reporter: novikova
Component: visualizationAssignee: Satoshi Tanaka <stanaka>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 1.0   
Hardware: All   
OS: All   

Description novikova 2002-07-10 10:25:51 CEST
The visualization/HepRep component allows to create XML files (extension
*.heprep) that are viewable using XML compatible software. The software
recommended by geant4 Manual is Wired
(http://www.slac.stanford.edu/BFROOT/www/Computing/Graphics/Wired/).

The combination of Geant4 and Wired works just fine, with the one exception.
The trajectories of particles are recorded into XML file with directive

<heprep:attvalue showLabel="NONE" name="DrawAs"
            value="Line"/>

(this is the actual two lines in a heprep file recorded by Geant4).  After this
directive, and a bunch of others, the coordinates of the particle's trajectory
are recorded as a sequence of triplets (x, y, and z coordinates).  Since the
sequence of coordinates is called "Line," the XML reader looks only at the
first two points in the sequence, and draws only the first leg of the
trajectory.  If we want to see the whole trajectory, and not just the first leg
of it (the first straight line), the sequence of coordinates has to be recorded
as "Polyline," and not as a "Line."

I fix the problem in my version of Geant4 4.1 (and 4.0 before that) by changing
two lines in the file G4HepRepFileScenneHandler.cc and recompiling the library.
Specifically, line #250 has to be changed from

  AddHepRepInstance("Line",polyline);

to

  AddHepRepInstance("Polyline",polyline);

The line #413 has to be changed from

    if (strcmp("Line",primName)==0)

to

    if (strcmp("Polyline",primName)==0)

These two changes fixed the problem, and the resulting XML files have the
trajectories of the particles recorded correctly. "Wired" software package
shows them correctly.

-- Elena Novikova,
novikova@ssd5.nrl.navy.mil
Comment 1 perl 2002-07-15 02:02:59 CEST
Ms Novikova's analysis of the problem is entirely correct.
It resulted from a mismatch between various early versions of HepRep
and WIRED.
For various reasons having to do with the intended evolution of HepRep,
the right solution is to modify WIRED to have it handle Line and Polyline
as synonymous, either of these being allowed to have 2 OR MORE points.
A new WIRED release will be made tomorrow incorporating this fix.
It will then work correctly with no change to G4 code.
Comment 2 perl 2002-07-15 03:10:59 CEST
A new version of WIRED, version 3.7, is now available that
corrects this problem.  No change is required to G4.
The new WIRED version is available from the usual place,
http://www.slac.stanford.edu/~wiredces/install.class