KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVPosition.h
Go to the documentation of this file.
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 
90 class KVPosition {
91 private:
93  mutable Double_t fPhi;
99 
100  /* ROOT Geometry */
104 
106  {
107  return GetVolumeCentre() - GetSurfaceCentre();
108  }
110  {
111  return GetVolumeCentre().Unit().Dot(GetSCVector().Unit());
112  }
113 
114 public:
115  KVPosition();
116  KVPosition(Double_t thmin, Double_t thmax, Double_t phmin, Double_t phmax, Double_t dist = 0.0);
117  void init();
118  virtual ~KVPosition();
119  virtual void SetAzimuthalAngle(Double_t ph);
120  virtual void SetPolarAngle(Double_t th);
121  virtual void SetPolarWidth(Double_t pw);
122  virtual void SetPolarMinMax(Double_t min, Double_t max);
123  virtual void SetAzimuthalWidth(Double_t aw);
124  virtual void SetAzimuthalMinMax(Double_t min, Double_t max);
126  {
127  SetAzimuthalMinMax(min, max);
128  }
129  virtual TVector3 GetRandomDirection(Option_t* t = "isotropic");
131  virtual void GetRandomAngles(Double_t& th, Double_t& ph, Option_t* t = "isotropic");
132  virtual TVector3 GetDirection();
133 
134  Bool_t IsInPolarRange(const Double_t theta);
135  Bool_t IsInPhiRange(const Double_t phi);
140 
141  inline Double_t GetPhiMin() const
142  {
143  return fPhi_min;
144  }
145  inline Double_t GetPhiMax() const
146  {
147  return fPhi_max;
148  }
149  inline Double_t GetThetaMin() const
150  {
151  return fTheta_min;
152  }
153  inline Double_t GetThetaMax() const
154  {
155  return fTheta_max;
156  }
157  Double_t GetAzimuthalWidth(Double_t phmin = -1., Double_t phimax =
158  -1.) const;
159  virtual Double_t GetTheta() const
160  {
161  return fTheta;
162  }
163  virtual Double_t GetSinTheta() const
164  {
165  return TMath::Sin(fTheta * TMath::DegToRad());
166  }
167  virtual Double_t GetCosTheta() const
168  {
169  return TMath::Cos(fTheta * TMath::DegToRad());
170  }
171  virtual Double_t GetPhi() const
172  {
173  if (fPhi >= 360.0)
174  fPhi -= 360.;
175  return fPhi;
176  }
178  {
179  SetPolarAngle(t);
180  }
181  void SetPhi(Double_t p)
182  {
184  }
186  {
187  fDistance = d;
188  }
189  virtual Double_t GetDistance(void) const
190  {
191  return fDistance;
192  }
193  void GetCornerCoordinates(TVector3*, Double_t /*depth*/ = 0);
194  void GetCornerCoordinatesInOwnFrame(TVector3*, Double_t /*depth*/ = 0);
195  void GetWidthsFromDimension(Double_t lin_dim);
196 
197  virtual Double_t GetSolidAngle(void) const;
198 
199  /* ROOT Geometry */
200  Bool_t ROOTGeo() const;
201  virtual void SetMatrix(const TGeoHMatrix*);
202  virtual void SetShape(TGeoBBox*);
203  virtual TGeoHMatrix* GetMatrix() const;
204  virtual TGeoBBox* GetShape() const;
205  virtual TVector3 GetRandomPointOnSurface() const;
206  virtual TVector3 GetSurfaceCentre() const;
207  virtual TVector3 GetVolumeCentre() const;
208  virtual TVector3 GetSurfaceNormal() const;
209  virtual Double_t GetSurfaceArea(int npoints = 100000) const;
210  virtual Double_t GetMisalignmentAngle() const;
211 
212  ClassDef(KVPosition, 1)//Class handling geometry of detectors in a multidetector array
213 };
214 
215 #endif
#define d(i)
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
Base class used for handling geometry in a multidetector array.
Definition: KVPosition.h:90
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:159
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:92
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:185
TRotation GetRandomIsotropicRotation()
Definition: KVPosition.cpp:665
virtual void SetPolarAngle(Double_t th)
Definition: KVPosition.cpp:96
virtual Double_t GetPhi() const
Definition: KVPosition.h:171
Double_t GetPhiMax() const
Definition: KVPosition.h:145
virtual Double_t GetDistance(void) const
Definition: KVPosition.h:189
Double_t fSolidAngle
solid angle = area of entrance window / distance**2
Definition: KVPosition.h:103
TGeoHMatrix * fMatrix
transform world<->detector coordinates
Definition: KVPosition.h:101
Double_t GetPhiMin() const
Definition: KVPosition.h:141
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:105
Double_t GetThetaMin() const
Definition: KVPosition.h:149
virtual Double_t GetSinTheta() const
Definition: KVPosition.h:163
Double_t GetOC_SC_CosAngle() const
Definition: KVPosition.h:109
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:94
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:95
void SetTheta(Double_t t)
Definition: KVPosition.h:177
Double_t fPhi
azimuthal angle in degrees with respect to 12 o'clock (=0 deg.), corresponds to centre of telescope
Definition: KVPosition.h:93
TGeoBBox * fShape
shape of detector volume
Definition: KVPosition.h:102
void SetPhi(Double_t p)
Definition: KVPosition.h:181
void SetPhiMinMax(Double_t min, Double_t max)
Definition: KVPosition.h:125
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:97
virtual Double_t GetCosTheta() const
Definition: KVPosition.h:167
Double_t fPhi_min
azimuthal angle in degrees corresponding to most anticlockwise edge of telescope
Definition: KVPosition.h:96
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:98
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:153
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)
constexpr Double_t DegToRad()
Double_t Cos(Double_t)
Double_t Sin(Double_t)