17 #include <boost/thread.hpp>
18 #include <boost/bind.hpp>
19 #include <boost/archive/binary_oarchive.hpp>
20 #include <boost/archive/text_oarchive.hpp>
21 #include <boost/archive/binary_iarchive.hpp>
22 #include <boost/archive/text_iarchive.hpp>
23 #include <boost/serialization/export.hpp>
24 #include <boost/serialization/unique_ptr.hpp>
26 #include "FairMQLogger.h"
28 #include "FairMQMessage.h"
30 #include "FairEventHeader.h"
70 for (
unsigned int ifile = 1 ; ifile <
fFileNames.size() ; ifile++ )
74 LOG(INFO) <<
"Going to request " <<
fBranchNames.size() <<
" branches:";
78 for (
unsigned int ibrn = 0 ; ibrn <
fBranchNames.size() ; ibrn++ ) {
80 LOG(INFO) <<
" requesting branch \"" <<
fBranchNames[ibrn].second <<
"\"";
83 LOG(INFO) <<
"BranchStat: " << branchStat;
85 LOG(INFO) <<
"Activated object \"" <<
fInputBranches[branchName] <<
"\" with name \"" <<
fBranchNames[ibrn].second <<
" for channel " <<
fBranchNames[ibrn].first <<
"/ (" << branchStat <<
")";
91 LOG(INFO) <<
"Input source has " <<
fMaxIndex <<
" events.";
97 if (branchName ==
"MVDPixelDigis")
99 else if (branchName ==
"MVDStripDigis")
101 else if (branchName ==
"STTHit")
103 else if (branchName ==
"MVDHitsStrip")
123 delete static_cast<std::string*
>(hint);
127 int eventCounter = 0;
131 while (CheckCurrentState(RUNNING)) {
134 Int_t readEventReturn =
fSource->ReadEvent(eventCounter);
136 if (readEventReturn != 0)
143 if (branchItr.first.find(
".") == std::string::npos){
144 std::vector<std::vector< FairTimeStamp* > > data;
145 TClonesArray* tmpArray = (TClonesArray*)branchItr.second;
154 LOG(INFO) <<
"FinishRun";
156 if (branchItr.first.find(
".") == std::string::npos){
168 for (
auto portIt =
fPorts.begin(); portIt !=
fPorts.end(); portIt++){
171 for (
auto dataIt =
fOutputData[branchIt->second].begin(); dataIt !=
fOutputData[branchIt->second].end(); ++dataIt){
173 if (dataIt->size() > 0){
175 std::vector<std::vector<FairTimeStamp*> > dataVector;
176 dataVector.push_back(*dataIt);
177 bData.
fData = dataVector;
181 std::ostringstream obuffer;
182 boost::archive::binary_oarchive OutputArchive(obuffer);
183 OutputArchive << bData;
184 std::string* strMsg =
new std::string(obuffer.str());
185 unique_ptr<FairMQMessage> msg(NewMessage(const_cast<char*>(strMsg->c_str()), strMsg->length(),
free_string, strMsg));
186 LOG(INFO) <<
"Send message: " << bData.fHeader.fBranchName <<
" " << bData.fHeader.fBurstID <<
" size: " << msg->GetSize();
199 LOG(INFO) <<
"Going out of RUNNING state.";
FairEventHeader * fEventHeader
virtual ~PndMvdMQFileSamplerBursts()
std::vector< std::pair< std::string, std::string > > fBranchNames
Class for digitised strip hits.
std::map< std::string, PndBurstVectorBuilderBase * > fBurstBuilder
TMessage2(void *buf, Int_t len)
BOOST_CLASS_EXPORT_GUID(PndSdsHit,"PndSdsHit")
virtual void InitBurstBuilder(std::string branchName)
void free_string(void *data, void *hint)
std::vector< std::string > fFileNames
std::set< std::string > fPorts
PndMvdMQFileSamplerBursts()
std::vector< std::vector< FairTimeStamp * > > fData
std::multimap< std::string, std::string > fPortBranchNameMap
Data class to store the digi output of a pixel module.
std::map< std::string, std::vector< std::vector< FairTimeStamp * > > > fOutputData
std::map< std::string, TObject * > fInputBranches