CFEL - ASG Software Suite  2.5.0
CASS
histo_updater.h
Go to the documentation of this file.
1 //Copyright (C) 2011 Lutz Foucar
2 
3 /**
4  * @file histo_updater.h file contains the classes that update histograms
5  *
6  * @author Lutz Foucar
7  */
8 
9 #ifndef _HISTOUPDATER_H_
10 #define _HISTOUPDATER_H_
11 
12 #include <memory>
13 #include <string>
14 
15 #include <TTimer.h>
16 
18 {
19 public:
20  /** constructor
21  *
22  * connects the timers Timeout() signal with the updateHistogram() method
23  * of this class
24  *
25  * @param server the server ip or name
26  * @param port the server port
27  */
28  HistogramUpdater(const std::string &server, int port);
29 
30  /** update the shown histograms
31  *
32  * create the server address from the _server and _port members. With this
33  * create a tcpclient object and use it to retrieve the list of available
34  * histograms. Use checkList() to filter out the ones that need to be updated.
35  * Now go through the list of to update histograms and call updateHist() for
36  * each one of them. After that update all Pads in the Canvases using
37  * updateCanvases().
38  */
39  void syncHistograms();
40 
41  /** copy a single result into a histogram
42  *
43  * @param name The name of the result to retrieve
44  */
45  void syncHistogram(const std::string &name);
46 
47  /** set the server
48  *
49  * @param server the server ip or name
50  */
51  void setServer(const std::string & server) {_server = server;}
52 
53  /** set server port
54  *
55  * @param port port that the server listens to
56  */
57  void setPort(int port) {_port = port;}
58 
59  /** automaticly update
60  *
61  * start autoupdate with requested frequency. If frequency is 0 stop
62  * autoupdate.
63  *
64  * @param freq The frequency with which the histogram should be updated in Hz
65  */
66  void autoSync(double freq);
67 
68  /** set the updateCanvas flag
69  *
70  * @param update the flag status
71  */
72  void alsoUpdateCanvas(bool update) {_updateCanv = update;}
73 
74  /** write all histograms to a root file
75  *
76  * first update all available histograms, then go through the list of root
77  * histograms and write them to file
78  *
79  * @param name the name of the root file
80  */
81  void writeRootFile(const std::string& name);
82 
83  /** tell the server reload the .ini parameters */
84  void reloadIni();
85 
86  /** control the dark calibration */
87  void controlCalibration(const std::string& command="startDarkcal");
88 
89 private:
90  /** the server */
91  std::string _server;
92 
93  /** the server port */
94  int _port;
95 
96  /** the timer for auto update */
97  std::auto_ptr<TTimer> _timer;
98 
99  /** flag whether after updating the histogram the canvas should also update */
101 };
102 
103 /** global acces variable for updater */
105 
106 #endif
R__EXTERN HistogramUpdater * gCASSClient
global acces variable for updater
void setPort(int port)
set server port
Definition: histo_updater.h:57
void writeRootFile(const std::string &name)
write all histograms to a root file
std::auto_ptr< TTimer > _timer
the timer for auto update
Definition: histo_updater.h:97
void alsoUpdateCanvas(bool update)
set the updateCanvas flag
Definition: histo_updater.h:72
HistogramUpdater(const std::string &server, int port)
constructor
void autoSync(double freq)
automaticly update
bool _updateCanv
flag whether after updating the histogram the canvas should also update
void controlCalibration(const std::string &command="startDarkcal")
control the dark calibration
void syncHistograms()
update the shown histograms
int _port
the server port
Definition: histo_updater.h:94
void syncHistogram(const std::string &name)
copy a single result into a histogram
void reloadIni()
tell the server reload the .ini parameters
void setServer(const std::string &server)
set the server
Definition: histo_updater.h:51
std::string _server
the server
Definition: histo_updater.h:91