15 #include <boost/thread.hpp>
16 #include <boost/bind.hpp>
17 #include <boost/archive/binary_oarchive.hpp>
20 #include "baseMQtools.h"
22 #include "FairMQLogger.h"
23 #include "mrfdata_8b.h"
34 using namespace baseMQ::tools::resolve;
35 bool checkOutputClass =
false;
38 if (is_same<boost::archive::binary_oarchive, boost::archive::binary_oarchive>::value)
40 if (has_BoostSerialization<
PndSdsDigiTopix4,
void(boost::archive::binary_oarchive&,
const unsigned int)>::value == 1)
42 checkOutputClass =
true;
58 while (CheckCurrentState(RUNNING))
60 unique_ptr<FairMQMessage> input(fTransportFactory->CreateMessage());
61 unique_ptr<FairMQMessage> headerPart(fTransportFactory->CreateMessage());
63 if (fChannels.at(
"data-in").at(0).Receive(headerPart) > 0)
65 int status = *(
static_cast<int*
>(headerPart->GetData()));
70 if (fChannels.at(
"data-in").at(0).Receive(input) > 0) {
75 memcpy(reinterpret_cast<u_int8_t*>(&message->
regdata[0]),input->GetData(), input->GetSize());
79 std::vector<ULong64_t> rawArray;
84 for (
auto frameIter : frames){
89 unique_ptr<FairMQMessage> header(fTransportFactory->CreateMessage(
sizeof(
int)));
90 memcpy(header->GetData(), &
status,
sizeof(int));
91 fChannels.at(
"data-out").at(0).SendPart(header);
93 ostringstream obuffer;
94 boost::archive::binary_oarchive OutputArchive(obuffer);
96 int outputSize = obuffer.str().length();
97 unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage(outputSize));
98 memcpy(msg->GetData(), obuffer.str().c_str(), outputSize);
99 fChannels.at(
"data-out").at(0).Send(msg);
103 if (eventCounter%10000 == 0){
107 unique_ptr<FairMQMessage> header(fTransportFactory->CreateMessage(
sizeof(
int)));
108 memcpy(header->GetData(), &
status,
sizeof(int));
109 fChannels.at(
"status-out").at(0).SendPart(header);
111 ostringstream obuffer;
112 boost::archive::binary_oarchive OutputArchive(obuffer);
114 int outputSize = obuffer.str().length();
115 unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage(outputSize));
116 memcpy(msg->GetData(), obuffer.str().c_str(), outputSize);
117 fChannels.at(
"status-out").at(0).Send(msg);
123 LOG(INFO) <<
"Catched STOP signal!";
125 unique_ptr<FairMQMessage> header(fTransportFactory->CreateMessage(
sizeof(
int)));
126 memcpy(header->GetData(), &
status,
sizeof(int));
127 fChannels.at(
"data-out").at(0).Send(header);
144 FairMQDevice::SetProperty(key, value);
157 return FairMQDevice::GetProperty(key, default_);
170 FairMQDevice::SetProperty(key, value);
182 return FairMQDevice::GetProperty(key, default_);
PndMvdReadInToPix4TBData fTopixDataReader
double fTimeStampCorrection
Data class to store the digi output of a pixel module.
void setNumWords(const UInt_t &length)
Sets the length of the register to lengths words.
virtual ~PndMQTopix4Processor()
std::vector< std::vector< PndSdsDigiTopix4 > > AnalyzeData(std::vector< ULong64_t > &rawData, Double_t clockFrequency)
std::vector< int > fStatusValues
virtual std::string GetProperty(const int key, const std::string &default_="")
std::vector< ULong64_t > GetRawData(TMrfData_8b *data)
std::vector< int > GetStatusValues() const
std::vector< PndSdsDigiTopix4 > fPndSdsDigiTopix4Vector
void SetTimeStampCorrection(Double_t val)
Base interface class for data storage and manipulation. Compatible with IO classes from MRF Suite...
std::vector< UChar_t > regdata
Internal storage for data structure.
virtual void SetProperty(const int key, const std::string &value)
bool fHasBoostSerialization
void SetFilter(Bool_t val)