From 992bb457406b5f3e8c595a65c600381af3f6bb3f Mon Sep 17 00:00:00 2001 From: Nikolay Karpushkin <karpushkin@inr.ru> Date: Mon, 21 Jun 2021 10:02:27 +0300 Subject: [PATCH] New PSD data format --- core/data/CMakeLists.txt | 4 +- ...tDataFormat.h => PsdGbtDataFormat-v0.00.h} | 4 +- core/data/raw/PsdGbtDataFormat-v1.00.h | 150 ++++++++++++++ ...sdGbtReader.cxx => PsdGbtReader-v0.00.cxx} | 6 +- .../{PsdGbtReader.h => PsdGbtReader-v0.00.h} | 7 +- core/detectors/psd/CbmMcbm2018PsdPar.cxx | 2 - core/detectors/psd/CbmMcbm2018PsdPar.h | 7 - .../monitor/CbmMcbm2018MonitorAlgoPsd.cxx | 2 +- .../monitor/CbmMcbm2018MonitorAlgoPsd.h | 2 +- .../unpacker/CbmMcbm2018UnpackerAlgoPsd.cxx | 189 ++++++++++-------- .../unpacker/CbmMcbm2018UnpackerAlgoPsd.h | 3 +- .../unpacker/CbmMcbm2018UnpackerTaskPsd.cxx | 81 +------- .../unpacker/CbmMcbm2018UnpackerTaskPsd.h | 6 +- macro/beamtime/mcbm2020/mPsdPar.par | 6 +- 14 files changed, 276 insertions(+), 193 deletions(-) rename core/data/raw/{PsdGbtDataFormat.h => PsdGbtDataFormat-v0.00.h} (98%) create mode 100644 core/data/raw/PsdGbtDataFormat-v1.00.h rename core/data/raw/{PsdGbtReader.cxx => PsdGbtReader-v0.00.cxx} (98%) rename core/data/raw/{PsdGbtReader.h => PsdGbtReader-v0.00.h} (92%) diff --git a/core/data/CMakeLists.txt b/core/data/CMakeLists.txt index b768cc7879..f2f223d3ee 100644 --- a/core/data/CMakeLists.txt +++ b/core/data/CMakeLists.txt @@ -117,7 +117,7 @@ set(SRCS raw/StsXyterMessage.cxx raw/gDpbMessv100.cxx raw/TimesliceMetaData.cxx - raw/PsdGbtReader.cxx + raw/PsdGbtReader-v0.00.cxx ) Set(NO_DICT_SRCS @@ -139,6 +139,6 @@ GENERATE_LIBRARY() # Install file which has no corresponding source file Install(FILES CbmDefs.h rich/CbmRichRingLight.h base/CbmDigiVector.h - raw/bitmask_operators.hpp raw/StsXyterFinalHit.h raw/PsdGbtDataFormat.h + raw/bitmask_operators.hpp raw/StsXyterFinalHit.h raw/PsdGbtDataFormat-v0.00.h raw/PsdGbtDataFormat-v1.00.h DESTINATION include ) diff --git a/core/data/raw/PsdGbtDataFormat.h b/core/data/raw/PsdGbtDataFormat-v0.00.h similarity index 98% rename from core/data/raw/PsdGbtDataFormat.h rename to core/data/raw/PsdGbtDataFormat-v0.00.h index 4694e697a6..1ffd759bb3 100644 --- a/core/data/raw/PsdGbtDataFormat.h +++ b/core/data/raw/PsdGbtDataFormat-v0.00.h @@ -18,7 +18,7 @@ #include <stdio.h> #include <string.h> -namespace PsdData +namespace PsdDataV000 { struct PsdEventHeaderAB { @@ -145,7 +145,7 @@ namespace PsdData PsdHitData() { clear(); } }; -} // namespace PsdData +} // namespace PsdDataV000 #endif /* PSD_GBT_DATA_FORMAT_H_ */ diff --git a/core/data/raw/PsdGbtDataFormat-v1.00.h b/core/data/raw/PsdGbtDataFormat-v1.00.h new file mode 100644 index 0000000000..763bbba69a --- /dev/null +++ b/core/data/raw/PsdGbtDataFormat-v1.00.h @@ -0,0 +1,150 @@ +// ----------------------------------------------------------------------------- +// ----- ----- +// ----- PsdGbtDataFormat ----- +// ----- Created 14.09.2019 by N.Karpushkin ----- +// ----- Version 1.00 ----- +// ----------------------------------------------------------------------------- + +#ifndef PSD_GBT_DATA_FORMAT_V100_H_ +#define PSD_GBT_DATA_FORMAT_V100_H_ + +#include <stdint.h> +#include <stdio.h> +#include <string.h> +#include <vector> + +namespace PsdDataV100 { + + struct PsdMsHeader { + enum bitFieldSizes { + MWs = 8, //! MagicWord size in bits + E0s = 8, //! Empty bits size in bits + MSs = 64 //! MicroSlice size in bits + }; + + uint8_t uMagicWord : MWs; //! MagicWord + uint8_t uEmpty0 : E0s; //! Empty bits + uint64_t ulMicroSlice : MSs; //! Epoch + + void printout() { + printf("MS magic word: %x; microslice: %lu\n", + uMagicWord, + ulMicroSlice); + } + + void clear() { + uMagicWord = 0; + uEmpty0 = 0; + ulMicroSlice = 0; + } + + PsdMsHeader() { clear(); } + + };//PsdMsHeader; + + + struct PsdPackHeader { + enum bitFieldSizes { + MWs = 4, //! MagicWord size in bits + LIs = 4, //! Link index size in bits + E0s = 24, //! Empty bits size in bits + HNs = 8, //! Hits number size in bits + TWs = 8, //! Words in pack size in bits + TMs = 32 //! ADC Time size in bits + }; + + uint8_t uMagicWord : MWs; //! MagicWord + uint8_t uLinkIndex : LIs; //! Link index + uint32_t uEmpty0 : E0s; //! Empty bits + uint8_t uHitsNumber : HNs; //! Hits number + uint8_t uTotalWords : TWs; //! Words in data pack + uint32_t uAdcTime : TMs; //! ADC Time of threshold cross from the begining of MS + + void printout() { + printf("Pack magic word: %x; link: %u; total hits: %u; total gbt words: %u; ADC time in microslice: %u\n", + uMagicWord, + uLinkIndex, + uHitsNumber, + uTotalWords, + uAdcTime); + } + + void clear() { + uMagicWord = 0; + uLinkIndex = 0; + uEmpty0 = 0; + uHitsNumber = 0; + uTotalWords = 0; + uAdcTime = 0; + } + + PsdPackHeader() { clear(); } + + };//PsdPackHeader; + + + struct PsdHitHeader { + enum bitFieldSizes { + HCs = 8, //! Hit channel size in bits + WWs = 8, //! Waveform points size in bits + E0s = 28, //! Empty bits size in bits + SCs = 20, //! Signal charge size in bits + ZLs = 16 //! ZeroLevel size in bits + }; + + uint8_t uHitChannel : HCs; //! Hit channel + uint8_t uWfmWords : WWs; //! Total waveform points per hit + uint32_t uEmpty0 : E0s; //! Empty bits + uint32_t uSignalCharge : SCs; //! Waveform integral above ZeroLevel + uint16_t uZeroLevel : ZLs; //! Waveform ZeroLevel + + void printout() { + printf("hit channel: %u; waveform words: %u; signal charge: %u; zero level: %u\n", + uHitChannel, + uWfmWords, + uSignalCharge, + uZeroLevel); + } + + void clear() { + uHitChannel = 0; + uWfmWords = 0; + uEmpty0 = 0; + uSignalCharge = 0; + uZeroLevel = 0; + } + + PsdHitHeader() { clear(); } + + };//PsdHitHeader; + + + struct PsdHitData { + enum bitFieldSizes { + E0s = 16, //! Empty bits size in bits + WPs = 16 //! Waveform point size in bits + }; + + uint16_t uEmpty0 : E0s; //! Empty bits + std::vector<uint16_t> uWfm; //! Waveform vector + + void printout() { + printf("waveform: "); + for (uint8_t iter = 0; iter < uWfm.size(); iter++) + printf("%u ", uWfm.at(iter)); + printf("\n"); + } + + void clear() { + uEmpty0 = 0; + uWfm.clear(); + } + + PsdHitData() { clear(); } + + };//PsdHitData; + +} // namespace PsdDataV100 + + +#endif /* PSD_GBT_DATA_FORMAT_V100_H_ */ diff --git a/core/data/raw/PsdGbtReader.cxx b/core/data/raw/PsdGbtReader-v0.00.cxx similarity index 98% rename from core/data/raw/PsdGbtReader.cxx rename to core/data/raw/PsdGbtReader-v0.00.cxx index b38e96f00c..e1ec77989c 100644 --- a/core/data/raw/PsdGbtReader.cxx +++ b/core/data/raw/PsdGbtReader-v0.00.cxx @@ -9,11 +9,11 @@ // ----- ----- // ----------------------------------------------------------------------------- -#include "PsdGbtReader.h" +#include "PsdGbtReader-v0.00.h" #include <cstdint> // for uint16_t, uint64_t, uint32_t -namespace PsdData +namespace PsdDataV000 { PsdGbtReader::~PsdGbtReader() @@ -126,4 +126,4 @@ namespace PsdData return 0; } -} // namespace PsdData +} // namespace PsdDataV000 diff --git a/core/data/raw/PsdGbtReader.h b/core/data/raw/PsdGbtReader-v0.00.h similarity index 92% rename from core/data/raw/PsdGbtReader.h rename to core/data/raw/PsdGbtReader-v0.00.h index ce26922030..f7e3d167cc 100644 --- a/core/data/raw/PsdGbtReader.h +++ b/core/data/raw/PsdGbtReader-v0.00.h @@ -13,12 +13,11 @@ #define PSD_GBT_READER_H_ #include <vector> // for vector - #include <stdint.h> // for uint64_t, uint32_t -#include "PsdGbtDataFormat.h" // for PsdHitData, PsdHitHeader, PsdEventHead... +#include "PsdGbtDataFormat-v0.00.h" // for PsdHitData, PsdHitHeader, PsdEventHead... -namespace PsdData +namespace PsdDataV000 { class PsdGbtReader { @@ -62,6 +61,6 @@ namespace PsdData uint32_t gbt_word_index = 0; int buffer_shift = 0; }; -} // namespace PsdData +} // namespace PsdDataV000 #endif // PSD_GBT_READER_H_ diff --git a/core/detectors/psd/CbmMcbm2018PsdPar.cxx b/core/detectors/psd/CbmMcbm2018PsdPar.cxx index 02575d3acd..540f89d481 100644 --- a/core/detectors/psd/CbmMcbm2018PsdPar.cxx +++ b/core/detectors/psd/CbmMcbm2018PsdPar.cxx @@ -21,8 +21,6 @@ CbmMcbm2018PsdPar::CbmMcbm2018PsdPar(const char* name, const char* title, const char* context) : FairParGenericSet(name, title, context) , fiDataVersion(-1) - , fiMonitorMode(-1) - , fiDebugMonitorMode(-1) , fiNrOfGdpb(-1) , fiGdpbIdArray() , fiNrOfFeesPerGdpb(-1) diff --git a/core/detectors/psd/CbmMcbm2018PsdPar.h b/core/detectors/psd/CbmMcbm2018PsdPar.h index 255244cf21..d69ca1e751 100644 --- a/core/detectors/psd/CbmMcbm2018PsdPar.h +++ b/core/detectors/psd/CbmMcbm2018PsdPar.h @@ -49,10 +49,6 @@ public: Int_t FeeChanToGbtChan(UInt_t uChannelInFee); inline Int_t GetDataVersion() { return fiDataVersion; } - - inline Bool_t GetMonitorMode() { return (1 == fiMonitorMode ? kTRUE : kFALSE); } - inline Bool_t GetDebugMonitorMode() { return (1 == fiDebugMonitorMode ? kTRUE : kFALSE); } - inline Int_t GetNrOfGdpbs() { return fiNrOfGdpb; } inline Int_t GetGdpbId(Int_t i) { return fiGdpbIdArray[i]; } inline Int_t GetNrOfFeesPerGdpb() { return fiNrOfFeesPerGdpb; } @@ -87,9 +83,6 @@ private: const UInt_t kuFeeToGbt[kuNbChannelsPerFee] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; //! Map from Psd channel to Gbt channel Int_t fiDataVersion; // Data Version - Int_t fiMonitorMode; // Enable histograms in event builder processes and algo, 0 = OFF / 1 = ON - Int_t - fiDebugMonitorMode; // Enable extra debuging histos in bth event builder and monitor processes and algo, 0 = OFF / 1 = ON Int_t fiNrOfGdpb; // Total number of GDPBs TArrayI fiGdpbIdArray; // Array to hold the unique IDs for all Psd GDPBs diff --git a/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.cxx b/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.cxx index 54edf9cfc3..49b2a771b3 100644 --- a/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.cxx +++ b/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.cxx @@ -359,7 +359,7 @@ Bool_t CbmMcbm2018MonitorAlgoPsd::ProcessMs(const fles::Timeslice& ts, size_t uM } } - PsdData::PsdGbtReader PsdReader(pInBuff); + PsdDataV000::PsdGbtReader PsdReader(pInBuff); if (fair::Logger::Logging(fair::Severity::debug)) PsdReader.SetPrintOutMode(true); if (uSize > 0) { while (PsdReader.GetTotalGbtWordsRead() < uNbMessages) { diff --git a/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.h b/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.h index 52d4f02a79..339f3c6c40 100644 --- a/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.h +++ b/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.h @@ -19,7 +19,7 @@ #include "CbmPsdDigi.h" #include "PronyFitter.h" -#include "PsdGbtReader.h" +#include "PsdGbtReader-v0.00.h" // CbmRoot diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.cxx b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.cxx index 095e636758..4930fa42f8 100644 --- a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.cxx +++ b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.cxx @@ -41,6 +41,7 @@ CbmMcbm2018UnpackerAlgoPsd::CbmMcbm2018UnpackerAlgoPsd() , fbDebugMonitorMode(kFALSE) , fvbMaskedComponents() , fUnpackPar(nullptr) + , fuRawDataVersion(0) , fuNrOfGdpbs(0) , fGdpbIdIndexMap() , fuNrOfFeePerGdpb(0) @@ -114,6 +115,9 @@ TList* CbmMcbm2018UnpackerAlgoPsd::GetParList() } Bool_t CbmMcbm2018UnpackerAlgoPsd::InitParameters() { + fuRawDataVersion = fUnpackPar->GetDataVersion(); + LOG(info) << "Data Version: " << fuRawDataVersion; + fuNrOfGdpbs = fUnpackPar->GetNrOfGdpbs(); LOG(info) << "Nr. of Tof GDPBs: " << fuNrOfGdpbs; @@ -290,89 +294,108 @@ Bool_t CbmMcbm2018UnpackerAlgoPsd::ProcessMs(const fles::Timeslice& ts, size_t u // Prepare variables for the loop on contents const uint64_t* pInBuff = reinterpret_cast<const uint64_t*>(msContent); - PsdData::PsdGbtReader PsdReader(pInBuff); - //PsdReader.SetPrintOutMode(true); - if (uSize != 0) { - while (PsdReader.GetTotalGbtWordsRead() < uNbMessages) { - int ReadResult = PsdReader.ReadEventFles(); - if (PsdReader.EvHdrAb.uHitsNumber > fviPsdChUId.size()) { - LOG(error) << "too many triggered channels! In header: " << PsdReader.EvHdrAb.uHitsNumber - << " in PSD: " << fviPsdChUId.size(); - break; - } - - if (ReadResult == 0) { - //hit loop - for (int hit_iter = 0; hit_iter < PsdReader.EvHdrAb.uHitsNumber; hit_iter++) { - UInt_t uHitChannel = PsdReader.VectHitHdr.at(hit_iter).uHitChannel; - UInt_t uSignalCharge = PsdReader.VectHitHdr.at(hit_iter).uSignalCharge; - UInt_t uZeroLevel = PsdReader.VectHitHdr.at(hit_iter).uZeroLevel; - std::vector<uint16_t> uWfm = PsdReader.VectHitData.at(hit_iter).uWfm; - - if (uHitChannel >= fviPsdChUId.size()) { - LOG(error) << "hit channel number out of range! channel index: " << uHitChannel - << " max: " << fviPsdChUId.size(); - break; - } - - UInt_t uChId = uHitChannel; - UInt_t uRpdChId = uChId; //Should be map(uChId) TODO - UInt_t uChanUId = fviPsdChUId[uRpdChId]; //unique ID - - UInt_t uHitAmlpitude = 0; - UInt_t uHitChargeWfm = 0; - for (UInt_t wfm_iter = 0; wfm_iter < uWfm.size(); wfm_iter++) { - if (uWfm.at(wfm_iter) > uHitAmlpitude) uHitAmlpitude = uWfm.at(wfm_iter); - uHitChargeWfm += uWfm.at(wfm_iter) - uZeroLevel; - } - uHitAmlpitude -= uZeroLevel; - - //printf("0x%08x %u %u %u %f %f\n", uChanUId, uChId, CbmPsdAddress::GetModuleId(uChanUId), CbmPsdAddress::GetSectionId(uChanUId), (double)PsdReader.VectHitHdr.at(hit_iter).uSignalCharge, (double)PsdReader.EvHdrAc.uAdcTime ); - - Double_t dAdcTime = - (double) PsdReader.EvHdrAb.ulMicroSlice + (double) PsdReader.EvHdrAc.uAdcTime * 12.5 - fdTimeOffsetNs; - - LOG(debug) << Form("Insert 0x%08x digi with charge ", uChanUId) << uSignalCharge - << Form(", at %u,", PsdReader.EvHdrAc.uAdcTime) << " epoch: " << PsdReader.EvHdrAb.ulMicroSlice; - - fDigiVect.emplace_back(uChanUId, (double) uSignalCharge, dAdcTime); - - fDigiVect.back().SetAmpl(uHitAmlpitude); - fDigiVect.back().SetEdepWfm(uHitChargeWfm); - fDigiVect.back().SetZL(uZeroLevel); - - } // for(int hit_iter = 0; hit_iter < PsdReader.EvHdrAb.uHitsNumber; hit_iter++) - } - else if (ReadResult == 1) { - LOG(error) << "no event headers in message!"; - break; - } - else if (ReadResult == 2) { - LOG(error) << "check number of waveform points! In header: " << PsdReader.HitHdr.uWfmPoints - << " should be: " << 8; - break; - } - else if (ReadResult == 3) { - LOG(error) << "wrong amount of hits read! In header: " << PsdReader.EvHdrAb.uHitsNumber - << " in hit vector: " << PsdReader.VectHitHdr.size(); - break; - } - else { - LOG(error) << "PsdGbtReader.ReadEventFles() didn't return expected values"; - break; - } - - } // while(PsdReader.GetTotalGbtWordsRead()<uNbMessages) - - if (uNbMessages != PsdReader.GetTotalGbtWordsRead()) - LOG(error) << "Wrong amount of messages read!" - << " in microslice " << uNbMessages << " by PsdReader " << PsdReader.GetTotalGbtWordsRead() << "\n"; - - if (fulCurrentMsIdx != PsdReader.EvHdrAb.ulMicroSlice) - LOG(error) << "Wrong MS index!" - << " in microslice " << fulCurrentMsIdx << " by PsdReader " << PsdReader.EvHdrAb.ulMicroSlice << "\n"; - - } //if(uSize != 0) + + switch (fuRawDataVersion) + { + case '0':{ + + PsdDataV000::PsdGbtReader PsdReader(pInBuff); + //PsdReader.SetPrintOutMode(true); + if (uSize != 0) { + while (PsdReader.GetTotalGbtWordsRead() < uNbMessages) { + int ReadResult = PsdReader.ReadEventFles(); + if (PsdReader.EvHdrAb.uHitsNumber > fviPsdChUId.size()) { + LOG(error) << "too many triggered channels! In header: " << PsdReader.EvHdrAb.uHitsNumber + << " in PSD: " << fviPsdChUId.size(); + break; + } + + if (ReadResult == 0) { + //hit loop + for (int hit_iter = 0; hit_iter < PsdReader.EvHdrAb.uHitsNumber; hit_iter++) { + UInt_t uHitChannel = PsdReader.VectHitHdr.at(hit_iter).uHitChannel; + UInt_t uSignalCharge = PsdReader.VectHitHdr.at(hit_iter).uSignalCharge; + UInt_t uZeroLevel = PsdReader.VectHitHdr.at(hit_iter).uZeroLevel; + std::vector<uint16_t> uWfm = PsdReader.VectHitData.at(hit_iter).uWfm; + + if (uHitChannel >= fviPsdChUId.size()) { + LOG(error) << "hit channel number out of range! channel index: " << uHitChannel + << " max: " << fviPsdChUId.size(); + break; + } + + UInt_t uChId = uHitChannel; + UInt_t uRpdChId = uChId; //Should be map(uChId) TODO + UInt_t uChanUId = fviPsdChUId[uRpdChId]; //unique ID + + UInt_t uHitAmlpitude = 0; + UInt_t uHitChargeWfm = 0; + for (UInt_t wfm_iter = 0; wfm_iter < uWfm.size(); wfm_iter++) { + if (uWfm.at(wfm_iter) > uHitAmlpitude) uHitAmlpitude = uWfm.at(wfm_iter); + uHitChargeWfm += uWfm.at(wfm_iter) - uZeroLevel; + } + uHitAmlpitude -= uZeroLevel; + + //printf("0x%08x %u %u %u %f %f\n", uChanUId, uChId, CbmPsdAddress::GetModuleId(uChanUId), CbmPsdAddress::GetSectionId(uChanUId), (double)PsdReader.VectHitHdr.at(hit_iter).uSignalCharge, (double)PsdReader.EvHdrAc.uAdcTime ); + + Double_t dAdcTime = + (double) PsdReader.EvHdrAb.ulMicroSlice + (double) PsdReader.EvHdrAc.uAdcTime * 12.5 - fdTimeOffsetNs; + + LOG(debug) << Form("Insert 0x%08x digi with charge ", uChanUId) << uSignalCharge + << Form(", at %u,", PsdReader.EvHdrAc.uAdcTime) << " epoch: " << PsdReader.EvHdrAb.ulMicroSlice; + + fDigiVect.emplace_back(uChanUId, (double) uSignalCharge, dAdcTime); + + fDigiVect.back().SetAmpl(uHitAmlpitude); + fDigiVect.back().SetEdepWfm(uHitChargeWfm); + fDigiVect.back().SetZL(uZeroLevel); + + } // for(int hit_iter = 0; hit_iter < PsdReader.EvHdrAb.uHitsNumber; hit_iter++) + } + else if (ReadResult == 1) { + LOG(error) << "no event headers in message!"; + break; + } + else if (ReadResult == 2) { + LOG(error) << "check number of waveform points! In header: " << PsdReader.HitHdr.uWfmPoints + << " should be: " << 8; + break; + } + else if (ReadResult == 3) { + LOG(error) << "wrong amount of hits read! In header: " << PsdReader.EvHdrAb.uHitsNumber + << " in hit vector: " << PsdReader.VectHitHdr.size(); + break; + } + else { + LOG(error) << "PsdGbtReader.ReadEventFles() didn't return expected values"; + break; + } + + } // while(PsdReader.GetTotalGbtWordsRead()<uNbMessages) + + if (uNbMessages != PsdReader.GetTotalGbtWordsRead()) + LOG(error) << "Wrong amount of messages read!" + << " in microslice " << uNbMessages << " by PsdReader " << PsdReader.GetTotalGbtWordsRead() << "\n"; + + if (fulCurrentMsIdx != PsdReader.EvHdrAb.ulMicroSlice) + LOG(error) << "Wrong MS index!" + << " in microslice " << fulCurrentMsIdx << " by PsdReader " << PsdReader.EvHdrAb.ulMicroSlice << "\n"; + + } //if(uSize != 0) + + + + } + case '1': { + + + + } + + } + + + return kTRUE; } diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.h b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.h index 56966a76a2..4b531090bd 100644 --- a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.h +++ b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.h @@ -19,7 +19,7 @@ #include "CbmPsdDigi.h" #include "PronyFitter.h" -#include "PsdGbtReader.h" +#include "PsdGbtReader-v0.00.h" // CbmRoot @@ -70,6 +70,7 @@ private: /// Settings from parameter file CbmMcbm2018PsdPar* fUnpackPar; //! + UInt_t fuRawDataVersion; //! Raw data versioning /// Readout chain dimensions and mapping UInt_t fuNrOfGdpbs; //! Total number of GDPBs in the system std::map<UInt_t, UInt_t> fGdpbIdIndexMap; //! gDPB ID to index map diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerTaskPsd.cxx b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerTaskPsd.cxx index 8f5715dcdc..c846c912ab 100644 --- a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerTaskPsd.cxx +++ b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerTaskPsd.cxx @@ -47,6 +47,7 @@ CbmMcbm2018UnpackerTaskPsd::CbmMcbm2018UnpackerTaskPsd(UInt_t /*uNbGdpb*/) , fulTsCounter(0) , fUnpackerAlgo(nullptr) { + LOG(info) << "CbmMcbm2018UnpackerTaskPsd::Allocate"; fUnpackerAlgo = new CbmMcbm2018UnpackerAlgoPsd(); } @@ -102,45 +103,8 @@ Bool_t CbmMcbm2018UnpackerTaskPsd::InitContainers() LOG(error) << "Failed to obtain parameter container CbmMcbm2018PsdPar"; return kFALSE; } // if( nullptr == pUnpackPar ) - /* - fbMonitorMode = pUnpackPar->GetMonitorMode(); - LOG(info) << "Monitor mode: " - << ( fbMonitorMode ? "ON" : "OFF" ); - - fbDebugMonitorMode = pUnpackPar->GetDebugMonitorMode(); - LOG(info) << "Debug Monitor mode: " - << ( fbDebugMonitorMode ? "ON" : "OFF" ); -*/ - Bool_t initOK = fUnpackerAlgo->InitContainers(); - - /// If monitor mode enabled, trigger histos creation, obtain pointer on them and add them to the HTTP server - if (kTRUE == fbMonitorMode) { - /// Trigger histo creation on all associated algos - initOK &= fUnpackerAlgo->CreateHistograms(); - - fhArraySize = new TH1I("fhArraySize", "Size of the Array VS TS index; TS index; Size [bytes]", 10000, 0., 10000.); - fhArrayCapacity = - new TH1I("fhArrayCapacity", "Size of the Array VS TS index; TS index; Size [bytes]", 10000, 0., 10000.); - - /// Obtain vector of pointers on each histo from the algo (+ optionally desired folder) - std::vector<std::pair<TNamed*, std::string>> vHistos = fUnpackerAlgo->GetHistoVector(); - /// Register the histos in the HTTP server - THttpServer* server = FairRunOnline::Instance()->GetHttpServer(); - if (nullptr != server) { - for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) { - server->Register(Form("/%s", vHistos[uHisto].second.data()), vHistos[uHisto].first); - } // for( UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto ) - - server->RegisterCommand("/Reset_UnpPsd_Hist", "bMcbm2018UnpackerTaskPsdResetHistos=kTRUE"); - server->Restrict("/Reset_UnpPsd_Hist", "allow=admin"); - - server->Register("/Array", fhArraySize); - server->Register("/Array", fhArrayCapacity); - } // if( nullptr != server ) - } // if( kTRUE == fbMonitorMode ) - - fUnpackerAlgo->SetMonitorMode(fbMonitorMode); + Bool_t initOK = fUnpackerAlgo->InitContainers(); return initOK; } @@ -183,8 +147,6 @@ Bool_t CbmMcbm2018UnpackerTaskPsd::DoUnpack(const fles::Timeslice& ts, size_t /* */ /* - fhArraySize->Fill( fulTsCounter, fPsdDigiCloneArray->GetEntries() ); - fhArrayCapacity->Fill( fulTsCounter, fPsdDigiCloneArray->Capacity() ); */ if (0 == fulTsCounter % 10000) LOG(info) << "Processed " << fulTsCounter << "TS"; fulTsCounter++; @@ -197,48 +159,9 @@ void CbmMcbm2018UnpackerTaskPsd::Reset() { fUnpackerAlgo->ClearVector(); } void CbmMcbm2018UnpackerTaskPsd::Finish() { - /// If monitor mode enabled, trigger histos creation, obtain pointer on them and add them to the HTTP server - if (kTRUE == fbMonitorMode) { - /// Obtain vector of pointers on each histo from the algo (+ optionally desired folder) - std::vector<std::pair<TNamed*, std::string>> vHistos = fUnpackerAlgo->GetHistoVector(); - - /// Save old global file and folder pointer to avoid messing with FairRoot - TFile* oldFile = gFile; - TDirectory* oldDir = gDirectory; - - TFile* histoFile = nullptr; - - // open separate histo file in recreate mode - histoFile = new TFile("data/HistosUnpackerPsd.root", "RECREATE"); - histoFile->cd(); - - /// Register the histos in the HTTP server - for (UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto) { - /// Make sure we end up in chosen folder - TString sFolder = vHistos[uHisto].second.data(); - if (nullptr == gDirectory->Get(sFolder)) gDirectory->mkdir(sFolder); - gDirectory->cd(sFolder); - - /// Write plot - vHistos[uHisto].first->Write(); - - histoFile->cd(); - } // for( UInt_t uHisto = 0; uHisto < vHistos.size(); ++uHisto ) - - fhArraySize->Write(); - fhArrayCapacity->Write(); - - /// Restore old global file and folder pointer to avoid messing with FairRoot - gFile = oldFile; - gDirectory = oldDir; - - histoFile->Close(); - } // if( kTRUE == fbMonitorMode ) } void CbmMcbm2018UnpackerTaskPsd::SetIgnoreOverlapMs(Bool_t bFlagIn) { fUnpackerAlgo->SetIgnoreOverlapMs(bFlagIn); } - void CbmMcbm2018UnpackerTaskPsd::SetTimeOffsetNs(Double_t dOffsetIn) { fUnpackerAlgo->SetTimeOffsetNs(dOffsetIn); } -void CbmMcbm2018UnpackerTaskPsd::SetDiamondDpbIdx(UInt_t uIdx) { fUnpackerAlgo->SetDiamondDpbIdx(uIdx); } ClassImp(CbmMcbm2018UnpackerTaskPsd) diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerTaskPsd.h b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerTaskPsd.h index b471813200..1c1b68fc33 100644 --- a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerTaskPsd.h +++ b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerTaskPsd.h @@ -48,10 +48,10 @@ public: void SetNbMsInTs(size_t /*uCoreMsNb*/, size_t /*uOverlapMsNb*/) {}; /// Algo settings setters + inline void SetMonitorMode(Bool_t bFlagIn = kTRUE) { fbMonitorMode = bFlagIn; } void SetIgnoreOverlapMs(Bool_t bFlagIn = kTRUE); void SetTimeOffsetNs(Double_t dOffsetIn = 0.0); - void SetDiamondDpbIdx(UInt_t uIdx = 2); /// Task settings void SetWriteOutputFlag(Bool_t bFlagIn) { fbWriteOutput = bFlagIn; } @@ -71,10 +71,6 @@ private: /// Output vectors std::vector<CbmPsdDigi>* fpvDigiPsd = nullptr; - /// Histogrrams - TH1* fhArraySize = nullptr; - TH1* fhArrayCapacity = nullptr; - /// Processing algo CbmMcbm2018UnpackerAlgoPsd* fUnpackerAlgo; diff --git a/macro/beamtime/mcbm2020/mPsdPar.par b/macro/beamtime/mcbm2020/mPsdPar.par index ca28a8c938..5e13f47e74 100644 --- a/macro/beamtime/mcbm2020/mPsdPar.par +++ b/macro/beamtime/mcbm2020/mPsdPar.par @@ -1,6 +1,6 @@ [CbmMcbm2018PsdPar] //---------------------------------------------------------------------------- -DataVersion Int_t 0 +DataVersion: Int_t 0 NrOfGdpbs: Int_t 1 GdpbIdArray: Int_t \ 0x193d @@ -11,8 +11,8 @@ NrOfModules: Int_t 1 ModuleId: Int_t \ 1 NrOfSections: Int_t 10 -MipCalibration: Double_t \ - 11.16 11.25 11.37 11.62 11.45 11.27 10.58 10.29 11.50 10.84 +MipCalibration: Double_t \ #adc per MeV + 36.83 37.12 37.52 38.35 37.78 37.19 34.91 33.96 37.95 35.77 NbMsTot: Int_t 100 NbMsOverlap: Int_t 1 SizeMsInNs: Double_t 102400.0 -- GitLab