Belle II Software  release-08-01-10
BelleCrystal Class Reference

a Belle crystal in Geant4 More...

#include <BelleCrystal.h>

Inheritance diagram for BelleCrystal:
Collaboration diagram for BelleCrystal:

Public Member Functions

 BelleCrystal (const G4String &pName)
 Constructor for "nominal" BelleCrystal.
 
 BelleCrystal (const G4String &pName, int, const G4ThreeVector *)
 Constructor.
 
virtual ~BelleCrystal ()
 Destructor.
 
Plane_t GetSidePlane (G4int n) const
 Get side plane.
 
G4double GetCubicVolume ()
 get the Cubic volume
 
G4double GetSurfaceArea ()
 get the surface area
 
void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 compute the dimensions
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
 calculate the extent of the volume
 
EInside Inside (const G4ThreeVector &p) const
 Return whether point inside/outside/on surface, using tolerance.
 
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
 Calculate side nearest to p, and return normal.
 
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
 Calculate exact shortest distance to any boundary from outside.
 
G4double DistanceToIn (const G4ThreeVector &p) const
 Calculate exact shortest distance to any boundary from outside.
 
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=0, G4ThreeVector *n=0) const
 Calculate exact shortest distance to any boundary from inside.
 
G4double DistanceToOut (const G4ThreeVector &p) const
 Calculate exact shortest distance to any boundary from inside.
 
G4GeometryType GetEntityType () const
 Get entity type.
 
G4ThreeVector GetPointOnSurface () const
 get point on surface
 
G4VSolid * Clone () const
 Make a clone of the object.
 
std::ostream & StreamInfo (std::ostream &os) const
 Stream object contents to an output stream.
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 Visualisation functions.
 
G4Polyhedron * CreatePolyhedron () const
 create polyhedron
 
void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 Two vectors define an axis-parallel bounding box for the shape.
 
 BelleCrystal (__void__ &)
 Fake default constructor for usage restricted to direct object persistency for clients requiring preallocation of memory for persistifiable objects.
 
 BelleCrystal (const BelleCrystal &rhs)
 copy constructor
 
BelleCrystaloperator= (const BelleCrystal &rhs)
 assignment operator
 
G4ThreeVector vertex (unsigned int i) const
 return ith vertex
 

Protected Member Functions

G4bool MakePlane (const G4ThreeVector &p1, const G4ThreeVector &p2, const G4ThreeVector &p3, const G4ThreeVector &p4, Plane_t &plane) const
 Calculate the coef's of the plane p1->p2->p3->p4->p1 where the ThreeVectors 1-4 are in anti-clockwise order when viewed from in front of the plane (i.e. More...
 

Private Member Functions

G4ThreeVector GetPointOnTriangle (int) const
 Returns a random point on the surface of one of the faces.
 
double area (int, double &) const
 triangle area
 
double getvolarea () const
 get volume area
 
const unsigned int * ivertx (unsigned int i) const
 get the ith vertex
 

Private Attributes

unsigned int nsides
 the number of sides
 
double fDz
 Dz.
 
std::vector< Plane_tfPlanes
 vector of planes
 
std::vector< Point_tfx
 vector of points
 
std::vector< double > fareas
 vector of area values
 

Detailed Description

a Belle crystal in Geant4

Definition at line 37 of file BelleCrystal.h.

Member Function Documentation

◆ MakePlane()

G4bool MakePlane ( const G4ThreeVector &  p1,
const G4ThreeVector &  p2,
const G4ThreeVector &  p3,
const G4ThreeVector &  p4,
Plane_t plane 
) const
protected

Calculate the coef's of the plane p1->p2->p3->p4->p1 where the ThreeVectors 1-4 are in anti-clockwise order when viewed from in front of the plane (i.e.

from normal direction).

Return true if the ThreeVectors are coplanar + set coef;s false if ThreeVectors are not coplanar

Definition at line 198 of file BelleCrystal.cc.

201 {
202  G4ThreeVector v12 = p2 - p1;
203  G4ThreeVector v13 = p3 - p1;
204  G4ThreeVector v14 = p4 - p1;
205  G4ThreeVector Vcross = v12.cross(v13);
206 
207  if (std::fabs(Vcross.dot(v14) / (Vcross.mag()*v14.mag())) > kCoplanar_Tolerance) {
208  std::ostringstream message;
209  message << "Verticies are not in the same plane: " << GetName() << " volume =" << Vcross.dot(v14);
210  G4Exception("BelleCrystal::MakePlane()", "BelleCrystal", FatalException, message);
211  }
212 
213  double a = +(p4.y() - p2.y()) * (p3.z() - p1.z()) - (p3.y() - p1.y()) * (p4.z() - p2.z());
214  double b = -(p4.x() - p2.x()) * (p3.z() - p1.z()) + (p3.x() - p1.x()) * (p4.z() - p2.z());
215  double c = +(p4.x() - p2.x()) * (p3.y() - p1.y()) - (p3.x() - p1.x()) * (p4.y() - p2.y());
216  double sd = sqrt(a * a + b * b + c * c); // so now vector plane.(a,b,c) is unit
217  a /= sd;
218  b /= sd;
219  c /= sd;
220  plane.n = G4ThreeVector(a, b, c);
221  plane.d = -(a * p1.x() + b * p1.y() + c * p1.z());
222 
223  // plane.n = (p4-p2).cross(p3-p1).unit();
224  // plane.d =-(plane.n*p1);
225  return true;
226 }
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

The documentation for this class was generated from the following files: