CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorMcbmRate.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// ----- CbmMcbm2018MonitorMcbmRate -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CBMMCBM2018MONITORMCBMRATE_H
13#define CBMMCBM2018MONITORMCBMRATE_H
14
15#include "Timeslice.hpp"
16
17// Data
18#include "StsXyterFinalHit.h"
19#include "StsXyterMessage.h"
20#include "gDpbMessv100.h"
21
22// CbmRoot
23#include "CbmHistManager.h"
24#include "CbmMcbmUnpack.h"
25
26// C++11
27#include <chrono>
28
29// C/C++
30#include <map>
31#include <set>
32#include <vector>
33
35
37
39public:
42
43 virtual Bool_t Init();
44
45 virtual Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
46
47 virtual void Reset();
48
49 virtual void Finish();
50
51 void SetParContainers();
52
53 Bool_t InitContainers();
54
55 Bool_t ReInitContainers();
56
57 virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId);
58 void AddMsComponentToListSts(size_t component);
59 void AddMsComponentToListTof(size_t component);
60
61 virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb);
62 void SetMsOverlap(size_t uOverlapMsNb = 1) { fuNbOverMsPerTs = uOverlapMsNb; }
63 size_t GetMsOverlap() { return fuNbOverMsPerTs; }
64 void SetIgnoreMsOverlap(Bool_t bIgnoreOver = kTRUE) { fbIgnoreOverlapMs = bIgnoreOver; }
65
66 void ResetAllHistos();
67 void SaveAllHistos(TString sFileName = "");
68 void SavePulserHistos(TString sFileName = "");
69 void SetHistoFileName(TString sFileName = "data/SetupHistos.root") { fsHistoFileFullname = sFileName; }
70
71 inline void SetDiamondDpbIdx(UInt_t uIdx = 2) { fuDiamondDpbIdx = uIdx; }
72 inline void SetMuchDpbIdx(UInt_t uIdx = 1) { fuMuchDpbIdx = uIdx; }
73 inline void SetStsTofOffsetNs(Double_t dOffsetIn = 0.0) { fdStsTofOffsetNs = dOffsetIn; }
74 inline void SetMuchTofOffsetNs(Double_t dOffsetIn = 0.0) { fdMuchTofOffsetNs = dOffsetIn; }
75
76 void UseDaqBuffer(Bool_t) {};
77
78private:
81 std::vector<size_t> fvMsComponentsListSts;
82 std::vector<size_t> fvMsComponentsListTof;
89 std::map<UInt_t, UInt_t> fmStsDpbIdIndexMap;
94 std::map<UInt_t, UInt_t> fmTofDpbIdIndexMap;
100
101 // Constants
102 static const UInt_t kuStsBytesPerMessage = 4;
103 static const UInt_t kuTofBytesPerMessage = 8;
104 static const UInt_t kuTimeBinSizeNs = 10000;
105 static const UInt_t kuTsSizeInNs = 10400000;
107
108 // Internal Control/status of monitor
109 // Histo File name and path
111 // Task configuration values
114 // TS/MS info
118 // Current data properties
119 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
121 UInt_t fuCurrDpbId;
125
126 /****************** STS Sync ******************************************/
127 // Data format control
128 std::vector<ULong64_t> fvulStsCurrentTsMsb;
129 std::vector<UInt_t> fvuStsCurrentTsMsbCycle;
130
131 // Hits time-sorting
132 std::vector<std::vector<stsxyter::FinalHit>>
134 std::vector<std::vector<stsxyter::FinalHit>>
136
138 void CreateStsHistograms();
139
140 Bool_t ProcessStsMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx);
141
142 void FillStsHitInfo(stsxyter::Message mess, const UInt_t& uMsIdx);
143 void FillStsTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
145 /****************** STS Sync ******************************************/
146
147 /****************** TOF Sync ******************************************/
148
150 uint64_t fulTofCurrentTsIndex; // Idx of the current TS
151 size_t fuTofCurrentMs; // Idx of the current MS in TS (0 to fuTotalMsNb)
152 Double_t fdTofMsIndex; // Time in ns of current MS from its index
153 UInt_t fuTofGdpbId; // Id (hex number) of the GDPB for current message
154 UInt_t fuTofGdpbNr; // running number (0 to fuNrOfGdpbs) of the GDPB for current message
156 std::vector<int> fviTofMsgCounter;
157
164 std::vector<ULong64_t> fvulTofCurrentEpoch;
165 std::vector<ULong64_t> fvulTofCurrentEpochCycle;
166 std::vector<ULong64_t> fvulTofCurrentEpochFull;
167
171 std::vector<std::vector<gdpbv100::Message>> fvmTofEpSupprBuffer;
172
174 std::vector<std::vector<gdpbv100::FullMessage>> fvmTofGdpbHitsInMs;
175 std::vector<std::vector<gdpbv100::FullMessage>> fvmTofGdpbHitsInTs;
176
177 std::vector<UInt_t> fvuHitsNbInTimeBinSts;
178 std::vector<UInt_t> fvuHitsNbInTimeBinMuch;
179 std::vector<UInt_t> fvuHitsNbInTimeBinTof;
180 std::vector<UInt_t> fvuHitsNbInTimeBinDiam;
181
183 void CreateTofHistograms();
184
185 Bool_t ProcessTofMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx);
186
187 void FillTofEpochCycle(uint64_t ulCycleData);
190 /****************** TOF Sync ******************************************/
191
192 /****************** mCBM Sync *****************************************/
196
199
203
207
211
215
217 /****************** mCBM Sync *****************************************/
218
219
222
223 ClassDef(CbmMcbm2018MonitorMcbmRate, 1)
224};
225
226#endif // CBMMCBM2018MONITORMCBMSYNC_H
Histogram manager.
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
Bool_t ProcessStsMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
stsxyter::MessagePrintMask fPrintMessCtrlSts
void FillStsHitInfo(stsxyter::Message mess, const UInt_t &uMsIdx)
void AddMsComponentToListSts(size_t component)
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
UInt_t fuTotalNrOfDpb
Global parameters.
std::vector< UInt_t > fvuHitsNbInTimeBinSts
std::map< UInt_t, UInt_t > fmStsDpbIdIndexMap
Total number of Sts DPBs in system.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< std::vector< gdpbv100::FullMessage > > fvmTofGdpbHitsInMs
Buffer for system sync check.
std::vector< UInt_t > fvuHitsNbInTimeBinTof
std::vector< ULong64_t > fvulTofCurrentEpoch
void SetHistoFileName(TString sFileName="data/SetupHistos.root")
void SaveAllHistos(TString sFileName="")
void SavePulserHistos(TString sFileName="")
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
Bool_t ProcessTofMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
void SetStsTofOffsetNs(Double_t dOffsetIn=0.0)
void FillTofEpochCycle(uint64_t ulCycleData)
void SetMsOverlap(size_t uOverlapMsNb=1)
std::vector< std::vector< gdpbv100::Message > > fvmTofEpSupprBuffer
Buffer for suppressed epoch processing.
void FillStsTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< std::vector< stsxyter::FinalHit > > fvmStsSdpbHitsInMs
Current TS MSB cycle for DPB.
CbmMcbm2018MonitorMcbmRate operator=(const CbmMcbm2018MonitorMcbmRate &)
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
std::map< UInt_t, UInt_t > fmTofDpbIdIndexMap
Total number of GDPBs in the system.
std::vector< UInt_t > fvuHitsNbInTimeBinMuch
void CreateTofHistograms()
Processing methods.
std::vector< ULong64_t > fvulTofCurrentEpochCycle
void FillStsEpochInfo(stsxyter::Message mess)
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
CbmMcbm2018MonitorMcbmRate(const CbmMcbm2018MonitorMcbmRate &)
std::vector< std::vector< stsxyter::FinalHit > > fvmStsSdpbHitsInTs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
std::vector< size_t > fvMsComponentsListSts
void SetIgnoreMsOverlap(Bool_t bIgnoreOver=kTRUE)
void AddMsComponentToListTof(size_t component)
uint64_t fulTofCurrentTsIndex
Running indices.
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< size_t > fvMsComponentsListTof
std::vector< UInt_t > fvuHitsNbInTimeBinDiam
std::vector< ULong64_t > fvulTofCurrentEpochFull
std::vector< ULong64_t > fvulStsCurrentTsMsb
Bin size in s for the plots with date as X axis.
void CreateStsHistograms()
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
static const UInt_t kuTofBytesPerMessage
TODO => move to the message class!!
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
CbmMcbm2018TofPar * fUnpackParTof
Unpacking and mapping parameters for TOF.
std::vector< std::vector< gdpbv100::FullMessage > > fvmTofGdpbHitsInTs
UInt_t fuMuchDpbIdx
Map of DPB Identifier to DPB index.
std::vector< UInt_t > fvuStsCurrentTsMsbCycle
Current TS MSB for each DPB.
void SetMuchTofOffsetNs(Double_t dOffsetIn=0.0)
MessagePrintMask
Printout control.