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

#include <PndMQTopix4Processor.h>

Inheritance diagram for PndMQTopix4Processor:

Public Types

enum  { FE = FairMQDevice::Last, TimeCorr, Last }
 

Public Member Functions

 PndMQTopix4Processor ()
 
virtual ~PndMQTopix4Processor ()
 
virtual void SetProperty (const int key, const std::string &value)
 
virtual std::string GetProperty (const int key, const std::string &default_="")
 
virtual void SetProperty (const int key, const int value)
 
virtual int GetProperty (const int key, const int default_=0)
 
void SetFilter (bool val)
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Protected Member Functions

virtual void Run ()
 

Private Attributes

std::vector< PndSdsDigiTopix4fPndSdsDigiTopix4Vector
 
std::vector< int > fStatusValues
 
bool fHasBoostSerialization
 
int fFE
 
double fTimeStampCorrection
 
std::string fTimeCorrStr
 
PndMvdReadInToPix4TBData fTopixDataReader
 

Friends

class boost::serialization::access
 

Detailed Description

PndMQTopix4Sink.h

Since
2014-10-10
Author
A. Rybalchenko

Definition at line 25 of file PndMQTopix4Processor.h.

Member Enumeration Documentation

anonymous enum
Enumerator
FE 
TimeCorr 
Last 

Definition at line 28 of file PndMQTopix4Processor.h.

Constructor & Destructor Documentation

PndMQTopix4Processor::PndMQTopix4Processor ( )

Definition at line 32 of file PndMQTopix4Processor.cxx.

References fHasBoostSerialization.

32  : fHasBoostSerialization(false)
33 {
34  using namespace baseMQ::tools::resolve;
35  bool checkOutputClass = false;
36 
37 
38  if (is_same<boost::archive::binary_oarchive, boost::archive::binary_oarchive>::value)
39  {
40  if (has_BoostSerialization<PndSdsDigiTopix4, void(boost::archive::binary_oarchive&, const unsigned int)>::value == 1)
41  {
42  checkOutputClass = true;
44  }
45  }
46  LOG(INFO) << "HasBoostSerialization: " << fHasBoostSerialization;
47 }
Data class to store the digi output of a pixel module.
PndMQTopix4Processor::~PndMQTopix4Processor ( )
virtual

Definition at line 49 of file PndMQTopix4Processor.cxx.

50 {
51 }

Member Function Documentation

virtual std::string PndMQTopix4Processor::GetProperty ( const int  key,
const std::string &  default_ = "" 
)
virtual
int PndMQTopix4Processor::GetProperty ( const int  key,
const int  default_ = 0 
)
virtual

Definition at line 175 of file PndMQTopix4Processor.cxx.

References FE, and fFE.

176 {
177  switch (key)
178  {
179  case FE:
180  return fFE;
181  default:
182  return FairMQDevice::GetProperty(key, default_);
183  }
184 }
void PndMQTopix4Processor::Run ( )
protectedvirtual

Definition at line 54 of file PndMQTopix4Processor.cxx.

References PndMvdReadInToPix4TBData::AnalyzeData(), fPndSdsDigiTopix4Vector, fStatusValues, fTopixDataReader, PndTopix4::GetRawData(), PndMvdReadInToPix4TBData::GetStatusValues(), TMrfData_8b::regdata, PndMQStatus::RUNNING, PndMvdReadInToPix4TBData::SetFilter(), TMrfData_8b::setNumWords(), status, and PndMQStatus::STOP.

55 {
56  int eventCounter = 0;
58  while (CheckCurrentState(RUNNING))
59  {
60  unique_ptr<FairMQMessage> input(fTransportFactory->CreateMessage());
61  unique_ptr<FairMQMessage> headerPart(fTransportFactory->CreateMessage());
62 
63  if (fChannels.at("data-in").at(0).Receive(headerPart) > 0)
64  {
65  int status = *(static_cast<int*>(headerPart->GetData()));
66 
67  //LOG(INFO) << "Status: " << status;
68 
69  if (status == PndMQStatus::RUNNING){
70  if (fChannels.at("data-in").at(0).Receive(input) > 0) {
71 
72  //LOG(INFO) << "Received data, processing...";
73  TMrfData_8b* message = new TMrfData_8b();
74  message->setNumWords(input->GetSize());
75  memcpy(reinterpret_cast<u_int8_t*>(&message->regdata[0]),input->GetData(), input->GetSize());
76  // LOG(INFO) << "Received message: \""
77  // << message->getNumWords() << " " << message->getNumBits()
78  // << "\"";
79  std::vector<ULong64_t> rawArray;
80  PndTopix4 topix;
81  rawArray = topix.GetRawData(message);
82  std::vector<std::vector<PndSdsDigiTopix4> > frames = fTopixDataReader.AnalyzeData(rawArray, 50);
84  for (auto frameIter : frames){
85  fPndSdsDigiTopix4Vector.insert(fPndSdsDigiTopix4Vector.end(), frameIter.begin(), frameIter.end());
86  }
87  if (fPndSdsDigiTopix4Vector.size() > 0){
88 
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);
92 
93  ostringstream obuffer;
94  boost::archive::binary_oarchive OutputArchive(obuffer);
95  OutputArchive << fPndSdsDigiTopix4Vector;
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);
100  // LOG(INFO) << "Data: " << frames.front().size() << std::endl;
101  }
102 
103  if (eventCounter%10000 == 0){
105  LOG(INFO) << "StatusValues taken: " << fStatusValues.size();
106 
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);
110 
111  ostringstream obuffer;
112  boost::archive::binary_oarchive OutputArchive(obuffer);
113  OutputArchive << fStatusValues;
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);
118  }
119 
120  eventCounter++;
121  }
122  } else if (status == PndMQStatus::STOP){
123  LOG(INFO) << "Catched STOP signal!";
124 
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);
128  //ChangeState("STOP");
129  }
130  }
131  }
132 }
PndMvdReadInToPix4TBData fTopixDataReader
void setNumWords(const UInt_t &length)
Sets the length of the register to lengths words.
std::vector< std::vector< PndSdsDigiTopix4 > > AnalyzeData(std::vector< ULong64_t > &rawData, Double_t clockFrequency)
std::vector< int > fStatusValues
std::vector< ULong64_t > GetRawData(TMrfData_8b *data)
Definition: PndTopix4.cxx:25
std::vector< int > GetStatusValues() const
std::vector< PndSdsDigiTopix4 > fPndSdsDigiTopix4Vector
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.
int status[10]
Definition: f_Init.h:28
template<class Archive >
void PndMQTopix4Processor::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Definition at line 46 of file PndMQTopix4Processor.h.

References fPndSdsDigiTopix4Vector, and fStatusValues.

47  {
49  ar& fStatusValues;
50  }
std::vector< int > fStatusValues
std::vector< PndSdsDigiTopix4 > fPndSdsDigiTopix4Vector
void PndMQTopix4Processor::SetFilter ( bool  val)
inline

Definition at line 43 of file PndMQTopix4Processor.h.

References fTopixDataReader, and PndMvdReadInToPix4TBData::SetFilter().

Referenced by main().

PndMvdReadInToPix4TBData fTopixDataReader
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
virtual void PndMQTopix4Processor::SetProperty ( const int  key,
const std::string &  value 
)
virtual

Referenced by main().

void PndMQTopix4Processor::SetProperty ( const int  key,
const int  value 
)
virtual

Definition at line 161 of file PndMQTopix4Processor.cxx.

References FE, fFE, fTopixDataReader, and PndMvdReadInToPix4TBData::SetFE().

162 {
163  switch (key)
164  {
165  case FE:
166  fFE = value;
168  break;
169  default:
170  FairMQDevice::SetProperty(key, value);
171  break;
172  }
173 }
PndMvdReadInToPix4TBData fTopixDataReader

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 56 of file PndMQTopix4Processor.h.

Member Data Documentation

int PndMQTopix4Processor::fFE
private

Definition at line 62 of file PndMQTopix4Processor.h.

Referenced by GetProperty(), and SetProperty().

bool PndMQTopix4Processor::fHasBoostSerialization
private

Definition at line 61 of file PndMQTopix4Processor.h.

Referenced by PndMQTopix4Processor().

std::vector<PndSdsDigiTopix4> PndMQTopix4Processor::fPndSdsDigiTopix4Vector
private

Definition at line 58 of file PndMQTopix4Processor.h.

Referenced by Run(), and serialize().

std::vector<int> PndMQTopix4Processor::fStatusValues
private

Definition at line 59 of file PndMQTopix4Processor.h.

Referenced by Run(), and serialize().

std::string PndMQTopix4Processor::fTimeCorrStr
private

Definition at line 64 of file PndMQTopix4Processor.h.

double PndMQTopix4Processor::fTimeStampCorrection
private

Definition at line 63 of file PndMQTopix4Processor.h.

PndMvdReadInToPix4TBData PndMQTopix4Processor::fTopixDataReader
private

Definition at line 66 of file PndMQTopix4Processor.h.

Referenced by Run(), SetFilter(), and SetProperty().


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