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

#include <MaxNPEWindow.h>

Inheritance diagram for flashmatch::MaxNPEWindow:
flashmatch::BaseFlashFilter flashmatch::BaseAlgorithm flashmatch::LoggerFeature

Public Member Functions

 MaxNPEWindow (const std::string name="MaxNPEWindow")
 Default constructor. More...
 
 ~MaxNPEWindow ()
 Default destructor. More...
 
IDArray_t Filter (const FlashArray_t &)
 Implementation of a virtual function. More...
 
- Public Member Functions inherited from flashmatch::BaseFlashFilter
 BaseFlashFilter (const std::string name="noname")
 Default constructor. More...
 
virtual ~BaseFlashFilter ()
 Default destructor. More...
 
- Public Member Functions inherited from flashmatch::BaseAlgorithm
 BaseAlgorithm (const Algorithm_t type, const std::string name)
 Default constructor. More...
 
 ~BaseAlgorithm ()
 Default destructor. More...
 
void Configure (const Config_t &pset)
 Function to accept configuration. More...
 
Algorithm_t AlgorithmType () const
 Algorithm type. More...
 
const std::string & AlgorithmName () const
 Algorithm name. More...
 
- Public Member Functions inherited from flashmatch::LoggerFeature
 LoggerFeature (const std::string logger_name="LoggerFeature")
 Default constructor. More...
 
 LoggerFeature (const LoggerFeature &original)
 Default copy constructor. More...
 
virtual ~LoggerFeature ()
 Default destructor. More...
 
const flashmatch::loggerlogger () const
 Logger getter. More...
 
void set_verbosity (::flashmatch::msg::Level_t level)
 Verbosity level. More...
 
const std::string & name () const
 Name getter, defined in a logger instance attribute. More...
 

Protected Member Functions

void _Configure_ (const Config_t &pset)
 

Private Attributes

double _time_lower_bound
 T1 [us]: the lower edge of the opened time window. More...
 
double _time_upper_bound
 T2 [us]: the upper edge of the opened time window. More...
 
double _npe_threshold
 threshold [p.e.]: to ignore any flash below this value More...
 

Detailed Description

Type flashmatch::BaseFlashFilter algorithm class. It applies a very simple
filter based on time window to eliminate multiple flashes coming from the
same interaction. The algorithm works in the following steps:
0) Order a list of provided flash using the amount photoelectrons
(the bigger, the higher priority).
1) Loop over the list of flashes in high=>low priority order.
1.1) For each flash, attempt to open a time window T1 => T2 w.r.t.
flash time where T1 & T2 are configured via user
1.2) If a flash falls within any of previously-opened time window,
ignore this flash.
1.3) Terminate the loop when the number of photoelectrons drops below
the threshold set by a user.

Definition at line 50 of file MaxNPEWindow.h.

Constructor & Destructor Documentation

flashmatch::MaxNPEWindow::MaxNPEWindow ( const std::string  name = "MaxNPEWindow")

Default constructor.

Definition at line 13 of file MaxNPEWindow.cxx.

15  , _time_lower_bound(-0.1) // Default T1 in micro-second
16  , _time_upper_bound(8.) // Default T2 in micro-second
17  , _npe_threshold(10) // Default # p.e. as a threshold
18  {}
double _time_upper_bound
T2 [us]: the upper edge of the opened time window.
Definition: MaxNPEWindow.h:70
double _npe_threshold
threshold [p.e.]: to ignore any flash below this value
Definition: MaxNPEWindow.h:71
double _time_lower_bound
T1 [us]: the lower edge of the opened time window.
Definition: MaxNPEWindow.h:69
BaseFlashFilter(const std::string name="noname")
Default constructor.
const std::string & name() const
Name getter, defined in a logger instance attribute.
Definition: LoggerFeature.h:51
flashmatch::MaxNPEWindow::~MaxNPEWindow ( )
inline

Default destructor.

Definition at line 58 of file MaxNPEWindow.h.

58 {}

Member Function Documentation

void flashmatch::MaxNPEWindow::_Configure_ ( const Config_t pset)
protectedvirtual

Implements flashmatch::BaseAlgorithm.

Definition at line 20 of file MaxNPEWindow.cxx.

21  {
22  _time_lower_bound = pset.get<double>("TimeLowerBound");
23  _time_upper_bound = pset.get<double>("TimeUpperBound");
24  _npe_threshold = pset.get<double>("NPEThreshold" );
25  }
double _time_upper_bound
T2 [us]: the upper edge of the opened time window.
Definition: MaxNPEWindow.h:70
double _npe_threshold
threshold [p.e.]: to ignore any flash below this value
Definition: MaxNPEWindow.h:71
double _time_lower_bound
T1 [us]: the lower edge of the opened time window.
Definition: MaxNPEWindow.h:69
IDArray_t flashmatch::MaxNPEWindow::Filter ( const FlashArray_t flash_v)
virtual

Implementation of a virtual function.

Implements flashmatch::BaseFlashFilter.

Definition at line 27 of file MaxNPEWindow.cxx.

28  {
29  // order flash via npe
30  std::multimap<double,ID_t> npe_map;
31  // Loop over flash array
32  for(size_t index=0; index<flash_v.size(); ++index) {
33 
34  auto const& flash = flash_v[index]; // Retrieve this flash
35 
36  double npe = std::accumulate(flash.pe_v.begin(),flash.pe_v.end(),0.0); // Sum p.e.
37 
38  if(npe < _npe_threshold) continue; // Ignore if below threshold
39 
40  npe_map.emplace( 1./npe, index ); // Use inverse of npe to order high=>low
41 
42  }
43 
44  // Prepare a return flashmatch::IDArray_t object
45  IDArray_t ordered_index_v;
46  ordered_index_v.reserve(npe_map.size()); // reserve for fast push_back
47 
48  TimeRangeSet trs; // Use TimeRange utility to detect overlap windows
49  for(auto const& npe_index : npe_map) {
50 
51  auto const& flash = flash_v[npe_index.second]; // retrieve flash
52 
53  if(trs.Overlap(flash.time)) continue; // if within defined set of windows, ignore
54 
55  ordered_index_v.push_back(npe_index.second); // candidate: add to a list
56 
57  // update TimeRangeSet to keep track of windows.
58  trs.Insert( TimeRange(flash.time + _time_lower_bound,
59  flash.time + _time_upper_bound) );
60  }
61 
62  return ordered_index_v;
63  }
double _time_upper_bound
T2 [us]: the upper edge of the opened time window.
Definition: MaxNPEWindow.h:70
double _npe_threshold
threshold [p.e.]: to ignore any flash below this value
Definition: MaxNPEWindow.h:71
double _time_lower_bound
T1 [us]: the lower edge of the opened time window.
Definition: MaxNPEWindow.h:69
std::vector< flashmatch::ID_t > IDArray_t
Index collection.

Member Data Documentation

double flashmatch::MaxNPEWindow::_npe_threshold
private

threshold [p.e.]: to ignore any flash below this value

Definition at line 71 of file MaxNPEWindow.h.

double flashmatch::MaxNPEWindow::_time_lower_bound
private

T1 [us]: the lower edge of the opened time window.

Definition at line 69 of file MaxNPEWindow.h.

double flashmatch::MaxNPEWindow::_time_upper_bound
private

T2 [us]: the upper edge of the opened time window.

Definition at line 70 of file MaxNPEWindow.h.


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