8#include <daq/dataflow/EvtSocket.h>
9#include <framework/pcore/EvtMessage.h>
10#include <framework/pcore/MsgHandler.h>
18#include "TDirectory.h"
27void StreamHistogramsInDir(TDirectory* curdir,
MsgHandler* hdl,
int& numobjs)
29 TList* keylist = curdir->GetListOfKeys();
31 TIter nextkey(keylist);
33 int nkeys [[maybe_unused]] = 0;
34 int nobjs [[maybe_unused]] = 0;
35 while ((key = (TKey*)nextkey())) {
37 TObject* obj = key->ReadObj();
38 if (obj->IsA()->InheritsFrom(
"TH1")) {
40 hdl->
add(h1, h1->GetName());
43 }
else if (obj->IsA()->InheritsFrom(TDirectory::Class())) {
44 TDirectory* tdir = (TDirectory*) obj;
45 printf(
"subdir: %s\n", tdir->GetName());
46 TText subdir(0, 0, tdir->GetName());
47 hdl->
add(&subdir,
"SUBDIR:" +
string(obj->GetName())) ;
51 StreamHistogramsInDir(tdir, hdl, numobjs);
52 TText command(0, 0,
"COMMAND:EXIT");
53 hdl->
add(&command,
"SUBDIR:EXIT");
61int main(
int argc,
char** argv)
64 printf(
"Usage : hsendfile file host port\n");
67 string file = string(argv[1]);
68 string host = string(argv[2]);
69 int port = atoi(argv[3]);
76 TFile* f =
new TFile(file.c_str());
78 StreamHistogramsInDir(f, &hdl, numobjs);
81 (msg->
header())->reserved[0] = 0;
82 (msg->
header())->reserved[1] = numobjs;
Class to manage streamed object.
EvtHeader * header()
Get pointer to EvtHeader.
A class to encode/decode an EvtMessage.
virtual void add(const TObject *, const std::string &name)
Add an object to be streamed.
virtual EvtMessage * encode_msg(ERecordType rectype)
Stream object list into an EvtMessage.
Abstract base class for different kinds of events.