Skip to content

Commit 12917b5

Browse files
committed
safter sending of blank frames
1 parent c97ca70 commit 12917b5

3 files changed

Lines changed: 19 additions & 16 deletions

File tree

Detectors/TRD/reconstruction/include/TRDReconstruction/DataReaderTask.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DataReaderTask : public Task
3838
DataReaderTask(bool compresseddata, bool byteswap, bool verbose, bool headerverbose, bool dataverbose) : mCompressedData(compresseddata), mByteSwap(byteswap), mVerbose(verbose), mHeaderVerbose(headerverbose), mDataVerbose(dataverbose) {}
3939
~DataReaderTask() override = default;
4040
void init(InitContext& ic) final;
41-
void sendData(ProcessingContext& pc);
41+
void sendData(ProcessingContext& pc, bool blankframe = false);
4242
void run(ProcessingContext& pc) final;
4343

4444
private:
@@ -57,6 +57,7 @@ class DataReaderTask : public Task
5757
bool mHeaderVerbose{false}; // verbose output of headers
5858
bool mCompressedData{false}; // are we dealing with the compressed data from the flp (send via option)
5959
bool mByteSwap{true}; // whether we are to byteswap the incoming data, mc is not byteswapped, raw data is (too be changed in cru at some point)
60+
o2::header::DataDescription mDataSpec; // input spec of th raw incoming data
6061
};
6162

6263
} // namespace o2::trd

Detectors/TRD/reconstruction/src/DataReader.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
9292
// LOG(info) << "expected incoming data definition : " << inputspec;
9393
// this is probably never going to be used but would to nice to know hence here.
9494
auto orig = o2::header::gDataOriginTRD;
95-
std::vector<InputSpec> inputs{{"stf", ConcreteDataTypeMatcher{orig, "RAWDATA"}, Lifetime::Optional}};
95+
auto inputs = o2::framework::select(inputspec.c_str());
96+
for (auto& inp : inputs) {
97+
// take care of case where our data is not in the time frame
98+
inp.lifetime = Lifetime::Optional;
99+
}
96100
if (askSTFDist) {
97101
inputs.emplace_back("stdDist", "FLP", "DISTSUBTIMEFRAME", 0, Lifetime::Timeframe);
98102
}

Detectors/TRD/reconstruction/src/DataReaderTask.cxx

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ void DataReaderTask::init(InitContext& ic)
4343
ic.services().get<CallbackService>().set(CallbackService::Id::Stop, finishFunction);
4444
}
4545

46-
void DataReaderTask::sendData(ProcessingContext& pc)
46+
void DataReaderTask::sendData(ProcessingContext& pc, bool blankframe)
4747
{
4848
// mReader.getParsedObjects(mTracklets,mDigits,mTriggers);
49-
mReader.getParsedObjects(mTracklets, mDigits, mTriggers);
49+
if (!blankframe) {
50+
mReader.getParsedObjects(mTracklets, mDigits, mTriggers);
51+
}
5052

51-
LOG(info) << "Sending data onwards with " << mDigits.size() << " Digits and " << mTracklets.size() << " Tracklets and " << mTriggers.size() << " Triggers";
53+
LOG(info) << "Sending data onwards with " << mDigits.size() << " Digits and " << mTracklets.size() << " Tracklets and " << mTriggers.size() << " Triggers and blankframe:" << blankframe;
5254
pc.outputs().snapshot(Output{o2::header::gDataOriginTRD, "DIGITS", 0, Lifetime::Timeframe}, mDigits);
5355
pc.outputs().snapshot(Output{o2::header::gDataOriginTRD, "TRACKLETS", 0, Lifetime::Timeframe}, mTracklets);
5456
pc.outputs().snapshot(Output{o2::header::gDataOriginTRD, "TRKTRGRD", 0, Lifetime::Timeframe}, mTriggers);
@@ -65,34 +67,31 @@ void DataReaderTask::run(ProcessingContext& pc)
6567
auto device = pc.services().get<o2::framework::RawDeviceService>().device();
6668
auto outputRoutes = pc.services().get<o2::framework::RawDeviceService>().spec().outputs;
6769
auto fairMQChannel = outputRoutes.at(0).channel;
68-
int inputcount = 0;
69-
std::vector<InputSpec> dummy{InputSpec{"filter", ConcreteDataTypeMatcher{"FLP", "DISTSUBTIMEFRAME"}, Lifetime::Timeframe}};
70+
mDataSpec = o2::header::gDataDescriptionRawData;
71+
72+
std::vector<InputSpec> dummy{InputSpec{"dummy", ConcreteDataMatcher{"TRD", mDataSpec, 0xDEADBEEF}}};
7073
// if we see requested data type input with 0xDEADBEEF subspec and 0 payload this means that the "delayed message"
7174
// // mechanism created it in absence of real data from upstream. Processor should send empty output to not block the workflow
7275

7376
for (const auto& ref : InputRecordWalker(pc.inputs(), dummy)) {
7477
const auto dh = o2::framework::DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
75-
if (dh->payloadSize == 16) {
78+
if (dh->payloadSize == 16 || dh->payloadSize == 0) {
7679
LOGP(WARNING, "Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : assuming no payload for all links in this TF",
7780
dh->dataOrigin.str, dh->dataDescription.str, dh->subSpecification, dh->tfCounter, dh->firstTForbit, dh->payloadSize);
78-
sendData(pc); //send the empty tf data.
81+
sendData(pc, true); //send the empty tf data.
7982
return;
8083
}
8184
LOG(info) << " matched DEADBEEF";
8285
}
8386
//TODO combine the previous and subsequent loops.
84-
int inputcounts = 0;
8587
/* loop over inputs routes */
8688
for (auto iit = pc.inputs().begin(), iend = pc.inputs().end(); iit != iend; ++iit) {
87-
LOG(info) << " looping over inputs " << inputcounts;
88-
inputcounts++;
8989
if (!iit.isValid()) {
9090
continue;
9191
}
9292
/* loop over input parts */
9393
int inputpartscount = 0;
9494
for (auto const& ref : iit) {
95-
LOG(info) << " looping over parts " << inputpartscount;
9695
if (mVerbose) {
9796
const auto dh = DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
9897
LOGP(info, "Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : assuming no payload for all links in this TF",
@@ -135,10 +134,9 @@ void DataReaderTask::run(ProcessingContext& pc)
135134
mTriggers = mCompressedReader.getIR();
136135
//get the payload of trigger and digits out.
137136
}
138-
/* output */
139-
//sendData(pc); //TODO do we ever have to not post the data. i.e. can we get here mid event? I dont think so.
140137
}
141-
sendData(pc); //TODO do we ever have to not post the data. i.e. can we get here mid event? I dont think so.
138+
/* output */
139+
sendData(pc, false); //TODO do we ever have to not post the data. i.e. can we get here mid event? I dont think so.
142140
}
143141

144142
auto dataReadTime = std::chrono::high_resolution_clock::now() - dataReadStart;

0 commit comments

Comments
 (0)