12#include "BoostSerializer.h"
13#include "FairMQLogger.h"
14#include "FairMQProgOptions.h"
15#include "RootSerializer.h"
20#include <boost/archive/binary_iarchive.hpp>
21#include <boost/serialization/utility.hpp>
29 using std::runtime_error::runtime_error;
39 LOG(info) <<
"Init options for CbmDevTrigger.";
42 const std::string sTriggerDet = fConfig->GetValue<std::string>(
"TriggerDet");
44 fMinNumDigis = fConfig->GetValue<int32_t>(
"TriggerMinDigis");
45 fDeadTime = fConfig->GetValue<
double>(
"TriggerDeadTime");
56 throw InitTaskError(
"CbmDevTrigger: Trigger detector not set.");
60 LOG(error) << e.what();
87 LOG(info) <<
"Received message number " <<
fNumMessages <<
" with " << parts.Size() <<
" parts"
88 <<
", size0: " << parts.At(0)->GetSize();
95 std::string msgStrTS(
static_cast<char*
>(parts.At(0)->GetData()), (parts.At(0))->GetSize());
96 std::istringstream issTS(msgStrTS);
97 boost::archive::binary_iarchive inputArchiveTS(issTS);
110 LOG(debug) <<
"triggers: " << triggers.size();
122 std::vector<double> vDigiTimes;
156 default: LOG(fatal) <<
"CbmDevTrigger::GetTriggerTimes(): Reading digis from unknown detector type!";
158 LOG(debug) <<
"CbmDevTrigger::GetTriggerTimes(): Building triggers from " << vDigiTimes.size() <<
" digis.";
164 LOG(debug) <<
"Vector size: " << vTriggers.size();
166 FairMQParts partsOut;
167 partsOut.AddPart(std::move(partsIn.At(0)));
168 partsOut.AddPart(std::move(partsIn.At(1)));
171 std::stringstream ossTrig;
172 boost::archive::binary_oarchive oaTrig(ossTrig);
174 std::string* strMsgTrig =
new std::string(ossTrig.str());
176 partsOut.AddPart(NewMessage(
177 const_cast<char*
>(strMsgTrig->c_str()),
178 strMsgTrig->length(),
179 [](
void*,
void*
object) { delete static_cast<std::string*>(object); },
@ kTrd
Transition Radiation Detector.
@ kTof
Time-of-flight Detector.
@ kPsd
Projectile spectator detector.
@ kSts
Silicon Tracking System.
@ kMuch
Muon detection system.
@ kFsd
Forward spectator detector.
@ kRich
Ring-Imaging Cherenkov Detector.
std::vector< CbmBmonDigi > fDigis
Data vector.
std::string fChannelNameDataOutput
std::vector< double > GetTriggerTimes(const CbmDigiTimeslice &ts)
ECbmModuleId GetDetectorId(std::string detName)
std::unique_ptr< cbm::algo::evbuild::TimeClusterTrigger > fTriggerAlgo
Processing algos.
uint64_t fNumMessages
Statistics.
bool HandleData(FairMQParts &, int)
bool SendTriggers(const std::vector< double > &vTriggers, FairMQParts &partsIn)
std::string fChannelNameDataInput
message queues
std::vector< double > GetDigiTimes(gsl::span< const TDigi > digiVec)
CbmPsdDigiData fPsd
PSD data.
CbmTrdDigiData fTrd
TRD data.
CbmTofDigiData fTof
TOF data.
CbmStsDigiData fSts
STS data.
CbmFsdDigiData fFsd
FSD data.
CbmRichDigiData fRich
RICH data.
CbmMuchDigiData fMuch
MUCH data.
CbmBmonDigiData fBmon
Beam monitor data.
Collection of digis from all detector systems within one timeslice.
CbmDigiData fData
Timeslice data.
std::vector< CbmFsdDigi > fDigis
Data vector.
std::vector< CbmMuchDigi > fDigis
Data vector.
std::vector< CbmPsdDigi > fDigis
Data vector.
std::vector< CbmRichDigi > fDigis
Data vector.
std::vector< CbmStsDigi > fDigis
Data vector.
std::vector< CbmTofDigi > fDigis
Data vector.
std::vector< CbmTrdDigi > fDigis
Data vector.
void ChangeState(FairMQDevice *device, cbm::mq::Transition transition)