4 #include "KVOnlineReconDataAnalyser.h"
5 #include "KVMultiDetArray.h"
7 #include "KVReconEventSelector.h"
10 #include "dataflowports.h"
12 #include <KVZMQMessage.h>
26 SetStatusUpdateInterval(2.5);
50 std::cout <<
"The selector \"" <<
GetUserClass() <<
"\" is not valid." << std::endl;
51 std::cout <<
"Process aborted." << std::endl;
62 Warning(
"SubmitTask",
"Did you forget to give option 'dataflowhost' in InitAnalysis()?");
70 zmq::context_t context(1);
71 std::string zmq_spy_port = Form(
"tcp://%s:%d",
fSelector->
GetOpt(
"dataflowhost").Data(), PORT_EVENT_PUB);
72 zmq::socket_t pub(context, ZMQ_SUB);
74 pub.setsockopt(ZMQ_RCVTIMEO, &timeout,
sizeof(
int));
76 pub.connect(zmq_spy_port.c_str());
78 catch (zmq::error_t& e) {
79 Error(
"SubmitTask",
"failed to connect socket: %s", e.what());
82 std::cout <<
"Connected to EventPublisher " << zmq_spy_port << std::endl;
83 pub.setsockopt(ZMQ_SUBSCRIBE,
"", 0);
90 Double_t fStartTime = fTimeStamp.Convert();
95 if (pub.recv(&event)) {
109 Double_t time = fTimeStamp.Convert();
111 std::cout <<
"~" << (int)(nev / (time - fStartTime)) <<
" events/s. tot = " << nevt << std::endl;
Double_t GetStatusUpdateInterval() const
virtual void postAnalysis()
const KVString & GetUserClassOptions() const
const Char_t * GetUserClass()
virtual void postInitRun()
virtual void postInitAnalysis()
TObject * GetInstanceOfUserClass(const KVString &alternative_base_class="")
const KVDataSet * GetDataSet() const
virtual void InitAnalysis()
virtual Bool_t Analysis()
Bool_t IsOptGiven(const Char_t *option)
TString GetOpt(const Char_t *option) const
virtual void EndAnalysis()
virtual void ParseOptions()
void SetEvent(KVEvent *e)
static KVMultiDetArray * MakeMultiDetector(const Char_t *dataset_name, Int_t run=-1, TString classname="KVMultiDetArray")
Online analysis of reconstructed data.
void SubmitTask() override
Bool_t CheckStatusUpdateInterval(Int_t) const
void preInitAnalysis() override
void preInitRun() override
void preAnalysis() override
Set minimum (trigger) multiplicity for array.
Manages user analysis of reconstructed experimental data.
KVReconEventSelector * fSelector
the data analysis class
Base class for user analysis of reconstructed data.
KVReconstructedEvent * GetEvent() const
Event containing KVReconstructedNucleus nuclei reconstructed from hits in detectors.
Allow to send/receive ROOT/KV objects between ZeroMQ sockets.