KaliVeda
Toolkit for HIC analysis
KVPosition Class Reference

Detailed Description

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:

  • Theta-min is the polar angle of the edge closest the beam (+ve z) axis
  • Theta-max is the polar angle of the edge furthest from the beam (+ve z) axis
  • Phi-min is the phi angle of the edge which is the most anticlockwise when looking as in the figure shown above
  • Phi-max is the phi angle of the edge which is the most clockwise when looking as in the figure shown above

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:

  • an element with phi-min = 20 and phi-max = 40 has an azimuthal width of 20 degrees;
  • an element with phi-min = 40 and phi-max = 20 has an azimuthal width of 340 degrees;
  • an element with phi-min = 350 and phi-max = 10 has an azimuthal width of 20 degrees.

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:91
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:487
Examples
ExampleAnalysis_KVEventMixerN_2Body.cpp, and ExampleCorrelationAnalysis.cpp.

Definition at line 91 of file KVPosition.h.

#include <KVPosition.h>

Inheritance diagram for KVPosition:

Public Member Functions

 KVPosition ()
 
 KVPosition (Double_t thmin, Double_t thmax, Double_t phmin, Double_t phmax, Double_t dist=0.0)
 
virtual ~KVPosition ()
 
void CalculateEstimatedAngularLimits (int N=10000)
 
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...
 
virtual Bool_t ROOTGeo () const
 
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...
 

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

◆ CalculateEstimatedAngularLimits()

void KVPosition::CalculateEstimatedAngularLimits ( int  N = 10000)

For ROOT geometries, perform a Monte-Carlo sampling in order to estimate the min/max polar and azimuthal angles of this volume

Definition at line 336 of file KVPosition.cpp.

◆ 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

Examples
ExampleAnalysis_KVEventMixerN_2Body.cpp, and ExampleCorrelationAnalysis.cpp.

Definition at line 627 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 520 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 568 of file KVPosition.cpp.

◆ GetCosTheta()

virtual Double_t KVPosition::GetCosTheta ( ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 177 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 487 of file KVPosition.cpp.

◆ GetDistance()

virtual Double_t KVPosition::GetDistance ( void  ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 199 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 792 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 1029 of file KVPosition.cpp.

◆ GetOC_SC_CosAngle()

Double_t KVPosition::GetOC_SC_CosAngle ( ) const
inlineprivate

Definition at line 110 of file KVPosition.h.

◆ GetPhi()

virtual Double_t KVPosition::GetPhi ( ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 181 of file KVPosition.h.

◆ GetPhiMax()

Double_t KVPosition::GetPhiMax ( ) const
inline

Definition at line 149 of file KVPosition.h.

◆ GetPhiMin()

Double_t KVPosition::GetPhiMin ( ) const
inline

Definition at line 143 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 680 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 828 of file KVPosition.cpp.

◆ GetSCVector()

TVector3 KVPosition::GetSCVector ( ) const
inlineprivate

Definition at line 106 of file KVPosition.h.

◆ GetShape()

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

Reimplemented in KVDetector.

Definition at line 805 of file KVPosition.cpp.

◆ GetSinTheta()

virtual Double_t KVPosition::GetSinTheta ( ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 173 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 KVDetector.

Definition at line 591 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 989 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 901 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 960 of file KVPosition.cpp.

◆ GetTheta()

virtual Double_t KVPosition::GetTheta ( ) const
inlinevirtual

Reimplemented in KVDetector.

Definition at line 169 of file KVPosition.h.

◆ GetThetaMax()

Double_t KVPosition::GetThetaMax ( ) const
inline

Definition at line 161 of file KVPosition.h.

◆ GetThetaMin()

Double_t KVPosition::GetThetaMin ( ) const
inline

Definition at line 155 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 930 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 654 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 419 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 470 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 360 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 386 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 432 of file KVPosition.cpp.

◆ IsSmallerThan()

Bool_t KVPosition::IsSmallerThan ( KVPosition pos)

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

Definition at line 403 of file KVPosition.cpp.

◆ ROOTGeo()

virtual Bool_t KVPosition::ROOTGeo ( ) const
inlinevirtual

Returns kTRUE if ROOT geometry is used, kFALSE if not

Reimplemented in KVINDRADetector.

Definition at line 210 of file KVPosition.h.

◆ 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.

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 KVINDRADetector.

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

Definition at line 189 of file KVPosition.cpp.

◆ SetDistance()

void KVPosition::SetDistance ( Double_t  d)
inline

Definition at line 195 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 717 of file KVPosition.cpp.

◆ SetPhi()

void KVPosition::SetPhi ( Double_t  p)
inline

Definition at line 191 of file KVPosition.h.

◆ SetPhiMinMax()

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

Definition at line 126 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.

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 KVINDRADetector.

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

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 758 of file KVPosition.cpp.

◆ SetTheta()

void KVPosition::SetTheta ( Double_t  t)
inline

Definition at line 187 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 99 of file KVPosition.h.

◆ fMatrix

TGeoHMatrix* KVPosition::fMatrix
private

transform world<->detector coordinates

Definition at line 102 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 94 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 98 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 97 of file KVPosition.h.

◆ fShape

TGeoBBox* KVPosition::fShape
private

shape of detector volume

Definition at line 103 of file KVPosition.h.

◆ fSolidAngle

Double_t KVPosition::fSolidAngle
mutableprivate

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

Definition at line 104 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 93 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 96 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 95 of file KVPosition.h.