KaliVeda
Toolkit for HIC analysis
KVPosition.h
1 /***************************************************************************
2  kvposition.h - description
3  -------------------
4  begin : Sun May 19 2002
5  copyright : (C) 2002 by J.D. Frankland
6  email : frankland@ganil.fr
7 
8 $Id: KVPosition.h,v 1.20 2009/01/19 14:36:57 ebonnet Exp $
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  ***************************************************************************/
19 
20 #ifndef KVPOSITION_H
21 #define KVPOSITION_H
22 #include "TMath.h"
23 #include "KVBase.h"
24 #include "TVector3.h"
25 #include "TRotation.h"
26 class TGeoHMatrix;
27 class TGeoBBox;
28 
91 class KVPosition {
92 private:
94  mutable Double_t fPhi;
100 
101  /* ROOT Geometry */
105 
107  {
108  return GetVolumeCentre() - GetSurfaceCentre();
109  }
111  {
112  return GetVolumeCentre().Unit().Dot(GetSCVector().Unit());
113  }
114 
115 public:
116  KVPosition();
117  KVPosition(Double_t thmin, Double_t thmax, Double_t phmin, Double_t phmax, Double_t dist = 0.0);
118  void init();
119  virtual ~KVPosition();
120  virtual void SetAzimuthalAngle(Double_t ph);
121  virtual void SetPolarAngle(Double_t th);
122  virtual void SetPolarWidth(Double_t pw);
123  virtual void SetPolarMinMax(Double_t min, Double_t max);
124  virtual void SetAzimuthalWidth(Double_t aw);
125  virtual void SetAzimuthalMinMax(Double_t min, Double_t max);
127  {
129  }
130  virtual TVector3 GetRandomDirection(Option_t* t = "isotropic");
132  virtual void GetRandomAngles(Double_t& th, Double_t& ph, Option_t* t = "isotropic");
133  virtual TVector3 GetDirection();
134 
135  Bool_t IsInPolarRange(const Double_t theta);
136  Bool_t IsInPhiRange(const Double_t phi);
141 
142  inline Double_t GetPhiMin() const
143  {
144  return fPhi_min;
145  }
146  inline Double_t GetPhiMax() const
147  {
148  return fPhi_max;
149  }
150  inline Double_t GetThetaMin() const
151  {
152  return fTheta_min;
153  }
154  inline Double_t GetThetaMax() const
155  {
156  return fTheta_max;
157  }
158  Double_t GetAzimuthalWidth(Double_t phmin = -1., Double_t phimax =
159  -1.) const;
160  virtual Double_t GetTheta() const
161  {
162  return fTheta;
163  }
164  virtual Double_t GetSinTheta() const
165  {
166  return TMath::Sin(fTheta * TMath::DegToRad());
167  }
168  virtual Double_t GetCosTheta() const
169  {
170  return TMath::Cos(fTheta * TMath::DegToRad());
171  }
172  virtual Double_t GetPhi() const
173  {
174  if (fPhi >= 360.0)
175  fPhi -= 360.;
176  return fPhi;
177  }
179  {
180  SetPolarAngle(t);
181  }
182  void SetPhi(Double_t p)
183  {
185  }
187  {
188  fDistance = d;
189  }
190  virtual Double_t GetDistance(void) const
191  {
192  return fDistance;
193  }
194  void GetCornerCoordinates(TVector3*, Double_t /*depth*/ = 0);
195  void GetCornerCoordinatesInOwnFrame(TVector3*, Double_t /*depth*/ = 0);
196  void GetWidthsFromDimension(Double_t lin_dim);
197 
198  virtual Double_t GetSolidAngle(void) const;
199 
200  /* ROOT Geometry */
201  Bool_t ROOTGeo() const;
202  virtual void SetMatrix(const TGeoHMatrix*);
203  virtual void SetShape(TGeoBBox*);
204  virtual TGeoHMatrix* GetMatrix() const;
205  virtual TGeoBBox* GetShape() const;
206  virtual TVector3 GetRandomPointOnSurface() const;
207  virtual TVector3 GetSurfaceCentre() const;
208  virtual TVector3 GetVolumeCentre() const;
209  virtual TVector3 GetSurfaceNormal() const;
210  virtual Double_t GetSurfaceArea(int npoints = 100000) const;
211  virtual Double_t GetMisalignmentAngle() const;
212 
213  ClassDef(KVPosition, 1)//Class handling geometry of detectors in a multidetector array
214 };
215 
216 #endif
#define d(i)
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
winID h TVirtualViewer3D TVirtualGLPainter p
Base class used for handling geometry in a multidetector array.
Definition: KVPosition.h:91
virtual void GetRandomAngles(Double_t &th, Double_t &ph, Option_t *t="isotropic")
Definition: KVPosition.cpp:280
Bool_t IsInPhiRange(const Double_t phi)
Definition: KVPosition.cpp:336
virtual void SetAzimuthalWidth(Double_t aw)
Definition: KVPosition.cpp:189
virtual TVector3 GetRandomDirection(Option_t *t="isotropic")
Definition: KVPosition.cpp:242
Bool_t IsAzimuthallyWiderThan(KVPosition *pos)
Definition: KVPosition.cpp:446
virtual void SetShape(TGeoBBox *)
Definition: KVPosition.cpp:743
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 SetAzimuthalAngle(Double_t ph)
Definition: KVPosition.cpp:117
virtual Double_t GetSolidAngle(void) const
Definition: KVPosition.cpp:567
virtual Double_t GetTheta() const
Definition: KVPosition.h:160
Bool_t ROOTGeo() const
Returns kTRUE if ROOT geometry is used, kFALSE if not.
Definition: KVPosition.cpp:598
void GetCornerCoordinates(TVector3 *, Double_t=0)
Definition: KVPosition.cpp:496
Double_t fTheta
polar angle in degrees with respect to beam axis, corresponds to centre of telescope
Definition: KVPosition.h:93
virtual TVector3 GetSurfaceCentre() const
Definition: KVPosition.cpp:886
virtual TGeoHMatrix * GetMatrix() const
Definition: KVPosition.cpp:777
void GetWidthsFromDimension(Double_t lin_dim)
Definition: KVPosition.cpp:639
void SetDistance(Double_t d)
Definition: KVPosition.h:186
TRotation GetRandomIsotropicRotation()
Definition: KVPosition.cpp:665
virtual void SetPolarAngle(Double_t th)
Definition: KVPosition.cpp:96
virtual Double_t GetPhi() const
Definition: KVPosition.h:172
Double_t GetPhiMax() const
Definition: KVPosition.h:146
virtual Double_t GetDistance(void) const
Definition: KVPosition.h:190
Double_t fSolidAngle
solid angle = area of entrance window / distance**2
Definition: KVPosition.h:104
TGeoHMatrix * fMatrix
transform world<->detector coordinates
Definition: KVPosition.h:102
Double_t GetPhiMin() const
Definition: KVPosition.h:142
Bool_t IsSmallerThan(KVPosition *pos)
kTRUE if "this" is entirely contained within "pos"
Definition: KVPosition.cpp:379
virtual TVector3 GetVolumeCentre() const
Definition: KVPosition.cpp:915
virtual Double_t GetSurfaceArea(int npoints=100000) const
Definition: KVPosition.cpp:974
TVector3 GetSCVector() const
Definition: KVPosition.h:106
Double_t GetThetaMin() const
Definition: KVPosition.h:150
virtual Double_t GetSinTheta() const
Definition: KVPosition.h:164
Double_t GetOC_SC_CosAngle() const
Definition: KVPosition.h:110
virtual TVector3 GetSurfaceNormal() const
Definition: KVPosition.cpp:945
virtual Double_t GetMisalignmentAngle() const
Double_t fTheta_min
polar angle in degrees corresponding to edge of telescope closest to beam axis
Definition: KVPosition.h:95
Double_t GetAzimuthalWidth(Double_t phmin=-1., Double_t phimax=-1.) const
Definition: KVPosition.cpp:612
Bool_t IsInPolarRange(const Double_t theta)
kTRUE if given angle theta is within the polar range of this solid angle element
Definition: KVPosition.cpp:362
virtual void SetPolarWidth(Double_t pw)
Definition: KVPosition.cpp:147
Bool_t IsAlignedWith(KVPosition *pos)
kTRUE if one of the two solid angle elements is completely contained within the other.
Definition: KVPosition.cpp:395
Double_t fTheta_max
polar angle in degrees of the edge furthest from the beam axis
Definition: KVPosition.h:96
void SetTheta(Double_t t)
Definition: KVPosition.h:178
Double_t fPhi
azimuthal angle in degrees with respect to 12 o'clock (=0 deg.), corresponds to centre of telescope
Definition: KVPosition.h:94
TGeoBBox * fShape
shape of detector volume
Definition: KVPosition.h:103
void SetPhi(Double_t p)
Definition: KVPosition.h:182
void SetPhiMinMax(Double_t min, Double_t max)
Definition: KVPosition.h:126
virtual void SetPolarMinMax(Double_t min, Double_t max)
Set min and max polar angles and calculate (mean) theta.
Definition: KVPosition.cpp:171
virtual void SetMatrix(const TGeoHMatrix *)
Definition: KVPosition.cpp:702
virtual TGeoBBox * GetShape() const
Definition: KVPosition.cpp:790
Double_t fPhi_max
azimuthal angle in degrees corresponding to most clockwise edge of telescope
Definition: KVPosition.h:98
virtual Double_t GetCosTheta() const
Definition: KVPosition.h:168
Double_t fPhi_min
azimuthal angle in degrees corresponding to most anticlockwise edge of telescope
Definition: KVPosition.h:97
virtual ~KVPosition()
Definition: KVPosition.cpp:58
Bool_t IsOverlappingWith(KVPosition *pos)
kTRUE if there is at least partial overlap between two solid angle elements
Definition: KVPosition.cpp:408
Double_t fDistance
distance in cm from centre of solid angle element to coordinate system origin (target)
Definition: KVPosition.h:99
void GetCornerCoordinatesInOwnFrame(TVector3 *, Double_t=0)
Definition: KVPosition.cpp:544
void init()
default initialiser
Definition: KVPosition.cpp:43
Double_t GetThetaMax() const
Definition: KVPosition.h:154
virtual TVector3 GetDirection()
Definition: KVPosition.cpp:463
virtual TVector3 GetRandomPointOnSurface() const
Definition: KVPosition.cpp:813
Double_t Dot(const TVector3 &) const
TVector3 Unit() const
SVector< T, D > Unit(const SVector< T, D > &rhs)
double min(double x, double y)
double max(double x, double y)
constexpr Double_t DegToRad()
Double_t Cos(Double_t)
Double_t Sin(Double_t)