Jpp  18.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
JSUPPORT::JRunByRun Struct Reference

Auxiliary class to select summary data (KM3NETDAQ::JDAQSummaryslice) from the specified raw data file(s). More...

#include <JRunByRun.hh>

Inheritance diagram for JSUPPORT::JRunByRun:
JSUPPORT::JMultipleFileSampler< JDAQSummaryslice, JRandomSampler > JSUPPORT::JMultipleFileSampler_t< JDAQSummaryslice > JLANG::JObjectSampler< T, JSampler_t > JLANG::JObjectIterator< T >

Public Types

typedef JRandomSampler
< JDAQSummaryslice
sampler_type
 
typedef JObjectIterator< T >
::pointer_type 
pointer_type
 

Public Member Functions

 JRunByRun ()
 Default constructor. More...
 
bool is_valid () const
 Check validity of run by run options. More...
 
const JMultipleFileScanner
< JDAQSummaryslice > *const 
operator-> () const
 Smart pointer operator. More...
 
JMultipleFileScanner
< JDAQSummaryslice > * 
operator-> ()
 Smart pointer operator. More...
 
virtual bool hasNext () override
 Check availability of next element. More...
 
virtual const pointer_typenext () override
 Get next element. More...
 
const JSampler_t< T > & getSampler () const
 Get sampler. More...
 
JSampler_t< T > & getSampler ()
 Get sampler. More...
 
virtual skip_type skip (const skip_type ns)
 Skip items. More...
 

Static Protected Member Functions

template<class T >
static JProperties getProperties (T &object)
 Get properties of this class. More...
 

Protected Attributes

JMultipleFileScanner
< JDAQSummaryslice
scanner
 
JRewindableObjectIterator< T > & in
 
JSampler_t< Tsampler
 
JPointer< Tps
 
bool has_next
 

Friends

std::istream & operator>> (std::istream &in, JRunByRun &object)
 Read run by run options from input. More...
 
std::ostream & operator<< (std::ostream &out, const JRunByRun &object)
 Write run by run options to output. More...
 

Detailed Description

Auxiliary class to select summary data (KM3NETDAQ::JDAQSummaryslice) from the specified raw data file(s).

The use case of this class primarily is for the run-by-run mode of JTriggerEfficiency.cc.
The two parameters of the JSUPPORT::JRandomSampler class should then be set to sufficiently cover the contents of raw data file(s) and to minimise possible biases.
The values can also be tuned to reduce the overhead of accessing the data in the input file(s).

Definition at line 32 of file JRunByRun.hh.

Member Typedef Documentation

Definition at line 60 of file JMultipleFileSampler.hh.

template<class T, template< class > class JSampler_t = JSampler>
typedef JObjectIterator<T>::pointer_type JLANG::JObjectSampler< T, JSampler_t >::pointer_type
inherited

Definition at line 45 of file JObjectSampler.hh.

Constructor & Destructor Documentation

JSUPPORT::JRunByRun::JRunByRun ( )
inline

Member Function Documentation

bool JSUPPORT::JRunByRun::is_valid ( ) const
inline

Check validity of run by run options.

Returns
true if okay; else false

Definition at line 48 of file JRunByRun.hh.

49  {
50  return !(*this)->getFilelist().empty();
51  }
template<class T >
static JProperties JSUPPORT::JRunByRun::getProperties ( T object)
inlinestaticprotected

Get properties of this class.

Parameters
objectclass object
Returns
properties

Definition at line 98 of file JRunByRun.hh.

99  {
100  JProperties properties;
101 
102  properties["file"] = object->getFilelist();
103  properties["sampler"] = object.getSampler();
104 
105  return properties;
106  }
Utility class to parse parameter values.
Definition: JProperties.hh:497
const JMultipleFileScanner<JDAQSummaryslice >* const JSUPPORT::JMultipleFileSampler_t< JDAQSummaryslice >::operator-> ( ) const
inlineinherited

Smart pointer operator.

Returns
pointer to scanner

Definition at line 31 of file JMultipleFileSampler.hh.

32  {
33  return &scanner;
34  }
JMultipleFileScanner< JDAQSummaryslice > scanner

Smart pointer operator.

Returns
pointer to scanner

Definition at line 41 of file JMultipleFileSampler.hh.

42  {
43  return &scanner;
44  }
JMultipleFileScanner< JDAQSummaryslice > scanner
template<class T, template< class > class JSampler_t = JSampler>
virtual bool JLANG::JObjectSampler< T, JSampler_t >::hasNext ( )
inlineoverridevirtualinherited

Check availability of next element.

Returns
true if the iteration has more elements; else false

Implements JLANG::JObjectIterator< T >.

Definition at line 78 of file JObjectSampler.hh.

79  {
80  while (!has_next) {
81 
82  if (!in.hasNext()) {
83  in.rewind();
84  }
85 
86  if (in.hasNext()) {
87 
88  ps.set(in.next());
89 
90  skip_type ns = sampler(*ps);
91 
92  if (ns == 0) {
93 
94  has_next = true;
95 
96  } else {
97 
98  while ((ns -= in.skip(ns)) != 0) {
99  in.rewind();
100  }
101  }
102 
103  } else {
104 
105  // nothing to sample
106 
107  break;
108  }
109  }
110 
111  return has_next;
112  }
unsigned int skip_type
Type definition for number of objects to skip.
std::vector< size_t > ns
JRewindableObjectIterator< T > & in
virtual void set(JClass_t *p) override
Set pointer.
Definition: JPointer.hh:75
JSampler_t< T > sampler
template<class T, template< class > class JSampler_t = JSampler>
virtual const pointer_type& JLANG::JObjectSampler< T, JSampler_t >::next ( )
inlineoverridevirtualinherited

Get next element.

Returns
pointer to element

Implements JLANG::JObjectIterator< T >.

Definition at line 120 of file JObjectSampler.hh.

121  {
122  if (!has_next) {
123  ps.reset(NULL);
124  }
125 
126  has_next = false;
127 
128  return ps;
129  }
virtual void reset() override
Reset pointer.
Definition: JPointer.hh:84
template<class T, template< class > class JSampler_t = JSampler>
const JSampler_t<T>& JLANG::JObjectSampler< T, JSampler_t >::getSampler ( ) const
inlineinherited

Get sampler.

Returns
sampler

Definition at line 137 of file JObjectSampler.hh.

138  {
139  return sampler;
140  }
JSampler_t< T > sampler
template<class T, template< class > class JSampler_t = JSampler>
JSampler_t<T>& JLANG::JObjectSampler< T, JSampler_t >::getSampler ( )
inlineinherited

Get sampler.

Returns
sampler

Definition at line 148 of file JObjectSampler.hh.

149  {
150  return sampler;
151  }
JSampler_t< T > sampler
template<class T>
virtual skip_type JLANG::JObjectIterator< T >::skip ( const skip_type  ns)
inlinevirtualinherited

Skip items.

Parameters
nsnumber of items to skip
Returns
number of items skipped

Reimplemented in JLANG::JPipe< T >, JLANG::JPipe< JTail_t >, JLANG::JPipe< JHead_t >, JLANG::JSTDObjectIterator< T >, JLANG::JAbstractObjectReader< T >, JLANG::JAbstractObjectReader< const event_type >, JLANG::JAbstractObjectReader< JNullType >, JLANG::JAbstractObjectReader< const T >, JLANG::JAbstractObjectReader< JTail_t >, JLANG::JAbstractObjectReader< JHead_t >, JLANG::JAbstractObjectReader< KM3NETDAQ::KM3NETDAQ::JDAQEvent >, and JLANG::JAbstractObjectReader< JDAQSummaryslice >.

Definition at line 90 of file JObjectIterator.hh.

91  {
92  skip_type i = 0;
93 
94  for ( ; i != ns && hasNext(); ++i) {
95  next();
96  }
97 
98  return i;
99  }
unsigned int skip_type
Type definition for number of objects to skip.
std::vector< size_t > ns
virtual const pointer_type & next()=0
Get next element.
virtual bool hasNext()=0
Check availability of next element.

Friends And Related Function Documentation

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

Read run by run options from input.

Parameters
ininput stream
objectrun by run options
Returns
input stream

Definition at line 61 of file JRunByRun.hh.

62  {
63  using namespace std;
64  using namespace JPP;
65 
67 
68  if (getFileStatus(is.str().c_str())) {
69  is.load();
70  }
71 
72  getProperties(object).read(is);
73 
74  return in;
75  }
bool read(const JEquation &equation)
Read equation.
Definition: JProperties.hh:679
JRewindableObjectIterator< T > & in
is
Definition: JDAQCHSM.chsm:167
static JStat getFileStatus
Function object for file status.
Definition: JStat.hh:173
Wrapper class around STL stringstream class to facilitate optional loading of data from file...
static JProperties getProperties(T &object)
Get properties of this class.
Definition: JRunByRun.hh:98
std::ostream& operator<< ( std::ostream &  out,
const JRunByRun object 
)
friend

Write run by run options to output.

Parameters
outoutput stream
objectrun by run options
Returns
output stream

Definition at line 85 of file JRunByRun.hh.

86  {
87  return getProperties(object).write(out);
88  }
std::ostream & write(std::ostream &out) const
Write the current parameter values.
Definition: JProperties.hh:847
static JProperties getProperties(T &object)
Get properties of this class.
Definition: JRunByRun.hh:98

Member Data Documentation

Definition at line 47 of file JMultipleFileSampler.hh.

template<class T, template< class > class JSampler_t = JSampler>
JRewindableObjectIterator<T>& JLANG::JObjectSampler< T, JSampler_t >::in
protectedinherited

Definition at line 154 of file JObjectSampler.hh.

template<class T, template< class > class JSampler_t = JSampler>
JSampler_t<T> JLANG::JObjectSampler< T, JSampler_t >::sampler
protectedinherited

Definition at line 155 of file JObjectSampler.hh.

template<class T, template< class > class JSampler_t = JSampler>
JPointer<T> JLANG::JObjectSampler< T, JSampler_t >::ps
protectedinherited

Definition at line 156 of file JObjectSampler.hh.

template<class T, template< class > class JSampler_t = JSampler>
bool JLANG::JObjectSampler< T, JSampler_t >::has_next
protectedinherited

Definition at line 157 of file JObjectSampler.hh.


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