Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Detectors/EMCAL/reconstruction/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ o2_target_root_dictionary(
include/EMCALReconstruction/RecoParam.h
include/EMCALReconstruction/StuDecoder.h
include/EMCALReconstruction/TRUDataHandler.h
include/EMCALReconstruction/TRUDecodingErrors.h
)

o2_add_executable(rawreader-file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
#include <EMCALReconstruction/FastORTimeSeries.h>
#include <EMCALReconstruction/TRUDataHandler.h>

#ifndef ALICEO2_EMCAL_RECOCONTAINER_H
#define ALICEO2_EMCAL_RECOCONTAINER_H

namespace o2::emcal
{
/// \struct RecCellInfo
Expand Down Expand Up @@ -372,3 +375,5 @@ class RecoContainerReader
};

} // namespace o2::emcal

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,11 @@ const char* getGainErrorDescription(unsigned int errorcode);
/// FastOR index or TRU index is called, or by the TRU data handler if
/// the patch index is outside range.
enum class TRUDecodingError_t {
TRU_INDEX_INVALID, ///< TRU index invalid
PATCH_INDEX_INVALID, ///< Patch index outside range
FASTOR_INDEX_INVALID, ///< FastOR index unknown
UNKNOWN_ERROR ///< Unknown error type
TRU_INDEX_INVALID, ///< TRU index invalid
PATCH_INDEX_INVALID, ///< Patch index outside range
FASTOR_INDEX_INVALID, ///< FastOR index unknown
FASTOR_STARTTIME_INVALID, ///< FastOr stattime is larger than 14
UNKNOWN_ERROR ///< Unknown error type
};

/// \brief Get the number of TRU error codes
Expand Down Expand Up @@ -253,6 +254,8 @@ constexpr int getErrorCodeFromTRUDecodingError(TRUDecodingError_t error)
return 1;
case TRUDecodingError_t::FASTOR_INDEX_INVALID:
return 2;
case TRUDecodingError_t::FASTOR_STARTTIME_INVALID:
return 3;
case TRUDecodingError_t::UNKNOWN_ERROR:
return -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FastOrStartTimeInvalidException : public std::exception
public:
/// \brief Constructor
/// \param l0size Size of the L0 patch
FastOrStartTimeInvalidException(unsigned int time) : std::exception(), mErrorMessage(), mStartTime(time)
FastOrStartTimeInvalidException(int time) : std::exception(), mErrorMessage(), mStartTime(time)
{
mErrorMessage = "FastOr starttime invalid: " + std::to_string(time);
}
Expand All @@ -46,7 +46,7 @@ class FastOrStartTimeInvalidException : public std::exception

/// \brief Get the size of the L0 patch
/// \return Size of the L0 patch
unsigned int getStartTime() const noexcept { return mStartTime; }
int getStartTime() const noexcept { return mStartTime; }

private:
std::string mErrorMessage; ///< Buffer for error message
Expand Down
5 changes: 4 additions & 1 deletion Detectors/EMCAL/reconstruction/src/FastORTimeSeries.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <algorithm>
#include <iostream>
#include "EMCALReconstruction/FastORTimeSeries.h"
#include "EMCALBase/TRUDecodingErrors.h"
#include "EMCALReconstruction/TRUDecodingErrors.h"

using namespace o2::emcal;

Expand All @@ -21,6 +21,9 @@ void FastORTimeSeries::fillReversed(const gsl::span<const uint16_t> samples, uin
if (starttime >= 14) {
throw FastOrStartTimeInvalidException(starttime);
}
if (starttime + 1 < samples.size()) {
throw FastOrStartTimeInvalidException(static_cast<int>(starttime) - static_cast<int>(samples.size()) + 1);
}
for (std::size_t isample = 0; isample < samples.size(); isample++) {
mTimeSamples[starttime - isample] = samples[isample];
}
Expand Down
8 changes: 8 additions & 0 deletions Detectors/EMCAL/reconstruction/src/ReconstructionErrors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ TRUDecodingError_t getTRUDecodingErrorFromErrorCode(unsigned int errorcode)
return TRUDecodingError_t::PATCH_INDEX_INVALID;
case 2:
return TRUDecodingError_t::FASTOR_INDEX_INVALID;
case 3:
return TRUDecodingError_t::FASTOR_STARTTIME_INVALID;
default:
return TRUDecodingError_t::UNKNOWN_ERROR;
}
Expand All @@ -170,6 +172,8 @@ const char* getTRUDecodingErrorName(TRUDecodingError_t errortype)
return "PatchIndexInvalid";
case TRUDecodingError_t::FASTOR_INDEX_INVALID:
return "FastORIndexInvalid";
case TRUDecodingError_t::FASTOR_STARTTIME_INVALID:
return "FastORStartTimeInvalid";
default:
return "UnknownError";
}
Expand All @@ -189,6 +193,8 @@ const char* getTRUDecodingErrorTitle(TRUDecodingError_t errortype)
return "Patch index invalid";
case TRUDecodingError_t::FASTOR_INDEX_INVALID:
return "FastOR index invalid";
case TRUDecodingError_t::FASTOR_STARTTIME_INVALID:
return "FastOR starttime invalid";
default:
return "Unknown error";
}
Expand All @@ -208,6 +214,8 @@ const char* getTRUDecodingErrorErrorDescription(TRUDecodingError_t errortype)
return "Patch index is invalid";
case TRUDecodingError_t::FASTOR_INDEX_INVALID:
return "FastOR index is invalid";
case TRUDecodingError_t::FASTOR_STARTTIME_INVALID:
return "FastOR starttime is invalid";
default:
return "Unknown error";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <tuple>
#include <TRandom.h>
#include <EMCALReconstruction/FastORTimeSeries.h>
#include "EMCALBase/TRUDecodingErrors.h"
#include "EMCALReconstruction/TRUDecodingErrors.h"

namespace o2
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "EMCALReconstruction/RawReaderMemory.h"
#include "EMCALReconstruction/RecoContainer.h"
#include "EMCALReconstruction/ReconstructionErrors.h"
#include "EMCALReconstruction/TRUDecodingErrors.h"
#include "EMCALWorkflow/CalibLoader.h"

namespace o2
Expand All @@ -44,6 +45,7 @@ class MinorAltroDecodingError;
class RawDecodingError;
class FastORIndexException;
class TRUIndexException;
class FastOrStartTimeInvalidException;

namespace reco_workflow
{
Expand Down Expand Up @@ -466,6 +468,17 @@ class RawToCellConverterSpec : public framework::Task
/// produced.
void handleFastORErrors(const FastORIndexException& error, unsigned int linkID, unsigned int indexTRU);

/// \brief Handler function for FastOR start time errors
/// \param error FastOR index error
/// \param linkID DDL raising the exception
/// \param indexTRU TRU raising the exception
///
/// Errors are printed to the infoLogger until a user-defiened
/// threshold is reached. In case the export of decoder errors
/// is activated an error object with additional information is
/// produced.
void handleFastORStartTimeErrors(const FastOrStartTimeInvalidException& e, unsigned int linkID, unsigned int indexTRU);

/// \brief Handler function patch index exception
/// \param error Patch index error
/// \param linkID DDL raising the exception
Expand Down
24 changes: 23 additions & 1 deletion Detectors/EMCAL/workflow/src/RawToCellConverterSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ void RawToCellConverterSpec::addFEEChannelToEvent(o2::emcal::EventContainer& cur
if (chantype == o2::emcal::ChannelType_t::HIGH_GAIN || chantype == o2::emcal::ChannelType_t::LOW_GAIN) {
// high- / low-gain cell
CellID = getCellAbsID(position.mSupermoduleID, position.mColumn, position.mRow);

isLowGain = chantype == o2::emcal::ChannelType_t::LOW_GAIN;
} else {
CellID = geLEDMONAbsID(position.mSupermoduleID, position.mColumn); // Module index encoded in colum for LEDMONs
Expand Down Expand Up @@ -562,7 +563,12 @@ void RawToCellConverterSpec::addTRUChannelToEvent(o2::emcal::EventContainer& cur
// std::cout << adc << ", ";
//}
// std::cout << std::endl;
currentEvent.setFastOR(absFastOR, bunch.getStartTime(), bunch.getADC());

try {
currentEvent.setFastOR(absFastOR, bunch.getStartTime(), bunch.getADC());
} catch (FastOrStartTimeInvalidException& e) {
handleFastORStartTimeErrors(e, position.mFeeID, tru);
}
}
} catch (FastORIndexException& e) {
handleFastORErrors(e, position.mFeeID, tru);
Expand Down Expand Up @@ -941,6 +947,22 @@ void RawToCellConverterSpec::handleFastORErrors(const FastORIndexException& e, u
}
}

void RawToCellConverterSpec::handleFastORStartTimeErrors(const FastOrStartTimeInvalidException& e, unsigned int linkID, unsigned int indexTRU)
{
if (mCreateRawDataErrors) {
mOutputDecoderErrors.emplace_back(linkID, ErrorTypeFEE::ErrorSource_t::TRU_ERROR, reconstructionerrors::getErrorCodeFromTRUDecodingError(reconstructionerrors::TRUDecodingError_t::FASTOR_STARTTIME_INVALID), indexTRU, -1);
}
if (mNumErrorMessages < mMaxErrorMessages) {
LOG(warning) << " TRU decoding: " << e.what() << " in FEE ID " << linkID << ", TRU " << indexTRU;
mNumErrorMessages++;
if (mNumErrorMessages == mMaxErrorMessages) {
LOG(warning) << "Max. amount of error messages (" << mMaxErrorMessages << " reached, further messages will be suppressed";
}
} else {
mErrorMessagesSuppressed++;
}
}

void RawToCellConverterSpec::handlePatchError(const TRUDataHandler::PatchIndexException& e, unsigned int linkID, unsigned int indexTRU)
{
if (mCreateRawDataErrors) {
Expand Down