Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JTriggeredFileScanner.hh
Go to the documentation of this file.
1#ifndef __JTRIGGEREDFILESCANNER__
2#define __JTRIGGEREDFILESCANNER__
3
4#include "JLang/JTypeList.hh"
5#include "JLang/JNullType.hh"
7
13#include "JSupport/JSupport.hh"
14
15
16/**
17 * \file
18 *
19 * Synchronously read DAQ events and Monte Carlo events (and optionally other events).
20 * \author mdejong
21 */
22namespace JSUPPORT {}
23namespace JPP { using namespace JSUPPORT; }
24
25namespace JSUPPORT {
26
27 using JLANG::JTypeList;
28 using JLANG::JNullType;
31
32
33 /**
34 * Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events).
35 * It is assumed that the TTree corresponding to the template argument and
36 * the TTree with KM3NETDAQ::JDAQEvent can be read in parallel.
37 */
38 template<class JTypelist_t = JNullType, template<class> class JFileScanner_t = JMultipleFileScanner>
40 public JParallelFileScanner<JTypeList<JDAQEvent, JTypelist_t>, JFileScanner_t>
41 {
45
46
47 /**
48 * Default constructor.
49 */
53
54
55 /**
56 * Constructor.
57 *
58 * \param input input
59 */
61 {
62 this->configure(input, JLimit());
63 }
64
65
66 /**
67 * Constructor.
68 *
69 * \param input input
70 * \param limit limit
71 */
73 {
74 this->configure(input, limit);
75 }
76
77
78 /**
79 * Check availability of next element.
80 *
81 * \return true if the iteration has more elements; else false
82 */
83 virtual bool hasNext() override
84 {
86
87 if (has_next && file_name != this->getFilename()) {
88
89 in.configure(this->getFilename());
90
91 file_name = this->getFilename();
92 }
93
94 return has_next;
95 }
96
97
98 /**
99 * Get next element.
100 *
101 * \return multi-pointer to elements
102 */
103 virtual const multi_pointer_type& next() override
104 {
105 static multi_pointer_type ps;
106
108
109 JDAQEvent* tev = __p;
110 Evt* event = in.getEntry(tev->getCounter());
111
112 ps.reset(event, __p);
113
114 return ps;
115 }
116
117 protected:
119 std::string file_name;
120 };
121}
122
123
124#endif
Scanning of objects from multiple files according a format that follows from the extension of each fi...
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
ROOT TTree parameter settings of various packages.
virtual bool hasNext()=0
Check availability of next element.
General purpose class for object reading from a list of file names.
General purpose class for parallel reading of objects from a single file or multiple files.
virtual const multi_pointer_type & next() override
Get next element.
JFileScanner_t< JNullType >::input_type input_type
Template definition for direct access of elements in ROOT TChain.
JTriggerCounter_t getCounter() const
Get trigger counter.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Support classes and methods for experiment specific I/O.
void configure(const T &value, const JAbstractCollection< JAbscissa_t > &bounds, JBool< false > option)
Configuration of value.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
General purpose class for multiple pointers.
void reset(const JMultiPointer< JClass_t > &pointer)
Reset multi-pointer.
Auxiliary class for no type definition.
Definition JNullType.hh:19
Type list.
Definition JTypeList.hh:23
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
JTriggeredFileScanner(const typename parallel_filescannner_type::input_type &input)
Constructor.
virtual bool hasNext() override
Check availability of next element.
virtual const multi_pointer_type & next() override
Get next element.
JTypeList< JDAQEvent, JTypelist_t > typelist
JTriggeredFileScanner(const typename parallel_filescannner_type::input_type &input, const JLimit &limit)
Constructor.
JTriggeredFileScanner()
Default constructor.
JParallelFileScanner< typelist, JFileScanner_t > parallel_filescannner_type
JMultiPointer< JTypeList< Evt, typelist > > multi_pointer_type