Jpp  18.5.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | Friends | List of all members
JAANET::JNeutrinoTypeCollection Struct Reference

Auxiliary class for parsing a vector of neutrino PDG identifiers. More...

#include <JEvtWeightToolkit.hh>

Public Member Functions

 JNeutrinoTypeCollection ()
 Default constructor. More...
 
void put (const int identifier)
 Add identifier. More...
 
size_t size () const
 Get size of this collection. More...
 
std::vector< int >::const_iterator cbegin () const noexcept
 Get constant iterator to the first element of the collection. More...
 
std::vector< int >::const_iterator cend () const noexcept
 Get constant iterator to the last element of the collection. More...
 

Private Attributes

std::vector< int > identifiers
 Container for identifiers. More...
 

Friends

std::istream & operator>> (std::istream &in, JNeutrinoTypeCollection &collection)
 Stream input. More...
 
std::ostream & operator<< (std::ostream &out, const JNeutrinoTypeCollection &collection)
 Stream output. More...
 

Detailed Description

Auxiliary class for parsing a vector of neutrino PDG identifiers.

Definition at line 93 of file JEvtWeightToolkit.hh.

Constructor & Destructor Documentation

JAANET::JNeutrinoTypeCollection::JNeutrinoTypeCollection ( )
inline

Default constructor.

Definition at line 98 of file JEvtWeightToolkit.hh.

98  :
99  identifiers()
100  {}
std::vector< int > identifiers
Container for identifiers.

Member Function Documentation

void JAANET::JNeutrinoTypeCollection::put ( const int  identifier)
inline

Add identifier.

Parameters
identifierPDG identifier

Definition at line 108 of file JEvtWeightToolkit.hh.

109  {
110  if (abs(identifier) == TRACK_TYPE_NUE ||
111  abs(identifier) == TRACK_TYPE_NUMU ||
112  abs(identifier) == TRACK_TYPE_NUTAU) {
113 
114  identifiers.push_back(identifier);
115 
116  } else {
117 
118  THROW(JValueOutOfRange, "JNeutrinoTypeCollection::put(): Invalid PDG identifier: " << identifier);
119  }
120  }
std::vector< int > identifiers
Container for identifiers.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
size_t JAANET::JNeutrinoTypeCollection::size ( ) const
inline

Get size of this collection.

Returns
size of neutrino type collection.

Definition at line 128 of file JEvtWeightToolkit.hh.

129  {
130  return identifiers.size();
131  }
std::vector< int > identifiers
Container for identifiers.
std::vector<int>::const_iterator JAANET::JNeutrinoTypeCollection::cbegin ( ) const
inlinenoexcept

Get constant iterator to the first element of the collection.

Returns
constant iterator to the first element of the collection

Definition at line 139 of file JEvtWeightToolkit.hh.

140  {
141  return identifiers.cbegin();
142  }
std::vector< int > identifiers
Container for identifiers.
std::vector<int>::const_iterator JAANET::JNeutrinoTypeCollection::cend ( ) const
inlinenoexcept

Get constant iterator to the last element of the collection.

Returns
constant iterator to the last element of the collection

Definition at line 150 of file JEvtWeightToolkit.hh.

151  {
152  return identifiers.cend();
153  }
std::vector< int > identifiers
Container for identifiers.

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JNeutrinoTypeCollection collection 
)
friend

Stream input.

Parameters
ininput stream
collectioncollection of neutrino PDG types
Returns
input stream

Definition at line 163 of file JEvtWeightToolkit.hh.

164  {
165  for (int identifier; in >> identifier; ) {
166  collection.put(identifier);
167  }
168 
169  return in;
170  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
void put(const int identifier)
Add identifier.
std::ostream& operator<< ( std::ostream &  out,
const JNeutrinoTypeCollection collection 
)
friend

Stream output.

Parameters
outoutput stream
collectioncollection of neutrino PDG types
Returns
output stream

Definition at line 180 of file JEvtWeightToolkit.hh.

181  {
182  using namespace std;
183 
184  const vector<int>& identifiers = collection.identifiers;
185 
186  for (vector<int>::const_iterator i = identifiers.cbegin(); i != identifiers.cend(); ++i) {
187  out << ' ' << *i;
188  }
189 
190  return out;
191  }
std::vector< int > identifiers
Container for identifiers.

Member Data Documentation

std::vector<int> JAANET::JNeutrinoTypeCollection::identifiers
private

Container for identifiers.

Definition at line 196 of file JEvtWeightToolkit.hh.


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