All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
evgen::ldm::RayTraceBox Class Reference

RayTraceBox class definiton. More...

Inheritance diagram for evgen::ldm::RayTraceBox:
evgen::ldm::IRayTrace evgen::ldm::IMeVPrtlStage

Public Member Functions

 RayTraceBox (fhicl::ParameterSet const &pset)
 Constructor. More...
 
 ~RayTraceBox ()
 Destructor. More...
 
void configure (const fhicl::ParameterSet &) override
 Interface for configuring the particular algorithm tool. More...
 
bool IntersectDetector (MeVPrtlFlux &flux, std::array< TVector3, 2 > &intersection, double &weight) override
 
double MaxWeight () override
 
- Public Member Functions inherited from evgen::ldm::IRayTrace
virtual ~IRayTrace () noexcept=default
 Virtual Destructor. More...
 
- Public Member Functions inherited from evgen::ldm::IMeVPrtlStage
virtual ~IMeVPrtlStage () noexcept
 Virtual Destructor. More...
 
 IMeVPrtlStage (const char *name)
 
TVector3 RandomUnitVector ()
 
double GetRandom ()
 
const char * Name ()
 

Private Attributes

geo::BoxBoundedGeo fBox
 

Additional Inherited Members

- Protected Attributes inherited from evgen::ldm::IMeVPrtlStage
CLHEP::HepRandomEngine * fEngine
 
const char * fName
 

Detailed Description

RayTraceBox class definiton.

Definition at line 38 of file RayTraceBox_tool.cc.

Constructor & Destructor Documentation

evgen::ldm::RayTraceBox::RayTraceBox ( fhicl::ParameterSet const &  pset)

Constructor.

Definition at line 62 of file RayTraceBox_tool.cc.

62  :
63  IMeVPrtlStage("RayTraceBox")
64 {
65  this->configure(pset);
66 }
void configure(const fhicl::ParameterSet &) override
Interface for configuring the particular algorithm tool.
IMeVPrtlStage(const char *name)
Definition: IMeVPrtlStage.h:46
evgen::ldm::RayTraceBox::~RayTraceBox ( )

Destructor.

Definition at line 70 of file RayTraceBox_tool.cc.

71 {
72 }

Member Function Documentation

void evgen::ldm::RayTraceBox::configure ( const fhicl::ParameterSet &  )
overridevirtual

Interface for configuring the particular algorithm tool.

Parameters
ParameterSetThe input set of parameters for configuration

Implements evgen::ldm::IMeVPrtlStage.

Definition at line 75 of file RayTraceBox_tool.cc.

76 {
77  if (pset.has_key("Box")) {
78  std::array<double, 6> box_config = pset.get<std::array<double, 6>>("Box");
79  // xmin, xmax, ymin, ymax, zmin, zmax
80  fBox = geo::BoxBoundedGeo(box_config[0], box_config[1], box_config[2], box_config[3], box_config[4], box_config[5]);
81  }
82  else {
83  const geo::GeometryCore *geometry = lar::providerFrom<geo::Geometry>();
84  fBox = geometry->DetectorEnclosureBox(pset.get<std::string>("Volume"));
85  }
86 
87  std::cout << "Detector Box." << std::endl;
88  std::cout << "X " << fBox.MinX() << " " << fBox.MaxX() << std::endl;
89  std::cout << "Y " << fBox.MinY() << " " << fBox.MaxY() << std::endl;
90  std::cout << "Z " << fBox.MinZ() << " " << fBox.MaxZ() << std::endl;
91 
92 }
const geo::GeometryCore * geometry
geo::BoxBoundedGeo DetectorEnclosureBox(std::string const &name="volDetEnclosure") const
geo::BoxBoundedGeo fBox
Description of geometry of one entire detector.
A base class aware of world box coordinatesAn object describing a simple shape can inherit from this ...
Definition: BoxBoundedGeo.h:33
BEGIN_PROLOG could also be cout
bool evgen::ldm::RayTraceBox::IntersectDetector ( MeVPrtlFlux flux,
std::array< TVector3, 2 > &  intersection,
double &  weight 
)
overridevirtual

Implements evgen::ldm::IRayTrace.

Definition at line 95 of file RayTraceBox_tool.cc.

95  {
96  std::vector<TVector3> box_intersections = fBox.GetIntersections(flux.pos.Vect(), flux.mom.Vect().Unit());
97 
98  if (box_intersections.size() != 2) return false;
99 
100  TVector3 A = box_intersections[0];
101  TVector3 B = box_intersections[1];
102 
103  // make sure that the flux start lies outside the detector
104  if ((flux.pos.Vect() - A).Mag() < (A-B).Mag() && (flux.pos.Vect() - B).Mag() < (A-B).Mag()) {
105  throw cet::exception("RayTraceBox Exception", "Input portal flux starts inside detector volume: "
106  "MeVPrtl start At: (" + std::to_string(flux.pos.X()) + ", " + std::to_string(flux.pos.Y()) + ", " + std::to_string(flux.pos.Z()) + "). "
107  "Intersection A At: " + std::to_string(A.X()) + ", " + std::to_string(A.Y()) + ", " + std::to_string(A.Z()) + "). "
108  "Intersection B At: " + std::to_string(B.X()) + ", " + std::to_string(B.Y()) + ", " + std::to_string(B.Z()) + ").\n"
109  );
110  }
111 
112  // if the ray points the wrong way, it doesn't intersect
113  if (flux.mom.Vect().Unit().Dot((A - flux.pos.Vect()).Unit()) < 0.) {
114  std::cout << "RAYTRACE: MeVPrtl points wrong way" << std::endl;
115  return false;
116  }
117 
118  if ((flux.pos.Vect() - A).Mag() < (flux.pos.Vect() - B).Mag()) {
119  intersection = {A, B}; // A is entry, B is exit
120  }
121  else {
122  intersection = {B, A}; // reversed
123  }
124 
125  weight = 1.;
126  return true;
127 }
geo::BoxBoundedGeo fBox
std::string to_string(WindowPattern const &pattern)
std::vector< TVector3 > GetIntersections(TVector3 const &TrajectoryStart, TVector3 const &TrajectoryDirect) const
Calculates the entry and exit points of a trajectory on the box surface.
float A
Definition: dedx.py:137
BEGIN_PROLOG could also be cout
double evgen::ldm::RayTraceBox::MaxWeight ( )
inlineoverridevirtual

Implements evgen::ldm::IMeVPrtlStage.

Definition at line 56 of file RayTraceBox_tool.cc.

56 { return -1.; }

Member Data Documentation

geo::BoxBoundedGeo evgen::ldm::RayTraceBox::fBox
private

Definition at line 59 of file RayTraceBox_tool.cc.


The documentation for this class was generated from the following file: