CFEL - ASG Software Suite  2.5.0
CASS
sacla_online_input.h
Go to the documentation of this file.
1 // Copyright (C) 2015 Lutz Foucar
2 
3 /**
4  * @file sacla_online_input.h contains input that uses the sacla online interface
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _SACLAONLINEINPUT_
10 #define _SACLAONLINEINPUT_
11 
12 #include <string>
13 
14 #include "cass.h"
15 #include "input_base.h"
16 
17 
18 namespace cass
19 {
20 /** Online Input to be used at SACLA
21  *
22  * Makes use of the "OnlineUserAPI" to retrieve the detector data online. All
23  * data that is stored in the database is retrieved using the
24  * SACLADataAccessUserAPI.
25  *
26  * @note At least one pixel detector is needed in order to be able to retrieve
27  * data using the SACLADataAccessUserAPI, since the runnumber is needed to
28  * retrieve the needed hightag number.
29  *
30  * @cassttng SACLAOnlineInput/{MaxGuessedEvents}\n
31  * The number of consecutive events that should be guessed. Once this
32  * number of events has been reached. The latest tag number will
33  * be retrieved for the next event. Default is 60.
34  * @cassttng SACLAOnlineInput/{BeamlineNumber}\n
35  * The Beamline at which the experiment is running. Default is 3
36  * @cassttng SACLAOnlineInput/OctalPixelDetectors/{size}\n
37  * The number of octal pixeldetectors that one wants to
38  * retrieve. Ensure that each parameter has a unique id in the list.
39  * @cassttng SACLAOnlineInput/OctalPixelDetectors/\%index\%/{CASSID}\n
40  * The id of the detector that CASS will use internally.
41  * Default is "-1" which will cause to skip this index.
42  * @cassttng SACLAOnlineInput/OctalPixelDetectors/\%index\%/{NextTagNumberAdvancedBy}\n
43  * It is needed to guess the next tag number therefore one has to
44  * tell how much the tag number advanced from one shot to the next.
45  * The tag number is increased with 60 Hz. Therefore at 30 Hz this
46  * number should be 2. Default is 2.
47  * @cassttng SACLAOnlineInput/OctalPixelDetectors/\%index\%/Tiles/{size}\n
48  * The number of tiles contained within the octal pixeldetectors
49  * Ensure that each parameter has a unique id in the list.
50  * @cassttng SACLAOnlineInput/OctalPixelDetectors/\%index\%/Tiles/\%index\%/{TileName}\n
51  * Name of the tile in the SACLA DAQ. Default is "Invalid".
52  * @cassttng SACLAOnlineInput/OctalPixelDetectors/\%index\%/Tiles/\%index\%{NbrCalibrationRows}\n
53  * Number of additional rows that are not part of the image but used for
54  * calibrating the image. Default is 6.
55  * @cassttng SACLAOnlineInput/OctalPixelDetectors/\%index\%/Tiles/\%index\%{NormalizeTo}\n
56  * Using this option one can control whether the pixel values of this
57  * tile will be normalized to the gain value of which other
58  * tile. The pixel values of this tile will be modified using:
59  * \f$ pixval_{tile} = \frac{gain_{tile}}{gain_{NormalizeTo}}*pixval_{tile}\f$
60  * Default is 0 in which case the tile will not be normalized.
61  * @cassttng SACLAOnlineInput/DatabaseValues/{size}\n
62  * The number of values one wants to retrieve from the database. Be sure
63  * that for each detector there is a unique id in the list below.
64  * At least one pixel detector is needed in order to be able to
65  * retrieve data using the SACLADataAccessUserAPI, since the runnumber
66  * is needed to retrieve the needed hightag number.
67  * @cassttng SACLAOnlineInput/DatabaseValues/\%index\%/{ValueName}\n
68  * The name of the database value to retrieve. Default is "Invalid"
69  * which will cause to skip that index.
70  * @cassttng SACLAOnlineInput/DatabaseValues/\%index\%/{CASSName}\n
71  * The name that the value should have within the CASSEvent. Default is
72  * "Invalid" in which case the name of the value will be chosen.
73  *
74  * @author Lutz Foucar
75  */
77 {
78 public:
79  /** create an instance of this
80  *
81  * this initializes the _instance member of the base class. Check here if
82  * it is already initialized, if so throw logic error.
83  *
84  * @param buffer the ringbuffer, that we take events out and fill it
85  * with the incomming information
86  * @param ratemeter reference to the ratemeter to measure the rate of the input
87  * @param loadmeter reference to the ratemeter to measure the load of the input
88  * @param parent the parent of this object
89  */
90  static void instance(RingBuffer<CASSEvent>& buffer,
91  Ratemeter &ratemeter, Ratemeter &loadmeter,
92  QObject *parent=0);
93 
94  /** starts the thread
95  *
96  * this is the main while loop collecting the requested data and making it
97  * available using the ringbuffer.
98  */
99  void runthis();
100 
101  /** do not load anything after it is started */
102  void load() {}
103 
104  /** retrieve the number of processed events
105  *
106  * @return number of processed events
107  */
108  uint64_t eventcounter() {return _evtCounter;}
109 
110  /** retrieve the number of skipped processed events
111  *
112  * @return number of processed events
113  */
115 
116 private:
117  /** constructor
118  *
119  * creates the thread.
120  *
121  * @param buffer the ringbuffer, that we take events out and fill it
122  * with the incomming information
123  * @param ratemeter reference to the ratemeter to measure the rate of the input
124  * @param loadmeter reference to the ratemeter to measure the load of the input
125  * @param parent the parent of this object
126  */
128  Ratemeter &ratemeter, Ratemeter &loadmeter,
129  QObject *parent=0);
130 
131  /** a counter for the events so far */
132  uint64_t _evtCounter;
133 
134  /** a counter for the skipped events so far */
136 };
137 
138 }//end namespace cass
139 
140 #endif
uint64_t _evtCounter
a counter for the events so far
class calculating a rate in Hz.
Definition: ratemeter.h:28
Input base class.
Definition: input_base.h:31
SACLAOnlineInput(RingBuffer< CASSEvent > &buffer, Ratemeter &ratemeter, Ratemeter &loadmeter, QObject *parent=0)
constructor
Online Input to be used at SACLA.
uint64_t skippedeventcounter()
retrieve the number of skipped processed events
A Ringbuffer, handles communication between Input and Worker Threads.
Definition: ringbuffer.hpp:52
file contains global definitions for project cass
static shared_pointer instance()
get the signelton instance
Definition: input_base.cpp:20
contains the base class for all input modules
void load()
do not load anything after it is started
uint64_t _skippedEvtCounter
a counter for the skipped events so far
uint64_t eventcounter()
retrieve the number of processed events
void runthis()
starts the thread