Skip to content

Commit ec4a568

Browse files
committed
[EMCAL-834] Checking active links per trigger
For each trigger checking from which DDLs the reconstruction received pages. If we don't receive pages from all active links the page is discarded.
1 parent 8ed9ac9 commit ec4a568

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

Detectors/EMCAL/workflow/src/RawToCellConverterSpec.cxx

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "DetectorsRaw/RDHUtils.h"
3232
#include "EMCALBase/Geometry.h"
3333
#include "EMCALBase/Mapper.h"
34+
#include "EMCALCalib/FeeDCS.h"
3435
#include "EMCALReconstruction/CaloFitResults.h"
3536
#include "EMCALReconstruction/Bunch.h"
3637
#include "EMCALReconstruction/CaloRawFitterStandard.h"
@@ -107,6 +108,17 @@ void RawToCellConverterSpec::run(framework::ProcessingContext& ctx)
107108
mCalibHandler->checkUpdates(ctx);
108109
updateCalibrationObjects();
109110

111+
FeeDCS* feedcs = mCalibHandler->getFEEDCS();
112+
std::bitset<32> list0 = feedcs->getDDLlist0();
113+
std::bitset<14> list1 = feedcs->getDDLlist1();
114+
// links 21 and 39 do not exist, but they are set active in DCS
115+
list0.set(21, false);
116+
list1.set(7, false);
117+
// must be 0x307FFFDFFFFF if all links are active
118+
std::bitset<46> bitSetActiveLinks((list1.to_ullong() << 32) + list0.to_ullong());
119+
// container with BCid and feeID
120+
std::unordered_map<int64_t, std::bitset<46>> bcFreq;
121+
110122
double timeshift = RecoParam::Instance().getCellTimeShiftNanoSec(); // subtract offset in ns in order to center the time peak around the nominal delay
111123
constexpr auto originEMC = o2::header::gDataOriginEMC;
112124
constexpr auto descRaw = o2::header::gDataDescriptionRawData;
@@ -181,6 +193,9 @@ void RawToCellConverterSpec::run(framework::ProcessingContext& ctx)
181193
continue;
182194
}
183195
}
196+
197+
bcFreq[currentIR.toLong()].set(feeID, true);
198+
184199
// Correct the cell time for the bc mod 4 (LHC: 40 MHz clock - ALTRO: 10 MHz clock)
185200
// Convention: All times shifted with respect to BC % 4 = 0 for trigger BC
186201
// Attention: Correction only works for the permutation (0 1 2 3) of the BC % 4, if the permutation is
@@ -315,6 +330,17 @@ void RawToCellConverterSpec::run(framework::ProcessingContext& ctx)
315330
}
316331
}
317332

333+
// Check if we have received pages from all active links
334+
// If not we cannot trust the timeframe and must send
335+
// empty containers
336+
for (const auto& [globalBC, activelinks] : bcFreq) {
337+
if (activelinks != bitSetActiveLinks) {
338+
LOG(error) << "Not all EMC active links contributed in global BCid=" << globalBC << ": mask=" << (activelinks ^ bitSetActiveLinks);
339+
sendData(ctx, mOutputCells, mOutputTriggerRecords, mOutputDecoderErrors);
340+
return;
341+
}
342+
}
343+
318344
// Loop over BCs, sort cells with increasing tower ID and write to output containers
319345
RecoContainerReader eventIterator(mCellHandler);
320346
while (eventIterator.hasNext()) {
@@ -355,9 +381,9 @@ void RawToCellConverterSpec::updateCalibrationObjects()
355381
LOG(info) << "RecoParams updated";
356382
o2::emcal::RecoParam::Instance().printKeyValues(true, true);
357383
}
358-
// if (mCalibHandler->hasUpdateFEEDCS()) {
359-
// LOG(info) << "DCS params updated";
360-
// }
384+
if (mCalibHandler->hasUpdateFEEDCS()) {
385+
LOG(info) << "DCS params updated";
386+
}
361387
}
362388

363389
bool RawToCellConverterSpec::isLostTimeframe(framework::ProcessingContext& ctx) const
@@ -677,7 +703,7 @@ o2::framework::DataProcessorSpec o2::emcal::reco_workflow::getRawToCellConverter
677703
// CCDB objects
678704
auto calibhandler = std::make_shared<o2::emcal::CalibLoader>();
679705
calibhandler->enableRecoParams(true);
680-
// calibhandler->enableFEEDCS(true);
706+
calibhandler->enableFEEDCS(true);
681707
calibhandler->defineInputSpecs(inputs);
682708

683709
return o2::framework::DataProcessorSpec{"EMCALRawToCellConverterSpec",

0 commit comments

Comments
 (0)