diff --git a/core/data/psd/CbmPsdDsp.cxx b/core/data/psd/CbmPsdDsp.cxx index a32d35fb869409426eec486fd884fb74234907f7..a317a495d7c8316dba884038cf63b23f0031979e 100644 --- a/core/data/psd/CbmPsdDsp.cxx +++ b/core/data/psd/CbmPsdDsp.cxx @@ -137,7 +137,11 @@ CbmPsdDsp::CbmPsdDsp(CbmPsdDsp&& other) // --- Destructor -CbmPsdDsp::~CbmPsdDsp() {} +CbmPsdDsp::~CbmPsdDsp() +{ + std::vector<uint16_t>().swap(fuWfm); + std::vector<uint16_t>().swap(fuFitWfm); +} // --- Assignment operator diff --git a/core/data/psd/CbmPsdDsp.h b/core/data/psd/CbmPsdDsp.h index 8cf498338e3a17bb6f8c074427ca0493eb015df6..d2683df6ab02a709121f94fecf70583cdae79970 100644 --- a/core/data/psd/CbmPsdDsp.h +++ b/core/data/psd/CbmPsdDsp.h @@ -126,14 +126,14 @@ private: Double_t fdAmpl = 0.; /// Amplitude from waveform [mV] UInt_t fuMinimum = 0; /// Minimum of waveform [adc samples] UInt_t fuTimeMax = 0; /// Time of maximum in waveform [adc samples] - std::vector<uint16_t> fuWfm; + std::vector<uint16_t> fuWfm = std::vector<uint16_t>(32, 0); Double_t fdFitAmpl = 0.; /// Amplitude from fit of waveform [mV] Double_t fdFitZL = 0.; /// ZeroLevel from fit of waveform [adc counts] Double_t fdFitEdep = 0.; /// Energy deposition from fit of waveform [MeV] Double_t fdFitR2 = 999.; /// Quality of waveform fit [] -- good near 0 Double_t fdFitTimeMax = -1.; /// Time of maximum in fit of waveform [adc samples] - std::vector<uint16_t> fuFitWfm; + std::vector<uint16_t> fuFitWfm = std::vector<uint16_t>(32, 0); template<class Archive> void serialize(Archive& ar, const unsigned int /*version*/) diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.cxx b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.cxx index 9324f355895588bffbeb8fa1bdc8d7e9e4fb647e..72f1c840bb3347865a7f2fc06f32f2777056b789 100644 --- a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.cxx +++ b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.cxx @@ -35,46 +35,13 @@ // ------------------------------------------------------------------------- CbmMcbm2018UnpackerAlgoPsd::CbmMcbm2018UnpackerAlgoPsd() : CbmStar2019Algo() - , fbMonitorMode(kFALSE) - , fbDebugMonitorMode(kFALSE) - , fbDebugWriteOutput(kFALSE) - , fPsdDigiVector(nullptr) - , fPsdDspVector(nullptr) - , fvbMaskedComponents() - , fUnpackPar(nullptr) - , fuRawDataVersion(0) - , fuNrOfGdpbs(0) - , fGdpbIdIndexMap() - , fuNrOfFeePerGdpb(0) - , fuNrOfChannelsPerFee(0) - , fuNrOfChannelsPerGdpb(0) - , fuNrOfGbtx(0) - , fuNrOfModules(0) - , fdTimeOffsetNs(0.0) - , fulCurrentTsIdx(0) - , fulCurrentMsIdx(0) - , fuCurrentMsSysId(0) - , fdTsStartTime(-1.0) - , fdTsStopTimeCore(-1.0) - , fdMsTime(-1.0) - , fuMsIndex(0) - , fuCurrentEquipmentId(0) - , fuCurrDpbId(0) - , fuCurrDpbIdx(0) - , fiRunStartDateTimeSec(-1) - , fiBinSizeDatePlots(-1) - , fvulCurrentEpoch() - , fvulCurrentEpochCycle() - , fvulCurrentEpochFull() - , fdStartTime(-1.0) - , fdStartTimeMsSz(0.0) - , ftStartTimeUnix(std::chrono::steady_clock::now()) { } + CbmMcbm2018UnpackerAlgoPsd::~CbmMcbm2018UnpackerAlgoPsd() { - if (nullptr != fPsdDigiVector) delete fPsdDigiVector; - if (nullptr != fPsdDspVector) delete fPsdDspVector; + if (nullptr != fPsdDigiVector) { fPsdDigiVector->clear(); delete fPsdDigiVector; } + if (nullptr != fPsdDspVector) { fPsdDspVector->clear(); delete fPsdDspVector; } } // ------------------------------------------------------------------------- @@ -160,11 +127,6 @@ Bool_t CbmMcbm2018UnpackerAlgoPsd::InitParameters() } } - /// Internal status initialization - fvulCurrentEpoch.resize(fuNrOfGdpbs, 0); - fvulCurrentEpochCycle.resize(fuNrOfGdpbs, 0); - fvulCurrentEpochFull.resize(fuNrOfGdpbs, 0); - return kTRUE; } // ------------------------------------------------------------------------- @@ -232,6 +194,11 @@ Bool_t CbmMcbm2018UnpackerAlgoPsd::ProcessTs(const fles::Timeslice& ts) std::sort(fPsdDigiVector->begin(), fPsdDigiVector->end(), [](const CbmPsdDigi& a, const CbmPsdDigi& b) -> bool { return a.GetTime() < b.GetTime(); }); + if (fbDebugWriteOutput && (fPsdDspVector != nullptr)) { + std::sort(fPsdDspVector->begin(), fPsdDspVector->end(), + [](const CbmPsdDsp& a, const CbmPsdDsp& b) -> bool { return a.GetTime() < b.GetTime(); }); + } + return kTRUE; } @@ -437,7 +404,7 @@ Bool_t CbmMcbm2018UnpackerAlgoPsd::ProcessMs(const fles::Timeslice& ts, size_t u fdFitAmpl, fdFitZL, fdFitEdep, fdFitR2, fdFitTimeMax, fuFitWfm); - std::shared_ptr<CbmPsdDigi> digi = MakeDigi(dsp); + std::unique_ptr<CbmPsdDigi> digi = MakeDigi(dsp); if (digi) fPsdDigiVector->emplace_back(*digi); if (fbDebugWriteOutput && (fPsdDspVector != nullptr)) { fPsdDspVector->emplace_back(dsp); } @@ -580,10 +547,9 @@ Bool_t CbmMcbm2018UnpackerAlgoPsd::SetDspOutputPointer(std::vector<CbmPsdDsp>* c } } -std::shared_ptr<CbmPsdDigi> CbmMcbm2018UnpackerAlgoPsd::MakeDigi(CbmPsdDsp dsp) +std::unique_ptr<CbmPsdDigi> CbmMcbm2018UnpackerAlgoPsd::MakeDigi(CbmPsdDsp dsp) { - std::shared_ptr<CbmPsdDigi> digi = - std::make_shared<CbmPsdDigi>(CbmPsdDigi(dsp.GetAddress(), dsp.GetTime(), dsp.GetEdep())); + std::unique_ptr<CbmPsdDigi> digi(new CbmPsdDigi(dsp.GetAddress(), dsp.GetTime(), dsp.GetEdep())); return digi; } diff --git a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.h b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.h index a3c3ebbfa7f6d595ae73ab9cb6a2ab2fa5d1e66a..3e819f9dd03287e85d001f72af6ac58956eee8e0 100644 --- a/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.h +++ b/fles/mcbm2018/unpacker/CbmMcbm2018UnpackerAlgoPsd.h @@ -63,7 +63,7 @@ public: Bool_t SetDigiOutputPointer(std::vector<CbmPsdDigi>* const pVector); Bool_t SetDspOutputPointer(std::vector<CbmPsdDsp>* const pVector); - std::shared_ptr<CbmPsdDigi> MakeDigi(CbmPsdDsp dsp); + std::unique_ptr<CbmPsdDigi> MakeDigi(CbmPsdDsp dsp); Bool_t CreateHistograms(); Bool_t FillHistograms(); @@ -72,45 +72,39 @@ public: inline void SetMonitorMode(Bool_t bFlagIn = kTRUE) { fbMonitorMode = bFlagIn; } inline void SetDspWriteMode(Bool_t bFlagIn = kTRUE) { fbDebugWriteOutput = bFlagIn; } inline void SetTimeOffsetNs(Double_t dOffsetIn = 0.0) { fdTimeOffsetNs = dOffsetIn; } - inline void SetDiamondDpbIdx(UInt_t uIdx = 2) { fuDiamondDpbIdx = uIdx; } private: /// Control flags - Bool_t fbMonitorMode; //! Switch ON the filling of a minimal set of histograms - Bool_t fbDebugMonitorMode; //! Switch ON the filling of a additional set of histograms - Bool_t fbDebugWriteOutput; //! If ON the output vector of dsp debug information is written to disk + Bool_t fbMonitorMode = kFALSE; //! Switch ON the filling of a minimal set of histograms + Bool_t fbDebugMonitorMode = kFALSE; //! Switch ON the filling of a additional set of histograms + Bool_t fbDebugWriteOutput = kFALSE; //! If ON the output vector of dsp debug information is written to disk /// Output vectors std::vector<CbmPsdDigi>* - fPsdDigiVector; //! Output Digi vector /* TODO CHECK The exclamation mark signals the transientness */ + fPsdDigiVector = nullptr; //! Output Digi vector /* TODO CHECK The exclamation mark signals the transientness */ std::vector<CbmPsdDsp>* - fPsdDspVector; //! Output Dsp vector /* TODO CHECK The exclamation mark signals the transientness */ + fPsdDspVector = nullptr; //! Output Dsp vector /* TODO CHECK The exclamation mark signals the transientness */ - std::vector<Bool_t> fvbMaskedComponents; + std::vector<Bool_t> fvbMaskedComponents = {}; /// Settings from parameter file - CbmMcbm2018PsdPar* fUnpackPar; //! - UInt_t fuRawDataVersion; //! Raw data versioning + CbmMcbm2018PsdPar* fUnpackPar = nullptr; //! + UInt_t fuRawDataVersion = 0; //! 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 - UInt_t fuNrOfFeePerGdpb; //! Number of FEBs per GDPB - UInt_t fuNrOfChannelsPerFee; //! Number of channels in each FEE - UInt_t fuNrOfChannelsPerGdpb; //! Number of channels per GDPB + UInt_t fuNrOfGdpbs = 0; //! Total number of GDPBs in the system + std::map<UInt_t, UInt_t> fGdpbIdIndexMap = {}; //! gDPB ID to index map + UInt_t fuNrOfFeePerGdpb = 0; //! Number of FEBs per GDPB + UInt_t fuNrOfChannelsPerFee = 0; //! Number of channels in each FEE + UInt_t fuNrOfChannelsPerGdpb = 0; //! Number of channels per GDPB /// Detector Mapping - UInt_t fuNrOfGbtx; - UInt_t fuNrOfModules; - std::vector<Int_t> fviNrOfRpc; - std::vector<Int_t> fviRpcType; - std::vector<Int_t> fviRpcSide; - std::vector<Int_t> fviModuleId; - std::vector<Int_t> fviPsdChUId; + UInt_t fuNrOfGbtx = 0; + UInt_t fuNrOfModules = 0; + std::vector<Int_t> fviPsdChUId= {}; /// User settings: Data correction parameters - Double_t fdTimeOffsetNs; - UInt_t fuDiamondDpbIdx; + Double_t fdTimeOffsetNs = 0.0; /// Constants static const Int_t kiMaxNbFlibLinks = 32; @@ -119,31 +113,25 @@ private: /// Running indices /// TS/MS info - ULong64_t fulCurrentTsIdx; //! Idx of the current TS - ULong64_t fulCurrentMsIdx; //! Idx of the current MS in TS (0 to fuTotalMsNb) - size_t fuCurrentMsSysId; //! SysId of the current MS in TS (0 to fuTotalMsNb) - Double_t fdTsStartTime; //! Time in ns of current TS from the index of the first MS first component - Double_t fdTsStopTimeCore; //! End Time in ns of current TS Core from the index of the first MS first component - Double_t fdMsTime; //! Start Time in ns of current MS from its index field in header - UInt_t fuMsIndex; //! Index of current MS within the TS + ULong64_t fulCurrentTsIdx = 0; //! Idx of the current TS + ULong64_t fulCurrentMsIdx = 0; //! Idx of the current MS in TS (0 to fuTotalMsNb) + size_t fuCurrentMsSysId = 0; //! SysId of the current MS in TS (0 to fuTotalMsNb) + Double_t fdTsStartTime = -1.0; //! Time in ns of current TS from the index of the first MS first component + Double_t fdTsStopTimeCore = -1.0; //! End Time in ns of current TS Core from the index of the first MS first component + Double_t fdMsTime = -1.0; //! Start Time in ns of current MS from its index field in header + UInt_t fuMsIndex = 0; //! Index of current MS within the TS /// Current data properties - UInt_t fuCurrentEquipmentId; //! Current equipment ID, tells from which DPB the current MS is originating - UInt_t fuCurrDpbId; //! Temp holder until Current equipment ID is properly filled in MS - UInt_t fuCurrDpbIdx; //! Index of the DPB from which the MS currently unpacked is coming - Int_t fiRunStartDateTimeSec; //! Start of run time since "epoch" in s, for the plots with date as X axis - Int_t fiBinSizeDatePlots; //! Bin size in s for the plots with date as X axis + UInt_t fuCurrentEquipmentId = 0; //! Current equipment ID, tells from which DPB the current MS is originating + UInt_t fuCurrDpbId = 0; //! Temp holder until Current equipment ID is properly filled in MS + UInt_t fuCurrDpbIdx = 0; //! Index of the DPB from which the MS currently unpacked is coming - /// Data format control: Current time references for each GDPB: merged epoch marker, epoch cycle, full epoch [fuNrOfGdpbs] - std::vector<ULong64_t> fvulCurrentEpoch; //! Current epoch index, per DPB - std::vector<ULong64_t> fvulCurrentEpochCycle; //! Epoch cycle from the Ms Start message and Epoch counter flip - std::vector<ULong64_t> fvulCurrentEpochFull; //! Epoch + Epoch Cycle /// Starting state book-keeping - Double_t fdStartTime; /** Time of first valid hit (TS_MSB available), used as reference for evolution plots**/ - Double_t fdStartTimeMsSz; /** Time of first microslice, used as reference for evolution plots**/ + Double_t fdStartTime = -1.0; /** Time of first valid hit (TS_MSB available), used as reference for evolution plots**/ + Double_t fdStartTimeMsSz = 0.0; /** Time of first microslice, used as reference for evolution plots**/ std::chrono::steady_clock::time_point - ftStartTimeUnix; /** Time of run Start from UNIX system, used as reference for long evolution plots against reception time **/ + ftStartTimeUnix = std::chrono::steady_clock::now(); /** Time of run Start from UNIX system, used as reference for long evolution plots against reception time **/ ClassDef(CbmMcbm2018UnpackerAlgoPsd, 2) };