CbmRoot
Loading...
Searching...
No Matches
CbmMcbm2018UnpackerAlgoSts.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// ----- CbmMcbm2018UnpackerAlgoSts -----
8// ----- Created 26.01.2019 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CbmMcbm2018UnpackerAlgoSts_H
13#define CbmMcbm2018UnpackerAlgoSts_H
14
15#include "CbmStar2019Algo.h"
16
17// Data
18#include "CbmStsDigi.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;
40class TProfile2D;
41
42class CbmMcbm2018UnpackerAlgoSts : public CbmStar2019Algo<CbmStsDigi> {
43public:
46
47 virtual Bool_t Init();
48 virtual void Reset();
49 virtual void Finish();
50
51 Bool_t InitContainers();
52 Bool_t ReInitContainers();
53 TList* GetParList();
54
55 Bool_t InitParameters();
56
57 std::vector<CbmStsDigi>& GetPulserVector() { return fPulserDigiVect; }
59
60 Bool_t ProcessTs(const fles::Timeslice& ts);
61 Bool_t ProcessTs(const fles::Timeslice& ts, size_t /*component*/) { return ProcessTs(ts); }
62 Bool_t ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx);
63
64 void AddMsComponentToList(size_t component, UShort_t usDetectorId);
65
66 Bool_t CreateHistograms();
67 Bool_t FillHistograms();
68 Bool_t ResetHistograms();
69
70 inline void SetMonitorMode(Bool_t bFlagIn = kTRUE) { fbMonitorMode = bFlagIn; }
71 inline void SetTimeOffsetNs(Double_t dOffsetIn = 0.0) { fdTimeOffsetNs = dOffsetIn; }
72 void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn = 0.0);
73 void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked = kTRUE);
74 void SetAdcCut(UInt_t uAdc) { fdAdcCut = uAdc; }
75
77 void SetBinningFwFlag(Bool_t bEnable = kTRUE) { fbBinningFw = bEnable; }
78
79 inline void SetVectCapInc(Double_t dIncFact) { fdCapacityIncFactor = dIncFact; }
80
81 void SeparatePulserOutput(Bool_t bFlagIn) { fbPulserOutput = bFlagIn; }
82
83private:
87 std::vector<Bool_t> fvbMaskedComponents;
89 Bool_t fbBinningFw = kFALSE;
90 Bool_t fbPulserOutput = kTRUE;
91
95 UInt_t fuNbModules;
96 std::vector<Int_t>
98 std::vector<Int_t> fviModAddress;
99 UInt_t fuNrOfDpbs;
100 std::map<UInt_t, UInt_t> fDpbIdIndexMap;
101 std::vector<std::vector<Bool_t>>
103 UInt_t fuNbFebs;
105 std::vector<std::vector<std::vector<Int_t>>>
107 std::vector<std::vector<std::vector<Int_t>>>
109 std::vector<std::vector<std::vector<Int_t>>>
111 std::vector<bool> fvbFebPulser = {};
112 std::vector<Int_t> fviFebAddress;
113 std::vector<Int_t> fviFebSide;
114 std::vector<Double_t> fvdFebAdcGain;
115 std::vector<Double_t> fvdFebAdcOffs;
116
119 std::vector<Double_t> fvdTimeOffsetNsAsics;
121 std::vector<std::vector<bool>>
123 UInt_t fdAdcCut;
124
126 static const Int_t kiMaxNbFlibLinks = 32;
127
132 Double_t fdTsStartTime;
134 Double_t fdMsTime;
135 UInt_t fuMsIndex;
137 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
139 UInt_t fuCurrDpbId;
144 std::vector<ULong64_t> fvulCurrentTsMsb;
145 std::vector<UInt_t> fvuCurrentTsMsbCycle;
147 Double_t fdStartTime;
149 std::chrono::steady_clock::time_point
153 std::vector<stsxyter::FinalHit>
155
157 std::vector<CbmStsDigi> fPulserDigiVect = {};
158
160 static const UInt_t kuMaxTsMsbDiffDuplicates = 8;
161 std::vector<std::vector<UShort_t>> fvvusLastTsChan;
162 std::vector<std::vector<UShort_t>>
164 std::vector<std::vector<UShort_t>>
166 std::vector<std::vector<UShort_t>>
168
171 /*
172 std::vector< TH1* > fvhHitsTimeToTriggerRaw; //! [sector]
173 std::vector< TH1* > fvhMessDistributionInMs; //! [sector], extra monitor for debug
174 TH1 * fhEventNbPerTs; //!
175 TCanvas * fcTimeToTrigRaw; //! All sectors
176*/
177 TH1* fhVectorSize = nullptr;
178 TH1* fhVectorCapacity = nullptr;
180 Double_t fdCapacityIncFactor = 1.1;
181
182
183 TH1* fhMsCntEvo = nullptr;
184 TH2* fhMsErrorsEvo = nullptr;
185
186 /*
187 TProfile2D* fhPulserVsTsAB = nullptr;
188 UShort_t fusTsA = 0.0;
189 Double_t fdTimeA = 0.0;
190*/
191 void ProcessHitInfo(const stsxyter::Message& mess, const UShort_t& usElinkIdx, const UInt_t& uAsicIdx,
192 const UInt_t& uMsIdx);
193 void ProcessTsMsbInfo(const stsxyter::Message& mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
194 void ProcessEpochInfo(const stsxyter::Message& mess);
195 void ProcessStatusInfo(const stsxyter::Message& mess, const UInt_t& uAsicIdx);
196
199
200 ClassDef(CbmMcbm2018UnpackerAlgoSts, 1)
201};
202
203#endif
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
std::vector< std::vector< UShort_t > > fvvusLastTsChan
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
CbmMcbm2018UnpackerAlgoSts operator=(const CbmMcbm2018UnpackerAlgoSts &)
Bool_t fbBinningFw
=> Quick and dirty hack for binning FW!!!
std::vector< Double_t > fvdFebAdcOffs
ADC gain in e-/b, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
std::vector< Int_t > fviFebAddress
Pulser flag for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
std::vector< CbmStsDigi > fPulserDigiVect
All hits (time in bins, ADC in bins, asic, channel) in last MS, sorted with "<" operator.
std::vector< CbmStsDigi > & GetPulserVector()
UInt_t fuNbFebs
Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ].
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
std::vector< Double_t > fvdFebAdcGain
Module side for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
TH1 * fhDigisTimeInRun
TS MSB cycle of last hit message for each channel, [ AsicIdx ][ Chan ].
void SetBinningFwFlag(Bool_t bEnable=kTRUE)
=> Quick and dirty hack for binning FW!!!
Int_t fiRunStartDateTimeSec
Index of the DPB from which the MS currently unpacked is coming.
std::vector< Int_t > fviModuleType
Total number of STS modules in the setup.
std::vector< UInt_t > fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
void ProcessEpochInfo(const stsxyter::Message &mess)
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
std::vector< Int_t > fviFebSide
STS address for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
std::vector< std::vector< std::vector< Int_t > > > fviFebModuleIdx
Number of StsXyter ASICs.
std::vector< Int_t > fviModAddress
Type of each module: 0 for connectors on the right, 1 for connectors on the left.
UInt_t fuNbStsXyters
Number of FEBs with StsXyter ASICs.
std::vector< std::vector< UShort_t > > fvvusLastTsMsbCycleChan
TS MSB of last hit message for each channel, [ AsicIdx ][ Chan ].
void ProcessHitInfo(const stsxyter::Message &mess, const UShort_t &usElinkIdx, const UInt_t &uAsicIdx, const UInt_t &uMsIdx)
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
std::vector< std::vector< Bool_t > > fvbCrobActiveFlag
Map of DPB Identifier to DPB index.
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
void ProcessStatusInfo(const stsxyter::Message &mess, const UInt_t &uAsicIdx)
Bool_t ProcessTs(const fles::Timeslice &ts, size_t)
void ProcessTsMsbInfo(const stsxyter::Message &mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< std::vector< UShort_t > > fvvusLastTsMsbChan
ADC of last hit message for each channel, [ AsicIdx ][ Chan ].
std::vector< std::vector< std::vector< Int_t > > > fviFebType
STS module side for each FEB, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = P, 1 = N,...
std::vector< ULong64_t > fvulCurrentTsMsb
std::map< UInt_t, UInt_t > fDpbIdIndexMap
Total number of STS DPBs in system.
static const UInt_t kuMaxTsMsbDiffDuplicates
Duplicate hits suppression.
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
std::chrono::steady_clock::time_point ftStartTimeUnix
std::vector< std::vector< bool > > fvvbMaskedChannels
UInt_t fuNrOfDpbs
STS address for the first strip of each module.
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
Double_t fdMsTime
End Time in ns of current TS Core from the index of the first MS first component.
CbmMcbm2018StsPar * fUnpackPar
If ON a separate output vector of digi is used for the pulser.
void SetVectCapInc(Double_t dIncFact)
UInt_t fdAdcCut
Vector of channel masks, [ NbFeb ][ NbCHanInFeb ], used only if fbUseChannelMask is true.
std::vector< bool > fvbFebPulser
FEB type, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = A, 1 = B, -1 if inactive.
std::vector< Double_t > fvdTimeOffsetNsAsics
Double_t fdTimeOffsetNs
ADC offset in e-, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ].
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
static const Int_t kiMaxNbFlibLinks
Constants.
void SetTimeOffsetNsAsic(UInt_t uAsicIdx, Double_t dOffsetIn=0.0)
UInt_t fuCurrDpbIdx
Temp holder until Current equipment ID is properly filled in MS.
std::vector< std::vector< UShort_t > > fvvusLastAdcChan
TS of last hit message for each channel, [ AsicIdx ][ Chan ].
Bool_t ProcessTs(const fles::Timeslice &ts)
std::vector< std::vector< std::vector< Int_t > > > fviFebModuleSide
Idx of the STS module for each FEB, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], -1 if inactive.
void MaskNoisyChannel(UInt_t uFeb, UInt_t uChan, Bool_t bMasked=kTRUE)
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
CbmMcbm2018UnpackerAlgoSts(const CbmMcbm2018UnpackerAlgoSts &)