19#include "KVPosition.h"
29#define ROOT_GEO_DO_NOT_USE(method,retval) \
31 ::Warning(method, "Does not work with ROOT geometries. Do not use."); \
154 ROOT_GEO_DO_NOT_USE(
"SetPolarWidth",)
175 ROOT_GEO_DO_NOT_USE(
"SetPolarMinMax",)
196 ROOT_GEO_DO_NOT_USE(
"SetAzimuthalWidth",)
220 ROOT_GEO_DO_NOT_USE(
"SetAzimuthalMinMax",)
297 th =
r.Theta() / dtor;
299 if (ph < 0) ph += 360.;
311 if (!strcmp(t,
"random")) {
314 dtheta = thmax - thmin;
320 dtheta = thmin - thmax;
341 ROOT_GEO_DO_NOT_USE(
"IsInPhiRange",
kFALSE)
345 if (phimintest > phimaxtest) {
348 if (phi >= phimintest && phi <= phimaxtest) {
351 if ((phi + 360.) >= phimintest && (phi + 360.) <= phimaxtest) {
366 ROOT_GEO_DO_NOT_USE(
"IsInPolarRange",
kFALSE)
383 ROOT_GEO_DO_NOT_USE(
"IsSmallerThan",
kFALSE)
399 ROOT_GEO_DO_NOT_USE(
"IsAlignedWith",
kFALSE)
412 ROOT_GEO_DO_NOT_USE(
"IsOverlappingWith",
kFALSE)
451 ROOT_GEO_DO_NOT_USE(
"IsAzimuthallyWiderThan",
kFALSE)
516 ROOT_GEO_DO_NOT_USE(
"GetCornerCoordinates",)
530 for (
int i = 0; i < 4; i++) {
531 Double_t t = corners[i] * normal_to_plane;
532 if (t <= 0.0) corners[i].
SetXYZ(0, 0, 0);
533 else corners[i] *= (
fDistance + depth) / t;
549 ROOT_GEO_DO_NOT_USE(
"GetCornerCoordinatesInOwnFrame",)
554 for (
int i = 0; i < 4; i++) {
555 corners[i] = rot_to_frame * corners[i] - displZ;
619 ROOT_GEO_DO_NOT_USE(
"GetAzimuthalWidth", 0.)
626 return (phmax - phmin);
628 return (phmax - phmin + 360.);
646 Error(
"GetWidthsFromDimension",
"Distance not set");
672 ROOT_GEO_DO_NOT_USE(
"GetRandomIsotropicRotation", rr2)
673 Double_t a1min, a1max, a2min, a2max, a3min, a3max;
724 if (!
GetShape()->InheritsFrom(
"TGeoArb8")) {
764 if (!
GetShape()->InheritsFrom(
"TGeoArb8")) {
829 ::Error(
"KVPosition::GetRandomPointOnSurface",
830 "ROOT Geometry has not been initialised");
843 for (
int i = 0; i < 3; i++)
points[i] += origin[i];
846 ::Error(
"KVPosition::GetRandomPoint",
847 "TGeoBBox::GetPointsOnFacet returns kFALSE for shape %s. Returning coordinates of centre.",
GetShape()->
ClassName());
856 npoint[2] += dz / 100.;
858 for (
int i = 0; i < 3; i++) npoint[i] += origin[i];
864 ::Error(
"KVPosition::GetRandomPointOnSurface",
865 "Cannot generate points for shape %s. Returning coordinates of surface centre.",
GetShape()->
ClassName());
870 npoint[2] -= dz / 100.;
897 ::Error(
"KVPosition::GetSurfaceCentre",
898 "ROOT Geometry has not been initialised");
922 ::Error(
"KVPosition::GetVolumeCentre",
923 "ROOT Geometry has not been initialised");
957 ::Error(
"KVPosition::GetSurfaceNormal",
958 "ROOT Geometry has not been initialised");
989 ::Error(
"KVPosition::GetEntranceWindowArea",
990 "TGeoBBox::GetPointsOnFacet returns kFALSE for shape %s. Returning 0.0",
GetShape()->
ClassName());
999 npoint[2] += dz / 100.;
1001 for (
int i = 0; i < 3; i++) npoint[i] += origin[i];
1002 if (
GetShape()->Contains(npoint)) ++points_on_facet;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
R__EXTERN TRandom * gRandom
Base class used for handling geometry in a multidetector array.
virtual void GetRandomAngles(Double_t &th, Double_t &ph, Option_t *t="isotropic")
Bool_t IsInPhiRange(const Double_t phi)
virtual void SetAzimuthalWidth(Double_t aw)
virtual TVector3 GetRandomDirection(Option_t *t="isotropic")
Bool_t IsAzimuthallyWiderThan(KVPosition *pos)
virtual void SetShape(TGeoBBox *)
virtual void SetAzimuthalMinMax(Double_t min, Double_t max)
Set min and max azimuthal angles and calculate (mean) phi.
virtual void SetAzimuthalAngle(Double_t ph)
virtual Double_t GetSolidAngle(void) const
virtual Double_t GetTheta() const
Bool_t ROOTGeo() const
Returns kTRUE if ROOT geometry is used, kFALSE if not.
void GetCornerCoordinates(TVector3 *, Double_t=0)
Double_t fTheta
polar angle in degrees with respect to beam axis, corresponds to centre of telescope
virtual TVector3 GetSurfaceCentre() const
virtual TGeoHMatrix * GetMatrix() const
void GetWidthsFromDimension(Double_t lin_dim)
void SetDistance(Double_t d)
TRotation GetRandomIsotropicRotation()
virtual void SetPolarAngle(Double_t th)
virtual Double_t GetPhi() const
Double_t GetPhiMax() const
virtual Double_t GetDistance(void) const
Double_t fSolidAngle
solid angle = area of entrance window / distance**2
TGeoHMatrix * fMatrix
transform world<->detector coordinates
Double_t GetPhiMin() const
Bool_t IsSmallerThan(KVPosition *pos)
kTRUE if "this" is entirely contained within "pos"
virtual TVector3 GetVolumeCentre() const
virtual Double_t GetSurfaceArea(int npoints=100000) const
TVector3 GetSCVector() const
Double_t GetThetaMin() const
virtual Double_t GetSinTheta() const
Double_t GetOC_SC_CosAngle() const
virtual TVector3 GetSurfaceNormal() const
virtual Double_t GetMisalignmentAngle() const
Double_t fTheta_min
polar angle in degrees corresponding to edge of telescope closest to beam axis
Double_t GetAzimuthalWidth(Double_t phmin=-1., Double_t phimax=-1.) const
Bool_t IsInPolarRange(const Double_t theta)
kTRUE if given angle theta is within the polar range of this solid angle element
virtual void SetPolarWidth(Double_t pw)
Bool_t IsAlignedWith(KVPosition *pos)
kTRUE if one of the two solid angle elements is completely contained within the other.
Double_t fTheta_max
polar angle in degrees of the edge furthest from the beam axis
void SetTheta(Double_t t)
Double_t fPhi
azimuthal angle in degrees with respect to 12 o'clock (=0 deg.), corresponds to centre of telescope
TGeoBBox * fShape
shape of detector volume
virtual void SetPolarMinMax(Double_t min, Double_t max)
Set min and max polar angles and calculate (mean) theta.
virtual void SetMatrix(const TGeoHMatrix *)
virtual TGeoBBox * GetShape() const
Double_t fPhi_max
azimuthal angle in degrees corresponding to most clockwise edge of telescope
Double_t fPhi_min
azimuthal angle in degrees corresponding to most anticlockwise edge of telescope
Bool_t IsOverlappingWith(KVPosition *pos)
kTRUE if there is at least partial overlap between two solid angle elements
Double_t fDistance
distance in cm from centre of solid angle element to coordinate system origin (target)
void GetCornerCoordinatesInOwnFrame(TVector3 *, Double_t=0)
void init()
default initialiser
Double_t GetThetaMax() const
virtual TVector3 GetDirection()
virtual TVector3 GetRandomPointOnSurface() const
virtual const Double_t * GetOrigin() const
virtual Double_t GetFacetArea(Int_t index=0) const
virtual Double_t GetDZ() const
Bool_t Contains(const Double_t *point) const override
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
virtual Double_t Uniform(Double_t x1, Double_t x2)
TRotation & SetXEulerAngles(Double_t phi, Double_t theta, Double_t psi)
TRotation & SetYEulerAngles(Double_t phi, Double_t theta, Double_t psi)
void SetMagThetaPhi(Double_t mag, Double_t theta, Double_t phi)
void SetXYZ(Double_t x, Double_t y, Double_t z)
RooCmdArg ClassName(const char *name)
T Mag(const SVector< T, D > &rhs)
RVec< PromoteType< T > > cos(const RVec< T > &v)
RVec< PromoteTypes< T0, T1 > > pow(const RVec< T0 > &v, const T1 &y)
RVec< PromoteType< T > > sin(const RVec< T > &v)
double dist(AxisAngle const &r1, AxisAngle const &r2)
double min(double x, double y)
double max(double x, double y)
constexpr Double_t DegToRad()
constexpr Double_t RadToDeg()