19 #include <FairMQLogger.h>
31 , fInputChannelName(
"data-in")
41 , fOutputObjects(new TObject*[1000])
46 fFileName = fConfig->GetValue<std::string>(
"file-name");
47 fInputChannelName = fConfig->GetValue<std::string>(
"in-channel");
48 fAckChannelName = fConfig->GetValue<std::string>(
"ack-channel");
50 LOG(info) <<
"SHOULD CREATE THE FILE AND TREE";
51 fFileOption =
"RECREATE";
54 if (::getenv(
"DDS_SESSION_ID")) {
55 std::string DDS_SESSION_ID = ::getenv(
"DDS_SESSION_ID");
56 if (fFileName.length() > 5) {
57 DDS_SESSION_ID =
"." + DDS_SESSION_ID +
".root";
58 fFileName.replace(fFileName.length() - 5, 5, DDS_SESSION_ID.c_str());
62 fOutFile = TFile::Open(fFileName.c_str(), fFileOption.c_str());
69 bool creatingTree =
false;
70 std::vector<TObject*> tempObjects;
73 fTree =
new TTree(fTreeName.c_str(),
"/cbmout");
76 for (
int ipart = 0; ipart < parts.Size(); ipart++) {
77 fOutputObjects[ipart] =
nullptr;
78 Deserialize<RootSerializer>(*parts.At(ipart), fOutputObjects[ipart]);
79 tempObjects.push_back(fOutputObjects[ipart]);
81 fTree->Branch(tempObjects.back()->GetName(), tempObjects.back()->ClassName(), &fOutputObjects[ipart]);
82 fTree->SetBranchAddress(tempObjects.back()->GetName(), &fOutputObjects[ipart]);
87 for (
unsigned int ipart = 0; ipart < tempObjects.size(); ipart++) {
88 if (tempObjects[ipart]) {
89 delete tempObjects[ipart];
94 if (fAckChannelName !=
"") {
95 unique_ptr<FairMQMessage> msg(NewMessage());
96 Send(msg, fAckChannelName);
108 if (fOutFile->IsOpen()) {
bool StoreData(FairMQParts &, int)
void ResetTask() override
virtual ~FairMQPixelFileSink()