CbmRoot
Loading...
Searching...
No Matches
CbmCosy2019MonitorAlgoHodo.h
Go to the documentation of this file.
1/* Copyright (C) 2019-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau, Florian Uhlig [committer] */
4
5// -----------------------------------------------------------------------------
6// ----- -----
7// ----- CbmCosy2019MonitorAlgoHodo -----
8// ----- Created 03.07.2019 by P.-A. Loizeau -----
9// ----- -----
10// -----------------------------------------------------------------------------
11
12#ifndef CbmCosy2019MonitorAlgoHodo_H
13#define CbmCosy2019MonitorAlgoHodo_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// ROOT
26#include "TCanvas.h"
27#include "TH1.h"
28#include "TH2.h"
29
30// C++11
31#include <chrono>
32
33// C/C++
34#include <map>
35#include <vector>
36
37class TProfile;
38
39class CbmCosy2019MonitorAlgoHodo : public CbmStar2019Algo<CbmStsDigi> {
40public:
43
44 virtual Bool_t Init();
45 virtual void Reset();
46 virtual void Finish();
47
48 Bool_t InitContainers();
49 Bool_t ReInitContainers();
50 TList* GetParList();
51
52 Bool_t InitParameters();
53
54 Bool_t ProcessTs(const fles::Timeslice& ts);
55 Bool_t ProcessTs(const fles::Timeslice& ts, size_t /*component*/) { return ProcessTs(ts); }
56 Bool_t ProcessMs(const fles::Timeslice& ts, size_t uMsCompIdx, size_t uMsIdx);
57
58 void AddMsComponentToList(size_t component, UShort_t usDetectorId);
59
60 Bool_t CreateHistograms();
61 Bool_t FillHistograms();
62 Bool_t ResetHistograms();
63
64 inline void SetMonitorMode(Bool_t bFlagIn = kTRUE) { fbMonitorMode = bFlagIn; }
65 inline void SetTimeOffsetNs(Double_t dOffsetIn = 0.0) { fdTimeOffsetNs = dOffsetIn; }
66
67 inline void SetDpbId(UInt_t uDpbId = 0x5b75) { fuDpbId = uDpbId; }
68 inline void SetHodoElinkIdx(UInt_t uElinkHodoA = 5, UInt_t uElinkHodoB = 10)
69 {
70 fvuElinkIdxHodo[0] = uElinkHodoA;
71 fvuElinkIdxHodo[1] = uElinkHodoB;
72 }
73 inline void SetHodoSwapXY(Bool_t bSwapHodoA = kFALSE, Bool_t bSwapHodoB = kTRUE)
74 {
75 fvbHodoSwapXY[0] = bSwapHodoA;
76 fvbHodoSwapXY[1] = bSwapHodoB;
77 }
78 inline void SetHodoInvertX(Bool_t bInvHodoA = kFALSE, Bool_t bInvHodoB = kTRUE)
79 {
80 fvbHodoInvertX[0] = bInvHodoA;
81 fvbHodoInvertX[1] = bInvHodoB;
82 }
83 inline void SetHodoInvertY(Bool_t bInvHodoA = kFALSE, Bool_t bInvHodoB = kTRUE)
84 {
85 fvbHodoInvertY[0] = bInvHodoA;
86 fvbHodoInvertY[1] = bInvHodoB;
87 }
88
89private:
93 std::vector<Bool_t> fvbMaskedComponents;
94
96 /*
97 CbmCosy2019HodoPar* fUnpackPar; //!
99 UInt_t fuNbModules; //! Total number of STS modules in the setup
100 std::vector< Int_t > fviModuleType; //! Type of each module: 0 for connectors on the right, 1 for connectors on the left
101 std::vector< Int_t > fviModAddress; //! STS address for the first strip of each module
102 UInt_t fuNrOfDpbs; //! Total number of STS DPBs in system
103 std::map<UInt_t, UInt_t> fDpbIdIndexMap; //! Map of DPB Identifier to DPB index
104 std::vector< std::vector< Bool_t > > fvbCrobActiveFlag; //! Array to hold the active flag for all CROBs, [ NbDpb ][ NbCrobPerDpb ]
105 UInt_t fuNbFebs; //! Number of FEBs with HodoXyter ASICs
106 UInt_t fuNbStsXyters; //! Number of StsXyter ASICs
107 std::vector< std::vector< std::vector< Int_t > > > fviFebModuleIdx; //! Idx of the STS module for each FEB, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], -1 if inactive
108 std::vector< std::vector< std::vector< Int_t > > > fviFebModuleSide; //! STS module side for each FEB, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = P, 1 = N, -1 if inactive
109 std::vector< std::vector< std::vector< Int_t > > > fviFebType; //! FEB type, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ], 0 = A, 1 = B, -1 if inactive
110 std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcGain; //! ADC gain in e-/b, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ]
111 std::vector< std::vector< std::vector< Double_t > > > fvdFebAdcOffs; //! ADC offset in e-, [ NbDpb ][ NbCrobPerDpb ][ NbFebsPerCrob ]
112 std::vector< Int_t > fviFebAddress; //! STS address for each FEB, [ NbDpb * NbCrobPerDpb * NbFebsPerCrob ]
113*/
114 UInt_t fuDpbId;
115 std::vector<UInt_t> fvuElinkIdxHodo;
116 std::vector<Bool_t> fvbHodoSwapXY;
117 std::vector<Bool_t> fvbHodoInvertX;
118 std::vector<Bool_t> fvbHodoInvertY;
119 std::vector<UInt_t> fvuAdcGainHodo;
120 std::vector<UInt_t> fvuAdcOffsHodo;
121
124
126 static const Int_t kiMaxNbFlibLinks = 32;
127 static const UInt_t kuBytesPerMessage = 4;
128 static const UInt_t kuNbElinksDpb = 2 * 42;
129 static const UInt_t kuNbHodos = 2;
130 static const UInt_t kuNbAxis = 2;
131 static const UInt_t kuNbChanPerAsic = 128;
132 /*
133 const UInt_t kuChannelToFiberMap[ kuNbChanPerAsic ] = {
134 0, 32, 16, 48, 15, 47, 31, 63, 1, 33, 17, 49, 14, 46, 30, 62,
135 2, 34, 18, 50, 13, 45, 29, 61, 3, 35, 19, 51, 12, 44, 28, 60,
136 4, 36, 20, 52, 11, 43, 27, 59, 5, 37, 21, 53, 10, 42, 26, 58,
137 6, 38, 22, 54, 9, 41, 25, 57, 7, 39, 23, 55, 8, 40, 24, 56,
138 0, 32, 16, 48, 15, 47, 31, 63, 1, 33, 17, 49, 14, 46, 30, 62,
139 2, 34, 18, 50, 13, 45, 29, 61, 3, 35, 19, 51, 12, 44, 28, 60,
140 4, 36, 20, 52, 11, 43, 27, 59, 5, 37, 21, 53, 10, 42, 26, 58,
141 6, 38, 22, 54, 9, 41, 25, 57, 7, 39, 23, 55, 8, 40, 24, 56
142 }; //! Map from channel index to Hodoscope Fiber
143*/
144 const UInt_t kuChannelToFiberMap[kuNbChanPerAsic] = {32, 0, 48, 16, 47, 15, 63, 31, 33, 1, 49, 17, 46, 14, 62,
145 30, 34, 2, 50, 18, 45, 13, 61, 29, 35, 3, 51, 19, 44, 12,
146 60, 28, 36, 4, 52, 20, 43, 11, 59, 27, 37, 5, 53, 21, 42,
147 10, 58, 26, 38, 6, 54, 22, 41, 9, 57, 25, 39, 7, 55, 23,
148 40, 8, 56, 24, 32, 0, 48, 16, 47, 15, 63, 31, 33, 1, 49,
149 17, 46, 14, 62, 30, 34, 2, 50, 18, 45, 13, 61, 29, 35, 3,
150 51, 19, 44, 12, 60, 28, 36, 4, 52, 20, 43, 11, 59, 27, 37,
151 5, 53, 21, 42, 10, 58, 26, 38, 6, 54, 22, 41, 9, 57, 25,
152 39, 7, 55, 23, 40, 8, 56, 24};
153 const UInt_t kuChannelToPixelMap[kuNbChanPerAsic] = {1, 5, 3, 7, 2, 6, 4, 8, 9, 13, 11, 15, 10, 14, 12,
154 16, 17, 21, 19, 23, 18, 22, 20, 24, 25, 29, 27, 31, 26, 30,
155 28, 32, 33, 37, 35, 39, 34, 38, 36, 40, 41, 45, 43, 47, 42,
156 46, 44, 48, 49, 53, 51, 55, 50, 54, 52, 56, 57, 61, 59, 63,
157 58, 62, 60, 64, 1, 5, 3, 7, 2, 6, 4, 8, 9, 13, 11,
158 15, 10, 14, 12, 16, 17, 21, 19, 23, 18, 22, 20, 24, 25, 29,
159 27, 31, 26, 30, 28, 32, 33, 37, 35, 39, 34, 38, 36, 40, 41,
160 45, 43, 47, 42, 46, 44, 48, 49, 53, 51, 55, 50, 54, 52, 56,
161 57, 61, 59, 63, 58, 62, 60, 64};
163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
165 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
166 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
167
172 Double_t fdTsStartTime;
174 std::vector<Double_t> fvdPrevMsTime;
175 Double_t fdMsTime;
176 UInt_t fuMsIndex;
178 std::map<stsxyter::MessType, UInt_t> fmMsgCounter;
180 UInt_t fuCurrDpbId;
187 Double_t fdStartTime;
189 std::chrono::steady_clock::time_point
193 std::vector<stsxyter::FinalHit>
195
203 std::vector<TH1*> fhHodoChanCntRaw;
204 std::vector<TH2*> fhHodoChanAdcRaw;
205 std::vector<TProfile*> fhHodoChanAdcRawProf;
206 std::vector<TH2*> fhHodoChanAdcCal;
207 std::vector<TProfile*> fhHodoChanAdcCalProf;
208 std::vector<TH2*> fhHodoChanRawTs;
209 std::vector<TH2*> fhHodoChanMissEvt;
210 std::vector<TH2*> fhHodoChanMissEvtEvo;
211 std::vector<TH2*> fhHodoChanHitRateEvo;
212 std::vector<TProfile*> fhHodoChanHitRateProf;
213 std::vector<TH2*> fhHodoChanDistT;
215 std::vector<std::vector<TH1*>> fhHodoFiberCnt;
216 std::vector<std::vector<TH2*>> fhHodoFiberAdc;
217 std::vector<std::vector<TProfile*>> fhHodoFiberAdcProf;
218 std::vector<std::vector<TH2*>> fhHodoFiberHitRateEvo;
222 Double_t fdTimeCoincLimit = 100.0;
224 std::vector<TH2*> fhHodoFiberCoincMapXY;
225 std::vector<TH1*> fhHodoFiberCoincTimeXY;
226 std::vector<TH2*> fhHodoFiberCoincWalkXY_X;
227 std::vector<TH2*> fhHodoFiberCoincWalkXY_Y;
228 std::vector<TH2*> fhHodoFiberCoincMapSameAB;
229 std::vector<TH1*> fhHodoFiberCoincTimeSameAB;
230 std::vector<TH2*> fhHodoFiberCoincMapDiffAB;
231 std::vector<TH1*> fhHodoFiberCoincTimeDiffAB;
238 std::vector<std::vector<TH2*>> fhHodoFullCoincTimeWalk;
240 std::vector<std::vector<TH2*>> fhHodoFullCoincPosEvo;
246
250 std::vector<Int_t> fviTimeSecLastRateUpdate;
251 std::vector<std::vector<Double_t>> fvdChanCountsSinceLastRateUpdate;
252 std::vector<std::vector<Double_t>> fdHodoChanLastTimeForDist;
254 std::vector<Double_t> fvdPreviousHitTimePerAsic;
255
257 TCanvas* fcSummary;
258 std::vector<TCanvas*> fcHodoSummaryRaw;
259 std::vector<TCanvas*> fcHodoSummaryFiber;
266
267 void ProcessHitInfo(stsxyter::Message mess, const UInt_t& uHodoIdx, const UInt_t& uMsIdx);
268 void ProcessTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx = 0, UInt_t uMsIdx = 0);
271
274
275 ClassDef(CbmCosy2019MonitorAlgoHodo, 1)
276};
277
278#endif
UInt_t fuDpbId
Settings from parameter file => For now use only accessors!
std::vector< TH2 * > fhHodoFiberCoincMapXY
+/- in clock cycles
static const Int_t kiMaxNbFlibLinks
Constants.
CbmCosy2019MonitorAlgoHodo operator=(const CbmCosy2019MonitorAlgoHodo &)
std::vector< std::vector< TH2 * > > fhHodoFullCoincTimeWalk
TH1 * fhHodoFullCoincRateEvo
[ Hodo ][ Axis ]
void SetDpbId(UInt_t uDpbId=0x5b75)
std::vector< std::vector< TH2 * > > fhHodoFiberHitRateEvo
[ Hodo ][ Axis ]
std::vector< Double_t > fvdPrevMsTime
End Time in ns of current TS Core from the index of the first MS first component.
std::chrono::steady_clock::time_point ftStartTimeUnix
Double_t fdMsTime
Header time of previous MS per link.
void SetHodoElinkIdx(UInt_t uElinkHodoA=5, UInt_t uElinkHodoB=10)
const UInt_t kuChannelToPlaneMap[kuNbChanPerAsic]
Map from channel index to PMT pixel.
std::vector< Double_t > fvdPreviousHitTimePerAsic
std::map< stsxyter::MessType, UInt_t > fmMsgCounter
void SetHodoInvertY(Bool_t bInvHodoA=kFALSE, Bool_t bInvHodoB=kTRUE)
Default set closest cosmic setup stack.
std::vector< stsxyter::FinalHit > fvmHitsInMs
Hits time-sorting.
Int_t fiRunStartDateTimeSec
Temp holder until Current equipment ID is properly filled in MS.
std::vector< TH2 * > fhHodoChanMissEvtEvo
[ Hodo ]
Double_t fdTimeOffsetNs
User settings: Data correction parameters.
std::vector< std::vector< TProfile * > > fhHodoFiberAdcProf
[ Hodo ][ Axis ]
std::vector< std::vector< Double_t > > fvdChanCountsSinceLastRateUpdate
[ Hodo ]
void AddMsComponentToList(size_t component, UShort_t usDetectorId)
Bool_t fbDebugMonitorMode
Switch ON the filling of a minimal set of histograms.
std::vector< TH1 * > fhHodoFiberCoincTimeSameAB
[ Axis ]
Int_t fiBinSizeDatePlots
Start of run time since "epoch" in s, for the plots with date as X axis.
void SetHodoSwapXY(Bool_t bSwapHodoA=kFALSE, Bool_t bSwapHodoB=kTRUE)
Default set for mMUCH FMC slots 8 and 9.
std::vector< TH2 * > fhHodoChanDistT
[ Hodo ]
Double_t fdTsStopTimeCore
Time in ns of current TS from the index of the first MS first component.
void SetHodoInvertX(Bool_t bInvHodoA=kFALSE, Bool_t bInvHodoB=kTRUE)
Default set closest cosmic setup stack.
std::vector< Int_t > fviTimeSecLastRateUpdate
std::vector< TH1 * > fhHodoFiberCoincTimeDiffAB
[ Axis ]
std::vector< TH2 * > fhHodoChanRawTs
[ Hodo ]
std::vector< TH2 * > fhHodoFiberCoincMapSameAB
[ Hodo ]
const UInt_t kuChannelToPixelMap[kuNbChanPerAsic]
Map from channel index to Hodoscope Fiber.
const UInt_t kuChannelToFiberMap[kuNbChanPerAsic]
void SetMonitorMode(Bool_t bFlagIn=kTRUE)
Bool_t fbMonitorMode
Default set closest cosmic setup stack.
TH1 * fhHodoMessType
All hits (time in bins, ADC in bins, asic, channel) in last MS, sorted with "<" operator.
static const UInt_t kuNbHodos
Max Nb of eLinks for this sDPB: 2 GBTx with 42 eLinks each.
std::vector< std::vector< Double_t > > fdHodoChanLastTimeForDist
[ Hodo ][ Chan ]
void ProcessEpochInfo(stsxyter::Message mess)
static const UInt_t kuNbChanPerAsic
Per hodoscope = X and Y.
std::vector< TH2 * > fhHodoChanMissEvt
[ Hodo ]
Bool_t ProcessTs(const fles::Timeslice &ts)
std::vector< TCanvas * > fcHodoSummaryRaw
std::vector< Bool_t > fvbMaskedComponents
Switch ON the filling of a additional set of histograms.
std::vector< TProfile * > fhHodoChanAdcRawProf
[ Hodo ]
std::vector< TProfile * > fhHodoChanAdcCalProf
[ Hodo ]
std::vector< TH2 * > fhHodoFiberCoincWalkXY_Y
[ Hodo ]
void SetTimeOffsetNs(Double_t dOffsetIn=0.0)
std::vector< TH1 * > fhHodoChanCntRaw
Raw = ASIC channels.
void ProcessStatusInfo(stsxyter::Message mess)
Double_t fdTimeCoincLimitNs
+/- in clock cycles
std::vector< std::vector< TH2 * > > fhHodoFiberAdc
[ Hodo ][ Axis ]
std::vector< std::vector< TH1 * > > fhHodoFiberCnt
static const UInt_t kuNbAxis
Nb of hodoscopes = Nb FEBs = Nb ASICs.
Bool_t ProcessMs(const fles::Timeslice &ts, size_t uMsCompIdx, size_t uMsIdx)
std::vector< TH2 * > fhHodoChanAdcRaw
[ Hodo ]
ULong64_t fulCurrentTsIdx
Map from channel index to Hodoscope Axis (X or Y)
std::vector< TH2 * > fhHodoFiberCoincWalkXY_X
[ Hodo ]
std::vector< TCanvas * > fcHodoSummaryFiber
std::vector< TH2 * > fhHodoChanAdcCal
[ Hodo ]
CbmCosy2019MonitorAlgoHodo(const CbmCosy2019MonitorAlgoHodo &)
std::vector< TH2 * > fhHodoFiberCoincMapDiffAB
[ Axis ]
void ProcessTsMsbInfo(stsxyter::Message mess, UInt_t uMessIdx=0, UInt_t uMsIdx=0)
std::vector< TH1 * > fhHodoFiberCoincTimeXY
[ Hodo ]
std::vector< std::vector< TH2 * > > fhHodoFullCoincPosEvo
Bool_t ProcessTs(const fles::Timeslice &ts, size_t)
UInt_t fuMsIndex
Start Time in ns of current MS from its index field in header.
void ProcessHitInfo(stsxyter::Message mess, const UInt_t &uHodoIdx, const UInt_t &uMsIdx)
std::vector< TProfile * > fhHodoChanHitRateProf
[ Hodo ]
UInt_t fuCurrDpbId
Current equipment ID, tells from which DPB the current MS is originating.
UInt_t fvuCurrentTsMsbCycle
Current TS MSB for each DPB.
std::vector< TH2 * > fhHodoChanHitRateEvo
[ Hodo ]
static constexpr double kdClockCycleNs