MDetector/Scintillator.h
Go to the documentation of this file.
1 #ifndef _mdet_Scintillator_h
2 #define _mdet_Scintillator_h
3 
4 #include <det/VManager.h>
5 #include <det/MPositionable.h>
6 //
7 #include <mdet/MDetectorComponent.h>
8 //
9 #include <utl/Point.h>
10 #include <utl/Plane.h>
11 #include <utl/Line.h>
12 #include <utl/Vector.h>
13 #include <utl/Segment.h>
14 #include <utl/CoordinateSystemPtr.h>
15 #include <utl/Validated.h>
16 //
17 #include <string>
18 #include <utility>
19 
20 namespace det {
21  struct ParentCreator;
22  struct ComponentUpdater;
23 }
24 
25 namespace mdet {
26 
27  class Module;
46  class Scintillator:
47  public MDetectorComponent<Scintillator>::Type,
48  public det::MPositionable<Scintillator>
49  {
50  public:
51 
52  static const char* const kComponentName;
53 
54  static const char* const kComponentId;
78  bool Contains(const utl::Point& point) const;
82  bool IntersectedBy(const utl::Line& line) const;
110  double ComputeUndergroundGrammageFor(const utl::Line& l) const;
116  double GetArea() const;
185  template<class V>
186  V& VisitShape(V& v) const {
187  /*
188  * When more shapes (if ever!) came up this code should be changed
189  * accordingly to handle them. This could be done with virtual functions
190  * , an ugly flag-based switch-case (that could be enough),
191  * typelists (http://www.ddj.com/cpp/184403813) or anything else.
192  * In any case, that decission would be kept here and won't spread in client
193  * code: that would have to define the proper functions for the new shapes,
194  * but I will only know about a unique Scintillator class-type.
195  */
196  // Up to now, just a box...
197  v.Box(*this, GetWidth(), GetLength(), GetHeight());
198  return v;
199  }
201 
204  double ComputeDecayDelay() const;
217  double GetDecayDelayMean() const;
223  double GetDecayDelayStdDev() const;
227  const Module& GetModule() const;
228  private:
249  Scintillator(int sId, const det::VManager::IndexMap& parentMap, const Module& parent);
261  friend struct det::ParentCreator;
267  template<class T>
268  friend void boost::checked_delete(T*) BOOST_NOEXCEPT;
270  friend struct det::ComponentUpdater;
284  template<class Container>
285  void IntersectionHelper(
286  Container& v,
287  const utl::Line& l, utl::Plane (Scintillator::* ComputePlane)() const ) const;
296  bool InExtent(double ext, const utl::Vector& pLocal, const utl::Vector& normal) const;
301  bool OnSide(const utl::Plane& sidePlane, const utl::Line& line) const;
305  utl::Plane ComputeGroundPlane() const;
312  utl::Plane ComputeTopPlane() const;
320  utl::Plane ComputeBottomPlane() const;
327  utl::Plane ComputeFrontPlane() const;
335  utl::Plane ComputeBackPlane() const;
342  utl::Plane ComputeRightPlane() const;
350  utl::Plane ComputeLeftPlane() const;
359  utl::Plane ComputePlaneHelper(double ext, double x, double y, double z) const;
372  double GetLength() const;
379  double GetWidth() const;
386  double GetHeight() const;
388 
391  double GetLocalSoilDensity() const;
395  double GetDecayTime() const;
399  double GetEpsilon() const;
403  bool IsCloseTo(double a, double b) const;
407  bool Intersects(const utl::Plane& p, const utl::Line& l) const;
408 
409  mutable utl::Validated<double> fLength;
410 
411  mutable utl::Validated<double> fWidth;
412 
413  mutable utl::Validated<double> fHeight;
414 
415  mutable utl::Validated<double> fLocalSoilDensity;
416 
417  mutable utl::Validated<double> fDecayTime;
418 
419  mutable utl::Validated<double> fEpsilon;
420 
421  const Module& fModule;
422  };
423 
424 }
425 
426 #endif // _mdet_Scintillator_h
427 
double Plane(const utl::Point &point, const utl::Vector &normal, const utl::Photon &photonIn, utl::Photon &photonOut)
Definition: RTFunctions.cc:41
Point object.
Definition: Point.h:32
bool IntersectedBy(const utl::Line &line) const
Answers if line crosses the body of the Scintillator.
bool InExtent(double ext, const utl::Vector &pLocal, const utl::Vector &normal) const
Checks if the vector lies within Scintillator&#39;s extent for the given axis.
utl::Validated< double > fLength
bool OnSide(const utl::Plane &sidePlane, const utl::Line &line) const
Indicates whether the line hits the Scintillator on the side contained in sidePlane.
bool IsCloseTo(double a, double b) const
FP Comparison criteria.
utl::Plane ComputeBottomPlane() const
The plane where the bottom of the Scintillator lays.
utl::Plane ComputeBackPlane() const
The plane where the back of the Scintillator lays.
utl::Plane ComputeTopPlane() const
The plane where the top of the Scintillator lays.
bool Contains(const utl::Point &point) const
Answers if point lies within the Scintillator.
double GetDecayTime() const
Characteristic decay time.
Mixin class to be inherited from objects that have a position.
Defines within it the common (templated) type for muon detector hierarchy components.
utl::Plane ComputeLeftPlane() const
The plane where the left of the Scintillator lays.
void IntersectionHelper(Container &v, const utl::Line &l, utl::Plane(Scintillator::*ComputePlane)() const ) const
Helper function for another specific member.
double GetWidth() const
Width of the strip (x direction in the local coordinate system).
#define V
double GetHeight() const
Height of the strip (z direction in the local coordinate system).
double GetDecayDelayStdDev() const
The standard deviation fo the delay time.
double GetEpsilon() const
FP comparison limit.
Actual muon-sensitive objects.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
double GetLength() const
Length of the strip (y direction in the local coordinate system).
utl::Plane ComputeRightPlane() const
The plane where the right of the Scintillator lays.
utl::Plane ComputeGroundPlane() const
The (inifite) plane that coincides with the ground.
Array of Scintillator.
V & VisitShape(V &v) const
Callback method for inspecting shape-aware properties.
utl::Validated< double > fEpsilon
double GetArea() const
Compute Scintillator&#39;s total area in square metres.
static const char *const kComponentName
utl::Validated< double > fDecayTime
utl::Validated< double > fWidth
double GetDecayDelayMean() const
The mean value of the delay time.
std::string const
Returns the message that identifies this component.
utl::Segment ComputeIntersectionWith(const utl::Line &line) const
Computes the intersection of line within the Scintillator.
double ComputeUndergroundGrammageFor(const utl::Line &l) const
Computes the amount of mass transversed until reaching the Scintillator.
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
const Module & GetModule() const
Retrieve the parent mdet::Module.
double ComputeDecayDelay() const
Computes a delay due to decay process.
utl::Plane ComputeFrontPlane() const
The plane where the front of the Scintillator lays.
bool Intersects(const utl::Plane &p, const utl::Line &l) const
Check for intersection.
double GetLocalSoilDensity() const
Simplest density distribution: constant value.
Scintillator(int sId, const det::VManager::IndexMap &parentMap, const Module &parent)
Constructs the Scintillator (obviously!).
Type
The type of file that we are acutally opening.
Definition: IoCodes.h:33
utl::CoordinateSystemPtr GetReferenceCoordinateSystem() const
The reference is the local coordinate system of mdet::Module.
utl::Validated< double > fHeight
utl::Segment ComputeUndergroundIntersectionOf(const utl::Line &line) const
Computes the intersection of line with the ground (until reaching the Scintillator).
friend void boost::checked_delete(T *) BOOST_NOEXCEPT
Friendship for destruction.
utl::Validated< double > fLocalSoilDensity
utl::Plane ComputePlaneHelper(double ext, double x, double y, double z) const
Helper to construct the different planes.
Definition: Line.h:17
static const char *const kComponentId
The child the information from the parent upon construction.
A segment joins two points.
Definition: Segment.h:18

, generated on Tue Sep 26 2023.