Jpp  19.1.0
the software that should make you happy
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
JTRIGGER::JPreprocessor Struct Reference

Auxiliary class for specifying the way of pre-processing of hits. More...

#include <JPreprocessor.hh>

Inheritance diagram for JTRIGGER::JPreprocessor:

Public Types

enum  JOption_t { none_t = 0 , join_t , filter_t , remove_t }
 Preprocessing options. More...
 
typedef std::pair< JPreprocessor, JOption_tpair_type
 
typedef std::vector< pair_typedata_type
 

Public Member Functions

 JPreprocessor ()
 Default constructor. More...
 
 operator JOption_t () const
 Type conversion operator. More...
 

Static Public Member Functions

static JOption_t getOption (const JPreprocessor &option)
 Get option. More...
 
static JPreprocessor getOption (const JOption_t option)
 Get option. More...
 
static std::vector< JPreprocessorgetOptions ()
 Get options. More...
 
static std::vector< JPreprocessorgetOptions (const JOption_t option)
 Get options. More...
 

Protected Member Functions

 JPreprocessor (const std::string &option)
 Constructor. More...
 

Static Protected Member Functions

static const data_typeget_options ()
 Get paired options. More...
 

Static Protected Attributes

static const char ENUM_EXTENSION = '_'
 Extension of enumeration names. More...
 

Detailed Description

Auxiliary class for specifying the way of pre-processing of hits.

Definition at line 31 of file JPreprocessor.hh.

Member Typedef Documentation

◆ pair_type

Definition at line 45 of file JPreprocessor.hh.

◆ data_type

Definition at line 46 of file JPreprocessor.hh.

Member Enumeration Documentation

◆ JOption_t

Preprocessing options.

Enumerator
none_t 

no pre-processing

join_t 

join consecutive hits according match criterion

filter_t 

filter consecutive hits according match criterion

remove_t 

remove consecutive hits according match criterion

Definition at line 37 of file JPreprocessor.hh.

37  {
38  none_t = 0, //!< no pre-processing
39  join_t, //!< join consecutive hits according match criterion
40  filter_t, //!< filter consecutive hits according match criterion
41  remove_t //!< remove consecutive hits according match criterion
42  };
@ none_t
no pre-processing
@ filter_t
filter consecutive hits according match criterion
@ remove_t
remove consecutive hits according match criterion
@ join_t
join consecutive hits according match criterion

Constructor & Destructor Documentation

◆ JPreprocessor() [1/2]

JTRIGGER::JPreprocessor::JPreprocessor ( )
inline

Default constructor.

Definition at line 52 of file JPreprocessor.hh.

52  :
53  std::string(get_options()[0].first)
54  {}
static const data_type & get_options()
Get paired options.

◆ JPreprocessor() [2/2]

JTRIGGER::JPreprocessor::JPreprocessor ( const std::string &  option)
inlineprotected

Constructor.

Parameters
optionoption

Definition at line 155 of file JPreprocessor.hh.

155  :
156  std::string(option)
157  {
158  using namespace std;
159 
160  const string::size_type pos = this->rfind(ENUM_EXTENSION);
161 
162  if (pos != string::npos) {
163  this->erase(pos);
164  }
165  }
Definition: JSTDTypes.hh:14
static const char ENUM_EXTENSION
Extension of enumeration names.

Member Function Documentation

◆ operator JOption_t()

JTRIGGER::JPreprocessor::operator JOption_t ( ) const
inline

Type conversion operator.

Returns
option

Definition at line 62 of file JPreprocessor.hh.

63  {
64  return JPreprocessor::getOption(*this);
65  }
static JOption_t getOption(const JPreprocessor &option)
Get option.

◆ getOption() [1/2]

static JOption_t JTRIGGER::JPreprocessor::getOption ( const JPreprocessor option)
inlinestatic

Get option.

Parameters
optionoption
Returns
option

Definition at line 74 of file JPreprocessor.hh.

75  {
76  using namespace std;
77  using namespace JPP;
78 
79  data_type::const_iterator i = find_if(get_options().begin(),
80  get_options().end(),
81  make_predicate(&pair_type::first, JPreprocessor(option)));
82 
83  if (i != get_options().end()) {
84  return i->second;
85  } else {
86  THROW(JTypeInformationException, "Invalid option <" << option << ">");
87  }
88  };
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception for absence of type information.
Definition: JException.hh:648
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Definition: JPredicate.hh:128
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JPreprocessor()
Default constructor.

◆ getOption() [2/2]

static JPreprocessor JTRIGGER::JPreprocessor::getOption ( const JOption_t  option)
inlinestatic

Get option.

Parameters
optionoption
Returns
option

Definition at line 97 of file JPreprocessor.hh.

98  {
99  using namespace std;
100  using namespace JPP;
101 
102  data_type::const_iterator i = find_if(get_options().begin(),
103  get_options().end(),
104  make_predicate(&pair_type::second, option));
105 
106  if (i != get_options().end()) {
107  return i->first;
108  } else {
109  THROW(JTypeInformationException, "Invalid option <" << option << ">");
110  }
111  };

◆ getOptions() [1/2]

static std::vector<JPreprocessor> JTRIGGER::JPreprocessor::getOptions ( )
inlinestatic

Get options.

Returns
list of options

Definition at line 119 of file JPreprocessor.hh.

120  {
121  return JLANG::make_array(get_options().begin(),
122  get_options().end(),
123  &pair_type::first);
124  }
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
Definition: JVectorize.hh:54

◆ getOptions() [2/2]

static std::vector<JPreprocessor> JTRIGGER::JPreprocessor::getOptions ( const JOption_t  option)
inlinestatic

Get options.

Parameters
optionoption
Returns
list of options

Definition at line 133 of file JPreprocessor.hh.

134  {
135  std::vector<JPreprocessor> buffer(1, getOption(option));
136 
137  for (const auto& i : get_options()) {
138  if (i.second != option) {
139  buffer.push_back(i.first);
140  }
141  }
142 
143  return buffer;
144  }

◆ get_options()

static const data_type& JTRIGGER::JPreprocessor::get_options ( )
inlinestaticprotected

Get paired options.

Returns
list of paired options

Definition at line 173 of file JPreprocessor.hh.

174  {
175  static data_type buffer;
176 
177  if (buffer.empty()) {
178 
179 #define MAKE_ENTRY(A) std::make_pair(JPreprocessor(#A), A)
180 
181  buffer.push_back(MAKE_ENTRY(none_t));
182  buffer.push_back(MAKE_ENTRY(join_t));
183  buffer.push_back(MAKE_ENTRY(filter_t));
184  buffer.push_back(MAKE_ENTRY(remove_t));
185 
186 #undef MAKE_ENTRY
187  }
188 
189  return buffer;
190  }
#define MAKE_ENTRY(A)
Data structure for measured coincidence rates of all pairs of PMTs in optical module.
Definition: JFitK40.hh:103

Member Data Documentation

◆ ENUM_EXTENSION

const char JTRIGGER::JPreprocessor::ENUM_EXTENSION = '_'
staticprotected

Extension of enumeration names.

Definition at line 148 of file JPreprocessor.hh.


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