Jpp 21.0.0
the software that should make you happy
Loading...
Searching...
No Matches
JAANET::JEvtCategory Struct Referenceabstract

Low-level interface for event categories. More...

#include <JEvtCategory.hh>

Inheritance diagram for JAANET::JEvtCategory:
JLANG::JClonable< JClonable_t, JDerived_t > JLANG::JComparable< JFirst_t, JSecond_t >

Public Types

typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JEvtCategory ()
 Default constructor.
 
 JEvtCategory (const int primaryType)
 Constructor.
 
virtual ~JEvtCategory ()
 Virtual destructor.
 
virtual bool is_valid () const =0
 Check if event category is valid.
 
void check_validity () const
 Check validity.
 
virtual bool match (const JHead &header) const =0
 Check whether given MC header matches with this event category.
 
virtual bool match (const Evt &event) const =0
 Check whether given event matches with this event category.
 
virtual bool less (const JEvtCategory &category) const
 Less-than method.
 
int getPrimaryType () const
 Get primary PDG type of this event category.
 
virtual JProperties getProperties (const JEquationParameters &eqpars=JEvtCategory::getEquationParameters())
 Get properties of this class.
 
virtual JProperties getProperties (const JEquationParameters &eqpars=JEvtCategory::getEquationParameters()) const
 Get properties of this class.
 
virtual std::istream & read (std::istream &in)
 Read event category from input.
 
virtual std::ostream & write (std::ostream &out) const
 Write event category to output.
 
virtual clone_type clone () const override
 Get clone of this object.
 

Static Public Member Functions

static JEquationParameters & getEquationParameters ()
 Get equation parameters.
 
static void setEquationParameters (const JEquationParameters &eqpars)
 Set equation parameters.
 

Protected Attributes

int primaryType
 Event primary PDG type.
 

Friends

std::istream & operator>> (std::istream &in, JEvtCategory &object)
 Read event category from input.
 
std::ostream & operator<< (std::ostream &out, const JEvtCategory &object)
 Write event category to output.
 

Detailed Description

Low-level interface for event categories.

Definition at line 33 of file JEvtCategory.hh.

Member Typedef Documentation

◆ clone_type

template<class JClonable_t , class JDerived_t >
JClonable<JClonable_t>::clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone_type
inherited

Definition at line 61 of file JClonable.hh.

Constructor & Destructor Documentation

◆ JEvtCategory() [1/2]

JAANET::JEvtCategory::JEvtCategory ( )
inline

Default constructor.

Definition at line 40 of file JEvtCategory.hh.

40 :
42 {}
int primaryType
Event primary PDG type.

◆ JEvtCategory() [2/2]

JAANET::JEvtCategory::JEvtCategory ( const int primaryType)
inline

Constructor.

Parameters
primaryTypeprimary PDG type

Definition at line 50 of file JEvtCategory.hh.

50 :
52 {}

◆ ~JEvtCategory()

virtual JAANET::JEvtCategory::~JEvtCategory ( )
inlinevirtual

Virtual destructor.

Definition at line 58 of file JEvtCategory.hh.

59 {}

Member Function Documentation

◆ is_valid()

virtual bool JAANET::JEvtCategory::is_valid ( ) const
pure virtual

Check if event category is valid.

Returns
true if event category is valid; else false

◆ check_validity()

void JAANET::JEvtCategory::check_validity ( ) const
inline

Check validity.

Definition at line 73 of file JEvtCategory.hh.

74 {
75 using namespace JPP;
76
77 if (!is_valid()) {
78 THROW(JValueOutOfRange, "JEvtCategory::check_validity(): Invalid category " << *this);
79 }
80 }
#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.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
virtual bool is_valid() const =0
Check if event category is valid.

◆ match() [1/2]

virtual bool JAANET::JEvtCategory::match ( const JHead & header) const
pure virtual

Check whether given MC header matches with this event category.

Parameters
headerMC header
Returns
true if matching; else false

◆ match() [2/2]

virtual bool JAANET::JEvtCategory::match ( const Evt & event) const
pure virtual

Check whether given event matches with this event category.

Parameters
eventevent
Returns
true if matching; else false

◆ less()

virtual bool JAANET::JEvtCategory::less ( const JEvtCategory & category) const
inlinevirtual

Less-than method.

Parameters
categoryevent category
Returns
true if this event category is less than given event category; else false

Definition at line 107 of file JEvtCategory.hh.

108 {
109 return this->primaryType < category.getPrimaryType();
110 }

◆ getPrimaryType()

int JAANET::JEvtCategory::getPrimaryType ( ) const
inline

Get primary PDG type of this event category.

Returns
primary PDG type

Definition at line 118 of file JEvtCategory.hh.

119 {
120 return primaryType;
121 }

◆ getEquationParameters()

static JEquationParameters & JAANET::JEvtCategory::getEquationParameters ( )
inlinestatic

Get equation parameters.

Returns
equation parameters

Definition at line 129 of file JEvtCategory.hh.

130 {
131 static JEquationParameters eqpars("=", ",", "./", "#");
132
133 return eqpars;
134 }
Simple data structure to support I/O of equations (see class JLANG::JEquation).

◆ setEquationParameters()

static void JAANET::JEvtCategory::setEquationParameters ( const JEquationParameters & eqpars)
inlinestatic

Set equation parameters.

Parameters
eqparsequation parameters

Definition at line 142 of file JEvtCategory.hh.

143 {
144 getEquationParameters() = eqpars;
145 }
static JEquationParameters & getEquationParameters()
Get equation parameters.

◆ getProperties() [1/2]

virtual JProperties JAANET::JEvtCategory::getProperties ( const JEquationParameters & eqpars = JEvtCategory::getEquationParameters())
inlinevirtual

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 153 of file JEvtCategory.hh.

154 {
155 JProperties properties(eqpars,1);
156
157 properties.insert(gmake_property(primaryType));
158
159 return properties;
160 }
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.

◆ getProperties() [2/2]

virtual JProperties JAANET::JEvtCategory::getProperties ( const JEquationParameters & eqpars = JEvtCategory::getEquationParameters()) const
inlinevirtual

Get properties of this class.

Parameters
eqparsequation parameters

Definition at line 168 of file JEvtCategory.hh.

169 {
170 JProperties properties(eqpars,1);
171
172 properties.insert(gmake_property(primaryType));
173
174 return properties;
175 }

◆ read()

virtual std::istream & JAANET::JEvtCategory::read ( std::istream & in)
inlinevirtual

Read event category from input.

Parameters
ininput stream
Returns
input stream

Definition at line 184 of file JEvtCategory.hh.

185 {
186 using namespace JPP;
187
188 JStringStream is(in);
189
190 JProperties properties = getProperties();
191 is >> properties;
192
194
195 return in;
196 }
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
void check_validity() const
Check validity.
virtual JProperties getProperties(const JEquationParameters &eqpars=JEvtCategory::getEquationParameters())
Get properties of this class.

◆ write()

virtual std::ostream & JAANET::JEvtCategory::write ( std::ostream & out) const
inlinevirtual

Write event category to output.

Parameters
outoutput stream
Returns
output stream

Definition at line 206 of file JEvtCategory.hh.

207 {
208 return out << getProperties();
209 }

◆ clone()

template<class JClonable_t , class JDerived_t >
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JEvtCategory & object )
friend

Read event category from input.

Parameters
ininput stream
objectevent category
Returns
input stream

Definition at line 219 of file JEvtCategory.hh.

220 {
221 return object.read(in);
222 }

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JEvtCategory & object )
friend

Write event category to output.

Parameters
outoutput stream
objectevent category
Returns
output stream

Definition at line 232 of file JEvtCategory.hh.

233 {
234 return object.write(out);
235 }

Member Data Documentation

◆ primaryType

int JAANET::JEvtCategory::primaryType
protected

Event primary PDG type.

Definition at line 240 of file JEvtCategory.hh.


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