From 9cccd10f9a2d4cd2efd5146983ee789a46878094 Mon Sep 17 00:00:00 2001 From: Maciej Slupecki Date: Thu, 14 Apr 2022 20:22:44 +0200 Subject: [PATCH] [FIT] Separate Trigger class and make it common for FT0, FV0 and FDD --- DataFormats/Detectors/FIT/CMakeLists.txt | 3 +- DataFormats/Detectors/FIT/FDD/CMakeLists.txt | 29 ++-- .../FIT/FDD/include/DataFormatsFDD/Digit.h | 65 +------ .../FIT/FDD/src/DataFormatsFDDLinkDef.h | 2 - DataFormats/Detectors/FIT/FT0/CMakeLists.txt | 47 +++--- .../FIT/FT0/include/DataFormatsFT0/Digit.h | 65 +------ .../FT0/include/DataFormatsFT0/RecPoints.h | 8 +- .../FIT/FT0/src/DataFormatsFT0LinkDef.h | 2 - DataFormats/Detectors/FIT/FT0/src/Digit.cxx | 10 +- DataFormats/Detectors/FIT/FV0/CMakeLists.txt | 40 ++--- .../FIT/FV0/include/DataFormatsFV0/Digit.h | 70 +------- .../FV0/include/DataFormatsFV0/RecPoints.h | 6 +- .../FIT/FV0/src/DataFormatsFV0LinkDef.h | 2 - DataFormats/Detectors/FIT/FV0/src/Digit.cxx | 10 +- .../Detectors/FIT/common/CMakeLists.txt | 4 +- .../common/include/DataFormatsFIT/Triggers.h | 128 ++++++++++++++ .../FIT/common/src/DataFormatsFITLinkDef.h | 3 + .../Detectors/FIT/common/src/Triggers.cxx | 36 ++++ Detectors/AOD/src/AODProducerWorkflowSpec.cxx | 6 +- Detectors/CTF/test/test_ctf_io_fdd.cxx | 51 +++--- Detectors/CTF/test/test_ctf_io_ft0.cxx | 49 +++--- Detectors/CTF/test/test_ctf_io_fv0.cxx | 26 +-- .../include/FDDReconstruction/CTFCoder.h | 32 ++-- .../FIT/FDD/reconstruction/src/CTFCoder.cxx | 2 +- .../include/FT0Reconstruction/CTFCoder.h | 32 ++-- .../FT0Reconstruction/InteractionTag.h | 2 +- .../FIT/FT0/reconstruction/src/CTFCoder.cxx | 2 +- .../FIT/FT0/simulation/src/Digitizer.cxx | 9 +- .../include/FV0Reconstruction/CTFCoder.h | 23 ++- .../FIT/FV0/reconstruction/src/CTFCoder.cxx | 2 +- .../FIT/FV0/simulation/src/Digitizer.cxx | 8 +- .../FIT/raw/include/FITRaw/DigitBlockFIT.h | 159 ++++-------------- 32 files changed, 435 insertions(+), 498 deletions(-) create mode 100644 DataFormats/Detectors/FIT/common/include/DataFormatsFIT/Triggers.h create mode 100644 DataFormats/Detectors/FIT/common/src/Triggers.cxx diff --git a/DataFormats/Detectors/FIT/CMakeLists.txt b/DataFormats/Detectors/FIT/CMakeLists.txt index 5facb351c3c45..8c406f517a9b9 100644 --- a/DataFormats/Detectors/FIT/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/CMakeLists.txt @@ -9,7 +9,8 @@ # granted to it by virtue of its status as an Intergovernmental Organization # or submit itself to any jurisdiction. +add_subdirectory(common) add_subdirectory(FDD) add_subdirectory(FT0) add_subdirectory(FV0) -add_subdirectory(common) + diff --git a/DataFormats/Detectors/FIT/FDD/CMakeLists.txt b/DataFormats/Detectors/FIT/FDD/CMakeLists.txt index 7ef1229e5595e..fff07003f2700 100644 --- a/DataFormats/Detectors/FIT/FDD/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/FDD/CMakeLists.txt @@ -10,19 +10,20 @@ # or submit itself to any jurisdiction. o2_add_library(DataFormatsFDD - SOURCES src/RawEventData.cxx - src/CTF.cxx - PUBLIC_LINK_LIBRARIES O2::FDDBase - O2::DataFormatsFIT - O2::CommonDataFormat - O2::SimulationDataFormat) + SOURCES src/RawEventData.cxx + src/CTF.cxx + PUBLIC_LINK_LIBRARIES O2::FDDBase + O2::DataFormatsFIT + O2::SimulationDataFormat + O2::CommonDataFormat +) o2_target_root_dictionary(DataFormatsFDD - HEADERS include/DataFormatsFDD/Digit.h - include/DataFormatsFDD/ChannelData.h - include/DataFormatsFDD/RecPoint.h - include/DataFormatsFDD/MCLabel.h - include/DataFormatsFDD/Hit.h - include/DataFormatsFDD/RawEventData.h - include/DataFormatsFDD/LookUpTable.h - include/DataFormatsFDD/CTF.h) \ No newline at end of file + HEADERS include/DataFormatsFDD/ChannelData.h + include/DataFormatsFDD/Digit.h + include/DataFormatsFDD/MCLabel.h + include/DataFormatsFDD/Hit.h + include/DataFormatsFDD/RecPoint.h + include/DataFormatsFDD/RawEventData.h + include/DataFormatsFDD/LookUpTable.h + include/DataFormatsFDD/CTF.h) diff --git a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/Digit.h b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/Digit.h index 829dfef006d53..b37a060202351 100644 --- a/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/Digit.h +++ b/DataFormats/Detectors/FIT/FDD/include/DataFormatsFDD/Digit.h @@ -12,76 +12,23 @@ #ifndef ALICEO2_FDD_DIGIT_H #define ALICEO2_FDD_DIGIT_H -#include "CommonDataFormat/RangeReference.h" #include "CommonDataFormat/InteractionRecord.h" +#include "CommonDataFormat/RangeReference.h" #include "CommonDataFormat/TimeStamp.h" #include "DataFormatsFDD/ChannelData.h" -#include -#include +#include "DataFormatsFIT/Triggers.h" #include #include #include +#include #include + namespace o2 { namespace fdd { - class ChannelData; - -struct Triggers { - enum { bitA, - bitC, - bitVertex, - bitCen, - bitSCen }; - uint8_t triggersignals = 0; // FDD trigger signals - int8_t nChanA = 0; // number of fired channels A side - int8_t nChanC = 0; // number of fired channels A side - int32_t amplA = -1024; // sum amplitude A side - int32_t amplC = -1024; // sum amplitude C side - int16_t timeA = 0; // average time A side - int16_t timeC = 0; // average time C side - Triggers() = default; - Triggers(uint8_t signals, int8_t chanA, int8_t chanC, int32_t aamplA, int32_t aamplC, int16_t atimeA, int16_t atimeC) - { - triggersignals = signals; - nChanA = chanA; - nChanC = chanC; - amplA = aamplA; - amplC = aamplC; - timeA = atimeA; - timeC = atimeC; - } - - bool getOrA() const { return (triggersignals & (1 << bitA)) != 0; } - bool getOrC() const { return (triggersignals & (1 << bitC)) != 0; } - bool getVertex() const { return (triggersignals & (1 << bitVertex)) != 0; } - bool getCen() const { return (triggersignals & (1 << bitCen)) != 0; } - bool getSCen() const { return (triggersignals & (1 << bitSCen)) != 0; } - - void cleanTriggers() - { - triggersignals = 0; - nChanA = nChanC = 0; - amplA = amplC = 0; - timeA = timeC = 0; - } - Triggers getTriggers(); - bool operator==(Triggers const& other) const - { - return std::tie(triggersignals, nChanA, nChanC, amplA, amplC, timeA, timeC) == - std::tie(other.triggersignals, other.nChanA, other.nChanC, other.amplA, other.amplC, other.timeA, other.timeC); - } - void printLog() const - { - LOG(info) << "mTrigger: " << static_cast(triggersignals); - LOG(info) << "nChanA: " << static_cast(nChanA) << " | nChanC: " << static_cast(nChanC); - LOG(info) << "amplA: " << amplA << " | amplC: " << amplC; - LOG(info) << "timeA: " << timeA << " | timeC: " << timeC; - } - ClassDefNV(Triggers, 1); -}; +using Triggers = o2::fit::Triggers; struct DetTrigInput { static constexpr char sChannelNameDPL[] = "TRIGGERINPUT"; @@ -106,7 +53,7 @@ struct Digit { static constexpr char sChannelNameDPL[] = "DIGITSBC"; static constexpr char sDigitName[] = "Digit"; static constexpr char sDigitBranchName[] = "FDDDigit"; - o2::dataformats::RangeRefComp<5> ref; + o2::dataformats::RangeReference ref{}; Triggers mTriggers; // pattern of triggers in this BC o2::InteractionRecord mIntRecord; // Interaction record (orbit, bc) Digit() = default; diff --git a/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h b/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h index 6a83c4e9b033b..fb43b97bd3f2c 100644 --- a/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h +++ b/DataFormats/Detectors/FIT/FDD/src/DataFormatsFDDLinkDef.h @@ -19,8 +19,6 @@ #pragma link C++ class o2::fdd::ChannelData + ; #pragma link C++ class vector < o2::fdd::Digit> + ; #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> + ; diff --git a/DataFormats/Detectors/FIT/FT0/CMakeLists.txt b/DataFormats/Detectors/FIT/FT0/CMakeLists.txt index 519dcba2b1513..b4091f852ee50 100644 --- a/DataFormats/Detectors/FIT/FT0/CMakeLists.txt +++ b/DataFormats/Detectors/FIT/FT0/CMakeLists.txt @@ -10,32 +10,33 @@ # or submit itself to any jurisdiction. o2_add_library(DataFormatsFT0 - SOURCES src/Digit.cxx SOURCES src/ChannelData.cxx - SOURCES src/RecPoints.cxx - SOURCES src/RawEventData.cxx - SOURCES src/CTF.cxx - SOURCES src/GlobalOffsetsCalibrationObject.cxx - SOURCES src/GlobalOffsetsContainer.cxx - PUBLIC_LINK_LIBRARIES O2::CommonDataFormat - O2::Headers + src/Digit.cxx + src/RecPoints.cxx + src/RawEventData.cxx + src/CTF.cxx + src/GlobalOffsetsCalibrationObject.cxx + src/GlobalOffsetsContainer.cxx + PUBLIC_LINK_LIBRARIES O2::FT0Base + O2::DataFormatsFIT O2::SimulationDataFormat + O2::CommonDataFormat + O2::Headers O2::CCDB O2::DetectorsCalibration - O2::FT0Base - O2::DataFormatsFIT - ) +) o2_target_root_dictionary(DataFormatsFT0 - HEADERS include/DataFormatsFT0/Digit.h - include/DataFormatsFT0/ChannelData.h - include/DataFormatsFT0/RecPoints.h - include/DataFormatsFT0/MCLabel.h - include/DataFormatsFT0/HitType.h - include/DataFormatsFT0/RawEventData.h - include/DataFormatsFT0/LookUpTable.h - include/DataFormatsFT0/CTF.h - include/DataFormatsFT0/RecoCalibInfoObject.h - include/DataFormatsFT0/GlobalOffsetsInfoObject.h - include/DataFormatsFT0/GlobalOffsetsCalibrationObject.h - include/DataFormatsFT0/GlobalOffsetsContainer.h) + HEADERS include/DataFormatsFT0/ChannelData.h + include/DataFormatsFT0/Digit.h + include/DataFormatsFT0/MCLabel.h + include/DataFormatsFT0/HitType.h + include/DataFormatsFT0/RecPoints.h + include/DataFormatsFT0/RawEventData.h + include/DataFormatsFT0/LookUpTable.h + include/DataFormatsFT0/CTF.h + include/DataFormatsFT0/RecoCalibInfoObject.h + include/DataFormatsFT0/GlobalOffsetsInfoObject.h + include/DataFormatsFT0/GlobalOffsetsCalibrationObject.h + include/DataFormatsFT0/GlobalOffsetsContainer.h +) diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/Digit.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/Digit.h index 96758e74af1ff..6f961d59f3ebc 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/Digit.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/Digit.h @@ -20,11 +20,11 @@ #include "CommonDataFormat/RangeReference.h" #include "CommonDataFormat/TimeStamp.h" #include "DataFormatsFT0/ChannelData.h" +#include "DataFormatsFIT/Triggers.h" #include #include #include #include - #include namespace o2 @@ -32,65 +32,7 @@ namespace o2 namespace ft0 { class ChannelData; - -struct Triggers { - enum { bitA, - bitC, - bitVertex, - bitCen, - bitSCen, - bitLaser }; - uint8_t triggersignals = 0; // T0 trigger signals - int8_t nChanA = 0; // number of fired channels A side - int8_t nChanC = 0; // number of fired channels A side - int32_t amplA = -5000; // sum amplitude A side - int32_t amplC = -5000; // sum amplitude C side - int16_t timeA = -5000; // average time A side - int16_t timeC = -5000; // average time C side - Triggers() = default; - Triggers(uint8_t signals, int8_t chanA, int8_t chanC, int32_t aamplA, int32_t aamplC, int16_t atimeA, int16_t atimeC) - { - triggersignals = signals; - nChanA = chanA; - nChanC = chanC; - amplA = aamplA; - amplC = aamplC; - timeA = atimeA; - timeC = atimeC; - } - bool getOrA() const { return (triggersignals & (1 << bitA)) != 0; } - bool getOrC() const { return (triggersignals & (1 << bitC)) != 0; } - bool getVertex() const { return (triggersignals & (1 << bitVertex)) != 0; } - bool getCen() const { return (triggersignals & (1 << bitCen)) != 0; } - bool getSCen() const { return (triggersignals & (1 << bitSCen)) != 0; } - bool getLaserBit() const { return (triggersignals & (1 << bitLaser)) != 0; } - - void setTriggers(Bool_t isA, Bool_t isC, Bool_t isVrtx, Bool_t isCnt, Bool_t isSCnt, int8_t chanA, int8_t chanC, int32_t aamplA, - int32_t aamplC, int16_t atimeA, int16_t atimeC, Bool_t isLaser = kFALSE) - { - triggersignals = (isA << bitA) | (isC << bitC) | (isVrtx << bitVertex) | (isCnt << bitCen) | (isSCnt << bitSCen) | (isLaser << bitLaser); - nChanA = chanA; - nChanC = chanC; - amplA = aamplA; - amplC = aamplC; - timeA = atimeA; - timeC = atimeC; - } - void cleanTriggers() - { - triggersignals = 0; - nChanA = nChanC = 0; - amplA = amplC = -5000; - timeA = timeC = -5000; - } - bool operator==(Triggers const& other) const - { - return std::tie(triggersignals, nChanA, nChanC, amplA, amplC, timeA, timeC) == - std::tie(other.triggersignals, other.nChanA, other.nChanC, other.amplA, other.amplC, other.timeA, other.timeC); - } - void printLog() const; - ClassDefNV(Triggers, 3); -}; +using Triggers = o2::fit::Triggers; struct DetTrigInput { static constexpr char sChannelNameDPL[] = "TRIGGERINPUT"; @@ -137,7 +79,7 @@ struct Digit { uint16_t getBC() const { return mIntRecord.bc; } Triggers getTriggers() const { return mTriggers; } int getEventID() const { return mEventID; } - o2::InteractionRecord getIntRecord() const { return mIntRecord; }; + const o2::InteractionRecord& getIntRecord() const { return mIntRecord; }; void setIntRecord(const o2::InteractionRecord& intRec) { mIntRecord = intRec; } gsl::span getBunchChannelData(const gsl::span tfdata) const; DetTrigInput makeTrgInput() const { return DetTrigInput{mIntRecord, mTriggers.getOrA(), mTriggers.getOrC(), mTriggers.getVertex(), mTriggers.getCen(), mTriggers.getSCen()}; } @@ -172,6 +114,7 @@ struct TriggersExt { void printLog() const; ClassDefNV(TriggersExt, 2); }; + } // namespace ft0 } // namespace o2 diff --git a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/RecPoints.h b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/RecPoints.h index a88b74962b844..1178cc20a4da0 100644 --- a/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/RecPoints.h +++ b/DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/RecPoints.h @@ -64,7 +64,7 @@ class RecPoints o2::InteractionRecord mIntRecord; // Interaction record (orbit, bc) RecPoints() = default; RecPoints(const std::array& collisiontime, - int first, int ne, o2::InteractionRecord iRec, o2::ft0::Triggers chTrig) + int first, int ne, o2::InteractionRecord iRec, o2::fit::Triggers chTrig) : mCollisionTime(collisiontime) { ref.setFirstEntry(first); @@ -86,8 +86,8 @@ class RecPoints short getVertex() const { return getCollisionTime(Vertex); } void setVertex(short vertex) { mCollisionTime[Vertex] = vertex; } - o2::ft0::Triggers getTrigger() const { return mTriggers; } - void setTriggers(o2::ft0::Triggers trig) { mTriggers = trig; } + o2::fit::Triggers getTrigger() const { return mTriggers; } + void setTriggers(o2::fit::Triggers trig) { mTriggers = trig; } o2::InteractionRecord getInteractionRecord() const { return mIntRecord; }; @@ -101,7 +101,7 @@ class RecPoints sDummyCollissionTime, sDummyCollissionTime, sDummyCollissionTime}; - o2::ft0::Triggers mTriggers; // pattern of triggers in this BC + o2::fit::Triggers mTriggers; // pattern of triggers in this BC ClassDefNV(RecPoints, 3); }; diff --git a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h index fdc0a13059b53..d9e902d8587f4 100644 --- a/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h +++ b/DataFormats/Detectors/FIT/FT0/src/DataFormatsFT0LinkDef.h @@ -17,12 +17,10 @@ #pragma link C++ class o2::ft0::Digit + ; #pragma link C++ class o2::ft0::ChannelData + ; -#pragma link C++ class o2::ft0::Triggers + ; #pragma link C++ class o2::ft0::DetTrigInput + ; #pragma link C++ class o2::ft0::TriggersExt + ; #pragma link C++ class vector < o2::ft0::ChannelData> + ; #pragma link C++ class vector < o2::ft0::Digit> + ; -#pragma link C++ class vector < o2::ft0::Triggers> + ; #pragma link C++ class vector < o2::ft0::DetTrigInput> + ; #pragma link C++ class vector < o2::ft0::TriggersExt> + ; diff --git a/DataFormats/Detectors/FIT/FT0/src/Digit.cxx b/DataFormats/Detectors/FIT/FT0/src/Digit.cxx index 3a5050fd65f18..ec1a12464fedb 100644 --- a/DataFormats/Detectors/FIT/FT0/src/Digit.cxx +++ b/DataFormats/Detectors/FIT/FT0/src/Digit.cxx @@ -18,14 +18,6 @@ using namespace o2::ft0; -void Triggers::printLog() const -{ - LOG(info) << "mTrigger: " << static_cast(triggersignals); - LOG(info) << "nChanA: " << static_cast(nChanA) << " | nChanC: " << static_cast(nChanC); - LOG(info) << "amplA: " << amplA << " | amplC: " << amplC; - LOG(info) << "timeA: " << timeA << " | timeC: " << timeC; -} - gsl::span Digit::getBunchChannelData(const gsl::span tfdata) const { // extract the span of channel data for this bunch from the whole TF data @@ -35,7 +27,7 @@ gsl::span Digit::getBunchChannelData(const gsl::span #include #include @@ -31,65 +32,7 @@ namespace o2 namespace fv0 { class ChannelData; - -struct Triggers { - enum { bitA, - bitAIn = 1, - bitC = 1, // alias of bitAIn - needed to be compatible with common-for-FIT raw reader - bitAOut = 2, - bitVertex = 2, // alias of bitAOut - needed to be compatible with common-for-FIT raw reader - bitCen, - bitSCen, - bitLaser }; - uint8_t triggersignals = 0; // V0 trigger signals - int8_t nChanA = 0; // number of fired channels A side - int8_t nChanC = 0; // TODO: MS: unused in FV0 - int32_t amplA = -5000; // sum amplitude A side - int32_t amplC = -5000; // TODO: MS: unused in FV0 - int16_t timeA = -5000; // average time A side - int16_t timeC = -5000; // TODO: MS: unused in FV0 - Triggers() = default; - Triggers(uint8_t signals, int8_t chanA, int32_t aamplA, int16_t atimeA) - { - triggersignals = signals; - nChanA = chanA; - amplA = aamplA; - timeA = atimeA; - } - bool getOrA() const { return (triggersignals & (1 << bitA)) != 0; } - bool getOrAIn() const { return (triggersignals & (1 << bitAIn)) != 0; } - bool getOrAOut() const { return (triggersignals & (1 << bitAOut)) != 0; } - bool getCen() const { return (triggersignals & (1 << bitCen)) != 0; } - bool getSCen() const { return (triggersignals & (1 << bitSCen)) != 0; } - bool getLaserBit() const { return (triggersignals & (1 << bitLaser)) != 0; } - - // TODO: MS: temporary aliases to keep DigitBlockFIT.h working (treat FV0 as FT0/FDD) - bool getOrC() const { return getOrAIn(); } - bool getVertex() const { return getOrAOut(); } - - void setTriggers(Bool_t isA, Bool_t isAIn, Bool_t isAOut, Bool_t isCnt, Bool_t isSCnt, int8_t chanA, int32_t aamplA, - int16_t atimeA, Bool_t isLaser = kFALSE) - { - triggersignals = (isA << bitA) | (isAIn << bitAIn) | (isAOut << bitAOut) | (isCnt << bitCen) | (isSCnt << bitSCen) | (isLaser << bitLaser); - nChanA = chanA; - amplA = aamplA; - timeA = atimeA; - } - void cleanTriggers() - { - triggersignals = 0; - nChanA = 0; - amplA = -5000; - timeA = -5000; - } - bool operator==(Triggers const& other) const - { - return std::tie(triggersignals, nChanA, amplA, timeA) == - std::tie(other.triggersignals, other.nChanA, other.amplA, other.timeA); - } - void printLog() const; - ClassDefNV(Triggers, 2); -}; +using Triggers = o2::fit::Triggers; struct DetTrigInput { static constexpr char sChannelNameDPL[] = "TRIGGERINPUT"; @@ -114,10 +57,8 @@ struct Digit { static constexpr char sChannelNameDPL[] = "DIGITSBC"; static constexpr char sDigitName[] = "Digit"; static constexpr char sDigitBranchName[] = "FV0DigitBC"; - /// we are going to refer to at most 48 channels, so 6 bits for the number of channels and 26 for the reference - o2::dataformats::RangeRefComp<6> ref; - Triggers mTriggers{}; // pattern of triggers in this BC - + o2::dataformats::RangeReference ref{}; + Triggers mTriggers{}; // pattern of triggers in this BC o2::InteractionRecord mIntRecord{}; // Interaction record (orbit, bc) int mEventID = 0; Digit() = default; @@ -149,7 +90,7 @@ struct Digit { return std::tie(ref, mTriggers, mIntRecord) == std::tie(other.ref, other.mTriggers, other.mIntRecord); } void printLog() const; - ClassDefNV(Digit, 2); + ClassDefNV(Digit, 3); }; // For TCM extended mode (calibration mode), TCMdataExtended digit @@ -165,6 +106,7 @@ struct TriggersExt { void printLog() const; ClassDefNV(TriggersExt, 1); }; + } // namespace fv0 } // namespace o2 diff --git a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/RecPoints.h b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/RecPoints.h index 1b207a29af2d2..c5e0a827de132 100644 --- a/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/RecPoints.h +++ b/DataFormats/Detectors/FIT/FV0/include/DataFormatsFV0/RecPoints.h @@ -55,7 +55,7 @@ class RecPoints TimeSelectedMean }; RecPoints() = default; RecPoints(const std::array& collisiontime, int first, int ne, - o2::InteractionRecord iRec, o2::fv0::Triggers triggers) + o2::InteractionRecord iRec, o2::fit::Triggers triggers) : mCollisionTimePs(collisiontime) { mRef.setFirstEntry(first); @@ -72,7 +72,7 @@ class RecPoints bool isValidTime(TimeTypeIndex type) const { return getCollisionTime(type) < sDummyCollissionTime; } void setCollisionTime(Float_t time, TimeTypeIndex type) { mCollisionTimePs[type] = time; } - o2::fv0::Triggers getTrigger() const { return mTriggers; } + o2::fit::Triggers getTrigger() const { return mTriggers; } o2::InteractionRecord getInteractionRecord() const { return mIntRecord; }; gsl::span getBunchChannelData(const gsl::span tfdata) const; short static constexpr sDummyCollissionTime = 32767; @@ -80,7 +80,7 @@ class RecPoints private: o2::dataformats::RangeReference mRef; o2::InteractionRecord mIntRecord; - o2::fv0::Triggers mTriggers; // pattern of triggers in this BC + o2::fit::Triggers mTriggers; // pattern of triggers in this BC std::array mCollisionTimePs = {sDummyCollissionTime, sDummyCollissionTime, sDummyCollissionTime}; // in picoseconds ClassDefNV(RecPoints, 1); diff --git a/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h b/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h index 8232b272e7d42..73e7548f7d9c8 100644 --- a/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h +++ b/DataFormats/Detectors/FIT/FV0/src/DataFormatsFV0LinkDef.h @@ -21,10 +21,8 @@ #pragma link C++ class o2::fv0::ChannelData + ; #pragma link C++ class o2::fv0::Digit + ; -#pragma link C++ class o2::fv0::Triggers + ; #pragma link C++ class o2::fv0::DetTrigInput + ; #pragma link C++ class std::vector < o2::fv0::ChannelData> + ; -#pragma link C++ class std::vector < o2::fv0::Triggers> + ; #pragma link C++ class std::vector < o2::fv0::DetTrigInput> + ; #pragma link C++ class std::vector < o2::fv0::Digit> + ; diff --git a/DataFormats/Detectors/FIT/FV0/src/Digit.cxx b/DataFormats/Detectors/FIT/FV0/src/Digit.cxx index ac8f186eb8890..9b44508af3023 100644 --- a/DataFormats/Detectors/FIT/FV0/src/Digit.cxx +++ b/DataFormats/Detectors/FIT/FV0/src/Digit.cxx @@ -18,14 +18,6 @@ using namespace o2::fv0; -void Triggers::printLog() const -{ - LOG(info) << "mTrigger: " << static_cast(triggersignals); - LOG(info) << "nChanA: " << static_cast(nChanA); - LOG(info) << "amplA: " << amplA; - LOG(info) << "timeA: " << timeA; -} - gsl::span Digit::getBunchChannelData(const gsl::span tfdata) const { // extract the span of channel data for this bunch from the whole TF data @@ -35,7 +27,7 @@ gsl::span Digit::getBunchChannelData(const gsl::span +#include +#include +#include + +namespace o2 +{ +namespace fit +{ + +class Triggers +{ + public: + enum { bitA = 0, + bitC = 1, // alias of bitAIn (FT0/FDD) + bitAIn = 1, // alias of bitC (FV0) + bitVertex = 2, // alias of bitAOut (FT0/FDD) + bitAOut = 2, // alias of bitVertex (FV0) + bitCen = 3, + bitSCen = 4, + bitLaser = 5, // indicates the laser was triggered in this BC + bitOutputsAreBlocked = 6, // indicates that laser-induced pulses should arrive from detector to FEE in this BC (and trigger outputs are blocked) + bitDataIsValid = 7 }; + static const int16_t DEFAULT_TIME = -5000; // for average of one side (A or C) + static const int16_t DEFAULT_AMP = 0; + static const int16_t DEFAULT_ZERO = 0; + + Triggers() = default; + Triggers(uint8_t signals, int8_t chanA, int8_t chanC, int32_t aamplA, int32_t aamplC, int16_t atimeA, int16_t atimeC) + { + triggersignals = signals; + nChanA = chanA; + nChanC = chanC; + amplA = aamplA; + amplC = aamplC; + timeA = atimeA; + timeC = atimeC; + } + bool getOrA() const { return (triggersignals & (1 << bitA)) != 0; } + bool getOrC() const { return (triggersignals & (1 << bitC)) != 0; } // only used by FT0/FDD (same bit as OrAIn in FV0) + bool getOrAIn() const { return (triggersignals & (1 << bitAIn)) != 0; } // only used by FV0 (same bit as OrC in FT0/FDD) + bool getVertex() const { return (triggersignals & (1 << bitVertex)) != 0; } // only used by FT0/FDD (same bit as OrAOut in FV0 + bool getOrAOut() const { return (triggersignals & (1 << bitAOut)) != 0; } // only used by FV0 (same bit as Vertex in FT0/FDD) + bool getCen() const { return (triggersignals & (1 << bitCen)) != 0; } + bool getSCen() const { return (triggersignals & (1 << bitSCen)) != 0; } + bool getLaser() const { return (triggersignals & (1 << bitLaser)) != 0; } + bool getLaserBit() const { return getLaser(); } // TODO: remove after QC is modified + bool getOutputsAreBlocked() const { return (triggersignals & (1 << bitOutputsAreBlocked)) != 0; } + bool getDataIsValid() const { return (triggersignals & (1 << bitDataIsValid)) != 0; } + + int8_t getTriggersignals() const { return triggersignals; } + int8_t getNChanA() const { return nChanA; } + int8_t getNChanC() const { return nChanC; } + int32_t getAmplA() const { return amplA; } + int32_t getAmplC() const { return amplC; } + int16_t getTimeA() const { return timeA; } + int16_t getTimeC() const { return timeC; } + + void setTriggers(uint8_t trgsig, int8_t chanA, int8_t chanC, int32_t aamplA, int32_t aamplC, int16_t atimeA, int16_t atimeC) + { + triggersignals = trgsig; + nChanA = chanA; + nChanC = chanC; + amplA = aamplA; + amplC = aamplC; + timeA = atimeA; + timeC = atimeC; + } + + void setTriggers(Bool_t isA, Bool_t isC, Bool_t isVrtx, Bool_t isCnt, Bool_t isSCnt, int8_t chanA, int8_t chanC, int32_t aamplA, + int32_t aamplC, int16_t atimeA, int16_t atimeC, Bool_t isLaser, Bool_t isOutputsAreBlocked, Bool_t isDataValid) + { + uint8_t trgsig = (isA << bitA) | (isC << bitC) | (isVrtx << bitVertex) | (isCnt << bitCen) | (isSCnt << bitSCen) | (isLaser << bitLaser) | (isOutputsAreBlocked << bitOutputsAreBlocked) | (isDataValid << bitDataIsValid); + setTriggers(trgsig, chanA, chanC, aamplA, aamplC, atimeA, atimeC); + } + + void cleanTriggers() + { + triggersignals = DEFAULT_ZERO; + nChanA = nChanC = DEFAULT_ZERO; + amplA = amplC = DEFAULT_AMP; + timeA = timeC = DEFAULT_TIME; + } + + bool operator==(Triggers const& other) const + { + return std::tie(triggersignals, nChanA, nChanC, amplA, amplC, timeA, timeC) == + std::tie(other.triggersignals, other.nChanA, other.nChanC, other.amplA, other.amplC, other.timeA, other.timeC); + } + + std::string print() const; + void print(std::ostream&) const; + void printLog() const; + + public: // TODO: change to 'private' after modifying QC to use the setters/getters + uint8_t triggersignals = DEFAULT_ZERO; // FIT trigger signals + int8_t nChanA = DEFAULT_ZERO; // number of fired channels A side + int8_t nChanC = DEFAULT_ZERO; // number of fired channels A side + int32_t amplA = DEFAULT_AMP; // sum amplitude A side + int32_t amplC = DEFAULT_AMP; // sum amplitude C side + int16_t timeA = DEFAULT_TIME; // average time A side (shouldn't be used if nChanA == 0) + int16_t timeC = DEFAULT_TIME; // average time C side (shouldn't be used if nChanC == 0) + + ClassDefNV(Triggers, 4); +}; + +} // namespace fit +} // namespace o2 + +#endif diff --git a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h index 668ef407309bd..e5f33a0e6728e 100644 --- a/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h +++ b/DataFormats/Detectors/FIT/common/src/DataFormatsFITLinkDef.h @@ -20,4 +20,7 @@ #pragma link C++ class o2::fit::EntryFEE + ; #pragma link C++ class vector < o2::fit::EntryFEE> + ; +#pragma link C++ class o2::fit::Triggers + ; +#pragma link C++ class vector < o2::fit::Triggers> + ; + #endif diff --git a/DataFormats/Detectors/FIT/common/src/Triggers.cxx b/DataFormats/Detectors/FIT/common/src/Triggers.cxx new file mode 100644 index 0000000000000..97387eeea64ce --- /dev/null +++ b/DataFormats/Detectors/FIT/common/src/Triggers.cxx @@ -0,0 +1,36 @@ +// Copyright 2019-2020 CERN and copyright holders of ALICE O2. +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. +// All rights not expressly granted are reserved. +// +// This software is distributed under the terms of the GNU General Public +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". +// +// 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 "DataFormatsFIT/Triggers.h" +#include +#include + +using namespace o2::fit; + +std::string Triggers::print() const +{ + std::stringstream ss; + ss << " chA " << nChanA << " chC " << nChanC << " A amp " << amplA << " C amp " << amplC << " time A " << timeA << " time C " << timeC << " signals 0x" << std::hex << int(triggersignals) << std::dec; + return ss.str(); +} + +void Triggers::print(std::ostream& stream) const +{ + stream << print() << std::endl; +} + +void Triggers::printLog() const +{ + LOG(info) << "mTrigger: " << static_cast(triggersignals); + LOG(info) << "nChanA: " << static_cast(nChanA) << " | nChanC: " << static_cast(nChanC); + LOG(info) << "amplA: " << amplA << " | amplC: " << amplC; + LOG(info) << "timeA: " << timeA << " | timeC: " << timeC; +} diff --git a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx index 16e1397375162..f448e305680f2 100644 --- a/Detectors/AOD/src/AODProducerWorkflowSpec.cxx +++ b/Detectors/AOD/src/AODProducerWorkflowSpec.cxx @@ -1275,7 +1275,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) aAmplitudes, aChannels, truncateFloatFraction(fv0RecPoint.getCollisionGlobalMeanTime() * 1E-3, mV0Time), // ps to ns - fv0RecPoint.getTrigger().triggersignals); + fv0RecPoint.getTrigger().getTriggersignals()); } for (auto zdcRecData : zdcBCRecData) { @@ -1430,7 +1430,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) aFDDAmplitudesC, truncateFloatFraction(fddRecPoint.getCollisionTimeA() * 1E-3, mFDDTime), // ps to ns truncateFloatFraction(fddRecPoint.getCollisionTimeC() * 1E-3, mFDDTime), // ps to ns - fddRecPoint.getTrigger().triggersignals); + fddRecPoint.getTrigger().getTriggersignals()); } // filling FT0 table @@ -1472,7 +1472,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc) aChannelsC, truncateFloatFraction(ft0RecPoint.getCollisionTimeA() * 1E-3, mT0Time), // ps to ns truncateFloatFraction(ft0RecPoint.getCollisionTimeC() * 1E-3, mT0Time), // ps to ns - ft0RecPoint.getTrigger().triggersignals); + ft0RecPoint.getTrigger().getTriggersignals()); } if (mUseMC) { diff --git a/Detectors/CTF/test/test_ctf_io_fdd.cxx b/Detectors/CTF/test/test_ctf_io_fdd.cxx index 66ed2da7a0fad..e37564fd2781c 100644 --- a/Detectors/CTF/test/test_ctf_io_fdd.cxx +++ b/Detectors/CTF/test/test_ctf_io_fdd.cxx @@ -28,7 +28,6 @@ BOOST_AUTO_TEST_CASE(CTFTest) { std::vector digits; std::vector channels; - TStopwatch sw; sw.Start(); o2::InteractionRecord ir(0, 0); @@ -37,36 +36,41 @@ BOOST_AUTO_TEST_CASE(CTFTest) ir += 1 + gRandom->Integer(200); uint8_t ich = gRandom->Poisson(4); auto start = channels.size(); - int32_t tMeanA = 0, tMeanC = 0; + int16_t tMeanA = 0, tMeanC = 0; int32_t ampTotA = 0, ampTotC = 0; - Triggers trig; - trig.triggersignals = gRandom->Integer(128); + int8_t nChanA = 0, nChanC = 0; while (ich < Nchannels) { int16_t t = -2048 + gRandom->Integer(2048 * 2); uint16_t q = gRandom->Integer(4096); - uint16_t feb = gRandom->Rndm() > 0.5 ? 0 : 1; + uint8_t feb = gRandom->Rndm() > 0.5 ? 0 : 1; channels.emplace_back(ich, t, q, feb); - if (ich > 7) { - trig.nChanA++; + nChanA++; ampTotA += q; tMeanA += t; } else { - trig.nChanC++; + nChanC++; ampTotC += q; tMeanC += t; } ich += 1 + gRandom->Poisson(4); } - if (trig.nChanA) { - trig.timeA = tMeanA / trig.nChanA; - trig.amplA = ampTotA * 0.125; + if (nChanA) { + tMeanA /= nChanA; + ampTotA *= 0.125; + } else { + tMeanA = o2::fit::Triggers::DEFAULT_TIME; + ampTotA = o2::fit::Triggers::DEFAULT_AMP; } - if (trig.nChanC) { - trig.timeC = tMeanC / trig.nChanC; - trig.amplC = ampTotC * 0.125; // sum/8 + if (nChanC) { + tMeanC /= nChanC; + ampTotC *= 0.125; // sum/8 + } else { + tMeanC = o2::fit::Triggers::DEFAULT_TIME; + ampTotC = o2::fit::Triggers::DEFAULT_AMP; } - + Triggers trig; + trig.setTriggers(gRandom->Integer(128), nChanA, nChanC, ampTotA, ampTotC, tMeanA, tMeanC); auto end = channels.size(); digits.emplace_back(start, end - start, ir, trig); } @@ -126,15 +130,18 @@ BOOST_AUTO_TEST_CASE(CTFTest) for (int i = digits.size(); i--;) { const auto& dor = digits[i]; const auto& ddc = digitsD[i]; + LOG(debug) << " dor " << dor.mTriggers.print(); + LOG(debug) << " ddc " << ddc.mTriggers.print(); + BOOST_CHECK(dor.mIntRecord == ddc.mIntRecord); BOOST_CHECK(dor.ref == ddc.ref); - BOOST_CHECK(dor.mTriggers.nChanA == ddc.mTriggers.nChanA); - BOOST_CHECK(dor.mTriggers.nChanC == ddc.mTriggers.nChanC); - BOOST_CHECK(dor.mTriggers.amplA == ddc.mTriggers.amplA); - BOOST_CHECK(dor.mTriggers.amplC == ddc.mTriggers.amplC); - BOOST_CHECK(dor.mTriggers.timeA == ddc.mTriggers.timeA); - BOOST_CHECK(dor.mTriggers.timeC == ddc.mTriggers.timeC); - BOOST_CHECK(dor.mTriggers.triggersignals == ddc.mTriggers.triggersignals); + BOOST_CHECK(dor.mTriggers.getNChanA() == ddc.mTriggers.getNChanA()); + BOOST_CHECK(dor.mTriggers.getNChanC() == ddc.mTriggers.getNChanC()); + BOOST_CHECK(dor.mTriggers.getAmplA() == ddc.mTriggers.getAmplA()); + BOOST_CHECK(dor.mTriggers.getAmplC() == ddc.mTriggers.getAmplC()); + BOOST_CHECK(dor.mTriggers.getTimeA() == ddc.mTriggers.getTimeA()); + BOOST_CHECK(dor.mTriggers.getTimeC() == ddc.mTriggers.getTimeC()); + BOOST_CHECK(dor.mTriggers.getTriggersignals() == ddc.mTriggers.getTriggersignals()); } for (int i = channels.size(); i--;) { const auto& cor = channels[i]; diff --git a/Detectors/CTF/test/test_ctf_io_ft0.cxx b/Detectors/CTF/test/test_ctf_io_ft0.cxx index bc51c4b19de21..ea9a7245ab6ea 100644 --- a/Detectors/CTF/test/test_ctf_io_ft0.cxx +++ b/Detectors/CTF/test/test_ctf_io_ft0.cxx @@ -38,11 +38,10 @@ BOOST_AUTO_TEST_CASE(CTFTest) ir += 1 + gRandom->Integer(200); uint8_t ich = gRandom->Poisson(10); auto start = channels.size(); - int32_t tMeanA = 0, tMeanC = 0; + int16_t tMeanA = 0, tMeanC = 0; int32_t ampTotA = 0, ampTotC = 0; + int8_t nChanA = 0, nChanC = 0; uint8_t eventFlag = 10; - Triggers trig; - trig.triggersignals = gRandom->Integer(128); while (ich < MAXChan) { int16_t t = -2048 + gRandom->Integer(2048 * 2); uint16_t q = gRandom->Integer(4096); @@ -50,25 +49,33 @@ BOOST_AUTO_TEST_CASE(CTFTest) channels.emplace_back(ich, t, q, chain); if (std::abs(t) < trg_gate) { if (ich < 4 * uint8_t(Geometry::NCellsA)) { - trig.nChanA++; + nChanA++; ampTotA += q; tMeanA += t; } else { - trig.nChanC++; + nChanC++; ampTotC += q; tMeanC += t; } } ich += 1 + gRandom->Poisson(10); } - if (trig.nChanA) { - trig.timeA = tMeanA / trig.nChanA; - trig.amplA = ampTotA * 0.125; + if (nChanA) { + tMeanA /= nChanA; + ampTotA *= 0.125; + } else { + tMeanA = o2::fit::Triggers::DEFAULT_TIME; + ampTotA = o2::fit::Triggers::DEFAULT_AMP; } - if (trig.nChanC) { - trig.timeC = tMeanC / trig.nChanC; - trig.amplC = ampTotC * 0.125; // sum/8 + if (nChanC) { + tMeanC /= nChanC; + ampTotC *= 0.125; // sum/8 + } else { + tMeanC = o2::fit::Triggers::DEFAULT_TIME; + ampTotC = o2::fit::Triggers::DEFAULT_AMP; } + Triggers trig; + trig.setTriggers(gRandom->Integer(128), nChanA, nChanC, ampTotA, ampTotC, tMeanA, tMeanC); auto end = channels.size(); digits.emplace_back(start, end - start, ir, trig, idig); digits[idig].setEventStatus(eventFlag); @@ -124,22 +131,22 @@ BOOST_AUTO_TEST_CASE(CTFTest) BOOST_CHECK(digitsD.size() == digits.size()); BOOST_CHECK(channelsD.size() == channels.size()); - LOG(debug) << " BOOST_CHECK digitsD.size() " << digitsD.size() << " digits.size() " << digits.size() << " BOOST_CHECK(channelsD.size() " << channelsD.size() << " channels.size()) " << channels.size(); + LOG(info) << " BOOST_CHECK digitsD.size() " << digitsD.size() << " digits.size() " << digits.size() << " BOOST_CHECK(channelsD.size() " << channelsD.size() << " channels.size()) " << channels.size(); for (int i = digits.size(); i--;) { const auto& dor = digits[i]; const auto& ddc = digitsD[i]; - LOG(debug) << " dor " << dor.mTriggers.nChanA << " " << dor.mTriggers.nChanC << " " << dor.mTriggers.amplA << " " << dor.mTriggers.amplC; - LOG(debug) << " ddc " << ddc.mTriggers.nChanA << " " << ddc.mTriggers.nChanC << " " << ddc.mTriggers.amplA << " " << ddc.mTriggers.amplC; + LOG(debug) << " dor " << dor.mTriggers.print(); + LOG(debug) << " ddc " << ddc.mTriggers.print(); BOOST_CHECK(dor.mIntRecord == ddc.mIntRecord); - BOOST_CHECK(dor.mTriggers.nChanA == ddc.mTriggers.nChanA); - BOOST_CHECK(dor.mTriggers.nChanC == ddc.mTriggers.nChanC); - BOOST_CHECK(dor.mTriggers.amplA == ddc.mTriggers.amplA); - BOOST_CHECK(dor.mTriggers.amplC == ddc.mTriggers.amplC); - BOOST_CHECK(dor.mTriggers.timeA == ddc.mTriggers.timeA); - BOOST_CHECK(dor.mTriggers.timeC == ddc.mTriggers.timeC); - BOOST_CHECK(dor.mTriggers.triggersignals == ddc.mTriggers.triggersignals); + BOOST_CHECK(dor.mTriggers.getNChanA() == ddc.mTriggers.getNChanA()); + BOOST_CHECK(dor.mTriggers.getNChanC() == ddc.mTriggers.getNChanC()); + BOOST_CHECK(dor.mTriggers.getAmplA() == ddc.mTriggers.getAmplA()); + BOOST_CHECK(dor.mTriggers.getAmplC() == ddc.mTriggers.getAmplC()); + BOOST_CHECK(dor.mTriggers.getTimeA() == ddc.mTriggers.getTimeA()); + BOOST_CHECK(dor.mTriggers.getTimeC() == ddc.mTriggers.getTimeC()); + BOOST_CHECK(dor.mTriggers.getTriggersignals() == ddc.mTriggers.getTriggersignals()); } for (int i = channels.size(); i--;) { const auto& cor = channels[i]; diff --git a/Detectors/CTF/test/test_ctf_io_fv0.cxx b/Detectors/CTF/test/test_ctf_io_fv0.cxx index b10aafc3d23a2..3521e9d449b1b 100644 --- a/Detectors/CTF/test/test_ctf_io_fv0.cxx +++ b/Detectors/CTF/test/test_ctf_io_fv0.cxx @@ -28,8 +28,6 @@ BOOST_AUTO_TEST_CASE(CTFTest) { std::vector digits; std::vector channels; - Triggers trigger; // TODO: Actual values are not set - TStopwatch sw; sw.Start(); o2::InteractionRecord ir(0, 0); @@ -39,6 +37,9 @@ BOOST_AUTO_TEST_CASE(CTFTest) ir += 1 + gRandom->Integer(200); uint8_t ich = gRandom->Poisson(10); auto start = channels.size(); + int16_t tMeanA = 0, tMeanC = 0; // TODO: Actual values are not set + int32_t ampTotA = 0, ampTotC = 0; + int8_t nChanA = 0, nChanC = 0; while (ich < MAXChan) { int16_t t = -2048 + gRandom->Integer(2048 * 2); uint16_t q = gRandom->Integer(4096); @@ -46,9 +47,10 @@ BOOST_AUTO_TEST_CASE(CTFTest) channels.emplace_back(ich, t, q, chain); ich += 1 + gRandom->Poisson(10); } + Triggers trig; // TODO: Actual values are not set + trig.setTriggers(gRandom->Integer(128), nChanA, nChanC, ampTotA, ampTotC, tMeanA, tMeanC); auto end = channels.size(); - trigger.triggersignals = gRandom->Integer(255); - digits.emplace_back(start, end - start, ir, trigger, idig); + digits.emplace_back(start, end - start, ir, trig, idig); } LOG(info) << "Generated " << channels.size() << " channels in " << digits.size() << " digits " << sw.CpuTime() << " s"; @@ -104,21 +106,21 @@ BOOST_AUTO_TEST_CASE(CTFTest) LOG(info) << " BOOST_CHECK digitsD.size() " << digitsD.size() << " digits.size() " << digits.size() << " BOOST_CHECK(channelsD.size() " << channelsD.size() << " channels.size()) " << channels.size(); for (int i = digits.size(); i--;) { - // const auto& dor = digits[i]; - // const auto& ddc = digitsD[i]; - BOOST_CHECK(digits[i] == digitsD[i]); - // BOOST_CHECK(dor.ir == ddc.ir); - // BOOST_CHECK(dor.ref == ddc.ref); + const auto& dor = digits[i]; + const auto& ddc = digitsD[i]; + LOG(debug) << " dor " << dor.mTriggers.print(); + LOG(debug) << " ddc " << ddc.mTriggers.print(); + + BOOST_CHECK(dor.mIntRecord == ddc.mIntRecord); // BOOST_CHECK(dor.mTriggers == ddc.mTriggers); } for (int i = channels.size(); i--;) { - /* const auto& cor = channels[i]; const auto& cdc = channelsD[i]; BOOST_CHECK(cor.ChId == cdc.ChId); + // BOOST_CHECK(cor.ChainQTC == cdc.ChainQTC); BOOST_CHECK(cor.CFDTime == cdc.CFDTime); BOOST_CHECK(cor.QTCAmpl == cdc.QTCAmpl); - */ - BOOST_CHECK(channels[i] == channelsD[i]); + // BOOST_CHECK(channels[i] == channelsD[i]); } } diff --git a/Detectors/FIT/FDD/reconstruction/include/FDDReconstruction/CTFCoder.h b/Detectors/FIT/FDD/reconstruction/include/FDDReconstruction/CTFCoder.h index 96ca314786ea6..3780b9100bb63 100644 --- a/Detectors/FIT/FDD/reconstruction/include/FDDReconstruction/CTFCoder.h +++ b/Detectors/FIT/FDD/reconstruction/include/FDDReconstruction/CTFCoder.h @@ -154,36 +154,42 @@ void CTFCoder::decompress(const CompressedDigits& cd, VDIG& digitVec, VCHAN& cha } else { ir.bc += cd.bcInc[idig]; } - Triggers trig; - trig.triggersignals = cd.trigger[idig]; - firstEntry = channelVec.size(); uint8_t chID = 0; - int amplA = 0, amplC = 0, timeA = 0, timeC = 0; + int8_t nChanA = 0, nChanC = 0; + int32_t amplA = 0, amplC = 0; + int16_t timeA = 0, timeC = 0; for (uint8_t ic = 0; ic < cd.nChan[idig]; ic++) { auto icc = channelVec.size(); const auto& chan = channelVec.emplace_back((chID += cd.idChan[icc]), cd.time[icc], cd.charge[icc], cd.feeBits[icc]); - // // rebuild digit if (chan.mPMNumber > 7) { // A side amplA += chan.mChargeADC; timeA += chan.mTime; - trig.nChanA++; + nChanA++; } else { amplC += chan.mChargeADC; timeC += chan.mTime; - trig.nChanC++; + nChanC++; } } - if (trig.nChanA) { - trig.timeA = timeA / trig.nChanA; - trig.amplA = amplA * 0.125; + if (nChanA) { + timeA /= nChanA; + amplA *= 0.125; + } else { + timeA = Triggers::DEFAULT_TIME; + amplA = Triggers::DEFAULT_AMP; } - if (trig.nChanC) { - trig.timeC = timeC / trig.nChanC; - trig.amplC = amplC * 0.125; + if (nChanC) { + timeC /= nChanC; + amplC *= 0.125; + } else { + timeC = Triggers::DEFAULT_TIME; + amplC = Triggers::DEFAULT_AMP; } + Triggers trig; + trig.setTriggers(cd.trigger[idig], nChanA, nChanC, amplA, amplC, timeA, timeC); digitVec.emplace_back(firstEntry, cd.nChan[idig], ir, trig); } } diff --git a/Detectors/FIT/FDD/reconstruction/src/CTFCoder.cxx b/Detectors/FIT/FDD/reconstruction/src/CTFCoder.cxx index 53b7197d6cdc4..922a55a02a701 100644 --- a/Detectors/FIT/FDD/reconstruction/src/CTFCoder.cxx +++ b/Detectors/FIT/FDD/reconstruction/src/CTFCoder.cxx @@ -69,7 +69,7 @@ void CTFCoder::compress(CompressedDigits& cd, const gsl::span& digi const auto chanels = digit.getBunchChannelData(channelVec); // we assume the channels are sorted // fill trigger info - cd.trigger[idig] = digit.mTriggers.triggersignals; + cd.trigger[idig] = digit.mTriggers.getTriggersignals(); if (prevOrbit == digit.mIntRecord.orbit) { cd.bcInc[idig] = digit.mIntRecord.bc - prevBC; cd.orbitInc[idig] = 0; diff --git a/Detectors/FIT/FT0/reconstruction/include/FT0Reconstruction/CTFCoder.h b/Detectors/FIT/FT0/reconstruction/include/FT0Reconstruction/CTFCoder.h index 5257b13fb2dc9..fe29dc02f0e9f 100644 --- a/Detectors/FIT/FT0/reconstruction/include/FT0Reconstruction/CTFCoder.h +++ b/Detectors/FIT/FT0/reconstruction/include/FT0Reconstruction/CTFCoder.h @@ -155,14 +155,13 @@ void CTFCoder::decompress(const CompressedDigits& cd, VDIG& digitVec, VCHAN& cha } else { ir.bc += cd.bcInc[idig]; } - Triggers trig; - trig.triggersignals = cd.trigger[idig]; const auto& params = FT0DigParam::Instance(); int triggerGate = params.mTime_trg_gate; firstEntry = channelVec.size(); uint8_t chID = 0; - int amplA = 0, amplC = 0, timeA = 0, timeC = 0; - + int8_t nChanA = 0, nChanC = 0; + int32_t amplA = 0, amplC = 0; + int16_t timeA = 0, timeC = 0; for (uint8_t ic = 0; ic < cd.nChan[idig]; ic++) { auto icc = channelVec.size(); const auto& chan = channelVec.emplace_back((chID += cd.idChan[icc]), cd.cfdTime[icc], cd.qtcAmpl[icc], cd.qtcChain[icc]); @@ -170,23 +169,30 @@ void CTFCoder::decompress(const CompressedDigits& cd, VDIG& digitVec, VCHAN& cha if (chan.ChId < 4 * uint8_t(Geometry::NCellsA)) { // A side amplA += chan.QTCAmpl; timeA += chan.CFDTime; - trig.nChanA++; - + nChanA++; } else { amplC += chan.QTCAmpl; timeC += chan.CFDTime; - trig.nChanC++; + nChanC++; } } } - if (trig.nChanA) { - trig.timeA = timeA / trig.nChanA; - trig.amplA = amplA / 8; + if (nChanA) { + timeA /= nChanA; + amplA *= 0.125; + } else { + timeA = Triggers::DEFAULT_TIME; + amplA = Triggers::DEFAULT_AMP; } - if (trig.nChanC) { - trig.timeC = timeC / trig.nChanC; - trig.amplC = amplC / 8; + if (nChanC) { + timeC /= nChanC; + amplC *= 0.125; + } else { + timeC = Triggers::DEFAULT_TIME; + amplC = Triggers::DEFAULT_AMP; } + Triggers trig; + trig.setTriggers(cd.trigger[idig], nChanA, nChanC, amplA, amplC, timeA, timeC); auto& d = digitVec.emplace_back(firstEntry, cd.nChan[idig], ir, trig, idig); d.setEventStatus(cd.eventStatus[idig]); } diff --git a/Detectors/FIT/FT0/reconstruction/include/FT0Reconstruction/InteractionTag.h b/Detectors/FIT/FT0/reconstruction/include/FT0Reconstruction/InteractionTag.h index 2a41d980c5749..be4b0ee032c20 100644 --- a/Detectors/FIT/FT0/reconstruction/include/FT0Reconstruction/InteractionTag.h +++ b/Detectors/FIT/FT0/reconstruction/include/FT0Reconstruction/InteractionTag.h @@ -30,7 +30,7 @@ struct InteractionTag : public o2::conf::ConfigurableParamHelper bool isSelected(const RecPoints& rp) const { - return rp.isValidTime(RecPoints::TimeMean) && (rp.getTrigger().amplA + rp.getTrigger().amplC) > minAmplitudeAC; + return rp.isValidTime(RecPoints::TimeMean) && (rp.getTrigger().getAmplA() + rp.getTrigger().getAmplC()) > minAmplitudeAC; } O2ParamDef(InteractionTag, "ft0tag"); diff --git a/Detectors/FIT/FT0/reconstruction/src/CTFCoder.cxx b/Detectors/FIT/FT0/reconstruction/src/CTFCoder.cxx index ffaea1d160175..9f224afa2caab 100644 --- a/Detectors/FIT/FT0/reconstruction/src/CTFCoder.cxx +++ b/Detectors/FIT/FT0/reconstruction/src/CTFCoder.cxx @@ -72,7 +72,7 @@ void CTFCoder::compress(CompressedDigits& cd, const gsl::span& digi const auto chanels = digit.getBunchChannelData(channelVec); // we assume the channels are sorted // fill trigger info - cd.trigger[idig] = digit.getTriggers().triggersignals; + cd.trigger[idig] = digit.getTriggers().getTriggersignals(); cd.eventStatus[idig] = digit.getEventStatusWord(); if (prevOrbit == digit.getOrbit()) { cd.bcInc[idig] = digit.getBC() - prevBC; diff --git a/Detectors/FIT/FT0/simulation/src/Digitizer.cxx b/Detectors/FIT/FT0/simulation/src/Digitizer.cxx index 85d1043d504cb..693918a226750 100644 --- a/Detectors/FIT/FT0/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/FT0/simulation/src/Digitizer.cxx @@ -304,9 +304,10 @@ void Digitizer::storeBC(BCCache& bc, isVertex = is_A && is_C && (vertex_time > -params.mTime_trg_gate && vertex_time < params.mTime_trg_gate); LOG(debug) << " A " << is_A << " timeA " << timeA << " mean_time_A " << mean_time_A << " n_hit_A " << n_hit_A << " C " << is_C << " timeC " << timeC << " mean_time_C " << mean_time_C << " n_hit_C " << n_hit_C << " vertex_time " << vertex_time; Triggers triggers; + const bool unusedBitsInSim = false; // bits related to laser and data validity if (nStored > 0) { triggers.setTriggers(is_A, is_C, isVertex, is_Central, is_SemiCentral, int8_t(n_hit_A), int8_t(n_hit_C), - amplA, amplC, timeA, timeC); + amplA, amplC, timeA, timeC, unusedBitsInSim, unusedBitsInSim, unusedBitsInSim); digitsBC.emplace_back(first, nStored, firstBCinDeque, triggers, mEventID - 1); digitsTrig.emplace_back(firstBCinDeque, is_A, is_C, isVertex, is_Central, is_SemiCentral); size_t const nBC = digitsBC.size(); @@ -317,9 +318,9 @@ void Digitizer::storeBC(BCCache& bc, // Debug output ------------------------------------------------------------- LOG(info) << "Event ID: " << mEventID << ", bc " << firstBCinDeque.bc << ", N hit " << bc.hits.size(); - LOG(info) << "N hit A: " << int(triggers.nChanA) << " N hit C: " << int(triggers.nChanC) << " summ ampl A: " << int(triggers.amplA) - << " summ ampl C: " << int(triggers.amplC) << " mean time A: " << triggers.timeA - << " mean time C: " << triggers.timeC << " nStored " << nStored; + LOG(info) << "N hit A: " << int(triggers.getNChanA()) << " N hit C: " << int(triggers.getNChanC()) << " summ ampl A: " << int(triggers.getAmplA()) + << " summ ampl C: " << int(triggers.getAmplC()) << " mean time A: " << triggers.getTimeA() + << " mean time C: " << triggers.getTimeC() << " nStored " << nStored; LOG(info) << "IS A " << triggers.getOrA() << " IsC " << triggers.getOrC() << " vertex " << triggers.getVertex() << " is Central " << triggers.getCen() << " is SemiCentral " << triggers.getSCen(); } diff --git a/Detectors/FIT/FV0/reconstruction/include/FV0Reconstruction/CTFCoder.h b/Detectors/FIT/FV0/reconstruction/include/FV0Reconstruction/CTFCoder.h index 1eb574aa30e76..4b802825622bf 100644 --- a/Detectors/FIT/FV0/reconstruction/include/FV0Reconstruction/CTFCoder.h +++ b/Detectors/FIT/FV0/reconstruction/include/FV0Reconstruction/CTFCoder.h @@ -155,16 +155,31 @@ void CTFCoder::decompress(const CompressedDigits& cd, VDIG& digitVec, VCHAN& cha } else { ir.bc += cd.bcInc[idig]; } - + int triggerGate = 153; // TODO: Add to FV0DgiParam (following FT0) firstEntry = channelVec.size(); uint8_t chID = 0; + int8_t nChanA = 0, nChanC = 0; + int32_t amplA = 0, amplC = Triggers::DEFAULT_AMP; + int16_t timeA = 0, timeC = Triggers::DEFAULT_TIME; for (uint8_t ic = 0; ic < cd.nChan[idig]; ic++) { auto icc = channelVec.size(); const auto& chan = channelVec.emplace_back((chID += cd.idChan[icc]), cd.time[icc], cd.charge[icc], -1); // TODO: MS: modify the CTF format and fill the chain correctly, not with -1 + if (std::abs(chan.CFDTime) < triggerGate) { + amplA += chan.QTCAmpl; + timeA += chan.CFDTime; + nChanA++; + } + } + if (nChanA) { + timeA /= nChanA; + amplA *= 0.125; + } else { + timeA = Triggers::DEFAULT_TIME; + amplA = Triggers::DEFAULT_AMP; } - Triggers triggers; - triggers.triggersignals = cd.trigger[idig]; - digitVec.emplace_back(firstEntry, cd.nChan[idig], ir, triggers, idig); + Triggers trig; + trig.setTriggers(cd.trigger[idig], nChanA, nChanC, amplA, amplC, timeA, timeC); + digitVec.emplace_back(firstEntry, cd.nChan[idig], ir, trig, idig); } } diff --git a/Detectors/FIT/FV0/reconstruction/src/CTFCoder.cxx b/Detectors/FIT/FV0/reconstruction/src/CTFCoder.cxx index 2b8fa0b3c33cd..32bb1df6c2f20 100644 --- a/Detectors/FIT/FV0/reconstruction/src/CTFCoder.cxx +++ b/Detectors/FIT/FV0/reconstruction/src/CTFCoder.cxx @@ -68,7 +68,7 @@ void CTFCoder::compress(CompressedDigits& cd, const gsl::span& digi const auto chanels = digit.getBunchChannelData(channelVec); // we assume the channels are sorted // fill trigger info - cd.trigger[idig] = digit.getTriggers().triggersignals; + cd.trigger[idig] = digit.getTriggers().getTriggersignals(); if (prevOrbit == digit.mIntRecord.orbit) { cd.bcInc[idig] = digit.mIntRecord.bc - prevBC; cd.orbitInc[idig] = 0; diff --git a/Detectors/FIT/FV0/simulation/src/Digitizer.cxx b/Detectors/FIT/FV0/simulation/src/Digitizer.cxx index 503e6021cbb74..dcb489f2a72d7 100644 --- a/Detectors/FIT/FV0/simulation/src/Digitizer.cxx +++ b/Detectors/FIT/FV0/simulation/src/Digitizer.cxx @@ -10,6 +10,7 @@ // or submit itself to any jurisdiction. #include +#include #include #include "FV0Simulation/Digitizer.h" #include "FV0Simulation/FV0DigParam.h" @@ -226,7 +227,7 @@ void Digitizer::storeBC(const BCCache& bc, { size_t const nBC = digitsBC.size(); // save before digitsBC is being modified size_t const first = digitsCh.size(); // save before digitsCh is being modified - size_t nFiredCells = 0; + int8_t nFiredCells = 0; double totalChargeAllRing = 0; double avgTime = 0; double nSignalInner = 0; @@ -285,7 +286,10 @@ void Digitizer::storeBC(const BCCache& bc, isSCen = totalChargeAllRing > FV0DigParam::Instance().adcChargeSCenThr; Triggers triggers; - triggers.setTriggers(isA, isAIn, isAOut, isCen, isSCen, nFiredCells, totalChargeAllRing, avgTime); + const int unused = 0; + const bool unusedBitsInSim = false; // bits related to laser and data validity + triggers.setTriggers(isA, isAIn, isAOut, isCen, isSCen, nFiredCells, (int8_t)unused, + (int32_t)std::round(totalChargeAllRing), (int32_t)unused, (int16_t)std::round(avgTime), (int16_t)unused, unusedBitsInSim, unusedBitsInSim, unusedBitsInSim); digitsBC.emplace_back(first, nFiredCells, bc, triggers, mEventId - 1); digitsTrig.emplace_back(bc, isA, isAIn, isAOut, isCen, isSCen); for (auto const& lbl : bc.labels) { diff --git a/Detectors/FIT/raw/include/FITRaw/DigitBlockFIT.h b/Detectors/FIT/raw/include/FITRaw/DigitBlockFIT.h index b32a260d450fa..20c628ad17dcd 100644 --- a/Detectors/FIT/raw/include/FITRaw/DigitBlockFIT.h +++ b/Detectors/FIT/raw/include/FITRaw/DigitBlockFIT.h @@ -36,17 +36,9 @@ namespace fit //Temporary helper namespace DigitBlockFIThelper { -template -struct IsFV0; -//FV0 Digit recognition -template -struct IsFV0().mIntRecord), o2::InteractionRecord>::value>> : std::false_type { -}; -template -struct IsFV0().ir), o2::InteractionRecord>::value>> : std::true_type { -}; -//Temporary, PM module convertation -//FT0 + +// Temporary, PM module conversion +// FT0 & FV0 template auto ConvertChData2EventData(const ChannelDataType& chData, PMDataType& pmData, int channelID) -> std::enable_if_t().QTCAmpl), int16_t>::value> { @@ -55,15 +47,7 @@ auto ConvertChData2EventData(const ChannelDataType& chData, PMDataType& pmData, pmData.time = chData.CFDTime; pmData.charge = chData.QTCAmpl; } -//FV0 -template -auto ConvertChData2EventData(const ChannelDataType& chData, PMDataType& pmData, int channelID) -> std::enable_if_t().chargeAdc), Short_t>::value> -{ - pmData.channelID = channelID; - pmData.time = chData.time; - pmData.charge = chData.chargeAdc; -} -//FDD +// FDD template auto ConvertChData2EventData(const ChannelDataType& chData, PMDataType& pmData, int channelID) -> std::enable_if_t().mChargeADC), int16_t>::value> { @@ -72,114 +56,52 @@ auto ConvertChData2EventData(const ChannelDataType& chData, PMDataType& pmData, pmData.time = chData.mTime; pmData.charge = chData.mChargeADC; } -//Temporary, TCM module convertation -//FT0 and FDD + +// Temporary, TCM module conversion +// FT0, FV0 and FDD template -auto ConvertDigit2TCMData(const DigitType& digit, TCMDataType& tcmData) -> std::enable_if_t::value> +auto ConvertDigit2TCMData(const DigitType& digit, TCMDataType& tcmData) { tcmData.orA = digit.mTriggers.getOrA(); tcmData.orC = digit.mTriggers.getOrC(); tcmData.sCen = digit.mTriggers.getSCen(); tcmData.cen = digit.mTriggers.getCen(); tcmData.vertex = digit.mTriggers.getVertex(); - tcmData.laser = bool(digit.mTriggers.triggersignals & (1 << 5)); - tcmData.outputsAreBlocked = bool(digit.mTriggers.triggersignals & (1 << 6)); - tcmData.dataIsValid = bool(digit.mTriggers.triggersignals & (1 << 7)); - tcmData.nChanA = digit.mTriggers.nChanA; - tcmData.nChanC = digit.mTriggers.nChanC; + tcmData.laser = digit.mTriggers.getLaser(); + tcmData.outputsAreBlocked = digit.mTriggers.getOutputsAreBlocked(); + tcmData.dataIsValid = digit.mTriggers.getDataIsValid(); + tcmData.nChanA = digit.mTriggers.getNChanA(); + tcmData.nChanC = digit.mTriggers.getNChanC(); const int64_t thresholdSignedInt17bit = 65535; //pow(2,17)/2-1 - if (digit.mTriggers.amplA > thresholdSignedInt17bit) { + if (digit.mTriggers.getAmplA() > thresholdSignedInt17bit) { tcmData.amplA = thresholdSignedInt17bit; } else { - tcmData.amplA = digit.mTriggers.amplA; + tcmData.amplA = digit.mTriggers.getAmplA(); } - if (digit.mTriggers.amplC > thresholdSignedInt17bit) { + if (digit.mTriggers.getAmplC() > thresholdSignedInt17bit) { tcmData.amplC = thresholdSignedInt17bit; } else { - tcmData.amplC = digit.mTriggers.amplC; + tcmData.amplC = digit.mTriggers.getAmplC(); } - tcmData.timeA = digit.mTriggers.timeA; - tcmData.timeC = digit.mTriggers.timeC; -} -//FV0 -template -auto ConvertDigit2TCMData(const DigitType& digit, TCMDataType& tcmData) -> std::enable_if_t::value> -{ - tcmData.orA = bool(digit.mTriggers.triggerSignals & (1 << 0)); - tcmData.orC = bool(digit.mTriggers.triggerSignals & (1 << 1)); - tcmData.sCen = bool(digit.mTriggers.triggerSignals & (1 << 2)); - tcmData.cen = bool(digit.mTriggers.triggerSignals & (1 << 3)); - tcmData.vertex = bool(digit.mTriggers.triggerSignals & (1 << 4)); - tcmData.laser = bool(digit.mTriggers.triggerSignals & (1 << 5)); - tcmData.outputsAreBlocked = bool(digit.mTriggers.triggerSignals & (1 << 6)); - tcmData.dataIsValid = bool(digit.mTriggers.triggerSignals & (1 << 7)); - tcmData.nChanA = digit.mTriggers.nChanA; - //tcmData.nChanC = digit.mTriggers.nChanC; - tcmData.nChanC = 0; - tcmData.amplA = digit.mTriggers.amplA; - //tcmdata.amplC = digit.mTriggers.amplA; - tcmData.amplC = 0; - //tcmData.timeA = digit.mTriggers.timeA - //tcmData.timeC = digit.mTriggers.timeC; - tcmData.timeA = 0; - tcmData.timeC = 0; -} -//Digit to raw helper functions, temporary -//TCM to Digit convertation -//FT0 and FDD -template -auto ConvertTCMData2Digit(DigitType& digit, const TCMDataType& tcmData) -> std::enable_if_t::value> -{ - using TriggerType = decltype(digit.mTriggers); - auto& trg = digit.mTriggers; - trg.triggersignals = ((bool)tcmData.orA << TriggerType::bitA) | - ((bool)tcmData.orC << TriggerType::bitC) | - ((bool)tcmData.vertex << TriggerType::bitVertex) | - ((bool)tcmData.cen << TriggerType::bitCen) | - ((bool)tcmData.sCen << TriggerType::bitSCen) | - ((bool)tcmData.laser << 5) | - ((bool)tcmData.outputsAreBlocked << 6) | - ((bool)tcmData.dataIsValid << 7); - trg.nChanA = (int8_t)tcmData.nChanA; - trg.nChanC = (int8_t)tcmData.nChanC; - trg.amplA = (int32_t)tcmData.amplA; - trg.amplC = (int32_t)tcmData.amplC; - trg.timeA = (int16_t)tcmData.timeA; - trg.timeC = (int16_t)tcmData.timeC; + tcmData.timeA = digit.mTriggers.getTimeA(); + tcmData.timeC = digit.mTriggers.getTimeC(); } -//FV0 + +// Digit to raw helper functions, temporary +// TCM to Digit convertation +// FT0, FV0 and FDD template -auto ConvertTCMData2Digit(DigitType& digit, const TCMDataType& tcmData) -> std::enable_if_t::value> +auto ConvertTCMData2Digit(DigitType& digit, const TCMDataType& tcmData) { using TriggerType = decltype(digit.mTriggers); auto& trg = digit.mTriggers; - //Taken from FT0 - /* - trg.triggersignals = ((bool)tcmData.orA << TriggerType::bitA) | - ((bool)tcmData.orC << TriggerType::bitC) | - ((bool)tcmData.vertex << TriggerType::bitVertex) | - ((bool)tcmData.cen << TriggerType::bitCen) | - ((bool)tcmData.sCen << TriggerType::bitSCen) | - ((bool)tcmData.laser << TriggerType::bitLaser); - */ - //Temporary - trg.triggerSignals = ((bool)tcmData.orA << 0) | - ((bool)tcmData.orC << 1) | - ((bool)tcmData.sCen << 2) | - ((bool)tcmData.cen << 3) | - ((bool)tcmData.vertex << 4) | - ((bool)tcmData.laser << 5) | - ((bool)tcmData.outputsAreBlocked << 6) | - ((bool)tcmData.dataIsValid << 7); - trg.nChanA = (int8_t)tcmData.nChanA; - //trg.nChanC = (int8_t)tcmData.nChanC; - trg.amplA = (int32_t)tcmData.amplA; - //trg.amplC = (int32_t)tcmData.amplC; - //trg.timeA = (int16_t)tcmData.timeA; - //trg.timeC = (int16_t)tcmData.timeC; + trg.setTriggers((bool)tcmData.orA, (bool)tcmData.orC, (bool)tcmData.vertex, (bool)tcmData.cen, (bool)tcmData.sCen, + (int8_t)tcmData.nChanA, (int8_t)tcmData.nChanC, (int32_t)tcmData.amplA, (int32_t)tcmData.amplC, + (int16_t)tcmData.timeA, (int16_t)tcmData.timeC, (bool)tcmData.laser, (bool)tcmData.outputsAreBlocked, (bool)tcmData.dataIsValid); } -//PM to ChannelData convertation -//FT0 + +// PM to ChannelData convertation +// FT0 and FV0 template auto ConvertEventData2ChData(std::vector& vecChData, const PMDataType& pmData, int linkID, int ep) -> std::enable_if_t().QTCAmpl), int16_t>::value> { @@ -191,19 +113,7 @@ auto ConvertEventData2ChData(std::vector& vecChData, const PMDa LOG(warning) << "Incorrect global channel! linkID: " << linkID << " | EndPoint: " << ep << " | LocalChID: " << pmData.channelID; } } -//FV0 -template -auto ConvertEventData2ChData(std::vector& vecChData, const PMDataType& pmData, int linkID, int ep) -> std::enable_if_t().chargeAdc), Short_t>::value> -{ - bool isValid{}; - const auto globalChID = LookupTableType::Instance().getChannel(linkID, ep, pmData.channelID, isValid); - if (isValid) { - vecChData.emplace_back(static_cast(globalChID), static_cast(pmData.time), static_cast(pmData.charge)); - } else { - LOG(warning) << "Incorrect global channel! linkID: " << linkID << " | EndPoint: " << ep << " | LocalChID: " << pmData.channelID; - } -} -//FDD +// FDD template auto ConvertEventData2ChData(std::vector& vecChData, const PMDataType& pmData, int linkID, int ep) -> std::enable_if_t().mChargeADC), int16_t>::value> { @@ -217,15 +127,10 @@ auto ConvertEventData2ChData(std::vector& vecChData, const PMDa } //Interface for extracting interaction record from Digit template -auto GetIntRecord(const T& digit) -> std::enable_if_t::value, o2::InteractionRecord> +auto GetIntRecord(const T& digit) { return digit.mIntRecord; } -template -auto GetIntRecord(const T& digit) -> std::enable_if_t::value, o2::InteractionRecord> -{ - return digit.ir; -} } // namespace DigitBlockFIThelper //Normal data taking mode