8 #include <FairMQDevice.h>
9 #include <TClonesArray.h>
26 virtual void Init() { fNumMsgs = fConfig->GetValue<
int>(
"num-msgs"); }
33 while (!NewStatePending()) {
35 FairMQMessagePtr msgIn(NewMessageFor(
"data1", 0));
36 if (Receive(msgIn,
"data1") > 0) {
40 std::unique_ptr<TClonesArray> digis(
nullptr);
41 Deserialize<RootSerializer>(*msgIn, digis);
44 TClonesArray hits =
FindHits(*digis);
47 FairMQMessagePtr msgOut(NewMessageFor(
"data2", 0));
48 Serialize<RootSerializer>(*msgOut, &hits);
51 Send(msgOut,
"data2");
55 if (receivedMsgs == fNumMsgs) {
61 LOG(info) <<
"Received " << receivedMsgs <<
" and sent " << sentMsgs <<
" messages!";
65 TClonesArray
FindHits(
const TClonesArray& digis)
67 TClonesArray hits(
"MyHit");
69 for (
int i = 0; i < digis.GetEntriesFast(); i++) {
78 dpos.SetXYZ(1 / TMath::Sqrt(12), 1 / TMath::Sqrt(12), 1 / TMath::Sqrt(12));
79 MyHit* hit =
new ((hits)[i])
MyHit(fDetID, fMCIndex, pos, dpos);
91 #endif // EX1PROCESSOR_H
void SetXYZ(Int_t x, Int_t y, Int_t z)
Ex1Processor & operator=(const Ex1Processor &)
TClonesArray FindHits(const TClonesArray &digis)
Double_t GetTimeStampError() const
Double_t GetTimeStamp() const
void SetTimeStamp(Double_t t)
void SetTimeStampError(Double_t t)