Message: Re: Probably bug in G4Sphere Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Probably bug in G4Sphere 

Keywords: Geometry, G4Sphere, GeomTest
Forum: Geometry
Re: None Probably bug in G4Sphere (Dmitry A. Shtol)
Re: None Re: Probably bug in G4Sphere (Vladimir Grichine)
Re: None Re: Probably bug in G4Sphere (Dmitry A. Shtol)
Re: None Re: Probably bug in G4Sphere (Vladimir Grichine)
Date: 16 Jan, 2006
From: Dmitry A. Shtol <Dmitry A. Shtol>

Here is more simple test program working only with solid:

/*
 * Program ro demonstarte a bug in G4Sphere
 */

// ----- includes ------

// standard C headers #include <cstdlib>

// standard C++ headers #include <iostream>

// other packages headers #include "ExtGeant4/G4Sphere.hh"

int main() {
   G4double mainInnerRadius =  21.45 * cm ;
   G4double mainOuterRadius = 85.0 * cm ;
   G4double minTheta = 18.0 * degree ;
   //G4double minTheta = 0 ;

   std::string name="mainSp";
   // test sphere
   G4Sphere* solidMainSp =
      new G4Sphere( name,
                    mainInnerRadius,
                    mainOuterRadius,
                    0.0, M_PI*2,
                    minTheta,
                    M_PI - 2*minTheta);

   // Solid test
G4ThreeVector point(81.61117212,-27.77179755,196.4143423);
   G4ThreeVector dir(0.1644697995,0.18507236,0.9688642354);
   if (solidMainSp->Inside(point)) {
      G4cout<<point<<" is inside"<<std::endl;
   }
   else {
      G4cout<<point<<" is outside"<<std::endl;
   }
   G4double dist=solidMainSp->DistanceToOut(point, dir);
   G4cout.precision(10);
   G4cout<<"Distance: "<<dist<<G4endl;

   if (dist>kCarTolerance) {
      G4cout<<"Distance is greater then tolerance"<<std::endl;
   }
   G4ThreeVector p1=point+dir*dist*0.999/dir.r();
   if (solidMainSp->Inside(p1) == kOutside) {
      G4cout<<p1<<" is outside"<<std::endl;
   }
   else {
      G4cout<<p1<<" is inside"<<std::endl;
   }                
}  

Output is :

(81.6112,-27.7718,196.414) is inside

Distance: 647.5415503
Distance is greater then tolerance (188.0057,91.95040333,823.1668115) is outside

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 More: Re: Probably bug in G4Sphere   (Gabriele Cosmo - 16 Jan, 2006)
 Add Message Add Message
to: "Re: Probably bug in G4Sphere"

 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 ]