Helper class for event categories.
More...
#include <JEvtCategoryHelper.hh>
Helper class for event categories.
Definition at line 32 of file JEvtCategoryHelper.hh.
◆ pointer_type
◆ JEvtCategoryHelper() [1/5]
JAANET::JEvtCategoryHelper::JEvtCategoryHelper |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 41 of file JEvtCategoryHelper.hh.
41 :
43 {}
std::shared_ptr< JEvtCategory > pointer_type
◆ JEvtCategoryHelper() [2/5]
JAANET::JEvtCategoryHelper::JEvtCategoryHelper |
( |
const pointer_type & | p | ) |
|
|
inline |
◆ JEvtCategoryHelper() [3/5]
JAANET::JEvtCategoryHelper::JEvtCategoryHelper |
( |
const JEvtCategory & | category | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 61 of file JEvtCategoryHelper.hh.
62 {
64 }
void configure(const pointer_type &p)
Configuration.
◆ JEvtCategoryHelper() [4/5]
JAANET::JEvtCategoryHelper::JEvtCategoryHelper |
( |
const JHead & | header | ) |
|
|
inline |
◆ JEvtCategoryHelper() [5/5]
JAANET::JEvtCategoryHelper::JEvtCategoryHelper |
( |
const int | type | ) |
|
|
inline |
◆ configure() [1/4]
void JAANET::JEvtCategoryHelper::configure |
( |
const pointer_type & | p | ) |
|
|
inline |
◆ configure() [2/4]
void JAANET::JEvtCategoryHelper::configure |
( |
const JEvtCategory & | category | ) |
|
|
inline |
◆ configure() [3/4]
void JAANET::JEvtCategoryHelper::configure |
( |
const JHead & | header | ) |
|
|
inline |
Configuration.
- Parameters
-
Definition at line 116 of file JEvtCategoryHelper.hh.
117 {
119
124 } else {
125 THROW(
JValueOutOfRange,
"JEvtCategoryHelper::configure(): Cannot construct event category for given header with primary ID " << header.primary.type);
126 }
127 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for accessing a value in a collection that is outside of its range.
bool is_neutrino_primary(const int type)
Auxiliary function to check if given PDG code corresponds to a neutrino.
bool is_muon_bundle_primary(const int type)
Auxiliary function to check if given PDG code corresponds to a valid muon bundle primary type.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Class for muon bundle categories.
Class for neutrino interaction categories.
◆ configure() [4/4]
void JAANET::JEvtCategoryHelper::configure |
( |
const int | type | ) |
|
|
inline |
Configuration.
- Parameters
-
Definition at line 135 of file JEvtCategoryHelper.hh.
136 {
138
143 } else {
144 THROW(
JValueOutOfRange,
"JEvtCategoryHelper::configure(): Cannot construct event category for PDG type " << type);
145 }
146 }
◆ getEvtCategory()
JEvtCategory & JAANET::JEvtCategoryHelper::getEvtCategory |
( |
| ) |
const |
|
inline |
Get reference to event category.
- Returns
- reference to event category
Definition at line 154 of file JEvtCategoryHelper.hh.
155 {
157
159 return *(this->get());
160 } else {
162 }
163 }
Exception for null pointer operation.
Helper class for event categories.
◆ is_valid()
bool JAANET::JEvtCategoryHelper::is_valid |
( |
| ) |
const |
|
inline |
Check if event category is valid.
- Returns
- true if event category is valid; else false
Definition at line 171 of file JEvtCategoryHelper.hh.
172 {
174 }
JEvtCategoryHelper()
Default constructor.
◆ match() [1/2]
bool JAANET::JEvtCategoryHelper::match |
( |
const JHead & | header | ) |
const |
|
inline |
Check whether given MC header matches with this event category.
- Parameters
-
- Returns
- true if matching; else false
Definition at line 183 of file JEvtCategoryHelper.hh.
184 {
186
187 return category.match(header);
188 }
JEvtCategory & getEvtCategory() const
Get reference to event category.
◆ match() [2/2]
bool JAANET::JEvtCategoryHelper::match |
( |
const Evt & | event | ) |
const |
|
inline |
Check whether given event matches with this event category.
- Parameters
-
- Returns
- true if matching; else false
Definition at line 197 of file JEvtCategoryHelper.hh.
198 {
200
201 return category.match(event);
202 }
◆ less() [1/2]
bool JAANET::JEvtCategoryHelper::less |
( |
const JEvtCategory & | category | ) |
const |
|
inline |
Less-than method.
- Parameters
-
- Returns
- true if this event category is less than given event category; else false
Definition at line 211 of file JEvtCategoryHelper.hh.
212 {
214
215 return cat.less(category);
216 }
◆ less() [2/2]
Less-than method.
- Parameters
-
helper | shared pointer to event category |
- Returns
- true if this event category is less than given event category; else false
Definition at line 225 of file JEvtCategoryHelper.hh.
226 {
227 return this->
less(helper.getEvtCategory());
228 }
bool less(const JEvtCategory &category) const
Less-than method.
◆ getProperties()
Get properties of this class.
- Parameters
-
equation | equation parameters |
Definition at line 236 of file JEvtCategoryHelper.hh.
237 {
239
240 return cat.getProperties();
241 }
◆ operator>>
Read event category from input.
- Parameters
-
in | input stream |
object | event category |
- Returns
- input stream
Definition at line 251 of file JEvtCategoryHelper.hh.
252 {
254
255 if (object) {
256
257 return object.get()->read(in);
258
259 } else {
260
261 streampos pos = in.tellg();
262
263 int type = 0;
264
265 if (in >> type) {
266 object.configure(type);
267 return in;
268 }
269
270 in.clear();
271 in.seekg(pos);
272
273 JNeutrinoInteractionCategory neutrinoInteraction;
274 neutrinoInteraction.getProperties().read(in);
275
276 if (neutrinoInteraction.is_valid()) {
277 object.configure(neutrinoInteraction);
278 return in;
279 }
280
281 in.clear();
282 in.seekg(pos);
283
284 JMuonBundleCategory muonBundle;
285 muonBundle.getProperties().read(in);
286
287 if (muonBundle.is_valid()) {
288 object.configure(muonBundle);
289 }
290
291 return in;
292 }
293 }
◆ operator<<
Write event category to output.
- Parameters
-
out | output stream |
object | event category |
- Returns
- output stream
Definition at line 303 of file JEvtCategoryHelper.hh.
304 {
306 return out << object.getEvtCategory();
307 } else {
308 return out << 0;
309 }
310 }
bool is_valid() const
Check if event category is valid.
The documentation for this struct was generated from the following file: