예제 #1
0
//
// 5. Trapezoid:
//
// G4Trd(const G4String& pName,
//       G4double  dx1,
//       G4double  dx2,
//       G4double  dy1,
//       G4double  dy2,
//       G4double  dz)
void doTrd(const std::string &name, double dx1, double dx2, double dy1, double dy2, double dz) {
  G4Trd g4(name, dx1, dx2, dy1, dy2, dz);
  /////////////////////////////////////////
  // DDD does not have direct implementation of Trd.
  // Use generic trapezoid instead.
  DDI::Trap dd(dz, 0.0 /* pTheta */, 0.0 /* pPhi */, dy1, dx1, dx1, 0.0 /* pAlp1 */, dy2, dx2, dx2, 0.0 /* pAlp2 */);
  DDTrap dds = DDSolidFactory::trap(
      name, dz, 0.0 /* pTheta */, 0.0 /* pPhi */, dy1, dx1, dx1, 0.0 /* pAlp1 */, dy2, dx2, dx2, 0.0 /* pAlp2 */);
  dd.stream(std::cout);
  std::cout << std::endl;
  std::cout << "\tg4 volume = " << g4.GetCubicVolume() / cm3 << " cm3" << std::endl;
  std::cout << "\tdd volume = " << dd.volume() / cm3 << " cm3" << std::endl;
  std::cout << "\tDD Information: " << dds << " vol= " << dds.volume() << std::endl;
}
예제 #2
0
//
// 6. Generic Trapezoid:
//
// G4Trap(const G4String& pName,                        
//        G4double   pZ,
//        G4double   pY,
//        G4double   pX,
//        G4double   pLTX)
//
// G4Trap(const G4String& pName,                         
//        G4double   pDz,   G4double   pTheta,
//        G4double   pPhi,  G4double   pDy1,
//        G4double   pDx1,  G4double   pDx2,
//        G4double   pAlp1, G4double   pDy2,
//        G4double   pDx3,  G4double   pDx4,
//        G4double   pAlp2)
void
doTrap( const std::string& name, double dz, double pTheta, double pPhi,
	double pDy1, double pDx1, double pDx2, double pAlp1,
	double pDy2, double pDx3, double pDx4, double pAlp2 )
{
  G4Trap g4( name, dz, pTheta, pPhi, pDy1, pDx1, pDx2, pAlp1, pDy2, pDx3, pDx4, pAlp2 );
  
  // Note, the order of parameters is different:
  DDI::Trap dd( dz, pTheta, pPhi, pDy2, pDx3, pDx4, pAlp1, pDy1, pDx1, pDx2, pAlp2 );
  DDTrap dds = DDSolidFactory::trap( name, dz, pTheta, pPhi, pDy2, pDx3, pDx4, pAlp1, pDy1, pDx1, pDx2, pAlp2 );
  dd.stream( std::cout );
  std::cout << std::endl;
  std::cout << "\tg4 volume = " << g4.GetCubicVolume()/cm3 <<" cm3" << std::endl;
  std::cout << "\tdd volume = " << dd.volume()/cm3 << " cm3"<<  std::endl;
  std::cout << "\tDD Information: " << dds << " vol= " << dds.volume() << std::endl;
}