KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
List of all members | Public Member Functions | Private Member Functions | Private Attributes | List of all members
KVPosition Class Reference

Base class used for handling geometry in a multidetector array.

Each KVPosition object represents an element of solid angle, with a domain in polar angle (theta) and azimuthal angle (phi). All methods necessary to inquire about relative positions of such elements (overlaps, inclusion, etc.) are provided.

The coordinate system has the target position for its centre. The beam direction defines the positive z axis, with respect to which polar angles are measured. The +ve x-axis is taken to be vertical, and azimuthal angles increase when going clockwise from the +ve x-axis, looking towards the +ve z direction:

phi=0
(x) beam |
|
|
+------- phi=90
Double_t x[n]

All angles are in degrees.

Polar angles (theta) vary between 0 and 180 degrees Azimuthal angles (phi) vary between 0 and 359.999... degrees.

An element is defined by theta-min/max and phi-min/max:

The above definitions mean that phi-min is not necessarily smaller than phi-max: we redefine "smaller" for phi angles to mean "more anticlockwise than" or "less clockwise than". Some examples:

Examples of use of KVPosition objects

Generating a random unit vector within a given angular range

KVPosition pos; |
pos.SetPolarMinMax(20, 30); | -- or: KVPosition pos(20, 30, 0, 90);
pos.SetAzimuthalMinMax(0, 90); |
TVector3 dir1 = pos.GetDirection(); //unit vector in direction theta=25, phi=45
TVector3 dir2 = pos.GetRandomDirection(); //isotropic direction within angular limits of pos
TVector3 dir3 = pos.GetRandomDirection("random");//random direction
Base class used for handling geometry in a multidetector array.
Definition: KVPosition.h:90
virtual TVector3 GetRandomDirection(Option_t *t="isotropic")
Definition: KVPosition.cpp:242
virtual void SetAzimuthalMinMax(Double_t min, Double_t max)
Set min and max azimuthal angles and calculate (mean) phi.
Definition: KVPosition.cpp:216
virtual void SetPolarMinMax(Double_t min, Double_t max)
Set min and max polar angles and calculate (mean) theta.
Definition: KVPosition.cpp:171
virtual TVector3 GetDirection()
Definition: KVPosition.cpp:463

Definition at line 90 of file KVPosition.h.

Public Member Functions

 KVPosition ()
 
 KVPosition (Double_t thmin, Double_t thmax, Double_t phmin, Double_t phmax, Double_t dist=0.0)
 
virtual ~KVPosition ()
 
Double_t GetAzimuthalWidth (Double_t phmin=-1., Double_t phimax=-1.) const
 
void GetCornerCoordinates (TVector3 *, Double_t=0)
 
void GetCornerCoordinatesInOwnFrame (TVector3 *, Double_t=0)
 
virtual Double_t GetCosTheta () const
 
virtual TVector3 GetDirection ()
 
virtual Double_t GetDistance (void) const
 
virtual TGeoHMatrixGetMatrix () const
 
virtual Double_t GetMisalignmentAngle () const
 
virtual Double_t GetPhi () const
 
Double_t GetPhiMax () const
 
Double_t GetPhiMin () const
 
virtual void GetRandomAngles (Double_t &th, Double_t &ph, Option_t *t="isotropic")
 
virtual TVector3 GetRandomDirection (Option_t *t="isotropic")
 
TRotation GetRandomIsotropicRotation ()
 
virtual TVector3 GetRandomPointOnSurface () const
 
virtual TGeoBBoxGetShape () const
 
virtual Double_t GetSinTheta () const
 
virtual Double_t GetSolidAngle (void) const
 
virtual Double_t GetSurfaceArea (int npoints=100000) const
 
virtual TVector3 GetSurfaceCentre () const
 
virtual TVector3 GetSurfaceNormal () const
 
virtual Double_t GetTheta () const
 
Double_t GetThetaMax () const
 
Double_t GetThetaMin () const
 
virtual TVector3 GetVolumeCentre () const
 
void GetWidthsFromDimension (Double_t lin_dim)
 
void init ()
 default initialiser More...
 
Bool_t IsAlignedWith (KVPosition *pos)
 kTRUE if one of the two solid angle elements is completely contained within the other. More...
 
Bool_t IsAzimuthallyWiderThan (KVPosition *pos)
 
Bool_t IsInPhiRange (const Double_t phi)
 
Bool_t IsInPolarRange (const Double_t theta)
 kTRUE if given angle theta is within the polar range of this solid angle element More...
 
Bool_t IsOverlappingWith (KVPosition *pos)
 kTRUE if there is at least partial overlap between two solid angle elements More...
 
Bool_t IsSmallerThan (KVPosition *pos)
 kTRUE if "this" is entirely contained within "pos" More...
 
Bool_t ROOTGeo () const
 Returns kTRUE if ROOT geometry is used, kFALSE if not. More...
 
virtual void SetAzimuthalAngle (Double_t ph)
 
virtual void SetAzimuthalMinMax (Double_t min, Double_t max)
 Set min and max azimuthal angles and calculate (mean) phi. More...
 
virtual void SetAzimuthalWidth (Double_t aw)
 
void SetDistance (Double_t d)
 
virtual void SetMatrix (const TGeoHMatrix *)
 
void SetPhi (Double_t p)
 
void SetPhiMinMax (Double_t min, Double_t max)
 
virtual void SetPolarAngle (Double_t th)
 
virtual void SetPolarMinMax (Double_t min, Double_t max)
 Set min and max polar angles and calculate (mean) theta. More...
 
virtual void SetPolarWidth (Double_t pw)
 
virtual void SetShape (TGeoBBox *)
 
void SetTheta (Double_t t)
 

Private Member Functions

Double_t GetOC_SC_CosAngle () const
 
TVector3 GetSCVector () const
 

Private Attributes

Double_t fDistance
 distance in cm from centre of solid angle element to coordinate system origin (target) More...
 
TGeoHMatrixfMatrix
 transform world<->detector coordinates More...
 
Double_t fPhi
 azimuthal angle in degrees with respect to 12 o'clock (=0 deg.), corresponds to centre of telescope More...
 
Double_t fPhi_max
 azimuthal angle in degrees corresponding to most clockwise edge of telescope More...
 
Double_t fPhi_min
 azimuthal angle in degrees corresponding to most anticlockwise edge of telescope More...
 
TGeoBBoxfShape
 shape of detector volume More...
 
Double_t fSolidAngle
 solid angle = area of entrance window / distance**2 More...
 
Double_t fTheta
 polar angle in degrees with respect to beam axis, corresponds to centre of telescope More...
 
Double_t fTheta_max
 polar angle in degrees of the edge furthest from the beam axis More...
 
Double_t fTheta_min
 polar angle in degrees corresponding to edge of telescope closest to beam axis More...
 

#include <KVPosition.h>

Inheritance diagram for KVPosition:
Inheritance graph
[legend]

Constructor & Destructor Documentation

◆ KVPosition() [1/2]

KVPosition::KVPosition ( )

Definition at line 70 of file KVPosition.cpp.

◆ KVPosition() [2/2]

KVPosition::KVPosition ( Double_t  thmin,
Double_t  thmax,
Double_t  phmin,
Double_t  phmax,
Double_t  dist = 0.0 
)

Definition at line 79 of file KVPosition.cpp.

◆ ~KVPosition()

KVPosition::~KVPosition ( )
virtual

Definition at line 58 of file KVPosition.cpp.

Member Function Documentation

◆ GetAzimuthalWidth()

Double_t KVPosition::GetAzimuthalWidth ( Double_t  phmin = -1.,
Double_t  phmax = -1. 
) const

Calculate azimuthal width taking phi-min as the most anticlockwise point of the element and phi-max the most clockwise. If no arguments are given, width calculated for this object Otherwise, width calculated for given phi-min and phi-max

Definition at line 612 of file KVPosition.cpp.

◆ GetCornerCoordinates()

void KVPosition::GetCornerCoordinates ( TVector3 corners,
Double_t  depth = 0 
)

Fill the array (TVector3 corner[4]) with the coordinates of the 4 'corners' of the solid angle element.

These 'corners' are the points of intersection between the plane defined by the normal to the centre of the solid angle (direction: theta,phi), at a distance fDistance [cm] from the origin, and the four lines starting at the origin with directions (thetamin,phimin), (thetamax,phimin), (thetamax,phimax), (thetamin,phimax).

If optional argument 'depth' [cm] is given, the coordinates are calculated for the plane situated at distance (fDistance+depth) from the origin.

The order of the 4 corners is as follows: corners[3] : theta-min, phi-min corners[2] : theta-max, phi-min corners[1] : theta-max, phi-max corners[0] : theta-min, phi-max

Coordinates are in CENTIMETRES

Definition at line 496 of file KVPosition.cpp.

◆ GetCornerCoordinatesInOwnFrame()

void KVPosition::GetCornerCoordinatesInOwnFrame ( TVector3 corners,
Double_t  depth = 0 
)

Like GetCornerCoordinates(), except that the coordinates correspond to a reference frame in which the +ve z-axis goes through the centre of the solid angle

Definition at line 544 of file KVPosition.cpp.

◆ GetCosTheta()

virtual Double_t KVPosition::GetCosTheta ( ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 167 of file KVPosition.h.

◆ GetDirection()

TVector3 KVPosition::GetDirection ( )
virtual

Returns a unit vector corresponding to the direction of fTheta, fPhi i.e. the centre of the solid angle element.

Reimplemented in KVDetector.

Definition at line 463 of file KVPosition.cpp.

◆ GetDistance()

virtual Double_t KVPosition::GetDistance ( void  ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 189 of file KVPosition.h.

◆ GetMatrix()

TGeoHMatrix * KVPosition::GetMatrix ( ) const
virtual
  • ROOT Geometry * Return global transformation matrix for this detector

Reimplemented in KVDetector.

Definition at line 777 of file KVPosition.cpp.

◆ GetMisalignmentAngle()

Double_t KVPosition::GetMisalignmentAngle ( ) const
virtual

Return angle (in deg.) between the vector from the target to the volume centre and the normal to the volume surface

Reimplemented in KVDetector.

Definition at line 1014 of file KVPosition.cpp.

◆ GetOC_SC_CosAngle()

Double_t KVPosition::GetOC_SC_CosAngle ( ) const
inlineprivate

Definition at line 109 of file KVPosition.h.

◆ GetPhi()

virtual Double_t KVPosition::GetPhi ( ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 171 of file KVPosition.h.

◆ GetPhiMax()

Double_t KVPosition::GetPhiMax ( ) const
inline

Definition at line 145 of file KVPosition.h.

◆ GetPhiMin()

Double_t KVPosition::GetPhiMin ( ) const
inline

Definition at line 141 of file KVPosition.h.

◆ GetRandomAngles()

void KVPosition::GetRandomAngles ( Double_t th,
Double_t ph,
Option_t t = "isotropic" 
)
virtual

Set th and ph to random values between the max and min limits defining the solid angle element. Depending on the optional option string, the direction is either drawn at "random" among the corresponding angles, or "isotropic". By default, the direction is "isotropic".

  • ROOT Geometry * th and ph correspond to a random position on the detector's entrance window. The "isotropic" option has no effect.

Reimplemented in KVDetector.

Definition at line 280 of file KVPosition.cpp.

◆ GetRandomDirection()

TVector3 KVPosition::GetRandomDirection ( Option_t t = "isotropic")
virtual

Returns a unit vector in a random direction corresponding to this detector. Depending on the optional option string, the direction is either drawn at "random" among the corresponding angles, or "isotropic". By default, the direction is "isotropic".

  • ROOT Geometry * Direction corresponds to a random position on the entrance surface of the volume. The "isotropic" option has no effect.

Reimplemented in KVDetector.

Definition at line 242 of file KVPosition.cpp.

◆ GetRandomIsotropicRotation()

TRotation KVPosition::GetRandomIsotropicRotation ( )

Generates a rotation which, if applied to a unit vector in the Z-direction, will transform it into an isotropically-distributed vector in this angular range.

Definition at line 665 of file KVPosition.cpp.

◆ GetRandomPointOnSurface()

TVector3 KVPosition::GetRandomPointOnSurface ( ) const
virtual
  • ROOT Geometry * Generate a vector in the world (laboratory) frame from the origin to a random point on the entrance surface of this volume.

It is assumed that the volume was defined in such a way that the entrance window corresponds to the facet in the X-Y plane placed at -dZ.

NOTE: we force the use of TGeoBBox::GetPointsOnFacet. For TGeoArb8, the method has been overridden and does nothing. We use the TGeoBBox method, and then use TGeoShape::Contains to check that the point does actually correspond to the TGeoArb8.

Reimplemented in KVDetector.

Definition at line 813 of file KVPosition.cpp.

◆ GetSCVector()

TVector3 KVPosition::GetSCVector ( ) const
inlineprivate

Definition at line 105 of file KVPosition.h.

◆ GetShape()

TGeoBBox * KVPosition::GetShape ( ) const
virtual
  • ROOT Geometry * Return shape of this detector

Reimplemented in KVDetector.

Definition at line 790 of file KVPosition.cpp.

◆ GetSinTheta()

virtual Double_t KVPosition::GetSinTheta ( ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 163 of file KVPosition.h.

◆ GetSolidAngle()

Double_t KVPosition::GetSolidAngle ( void  ) const
virtual

Return values of the solid angle (in msr) seen by the geometric ensemble For simple geometries defined by theta_min/max etc., this is exact. For ROOT geometries we calculate the area of the entrance window and divide it by the square of the distance to the detector.

Reimplemented in KVRing, and KVDetector.

Definition at line 567 of file KVPosition.cpp.

◆ GetSurfaceArea()

Double_t KVPosition::GetSurfaceArea ( int  npoints = 100000) const
virtual

Monte Carlo calculation of entrance surface area for TGeoArb8 shapes Area is calculated as area of bounding box facet multiplied by the ratio between number of random points actually on the shape surface to the number of points npoints generated over the surface of the bounding box facet

npoints is the number of points to test

Reimplemented in KVDetector.

Definition at line 974 of file KVPosition.cpp.

◆ GetSurfaceCentre()

TVector3 KVPosition::GetSurfaceCentre ( ) const
virtual
  • ROOT Geometry * Generate a vector in the world (laboratory) frame from the origin to the centre of the entrance surface of the volume.

It is assumed that the volume was defined in such a way that the entrance surface corresponds to the facet in the X-Y plane placed at -dZ.

Reimplemented in KVDetector.

Definition at line 886 of file KVPosition.cpp.

◆ GetSurfaceNormal()

TVector3 KVPosition::GetSurfaceNormal ( ) const
virtual
  • ROOT Geometry * Generate a vector in the world (laboratory) frame representing the normal to the entrance surface of the volume (pointing away from the target, i.e. towards the inside of the volume)

It is assumed that the volume was defined in such a way that the entrance surface corresponds to the facet in the X-Y plane placed at -dZ.

Reimplemented in KVDetector.

Definition at line 945 of file KVPosition.cpp.

◆ GetTheta()

virtual Double_t KVPosition::GetTheta ( ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 159 of file KVPosition.h.

◆ GetThetaMax()

Double_t KVPosition::GetThetaMax ( ) const
inline

Definition at line 153 of file KVPosition.h.

◆ GetThetaMin()

Double_t KVPosition::GetThetaMin ( ) const
inline

Definition at line 149 of file KVPosition.h.

◆ GetVolumeCentre()

TVector3 KVPosition::GetVolumeCentre ( ) const
virtual
  • ROOT Geometry * Generate a vector in the world (laboratory) frame from the origin to the centre of the volume.

Reimplemented in KVDetector.

Definition at line 915 of file KVPosition.cpp.

◆ GetWidthsFromDimension()

void KVPosition::GetWidthsFromDimension ( Double_t  lin_dim)

Calculate azimuthal and polar widths for a square element placed at a given distance from the origin with linear dimension 'lin_dim' (in mm). SetDistance, SetTheta and SetPhi must already have been called.

Definition at line 639 of file KVPosition.cpp.

◆ init()

void KVPosition::init ( void  )

default initialiser

Definition at line 43 of file KVPosition.cpp.

◆ IsAlignedWith()

Bool_t KVPosition::IsAlignedWith ( KVPosition pos)

kTRUE if one of the two solid angle elements is completely contained within the other.

Definition at line 395 of file KVPosition.cpp.

◆ IsAzimuthallyWiderThan()

Bool_t KVPosition::IsAzimuthallyWiderThan ( KVPosition pos)

kTRUE if "this" has larger azimuthal width than "pos". Takes care of cases where the solid angle straddles 0 degrees

Definition at line 446 of file KVPosition.cpp.

◆ IsInPhiRange()

Bool_t KVPosition::IsInPhiRange ( const Double_t  phi)

kTRUE if given angle phi is within the azimuthal range of this solid angle element

Definition at line 336 of file KVPosition.cpp.

◆ IsInPolarRange()

Bool_t KVPosition::IsInPolarRange ( const Double_t  theta)

kTRUE if given angle theta is within the polar range of this solid angle element

Definition at line 362 of file KVPosition.cpp.

◆ IsOverlappingWith()

Bool_t KVPosition::IsOverlappingWith ( KVPosition pos)

kTRUE if there is at least partial overlap between two solid angle elements

Definition at line 408 of file KVPosition.cpp.

◆ IsSmallerThan()

Bool_t KVPosition::IsSmallerThan ( KVPosition pos)

kTRUE if "this" is entirely contained within "pos"

Definition at line 379 of file KVPosition.cpp.

◆ ROOTGeo()

Bool_t KVPosition::ROOTGeo ( ) const

Returns kTRUE if ROOT geometry is used, kFALSE if not.

Definition at line 598 of file KVPosition.cpp.

◆ SetAzimuthalAngle()

void KVPosition::SetAzimuthalAngle ( Double_t  ph)
virtual

Sets the azimuthal angle corresponding to the centre of this telescope/solid angle element/etc. If the azimuthal width has been set already (KVPosition::SetAzimuthalWidth), the limits phi-min and phi-max are calculated.

Reimplemented in KVTelescope.

Definition at line 117 of file KVPosition.cpp.

◆ SetAzimuthalMinMax()

void KVPosition::SetAzimuthalMinMax ( Double_t  min,
Double_t  max 
)
virtual

Set min and max azimuthal angles and calculate (mean) phi.

Reimplemented in KVTelescope.

Definition at line 216 of file KVPosition.cpp.

◆ SetAzimuthalWidth()

void KVPosition::SetAzimuthalWidth ( Double_t  aw)
virtual

Set phi_min and phi_max from width (in degrees) If phi is already known, use to set phi_min and phi_max If not, keep relative values (negative) of phi_min and phi_max, to be used when phi is set

Reimplemented in KVTelescope.

Definition at line 189 of file KVPosition.cpp.

◆ SetDistance()

void KVPosition::SetDistance ( Double_t  d)
inline

Definition at line 185 of file KVPosition.h.

◆ SetMatrix()

void KVPosition::SetMatrix ( const TGeoHMatrix m)
virtual
  • ROOT Geometry * Set the global transformation matrix for this volume If shape has been set, we set the (theta,phi) angles corresponding to the centre of the volume, and the distance from the target corresponding to the distance along (theta,phi) to the entrance surface of the volume (not necessarily the same as the distance from the target to the centre of the entrance surface)

Reimplemented in KVDetector.

Definition at line 702 of file KVPosition.cpp.

◆ SetPhi()

void KVPosition::SetPhi ( Double_t  p)
inline

Definition at line 181 of file KVPosition.h.

◆ SetPhiMinMax()

void KVPosition::SetPhiMinMax ( Double_t  min,
Double_t  max 
)
inline

Definition at line 125 of file KVPosition.h.

◆ SetPolarAngle()

void KVPosition::SetPolarAngle ( Double_t  th)
virtual

Sets the polar angle corresponding to the centre of this telescope/solid angle element/etc. If the polar width has been set already (KVPosition::SetPolarWidth), the limits theta-min and theta-max are calculated.

Reimplemented in KVTelescope.

Definition at line 96 of file KVPosition.cpp.

◆ SetPolarMinMax()

void KVPosition::SetPolarMinMax ( Double_t  min,
Double_t  max 
)
virtual

Set min and max polar angles and calculate (mean) theta.

Reimplemented in KVTelescope.

Definition at line 171 of file KVPosition.cpp.

◆ SetPolarWidth()

void KVPosition::SetPolarWidth ( Double_t  pw)
virtual

Set theta_min and theta_max from width (in degrees). If theta is already known, use to set theta_min and theta_max. If not, keep relative values (negative) of theta_min and theta_max, to be used when theta is set

Reimplemented in KVTelescope.

Definition at line 147 of file KVPosition.cpp.

◆ SetShape()

void KVPosition::SetShape ( TGeoBBox b)
virtual
  • ROOT Geometry * Set the shape of this detector If matrix has been set, we set the (theta,phi) angles corresponding to the centre of the volume, and the distance from the target corresponding to the distance along (theta,phi) to the entrance surface of the volume (not necessarily the same as the distance from the target to the centre of the entrance surface)

Reimplemented in KVDetector.

Definition at line 743 of file KVPosition.cpp.

◆ SetTheta()

void KVPosition::SetTheta ( Double_t  t)
inline

Definition at line 177 of file KVPosition.h.

Member Data Documentation

◆ fDistance

Double_t KVPosition::fDistance
private

distance in cm from centre of solid angle element to coordinate system origin (target)

Definition at line 98 of file KVPosition.h.

◆ fMatrix

TGeoHMatrix* KVPosition::fMatrix
private

transform world<->detector coordinates

Definition at line 101 of file KVPosition.h.

◆ fPhi

Double_t KVPosition::fPhi
mutableprivate

azimuthal angle in degrees with respect to 12 o'clock (=0 deg.), corresponds to centre of telescope

Definition at line 93 of file KVPosition.h.

◆ fPhi_max

Double_t KVPosition::fPhi_max
private

azimuthal angle in degrees corresponding to most clockwise edge of telescope

Definition at line 97 of file KVPosition.h.

◆ fPhi_min

Double_t KVPosition::fPhi_min
private

azimuthal angle in degrees corresponding to most anticlockwise edge of telescope

Definition at line 96 of file KVPosition.h.

◆ fShape

TGeoBBox* KVPosition::fShape
private

shape of detector volume

Definition at line 102 of file KVPosition.h.

◆ fSolidAngle

Double_t KVPosition::fSolidAngle
mutableprivate

solid angle = area of entrance window / distance**2

Definition at line 103 of file KVPosition.h.

◆ fTheta

Double_t KVPosition::fTheta
private

polar angle in degrees with respect to beam axis, corresponds to centre of telescope

Definition at line 92 of file KVPosition.h.

◆ fTheta_max

Double_t KVPosition::fTheta_max
private

polar angle in degrees of the edge furthest from the beam axis

Definition at line 95 of file KVPosition.h.

◆ fTheta_min

Double_t KVPosition::fTheta_min
private

polar angle in degrees corresponding to edge of telescope closest to beam axis

Definition at line 94 of file KVPosition.h.


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