|
31 | 31 | #include "DetectorsRaw/RDHUtils.h" |
32 | 32 | #include "EMCALBase/Geometry.h" |
33 | 33 | #include "EMCALBase/Mapper.h" |
| 34 | +#include "EMCALCalib/FeeDCS.h" |
34 | 35 | #include "EMCALReconstruction/CaloFitResults.h" |
35 | 36 | #include "EMCALReconstruction/Bunch.h" |
36 | 37 | #include "EMCALReconstruction/CaloRawFitterStandard.h" |
@@ -107,6 +108,17 @@ void RawToCellConverterSpec::run(framework::ProcessingContext& ctx) |
107 | 108 | mCalibHandler->checkUpdates(ctx); |
108 | 109 | updateCalibrationObjects(); |
109 | 110 |
|
| 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 | + |
110 | 122 | double timeshift = RecoParam::Instance().getCellTimeShiftNanoSec(); // subtract offset in ns in order to center the time peak around the nominal delay |
111 | 123 | constexpr auto originEMC = o2::header::gDataOriginEMC; |
112 | 124 | constexpr auto descRaw = o2::header::gDataDescriptionRawData; |
@@ -181,6 +193,9 @@ void RawToCellConverterSpec::run(framework::ProcessingContext& ctx) |
181 | 193 | continue; |
182 | 194 | } |
183 | 195 | } |
| 196 | + |
| 197 | + bcFreq[currentIR.toLong()].set(feeID, true); |
| 198 | + |
184 | 199 | // Correct the cell time for the bc mod 4 (LHC: 40 MHz clock - ALTRO: 10 MHz clock) |
185 | 200 | // Convention: All times shifted with respect to BC % 4 = 0 for trigger BC |
186 | 201 | // 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) |
315 | 330 | } |
316 | 331 | } |
317 | 332 |
|
| 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 | + |
318 | 344 | // Loop over BCs, sort cells with increasing tower ID and write to output containers |
319 | 345 | RecoContainerReader eventIterator(mCellHandler); |
320 | 346 | while (eventIterator.hasNext()) { |
@@ -355,9 +381,9 @@ void RawToCellConverterSpec::updateCalibrationObjects() |
355 | 381 | LOG(info) << "RecoParams updated"; |
356 | 382 | o2::emcal::RecoParam::Instance().printKeyValues(true, true); |
357 | 383 | } |
358 | | - // if (mCalibHandler->hasUpdateFEEDCS()) { |
359 | | - // LOG(info) << "DCS params updated"; |
360 | | - // } |
| 384 | + if (mCalibHandler->hasUpdateFEEDCS()) { |
| 385 | + LOG(info) << "DCS params updated"; |
| 386 | + } |
361 | 387 | } |
362 | 388 |
|
363 | 389 | bool RawToCellConverterSpec::isLostTimeframe(framework::ProcessingContext& ctx) const |
@@ -677,7 +703,7 @@ o2::framework::DataProcessorSpec o2::emcal::reco_workflow::getRawToCellConverter |
677 | 703 | // CCDB objects |
678 | 704 | auto calibhandler = std::make_shared<o2::emcal::CalibLoader>(); |
679 | 705 | calibhandler->enableRecoParams(true); |
680 | | - // calibhandler->enableFEEDCS(true); |
| 706 | + calibhandler->enableFEEDCS(true); |
681 | 707 | calibhandler->defineInputSpecs(inputs); |
682 | 708 |
|
683 | 709 | return o2::framework::DataProcessorSpec{"EMCALRawToCellConverterSpec", |
|
0 commit comments