CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018UnpackerAlgoMuch.h
Go to the documentation of this file.
1/* Copyright (C) 2019-2020 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// ----- CbmMcbm2018UnpackerAlgoMuch -----
8// ----- Created 02.02.2019 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CbmMcbm2018UnpackerAlgoMuch_H
13#define CbmMcbm2018UnpackerAlgoMuch_H
14
15#include "CbmStar2019Algo.h"
16
17// Data
18#include "CbmMuchBeamTimeDigi.h"
19
20#include "StsXyterFinalHit.h"
21#include "StsXyterMessage.h"
22
23// CbmRoot
24
25// C++11
26#include <chrono>
27
28// C/C++
29#include <map>
30#include <vector>
31
33/*
34class TCanvas;
35class THttpServer;
36*/
37class TH1;
38class TH2;
39class TProfile;
40
41class CbmMcbm2018UnpackerAlgoMuch : public CbmStar2019Algo<CbmMuchBeamTimeDigi> {
42public:
45
46 virtual Bool_t Init();
47 virtual void Reset();
48 virtual void Finish();
49
50 Bool_t InitContainers();
51 Bool_t ReInitContainers();
52 TList* GetParList();
53
54 Bool_t InitParameters();
55
56 Bool_t ProcessTs(const fles::Timeslice& ts);
57 Bool_t ProcessTs(const fles::Timeslice& ts, size_t /*component*/) { return ProcessTs(ts); }
58 Bool_t ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx);
59
60 void AddMsComponentToList(size_t component, UShort_t usDetectorId);
61
62 Bool_t CreateHistograms();
63 Bool_t FillHistograms();
64 Bool_t ResetHistograms();
65
66 inline void SetMonitorMode(Bool_t bFlagIn = kTRUE) { fbMonitorMode = bFlagIn; }
67 inline void SetTimeOffsetNs(Double_t dOffsetIn = 0.0) { fdTimeOffsetNs = dOffsetIn; }
68 void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn = 0.0);
69 void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked = kTRUE);
70 void EnableAsicType(Int_t flag = 0) { fiFlag = flag; }
71
73 void SetBinningFwFlag(Bool_t bEnable = kTRUE) { fbBinningFw = bEnable; }
74
75 inline void SetVectCapInc(Double_t dIncFact) { fdCapacityIncFactor = dIncFact; }
76
77 void SetAdcCut(UInt_t uAdc) { fdAdcCut = uAdc; }
78
79
81
82
83private:
87 std::vector<Bool_t> fvbMaskedComponents;
89 Bool_t fbBinningFw = kFALSE;
90
91 Int_t fiFlag;
92
96 UInt_t fuNrOfDpbs;
97 std::map<UInt_t, UInt_t> fDpbIdIndexMap;
98 std::vector<std::vector<Bool_t>>
100 UInt_t fuNbFebs;
102
105 std::vector<Double_t> fvdTimeOffsetNsAsics;
106 //std::vector< Int_t > fviFebAddress; //! Much address for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ]
107
109 std::vector<std::vector<bool>>
111 UInt_t fdAdcCut;
113 static const Int_t kiMaxNbFlibLinks = 32;
114
119 Double_t fdTsStartTime;
121 Double_t fdMsTime;
122 UInt_t fuMsIndex;
124 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
126 UInt_t fuCurrDpbId;
131 std::vector<ULong64_t> fvulCurrentTsMsb;
132 std::vector<UInt_t> fvuCurrentTsMsbCycle;
134 Double_t fdStartTime;
136 std::chrono::steady_clock::time_point
140 std::vector<stsxyter::FinalHit>
142
144 static const UInt_t kuMaxTsMsbDiffDuplicates =
145 32;
146 std::vector<std::vector<UShort_t>> fvvusLastTsChan;
147 std::vector<std::vector<UShort_t>>
149 std::vector<std::vector<UShort_t>>
151 std::vector<std::vector<UShort_t>>
153
156 /*
157 std::vector< TH1* > fvhHitsTimeToTriggerRaw; //! [sector]
158 std::vector< TH1* > fvhMessDistributionInMs; //! [sector], extra monitor for debug
159 TH1 * fhEventNbPerTs; //!
160 TCanvas * fcTimeToTrigRaw; //! All sectors
161*/
162 TH1* fhVectorSize = nullptr;
163 TH1* fhVectorCapacity = nullptr;
165 Double_t fdCapacityIncFactor = 1.1;
166
167 void ProcessHitInfo(const stsxyter::Message& mess, const UShort_t& usElinkIdx, const UInt_t& uAsicIdx,
168 const UInt_t& uMsIdx);
169 void ProcessTsMsbInfo(const stsxyter::Message& mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
170 void ProcessEpochInfo(const stsxyter::Message& mess);
171 void ProcessStatusInfo(const stsxyter::Message& mess, const UInt_t& uAsicIdx);
172
175
176 ClassDef(CbmMcbm2018UnpackerAlgoMuch, 1)
177};
178
179#endif
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of STS DPBs in system.
CbmMcbm2018UnpackerAlgoMuch operator=(const CbmMcbm2018UnpackerAlgoMuch &)
std::vector< std::vector< UShort_t > > fvvusLastTsChan
Limit how many different TS_MSB are checked for same duplicate hit => set to 1 uS.
std::chrono::steady_clock::time_point ftStartTimeUnix
CbmMuchBeamTimeDigi * CreateMuchDigi(stsxyter::FinalHit *)
void ProcessTsMsbInfo(const stsxyter::Message &mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
CbmMcbm2018MuchPar * fUnpackPar
Switch to smx2.0/smx2.1 data-> fiFlag = 0 for 2.0 and fiFlag = 1 for 2.1.
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
Bool_t fbBinningFw
=> Quick and dirty hack for binning FW!!!
void SetBinningFwFlag(Bool_t bEnable=kTRUE)
=> Quick and dirty hack for binning FW!!!
void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
UInt_t fuNbFebs
Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ].
std::vector< std::vector< UShort_t > > fvvusLastTsMsbChan
ADC of last hit message for each channel, [ AsicIdx ][ Chan ].
Double_t fdTimeOffsetNs
Number of StsXyter ASICs.
std::vector< std::vector< UShort_t > > fvvusLastTsMsbCycleChan
TS MSB of last hit message for each channel, [ AsicIdx ][ Chan ].
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
static const Int_t kiMaxNbFlibLinks
Constants.
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
UInt_t fuNbStsXyters
Number of FEBs with StsXyter ASICs.
std::vector< std::vector< Bool_t > > fvbCrobActiveFlag
Map of DPB Identifier to DPB index.
std::vector< std::vector< bool > > fvvbMaskedChannels
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
Bool_t ProcessTs(const fles::Timeslice &ts)
std::vector< Double_t > fvdTimeOffsetNsAsics
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
void ProcessStatusInfo(const stsxyter::Message &mess, const UInt_t &uAsicIdx)
UInt_t fdAdcCut
Vector of channel masks, [ NbFeb ][ NbCHanInFeb ], used only if fbUseChannelMask is true.
Bool_t ProcessTs(const fles::Timeslice &ts, size_t)
TH1 * fhDigisTimeInRun
TS MSB cycle of last hit message for each channel, [ AsicIdx ][ Chan ].
std::vector< std::vector< UShort_t > > fvvusLastAdcChan
TS of last hit message for each channel, [ AsicIdx ][ Chan ].
CbmMcbm2018UnpackerAlgoMuch(const CbmMcbm2018UnpackerAlgoMuch &)
void ProcessHitInfo(const stsxyter::Message &mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
void ProcessEpochInfo(const stsxyter::Message &mess)
static const UInt_t kuMaxTsMsbDiffDuplicates
All hits (time in bins, ADC in bins, asic, channel) in last MS, sorted with "<" operator.
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
Double_t fdMsTime
End Time in ns of current TS Core from the index of the first MS first component.
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
std::vector< ULong64_t > fvulCurrentTsMsb