|
| 1 | +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +#ifndef O2_CTP_RAWDECODER_H |
| 13 | +#define O2_CTP_RAWDECODER_H |
| 14 | + |
| 15 | +#include <vector> |
| 16 | +#include <deque> |
| 17 | +#include "Framework/DataProcessorSpec.h" |
| 18 | +#include "Framework/Task.h" |
| 19 | +#include "Framework/WorkflowSpec.h" |
| 20 | +#include "DataFormatsCTP/Digits.h" |
| 21 | +#include "DataFormatsCTP/LumiInfo.h" |
| 22 | +#include "CTPReconstruction/RawDataDecoder.h" |
| 23 | + |
| 24 | +namespace o2 |
| 25 | +{ |
| 26 | +namespace ctp |
| 27 | +{ |
| 28 | +namespace reco_workflow |
| 29 | +{ |
| 30 | + |
| 31 | +/// \class RawDecoderSpec |
| 32 | +/// \brief Coverter task for Raw data to CTP digits |
| 33 | +/// \author Roman Lietava from CPV example |
| 34 | +/// |
| 35 | +class RawDecoderSpec : public framework::Task |
| 36 | +{ |
| 37 | + public: |
| 38 | + /// \brief Constructor |
| 39 | + /// \param propagateMC If true the MCTruthContainer is propagated to the output |
| 40 | + RawDecoderSpec(bool digits, bool lumi) : mDoDigits(digits), mDoLumi(lumi) {} |
| 41 | + /// \brief Destructor |
| 42 | + ~RawDecoderSpec() override = default; |
| 43 | + /// \brief Initializing the RawDecoderSpec |
| 44 | + /// \param ctx Init context |
| 45 | + void init(framework::InitContext& ctx) final; |
| 46 | + void endOfStream(o2::framework::EndOfStreamContext& ec) final; |
| 47 | + /// \brief Run conversion of raw data to cells |
| 48 | + /// \param ctx Processing context |
| 49 | + /// |
| 50 | + /// The following branches are linked: |
| 51 | + /// Input RawData: {"ROUT", "RAWDATA", 0, Lifetime::Timeframe} |
| 52 | + /// Output HW errors: {"CTP", "RAWHWERRORS", 0, Lifetime::Timeframe} -later |
| 53 | + void run(framework::ProcessingContext& ctx) final; |
| 54 | + void updateTimeDependentParams(framework::ProcessingContext& pc); |
| 55 | + |
| 56 | + protected: |
| 57 | + private: |
| 58 | + // for digits |
| 59 | + bool mDoDigits = true; |
| 60 | + o2::pmr::vector<CTPDigit> mOutputDigits; |
| 61 | + int mMaxInputSize = 0; |
| 62 | + bool mMaxInputSizeFatal = 0; |
| 63 | + // for lumi |
| 64 | + bool mDoLumi = true; |
| 65 | + // |
| 66 | + LumiInfo mOutputLumiInfo; |
| 67 | + bool mVerbose = false; |
| 68 | + uint64_t mCountsT = 0; |
| 69 | + uint64_t mCountsV = 0; |
| 70 | + uint32_t mNTFToIntegrate = 1; |
| 71 | + uint32_t mNHBIntegratedT = 0; |
| 72 | + uint32_t mNHBIntegratedV = 0; |
| 73 | + bool mDecodeinputs = 0; |
| 74 | + std::deque<size_t> mHistoryT; |
| 75 | + std::deque<size_t> mHistoryV; |
| 76 | + RawDataDecoder mDecoder; |
| 77 | + // Errors |
| 78 | + int mLostDueToShiftInps = 0; |
| 79 | + int mErrorIR = 0; |
| 80 | + int mErrorTCR = 0; |
| 81 | + int mIRRejected = 0; |
| 82 | + int mTCRRejected = 0; |
| 83 | + std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClsEA{}; |
| 84 | + std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClsEB{}; // from inputs |
| 85 | + std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClsA{}; |
| 86 | + std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClsB{}; // from inputs |
| 87 | + bool mCheckConsistency = false; |
| 88 | +}; |
| 89 | + |
| 90 | +/// \brief Creating DataProcessorSpec for the CTP |
| 91 | +/// |
| 92 | +o2::framework::DataProcessorSpec getRawDecoderSpec(bool askSTFDist, bool digits, bool lumi); |
| 93 | + |
| 94 | +} // namespace reco_workflow |
| 95 | + |
| 96 | +} // namespace ctp |
| 97 | + |
| 98 | +} // namespace o2 |
| 99 | + |
| 100 | +#endif |
0 commit comments