tdaq-develop-2025-02-12
RawDataVisualizerConsumerImpl.cc
1 #include "otsdaq/DataProcessorPlugins/RawDataVisualizerConsumer.h"
2 
3 #include "otsdaq/Macros/CoutMacros.h"
4 #include "otsdaq/MessageFacility/MessageFacility.h"
5 
6 using namespace ots;
7 
8 //==============================================================================
9 RawDataVisualizerConsumer::RawDataVisualizerConsumer(
10  std::string supervisorApplicationUID,
11  std::string bufferUID,
12  std::string processorUID,
13  const ConfigurationTree& theXDAQContextConfigTree,
14  const std::string& configurationPath)
15  : WorkLoop(processorUID)
16  , DataConsumer(supervisorApplicationUID, bufferUID, processorUID, LowConsumerPriority)
17  , Configurable(theXDAQContextConfigTree, configurationPath)
18 {
19 }
20 
21 //==============================================================================
22 RawDataVisualizerConsumer::~RawDataVisualizerConsumer(void) {}
23 
24 //==============================================================================
26 {
28 }
29 
30 //==============================================================================
31 void RawDataVisualizerConsumer::stopProcessingData(void)
32 {
33  DataConsumer::stopProcessingData();
34 }
35 
36 //==============================================================================
37 bool RawDataVisualizerConsumer::workLoopThread(toolbox::task::WorkLoop* /*workLoop*/)
38 {
39  __COUT__ << DataProcessor::processorUID_
40  << " running, because workloop: " << WorkLoop::continueWorkLoop_
41  << std::endl;
42  slowRead(); // fastRead();
43  return WorkLoop::continueWorkLoop_;
44 }
45 
46 //==============================================================================
47 void RawDataVisualizerConsumer::fastRead(void)
48 {
49  //__COUT__ << processorUID_ << " running!" << std::endl;
50  // This is making a copy!!!
51  if(DataConsumer::read(dataP_, headerP_) < 0)
52  {
53  usleep(100);
54  return;
55  }
56  __COUT__ << DataProcessor::processorUID_ << " UID: " << supervisorApplicationUID_
57  << std::endl;
58 
59  // //HW emulator
60  // // Burst Type | Sequence | 8B data
61  // __COUT__ << "Size fill: " << dataP_->length() << std::endl;
62  // dqmHistos_->fill(*dataP_,*headerP_);
63 
64  DataConsumer::setReadSubBuffer<std::string, std::map<std::string, std::string>>();
65 }
66 
67 //==============================================================================
68 void RawDataVisualizerConsumer::slowRead(void)
69 {
70  // This is making a copy!!!
71  if(DataConsumer::read(data_, header_) < 0)
72  {
73  usleep(1000);
74  return;
75  }
76  __COUT__ << DataProcessor::processorUID_ << " UID: " << supervisorApplicationUID_
77  << std::endl;
78 }
int read(D &buffer, H &header)
Copies the buffer into the passed parameters.
Definition: DataConsumer.h:38
virtual void startProcessingData(std::string runNumber)
void startProcessingData(std::string runNumber) override