Jpp  18.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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"
6 #include "JLang/JMultiPointer.hh"
7 
12 #include "JSupport/JTreeScanner.hh"
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  */
22 namespace JSUPPORT {}
23 namespace JPP { using namespace JSUPPORT; }
24 
25 namespace 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  */
52  {}
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  {
85  bool has_next = parallel_filescannner_type::hasNext();
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:
120  };
121 }
122 
123 
124 #endif
JMultiPointer< JTypeList< Evt, typelist > > multi_pointer_type
ROOT TTree parameter settings of various packages.
JParallelFileScanner< typelist, JFileScanner_t > parallel_filescannner_type
virtual const multi_pointer_type & next() override
Get next element.
void reset(const JMultiPointer< JClass_t > &pointer)
Reset multi-pointer.
JTypeList< JDAQEvent, JTypelist_t > typelist
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
General purpose class for parallel reading of objects from a single file or multiple files...
virtual bool hasNext() override
Check availability of next element.
Type list.
Definition: JTypeList.hh:22
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
virtual const multi_pointer_type & next() override
Get next element.
JTriggeredFileScanner(const typename parallel_filescannner_type::input_type &input)
Constructor.
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
Auxiliary class for no type definition.
Definition: JNullType.hh:19
then awk string
Scanning of objects from multiple files according a format that follows from the extension of each fi...
JTriggeredFileScanner(const typename parallel_filescannner_type::input_type &input, const JLimit &limit)
Constructor.
void configure(const T &value, const JAbstractCollection< JAbscissa_t > &bounds, JBool< false > option)
Configuration of value.
General purpose class for object reading from a list of file names.
JTriggeredFileScanner()
Default constructor.
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
Definition: JeepToolkit.hh:128
JFileScanner_t< JNullType >::input_type input_type
General purpose class for multiple pointers.
JTriggerCounter_t getCounter() const
Get trigger counter.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:20