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

#include <TimeRange.h>

Public Member Functions

 TimeRangeSet ()
 
 ~TimeRangeSet ()
 
void Print () const
 
bool Overlap (const flashmatch::TimeRange &range) const
 
bool Overlap (double time) const
 
void Insert (const flashmatch::TimeRange &range)
 

Private Attributes

std::vector
< flashmatch::TimeRange
_time_range_v
 

Detailed Description

Definition at line 71 of file TimeRange.h.

Constructor & Destructor Documentation

flashmatch::TimeRangeSet::TimeRangeSet ( )
inline

Definition at line 74 of file TimeRange.h.

74 {}
flashmatch::TimeRangeSet::~TimeRangeSet ( )
inline

Definition at line 76 of file TimeRange.h.

76 {}

Member Function Documentation

void flashmatch::TimeRangeSet::Insert ( const flashmatch::TimeRange range)
inline

Definition at line 104 of file TimeRange.h.

105  {
106  auto low = std::lower_bound(_time_range_v.begin(),
107  _time_range_v.end(),
108  range);
109 
110  if(low == _time_range_v.end()) {
111  _time_range_v.push_back(range);
112  return;
113  }
114 
115  // Check if found one is overlapping
116  if(range.End() < (*low).Start()){
117 
118  double next_start=0;
119  double next_end =0;
120  double start=range.Start();
121  double end=range.End();
122  while(low != _time_range_v.end()) {
123  next_start = (*low).Start();
124  next_end = (*low).End();
125  (*low).SetRange(start,end);
126  start = next_start;
127  end = next_end;
128  ++low;
129  }
130  _time_range_v.push_back(TimeRange(start,end));
131  }else{
132 
133  if((*low).Start() <= range.End()) {
134 
135  (*low).SetRange(std::min((*low).Start(),range.Start()),
136  std::max((*low).End(),range.End()));
137 
138  // If this overlaps with previous window, set it to previous window's max boundary
139  size_t dist = std::distance(_time_range_v.begin(),low);
140  if(dist) {
141  auto prev = low-1;
142  if((*prev).End() > (*low).Start()) (*low).SetRange((*prev).End(),(*low).End());
143  }
144 
145  // If this overlaps with next window, set it to next window's min boundary
146  if( (dist+1) < _time_range_v.size() ) {
147  auto next = low+1;
148  if((*low).End() > (*next).Start()) (*low).SetRange((*low).Start(),(*next).Start());
149  }
150  }
151  }
152  }
double Start() const
Definition: TimeRange.h:48
double End() const
Definition: TimeRange.h:50
standard_dbscan3dalg useful for diagnostics hits not in a line will not be clustered on on only for track like only for track like on on the smaller the less shower like tracks low
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
std::vector< flashmatch::TimeRange > _time_range_v
Definition: TimeRange.h:156
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
bool flashmatch::TimeRangeSet::Overlap ( const flashmatch::TimeRange range) const
inline

Definition at line 86 of file TimeRange.h.

87  {
88  auto low = std::lower_bound(_time_range_v.begin(),
89  _time_range_v.end(),
90  range);
91  if(low == _time_range_v.end()) return false;
92  if(range.End() >= (*low).Start()) return true;
93  return false;
94  }
double End() const
Definition: TimeRange.h:50
standard_dbscan3dalg useful for diagnostics hits not in a line will not be clustered on on only for track like only for track like on on the smaller the less shower like tracks low
std::vector< flashmatch::TimeRange > _time_range_v
Definition: TimeRange.h:156
bool flashmatch::TimeRangeSet::Overlap ( double  time) const
inline

Definition at line 96 of file TimeRange.h.

97  { auto low = std::lower_bound(_time_range_v.begin(),
98  _time_range_v.end(),
99  time);
100  if(low == _time_range_v.end()) return false;
101  return ((*low).Start() <= time && time <= (*low).End());
102  }
standard_dbscan3dalg useful for diagnostics hits not in a line will not be clustered on on only for track like only for track like on on the smaller the less shower like tracks low
std::vector< flashmatch::TimeRange > _time_range_v
Definition: TimeRange.h:156
void flashmatch::TimeRangeSet::Print ( ) const
inline

Definition at line 80 of file TimeRange.h.

81  {
82  for(auto const& r : _time_range_v)
83  std::cout<<r.Start()<<" => "<<r.End()<<std::endl;
84  }
std::vector< flashmatch::TimeRange > _time_range_v
Definition: TimeRange.h:156
esac echo uname r
BEGIN_PROLOG could also be cout

Member Data Documentation

std::vector<flashmatch::TimeRange> flashmatch::TimeRangeSet::_time_range_v
private

Definition at line 156 of file TimeRange.h.


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