19 #include "KVPosition.h"
27 #define ROOT_GEO_DO_NOT_USE(method,retval) \
29 ::Warning(method, "Does not work with ROOT geometries. Do not use."); \
112 ROOT_GEO_DO_NOT_USE(
"SetPolarWidth",)
133 ROOT_GEO_DO_NOT_USE(
"SetPolarMinMax",)
154 ROOT_GEO_DO_NOT_USE(
"SetAzimuthalWidth",)
178 ROOT_GEO_DO_NOT_USE(
"SetAzimuthalMinMax",)
255 th =
r.Theta() / dtor;
257 if (ph < 0) ph += 360.;
269 if (!strcmp(t,
"random")) {
272 dtheta = thmax - thmin;
278 dtheta = thmin - thmax;
307 if (ph < 0) ph += 360.;
328 ROOT_GEO_DO_NOT_USE(
"IsInPhiRange",
kFALSE)
332 if (phimintest > phimaxtest) {
335 if (phi >= phimintest && phi <= phimaxtest) {
338 if ((phi + 360.) >= phimintest && (phi + 360.) <= phimaxtest) {
353 ROOT_GEO_DO_NOT_USE(
"IsInPolarRange",
kFALSE)
370 ROOT_GEO_DO_NOT_USE(
"IsSmallerThan",
kFALSE)
386 ROOT_GEO_DO_NOT_USE(
"IsAlignedWith",
kFALSE)
399 ROOT_GEO_DO_NOT_USE(
"IsOverlappingWith",
kFALSE)
438 ROOT_GEO_DO_NOT_USE(
"IsAzimuthallyWiderThan",
kFALSE)
503 ROOT_GEO_DO_NOT_USE(
"GetCornerCoordinates",)
517 for (
int i = 0; i < 4; i++) {
518 Double_t t = corners[i] * normal_to_plane;
519 if (t <= 0.0) corners[i].
SetXYZ(0, 0, 0);
520 else corners[i] *= (
fDistance + depth) / t;
536 ROOT_GEO_DO_NOT_USE(
"GetCornerCoordinatesInOwnFrame",)
541 for (
int i = 0; i < 4; i++) {
542 corners[i] = rot_to_frame * corners[i] - displZ;
597 ROOT_GEO_DO_NOT_USE(
"GetAzimuthalWidth", 0.)
604 return (phmax - phmin);
606 return (phmax - phmin + 360.);
624 Error(
"GetWidthsFromDimension",
"Distance not set");
650 ROOT_GEO_DO_NOT_USE(
"GetRandomIsotropicRotation", rr2)
651 Double_t a1min, a1max, a2min, a2max, a3min, a3max;
702 if (!
GetShape()->InheritsFrom(
"TGeoArb8")) {
798 ::Error(
"KVPosition::GetRandomPointOnSurface",
799 "ROOT Geometry has not been initialised");
812 for (
int i = 0; i < 3; i++)
points[i] += origin[i];
815 ::Error(
"KVPosition::GetRandomPoint",
816 "TGeoBBox::GetPointsOnFacet returns kFALSE for shape %s. Returning coordinates of centre.",
GetShape()->
ClassName());
825 npoint[2] += dz / 100.;
827 for (
int i = 0; i < 3; i++) npoint[i] += origin[i];
833 ::Error(
"KVPosition::GetRandomPointOnSurface",
834 "Cannot generate points for shape %s. Returning coordinates of surface centre.",
GetShape()->
ClassName());
839 npoint[2] -= dz / 100.;
917 ::Error(
"KVPosition::GetEntranceWindowArea",
918 "TGeoBBox::GetPointsOnFacet returns kFALSE for shape %s. Returning 0.0",
GetShape()->
ClassName());
927 npoint[2] += dz / 100.;
929 for (
int i = 0; i < 3; i++) npoint[i] += origin[i];
930 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)
void set_surface_centre()
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
void GetCornerCoordinates(TVector3 *, Double_t=0)
void initialize_root_geo()
virtual TGeoHMatrix * GetMatrix() const
virtual TVector3 GetSurfaceCentre() const
void GetWidthsFromDimension(Double_t lin_dim)
void SetDistance(Double_t d)
TRotation GetRandomIsotropicRotation()
virtual TVector3 GetVolumeCentre() const
virtual void SetPolarAngle(Double_t th)
virtual Double_t GetPhi() const
Double_t GetPhiMax() const
virtual Double_t GetDistance(void) const
Double_t GetPhiMin() const
Bool_t IsSmallerThan(KVPosition *pos)
kTRUE if "this" is entirely contained within "pos"
Double_t fMaxMisalignment
std::unique_ptr< TGeoHMatrix > fMatrix
transform world<->detector coordinates
virtual Double_t GetSurfaceArea(int npoints=100000) const
Double_t GetThetaMin() const
virtual Double_t GetSinTheta() const
Double_t GetOC_SC_CosAngle() const
virtual TVector3 GetNormalIntoShape() const
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.
void SetTheta(Double_t t)
void CalculateEstimatedAngularLimits(int N=10000)
virtual void SetPolarMinMax(Double_t min, Double_t max)
Set min and max polar angles and calculate (mean) theta.
virtual void SetMatrix(const TGeoHMatrix *)
Set the global transformation matrix for this volume.
virtual TGeoBBox * GetShape() const
Bool_t IsOverlappingWith(KVPosition *pos)
kTRUE if there is at least partial overlap between two solid angle elements
virtual Bool_t ROOTGeo() const
void GetCornerCoordinatesInOwnFrame(TVector3 *, Double_t=0)
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)
SVector< T, D > Unit(const SVector< T, D > &rhs)
T Mag(const SVector< T, D > &rhs)
RVec< PromoteType< T > > cos(const RVec< T > &v)
RVec< PromoteTypes< T0, T1 > > pow(const T0 &x, const RVec< T1 > &v)
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()