/******************************************************************************** * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence version 3 (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ /** * PndMQTopix4Sink.cxx * * @since 2014-10-10 * @author A. Rybalchenko */ #include #include #include #include #include #include "baseMQtools.h" #include "FairMQLogger.h" #include "mrfdata_8b.h" #include "PndSdsDigiTopix4.h" using namespace std; PndMQTopix4ProcessorTask::PndMQTopix4ProcessorTask() : fHasBoostSerialization(false) { using namespace baseMQ::tools::resolve; bool checkOutputClass = false; if (is_same::value) { if (has_BoostSerialization::value == 1) { checkOutputClass = true; fHasBoostSerialization = true; } } LOG(INFO) << "HasBoostSerialization: " << fHasBoostSerialization; } void PndMQTopix4ProcessorTask::Exec(Option_t* opt) { TMrfData_8b* message = new TMrfData_8b(); message->setNumWords(fPayload->GetSize()); memcpy(reinterpret_cast(&message->regdata[0]),fPayload->GetData(), fPayload->GetSize()); // LOG(INFO) << "Received message: \"" // << message->getNumWords() << " " << message->getNumBits() // << "\""; std::vector rawArray; rawArray = fTopixDataReader.GetRawData(message); std::vector > frames = fTopixDataReader.AnalyzeData(rawArray, 50); LOG(INFO) << "Frames.size " << frames.size(); if (frames.size() > 0) LOG(INFO) << "Frames.front().size() " << frames.front().size(); if (frames.size() > 0){ ostringstream obuffer; boost::archive::binary_oarchive OutputArchive(obuffer); fPndSdsDigiTopix4Vector = frames.front(); OutputArchive << fPndSdsDigiTopix4Vector; int outputSize = obuffer.str().length(); fPayload->Rebuild(outputSize); memcpy(fPayload->GetData(), obuffer.str().c_str(), outputSize); //unique_ptr msg2(fTransportFactory->CreateMessage(const_cast(obuffer.str().c_str()), outputSize, CustomCleanup, &obuffer)); //fChannels.at("data-out").at(0).Send(msg); LOG(INFO) << "Data: " << frames.front().size(); } } PndMQTopix4ProcessorTask::~PndMQTopix4ProcessorTask() { }