21 #include <FairMQLogger.h>
22 #include <FairMQMessage.h>
25 #include <TObjString.h>
35 FairMQMessagePtr mess(NewMessage());
36 Serialize<RootSerializer>(*mess, obj);
38 FairMQMessagePtr rep(NewMessage());
40 printf(
"sending %s", obj->GetName());
41 if (Send(mess, chan) > 0) {
42 if (Receive(rep, chan) > 0) {
43 std::string repString = string(static_cast<char*>(rep->GetData()), rep->GetSize());
44 LOG(info) <<
" -> " << repString.data();
52 LOG(debug) <<
"called FairMQRunDevice::SendBranches()!!!!";
57 for (
auto& mi : fChannels) {
58 LOG(debug) <<
"trying channel >" << mi.first.data() <<
"<";
62 for (Int_t t = 0; t < branchNameList->GetEntries(); t++) {
63 ObjStr =
static_cast<TObjString*
>(branchNameList->TList::At(t));
64 LOG(debug) <<
" branch >" << ObjStr->GetString().Data() <<
"<";
65 std::string modifiedBranchName = std::string(
"#") + ObjStr->GetString().Data() +
"#";
66 if (mi.first.find(modifiedBranchName) != std::string::npos || mi.first.find(
"#all#") != std::string::npos) {
68 ->IsPersistentBranchAny(ObjStr->GetString())) {
69 LOG(debug) <<
"Branch \"" << ObjStr->GetString() <<
"\" is persistent ANY";
70 if (ObjStr->GetString().CompareTo(
"MCTrack") == 0) {
71 TClonesArray** mcTrackArray =
73 ->GetPersistentBranchAny<TClonesArray**>(ObjStr->GetString());
75 (*mcTrackArray)->SetName(
"MCTrack");
77 << mcTrackArray <<
" /// *mcTrackArray " << *mcTrackArray
78 <<
" /// *mcTrackArray->GetName() " << (*mcTrackArray)->GetName();
79 TObject* objClone = (*mcTrackArray)->Clone();
80 LOG(debug) <<
"FairMQRunDevice::SendBranches() the track array has "
81 << ((TClonesArray*)(objClone))->GetEntries() <<
" entries.";
82 FairMQMessagePtr mess(NewMessage());
83 Serialize<RootSerializer>(*mess, objClone);
84 parts.AddPart(std::move(mess));
85 LOG(debug) <<
"channel >" << mi.first.data() <<
"< --> >" << ObjStr->GetString().Data()
89 LOG(warning) <<
"FairMQRunDevice::SendBranches() hasn't got knowledge how to send any branch \""
90 << ObjStr->GetString().Data() <<
"\"";
96 TObject* objClone =
object->Clone();
97 FairMQMessagePtr mess(NewMessage());
98 Serialize<RootSerializer>(*mess, objClone);
99 parts.AddPart(std::move(mess));
100 LOG(debug) <<
"channel >" << mi.first.data() <<
"< --> >" << ObjStr->GetString().Data() <<
"<";
102 LOG(fatal) <<
"Object " << ObjStr->GetString() <<
" NOT FOUND!!!";
107 if (parts.Size() > 0) {
108 std::unique_lock<std::mutex> lock(
mtx);
109 Send(parts, mi.first.data());
static FairRootManager * Instance()
TObject * GetObject(const char *BrName)
void SendObject(TObject *obj, const std::string &chan)
TList * GetBranchNameList()
virtual void SendBranches()
Int_t GetInstanceId() const