Example #1
0
void
testEllipticalTube::matched_g4_and_dd( void )
{
  double xSemiAxis = 3.0*cm;
  double ySemiAxis = 2.0*cm;
  double zHeight = 5.0*cm;
  std::string name( "fred1" );

  G4EllipticalTube g4( name, xSemiAxis, ySemiAxis, zHeight );
  DDI::EllipticalTube dd(    xSemiAxis, ySemiAxis, zHeight );
  DDEllipticalTube dds = DDSolidFactory::ellipticalTube( name, xSemiAxis, ySemiAxis, zHeight );
  std::cout << std::endl;
  dd.stream( std::cout );
  std::cout << std::endl;

  double g4_volume = g4.GetCubicVolume()/cm3;
  double dd_volume = dd.volume()/cm3;
  double dds_volume = dds.volume()/cm3;
  
  std::cout << "\tg4 volume = " << g4_volume <<" cm3" << std::endl;
  std::cout << "\tdd volume = " << dd_volume << " cm3" <<  std::endl;
  std::cout << "\tDD Information: " << dds << " vol=" << dds_volume << " cm3" << std::endl;
  
  double tolerance = 0.5;
  
  CPPUNIT_ASSERT( fabs( g4_volume - dd_volume ) < tolerance );
  CPPUNIT_ASSERT( fabs( g4_volume - dds_volume ) < tolerance );
}
Example #2
0
void
testEllipticalTube::matched_g4_and_dd( void )
{
  double xSemiAxis = 3.0*cm;
  double ySemiAxis = 2.0*cm;
  double zHeight = 5.0*cm;
  string name( "fred1" );

  G4EllipticalTube g4( name, xSemiAxis, ySemiAxis, zHeight );
  DDI::EllipticalTube dd(    xSemiAxis, ySemiAxis, zHeight );
  DDEllipticalTube dds = DDSolidFactory::ellipticalTube( name, xSemiAxis, ySemiAxis, zHeight );
  cout << endl;
  dd.stream( cout );
  cout << endl;

  double g4v = g4.GetCubicVolume()/cm3;
  double ddv = dd.volume()/cm3;
  double ddsv = dds.volume()/cm3;
  
  cout << "\tg4 volume = " << g4v <<" cm3" << endl;
  cout << "\tdd volume = " << ddv << " cm3" <<  endl;
  cout << "\tDD Information: " << dds << " vol=" << ddsv << " cm3" << endl;
  
  CPPUNIT_ASSERT( abs(g4v - ddv) < numeric_limits<float>::epsilon());
  CPPUNIT_ASSERT( abs(g4v - ddsv) < numeric_limits<float>::epsilon());
}
Example #3
0
//
// 12. Tube with an elliptical cross section:
//
// G4EllipticalTube(const G4String& pName,
// 		 G4double  Dx,
// 		 G4double  Dy,
// 		 G4double  Dz)
void doEllipticalTube(const std::string &name, double xSemiaxis, double ySemiAxis, double zHeight) {
  G4EllipticalTube g4t(name, xSemiaxis, ySemiAxis, zHeight);
  DDI::EllipticalTube ddt(xSemiaxis, ySemiAxis, zHeight);
  DDEllipticalTube ddet = DDSolidFactory::ellipticalTube(name, xSemiaxis, ySemiAxis, zHeight);
  ddt.stream(std::cout);
  std::cout << std::endl;
  std::cout << "\tg4 volume = " << g4t.GetCubicVolume() / cm3 << " cm3" << std::endl;
  std::cout << "\tdd volume = " << ddt.volume() / cm3 << " cm3" << std::endl;
  std::cout << "\tcalc volume = " << 2 * zHeight * Geom::pi() * ySemiAxis * xSemiaxis / cm3 << " cm3 " << std::endl;
  std::cout << "\tDD Information: ";
  std::cout << ddet << " vol= " << ddet.volume() << std::endl;
}