|
15 | 15 |
|
16 | 16 | #include "TRDReconstruction/DataReaderTask.h" |
17 | 17 | #include "TRDReconstruction/CruRawReader.h" |
| 18 | + |
18 | 19 | #include "Framework/ControlService.h" |
19 | 20 | #include "Framework/ConfigParamRegistry.h" |
20 | 21 | #include "Framework/RawDeviceService.h" |
21 | 22 | #include "Framework/DeviceSpec.h" |
22 | 23 | #include "Framework/DataSpecUtils.h" |
| 24 | +#include "Framework/InputRecordWalker.h" |
| 25 | + |
23 | 26 | #include "DataFormatsTRD/Constants.h" |
| 27 | + |
24 | 28 | #include <fairmq/FairMQDevice.h> |
25 | 29 |
|
26 | 30 | //using namespace o2::framework; |
@@ -62,28 +66,45 @@ void DataReaderTask::run(ProcessingContext& pc) |
62 | 66 | auto outputRoutes = pc.services().get<o2::framework::RawDeviceService>().spec().outputs; |
63 | 67 | auto fairMQChannel = outputRoutes.at(0).channel; |
64 | 68 | int inputcount = 0; |
| 69 | + std::vector<InputSpec> dummy{InputSpec{"filter", ConcreteDataTypeMatcher{"FLP", "DISTSUBTIMEFRAME"}, Lifetime::Timeframe}}; |
| 70 | + // if we see requested data type input with 0xDEADBEEF subspec and 0 payload this means that the "delayed message" |
| 71 | + // // mechanism created it in absence of real data from upstream. Processor should send empty output to not block the workflow |
| 72 | + |
| 73 | + for (const auto& ref : InputRecordWalker(pc.inputs(), dummy)) { |
| 74 | + const auto dh = o2::framework::DataRefUtils::getHeader<o2::header::DataHeader*>(ref); |
| 75 | + if (dh->payloadSize == 16) { |
| 76 | + LOGP(WARNING, "Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : assuming no payload for all links in this TF", |
| 77 | + dh->dataOrigin.str, dh->dataDescription.str, dh->subSpecification, dh->tfCounter, dh->firstTForbit, dh->payloadSize); |
| 78 | + sendData(pc); //send the empty tf data. |
| 79 | + return; |
| 80 | + } |
| 81 | + LOG(info) << " matched DEADBEEF"; |
| 82 | + } |
| 83 | + //TODO combine the previous and subsequent loops. |
| 84 | + int inputcounts = 0; |
65 | 85 | /* loop over inputs routes */ |
66 | 86 | for (auto iit = pc.inputs().begin(), iend = pc.inputs().end(); iit != iend; ++iit) { |
| 87 | + LOG(info) << " looping over inputs " << inputcounts; |
| 88 | + inputcounts++; |
67 | 89 | if (!iit.isValid()) { |
68 | 90 | continue; |
69 | 91 | } |
70 | 92 | /* loop over input parts */ |
| 93 | + int inputpartscount = 0; |
71 | 94 | for (auto const& ref : iit) { |
72 | | - |
| 95 | + LOG(info) << " looping over parts " << inputpartscount; |
| 96 | + if (mVerbose) { |
| 97 | + const auto dh = DataRefUtils::getHeader<o2::header::DataHeader*>(ref); |
| 98 | + LOGP(info, "Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : assuming no payload for all links in this TF", |
| 99 | + dh->dataOrigin.str, dh->dataDescription.str, dh->subSpecification, dh->tfCounter, dh->firstTForbit, dh->payloadSize); |
| 100 | + } |
73 | 101 | const auto* headerIn = DataRefUtils::getHeader<o2::header::DataHeader*>(ref); |
74 | 102 | auto payloadIn = ref.payload; |
75 | 103 | auto payloadInSize = headerIn->payloadSize; |
76 | 104 | if (!mCompressedData) { //we have raw data coming in from flp |
77 | 105 | if (mVerbose) { |
78 | | - LOG(info) << " parsing non compressed data in the data reader task"; |
| 106 | + LOG(info) << " parsing non compressed data in the data reader task with a payload of " << payloadInSize << " payload size"; |
79 | 107 | } |
80 | | - |
81 | | - int a = 1; |
82 | | - int d = 1; |
83 | | - // while(d==1){ |
84 | | - // a=sin(rand()); |
85 | | - // } |
86 | | - |
87 | 108 | mReader.setDataBuffer(payloadIn); |
88 | 109 | mReader.setDataBufferSize(payloadInSize); |
89 | 110 | mReader.configure(mByteSwap, mVerbose, mHeaderVerbose, mDataVerbose); |
|
0 commit comments