diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/Digit.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/Digit.h index 5f24c40b746e8..0ede0b3eadf2b 100644 --- a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/Digit.h +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/Digit.h @@ -28,6 +28,11 @@ namespace fdd class ChannelData; struct Triggers { + enum { bitA, + bitC, + bitVertex, + bitCen, + bitSCen }; uint8_t triggersignals = 0; // FDD trigger signals int8_t nChanA = -1; // number of fired channels A side int8_t nChanC = -1; // number of fired channels A side @@ -58,6 +63,22 @@ struct Triggers { ClassDefNV(Triggers, 1); }; +struct DetTrigInput { + o2::InteractionRecord mIntRecord; // bc/orbit of the intpur + std::bitset<5> mInputs; // pattern of inputs. + DetTrigInput() = default; + DetTrigInput(const o2::InteractionRecord& iRec, Bool_t isA, Bool_t isC, Bool_t isVrtx, Bool_t isCnt, Bool_t isSCnt) + : mIntRecord(iRec), + mInputs((isA << Triggers::bitA) | + (isC << Triggers::bitC) | + (isVrtx << Triggers::bitVertex) | + (isCnt << Triggers::bitCen) | + (isSCnt << Triggers::bitSCen)) + { + } + ClassDefNV(DetTrigInput, 1); +}; + struct Digit { o2::dataformats::RangeRefComp<5> ref; diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/LookUpTable.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/LookUpTable.h index 6b5e6707e0e53..ced5f8ed51469 100644 --- a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/LookUpTable.h +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/LookUpTable.h @@ -95,6 +95,11 @@ class LookUpTable } } + static o2::fdd::LookUpTable linear() + { + return o2::fdd::LookUpTable{1}; + } + private: std::vector mTopoVector; // iterator of each vector element gives the global channel number std::vector mInvTopo; // each element is an iterator of mTopoVector diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/RawEventData.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/RawEventData.h index 3f8220e4a8f06..da4d7c33ec506 100644 --- a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/RawEventData.h +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/RawEventData.h @@ -16,6 +16,7 @@ #define ALICEO2_FDD_RAWEVENTDATA_H_ #include "FDDBase/Constants.h" +#include "DataFormatsFDD/Digit.h" #include "DataFormatsFDD/ChannelData.h" #include "Headers/RAWDataHeader.h" #include "DataFormatsFDD/LookUpTable.h" @@ -31,21 +32,34 @@ namespace o2 namespace fdd { struct EventHeader { - static constexpr int PayloadSize = 16; + static constexpr size_t PayloadSize = 16; //should be equal to 10 + static constexpr size_t PayloadPerGBTword = 16; //should be equal to 10 + static constexpr int MinNelements = 1; + static constexpr int MaxNelements = 1; union { uint64_t word[2] = {}; struct { uint64_t bc : 12; uint64_t orbit : 32; - uint64_t reservedField1 : 20; + uint64_t phase : 3; + uint64_t errorPhase : 1; + uint64_t reservedField1 : 16; uint64_t reservedField2 : 8; uint64_t nGBTWords : 4; uint64_t startDescriptor : 4; uint64_t reservedField3 : 48; }; }; + InteractionRecord getIntRec() const { return InteractionRecord{(uint16_t)bc, (uint32_t)orbit}; } }; struct EventData { + static constexpr size_t PayloadSize = 5; + static constexpr size_t PayloadPerGBTword = 10; + static constexpr int MinNelements = 1; //additional static field + static constexpr int MaxNelements = 12; + // + static constexpr int BitFlagPos = 25; // position of first bit flag(numberADC) + union { uint64_t word = {0}; struct { @@ -79,10 +93,17 @@ struct EventData { isEventInTVDC = 1; isTimeInfoLost = 0; } + uint8_t getFlagWord() const + { + return uint8_t(word >> BitFlagPos); + } }; struct TCMdata { - static constexpr int PayloadSize = 16; + static constexpr size_t PayloadSize = 16; //should be equal to 10 + static constexpr size_t PayloadPerGBTword = 16; //should be equal to 10 + static constexpr int MinNelements = 1; + static constexpr int MaxNelements = 1; union { uint64_t word[2] = {0}; struct { @@ -101,6 +122,20 @@ struct TCMdata { reservedField2 : 46; }; }; + void fillTrigger(Triggers& trg) + { + trg.triggersignals = ((bool)orA << Triggers::bitA) | + ((bool)orC << Triggers::bitC) | + ((bool)vertex << Triggers::bitVertex) | + ((bool)cen << Triggers::bitCen) | + ((bool)sCen << Triggers::bitSCen); + trg.nChanA = (int8_t)nChanA; + trg.nChanC = (int8_t)nChanC; + trg.amplA = (int32_t)amplA; + trg.amplC = (int32_t)amplC; + trg.timeA = (int16_t)timeA; + trg.timeC = (int16_t)timeC; + } }; class RawEventData diff --git a/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h b/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h index 6f4f3e9fe4554..9342e20a82182 100644 --- a/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h +++ b/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h @@ -20,6 +20,8 @@ #pragma link C++ class vector < o2::fdd::ChannelData> + ; #pragma link C++ class o2::fdd::Triggers + ; #pragma link C++ class vector < o2::fdd::Triggers> + ; +#pragma link C++ class o2::fdd::DetTrigInput + ; +#pragma link C++ class vector < o2::fdd::DetTrigInput> + ; #pragma link C++ class o2::fdd::MCLabel + ; #pragma link C++ class vector < o2::fdd::MCLabel> + ; diff --git a/Detectors/FIT/FDD/CMakeLists.txt b/Detectors/FIT/FDD/CMakeLists.txt index f9ecc0c9f62be..d119660024e7c 100644 --- a/Detectors/FIT/FDD/CMakeLists.txt +++ b/Detectors/FIT/FDD/CMakeLists.txt @@ -9,6 +9,7 @@ # submit itself to any jurisdiction. add_subdirectory(base) +add_subdirectory(raw) add_subdirectory(simulation) add_subdirectory(reconstruction) add_subdirectory(workflow) diff --git a/Detectors/FIT/FDD/raw/CMakeLists.txt b/Detectors/FIT/FDD/raw/CMakeLists.txt new file mode 100644 index 0000000000000..813244d19448b --- /dev/null +++ b/Detectors/FIT/FDD/raw/CMakeLists.txt @@ -0,0 +1,13 @@ +#Copyright CERN and copyright holders of ALICE O2.This software is distributed +#under the terms of the GNU General Public License v3(GPL Version 3), copied +#verbatim in the file "COPYING". +# +#See http: //alice-o2.web.cern.ch/license for full licensing information. +# +#In applying this license CERN does not waive the privileges and immunities +#granted to it by virtue of its status as an Intergovernmental Organization or +#submit itself to any jurisdiction. + +o2_add_library(FDDRaw + SOURCES src/DataBlockFDD.cxx src/DigitBlockFDD.cxx src/RawReaderFDDBase.cxx + PUBLIC_LINK_LIBRARIES O2::CommonDataFormat O2::Headers O2::DataFormatsFDD O2::FITRaw) diff --git a/Detectors/FIT/FDD/raw/include/FDDRaw/DataBlockFDD.h b/Detectors/FIT/FDD/raw/include/FDDRaw/DataBlockFDD.h new file mode 100644 index 0000000000000..01b36e15ff058 --- /dev/null +++ b/Detectors/FIT/FDD/raw/include/FDDRaw/DataBlockFDD.h @@ -0,0 +1,88 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file DataBlockFDD.h class for RAW data format data blocks at FDD +// +// Artur.Furs +// afurs@cern.ch +// + +#ifndef ALICEO2_FIT_DATABLOCKFDD_H_ +#define ALICEO2_FIT_DATABLOCKFDD_H_ +#include +#include +#include +#include + +#include +#include +#include +using namespace o2::fit; +namespace o2 +{ +namespace fdd +{ +using RawHeaderPM = o2::fdd::EventHeader; +using RawDataPM = o2::fdd::EventData; +using RawHeaderTCM = o2::fdd::EventHeader; +using RawDataTCM = o2::fdd::TCMdata; + +using namespace std; + +//FDD DATA BLOCK DEFINITIONS + +//standard data block from PM +class DataBlockPM : public DataBlockBase +{ + public: + DataBlockPM() = default; + DataBlockPM(const DataBlockPM&) = default; + void deserialize(gsl::span srcBytes, size_t& srcByteShift) + { + DataBlockWrapper::deserialize(srcBytes, DataBlockWrapper::MaxNwords, srcByteShift); + DataBlockWrapper::deserialize(srcBytes, DataBlockWrapper::mData[0].nGBTWords, srcByteShift); + } + //Custom sanity checking for current deserialized block + // put here code for raw data checking + void sanityCheck(bool& flag) + { + if (DataBlockWrapper::mNelements == 0) { + flag = false; + return; + } + if (DataBlockWrapper::mNelements % 2 == 0 && DataBlockWrapper::mData[DataBlockWrapper::mNelements - 1].channelID == 0) { + DataBlockWrapper::mNelements--; //in case of half GBT-word filling + } + //TODO, Descriptor checking, Channel range + } +}; + +//standard data block from TCM +class DataBlockTCM : public DataBlockBase +{ + public: + DataBlockTCM() = default; + DataBlockTCM(const DataBlockTCM&) = default; + void deserialize(gsl::span srcBytes, size_t& srcByteShift) + { + DataBlockWrapper::deserialize(srcBytes, DataBlockWrapper::MaxNwords, srcByteShift); + DataBlockWrapper::deserialize(srcBytes, DataBlockWrapper::mData[0].nGBTWords, srcByteShift); + } + //Custom sanity checking for current deserialized block + // put here code for raw data checking + void sanityCheck(bool& flag) + { + //TODO, Descriptor checking + } +}; + +} // namespace fdd +} // namespace o2 +#endif diff --git a/Detectors/FIT/FDD/raw/include/FDDRaw/DigitBlockFDD.h b/Detectors/FIT/FDD/raw/include/FDDRaw/DigitBlockFDD.h new file mode 100644 index 0000000000000..8893b7b5e4533 --- /dev/null +++ b/Detectors/FIT/FDD/raw/include/FDDRaw/DigitBlockFDD.h @@ -0,0 +1,133 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file DigitBlockFDD.h class for proccessing RAW data into Digits +// +// Artur.Furs +// afurs@cern.ch +// TODO: +// traites for DataBlocks +// check if the EventID filling is correct + +#ifndef ALICEO2_FIT_DIGITBLOCKFDD_H_ +#define ALICEO2_FIT_DIGITBLOCKFDD_H_ +#include +#include +#include +#include +#include "FDDRaw/DataBlockFDD.h" +#include "FITRaw/DigitBlockBase.h" + +#include +#include "DataFormatsFDD/Digit.h" +#include "DataFormatsFDD/ChannelData.h" +#include "DataFormatsFDD/LookUpTable.h" + +#include +#include + +#include + +using namespace o2::fit; + +namespace o2 +{ +namespace fdd +{ +//Normal data taking mode +class DigitBlockFDD : public DigitBlockBase +{ + public: + typedef DigitBlockBase DigitBlockBaseType; + DigitBlockFDD(o2::InteractionRecord intRec) { setIntRec(intRec); } + DigitBlockFDD() = default; + DigitBlockFDD(const DigitBlockFDD& other) = default; + ~DigitBlockFDD() = default; + void setIntRec(o2::InteractionRecord intRec) { mDigit.mIntRecord = intRec; } + Digit mDigit; + std::vector mVecChannelData; + static o2::fdd::LookUpTable sLookupTable; + static int sEventID; + + template + void processDigits(DataBlockType& dataBlock, int linkID) + { + if constexpr (std::is_same::value) { //Filling data from PM + for (int iEventData = 0; iEventData < dataBlock.DataBlockWrapper::mNelements; iEventData++) { + mVecChannelData.emplace_back(int(sLookupTable.getChannel(linkID, dataBlock.DataBlockWrapper::mData[iEventData].channelID)), + int(dataBlock.DataBlockWrapper::mData[iEventData].time), + int(dataBlock.DataBlockWrapper::mData[iEventData].charge), + dataBlock.DataBlockWrapper::mData[iEventData].getFlagWord()); + } + } else if constexpr (std::is_same::value) { //Filling data from TCM + dataBlock.DataBlockWrapper::mData[0].fillTrigger(mDigit.mTriggers); + } + } + void getDigits(std::vector& vecDigits, std::vector& vecChannelData) + { + //last digit filling + mDigit.ref.set(vecChannelData.size(), mVecChannelData.size()); + //mDigit.mEventID = sEventID; + // + vecDigits.push_back(std::move(mDigit)); + std::move(mVecChannelData.begin(), mVecChannelData.end(), std::back_inserter(vecChannelData)); + mVecChannelData.clear(); + + sEventID++; //Increasing static eventID. After each poping of the data, it will increase + } + void print() const + { + std::cout << "\n______________DIGIT DATA____________"; + std::cout << std::hex; + std::cout << "\nBC: " << mDigit.mIntRecord.bc << "| ORBIT: " << mDigit.mIntRecord.orbit; + std::cout << "\nRef first: " << mDigit.ref.getFirstEntry() << "| Ref entries: " << mDigit.ref.getEntries(); + std::cout << "\nmTrigger: " << static_cast(mDigit.mTriggers.triggersignals); + std::cout << "\nnChanA: " << static_cast(mDigit.mTriggers.nChanA) << " | nChanC: " << static_cast(mDigit.mTriggers.nChanC); + std::cout << "\namplA: " << mDigit.mTriggers.amplA << " | amplC: " << mDigit.mTriggers.amplC; + std::cout << "\ntimeA: " << mDigit.mTriggers.timeA << " | timeC: " << mDigit.mTriggers.timeC; + + std::cout << "\n______________CHANNEL DATA____________\n"; + std::cout << "\nN channel: " << mVecChannelData.size(); + for (const auto& chData : mVecChannelData) { + std::cout << "\nChId: " << static_cast(chData.mPMNumber) << " | ChainQTC:" << static_cast(chData.mFEEBits) << " | CFDTime: " << chData.mTime << " | QTCAmpl: " << chData.mChargeADC; + } + std::cout << std::dec; + std::cout << "\n"; + LOG(INFO) << "______________________________________"; + } + + static void print(std::vector& vecDigit, std::vector& vecChannelData) + { + for (const auto& digit : vecDigit) { + std::cout << "\n______________DIGIT DATA____________"; + std::cout << std::hex; + std::cout << "\nBC: " << digit.mIntRecord.bc << "| ORBIT: " << digit.mIntRecord.orbit << " | EventID: " + << "digit.mEventID"; + std::cout << "\nRef first: " << digit.ref.getFirstEntry() << "| Ref entries: " << digit.ref.getEntries(); + std::cout << "\nmTrigger: " << static_cast(digit.mTriggers.triggersignals); + std::cout << "\nnChanA: " << static_cast(digit.mTriggers.nChanA) << " | nChanC: " << static_cast(digit.mTriggers.nChanC); + std::cout << "\namplA: " << digit.mTriggers.amplA << " | amplC: " << digit.mTriggers.amplC; + std::cout << "\ntimeA: " << digit.mTriggers.timeA << " | timeC: " << digit.mTriggers.timeC; + + std::cout << "\n______________CHANNEL DATA____________\n"; + for (int iChData = digit.ref.getFirstEntry(); iChData < digit.ref.getFirstEntry() + digit.ref.getEntries(); iChData++) { + + std::cout << "\nChId: " << static_cast(vecChannelData[iChData].mPMNumber) << " | ChainQTC:" << static_cast(vecChannelData[iChData].mFEEBits) + << " | CFDTime: " << vecChannelData[iChData].mTime << " | QTCAmpl: " << vecChannelData[iChData].mChargeADC; + } + std::cout << std::dec; + std::cout << "\n______________________________________\n"; + } + } +}; + +} // namespace fdd +} // namespace o2 +#endif diff --git a/Detectors/FIT/FDD/raw/include/FDDRaw/RawReaderFDDBase.h b/Detectors/FIT/FDD/raw/include/FDDRaw/RawReaderFDDBase.h new file mode 100644 index 0000000000000..977e10493cfbf --- /dev/null +++ b/Detectors/FIT/FDD/raw/include/FDDRaw/RawReaderFDDBase.h @@ -0,0 +1,74 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderFDDBase.h Base class for RAW data reading +// +// Artur.Furs +// afurs@cern.ch +// +//Main purpuse is to decode FDD data blocks and push them to DigitBlockFDD for proccess +//Base class only provides static linkID-moduleType conformity + +#ifndef ALICEO2_FIT_RAWREADERFDDBASE_H_ +#define ALICEO2_FIT_RAWREADERFDDBASE_H_ +#include +#include +#include +#include "FDDRaw/DataBlockFDD.h" +#include "FDDRaw/DigitBlockFDD.h" +#include "FITRaw/RawReaderBase.h" + +#include +#include + +#include +#include "Headers/RAWDataHeader.h" + +#include + +using namespace o2::fit; +namespace o2 +{ +namespace fdd +{ + +// Common raw reader for FDD +template +class RawReaderFDDBase : public RawReaderBase +{ + public: + typedef RawReaderBase RawReaderBaseType; + RawReaderFDDBase() = default; + ~RawReaderFDDBase() = default; + //deserialize payload to raw data blocks and proccesss them to digits + void process(int linkID, gsl::span payload) + { + if (0 <= linkID && linkID < 2) { + //PM data proccessing + RawReaderBaseType::template processBinaryData(payload, linkID); + } else if (linkID == 2) { + //TCM data proccessing + RawReaderBaseType::template processBinaryData(payload, linkID); + } else { + //put here code in case of bad rdh.linkID value + LOG(INFO) << "WARNING! WRONG LINK ID! " << linkID; + return; + } + + // + } +}; +//Normal TCM mode +using RawReaderFDDBaseNorm = RawReaderFDDBase; + +} // namespace fdd +} // namespace o2 + +#endif diff --git a/Detectors/FIT/FDD/raw/src/DataBlockFDD.cxx b/Detectors/FIT/FDD/raw/src/DataBlockFDD.cxx new file mode 100644 index 0000000000000..39e3d0b9588f2 --- /dev/null +++ b/Detectors/FIT/FDD/raw/src/DataBlockFDD.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "FDDRaw/DataBlockFDD.h" +using namespace o2::fdd; diff --git a/Detectors/FIT/FDD/raw/src/DigitBlockFDD.cxx b/Detectors/FIT/FDD/raw/src/DigitBlockFDD.cxx new file mode 100644 index 0000000000000..db0a70f93e37e --- /dev/null +++ b/Detectors/FIT/FDD/raw/src/DigitBlockFDD.cxx @@ -0,0 +1,15 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "FDDRaw/DigitBlockFDD.h" +using namespace o2::fdd; + +int DigitBlockFDD::sEventID = 0; +o2::fdd::LookUpTable DigitBlockFDD::sLookupTable = o2::fdd::LookUpTable::linear(); diff --git a/Detectors/FIT/FDD/raw/src/FDDRawLinkDef.h b/Detectors/FIT/FDD/raw/src/FDDRawLinkDef.h new file mode 100644 index 0000000000000..4b970c120926b --- /dev/null +++ b/Detectors/FIT/FDD/raw/src/FDDRawLinkDef.h @@ -0,0 +1,21 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifdef __CLING__ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class o2::fdd::DataBlockPM + ; +#pragma link C++ class o2::fdd::DataBlockTCM + ; +#pragma link C++ class o2::fdd::DigitBlockFDD + ; + +#endif diff --git a/Detectors/FIT/FDD/raw/src/RawReaderFDDBase.cxx b/Detectors/FIT/FDD/raw/src/RawReaderFDDBase.cxx new file mode 100644 index 0000000000000..bcf023f3255c3 --- /dev/null +++ b/Detectors/FIT/FDD/raw/src/RawReaderFDDBase.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "FDDRaw/RawReaderFDDBase.h" +using namespace o2::fdd; diff --git a/Detectors/FIT/FDD/simulation/include/FDDSimulation/Digitizer.h b/Detectors/FIT/FDD/simulation/include/FDDSimulation/Digitizer.h index da6056fdf24e2..dec43aeb35737 100644 --- a/Detectors/FIT/FDD/simulation/include/FDDSimulation/Digitizer.h +++ b/Detectors/FIT/FDD/simulation/include/FDDSimulation/Digitizer.h @@ -65,10 +65,12 @@ class Digitizer void process(const std::vector& hits, std::vector& digitsBC, std::vector& digitsCh, + std::vector& digitsTrig, o2::dataformats::MCTruthContainer& labels); void flush(std::vector& digitsBC, std::vector& digitsCh, + std::vector& digitsTrig, o2::dataformats::MCTruthContainer& labels); void setEventTime(long value) { mEventTime = value; } @@ -93,7 +95,7 @@ class Digitizer BCCache* getBCCache(const o2::InteractionRecord& ir); void storeBC(const BCCache& bc, - std::vector& digitsBC, std::vector& digitsCh, + std::vector& digitsBC, std::vector& digitsCh, std::vector& digitsTrig, o2::dataformats::MCTruthContainer& labels); long mEventTime; // TF (run) timestamp diff --git a/Detectors/FIT/FDD/simulation/src/Digitizer.cxx b/Detectors/FIT/FDD/simulation/src/Digitizer.cxx index fdb232dc95d66..8df9cfc5346b8 100644 --- a/Detectors/FIT/FDD/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/FDD/simulation/src/Digitizer.cxx @@ -32,12 +32,13 @@ Digitizer::BCCache::BCCache() void Digitizer::process(const std::vector& hits, std::vector& digitsBC, std::vector& digitsCh, + std::vector& digitsTrig, o2::dataformats::MCTruthContainer& labels) { // loop over all hits and produce digits //LOG(INFO) << "Processing IR = " << mIntRecord << " | NHits = " << hits.size(); - flush(digitsBC, digitsCh, labels); // flush cached signal which cannot be affect by new event + flush(digitsBC, digitsCh, digitsTrig, labels); // flush cached signal which cannot be affect by new event auto sorted_hits{hits}; std::sort(sorted_hits.begin(), sorted_hits.end(), [](o2::fdd::Hit const& a, o2::fdd::Hit const& b) { @@ -155,6 +156,7 @@ void Digitizer::createPulse(int nPhE, int parID, double timeHit, std::array& digitsBC, std::vector& digitsCh, + std::vector& digitsTrig, o2::dataformats::MCTruthContainer& labels) { @@ -175,7 +177,7 @@ void Digitizer::flush(std::vector& digitsBC, for (int ibc = 0; ibc < nCached; ibc++) { // digitize BCs which might not be affected by future events auto& bc = mCache[ibc]; - storeBC(bc, digitsBC, digitsCh, labels); + storeBC(bc, digitsBC, digitsCh, digitsTrig, labels); } // clean cache for BCs which are not needed anymore //LOG(INFO) << "Cleaning cache"; @@ -184,6 +186,7 @@ void Digitizer::flush(std::vector& digitsBC, //_____________________________________________________________________________ void Digitizer::storeBC(const BCCache& bc, std::vector& digitsBC, std::vector& digitsCh, + std::vector& digitsTrig, o2::dataformats::MCTruthContainer& labels) { //LOG(INFO) << "Storing BC " << bc; @@ -196,6 +199,7 @@ void Digitizer::storeBC(const BCCache& bc, int nBC = digitsBC.size(); digitsBC.emplace_back(first, 16, bc, mTriggers); + digitsTrig.emplace_back(bc, 0, 0, 0, 0, 0); for (const auto& lbl : bc.labels) { labels.addElement(nBC, lbl); diff --git a/Detectors/FIT/FDD/workflow/CMakeLists.txt b/Detectors/FIT/FDD/workflow/CMakeLists.txt index 65cca7cf3aba7..39a02f65daec7 100644 --- a/Detectors/FIT/FDD/workflow/CMakeLists.txt +++ b/Detectors/FIT/FDD/workflow/CMakeLists.txt @@ -10,15 +10,24 @@ o2_add_library(FDDWorkflow SOURCES src/DigitReaderSpec.cxx + src/DigitWriterSpec.cxx src/EntropyEncoderSpec.cxx src/EntropyDecoderSpec.cxx src/RecoWorkflow.cxx src/ReconstructorSpec.cxx src/RecPointWriterSpec.cxx src/RecPointReaderSpec.cxx - PUBLIC_LINK_LIBRARIES O2::FDDReconstruction + + src/RawDataProcessSpec.cxx + src/RawDataReaderSpec.cxx + src/RawReaderFDD.cxx + src/RawWorkflow.cxx + + PUBLIC_LINK_LIBRARIES O2::DataFormatsFDD + O2::FDDReconstruction O2::Framework - O2::DPLUtils) + O2::DPLUtils + O2::FDDRaw) o2_add_executable(reco-workflow COMPONENT_NAME fdd @@ -35,3 +44,8 @@ o2_add_executable(digit-reader-workflow COMPONENT_NAME fdd PUBLIC_LINK_LIBRARIES O2::FDDWorkflow) +o2_add_executable(flp-dpl-workflow + COMPONENT_NAME fdd + SOURCES src/fdd-flp-workflow.cxx + PUBLIC_LINK_LIBRARIES O2::FDDWorkflow + TARGETVARNAME fddflpexe) diff --git a/Detectors/FIT/FDD/workflow/include/FDDWorkflow/DigitWriterSpec.h b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/DigitWriterSpec.h new file mode 100644 index 0000000000000..8440758943444 --- /dev/null +++ b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/DigitWriterSpec.h @@ -0,0 +1,31 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file DigitWriterSpec.h + +#ifndef O2_FDDDIGITWRITER_H +#define O2_FDDDIGITWRITER_H + +#include "Framework/DataProcessorSpec.h" + +using namespace o2::framework; + +namespace o2 +{ +namespace fdd +{ + +/// create a processor spec +framework::DataProcessorSpec getFDDDigitWriterSpec(); + +} // namespace fdd +} // namespace o2 + +#endif /* O2_DIGITWRITER_H */ diff --git a/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawDataProcessSpec.h b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawDataProcessSpec.h new file mode 100644 index 0000000000000..3bd340796be22 --- /dev/null +++ b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawDataProcessSpec.h @@ -0,0 +1,60 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file RawDataProcessSpec.h + +#ifndef O2_FDD_RAWDATAPROCESSSPEC_H +#define O2_FDD_RAWDATAPROCESSSPEC_H + +#include "Framework/CallbackService.h" +#include "Framework/ConfigParamRegistry.h" +#include "Framework/ControlService.h" +#include "Framework/Lifetime.h" +#include "Framework/Output.h" +#include "Framework/WorkflowSpec.h" +#include "Framework/SerializationMethods.h" +#include "Framework/DataProcessorSpec.h" +#include "Framework/Task.h" + +#include "FDDRaw/DigitBlockFDD.h" +#include "DataFormatsFDD/Digit.h" +#include "DataFormatsFDD/ChannelData.h" + +#include +#include +#include + +using namespace o2::framework; + +namespace o2 +{ +namespace fdd +{ + +class RawDataProcessSpec : public Task +{ + public: + RawDataProcessSpec(bool dumpEventBlocks) : mDumpEventBlocks(dumpEventBlocks) {} + ~RawDataProcessSpec() override = default; + void init(InitContext& ic) final; + void run(ProcessingContext& pc) final; + + private: + bool mDumpEventBlocks; + + o2::header::DataOrigin mOrigin = o2::header::gDataOriginFDD; +}; + +framework::DataProcessorSpec getFDDRawDataProcessSpec(bool dumpProcessor); + +} // namespace fdd +} // namespace o2 + +#endif /* O2_FDDDATAPROCESSDPL_H */ diff --git a/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawDataReaderSpec.h b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawDataReaderSpec.h new file mode 100644 index 0000000000000..51ea363b7840c --- /dev/null +++ b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawDataReaderSpec.h @@ -0,0 +1,81 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file RawDataReaderSpec.h + +#ifndef O2_FDD_RAWDATAREADERSPEC_H +#define O2_FDD_RAWDATAREADERSPEC_H + +#include "Framework/DataProcessorSpec.h" +#include "Framework/Task.h" +#include "Framework/CallbackService.h" +#include "Framework/ConfigParamRegistry.h" +#include "Framework/ControlService.h" +#include "Framework/Lifetime.h" +#include "Framework/Output.h" +#include "Framework/WorkflowSpec.h" +#include "Framework/SerializationMethods.h" +#include "DPLUtils/DPLRawParser.h" + +#include +#include +#include +using namespace o2::framework; + +namespace o2 +{ +namespace fdd +{ +template +class RawDataReaderSpec : public Task +{ + public: + RawDataReaderSpec(const RawReader& rawReader) : mRawReader(rawReader) {} + RawDataReaderSpec() = default; + ~RawDataReaderSpec() override = default; + void init(InitContext& ic) final {} + void run(ProcessingContext& pc) final + { + DPLRawParser parser(pc.inputs()); + mRawReader.clear(); + LOG(INFO) << "FDD RawDataReaderSpec"; + uint64_t count = 0; + for (auto it = parser.begin(), end = parser.end(); it != end; ++it) { + //Proccessing each page + count++; + auto rdhPtr = it.get_if(); + gsl::span payload(it.data(), it.size()); + mRawReader.process(rdhPtr->linkID, payload); + } + LOG(INFO) << "Pages: " << count; + mRawReader.accumulateDigits(); + mRawReader.makeSnapshot(pc); + } + RawReader mRawReader; +}; + +template +framework::DataProcessorSpec getFDDRawDataReaderSpec(const RawReader& rawReader) +{ + LOG(INFO) << "DataProcessorSpec initDataProcSpec() for RawReaderFDD"; + std::vector outputSpec; + RawReader::prepareOutputSpec(outputSpec); + return DataProcessorSpec{ + "fdd-datareader-dpl", + o2::framework::select("TF:FDD/RAWDATA"), + outputSpec, + adaptFromTask>(rawReader), + Options{}}; +} + +} // namespace fdd +} // namespace o2 + +#endif /* O2_FDDDATAREADERDPL_H */ diff --git a/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawReaderFDD.h b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawReaderFDD.h new file mode 100644 index 0000000000000..51538f680f141 --- /dev/null +++ b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawReaderFDD.h @@ -0,0 +1,78 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. +// +//file RawReaderFDD.h class for RAW data reading +// +// Artur.Furs +// afurs@cern.ch +// +//Main purpuse is to decode FDD data blocks and push them to DigitBlockFDD for proccess +//TODO: prepare wrappers for containers with digits and combine classes below into one template class? +#ifndef ALICEO2_FDD_RAWREADERFDD_H_ +#define ALICEO2_FDD_RAWREADERFDD_H_ +#include +#include +#include +#include "FDDRaw/RawReaderFDDBase.h" + +#include "DataFormatsFDD/Digit.h" +#include "DataFormatsFDD/ChannelData.h" + +#include "Framework/ProcessingContext.h" +#include "Framework/DataAllocator.h" +#include "Framework/OutputSpec.h" +#include + +namespace o2 +{ +namespace fdd +{ +//Normal TCM mode +class RawReaderFDD : public RawReaderFDDBaseNorm +{ + public: + RawReaderFDD(bool dumpData) : mDumpData(dumpData) {} + RawReaderFDD(const RawReaderFDD&) = default; + + RawReaderFDD() = default; + ~RawReaderFDD() = default; + void clear() + { + mVecDigits.clear(); + mVecChannelData.clear(); + } + void accumulateDigits() + { + getDigits(mVecDigits, mVecChannelData); + LOG(INFO) << "Number of Digits: " << mVecDigits.size(); + LOG(INFO) << "Number of ChannelData: " << mVecChannelData.size(); + if (mDumpData) { + DigitBlockFDD::print(mVecDigits, mVecChannelData); + } + } + static void prepareOutputSpec(std::vector& outputSpec) + { + outputSpec.emplace_back(o2::header::gDataOriginFDD, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe); + outputSpec.emplace_back(o2::header::gDataOriginFDD, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe); + } + void makeSnapshot(o2::framework::ProcessingContext& pc) + { + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginFDD, "DIGITSBC", 0, o2::framework::Lifetime::Timeframe}, mVecDigits); + pc.outputs().snapshot(o2::framework::Output{o2::header::gDataOriginFDD, "DIGITSCH", 0, o2::framework::Lifetime::Timeframe}, mVecChannelData); + } + bool mDumpData; + std::vector mVecDigits; + std::vector mVecChannelData; +}; + +} // namespace fdd +} // namespace o2 + +#endif diff --git a/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawWorkflow.h b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawWorkflow.h new file mode 100644 index 0000000000000..f4096f6aa59a5 --- /dev/null +++ b/Detectors/FIT/FDD/workflow/include/FDDWorkflow/RawWorkflow.h @@ -0,0 +1,27 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#ifndef O2_FDD_RAWWORKFLOW_H +#define O2_FDD_RAWWORKFLOW_H + +/// @file RawWorkflow.h + +#include "Framework/WorkflowSpec.h" + +namespace o2 +{ +namespace fdd +{ +framework::WorkflowSpec getFDDRawWorkflow(bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut); +} // namespace fdd +} // namespace o2 +#endif diff --git a/Detectors/FIT/FDD/workflow/src/DigitWriterSpec.cxx b/Detectors/FIT/FDD/workflow/src/DigitWriterSpec.cxx new file mode 100644 index 0000000000000..d5e6ef4a60c76 --- /dev/null +++ b/Detectors/FIT/FDD/workflow/src/DigitWriterSpec.cxx @@ -0,0 +1,46 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file DigitWriterSpec.cxx + +#include + +#include "DPLUtils/MakeRootTreeWriterSpec.h" +#include "DataFormatsFDD/ChannelData.h" +#include "DataFormatsFDD/Digit.h" +#include "FDDWorkflow/DigitWriterSpec.h" +using namespace o2::framework; + +namespace o2 +{ +namespace fdd +{ + +template +using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition; +DataProcessorSpec getFDDDigitWriterSpec() +{ + using DigitType = std::vector; + using ChanDataType = std::vector; + // Spectators for logging + auto logger = [](DigitType const& digits) { + LOG(INFO) << "FDDDigitWriter pulled " << digits.size() << " digits"; + }; + return MakeRootTreeWriterSpec( + "fdd-digit-writer", "o2digit_fdd.root", "o2sim", + BranchDefinition{InputSpec{"digits", "FDD", "DIGITSBC", 0}, + "FDDDIGITSBC", "fdd-digits-branch-name", 1, + logger}, + BranchDefinition{InputSpec{"digch", "FDD", "DIGITSCH", 0}, + "FDDDIGITSCH", "fdd-chhdata-branch-name"})(); +} + +} // namespace fdd +} // namespace o2 diff --git a/Detectors/FIT/FDD/workflow/src/RawDataProcessSpec.cxx b/Detectors/FIT/FDD/workflow/src/RawDataProcessSpec.cxx new file mode 100644 index 0000000000000..d0a23c5068207 --- /dev/null +++ b/Detectors/FIT/FDD/workflow/src/RawDataProcessSpec.cxx @@ -0,0 +1,51 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file RawDataProcessSpec.cxx + +#include "FDDWorkflow/RawDataProcessSpec.h" + +using namespace o2::framework; + +namespace o2 +{ +namespace fdd +{ +using namespace std; +void RawDataProcessSpec::init(InitContext& ic) +{ +} + +void RawDataProcessSpec::run(ProcessingContext& pc) +{ + LOG(INFO) << "RawDataProcessSpec running..."; + auto vecDigits = pc.inputs().get>("digits"); + auto vecChannelData = pc.inputs().get>("digch"); + if (mDumpEventBlocks) { + DigitBlockFDD::print(vecDigits, vecChannelData); + } +} + +DataProcessorSpec getFDDRawDataProcessSpec(bool dumpProcessor) +{ + std::vector inputSpec; + inputSpec.emplace_back("digits", o2::header::gDataOriginFDD, "DIGITSBC", 0, Lifetime::Timeframe); + inputSpec.emplace_back("digch", o2::header::gDataOriginFDD, "DIGITSCH", 0, Lifetime::Timeframe); + LOG(INFO) << "DataProcessorSpec getRawDataProcessSpec"; + return DataProcessorSpec{ + "fdd-dataprocess-dpl-flp", + inputSpec, + Outputs{}, + AlgorithmSpec{adaptFromTask(dumpProcessor)}, + Options{}}; +} + +} // namespace fdd +} // namespace o2 diff --git a/Detectors/FIT/FDD/workflow/src/RawDataReaderSpec.cxx b/Detectors/FIT/FDD/workflow/src/RawDataReaderSpec.cxx new file mode 100644 index 0000000000000..7e17650d8cb0f --- /dev/null +++ b/Detectors/FIT/FDD/workflow/src/RawDataReaderSpec.cxx @@ -0,0 +1,23 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file RawDataReaderSpec.cxx + +#include "FDDWorkflow/RawDataReaderSpec.h" + +using namespace o2::framework; + +namespace o2 +{ +namespace fdd +{ + +} // namespace fdd +} // namespace o2 diff --git a/Detectors/FIT/FDD/workflow/src/RawReaderFDD.cxx b/Detectors/FIT/FDD/workflow/src/RawReaderFDD.cxx new file mode 100644 index 0000000000000..ce6c961101136 --- /dev/null +++ b/Detectors/FIT/FDD/workflow/src/RawReaderFDD.cxx @@ -0,0 +1,12 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "FDDWorkflow/RawReaderFDD.h" +using namespace o2::fdd; diff --git a/Detectors/FIT/FDD/workflow/src/RawWorkflow.cxx b/Detectors/FIT/FDD/workflow/src/RawWorkflow.cxx new file mode 100644 index 0000000000000..b571054c66cd8 --- /dev/null +++ b/Detectors/FIT/FDD/workflow/src/RawWorkflow.cxx @@ -0,0 +1,41 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +/// @file RawWorkflow.cxx + +#include "FDDWorkflow/RawWorkflow.h" +#include "FDDWorkflow/RawDataProcessSpec.h" +#include "FDDWorkflow/RawDataReaderSpec.h" +#include "FDDWorkflow/DigitWriterSpec.h" +#include "FDDWorkflow/RawReaderFDD.h" +namespace o2 +{ +namespace fdd +{ + +framework::WorkflowSpec getFDDRawWorkflow(bool useProcess, + bool dumpProcessor, bool dumpReader, + bool disableRootOut) +{ + LOG(INFO) << "framework::WorkflowSpec getFDDWorkflow"; + framework::WorkflowSpec specs; + specs.emplace_back(o2::fdd::getFDDRawDataReaderSpec(RawReaderFDD{dumpReader})); + + if (useProcess) { + specs.emplace_back(o2::fdd::getFDDRawDataProcessSpec(dumpProcessor)); + } + if (!disableRootOut) { + specs.emplace_back(o2::fdd::getFDDDigitWriterSpec()); + } + return specs; +} + +} // namespace fdd +} // namespace o2 diff --git a/Detectors/FIT/FDD/workflow/src/fdd-flp-workflow.cxx b/Detectors/FIT/FDD/workflow/src/fdd-flp-workflow.cxx new file mode 100644 index 0000000000000..02d2c45635e99 --- /dev/null +++ b/Detectors/FIT/FDD/workflow/src/fdd-flp-workflow.cxx @@ -0,0 +1,59 @@ +// Copyright CERN and copyright holders of ALICE O2. This software is +// distributed under the terms of the GNU General Public License v3 (GPL +// Version 3), copied verbatim in the file "COPYING". +// +// See http://alice-o2.web.cern.ch/license for full licensing information. +// +// In applying this license CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +#include "CommonUtils/ConfigurableParam.h" +#include "FDDWorkflow/RawWorkflow.h" + +using namespace o2::framework; + +// ------------------------------------------------------------------ + +// we need to add workflow options before including Framework/runDataProcessing +void customize(std::vector& workflowOptions) +{ + // option allowing to set parameters + workflowOptions.push_back( + ConfigParamSpec{"use-process", + o2::framework::VariantType::Bool, + false, + {"enable processor for data taking/dumping"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-process", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at processor side"}}); + workflowOptions.push_back( + ConfigParamSpec{"dump-blocks-reader", + o2::framework::VariantType::Bool, + false, + {"enable dumping of event blocks at reader side"}}); + workflowOptions.push_back( + ConfigParamSpec{"disable-root-output", + o2::framework::VariantType::Bool, + false, + {"disable root-files output writers"}}); +} + +// ------------------------------------------------------------------ + +#include "Framework/runDataProcessing.h" + +WorkflowSpec defineDataProcessing(ConfigContext const& configcontext) +{ + LOG(INFO) << "WorkflowSpec defineDataProcessing"; + auto useProcessor = configcontext.options().get("use-process"); + auto dumpProcessor = configcontext.options().get("dump-blocks-process"); + auto dumpReader = configcontext.options().get("dump-blocks-reader"); + auto disableRootOut = + configcontext.options().get("disable-root-output"); + LOG(INFO) << "WorkflowSpec FLPWorkflow"; + return std::move(o2::fdd::getFDDRawWorkflow( + useProcessor, dumpProcessor, dumpReader, disableRootOut)); +} diff --git a/Steer/DigitizerWorkflow/src/FDDDigitWriterSpec.h b/Steer/DigitizerWorkflow/src/FDDDigitWriterSpec.h index 872a4a11da3bb..d5d1bab1e4417 100644 --- a/Steer/DigitizerWorkflow/src/FDDDigitWriterSpec.h +++ b/Steer/DigitizerWorkflow/src/FDDDigitWriterSpec.h @@ -75,6 +75,7 @@ o2::framework::DataProcessorSpec getFDDDigitWriterSpec(bool mctruth = true) MakeRootTreeWriterSpec::CustomClose(finishWriting), BranchDefinition>{InputSpec{"digitBCinput", "FDD", "DIGITSBC"}, "FDDDigit"}, BranchDefinition>{InputSpec{"digitChinput", "FDD", "DIGITSCH"}, "FDDDigitCh"}, + BranchDefinition>{InputSpec{"digitTrinput", "FDD", "TRIGGERINPUT"}, "TRIGGERINPUT"}, std::move(labelsdef))(); } diff --git a/Steer/DigitizerWorkflow/src/FDDDigitizerSpec.cxx b/Steer/DigitizerWorkflow/src/FDDDigitizerSpec.cxx index 4b72eeb32dbaa..52f9f972103eb 100644 --- a/Steer/DigitizerWorkflow/src/FDDDigitizerSpec.cxx +++ b/Steer/DigitizerWorkflow/src/FDDDigitizerSpec.cxx @@ -31,7 +31,6 @@ using namespace o2::framework; using SubSpecificationType = o2::framework::DataAllocator::SubSpecificationType; - namespace o2 { namespace fdd @@ -91,18 +90,19 @@ class FDDDPLDigitizerTask : public o2::base::BaseDPLDigitizer mDigitizer.setEventID(part.entryID); mDigitizer.setSrcID(part.sourceID); - mDigitizer.process(hits, mDigitsBC, mDigitsCh, labels); + mDigitizer.process(hits, mDigitsBC, mDigitsCh, mDigitsTrig, labels); } } o2::InteractionTimeRecord terminateIR; terminateIR.orbit = 0xffffffff; // supply IR in the infinite future to flush all cached BC mDigitizer.setInteractionRecord(terminateIR); - mDigitizer.flush(mDigitsBC, mDigitsCh, labels); + mDigitizer.flush(mDigitsBC, mDigitsCh, mDigitsTrig, labels); // send out to next stage pc.outputs().snapshot(Output{"FDD", "DIGITSBC", 0, Lifetime::Timeframe}, mDigitsBC); pc.outputs().snapshot(Output{"FDD", "DIGITSCH", 0, Lifetime::Timeframe}, mDigitsCh); + pc.outputs().snapshot(Output{"FDD", "TRIGGERINPUT", 0, Lifetime::Timeframe}, mDigitsTrig); if (pc.outputs().isAllowed({"FDD", "DIGITLBL", 0})) { auto& sharedlabels = pc.outputs().make>(Output{"FDD", "DIGITLBL", 0, Lifetime::Timeframe}); labels.flatten_to(sharedlabels); @@ -123,6 +123,7 @@ class FDDDPLDigitizerTask : public o2::base::BaseDPLDigitizer std::vector mSimChains; std::vector mDigitsCh; std::vector mDigitsBC; + std::vector mDigitsTrig; // RS: at the moment using hardcoded flag for continuous readout o2::parameters::GRPObject::ROMode mROMode = o2::parameters::GRPObject::CONTINUOUS; // readout mode @@ -138,6 +139,7 @@ o2::framework::DataProcessorSpec getFDDDigitizerSpec(int channel, bool mctruth) std::vector outputs; outputs.emplace_back("FDD", "DIGITSBC", 0, Lifetime::Timeframe); outputs.emplace_back("FDD", "DIGITSCH", 0, Lifetime::Timeframe); + outputs.emplace_back("FDD", "TRIGGERINPUT", 0, Lifetime::Timeframe); if (mctruth) { outputs.emplace_back("FDD", "DIGITLBL", 0, Lifetime::Timeframe); }