@@ -47,14 +47,15 @@ void DataReaderTask::sendData(ProcessingContext& pc, bool blankframe)
4747{
4848 // mReader.getParsedObjects(mTracklets,mDigits,mTriggers);
4949 if (!blankframe) {
50- mReader .getParsedObjects (mTracklets , mDigits , mTriggers );
50+ mReader .buildDPLOutputs (pc); // getParsedObjectsandClear(mTracklets, mDigits, mTriggers);
51+ } else {
52+ // ensure the objects we are sending back are indeed blank.
53+ LOG (info) << " Sending data onwards with " << mDigits .size () << " Digits and " << mTracklets .size () << " Tracklets and " << mTriggers .size () << " Triggers and blankframe:" << blankframe;
54+ pc.outputs ().snapshot (Output{o2::header::gDataOriginTRD , " DIGITS" , 0 , Lifetime::Timeframe}, mDigits );
55+ pc.outputs ().snapshot (Output{o2::header::gDataOriginTRD , " TRACKLETS" , 0 , Lifetime::Timeframe}, mTracklets );
56+ pc.outputs ().snapshot (Output{o2::header::gDataOriginTRD , " TRKTRGRD" , 0 , Lifetime::Timeframe}, mTriggers );
57+ // pc.outputs().snapshot(Output{o2::header::gDataOriginTRD,"STATS",0,Lifetime::Timerframe},mStats);
5158 }
52-
53- LOG (info) << " Sending data onwards with " << mDigits .size () << " Digits and " << mTracklets .size () << " Tracklets and " << mTriggers .size () << " Triggers and blankframe:" << blankframe;
54- pc.outputs ().snapshot (Output{o2::header::gDataOriginTRD , " DIGITS" , 0 , Lifetime::Timeframe}, mDigits );
55- pc.outputs ().snapshot (Output{o2::header::gDataOriginTRD , " TRACKLETS" , 0 , Lifetime::Timeframe}, mTracklets );
56- pc.outputs ().snapshot (Output{o2::header::gDataOriginTRD , " TRKTRGRD" , 0 , Lifetime::Timeframe}, mTriggers );
57- // pc.outputs().snapshot(Output{o2::header::gDataOriginTRD,"STATS",0,Lifetime::Timerframe},mStats);
5859}
5960
6061void DataReaderTask::run (ProcessingContext& pc)
@@ -67,16 +68,16 @@ void DataReaderTask::run(ProcessingContext& pc)
6768 auto device = pc.services ().get <o2::framework::RawDeviceService>().device ();
6869 auto outputRoutes = pc.services ().get <o2::framework::RawDeviceService>().spec ().outputs ;
6970 auto fairMQChannel = outputRoutes.at (0 ).channel ;
70- mDataSpec = o2::header::gDataDescriptionRawData ;
7171
72- std::vector<InputSpec> dummy{InputSpec{" dummy" , ConcreteDataMatcher{" TRD" , mDataSpec , 0xDEADBEEF }}};
73- // if we see requested data type input with 0xDEADBEEF subspec and 0 payload this means that the "delayed message"
72+ std::vector<InputSpec> dummy{InputSpec{" dummy" , ConcreteDataMatcher{" TRD" , " RAWDATA" , 0xDEADBEEF }}};
73+ // std::vector<InputSpec> dummy{InputSpec{"dummy", ConcreteDataMatcher{"TRD","RAWDATA"/* mDataDesc.c_str()*/, 0xDEADBEEF}}};
74+ // if we see requested data type input with 0xDEADBEEF subspec and 0 payload this mecans that the "delayed message"
7475 // // mechanism created it in absence of real data from upstream. Processor should send empty output to not block the workflow
7576
7677 for (const auto & ref : InputRecordWalker (pc.inputs (), dummy)) {
7778 const auto dh = o2::framework::DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
78- if (dh->payloadSize == 16 || dh->payloadSize == 0 ) {
79- LOGP (WARNING , " Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : assuming no payload for all links in this TF " ,
79+ if (dh->payloadSize == 0 ) { // } || dh->payloadSize==16 ) {
80+ LOGP (WARNING , " Found blank input input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : " ,
8081 dh->dataOrigin .str , dh->dataDescription .str , dh->subSpecification , dh->tfCounter , dh->firstTForbit , dh->payloadSize );
8182 sendData (pc, true ); // send the empty tf data.
8283 return ;
@@ -94,49 +95,50 @@ void DataReaderTask::run(ProcessingContext& pc)
9495 for (auto const & ref : iit) {
9596 if (mVerbose ) {
9697 const auto dh = DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
97- LOGP (info, " Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : assuming no payload for all links in this TF " ,
98+ LOGP (info, " Found input [{}/{}/{:#x}] TF#{} 1st_orbit:{} Payload {} : " ,
9899 dh->dataOrigin .str , dh->dataDescription .str , dh->subSpecification , dh->tfCounter , dh->firstTForbit , dh->payloadSize );
99100 }
100101 const auto * headerIn = DataRefUtils::getHeader<o2::header::DataHeader*>(ref);
101102 auto payloadIn = ref.payload ;
102103 auto payloadInSize = headerIn->payloadSize ;
103- if (!mCompressedData ) { // we have raw data coming in from flp
104- if (mVerbose ) {
105- LOG (info) << " parsing non compressed data in the data reader task with a payload of " << payloadInSize << " payload size" ;
106- }
107- mReader .setDataBuffer (payloadIn);
108- mReader .setDataBufferSize (payloadInSize);
109- mReader .configure (mByteSwap , mVerbose , mHeaderVerbose , mDataVerbose );
110- if (mVerbose ) {
111- LOG (info) << " %%% about to run " << loopcounter << " %%%" ;
112- }
113- mReader .run ();
114- if (mVerbose ) {
115- LOG (info) << " %%% finished running " << loopcounter << " %%%" ;
116- }
117- loopcounter++;
118- // mTracklets.insert(std::end(mTracklets), std::begin(mReader.getTracklets()), std::end(mReader.getTracklets()));
119- // mCompressedDigits.insert(std::end(mCompressedDigits), std::begin(mReader.getCompressedDigits()), std::end(mReader.getCompressedDigits()));
120- // mReader.clearall();
121- if (mVerbose ) {
122- LOG (info) << " from parsing received: " << mTracklets .size () << " tracklets and " << mDigits .size () << " compressed digits" ;
123- LOG (info) << " relevant vectors to read : " << mReader .sumTrackletsFound () << " tracklets and " << mReader .sumDigitsFound () << " compressed digits" ;
104+ if (std::string (headerIn->dataDescription .str ) != std::string (" DISTSUBTIMEFRAMEFLP" )) {
105+ if (!mCompressedData ) { // we have raw data coming in from flp
106+ if (mVerbose ) {
107+ LOG (info) << " parsing non compressed data in the data reader task with a payload of " << payloadInSize << " payload size" ;
108+ }
109+ mReader .setDataBuffer (payloadIn);
110+ mReader .setDataBufferSize (payloadInSize);
111+ mReader .configure (mByteSwap , mVerbose , mHeaderVerbose , mDataVerbose );
112+ if (mVerbose ) {
113+ LOG (info) << " %%% about to run " << loopcounter << " %%%" ;
114+ }
115+ mReader .run ();
116+ if (mVerbose ) {
117+ LOG (info) << " %%% finished running " << loopcounter << " %%%" ;
118+ }
119+ loopcounter++;
120+ // mTracklets.insert(std::end(mTracklets), std::begin(mReader.getTracklets()), std::end(mReader.getTracklets()));
121+ // mCompressedDigits.insert(std::end(mCompressedDigits), std::begin(mReader.getCompressedDigits()), std::end(mReader.getCompressedDigits()));
122+ // mReader.clearall();
123+ if (mVerbose ) {
124+ LOG (info) << " from parsing received: " << mTracklets .size () << " tracklets and " << mDigits .size () << " compressed digits" ;
125+ LOG (info) << " relevant vectors to read : " << mReader .sumTrackletsFound () << " tracklets and " << mReader .sumDigitsFound () << " compressed digits" ;
126+ }
127+ // mTriggers = mReader.getIR();
128+ // get the payload of trigger and digits out.
129+ } else { // we have compressed data coming in from flp.
130+ mCompressedReader .setDataBuffer (payloadIn);
131+ mCompressedReader .setDataBufferSize (payloadInSize);
132+ mCompressedReader .configure (mByteSwap , mVerbose , mHeaderVerbose , mDataVerbose );
133+ mCompressedReader .run ();
134+ // get the payload of trigger and digits out.
124135 }
125- // mTriggers = mReader.getIR();
126- // get the payload of trigger and digits out.
127- } else { // we have compressed data coming in from flp.
128- mCompressedReader .setDataBuffer (payloadIn);
129- mCompressedReader .setDataBufferSize (payloadInSize);
130- mCompressedReader .configure (mByteSwap , mVerbose , mHeaderVerbose , mDataVerbose );
131- mCompressedReader .run ();
132- mTracklets = mCompressedReader .getTracklets ();
133- mDigits = mCompressedReader .getDigits ();
134- mTriggers = mCompressedReader .getIR ();
135- // get the payload of trigger and digits out.
136+ /* output */
137+ 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.
138+ } else {
139+ sendData (pc, true );
136140 }
137141 }
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.
140142 }
141143
142144 auto dataReadTime = std::chrono::high_resolution_clock::now () - dataReadStart;
0 commit comments