CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018MonitorStsPulser.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// ----- CbmCosy2018MonitorPulser -----
8// ----- Created 11/05/18 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CBMCOSY2018MONITORPULSER_H
13#define CBMCOSY2018MONITORPULSER_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 "CbmTSUnpack.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
36class CbmCosy2018MonitorPulser : public CbmTSUnpack {
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 void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize = 5);
56
57 void ResetAllHistos();
58 void SaveAllHistos(TString sFileName = "");
59 void SetHistoFileName(TString sFileName = "data/SetupHistos.root") { fsHistoFileFullname = sFileName; }
60
61 void SetMsOverlap(size_t uOverlapMsNb = 1) { fuOverlapMsNb = uOverlapMsNb; }
62 size_t GetMsOverlap() { return fuOverlapMsNb; }
63
71 void SetLongDurationLimits(UInt_t uDurationSeconds = 3600, UInt_t uBinSize = 1);
72 void SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal);
73
74 void UseDaqBuffer(Bool_t) {};
75
76private:
79 // Parameters
80 CbmCern2017UnpackParHodo* fUnpackParHodo;
81 UInt_t fuNrOfDpbs;
82 std::map<UInt_t, UInt_t> fDpbIdIndexMap;
86 std::vector<std::vector<UInt_t>>
88
89 // Constants
90 static const Int_t kiMaxNbFlibLinks = 16;
91 static const UInt_t kuBytesPerMessage = 4;
92
93 // Internal Control/status of monitor
94 // Histo File name and path
96 // Task configuration values
99 // TS/MS info
102 // Current data properties
103 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
105 UInt_t fuCurrDpbId;
109
110 // Data format control
111 std::vector<ULong64_t> fvulCurrentTsMsb;
112 std::vector<UInt_t> fvuCurrentTsMsbCycle;
113 std::vector<UInt_t> fvuElinkLastTsHit;
114 // Hits comparison
115 std::vector<std::vector<ULong64_t>> fvulChanLastHitTime;
116 std::vector<std::vector<Double_t>> fvdChanLastHitTime;
117 std::vector<Double_t> fvdMsTime;
118 std::vector<std::vector<std::vector<UInt_t>>> fvuChanNbHitsInMs;
119 std::vector<std::vector<std::vector<Double_t>>>
121 std::vector<std::vector<std::vector<UShort_t>>>
123 // std::vector< std::vector< std::multiset< stsxyter::FinalHit > > > fvmChanHitsInTs; //! All hits (time & ADC) in bins in last TS for each Channel
124 // Starting state book-keeping
125 Double_t fdStartTime;
127 std::chrono::steady_clock::time_point
130 // Hits time-sorting
131 std::vector<stsxyter::FinalHit>
133 std::vector<std::vector<stsxyter::FinalHit>>
135 // Coincidence histos
137 // Rate evolution histos
142
143 // Coincidences in sorted hits
144 Double_t fdCoincCenter; // ns
145 Double_t fdCoincBorder; // ns, +/-
146 Double_t fdCoincMin; // ns
147 Double_t fdCoincMax; // ns
148
149 // Histograms
155 /*
156 TH2* fhStsDpbRawTsMsb;
157 TH2* fhStsDpbRawTsMsbSx;
158 TH2* fhStsDpbRawTsMsbDpb;
159*/
162
163 std::vector<TH1*> fhPulserChanCntRaw;
164 std::vector<TH1*> fhPulserChanCntRawGood;
165 std::vector<TH2*> fhPulserChanAdcRaw;
166 std::vector<TProfile*> fhPulserChanAdcRawProf;
167 std::vector<TH2*> fhPulserChanRawTs;
168 std::vector<TH2*> fhPulserChanMissEvt;
169 std::vector<TH2*> fhPulserChanMissEvtEvo;
170 std::vector<TH2*> fhPulserChanHitRateEvo;
171 std::vector<TH1*> fhPulserFebRateEvo;
172 std::vector<TH1*> fhPulserFebMissEvtEvo;
173 std::vector<TH2*> fhPulserChanHitRateEvoLong;
174 std::vector<TH1*> fhPulserFebRateEvoLong;
175
176 TCanvas* fcMsSizeAll;
179
181 Double_t fdStartTs;
182 std::vector<stsxyter::FinalHit> fvmLastHitAsic;
183 std::vector<TH2*> fhPulserTimeDiffPerAsic;
184 std::vector<std::vector<TH1*>> fhPulserTimeDiffPerAsicPair;
185 std::vector<std::vector<TH2*>> fhPulserTimeDiffEvoPerAsicPair;
186 std::vector<std::vector<TH2*>> fhPulserTsLsbMatchPerAsicPair;
187 std::vector<std::vector<TH2*>> fhPulserTsMsbMatchPerAsicPair;
188 std::vector<TH1*> fhPulserIntervalAsic;
189 std::vector<TH1*> fhPulserIntervalLongAsic;
190
191 void CreateHistograms();
192
193 void FillHitInfo(stsxyter::Message mess, const UShort_t& usElinkIdx, const UInt_t& uAsicIdx, const UInt_t& uMsIdx);
194 void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
196
199
200 ClassDef(CbmCosy2018MonitorPulser, 1)
201};
202
203#endif // CBMCOSY2018MONITORPULSER_H
Histogram manager.
std::vector< UInt_t > fvuElinkLastTsHit
Current TS MSB cycle for DPB.
Double_t fdStartTime
Last hit ADC in bins in each MS for each Channel.
UInt_t fuNbChanPerAsic
Number of StsXyter ASICs.
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
stsxyter::MessagePrintMask fPrintMessCtrl
CbmCern2017UnpackParHodo * fUnpackParHodo
std::vector< std::vector< TH1 * > > fhPulserTimeDiffPerAsicPair
std::vector< TH2 * > fhPulserChanMissEvtEvo
virtual Bool_t DoUnpack(const fles::Timeslice &ts, size_t component)
std::vector< std::vector< TH2 * > > fhPulserTsLsbMatchPerAsicPair
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of Sts DPBs in system.
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
CbmCosy2018MonitorPulser(const CbmCosy2018MonitorPulser &)
std::vector< TH1 * > fhPulserChanCntRawGood
std::vector< Double_t > fvdMsTime
Last hit time in ns for each Channel.
std::chrono::steady_clock::time_point ftStartTimeUnix
std::vector< TH1 * > fhPulserIntervalLongAsic
std::vector< std::vector< ULong64_t > > fvulChanLastHitTime
TS from last hit for DPB.
void FillEpochInfo(stsxyter::Message mess)
void SetCoincidenceBorder(Double_t dCenterPos, Double_t dBorderVal)
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
void SetLongDurationLimits(UInt_t uDurationSeconds=3600, UInt_t uBinSize=1)
std::vector< ULong64_t > fvulCurrentTsMsb
Bin size in s for the plots with date as X axis.
std::vector< TH2 * > fhPulserTimeDiffPerAsic
Last hits in each ASIC.
std::vector< std::vector< TH2 * > > fhPulserTsMsbMatchPerAsicPair
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
void SetRunStart(Int_t dateIn, Int_t timeIn, Int_t iBinSize=5)
std::vector< std::vector< stsxyter::FinalHit > > fvmAsicHitsInTs
All hits (time in bins, ADC in bins, asic, channel) in last TS, sorted with "<" operator.
std::vector< stsxyter::FinalHit > fvmLastHitAsic
Last hits in each ASIC.
Double_t fdStartTs
Pulser time difference histos.
std::vector< TH2 * > fhPulserChanHitRateEvoLong
std::vector< std::vector< UInt_t > > fvuElinkToAsic
Number of channels per StsXyter ASIC => should be constant somewhere!!!!
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< TH1 * > fhPulserFebRateEvoLong
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< stsxyter::FinalHit > fvmHitsInTs
std::vector< std::vector< TH2 * > > fhPulserTimeDiffEvoPerAsicPair
std::vector< std::vector< Double_t > > fvdChanLastHitTime
Last hit time in bins for each Channel.
std::vector< TProfile * > fhPulserChanAdcRawProf
UInt_t fuNbElinksPerDpb
Map of DPB Identifier to DPB index.
UInt_t fuMaxNbMicroslices
All hits (time in bins, ADC in bins, asic, channel) in last TS, per ASIC, sorted with "<" operator.
CbmCosy2018MonitorPulser operator=(const CbmCosy2018MonitorPulser &)
void FillTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< std::vector< std::vector< Double_t > > > fvdChanLastHitTimeInMs
Number of hits in each MS for each Channel.
void SetPrintMessage(Bool_t bPrintMessOn=kTRUE, stsxyter::MessagePrintMask ctrl=stsxyter::MessagePrintMask::msg_print_Hex|stsxyter::MessagePrintMask::msg_print_Human)
void SetHistoFileName(TString sFileName="data/SetupHistos.root")
TProfile * fhMsSzTime[kiMaxNbFlibLinks]
void SetMsOverlap(size_t uOverlapMsNb=1)
std::vector< std::vector< std::vector< UShort_t > > > fvusChanLastHitAdcInMs
Last hit time in bins in each MS for each Channel.
UInt_t fuNbStsXyters
Number of possible eLinks per DPB.
static const Int_t kiMaxNbFlibLinks
Vector holding for each link the corresponding ASIC index [fuNrOfDpbs * fuNbElinksPerDpb].
std::vector< TH2 * > fhPulserChanHitRateEvo
std::vector< std::vector< std::vector< UInt_t > > > fvuChanNbHitsInMs
Header time of each MS.
TH1 * fhPulserMessType
Histogram manager.
void SaveAllHistos(TString sFileName="")
Histogram manager.
MessagePrintMask
Printout control.