Jpp test-rotations-old
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 JEquationParametersgetEquationParameters ()
 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 35 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 42 of file JEvtCategory.hh.

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

◆ JEvtCategory() [2/2]

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

Constructor.

Parameters
primaryTypeprimary PDG type

Definition at line 52 of file JEvtCategory.hh.

52 :
54 {}

◆ ~JEvtCategory()

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

Virtual destructor.

Definition at line 60 of file JEvtCategory.hh.

61 {}

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 75 of file JEvtCategory.hh.

76 {
77 using namespace JPP;
78
79 if (!is_valid()) {
80 THROW(JValueOutOfRange, "JEvtCategory::check_validity(): Invalid category " << *this);
81 }
82 }
#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 109 of file JEvtCategory.hh.

110 {
111 return this->primaryType < category.getPrimaryType();
112 }

◆ getPrimaryType()

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

Get primary PDG type of this event category.

Returns
primary PDG type

Definition at line 120 of file JEvtCategory.hh.

121 {
122 return primaryType;
123 }

◆ getEquationParameters()

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

Get equation parameters.

Returns
equation parameters

Definition at line 131 of file JEvtCategory.hh.

132 {
133 static JEquationParameters eqpars("=", ",", "./", "#");
134
135 return eqpars;
136 }
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 144 of file JEvtCategory.hh.

145 {
146 getEquationParameters() = eqpars;
147 }
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 155 of file JEvtCategory.hh.

156 {
157 JProperties properties(eqpars,1);
158
159 properties.insert(gmake_property(primaryType));
160
161 return properties;
162 }
#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 170 of file JEvtCategory.hh.

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

◆ 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 186 of file JEvtCategory.hh.

187 {
188 using namespace std;
189 using namespace JPP;
190
191 JStringStream is(in);
192
193 if (getFileStatus(is.str().c_str())) {
194 is.load();
195 }
196
197 JProperties properties = getProperties();
198 is >> properties;
199
201
202 return in;
203 }
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 213 of file JEvtCategory.hh.

214 {
215 return out << getProperties();
216 }

◆ 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 226 of file JEvtCategory.hh.

227 {
228 return object.read(in);
229 }

◆ 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 239 of file JEvtCategory.hh.

240 {
241 return object.write(out);
242 }

Member Data Documentation

◆ primaryType

int JAANET::JEvtCategory::primaryType
protected

Event primary PDG type.

Definition at line 247 of file JEvtCategory.hh.


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