From 1ee5d44d51dc676d37b87d018219d273994ecff8 Mon Sep 17 00:00:00 2001
From: Nikolay Karpushkin <karpushkin@inr.ru>
Date: Thu, 8 Jul 2021 17:30:49 +0200
Subject: [PATCH] moni init in header

---
 .../monitor/CbmMcbm2018MonitorAlgoPsd.cxx     |  76 +--------
 .../monitor/CbmMcbm2018MonitorAlgoPsd.h       | 153 +++++++++---------
 2 files changed, 77 insertions(+), 152 deletions(-)

diff --git a/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.cxx b/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.cxx
index 744eb62265..e68e1fff6c 100644
--- a/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.cxx
+++ b/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.cxx
@@ -41,83 +41,9 @@
 // -------------------------------------------------------------------------
 CbmMcbm2018MonitorAlgoPsd::CbmMcbm2018MonitorAlgoPsd()
   : CbmStar2019Algo()
-  ,
-  /// From the class itself
-  fbMonitorMode(kFALSE)
-  , fbMonitorChanMode(kFALSE)
-  , fbMonitorWfmMode(kFALSE)
-  , fbMonitorFitMode(kFALSE)
-  , fbDebugMonitorMode(kTRUE)
-  , fvbMaskedComponents()
-  , fbFirstPackageError(kTRUE)
-  , fbPsdMissedData(kFALSE)
-  , fUnpackPar(nullptr)
-  , fuNrOfGdpbs(0)
-  , fGdpbIdIndexMap()
-  , fuNrOfFeePerGdpb(0)
-  , fuNrOfChannelsPerFee(0)
-  , fuNrOfChannelsPerGdpb(0)
-  , fulCurrentTsIdx(0)
-  , fulCurrentMsIdx(0)
-  , fdTsStartTime(-1.0)
-  , fdMsTime(-1.0)
-  , fdPrevMsTime(-1.0)
-  , fuMsIndex(0)
-  , fuCurrentEquipmentId(0)
-  , fuCurrDpbId(0)
-  , fuCurrDpbIdx(0)
-  , fdStartTime(-1.0)
-  , ftStartTimeUnix(std::chrono::steady_clock::now())
-  , fuHistoryHistoSize(3600)
-  , fviHistoChargeArgs(3, 0)
-  , fviHistoAmplArgs(3, 0)
-  , fviHistoZLArgs(3, 0)
-  , fuMsgsCntInMs(0)
-  , fuReadMsgsCntInMs(0)
-  , fuLostMsgsCntInMs(0)
-  , fuReadEvtCntInMs(0)
-  , fvhHitZLChanEvo(kuNbChanPsd, nullptr)
-  , fvhHitLPChanEvo(kuNbChanPsd, nullptr)
-  , fvhHitFAChanEvo(kuNbChanPsd, nullptr)
-  , fvhHitChargeChan(kuNbChanPsd, nullptr)
-  , fvhHitZeroLevelChan(kuNbChanPsd, nullptr)
-  , fvhHitAmplChan(kuNbChanPsd, nullptr)
-  , fvhHitChargeByWfmChan(kuNbChanPsd, nullptr)
-  , fvhHitWfmChan(kuNbChanPsd, nullptr)
-  , kvuWfmRanges(kuNbWfmRanges, 0)
-  , kvuWfmInRangeToChangeChan(kuNbChanPsd * kuNbWfmRanges, 0)
-  , fv3hHitWfmFlattenedChan(kuNbChanPsd * kuNbWfmRanges * kuNbWfmExamples, nullptr)
-  , fbSpillOn(kTRUE)
-  , fuCurrentSpillIdx(0)
-  , fuCurrentSpillPlot(0)
-  , fdStartTimeSpill(-1.0)
-  , fdLastSecondTime(-1.0)
-  , fuCountsLastSecond(0)
-  , fhHitChargeMap(nullptr)
-  , fhHitMapEvo(nullptr)
-  , fhChanHitMapEvo(nullptr)
-  , fhMissedData(nullptr)
-  , fhAdcTime(nullptr)
-  , fhMsLengthEvo(nullptr)
-  , fhMsgsCntPerMsEvo(nullptr)
-  , fhReadMsgsCntPerMsEvo(nullptr)
-  , fhLostMsgsCntPerMsEvo(nullptr)
-  , fhReadEvtsCntPerMsEvo(nullptr)
-  , fvhHitFitWfmChan(kuNbChanPsd, nullptr)
-  , fvhFitHarmonic1Chan(kuNbChanPsd, nullptr)
-  , fvhFitHarmonic2Chan(kuNbChanPsd, nullptr)
-  , fvhFitQaChan(kuNbChanPsd, nullptr)
-  , fcSummary(nullptr)
-  , fcHitMaps(nullptr)
-  , fcChargesFPGA(nullptr)
-  , fcChargesWfm(nullptr)
-  , fcAmplitudes(nullptr)
-  , fcZeroLevels(nullptr)
-  , fcGenCntsPerMs(nullptr)
-  , fcWfmsAllChannels(nullptr)
-  , fvcWfmsChan(kuNbChanPsd, nullptr)
 {
 }
+
 CbmMcbm2018MonitorAlgoPsd::~CbmMcbm2018MonitorAlgoPsd()
 {
   /// Clear buffers
diff --git a/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.h b/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.h
index 62f8c56f1b..9ce35be069 100644
--- a/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.h
+++ b/fles/mcbm2018/monitor/CbmMcbm2018MonitorAlgoPsd.h
@@ -81,24 +81,24 @@ public:
 
 private:
   /// Control flags
-  Bool_t fbMonitorMode;       //! Switch ON the filling of a minimal set of histograms
-  Bool_t fbMonitorChanMode;   //! Switch ON the filling channelwise histograms
-  Bool_t fbMonitorWfmMode;    //! Switch ON the filling waveforms histograms
-  Bool_t fbMonitorFitMode;    //! Switch ON the filling waveform fitting histograms
-  Bool_t fbDebugMonitorMode;  //! Switch ON the filling of a additional set of histograms
-  std::vector<Bool_t> fvbMaskedComponents;
-  Bool_t fbFirstPackageError;
-  Bool_t fbPsdMissedData;
+  Bool_t fbMonitorMode = kTRUE;       //! Switch ON the filling of a minimal set of histograms
+  Bool_t fbMonitorChanMode = kFALSE;   //! Switch ON the filling channelwise histograms
+  Bool_t fbMonitorWfmMode = kFALSE;     //! Switch ON the filling waveforms histograms
+  Bool_t fbMonitorFitMode= kFALSE;      //! Switch ON the filling waveform fitting histograms
+  Bool_t fbDebugMonitorMode= kFALSE;   //! Switch ON the filling of a additional set of histograms
+  Bool_t fbFirstPackageError = kTRUE;
+  Bool_t fbPsdMissedData = kFALSE;
+  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
 
   /// Constants
   static const Int_t kiMaxNbFlibLinks   = 32;
@@ -109,95 +109,94 @@ private:
   static constexpr UInt_t GetNbChanPsd() { return kuNbChanPsd; }
   /// Running indices
   /// TS/MS info
-  ULong64_t fulCurrentTsIdx;
-  ULong64_t fulCurrentMsIdx;
-  Double_t fdTsStartTime;  //! Time in ns of current TS 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
-  Double_t fdPrevMsTime;   //! Start Time in ns of previous MS from its index field in header
-  UInt_t fuMsIndex;        //! Index of current MS within the TS
+  ULong64_t fulCurrentTsIdx = 0;
+  ULong64_t fulCurrentMsIdx = 0;
+  Double_t fdTsStartTime = -1.0;  //! Time in ns of current TS 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
+  Double_t fdPrevMsTime = -1.0;   //! Start Time in ns of previous 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
+  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
 
   /// Starting state book-keeping
-  Double_t fdStartTime; /** Time of first valid hit (epoch available), used as reference for evolution plots**/
+  Double_t fdStartTime = -1.0; /** Time of first valid hit (epoch available), 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 **/
 
   /// Histograms related variables
-  UInt_t fuHistoryHistoSize;             /** Size in seconds of the evolution histograms **/
-  std::vector<Int_t> fviHistoChargeArgs; /** Charge histogram arguments in adc counts **/
-  std::vector<Int_t> fviHistoAmplArgs;   /** Amplitude histogram arguments in adc counts **/
-  std::vector<Int_t> fviHistoZLArgs;     /** ZeroLevel histogram arguments in adc counts **/
+  UInt_t fuHistoryHistoSize = 3600;             /** Size in seconds of the evolution histograms **/
+  std::vector<Int_t> fviHistoChargeArgs= std::vector<Int_t>(3, 0); /** Charge histogram arguments in adc counts **/
+  std::vector<Int_t> fviHistoAmplArgs= std::vector<Int_t>(3, 0);  /** Amplitude histogram arguments in adc counts **/
+  std::vector<Int_t> fviHistoZLArgs= std::vector<Int_t>(3, 0);     /** ZeroLevel histogram arguments in adc counts **/
 
   /// Histograms
-  UInt_t fuMsgsCntInMs;
-  UInt_t fuReadMsgsCntInMs;
-  UInt_t fuLostMsgsCntInMs;
-  UInt_t fuReadEvtCntInMs;
+  UInt_t fuMsgsCntInMs = 0;
+  UInt_t fuReadMsgsCntInMs = 0;
+  UInt_t fuLostMsgsCntInMs = 0;
+  UInt_t fuReadEvtCntInMs = 0;
 
   /// Channel rate plots
-  std::vector<UInt_t> fvuHitCntChanMs;
-  std::vector<TH2*> fvhHitZLChanEvo;
-  std::vector<TH2*> fvhHitLPChanEvo;
-  std::vector<TH2*> fvhHitFAChanEvo;
-  std::vector<TH1*> fvhHitChargeChan;
-  std::vector<TH1*> fvhHitZeroLevelChan;
-  std::vector<TH1*> fvhHitAmplChan;
-  std::vector<TH1*> fvhHitChargeByWfmChan;
-  std::vector<TH1*> fvhHitWfmChan;
+  std::vector<TH2*> fvhHitZLChanEvo = std::vector<TH2*>(kuNbChanPsd, nullptr);
+  std::vector<TH2*> fvhHitLPChanEvo= std::vector<TH2*>(kuNbChanPsd, nullptr);
+  std::vector<TH2*> fvhHitFAChanEvo= std::vector<TH2*>(kuNbChanPsd, nullptr);
+  std::vector<TH1*> fvhHitChargeChan= std::vector<TH1*>(kuNbChanPsd, nullptr);
+  std::vector<TH1*> fvhHitZeroLevelChan= std::vector<TH1*>(kuNbChanPsd, nullptr);
+  std::vector<TH1*> fvhHitAmplChan= std::vector<TH1*>(kuNbChanPsd, nullptr);
+  std::vector<TH1*> fvhHitChargeByWfmChan= std::vector<TH1*>(kuNbChanPsd, nullptr);
+  std::vector<TH1*> fvhHitWfmChan= std::vector<TH1*>(kuNbChanPsd, nullptr);
 
   static const UInt_t kuNbWfmRanges   = 8;
   static const UInt_t kuNbWfmExamples = 8;
-  std::vector<UInt_t> kvuWfmRanges;
-  std::vector<UInt_t> kvuWfmInRangeToChangeChan;
-  std::vector<TH1*> fv3hHitWfmFlattenedChan;
+  std::vector<UInt_t> kvuWfmRanges = std::vector<UInt_t>(kuNbWfmRanges, 0);
+  std::vector<UInt_t> kvuWfmInRangeToChangeChan = std::vector<UInt_t>(kuNbChanPsd * kuNbWfmRanges, 0);
+  std::vector<TH1*> fv3hHitWfmFlattenedChan = std::vector<TH1*>(kuNbChanPsd * kuNbWfmRanges * kuNbWfmExamples, 0);
 
   /// Channels map
-  Bool_t fbSpillOn;
-  UInt_t fuCurrentSpillIdx;
-  UInt_t fuCurrentSpillPlot;
-  Double_t fdStartTimeSpill;
-  Double_t fdLastSecondTime;
-  UInt_t fuCountsLastSecond;
+  Bool_t fbSpillOn = kTRUE;
+  UInt_t fuCurrentSpillIdx = 0;
+  UInt_t fuCurrentSpillPlot = 0;
+  Double_t fdStartTimeSpill = -1.0;
+  Double_t fdLastSecondTime = -1.0;
+  UInt_t fuCountsLastSecond = 0;
   static const UInt_t kuOffSpillCountLimit = 200;
 
   const UInt_t kuPsdChanMap[kuNbChanPsd] = {
     0};  // = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; //! Map from electronics channel to PSD physical channel
-  TH1* fhHitChargeMap;
-  TH1* fhHitMapEvo;
-  TH2* fhChanHitMapEvo;
+  TH1* fhHitChargeMap= nullptr;
+  TH1* fhHitMapEvo= nullptr;
+  TH2* fhChanHitMapEvo= nullptr;
 
   /// Global Rate
-  TH1* fhMissedData;
-  TH1* fhAdcTime;
-  TH2* fhMsLengthEvo;
+  TH1* fhMissedData= nullptr;
+  TH1* fhAdcTime= nullptr;
+  TH2* fhMsLengthEvo= nullptr;
 
-  TH2* fhMsgsCntPerMsEvo;
-  TH2* fhReadMsgsCntPerMsEvo;
-  TH2* fhLostMsgsCntPerMsEvo;
-  TH2* fhReadEvtsCntPerMsEvo;
+  TH2* fhMsgsCntPerMsEvo = nullptr;
+  TH2* fhReadMsgsCntPerMsEvo= nullptr;
+  TH2* fhLostMsgsCntPerMsEvo= nullptr;
+  TH2* fhReadEvtsCntPerMsEvo= nullptr;
 
   /// Waveform fitting
-  std::vector<TH1*> fvhHitFitWfmChan;
-  std::vector<TH2*> fvhFitHarmonic1Chan;
-  std::vector<TH2*> fvhFitHarmonic2Chan;
-  std::vector<TH2*> fvhFitQaChan;
+  std::vector<TH1*> fvhHitFitWfmChan = std::vector<TH1*>(kuNbChanPsd, nullptr);
+  std::vector<TH2*> fvhFitHarmonic1Chan = std::vector<TH2*>(kuNbChanPsd, nullptr);
+  std::vector<TH2*> fvhFitHarmonic2Chan= std::vector<TH2*>(kuNbChanPsd, nullptr);
+  std::vector<TH2*> fvhFitQaChan= std::vector<TH2*>(kuNbChanPsd, nullptr);
 
   /// Canvases
-  TCanvas* fcSummary;
-  TCanvas* fcHitMaps;
-  TCanvas* fcZLevo;
-  TCanvas* fcChargesFPGA;
-  TCanvas* fcChargesWfm;
-  TCanvas* fcAmplitudes;
-  TCanvas* fcZeroLevels;
-  TCanvas* fcGenCntsPerMs;
-  TCanvas* fcWfmsAllChannels;
-  std::vector<TCanvas*> fvcWfmsChan;
-  TCanvas* fcPronyFit;
+  TCanvas* fcSummary= nullptr;
+  TCanvas* fcHitMaps= nullptr;
+  TCanvas* fcZLevo= nullptr;
+  TCanvas* fcChargesFPGA= nullptr;
+  TCanvas* fcChargesWfm= nullptr;
+  TCanvas* fcAmplitudes= nullptr;
+  TCanvas* fcZeroLevels= nullptr;
+  TCanvas* fcGenCntsPerMs= nullptr;
+  TCanvas* fcWfmsAllChannels= nullptr;
+  std::vector<TCanvas*> fvcWfmsChan = std::vector<TCanvas*>(kuNbChanPsd, nullptr);
+  TCanvas* fcPronyFit= nullptr;
 
   CbmMcbm2018MonitorAlgoPsd(const CbmMcbm2018MonitorAlgoPsd&);
   CbmMcbm2018MonitorAlgoPsd operator=(const CbmMcbm2018MonitorAlgoPsd&);
-- 
GitLab