CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorMcbmSync.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// ----- CbmMcbm2018MonitorMcbmSync -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CBMMCBM2018MONITORMCBMSYNC_H
13#define CBMMCBM2018MONITORMCBMSYNC_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 inline void SetUseBestPair(Bool_t bInFLag = kTRUE) { fbUseBestPair = bInFLag; }
76 inline void SetTsLevelAna(Bool_t bInFLag = kTRUE) { fbTsLevelAna = bInFLag; }
77 inline void SetSpillLimits(Double_t dSpillA, Double_t dSpillB, Double_t dSpillC)
78 {
79 fdSpillStartA = dSpillA;
80 fdSpillStartB = dSpillB;
81 fdSpillStartC = dSpillC;
82 }
83
84 void UseDaqBuffer(Bool_t) {};
85
86private:
89 std::vector<size_t> fvMsComponentsListSts;
90 std::vector<size_t> fvMsComponentsListTof;
97 std::map<UInt_t, UInt_t> fmStsDpbIdIndexMap;
102 std::map<UInt_t, UInt_t> fmTofDpbIdIndexMap;
110
111 // Constants
112 static const UInt_t kuStsBytesPerMessage = 4;
113 static const UInt_t kuTofBytesPerMessage = 8;
114
115 // Internal Control/status of monitor
116 // Histo File name and path
118 // Task configuration values
121 // TS/MS info
124 // Current data properties
125 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
127 UInt_t fuCurrDpbId;
131
132 /****************** STS Sync ******************************************/
133 // Data format control
134 std::vector<ULong64_t> fvulStsCurrentTsMsb;
135 std::vector<UInt_t> fvuStsCurrentTsMsbCycle;
136
137 // Hits time-sorting
138 std::vector<std::vector<stsxyter::FinalHit>>
140 std::vector<std::vector<stsxyter::FinalHit>>
142
144 void CreateStsHistograms();
145
146 Bool_t ProcessStsMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx);
147
148 void FillStsHitInfo(stsxyter::Message mess, const UInt_t& uMsIdx);
149 void FillStsTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
151 /****************** STS Sync ******************************************/
152
153 /****************** TOF Sync ******************************************/
154
156 uint64_t fulTofCurrentTsIndex; // Idx of the current TS
157 size_t fuTofCurrentMs; // Idx of the current MS in TS (0 to fuTotalMsNb)
158 Double_t fdTofMsIndex; // Time in ns of current MS from its index
159 UInt_t fuTofGdpbId; // Id (hex number) of the GDPB for current message
160 UInt_t fuTofGdpbNr; // running number (0 to fuNrOfGdpbs) of the GDPB for current message
162 std::vector<int> fviTofMsgCounter;
163
170 std::vector<ULong64_t> fvulTofCurrentEpoch;
171 std::vector<ULong64_t> fvulTofCurrentEpochCycle;
172 std::vector<ULong64_t> fvulTofCurrentEpochFull;
173
177 std::vector<std::vector<gdpbv100::Message>> fvmTofEpSupprBuffer;
178
180 std::vector<std::vector<gdpbv100::FullMessage>> fvmTofGdpbHitsInMs;
181 std::vector<std::vector<gdpbv100::FullMessage>> fvmTofGdpbHitsInTs;
182
184 void CreateTofHistograms();
185
186 Bool_t ProcessTofMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx);
187
188 void FillTofEpochCycle(uint64_t ulCycleData);
191 /****************** TOF Sync ******************************************/
192
193 /****************** mCBM Sync *****************************************/
195
199
203
207
211
215 std::vector<TH1*> fvhHitsTimeEvoSpillA;
216 std::vector<TH1*> fvhHitsTimeEvoSpillB;
217
220
223
225 /****************** mCBM Sync *****************************************/
226
227
230
231 ClassDef(CbmMcbm2018MonitorMcbmSync, 1)
232};
233
234#endif // CBMMCBM2018MONITORMCBMSYNC_H
Histogram manager.
void SaveAllHistos(TString sFileName="")
void CreateStsHistograms()
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< size_t > fvMsComponentsListTof
void SetUseBestPair(Bool_t bInFLag=kTRUE)
std::map< UInt_t, UInt_t > fmStsDpbIdIndexMap
Total number of Sts DPBs in system.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::map< UInt_t, UInt_t > fmTofDpbIdIndexMap
Total number of GDPBs in the system.
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondEvoSpillB
CbmMcbm2018MonitorMcbmSync(const CbmMcbm2018MonitorMcbmSync &)
void SetMuchTofOffsetNs(Double_t dOffsetIn=0.0)
void SetSpillLimits(Double_t dSpillA, Double_t dSpillB, Double_t dSpillC)
Bool_t ProcessStsMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
std::vector< std::vector< stsxyter::FinalHit > > fvmStsSdpbHitsInMs
Current TS MSB cycle for DPB.
std::vector< ULong64_t > fvulTofCurrentEpochCycle
UInt_t fuTotalNrOfDpb
Global parameters.
std::vector< TH2 * > fvhMcbmTimeDiffToMuchEvoSpillA
void SetHistoFileName(TString sFileName="data/SetupHistos.root")
std::vector< size_t > fvMsComponentsListSts
void AddMsComponentToListTof(size_t component)
void SetTsLevelAna(Bool_t bInFLag=kTRUE)
void SetStsTofOffsetNs(Double_t dOffsetIn=0.0)
std::vector< ULong64_t > fvulTofCurrentEpochFull
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondEvoDpb
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
void AddMsComponentToListSts(size_t component)
CbmMcbm2018TofPar * fUnpackParTof
Unpacking and mapping parameters for TOF.
std::vector< UInt_t > fvuStsCurrentTsMsbCycle
Current TS MSB for each DPB.
Bool_t ProcessTofMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
void FillTofEpochCycle(uint64_t ulCycleData)
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondEvoSpillA
std::vector< TH2 * > fvhMcbmTimeDiffToMuchEvoSpillB
UInt_t fuMuchDpbIdx
Map of DPB Identifier to DPB index.
void SavePulserHistos(TString sFileName="")
std::vector< std::vector< gdpbv100::FullMessage > > fvmTofGdpbHitsInTs
uint64_t fulTofCurrentTsIndex
Running indices.
std::vector< ULong64_t > fvulTofCurrentEpoch
std::vector< ULong64_t > fvulStsCurrentTsMsb
Bin size in s for the plots with date as X axis.
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
std::vector< std::vector< gdpbv100::FullMessage > > fvmTofGdpbHitsInMs
Buffer for system sync check.
void FillStsTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
void FillStsEpochInfo(stsxyter::Message mess)
void SetMsOverlap(size_t uOverlapMsNb=1)
void FillStsHitInfo(stsxyter::Message mess, const UInt_t &uMsIdx)
std::vector< std::vector< stsxyter::FinalHit > > fvmStsSdpbHitsInTs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
CbmMcbm2018MonitorMcbmSync operator=(const CbmMcbm2018MonitorMcbmSync &)
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
static const UInt_t kuTofBytesPerMessage
TODO => move to the message class!!
stsxyter::MessagePrintMask fPrintMessCtrlSts
void SetIgnoreMsOverlap(Bool_t bIgnoreOver=kTRUE)
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondWideEvoDpb
std::vector< std::vector< gdpbv100::Message > > fvmTofEpSupprBuffer
Buffer for suppressed epoch processing.
void CreateTofHistograms()
Processing methods.
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondTsEvoDpb
MessagePrintMask
Printout control.