7 #include <FairMQDevice.h>
8 #include <TClonesArray.h>
29 fTree->Write(
"", TObject::kOverwrite);
34 if (fOutFile->IsOpen()) {
44 fNumMsgs = fConfig->GetValue<
int>(
"num-msgs");
45 fFileName = fConfig->GetValue<std::string>(
"output-file");
46 fOutFile = TFile::Open(fFileName.c_str(),
"RECREATE");
47 fInput =
new TClonesArray(
"MyHit");
48 fTree =
new TTree(
"SerializationEx1",
"Test output");
49 fTree->Branch(
"MyHit",
"TClonesArray", &fInput);
55 while (!NewStatePending()) {
56 FairMQMessagePtr msg(NewMessage());
57 if (Receive(msg,
"data2") > 0) {
58 Deserialize<RootSerializer>(*msg, fInput);
60 fTree->SetBranchAddress(
"MyHit", &fInput);
64 if (receivedMsgs == fNumMsgs) {
70 LOG(info) <<
"Received " << receivedMsgs <<
" messages!";
75 std::string fFileName;
Ex1Sink & operator=(const Ex1Sink &)