FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
PndMQDataDuplicator Class Reference

#include <PndMQDataDuplicator.h>

Inheritance diagram for PndMQDataDuplicator:

Public Member Functions

 PndMQDataDuplicator ()
 
virtual ~PndMQDataDuplicator ()
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 
void SetRateRatio (int channel, int ratio)
 

Protected Member Functions

virtual void Run ()
 

Protected Attributes

std::vector< int > fRates
 
bool fHasBoostSerialization
 
std::vector< PndSdsDigiTopix4fTopixData
 

Friends

class boost::serialization::access
 

Detailed Description

PndMQDataDuplicator.h

Since
2014-10-10
Author
A. Rybalchenko

Definition at line 29 of file PndMQDataDuplicator.h.

Constructor & Destructor Documentation

PndMQDataDuplicator::PndMQDataDuplicator ( )

PndMQDataDuplicator.cpp

Since
2014-10-10
Author
A. Rybalchenko

Definition at line 24 of file PndMQDataDuplicator.cxx.

References fRates.

25 {
26  fRates.push_back(0);
27  fRates.push_back(200);
28 }
std::vector< int > fRates
PndMQDataDuplicator::~PndMQDataDuplicator ( )
virtual

Definition at line 95 of file PndMQDataDuplicator.cxx.

96 {
97 }

Member Function Documentation

void PndMQDataDuplicator::Run ( )
protectedvirtual

Definition at line 30 of file PndMQDataDuplicator.cxx.

References counter, fRates, i, status, PndMQStatus::STOP, and PndMQStatus::UNDEFINED.

31 {
32  uint64_t counter = 0;
33 
34  const FairMQChannel& dataInChannel = fChannels.at("data-in").at(0);
35 
36  while (CheckCurrentState(RUNNING))
37  {
38  std::unique_ptr<FairMQMessage> header(fTransportFactory->CreateMessage());
39  std::unique_ptr<FairMQMessage> msg(fTransportFactory->CreateMessage());
41  if (dataInChannel.Receive(header) > 0)
42  {
43  status = *(static_cast<int*>(header->GetData()));
44 
45  if (dataInChannel.ExpectsAnotherPart())
46  {
47  if (dataInChannel.Receive(msg) > 0)
48  {
49  counter++;
50  if (fChannels.at("data-out").size() > 1)
51  {
52  for (int i = 1; i < fChannels.at("data-out").size(); ++i)
53  {
54  if (i < fRates.size()){
55  //LOG(INFO) << "Channel: " << i;
56  if ( counter%fRates[i] == 0 ){
57  //LOG(INFO) << "SendMessage";
58  std::unique_ptr<FairMQMessage> headerCopy(fTransportFactory->CreateMessage());
59  headerCopy->Copy(header);
60  fChannels.at("data-out").at(i).SendPart(headerCopy);
61  std::unique_ptr<FairMQMessage> msgCopy(fTransportFactory->CreateMessage());
62  msgCopy->Copy(msg);
63  fChannels.at("data-out").at(i).Send(msgCopy);
64  }
65  }
66  }
67  std::unique_ptr<FairMQMessage> headerCopy(fTransportFactory->CreateMessage());
68  headerCopy->Copy(header);
69  fChannels.at("data-out").at(0).SendPart(headerCopy);
70  std::unique_ptr<FairMQMessage> msgCopy(fTransportFactory->CreateMessage());
71  msgCopy->Copy(msg);
72  fChannels.at("data-out").at(0).Send(msgCopy);
73  }
74  else
75  {
76  std::unique_ptr<FairMQMessage> headerCopy(fTransportFactory->CreateMessage());
77  headerCopy->Copy(header);
78  fChannels.at("data-out").at(0).SendPart(headerCopy);
79  std::unique_ptr<FairMQMessage> msgCopy(fTransportFactory->CreateMessage());
80  msgCopy->Copy(msg);
81  fChannels.at("data-out").at(0).Send(msgCopy);
82  }
83  }
84  } else {
85  std::unique_ptr<FairMQMessage> headerCopy(fTransportFactory->CreateMessage());
86  headerCopy->Copy(header);
87  fChannels.at("data-out").at(0).Send(headerCopy);
88  }
89  if (status == PndMQStatus::STOP)
90  LOG(INFO) << "STOP-Signal Received!";
91  }
92  }
93 }
Int_t i
Definition: run_full.C:25
int counter
Definition: ZeeAnalysis.C:59
std::vector< int > fRates
int status[10]
Definition: f_Init.h:28
template<class Archive >
void PndMQDataDuplicator::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 36 of file PndMQDataDuplicator.h.

References fTopixData.

37  {
38  ar& fTopixData;
39  }
std::vector< PndSdsDigiTopix4 > fTopixData
void PndMQDataDuplicator::SetRateRatio ( int  channel,
int  ratio 
)
inline

Definition at line 41 of file PndMQDataDuplicator.h.

References fRates.

Referenced by main().

41  {
42  if (channel > fRates.size() - 1){
43  fRates.resize(channel + 1, 0);
44  }
45  fRates[channel] = ratio;
46  }
std::vector< int > fRates

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 54 of file PndMQDataDuplicator.h.

Member Data Documentation

bool PndMQDataDuplicator::fHasBoostSerialization
protected

Definition at line 55 of file PndMQDataDuplicator.h.

std::vector<int> PndMQDataDuplicator::fRates
protected

Definition at line 51 of file PndMQDataDuplicator.h.

Referenced by PndMQDataDuplicator(), Run(), and SetRateRatio().

std::vector<PndSdsDigiTopix4> PndMQDataDuplicator::fTopixData
protected

Definition at line 57 of file PndMQDataDuplicator.h.

Referenced by serialize().


The documentation for this class was generated from the following files: