Jpp 21.0.0
the software that should make you happy
Loading...
Searching...
No Matches
JRunByRun.hh
Go to the documentation of this file.
1#ifndef __JSUPPORT__JRUNBYRUN__
2#define __JSUPPORT__JRUNBYRUN__
3
5
8
10
11#include "Jeep/JProperties.hh"
12
13
14
15/**
16 * \author mdejong
17 */
18
19namespace JSUPPORT {}
20namespace JPP { using namespace JSUPPORT; }
21
22namespace JSUPPORT {
23
25
26
27 /**
28 * Auxiliary class to select summary data (KM3NETDAQ::JDAQSummaryslice) from the specified raw data file(s).
29 *
30 * The use case of this class primarily is for the run-by-run mode of JTriggerEfficiency.cc.\n
31 * The two parameters of the JSUPPORT::JRandomSampler class should then be set
32 * to sufficiently cover the contents of raw data file(s) and to minimise possible biases.\n
33 * The values can also be tuned to reduce the overhead of accessing the data in the input file(s).\n
34 */
35 struct JRunByRun :
36 public JMultipleFileSampler<JDAQSummaryslice, JRandomSampler>
37 {
38 /**
39 * Default constructor.
40 */
44
45
46 /**
47 * Check validity of run by run options.
48 *
49 * \return true if okay; else false
50 */
51 inline bool is_valid() const
52 {
53 return !(*this)->getFilelist().empty();
54 }
55
56
57 /**
58 * Read run by run options from input.
59 *
60 * \param in input stream
61 * \param object run by run options
62 * \return input stream
63 */
64 friend inline std::istream& operator>>(std::istream& in, JRunByRun& object)
65 {
66 using namespace std;
67 using namespace JPP;
68
69 JStringStream is(in);
70
71 getProperties(object).read(is);
72
73 return in;
74 }
75
76
77 /**
78 * Write run by run options to output.
79 *
80 * \param out output stream
81 * \param object run by run options
82 * \return output stream
83 */
84 friend inline std::ostream& operator<<(std::ostream& out, const JRunByRun& object)
85 {
86 return getProperties(object).write(out);
87 }
88
89 protected:
90 /**
91 * Get properties of this class.
92 *
93 * \param object class object
94 * \return properties
95 */
96 template<class T>
97 static inline JProperties getProperties(T& object)
98 {
99 JProperties properties;
100
101 properties["file"] = object->getFilelist();
102 properties["sampler"] = object.getSampler();
103
104 return properties;
105 }
106 };
107}
108
109#endif
Utility class to parse parameter values.
Utility class to parse parameter values.
std::ostream & write(std::ostream &out) const
Write the current parameter values.
bool read(const JEquation &equation)
Read equation.
JRewindableObjectIterator< T > & in
Wrapper class around STL stringstream class to facilitate optional loading of data from file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Support classes and methods for experiment specific I/O.
Auxiliary class to sample from a list of files.
Template class for randomly sampling from a JLANG::JRewindableObjectIterator using a JLANG::JObjectSa...
Auxiliary class to select summary data (KM3NETDAQ::JDAQSummaryslice) from the specified raw data file...
Definition JRunByRun.hh:37
bool is_valid() const
Check validity of run by run options.
Definition JRunByRun.hh:51
friend std::ostream & operator<<(std::ostream &out, const JRunByRun &object)
Write run by run options to output.
Definition JRunByRun.hh:84
static JProperties getProperties(T &object)
Get properties of this class.
Definition JRunByRun.hh:97
friend std::istream & operator>>(std::istream &in, JRunByRun &object)
Read run by run options from input.
Definition JRunByRun.hh:64
JRunByRun()
Default constructor.
Definition JRunByRun.hh:41