CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorMcbmPulser.h
Go to the documentation of this file.
1/* Copyright (C) 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// ----- CbmMcbm2018MonitorMcbmPulser -----
8// ----- Created 20/02/19 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CBMMCBM2018MONITORMCBMPULSER_H
13#define CBMMCBM2018MONITORMCBMPULSER_H
14
15#ifndef __CINT__
16#include "Timeslice.hpp"
17#endif
18
19// Data
20#include "StsXyterFinalHit.h"
21#include "StsXyterMessage.h"
22#include "gDpbMessv100.h"
23
24// CbmRoot
25#include "CbmHistManager.h"
26#include "CbmMcbmUnpack.h"
27
28// C++11
29#include <chrono>
30
31// C/C++
32#include <map>
33#include <set>
34#include <vector>
35
37
39
41public:
44
45 virtual Bool_t Init();
46#ifndef __CINT__
47 virtual Bool_t DoUnpack(const fles::Timeslice& ts, size_t component);
48#endif
49 virtual void Reset();
50
51 virtual void Finish();
52
53 void SetParContainers();
54
55 Bool_t InitContainers();
56
57 Bool_t ReInitContainers();
58
59 virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId);
60 void AddMsComponentToListSts(size_t component);
61 void AddMsComponentToListTof(size_t component);
62
63 virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb);
64 void SetMsOverlap(size_t uOverlapMsNb = 1) { fuNbOverMsPerTs = uOverlapMsNb; }
65 size_t GetMsOverlap() { return fuNbOverMsPerTs; }
66 void SetIgnoreMsOverlap(Bool_t bIgnoreOver = kTRUE) { fbIgnoreOverlapMs = bIgnoreOver; }
67
68 void ResetAllHistos();
69 void SaveAllHistos(TString sFileName = "");
70 void SavePulserHistos(TString sFileName = "");
71 void SetHistoFileName(TString sFileName = "data/SetupHistos.root") { fsHistoFileFullname = sFileName; }
72
73 inline void SetDiamondDpbIdx(UInt_t uIdx = 2) { fuDiamondDpbIdx = uIdx; }
74 inline void SetMuchDpbIdx(UInt_t uIdx = 2) { fuMuchDpbIdx = uIdx; }
75 inline void SetStsTofOffsetNs(Double_t dOffsetIn = 0.0) { fdStsTofOffsetNs = dOffsetIn; }
76 inline void SetMuchTofOffsetNs(Double_t dOffsetIn = 0.0) { fdMuchTofOffsetNs = dOffsetIn; }
77 inline void SetUseBestPair(Bool_t bInFLag = kTRUE) { fbUseBestPair = bInFLag; }
78 inline void SetTsLevelAna(Bool_t bInFLag = kTRUE) { fbTsLevelAna = bInFLag; }
79
80 void UseDaqBuffer(Bool_t) {};
81
82private:
85 std::vector<size_t> fvMsComponentsListSts;
86 std::vector<size_t> fvMsComponentsListTof;
93 std::map<UInt_t, UInt_t> fmStsDpbIdIndexMap;
98 std::map<UInt_t, UInt_t> fmTofDpbIdIndexMap;
106
107 // Constants
108 static const UInt_t kuStsBytesPerMessage = 4;
109 static const UInt_t kuTofBytesPerMessage = 8;
110
111 // Internal Control/status of monitor
112 // Histo File name and path
114 // Task configuration values
117 // TS/MS info
120 // Current data properties
121 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
123 UInt_t fuCurrDpbId;
127
128 /****************** STS Sync ******************************************/
129 // Data format control
130 std::vector<ULong64_t> fvulStsCurrentTsMsb;
131 std::vector<UInt_t> fvuStsCurrentTsMsbCycle;
132
133 // Hits time-sorting
134 std::vector<std::vector<stsxyter::FinalHit>>
136 std::vector<std::vector<stsxyter::FinalHit>>
138
140 void CreateStsHistograms();
141
142 Bool_t ProcessStsMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx);
143
144 void FillStsHitInfo(stsxyter::Message mess, const UInt_t& uMsIdx);
145 void FillStsTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
147 /****************** STS Sync ******************************************/
148
149 /****************** TOF Sync ******************************************/
150
152 uint64_t fulTofCurrentTsIndex; // Idx of the current TS
153 size_t fuTofCurrentMs; // Idx of the current MS in TS (0 to fuTotalMsNb)
154 Double_t fdTofMsIndex; // Time in ns of current MS from its index
155 UInt_t fuTofGdpbId; // Id (hex number) of the GDPB for current message
156 UInt_t fuTofGdpbNr; // running number (0 to fuNrOfGdpbs) of the GDPB for current message
158 std::vector<int> fviTofMsgCounter;
159
166 std::vector<ULong64_t> fvulTofCurrentEpoch;
167 std::vector<ULong64_t> fvulTofCurrentEpochCycle;
168 std::vector<ULong64_t> fvulTofCurrentEpochFull;
169
173 std::vector<std::vector<gdpbv100::Message>> fvmTofEpSupprBuffer;
174
176 std::vector<std::vector<gdpbv100::FullMessage>> fvmTofGdpbHitsInMs;
177 std::vector<std::vector<gdpbv100::FullMessage>> fvmTofGdpbHitsInTs;
178
180 void CreateTofHistograms();
181
182 Bool_t ProcessTofMs(const fles::Timeslice& ts, size_t uMsComp, UInt_t uMsIdx);
183
184 void FillTofEpochCycle(uint64_t ulCycleData);
187 /****************** TOF Sync ******************************************/
188
189 /****************** mCBM Sync *****************************************/
191
192 std::vector<TH2*> fvhMcbmTimeDiffToSelDpb;
194 std::vector<TH2*> fvhMcbmTimeDiffToSelDpbTs;
195
199
200 std::vector<TH2*> fvhMcbmTimeDiffToTofEvoDpb;
203
204
206 /****************** mCBM Sync *****************************************/
207
208
211
213};
214
215#endif // CBMMCBM2018MONITORMCBMPULSER_H
Histogram manager.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< std::vector< stsxyter::FinalHit > > fvmStsSdpbHitsInTs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
Bool_t ProcessTofMs(const fles::Timeslice &ts, size_t uMsComp, UInt_t uMsIdx)
void SetUseBestPair(Bool_t bInFLag=kTRUE)
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
CbmMcbm2018MonitorMcbmPulser operator=(const CbmMcbm2018MonitorMcbmPulser &)
std::map< UInt_t, UInt_t > fmStsDpbIdIndexMap
Total number of Sts DPBs in system.
std::vector< UInt_t > fvuStsCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< std::vector< gdpbv100::Message > > fvmTofEpSupprBuffer
Buffer for suppressed epoch processing.
virtual void SetNbMsInTs(size_t uCoreMsNb, size_t uOverlapMsNb)
void FillStsEpochInfo(stsxyter::Message mess)
std::vector< std::vector< gdpbv100::FullMessage > > fvmTofGdpbHitsInMs
Buffer for system sync check.
uint64_t fulTofCurrentTsIndex
Running indices.
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondTsEvoDpb
std::vector< std::vector< stsxyter::FinalHit > > fvmStsSdpbHitsInMs
Current TS MSB cycle for DPB.
UInt_t fuMuchDpbIdx
Map of DPB Identifier to DPB index.
virtual void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void SetStsTofOffsetNs(Double_t dOffsetIn=0.0)
void FillStsTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
void SetIgnoreMsOverlap(Bool_t bIgnoreOver=kTRUE)
stsxyter::MessagePrintMask fPrintMessCtrlSts
std::vector< ULong64_t > fvulStsCurrentTsMsb
Bin size in s for the plots with date as X axis.
void SetMsOverlap(size_t uOverlapMsNb=1)
CbmMcbm2018TofPar * fUnpackParTof
Unpacking and mapping parameters for TOF.
std::vector< ULong64_t > fvulTofCurrentEpochFull
std::map< UInt_t, UInt_t > fmTofDpbIdIndexMap
Total number of GDPBs in the system.
void SetHistoFileName(TString sFileName="data/SetupHistos.root")
void SetTsLevelAna(Bool_t bInFLag=kTRUE)
void SetMuchTofOffsetNs(Double_t dOffsetIn=0.0)
void SavePulserHistos(TString sFileName="")
std::vector< ULong64_t > fvulTofCurrentEpochCycle
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
static const UInt_t kuTofBytesPerMessage
TODO => move to the message class!!
void CreateStsHistograms()
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
std::vector< std::vector< gdpbv100::FullMessage > > fvmTofGdpbHitsInTs
std::vector< TH2 * > fvhMcbmTimeDiffToDiamondWideEvoDpb
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
CbmMcbm2018MonitorMcbmPulser(const CbmMcbm2018MonitorMcbmPulser &)
void FillStsHitInfo(stsxyter::Message mess, const UInt_t &uMsIdx)
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)
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
MessagePrintMask
Printout control.