CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorStsSync.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2019 Facility for Antiproton and Ion Research in Europe, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmMcbm2018MonitorStsSync -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CBMMCBM2018MONITORSTSSYNC_H
13#define CBMMCBM2018MONITORSTSSYNC_H
14
15#include "Timeslice.hpp"
16
17// Data
18#include "StsXyterFinalHit.h"
19#include "StsXyterMessage.h"
20
21// CbmRoot
22#include "CbmHistManager.h"
23#include "CbmMcbmUnpack.h"
24
25// C++11
26#include <chrono>
27
28// C/C++
29#include <map>
30#include <set>
31#include <vector>
32
33class CbmCern2017UnpackParHodo;
34class CbmCern2017UnpackParSts;
35
37public:
40
41 virtual Bool_t Init();
42
43 virtual Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
44
45 virtual void Reset();
46
47 virtual void Finish();
48
49 void SetParContainers();
50
51 Bool_t InitContainers();
52
53 Bool_t ReInitContainers();
54
55 virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId);
56 virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb);
57 void SetMsOverlap(size_t uOverlapMsNb = 1) { fuNbOverMsPerTs = uOverlapMsNb; }
58 size_t GetMsOverlap() { return fuNbOverMsPerTs; }
59
60 void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize = 5);
61
62 void ResetAllHistos();
63 void SaveAllHistos(TString sFileName = "");
64 void SavePulserHistos(TString sFileName = "");
65 void SetHistoFileName(TString sFileName = "data/SetupHistos.root") { fsHistoFileFullname = sFileName; }
66
74 void SetLongDurationLimits(UInt_t uDurationSeconds = 3600, UInt_t uBinSize = 1);
75 void SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal);
76
77 void UseDaqBuffer(Bool_t) {};
78
79private:
80 // Parameters
81 // FLES containers
82 std::vector<size_t> fvMsComponentsList;
86 // Unpacking and mapping
87 CbmCern2017UnpackParHodo* fUnpackParHodo;
88 UInt_t fuNrOfDpbs;
89 std::map<UInt_t, UInt_t> fDpbIdIndexMap;
93 std::vector<std::vector<UInt_t>>
95
96 // Constants
97 static const Int_t kiMaxNbFlibLinks = 16;
98 static const UInt_t kuBytesPerMessage = 4;
99
100 // Internal Control/status of monitor
101 // Histo File name and path
103 // Task configuration values
106 // TS/MS info
109 // Current data properties
110 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
112 UInt_t fuCurrDpbId;
116
117 // Data format control
118 std::vector<ULong64_t> fvulCurrentTsMsb;
119 std::vector<UInt_t> fvuCurrentTsMsbCycle;
120 std::vector<UInt_t> fvuInitialHeaderDone;
121 std::vector<UInt_t> fvuInitialTsMsbCycleHeader;
122 std::vector<UInt_t> fvuElinkLastTsHit;
123 // Hits comparison
124 std::vector<std::vector<ULong64_t>> fvulChanLastHitTime;
125 std::vector<std::vector<Double_t>> fvdChanLastHitTime;
126 std::vector<Double_t> fvdMsTime;
127 std::vector<std::vector<std::vector<UInt_t>>> fvuChanNbHitsInMs;
128 std::vector<std::vector<std::vector<Double_t>>>
130 std::vector<std::vector<std::vector<UShort_t>>>
132 // std::vector< std::vector< std::multiset< stsxyter::FinalHit > > > fvmChanHitsInTs; //! All hits (time & ADC) in bins in last TS for each Channel
133 // Starting state book-keeping
134 Double_t fdStartTime;
136 std::chrono::steady_clock::time_point
139 // Hits time-sorting
140 std::vector<stsxyter::FinalHit>
142 std::vector<std::vector<stsxyter::FinalHit>>
144 // Coincidence histos
146 // Rate evolution histos
151
152 // Coincidences in sorted hits
153 Double_t fdCoincCenter; // ns
154 Double_t fdCoincBorder; // ns, +/-
155 Double_t fdCoincMin; // ns
156 Double_t fdCoincMax; // ns
157
158 // Histograms
164 /*
165 TH2* fhStsDpbRawTsMsb;
166 TH2* fhStsDpbRawTsMsbSx;
167 TH2* fhStsDpbRawTsMsbDpb;
168*/
173
174 std::vector<TH1*> fhPulserChanCntRaw;
175 std::vector<TH1*> fhPulserChanCntRawGood;
176 std::vector<TH2*> fhPulserChanAdcRaw;
177 std::vector<TProfile*> fhPulserChanAdcRawProf;
178 std::vector<TH2*> fhPulserChanRawTs;
179 std::vector<TH2*> fhPulserChanMissEvt;
180 std::vector<TH2*> fhPulserChanMissEvtEvo;
181 std::vector<TH2*> fhPulserChanHitRateEvo;
182 std::vector<TH1*> fhPulserFebRateEvo;
183 std::vector<TH1*> fhPulserFebMissEvtEvo;
184 std::vector<TH2*> fhPulserChanHitRateEvoLong;
185 std::vector<TH1*> fhPulserFebRateEvoLong;
186
187 TCanvas* fcMsSizeAll;
190
192 Double_t fdStartTs;
193 std::vector<stsxyter::FinalHit> fvmLastHitAsic;
194 std::vector<TH2*> fhPulserTimeDiffPerAsic;
195 std::vector<std::vector<TH1*>> fhPulserTimeDiffPerAsicPair;
196 std::vector<std::vector<TH1*>> fhPulserTimeDiffClkPerAsicPair;
197 std::vector<std::vector<TH2*>> fhPulserTimeDiffEvoPerAsicPair;
198 std::vector<std::vector<TProfile*>> fhPulserTimeDiffEvoPerAsicPairProf;
199 std::vector<std::vector<TProfile*>> fhPulserRawTimeDiffEvoPerAsicPairProf;
200 std::vector<std::vector<TH2*>> fhPulserTsLsbMatchPerAsicPair;
201 std::vector<std::vector<TH2*>> fhPulserTsMsbMatchPerAsicPair;
202 std::vector<std::vector<TProfile*>> fhPulserTsLsbDiffEvoPerAsicPairProf;
203 std::vector<std::vector<TProfile*>> fhPulserTsMsbDiffEvoPerAsicPairProf;
204 std::vector<TH1*> fhPulserIntervalAsic;
205 std::vector<TH1*> fhPulserIntervalLongAsic;
206
207 static const UInt_t kuNbValuesForTimeDiffMean = 100;
208 constexpr static const double kdPulserPeriod = 154000;
209 constexpr static const double kdTimeDiffToMeanMargin = 50;
210 std::vector<std::vector<std::vector<Double_t>>> fvdLastTimeDiffValuesAsicPair;
211 std::vector<std::vector<UInt_t>> fvuLastTimeDiffSlotAsicPair;
212 std::vector<std::vector<Double_t>> fvdMeanTimeDiffAsicPair;
213
214 void UpdatePairMeanValue(UInt_t uAsicA, UInt_t uAsicB, Double_t dNewValue);
215
216 void CreateHistograms();
217
218 void FillHitInfo(stsxyter::Message mess, const UShort_t& usElinkIdx, const UInt_t& uAsicIdx, const UInt_t& uMsIdx);
219 void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
221
224
225 ClassDef(CbmMcbm2018MonitorStsSync, 1)
226};
227
228#endif // CBMMCBM2018MONITORSTSSYNC_H
Histogram manager.
Histogram manager.
std::vector< std::vector< Double_t > > fvdChanLastHitTime
Last hit time in bins for each Channel.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
stsxyter::MessagePrintMask fPrintMessCtrl
std::vector< std::vector< Double_t > > fvdMeanTimeDiffAsicPair
std::vector< std::vector< TH2 * > > fhPulserTimeDiffEvoPerAsicPair
static const UInt_t kuNbValuesForTimeDiffMean
std::vector< std::vector< TH2 * > > fhPulserTsLsbMatchPerAsicPair
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< std::vector< ULong64_t > > fvulChanLastHitTime
TS from last hit for DPB.
std::vector< TH1 * > fhPulserFebRateEvoLong
std::vector< stsxyter::FinalHit > fvmHitsInMs
CbmMcbm2018MonitorStsSync operator=(const CbmMcbm2018MonitorStsSync &)
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
std::vector< stsxyter::FinalHit > fvmLastHitAsic
Last hits in each ASIC.
void SavePulserHistos(TString sFileName="")
static const Int_t kiMaxNbFlibLinks
Vector holding for each link the corresponding ASIC index [fuNrOfDpbs * fuNbElinksPerDpb].
UInt_t fuNbElinksPerDpb
Map of DPB Identifier to DPB index.
std::vector< TH1 * > fhPulserChanCntRawGood
std::vector< std::vector< std::vector< Double_t > > > fvdChanLastHitTimeInMs
Number of hits in each MS for each Channel.
Double_t fdStartTs
Pulser time difference histos.
std::vector< Double_t > fvdMsTime
Last hit time in ns for each Channel.
UInt_t fuMaxNbMicroslices
All hits (time in bins, ADC in bins, asic, channel) in last TS, per ASIC, sorted with "<" operator.
static constexpr const double kdTimeDiffToMeanMargin
ns
std::vector< std::vector< TH1 * > > fhPulserTimeDiffClkPerAsicPair
void SetMsOverlap(size_t uOverlapMsNb=1)
std::vector< TH2 * > fhPulserChanMissEvtEvo
UInt_t fuNbStsXyters
Number of possible eLinks per DPB.
std::vector< TH2 * > fhPulserChanHitRateEvoLong
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of Sts DPBs in system.
void SaveAllHistos(TString sFileName="")
CbmCern2017UnpackParHodo * fUnpackParHodo
/‍** Ignore Overlap Ms: all fuOverlapMsNb MS at the end of timeslice **‍/
UInt_t fuNbChanPerAsic
Number of StsXyter ASICs.
std::vector< std::vector< std::vector< UInt_t > > > fvuChanNbHitsInMs
Header time of each MS.
void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< UInt_t > fvuInitialHeaderDone
Current TS MSB cycle for DPB.
void SetHistoFileName(TString sFileName="data/SetupHistos.root")
void SetLongDurationLimits(UInt_t uDurationSeconds=3600, UInt_t uBinSize=1)
CbmMcbm2018MonitorStsSync(const CbmMcbm2018MonitorStsSync &)
std::vector< TH1 * > fhPulserIntervalAsic
std::vector< std::vector< std::vector< Double_t > > > fvdLastTimeDiffValuesAsicPair
std::chrono::steady_clock::time_point ftStartTimeUnix
std::vector< std::vector< UInt_t > > fvuLastTimeDiffSlotAsicPair
void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize=5)
std::vector< std::vector< TProfile * > > fhPulserTimeDiffEvoPerAsicPairProf
std::vector< UInt_t > fvuInitialTsMsbCycleHeader
Flag set after seeing MS header in 1st MS for DPB.
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< std::vector< UInt_t > > fvuElinkToAsic
Number of channels per StsXyter ASIC => should be constant somewhere!!!!
std::vector< std::vector< TProfile * > > fhPulserRawTimeDiffEvoPerAsicPairProf
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
std::vector< std::vector< TProfile * > > fhPulserTsMsbDiffEvoPerAsicPairProf
std::vector< std::vector< TH2 * > > fhPulserTsMsbMatchPerAsicPair
std::vector< UInt_t > fvuElinkLastTsHit
TS MSB cycle from MS header in 1st MS for DPB.
std::vector< std::vector< TProfile * > > fhPulserTsLsbDiffEvoPerAsicPairProf
Double_t fdStartTime
Last hit ADC in bins in each MS for each Channel.
void FillHitInfo(stsxyter::Message mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
std::vector< size_t > fvMsComponentsList
TProfile * fhMsSzTime[kiMaxNbFlibLinks]
void SetPrintMessage(Bool_t bPrintMessOn=kTRUE, stsxyter::MessagePrintMask ctrl=stsxyter::MessagePrintMask::msg_print_Hex|stsxyter::MessagePrintMask::msg_print_Human)
std::vector< TH1 * > fhPulserIntervalLongAsic
std::vector< std::vector< TH1 * > > fhPulserTimeDiffPerAsicPair
static constexpr const double kdPulserPeriod
std::vector< ULong64_t > fvulCurrentTsMsb
Bin size in s for the plots with date as X axis.
std::vector< TProfile * > fhPulserChanAdcRawProf
std::vector< std::vector< stsxyter::FinalHit > > fvmAsicHitsInMs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
std::vector< TH2 * > fhPulserChanHitRateEvo
TH1 * fhPulserMessType
Histogram manager.
std::vector< TH2 * > fhPulserTimeDiffPerAsic
Last hits in each ASIC.
void SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal)
void FillEpochInfo(stsxyter::Message mess)
std::vector< std::vector< std::vector< UShort_t > > > fvusChanLastHitAdcInMs
Last hit time in bins in each MS for each Channel.
void UpdatePairMeanValue(UInt_t uAsicA, UInt_t uAsicB, Double_t dNewValue)
std::vector< TH1 * > fhPulserFebMissEvtEvo
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
MessagePrintMask
Printout control.