ATLAS Offline Software
Loading...
Searching...
No Matches
InDetDD::SegmentSplitter Class Reference

#include <VolumeSplitterUtils.h>

Collaboration diagram for InDetDD::SegmentSplitter:

Public Member Functions

const SegmentListsplit (const Zone *, const Ray &)

Private Member Functions

Ray addChildSegment (const Zone *, const Ray &)
void addSegment (const Zone *, const Point &start, const Point &end)
Point getNextBoundary (const Zone *, const Ray &)
Ray searchPoint (const Zone *zone, const Ray &ray)
Point nearestPoint (const Point &point1, const Point &point2)

Private Attributes

SegmentList m_segments

Detailed Description

Definition at line 174 of file VolumeSplitterUtils.h.

Member Function Documentation

◆ addChildSegment()

Ray InDetDD::SegmentSplitter::addChildSegment ( const Zone * zone,
const Ray & ray )
private

Definition at line 19 of file VolumeSplitterUtils.cxx.

19 {
20 //std::cout << "addChildSegment: " << zone->label() << " " << ray << std::endl;
21 // Point startPoint = ray.start();
22 // If start point is not yet know to be in current zone. We need to search children.
23 // If not in children searchPoint will return a copy of ray. Otherwise it will
24 // add segments of the child and return a ray that starts from the exit of the child.
25 Ray nextRay = ray;
26
27 if (!ray.foundStart()) {
28 nextRay = searchPoint(zone, ray);
29 }
30 bool exit = false;
31 while (nextRay.valid() && !exit) {
32 Point nextPoint = getNextBoundary(zone, nextRay);
33 addSegment(zone, nextRay.start(), nextPoint);
34
35 //std::cout << "Next boundary: " << nextPoint;
36 //if (nextPoint.last()) std::cout << " Last ";
37 //if (nextPoint.exit()) std::cout << " Exit ";
38 //if (nextPoint.child()) std::cout << " Child: " << nextPoint.child()->label();
39 //std::cout << std::endl;
40
41 if (nextPoint.last()) { // last indicates end of ray. ie ray ended before exit or child entry.
42 nextRay.setInvalid();
43 } else {
44 nextRay.set(nextPoint, nextRay.end());
45 }
46 exit = nextPoint.exit();
47 if (nextPoint.child()) {
48 nextRay = addChildSegment(nextPoint.child(), nextRay);
49 }
50 }
51 return nextRay;
52 }
ChargedTracksWeightFilter::Spline::Point Point
void addSegment(const Zone *, const Point &start, const Point &end)
Ray searchPoint(const Zone *zone, const Ray &ray)
Point getNextBoundary(const Zone *, const Ray &)
Ray addChildSegment(const Zone *, const Ray &)

◆ addSegment()

void InDetDD::SegmentSplitter::addSegment ( const Zone * zone,
const Point & start,
const Point & end )
private

Definition at line 55 of file VolumeSplitterUtils.cxx.

55 {
56 m_segments.add(zone->label(), start, end, zone->rotated());
57 }

◆ getNextBoundary()

Point InDetDD::SegmentSplitter::getNextBoundary ( const Zone * zone,
const Ray & ray )
private

Definition at line 60 of file VolumeSplitterUtils.cxx.

60 {
61 Point nextPoint; //invalid
62
63 // Search children
64 for (Zone::ChildIterator iter = zone->begin(); iter != zone->end(); ++iter) {
65 const Zone* child = *iter;
66 // return invalid if not crossed.
67 Point newPoint = child->findEntry(ray);
68 nextPoint = nearestPoint(newPoint, nextPoint);
69 }
70 //search exit
71 nextPoint = nearestPoint(zone->findExit(ray), nextPoint);
72 if (!nextPoint.valid()) {
73 // Return endpoint
74 return ray.end();
75 }
76 return nextPoint;
77 }
Point nearestPoint(const Point &point1, const Point &point2)
std::vector< constZone * >::const_iterator ChildIterator

◆ nearestPoint()

Point InDetDD::SegmentSplitter::nearestPoint ( const Point & point1,
const Point & point2 )
private

Definition at line 80 of file VolumeSplitterUtils.cxx.

80 {
81 if (!point2.valid()) return point1;
82
83 if (!point1.valid()) return point2;
84
85 if ((point2.r() == point1.r() && point2.z() < point1.z()) ||
86 (point2.z() == point1.z() && point2.r() < point1.r())) {
87 return point2;
88 }
89 return point1;
90 //return first point. If either invalid return the other.
91 // If both invalid return invalid
92 }

◆ searchPoint()

Ray InDetDD::SegmentSplitter::searchPoint ( const Zone * zone,
const Ray & ray )
private

Definition at line 95 of file VolumeSplitterUtils.cxx.

95 {
96 // If not found in children return original ray.
97 //std::cout << "Searching for point " << ray.start() << std::endl;
98 Ray nextRay = ray;
99
100 for (Zone::ChildIterator iter = zone->begin(); iter != zone->end(); ++iter) {
101 const Zone* child = *iter;
102 if (child->inSide(ray.start())) {
103 //std::cout << "Point " << ray.start() << " found in zone " << child->label() << std::endl;
104 nextRay = addChildSegment(child, ray);
105 break;
106 }
107 }
108 nextRay.setFound();
109 return nextRay;
110 }

◆ split()

const SegmentList & InDetDD::SegmentSplitter::split ( const Zone * zone,
const Ray & ray )

Definition at line 13 of file VolumeSplitterUtils.cxx.

13 {
14 addChildSegment(zone, ray);
15 return m_segments;
16 }

Member Data Documentation

◆ m_segments

SegmentList InDetDD::SegmentSplitter::m_segments
private

Definition at line 187 of file VolumeSplitterUtils.h.


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