CFEL - ASG Software Suite  2.5.0
CASS
hdf5_file_input.h
Go to the documentation of this file.
1 // Copyright (C) 2015 Lutz Foucar
2 
3 /**
4  * @file hdf5_file_input.h contains a hdf5 file reader class
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _HDF5FILEINPUT_H_
10 #define _HDF5FILEINPUT_H_
11 
12 #include <string>
13 
14 #include "input_base.h"
15 #include "cass.h"
16 #include "ringbuffer.hpp"
17 #include "cass_event.h"
18 #include "file_reader.h"
19 
20 namespace cass
21 {
22 /** HDF5 File Input for cass
23  *
24  * The HDF5 file is expected to contain the data separated by the events. For
25  * each event there should be a group that contains the data of all the
26  * detectors and deveices that were recorded for this event. The reader will
27  * gather a list of all the "root" groups and then iterate through them. Thus
28  * all dataset keys should be given with respect to the event group.
29  *
30  * @cassttng HDF5FileInput/{EventIDKey}\n
31  * The name of the dataset within the hdf5 file that allows to
32  * retrieve the current event ID.
33  * The Groupname of the Event can be omitted. Default is "EventID"
34  * @cassttng HDF5FileInput/MachineValues/{size}\n
35  * The number of machine parameters that one wants to retrieve. Ensure
36  * that each parameter has a unique id in the list. All reuested
37  * machine parameters will be stored in the beamlineparameter part of
38  * the CASSEvent. Use PostProcessor 120 to retrieve those values for
39  * processing later on.
40  * @cassttng HDF5FileInput/MachineValues/\%index\%/{HDF5Key}\n
41  * Name of the dataset that contains the requested machine parameter.
42  * The Groupname of the Event can be omitted. Default is "Invalid"
43  * @cassttng HDF5FileInput/MachineValues/\%index\%/{CASSName}\n
44  * Name of the parameter within the Beamlineparameter part of the
45  * CASSEvent. Default is "Invalid" in which case the name of the
46  * dataset will be used.
47  * @cassttng HDF5FileInput/MachineValues/\%index\%/{ArrayIndex}\n
48  * In case the value is contained within an array. This is the
49  * index at which the values stand within the array. Default is 0
50  * @cassttng HDF5FileInput/AcqirisValues/{size}\n
51  * The number of acqirs instrument channels that one wants to
52  * retrieve. Each channel of an instrument has to be defined separately.
53  * Ensure that each parameter has a unique id in the list.
54  * @cassttng HDF5FileInput/AcqirisValues/\%index\%/{HDF5DataKey}\n
55  * Name of the dataset that contains the requested acqiris channel data.
56  * The Groupname of the Event can be omitted. Default is "Invalid"
57  * @cassttng HDF5FileInput/AcqirisValues/\%index\%/{HDF5HorposKey}\n
58  * Name of the dataset that contains the Horpos value of the
59  * requested acqiris channel.
60  * The Groupname of the Event can be omitted. Default is "Invalid"
61  * @cassttng HDF5FileInput/AcqirisValues/\%index\%/{HDF5VerticalOffsetKey}\n
62  * Name of the dataset that contains vertical offset value of the
63  * requested acqiris channel.
64  * The Groupname of the Event can be omitted. Default is "Invalid"
65  * @cassttng HDF5FileInput/AcqirisValues/\%index\%/{HDF5GainKey}\n
66  * Name of the dataset that contains the vertical gain value of the
67  * requested acqiris channel.
68  * The Groupname of the Event can be omitted. Default is "Invalid"
69  * @cassttng HDF5FileInput/AcqirisValues/\%index\%/{HDF5SampleIntervalKey}\n
70  * Name of the dataset that contains the sample interval value of the
71  * requested acqiris channel.
72  * The Groupname of the Event can be omitted. Default is "Invalid"
73  * @cassttng HDF5FileInput/AcqirisValues/\%index\%/{CASSInstrumentID}\n
74  * The id of the insturment within the CASSEVent that the acqiris data
75  * should be copied to. Default is "1". This should not be changed since
76  * this is the generic instrument id. Note that not all ids are available.
77  * @cassttng HDF5FileInput/AcqirisValues/\%index\%/{CASSChannelNumber}\n
78  * The channel number within the instrument of the CASSEvent that the
79  * channel data should be copied to. Default is 0.
80  * @cassttng HDF5FileInput/PixelDetectorValues/{size}\n
81  * The number of pixeldetectors that one wants to
82  * retrieve. Ensure that each parameter has a unique id in the list.
83  * @cassttng HDF5FileInput/PixelDetectorValues/\%index\%/{HDF5DataKey}\n
84  * Name of the dataset that contains the requested pixel detector data.
85  * The Groupname of the Event can be omitted. Default is "Invalid"
86  * @cassttng HDF5FileInput/PixelDetectorValues/\%index\%/{CASSID}\n
87  * The id that the pixel detector should have whithin the CASSEvent
88  * Default is 0.
89  *
90  * @author Lutz Foucar
91  */
92 class HDF5FileInput : public InputBase
93 {
94 public:
95  /** create instance of this
96  *
97  * @param filelistname name of the file containing all files that should be
98  * processed
99  * @param ringbuffer reference to the ringbuffer containing the CASSEvents
100  * @param ratemeter reference to the ratemeter to measure the rate of the input
101  * @param loadmeter reference to the ratemeter to measure the load of the input
102  * @param quitwhendone flag that tells this class that it should quit the
103  * Program when its done reading all events
104  * @param parent The parent QT Object of this class
105  */
106  static void instance(std::string filelistname,
108  Ratemeter &ratemeter,
109  Ratemeter &loadmeter,
110  bool quitwhendone,
111  QObject *parent=0);
112 
113  /** function with the main loop */
114  void runthis();
115 
116  /** load the parameters used for the multifile input */
117  void load();
118 
119 public:
120  /** parameters needed to retrieve the Acqiris data */
122  {
123  /** name of the waveform datafield */
124  std::string DataKey;
125  /** name of the field that contains the horpos value */
126  std::string HorposKey;
127  /** name of the field that contains the vertical offset value */
128  std::string VertOffsetKey;
129  /** name of the field that contains the gain value */
130  std::string GainKey;
131  /** name of the field that contains the sample interval */
132  std::string SampleIntervalKey;
133  /** the instrument within the CASSEvent that should be used */
134  uint32_t Instrument;
135  /** the channel with the instrument within the CASSEvent that the data should
136  * loaded to
137  */
139  };
140 
141  /** parameters needed to retrieve the pixeldetector data */
143  {
144  /** name of the waveform datafield */
145  std::string DataKey;
146 
147  /** the id of the pixeldetector that it should have in the CASSEvent */
148  int CASSID;
149  };
150 
151 private:
152  /** constructor
153  *
154  * @param filelistname name of the file containing all files that should be
155  * processed
156  * @param ringbuffer reference to the ringbuffer containing the CASSEvents
157  * @param ratemeter reference to the ratemeter to measure the rate of the input
158  * @param loadmeter reference to the ratemeter to measure the load of the input
159  * @param quitwhendone flag that tells this class that it should quit the
160  * Program when its done reading all events
161  * @param parent The parent QT Object of this class
162  */
163  HDF5FileInput(std::string filelistname,
165  Ratemeter &ratemeter,
166  Ratemeter &loadmeter,
167  bool quitwhendone,
168  QObject *parent=0);
169 
170  /** flag to tell the thread to quit when its done with all files */
172 
173  /** name of the file containing all files that we need to process */
174  std::string _filelistname;
175 
176 };
177 
178 }//end namespace cass
179 
180 #endif
bool _quitWhenDone
flag to tell the thread to quit when its done with all files
std::string HorposKey
name of the field that contains the horpos value
class calculating a rate in Hz.
Definition: ratemeter.h:28
HDF5FileInput(std::string filelistname, RingBuffer< CASSEvent > &, Ratemeter &ratemeter, Ratemeter &loadmeter, bool quitwhendone, QObject *parent=0)
constructor
file contains declaration of the CASSEvent
int CASSID
the id of the pixeldetector that it should have in the CASSEvent
Input base class.
Definition: input_base.h:31
std::string GainKey
name of the field that contains the gain value
std::string DataKey
name of the waveform datafield
std::string DataKey
name of the waveform datafield
A Ringbuffer, handles communication between Input and Worker Threads.
Definition: ringbuffer.hpp:52
parameters needed to retrieve the pixeldetector data
contains base class for all file readers
file contains the ringbuffer class
file contains global definitions for project cass
void load()
load the parameters used for the multifile input
static shared_pointer instance()
get the signelton instance
Definition: input_base.cpp:20
uint32_t Instrument
the instrument within the CASSEvent that should be used
contains the base class for all input modules
std::string _filelistname
name of the file containing all files that we need to process
HDF5 File Input for cass.
std::string SampleIntervalKey
name of the field that contains the sample interval
size_t ChannelNumber
the channel with the instrument within the CASSEvent that the data should loaded to ...
std::string VertOffsetKey
name of the field that contains the vertical offset value
parameters needed to retrieve the Acqiris data
void runthis()
function with the main loop