Problem 1909 - WAF block contents?
Summary: WAF block contents?
Status: REOPENED FIXED
Alias: None
Product: Bugzilla
Classification: Unclassified
Component: general (show other problems)
Version: other
Hardware: All All
: P4 major
Assignee: Koichi Murakami
URL:
Depends on:
Blocks:
 
Reported: 2016-11-14 04:36 CET by Koichi Murakami
Modified: 2016-11-17 03:02 CET (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this problem.
Description Koichi Murakami 2016-11-14 04:36:50 CET
After WAF was enabled, some contents updates failed.
Comment 1 Koichi Murakami 2016-11-14 04:38:35 CET
Some dirty words blocking?
Comment 2 Koichi Murakami 2016-11-14 04:39:06 CET
How about resolviung the issue?
Comment 3 Koichi Murakami 2016-11-14 10:09:19 CET
Hello,

I had a problem with the magnetic field classes implemented in the hadrontherapy and the purging magnet examples of Geant4. 

In some runs it segfaulted, and with gdb we figured out that it crashed in line 191 of HadrontherapyMagneticField3D.cc (line 219 of PurgMagTabulatedField3D.cc):
> xField[xindex+1][yindex  ][zindex  ] *    xlocal  * (1-ylocal) * (1-zlocal) +


Furthermore we saw, that xindex+1 was as big as the whole x-width of the xField array (xindex+1 == nx), which is obviously wrong.

When we fixed the range check in line 145+ (171+, respectively) from
>  if ( x>=minx && x<maxx &&
>       y>=miny && y<maxy &&
>       z>=minz && z<maxz ) {

to
>  if ( x>=minx && x+dx/nx<maxx &&
>       y>=miny && y+dy/ny<maxy &&
>       z>=minz && z+dz/nz<maxz ) {


so that it also checks whether the interpolation neighbour is valid too, it seems to work.

Now my question: Did we do something wrong (e.g. while loading the data) or did we find a bug in the example?

-----

Thank you for your feedback.

Your proposed change would 

Instead the code should be changed to use the 'floor' method when converting from the double variables xdindex, ydindex and zdindex to their integer variable xindex, yindex and zindex.  Using the method
  double floor (double x);
ensure that the value is the smaller of the integers near the value of the double - so for example floor(3.7) = 3, and not the rounded value 4.

So the relevant code in the magnetic field class should be changed to:

    // The indices of the nearest tabulated point whose coordinates
    // are all less than those of the given point
    int xindex = static_cast<int>(floor(xdindex));
    int yindex = static_cast<int>(floor(ydindex));
    int zindex = static_cast<int>(floor(zdindex));

Please let us know whether you have further issues once you have tried this change. Best regards, John
Comment 4 Koichi Murakami 2016-11-14 10:09:45 CET
database is changed and closed.
Comment 5 Koichi Murakami 2016-11-14 10:09:59 CET
sql command
Comment 6 Koichi Murakami 2016-11-14 10:10:41 CET
a != aaaaa
aa += p2;


if (aaa ) {
  cout << aaa;
}


codes.
Comment 7 Koichi Murakami 2016-11-17 03:01:33 CET
When using <replicavol> to create replicated volumes in gdml, the <width value="" unit=""> tag does not accept units other than lengths. When replicating around direction="phi", this requires the user to enter a width value in radians with unit mm (which is defined identical to 1). 

Code that fails to run:
    <replicavol number="7">
      <volumeref ref="pionDetectorGEMOpenSector_logical"/>
      <replicate_along_axis>
        <direction phi="1"/>
        <width value="360.0/7.0" unit="deg"/>
        <offset value="0.0" unit="deg"/>
      </replicate_along_axis>
    </replicavol>

Work-around:
    <replicavol number="7">
      <volumeref ref="pionDetectorGEMOpenSector_logical"/>
      <replicate_along_axis>
        <direction phi="1"/>
        <width value="2.0*pi/7.0" unit="mm"/> <!-- bug geant4.10.02.p02: unit must be a length, but mm == 1 -->
        <offset value="0.0" unit="mm"/>
      </replicate_along_axis>
    </replicavol>

The bug is caused by G4GDMLReadStructure::QuantityRead which throws an exception in line 559 when the unit is not of the category length.

Suggested solution could be to relax the requirement in QuantityRead, or to pass the axis in ReplicaRead and check accordingly (this requires the <direction> tag to appear before <width> and <offset>).
Comment 8 Koichi Murakami 2016-11-17 03:01:47 CET
/etc
/usr
/bin
Comment 9 Koichi Murakami 2016-11-17 03:02:06 CET
/etc/
/share
/sbin
/root
password