82#include "TRestRealTimeDrawingProcess.h"
84#include "TRestMessenger.h"
132 TiXmlElement* ele =
GetElement(
"TRestAnalysisPlot");
133 while (ele !=
nullptr) {
137 plt->SetName(plt->GetName() +
138 (TString)ToString(
this));
146 TiXmlElement* ele =
GetElement(
"ProcessDrawing");
147 while (ele !=
nullptr) {
149 if (GetFriendLive(proc) ==
nullptr) {
150 RESTError <<
"TRestRealTimeDrawingProcess: cannot find process \"" << proc
151 <<
"\" to call drawing!" <<
RESTendl;
169 if (GetFullAnalysisTree() ==
nullptr) {
184 RESTInfo <<
"TRestRealTimeDrawingProcess: reached drawing flag. Waiting for other processes to pause"
188 if (iter->first ==
this)
continue;
190 while (iter->second ==
false) {
196 <<
"TRestRealTimeDrawingProcess: waiting time reaches maximum, plotting job aborted"
205 RESTInfo <<
"TRestRealTimeDrawingProcess: drawing..." <<
RESTendl;
220 RESTInfo <<
"TRestRealTimeDrawingProcess: end drawing..." <<
RESTendl;
227void TRestRealTimeDrawingProcess::DrawOnce() {
228 Long64_t totalentries = GetFullAnalysisTree()->GetEntries();
229 for (
unsigned int i = 0; i <
fPlots.size(); i++) {
231 fPlots[i]->PlotCombinedCanvas();
239 auto messager = GetMetadata<TRestMessenger>();
241 if (runNumber == -1) {
242 RESTError <<
"TRestRealTimeDrawingProcess::DrawWithNotification: runNumber must be given!"
244 RESTError <<
"consider adding \"--d xx\" in restManager command" <<
RESTendl;
249 string message = messager->ConsumeMessage();
251 RESTInfo <<
"Recieveing message: " << message <<
RESTendl;
254 int _runNumber = run->GetRunNumber();
256 if (_runNumber == runNumber) {
257 for (
auto& plot :
fPlots) {
258 plot->SetFile(message);
259 plot->PlotCombinedCanvas();
264 RESTWarning <<
"file: " << message <<
RESTendl;
265 RESTWarning <<
"It is not the file we wanted! runNumber in file: " << _runNumber
266 <<
", run we are processing: " << runNumber <<
RESTendl;
267 messager->SendMessage(message);
282 RESTMetadata <<
"Number of AnalysisPlots added: " <<
fPlots.size() <<
RESTendl;
284 RESTMetadata << p->GetName();
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
static Long64_t fLastDrawnEntry
Last drawn entry of analysis tree.
static std::vector< TRestAnalysisPlot * > fPlots
TRestAnalysisPlot object called for drawing.
static std::map< TRestRealTimeDrawingProcess *, bool > fPauseResponse
Pause response flag from other threads when recieving pause signal.
TRestEvent * fEvent
The event pointer is not used in this process.
static std::vector< std::string > fProcessesToDraw
TRestAnalysisPlot object called for drawing.
void EndProcess() override
Function to use when all events have been processed.
void DrawWithNotification()
Returns a new instance of this class.
Int_t fThreadWaitTimeoutMs
How many events passed when it starts next drawing.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
void InitProcess() override
Function to use in initialization of process members before starting to process the event.
TRestRealTimeDrawingProcess()
Default constructor.
void Initialize() override
Function to initialize input/output event members and define the section name and library version.
int fDrawInterval
How many events passed when it starts next drawing.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
static bool fPauseInvoke
Pause signal send for other threads when start drawing.
~TRestRealTimeDrawingProcess()
Default destructor.
Data provider and manager in REST.
Int_t StringToInteger(std::string in)
Gets an integer from a string.